@useloops/design-system 1.4.77 → 1.4.78
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/esm/index.js +4 -4
- package/dist/index.js +4 -4
- package/package.json +4 -5
package/dist/esm/index.js
CHANGED
|
@@ -22,22 +22,22 @@ object-assign
|
|
|
22
22
|
@license MIT
|
|
23
23
|
*/function Ln(){if(Sn)return Cn;Sn=1;var e=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;return Cn=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var a={},r=0;r<10;r++)a["_"+String.fromCharCode(r)]=r;if("0123456789"!==Object.getOwnPropertyNames(a).map((function(e){return a[e]})).join(""))return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach((function(e){n[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}()?Object.assign:function(n,i){for(var t,o,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(n),l=1;l<arguments.length;l++){for(var c in t=Object(arguments[l]))a.call(t,c)&&(s[c]=t[c]);if(e){o=e(t);for(var d=0;d<o.length;d++)r.call(t,o[d])&&(s[o[d]]=t[o[d]])}}return s},Cn}function Bn(){if(En)return On;En=1;return On="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function Vn(){return _n?Mn:(_n=1,Mn=Function.call.bind(Object.prototype.hasOwnProperty))}if("production"!==process.env.NODE_ENV){var Hn=Rn();zn.exports=function(){if(Tn)return Nn;Tn=1;var e=Rn(),a=Ln(),r=Bn(),n=Vn(),i=function(){if(Dn)return An;Dn=1;var e=function(){};if("production"!==process.env.NODE_ENV){var a=Bn(),r={},n=Vn();e=function(e){var a="Warning: "+e;"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}}}function i(i,t,o,s,l){if("production"!==process.env.NODE_ENV)for(var c in i)if(n(i,c)){var d;try{if("function"!=typeof i[c]){var u=Error((s||"React class")+": "+o+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw u.name="Invariant Violation",u}d=i[c](t,c,s,o,null,a)}catch(e){d=e}if(!d||d instanceof Error||e((s||"React class")+": type specification of "+o+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof d+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),d instanceof Error&&!(d.message in r)){r[d.message]=!0;var h=l?l():"";e("Failed "+o+" type: "+d.message+(null!=h?h:""))}}}return i.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(r={})},An=i}(),t=function(){};function o(){return null}return"production"!==process.env.NODE_ENV&&(t=function(e){var a="Warning: "+e;"undefined"!=typeof console&&console.error(a);try{throw new Error(a)}catch(e){}}),Nn=function(s,l){var c="function"==typeof Symbol&&Symbol.iterator,d="<<anonymous>>",u={array:p("array"),bigint:p("bigint"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:g(o),arrayOf:function(e){return g((function(a,n,i,t,o){if("function"!=typeof e)return new m("Property `"+o+"` of component `"+i+"` has invalid PropType notation inside arrayOf.");var s=a[n];if(!Array.isArray(s))return new m("Invalid "+t+" `"+o+"` of type `"+k(s)+"` supplied to `"+i+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,i,t,o+"["+l+"]",r);if(c instanceof Error)return c}return null}))},element:g((function(e,a,r,n,i){var t=e[a];return s(t)?null:new m("Invalid "+n+" `"+i+"` of type `"+k(t)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:g((function(a,r,n,i,t){var o=a[r];return e.isValidElementType(o)?null:new m("Invalid "+i+" `"+t+"` of type `"+k(o)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return g((function(a,r,n,i,t){if(!(a[r]instanceof e)){var o=e.name||d;return new m("Invalid "+i+" `"+t+"` of type `"+((s=a[r]).constructor&&s.constructor.name?s.constructor.name:d)+"` supplied to `"+n+"`, expected instance of `"+o+"`.")}var s;return null}))},node:g((function(e,a,r,n,i){return f(e[a])?null:new m("Invalid "+n+" `"+i+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return g((function(a,i,t,o,s){if("function"!=typeof e)return new m("Property `"+s+"` of component `"+t+"` has invalid PropType notation inside objectOf.");var l=a[i],c=k(l);if("object"!==c)return new m("Invalid "+o+" `"+s+"` of type `"+c+"` supplied to `"+t+"`, expected an object.");for(var d in l)if(n(l,d)){var u=e(l,d,t,o,s+"."+d,r);if(u instanceof Error)return u}return null}))},oneOf:function(e){return Array.isArray(e)?g((function(a,r,n,i,t){for(var o=a[r],s=0;s<e.length;s++)if(h(o,e[s]))return null;var l=JSON.stringify(e,(function(e,a){return"symbol"===y(a)?String(a):a}));return new m("Invalid "+i+" `"+t+"` of value `"+String(o)+"` supplied to `"+n+"`, expected one of "+l+".")})):("production"!==process.env.NODE_ENV&&t(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),o)},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&t("Invalid argument supplied to oneOfType, expected an instance of array."),o;for(var a=0;a<e.length;a++){var i=e[a];if("function"!=typeof i)return t("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+v(i)+" at index "+a+"."),o}return g((function(a,i,t,o,s){for(var l=[],c=0;c<e.length;c++){var d=(0,e[c])(a,i,t,o,s,r);if(null==d)return null;d.data&&n(d.data,"expectedType")&&l.push(d.data.expectedType)}return new m("Invalid "+o+" `"+s+"` supplied to `"+t+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")}))},shape:function(e){return g((function(a,n,i,t,o){var s=a[n],l=k(s);if("object"!==l)return new m("Invalid "+t+" `"+o+"` of type `"+l+"` supplied to `"+i+"`, expected `object`.");for(var c in e){var d=e[c];if("function"!=typeof d)return b(i,t,o,c,y(d));var u=d(s,c,i,t,o+"."+c,r);if(u)return u}return null}))},exact:function(e){return g((function(i,t,o,s,l){var c=i[t],d=k(c);if("object"!==d)return new m("Invalid "+s+" `"+l+"` of type `"+d+"` supplied to `"+o+"`, expected `object`.");var u=a({},i[t],e);for(var h in u){var g=e[h];if(n(e,h)&&"function"!=typeof g)return b(o,s,l,h,y(g));if(!g)return new m("Invalid "+s+" `"+l+"` key `"+h+"` supplied to `"+o+"`.\nBad object: "+JSON.stringify(i[t],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var p=g(c,h,o,s,l+"."+h,r);if(p)return p}return null}))}};function h(e,a){return e===a?0!==e||1/e==1/a:e!=e&&a!=a}function m(e,a){this.message=e,this.data=a&&"object"==typeof a?a:{},this.stack=""}function g(e){if("production"!==process.env.NODE_ENV)var a={},n=0;function i(i,o,s,c,u,h,g){if(c=c||d,h=h||s,g!==r){if(l){var p=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw p.name="Invariant Violation",p}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var b=c+":"+s;!a[b]&&n<3&&(t("You are manually calling a React.PropTypes validation function for the `"+h+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),a[b]=!0,n++)}}return null==o[s]?i?null===o[s]?new m("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `null`."):new m("The "+u+" `"+h+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(o,s,c,u,h)}var o=i.bind(null,!1);return o.isRequired=i.bind(null,!0),o}function p(e){return g((function(a,r,n,i,t,o){var s=a[r];return k(s)!==e?new m("Invalid "+i+" `"+t+"` of type `"+y(s)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function b(e,a,r,n,i){return new m((e||"React class")+": "+a+" type `"+r+"."+n+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+i+"`.")}function f(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(f);if(null===e||s(e))return!0;var a=function(e){var a=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof a)return a}(e);if(!a)return!1;var r,n=a.call(e);if(a!==e.entries){for(;!(r=n.next()).done;)if(!f(r.value))return!1}else for(;!(r=n.next()).done;){var i=r.value;if(i&&!f(i[1]))return!1}return!0;default:return!1}}function k(e){var a=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,a){return"symbol"===e||!!a&&("Symbol"===a["@@toStringTag"]||"function"==typeof Symbol&&a instanceof Symbol)}(a,e)?"symbol":a}function y(e){if(null==e)return""+e;var a=k(e);if("object"===a){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return a}function v(e){var a=y(e);switch(a){case"array":case"object":return"an "+a;case"boolean":case"date":case"regexp":return"a "+a;default:return a}}return m.prototype=Error.prototype,u.checkPropTypes=i,u.resetWarningCache=i.resetWarningCache,u.PropTypes=u,u},Nn}()(Hn.isElement,!0)}else zn.exports=function(){if(Fn)return In;Fn=1;var e=Bn();function a(){}function r(){}return r.resetWarningCache=a,In=function(){function n(a,r,n,i,t,o){if(o!==e){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function i(){return n}n.isRequired=n;var t={array:n,bigint:n,bool:n,func:n,number:n,object:n,string:n,symbol:n,any:n,arrayOf:i,element:n,elementType:n,instanceOf:i,node:n,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:r,resetWarningCache:a};return t.PropTypes=t,t},In}()();var Wn=la(zn.exports);var Un=function(){function e(e){var a=this;this._insertTag=function(e){var r;r=0===a.tags.length?a.insertionPoint?a.insertionPoint.nextSibling:a.prepend?a.container.firstChild:a.before:a.tags[a.tags.length-1].nextSibling,a.container.insertBefore(e,r),a.tags.push(e)},this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container,this.prepend=e.prepend,this.insertionPoint=e.insertionPoint,this.before=null}var a=e.prototype;return a.hydrate=function(e){e.forEach(this._insertTag)},a.insert=function(e){this.ctr%(this.isSpeedy?65e3:1)==0&&this._insertTag(function(e){var a=document.createElement("style");return a.setAttribute("data-emotion",e.key),void 0!==e.nonce&&a.setAttribute("nonce",e.nonce),a.appendChild(document.createTextNode("")),a.setAttribute("data-s",""),a}(this));var a=this.tags[this.tags.length-1];if(this.isSpeedy){var r=function(e){if(e.sheet)return e.sheet;for(var a=0;a<document.styleSheets.length;a++)if(document.styleSheets[a].ownerNode===e)return document.styleSheets[a]}(a);try{r.insertRule(e,r.cssRules.length)}catch(e){}}else a.appendChild(document.createTextNode(e));this.ctr++},a.flush=function(){this.tags.forEach((function(e){var a;return null==(a=e.parentNode)?void 0:a.removeChild(e)})),this.tags=[],this.ctr=0},e}(),Gn="-ms-",Kn="-moz-",Zn="-webkit-",Jn="comm",Yn="rule",Xn="decl",Qn="@keyframes",ei=Math.abs,ai=String.fromCharCode,ri=Object.assign;function ni(e){return e.trim()}function ii(e,a,r){return e.replace(a,r)}function ti(e,a){return e.indexOf(a)}function oi(e,a){return 0|e.charCodeAt(a)}function si(e,a,r){return e.slice(a,r)}function li(e){return e.length}function ci(e){return e.length}function di(e,a){return a.push(e),e}var ui=1,hi=1,mi=0,gi=0,pi=0,bi="";function fi(e,a,r,n,i,t,o){return{value:e,root:a,parent:r,type:n,props:i,children:t,line:ui,column:hi,length:o,return:""}}function ki(e,a){return ri(fi("",null,null,"",null,null,0),e,{length:-e.length},a)}function yi(){return pi=gi<mi?oi(bi,gi++):0,hi++,10===pi&&(hi=1,ui++),pi}function vi(){return oi(bi,gi)}function wi(){return gi}function zi(e,a){return si(bi,e,a)}function ji(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function xi(e){return ui=hi=1,mi=li(bi=e),gi=0,[]}function $i(e){return bi="",e}function qi(e){return ni(zi(gi-1,Oi(91===e?e+2:40===e?e+1:e)))}function Ci(e){for(;(pi=vi())&&pi<33;)yi();return ji(e)>2||ji(pi)>3?"":" "}function Si(e,a){for(;--a&&yi()&&!(pi<48||pi>102||pi>57&&pi<65||pi>70&&pi<97););return zi(e,wi()+(a<6&&32==vi()&&32==yi()))}function Oi(e){for(;yi();)switch(pi){case e:return gi;case 34:case 39:34!==e&&39!==e&&Oi(pi);break;case 40:41===e&&Oi(e);break;case 92:yi()}return gi}function Ei(e,a){for(;yi()&&e+pi!==57&&(e+pi!==84||47!==vi()););return"/*"+zi(a,gi-1)+"*"+ai(47===e?e:yi())}function Mi(e){for(;!ji(vi());)yi();return zi(e,gi)}function _i(e){return $i(Ai("",null,null,null,[""],e=xi(e),0,[0],e))}function Ai(e,a,r,n,i,t,o,s,l){for(var c=0,d=0,u=o,h=0,m=0,g=0,p=1,b=1,f=1,k=0,y="",v=i,w=t,z=n,j=y;b;)switch(g=k,k=yi()){case 40:if(108!=g&&58==oi(j,u-1)){-1!=ti(j+=ii(qi(k),"&","&\f"),"&\f")&&(f=-1);break}case 34:case 39:case 91:j+=qi(k);break;case 9:case 10:case 13:case 32:j+=Ci(g);break;case 92:j+=Si(wi()-1,7);continue;case 47:switch(vi()){case 42:case 47:di(Ni(Ei(yi(),wi()),a,r),l);break;default:j+="/"}break;case 123*p:s[c++]=li(j)*f;case 125*p:case 59:case 0:switch(k){case 0:case 125:b=0;case 59+d:-1==f&&(j=ii(j,/\f/g,"")),m>0&&li(j)-u&&di(m>32?Ti(j+";",n,r,u-1):Ti(ii(j," ","")+";",n,r,u-2),l);break;case 59:j+=";";default:if(di(z=Di(j,a,r,c,d,i,s,y,v=[],w=[],u),t),123===k)if(0===d)Ai(j,a,z,z,v,t,u,s,w);else switch(99===h&&110===oi(j,3)?100:h){case 100:case 108:case 109:case 115:Ai(e,z,z,n&&di(Di(e,z,z,0,0,i,s,y,i,v=[],u),w),i,w,u,s,n?v:w);break;default:Ai(j,z,z,z,[""],w,0,s,w)}}c=d=m=0,p=f=1,y=j="",u=o;break;case 58:u=1+li(j),m=g;default:if(p<1)if(123==k)--p;else if(125==k&&0==p++&&125==(pi=gi>0?oi(bi,--gi):0,hi--,10===pi&&(hi=1,ui--),pi))continue;switch(j+=ai(k),k*p){case 38:f=d>0?1:(j+="\f",-1);break;case 44:s[c++]=(li(j)-1)*f,f=1;break;case 64:45===vi()&&(j+=qi(yi())),h=vi(),d=u=li(y=j+=Mi(wi())),k++;break;case 45:45===g&&2==li(j)&&(p=0)}}return t}function Di(e,a,r,n,i,t,o,s,l,c,d){for(var u=i-1,h=0===i?t:[""],m=ci(h),g=0,p=0,b=0;g<n;++g)for(var f=0,k=si(e,u+1,u=ei(p=o[g])),y=e;f<m;++f)(y=ni(p>0?h[f]+" "+k:ii(k,/&\f/g,h[f])))&&(l[b++]=y);return fi(e,a,r,0===i?Yn:s,l,c,d)}function Ni(e,a,r){return fi(e,a,r,Jn,ai(pi),si(e,2,-2),0)}function Ti(e,a,r,n){return fi(e,a,r,Xn,si(e,0,n),si(e,n+1,-1),n)}function Ii(e,a){for(var r="",n=ci(e),i=0;i<n;i++)r+=a(e[i],i,e,a)||"";return r}function Fi(e,a,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case Xn:return e.return=e.return||e.value;case Jn:return"";case Qn:return e.return=e.value+"{"+Ii(e.children,n)+"}";case Yn:e.value=e.props.join(",")}return li(r=Ii(e.children,n))?e.return=e.value+"{"+r+"}":""}function Pi(e){var a=ci(e);return function(r,n,i,t){for(var o="",s=0;s<a;s++)o+=e[s](r,n,i,t)||"";return o}}function Ri(e){var a=Object.create(null);return function(r){return void 0===a[r]&&(a[r]=e(r)),a[r]}}var Li="undefined"!=typeof document,Bi=function(e,a,r){for(var n=0,i=0;n=i,i=vi(),38===n&&12===i&&(a[r]=1),!ji(i);)yi();return zi(e,gi)},Vi=function(e,a){return $i(function(e,a){var r=-1,n=44;do{switch(ji(n)){case 0:38===n&&12===vi()&&(a[r]=1),e[r]+=Bi(gi-1,a,r);break;case 2:e[r]+=qi(n);break;case 4:if(44===n){e[++r]=58===vi()?"&\f":"",a[r]=e[r].length;break}default:e[r]+=ai(n)}}while(n=yi());return e}(xi(e),a))},Hi=new WeakMap,Wi=function(e){if("rule"===e.type&&e.parent&&!(e.length<1)){for(var a=e.value,r=e.parent,n=e.column===r.column&&e.line===r.line;"rule"!==r.type;)if(!(r=r.parent))return;if((1!==e.props.length||58===a.charCodeAt(0)||Hi.get(r))&&!n){Hi.set(e,!0);for(var i=[],t=Vi(a,i),o=r.props,s=0,l=0;s<t.length;s++)for(var c=0;c<o.length;c++,l++)e.props[l]=i[s]?t[s].replace(/&\f/g,o[c]):o[c]+" "+t[s]}}},Ui=function(e){if("decl"===e.type){var a=e.value;108===a.charCodeAt(0)&&98===a.charCodeAt(2)&&(e.return="",e.value="")}};function Gi(e,a){switch(function(e,a){return 45^oi(e,0)?(((a<<2^oi(e,0))<<2^oi(e,1))<<2^oi(e,2))<<2^oi(e,3):0}(e,a)){case 5103:return Zn+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Zn+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Zn+e+Kn+e+Gn+e+e;case 6828:case 4268:return Zn+e+Gn+e+e;case 6165:return Zn+e+Gn+"flex-"+e+e;case 5187:return Zn+e+ii(e,/(\w+).+(:[^]+)/,Zn+"box-$1$2"+Gn+"flex-$1$2")+e;case 5443:return Zn+e+Gn+"flex-item-"+ii(e,/flex-|-self/,"")+e;case 4675:return Zn+e+Gn+"flex-line-pack"+ii(e,/align-content|flex-|-self/,"")+e;case 5548:return Zn+e+Gn+ii(e,"shrink","negative")+e;case 5292:return Zn+e+Gn+ii(e,"basis","preferred-size")+e;case 6060:return Zn+"box-"+ii(e,"-grow","")+Zn+e+Gn+ii(e,"grow","positive")+e;case 4554:return Zn+ii(e,/([^-])(transform)/g,"$1"+Zn+"$2")+e;case 6187:return ii(ii(ii(e,/(zoom-|grab)/,Zn+"$1"),/(image-set)/,Zn+"$1"),e,"")+e;case 5495:case 3959:return ii(e,/(image-set\([^]*)/,Zn+"$1$`$1");case 4968:return ii(ii(e,/(.+:)(flex-)?(.*)/,Zn+"box-pack:$3"+Gn+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Zn+e+e;case 4095:case 3583:case 4068:case 2532:return ii(e,/(.+)-inline(.+)/,Zn+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(li(e)-1-a>6)switch(oi(e,a+1)){case 109:if(45!==oi(e,a+4))break;case 102:return ii(e,/(.+:)(.+)-([^]+)/,"$1"+Zn+"$2-$3$1"+Kn+(108==oi(e,a+3)?"$3":"$2-$3"))+e;case 115:return~ti(e,"stretch")?Gi(ii(e,"stretch","fill-available"),a)+e:e}break;case 4949:if(115!==oi(e,a+1))break;case 6444:switch(oi(e,li(e)-3-(~ti(e,"!important")&&10))){case 107:return ii(e,":",":"+Zn)+e;case 101:return ii(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+Zn+(45===oi(e,14)?"inline-":"")+"box$3$1"+Zn+"$2$3$1"+Gn+"$2box$3")+e}break;case 5936:switch(oi(e,a+11)){case 114:return Zn+e+Gn+ii(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Zn+e+Gn+ii(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Zn+e+Gn+ii(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return Zn+e+Gn+e+e}return e}var Ki=Li?void 0:function(e){var a=new WeakMap;return function(r){if(a.has(r))return a.get(r);var n=e(r);return a.set(r,n),n}}((function(){return Ri((function(){return{}}))})),Zi=[function(e,a,r,n){if(e.length>-1&&!e.return)switch(e.type){case Xn:e.return=Gi(e.value,e.length);break;case Qn:return Ii([ki(e,{value:ii(e.value,"@","@"+Zn)})],n);case Yn:if(e.length)return function(e,a){return e.map(a).join("")}(e.props,(function(a){switch(function(e,a){return(e=a.exec(e))?e[0]:e}(a,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Ii([ki(e,{props:[ii(a,/:(read-\w+)/,":-moz-$1")]})],n);case"::placeholder":return Ii([ki(e,{props:[ii(a,/:(plac\w+)/,":"+Zn+"input-$1")]}),ki(e,{props:[ii(a,/:(plac\w+)/,":-moz-$1")]}),ki(e,{props:[ii(a,/:(plac\w+)/,Gn+"input-$1")]})],n)}return""}))}}],Ji=function(e){var a=e.key;if(Li&&"css"===a){var r=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(r,(function(e){-1!==e.getAttribute("data-emotion").indexOf(" ")&&(document.head.appendChild(e),e.setAttribute("data-s",""))}))}var n,i,t=e.stylisPlugins||Zi,o={},s=[];Li&&(n=e.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+a+' "]'),(function(e){for(var a=e.getAttribute("data-emotion").split(" "),r=1;r<a.length;r++)o[a[r]]=!0;s.push(e)})));var l,c=[Wi,Ui];if(Ki){var d=[Fi],u=Pi(c.concat(t,d)),h=Ki(t)(a),m=function(e,a){var r=a.name;return void 0===h[r]&&(h[r]=Ii(_i(e?e+"{"+a.styles+"}":a.styles),u)),h[r]};i=function(e,a,r,n){var i=a.name,t=m(e,a);return void 0===f.compat?(n&&(f.inserted[i]=!0),t):n?void(f.inserted[i]=t):t}}else{var g,p=[Fi,(l=function(e){g.insert(e)},function(e){e.root||(e=e.return)&&l(e)})],b=Pi(c.concat(t,p));i=function(e,a,r,n){g=r,Ii(_i(e?e+"{"+a.styles+"}":a.styles),b),n&&(f.inserted[a.name]=!0)}}var f={key:a,sheet:new Un({key:a,container:n,nonce:e.nonce,speedy:e.speedy,prepend:e.prepend,insertionPoint:e.insertionPoint}),nonce:e.nonce,inserted:o,registered:{},insert:i};return f.sheet.hydrate(s),f};let Yi;function Xi(e){const{injectFirst:a,children:r}=e;return a&&Yi?pa.jsx(Te,{value:Yi,children:r}):r}function Qi(e){const{styles:a,defaultTheme:r={}}=e,n="function"==typeof a?e=>{return a(null==(n=e)||0===Object.keys(n).length?r:e);var n}:a;return pa.jsx(Ie,{styles:n})}"object"==typeof document&&(Yi=Ji({key:"css",prepend:!0})),"production"!==process.env.NODE_ENV&&(Xi.propTypes={children:Wn.node,injectFirst:Wn.bool}),"production"!==process.env.NODE_ENV&&(Qi.propTypes={defaultTheme:Wn.object,styles:Wn.oneOfType([Wn.array,Wn.string,Wn.object,Wn.func])});var et=Object.freeze({__proto__:null,GlobalStyles:Qi,StyledEngineProvider:Xi,ThemeContext:Fe,css:Pe,default:
|
|
24
24
|
/**
|
|
25
|
-
* @mui/styled-engine v5.16.
|
|
25
|
+
* @mui/styled-engine v5.16.14
|
|
26
26
|
*
|
|
27
27
|
* @license MIT
|
|
28
28
|
* This source code is licensed under the MIT license found in the
|
|
29
29
|
* LICENSE file in the root directory of this source tree.
|
|
30
30
|
*/
|
|
31
|
-
function(e,a){const r=sa(e,a);return"production"!==process.env.NODE_ENV?(...a)=>{const n="string"==typeof e?`"${e}"`:"component";return 0===a.length?console.error([`MUI: Seems like you called \`styled(${n})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join("\n")):a.some((e=>void 0===e))&&console.error(`MUI: the styled(${n})(...args) API requires all its args to be defined.`),r(...a)}:r},internal_processStyles:(e,a)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=a(e.__emotion_styles))},keyframes:Re});function at(e){if("object"!=typeof e||null===e)return!1;const a=Object.getPrototypeOf(e);return!(null!==a&&a!==Object.prototype&&null!==Object.getPrototypeOf(a)||Symbol.toStringTag in e||Symbol.iterator in e)}function rt(e){if(!at(e))return e;const a={};return Object.keys(e).forEach((r=>{a[r]=rt(e[r])})),a}function nt(e,a,r={clone:!0}){const n=r.clone?fn({},e):e;return at(e)&&at(a)&&Object.keys(a).forEach((i=>{at(a[i])&&Object.prototype.hasOwnProperty.call(e,i)&&at(e[i])?n[i]=nt(e[i],a[i],r):r.clone?n[i]=at(a[i])?rt(a[i]):a[i]:n[i]=a[i]})),n}var it=Object.freeze({__proto__:null,default:nt,isPlainObject:at});const tt=["values","unit","step"];function ot(e){const{values:a={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5}=e,i=kn(e,tt),t=(e=>{const a=Object.keys(e).map((a=>({key:a,val:e[a]})))||[];return a.sort(((e,a)=>e.val-a.val)),a.reduce(((e,a)=>fn({},e,{[a.key]:a.val})),{})})(a),o=Object.keys(t);function s(e){return`@media (min-width:${"number"==typeof a[e]?a[e]:e}${r})`}function l(e){return`@media (max-width:${("number"==typeof a[e]?a[e]:e)-n/100}${r})`}function c(e,i){const t=o.indexOf(i);return`@media (min-width:${"number"==typeof a[e]?a[e]:e}${r}) and (max-width:${(-1!==t&&"number"==typeof a[o[t]]?a[o[t]]:i)-n/100}${r})`}return fn({keys:o,values:t,up:s,down:l,between:c,only:function(e){return o.indexOf(e)+1<o.length?c(e,o[o.indexOf(e)+1]):s(e)},not:function(e){const a=o.indexOf(e);return 0===a?s(o[1]):a===o.length-1?l(o[a]):c(e,o[o.indexOf(e)+1]).replace("@media","@media not all and")},unit:r},i)}const st={borderRadius:4},lt="production"!==process.env.NODE_ENV?Wn.oneOfType([Wn.number,Wn.string,Wn.object,Wn.array]):{};function ct(e,a){return a?nt(e,a,{clone:!1}):e}const dt={xs:0,sm:600,md:900,lg:1200,xl:1536},ut={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${dt[e]}px)`};function ht(e,a,r){const n=e.theme||{};if(Array.isArray(a)){const e=n.breakpoints||ut;return a.reduce(((n,i,t)=>(n[e.up(e.keys[t])]=r(a[t]),n)),{})}if("object"==typeof a){const e=n.breakpoints||ut;return Object.keys(a).reduce(((n,i)=>{if(-1!==Object.keys(e.values||dt).indexOf(i)){n[e.up(i)]=r(a[i],i)}else{const e=i;n[e]=a[e]}return n}),{})}return r(a)}function mt(e){if("string"!=typeof e)throw new Error("production"!==process.env.NODE_ENV?"MUI: `capitalize(string)` expects a string argument.":yn(7));return e.charAt(0).toUpperCase()+e.slice(1)}var gt=Object.freeze({__proto__:null,default:mt});function pt(e,a,r=!0){if(!a||"string"!=typeof a)return null;if(e&&e.vars&&r){const r=`vars.${a}`.split(".").reduce(((e,a)=>e&&e[a]?e[a]:null),e);if(null!=r)return r}return a.split(".").reduce(((e,a)=>e&&null!=e[a]?e[a]:null),e)}function bt(e,a,r,n=r){let i;return i="function"==typeof e?e(r):Array.isArray(e)?e[r]||n:pt(e,r)||n,a&&(i=a(i,n,e)),i}function ft(e){const{prop:a,cssProperty:r=e.prop,themeKey:n,transform:i}=e,t=e=>{if(null==e[a])return null;const t=e[a],o=pt(e.theme,n)||{};return ht(e,t,(e=>{let n=bt(o,i,e);return e===n&&"string"==typeof e&&(n=bt(o,i,`${a}${"default"===e?"":mt(e)}`,e)),!1===r?n:{[r]:n}}))};return t.propTypes="production"!==process.env.NODE_ENV?{[a]:lt}:{},t.filterProps=[a],t}const kt={m:"margin",p:"padding"},yt={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},vt={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},wt=function(e){const a={};return r=>(void 0===a[r]&&(a[r]=e(r)),a[r])}((e=>{if(e.length>2){if(!vt[e])return[e];e=vt[e]}const[a,r]=e.split(""),n=kt[a],i=yt[r]||"";return Array.isArray(i)?i.map((e=>n+e)):[n+i]})),zt=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],jt=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],xt=[...zt,...jt];function $t(e,a,r,n){var i;const t=null!=(i=pt(e,a,!1))?i:r;return"number"==typeof t?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&"number"!=typeof e&&console.error(`MUI: Expected ${n} argument to be a number or a string, got ${e}.`),t*e):Array.isArray(t)?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&(Number.isInteger(e)?e>t.length-1&&console.error([`MUI: The value provided (${e}) overflows.`,`The supported values are: ${JSON.stringify(t)}.`,`${e} > ${t.length-1}, you need to add the missing values.`].join("\n")):console.error([`MUI: The \`theme.${a}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${a}\` as a number.`].join("\n"))),t[e]):"function"==typeof t?t:("production"!==process.env.NODE_ENV&&console.error([`MUI: The \`theme.${a}\` value (${t}) is invalid.`,"It should be a number, an array or a function."].join("\n")),()=>{})}function qt(e){return $t(e,"spacing",8,"spacing")}function Ct(e,a){if("string"==typeof a||null==a)return a;const r=e(Math.abs(a));return a>=0?r:"number"==typeof r?-r:`-${r}`}function St(e,a,r,n){if(-1===a.indexOf(r))return null;const i=function(e,a){return r=>e.reduce(((e,n)=>(e[n]=Ct(a,r),e)),{})}(wt(r),n);return ht(e,e[r],i)}function Ot(e,a){const r=qt(e.theme);return Object.keys(e).map((n=>St(e,a,n,r))).reduce(ct,{})}function Et(e){return Ot(e,zt)}function Mt(e){return Ot(e,jt)}function _t(...e){const a=e.reduce(((e,a)=>(a.filterProps.forEach((r=>{e[r]=a})),e)),{}),r=e=>Object.keys(e).reduce(((r,n)=>a[n]?ct(r,a[n](e)):r),{});return r.propTypes="production"!==process.env.NODE_ENV?e.reduce(((e,a)=>Object.assign(e,a.propTypes)),{}):{},r.filterProps=e.reduce(((e,a)=>e.concat(a.filterProps)),[]),r}function At(e){return"number"!=typeof e?e:`${e}px solid`}function Dt(e,a){return ft({prop:e,themeKey:"borders",transform:a})}Et.propTypes="production"!==process.env.NODE_ENV?zt.reduce(((e,a)=>(e[a]=lt,e)),{}):{},Et.filterProps=zt,Mt.propTypes="production"!==process.env.NODE_ENV?jt.reduce(((e,a)=>(e[a]=lt,e)),{}):{},Mt.filterProps=jt,"production"===process.env.NODE_ENV||xt.reduce(((e,a)=>(e[a]=lt,e)),{});const Nt=Dt("border",At),Tt=Dt("borderTop",At),It=Dt("borderRight",At),Ft=Dt("borderBottom",At),Pt=Dt("borderLeft",At),Rt=Dt("borderColor"),Lt=Dt("borderTopColor"),Bt=Dt("borderRightColor"),Vt=Dt("borderBottomColor"),Ht=Dt("borderLeftColor"),Wt=Dt("outline",At),Ut=Dt("outlineColor"),Gt=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const a=$t(e.theme,"shape.borderRadius",4,"borderRadius"),r=e=>({borderRadius:Ct(a,e)});return ht(e,e.borderRadius,r)}return null};Gt.propTypes="production"!==process.env.NODE_ENV?{borderRadius:lt}:{},Gt.filterProps=["borderRadius"],_t(Nt,Tt,It,Ft,Pt,Rt,Lt,Bt,Vt,Ht,Gt,Wt,Ut);const Kt=e=>{if(void 0!==e.gap&&null!==e.gap){const a=$t(e.theme,"spacing",8,"gap"),r=e=>({gap:Ct(a,e)});return ht(e,e.gap,r)}return null};Kt.propTypes="production"!==process.env.NODE_ENV?{gap:lt}:{},Kt.filterProps=["gap"];const Zt=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const a=$t(e.theme,"spacing",8,"columnGap"),r=e=>({columnGap:Ct(a,e)});return ht(e,e.columnGap,r)}return null};Zt.propTypes="production"!==process.env.NODE_ENV?{columnGap:lt}:{},Zt.filterProps=["columnGap"];const Jt=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const a=$t(e.theme,"spacing",8,"rowGap"),r=e=>({rowGap:Ct(a,e)});return ht(e,e.rowGap,r)}return null};Jt.propTypes="production"!==process.env.NODE_ENV?{rowGap:lt}:{},Jt.filterProps=["rowGap"];function Yt(e,a){return"grey"===a?a:e}_t(Kt,Zt,Jt,ft({prop:"gridColumn"}),ft({prop:"gridRow"}),ft({prop:"gridAutoFlow"}),ft({prop:"gridAutoColumns"}),ft({prop:"gridAutoRows"}),ft({prop:"gridTemplateColumns"}),ft({prop:"gridTemplateRows"}),ft({prop:"gridTemplateAreas"}),ft({prop:"gridArea"}));function Xt(e){return e<=1&&0!==e?100*e+"%":e}_t(ft({prop:"color",themeKey:"palette",transform:Yt}),ft({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Yt}),ft({prop:"backgroundColor",themeKey:"palette",transform:Yt}));const Qt=ft({prop:"width",transform:Xt}),eo=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const a=a=>{var r,n;const i=(null==(r=e.theme)||null==(r=r.breakpoints)||null==(r=r.values)?void 0:r[a])||dt[a];return i?"px"!==(null==(n=e.theme)||null==(n=n.breakpoints)?void 0:n.unit)?{maxWidth:`${i}${e.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:Xt(a)}};return ht(e,e.maxWidth,a)}return null};eo.filterProps=["maxWidth"];const ao=ft({prop:"minWidth",transform:Xt}),ro=ft({prop:"height",transform:Xt}),no=ft({prop:"maxHeight",transform:Xt}),io=ft({prop:"minHeight",transform:Xt});ft({prop:"size",cssProperty:"width",transform:Xt}),ft({prop:"size",cssProperty:"height",transform:Xt});_t(Qt,eo,ao,ro,no,io,ft({prop:"boxSizing"}));const to={border:{themeKey:"borders",transform:At},borderTop:{themeKey:"borders",transform:At},borderRight:{themeKey:"borders",transform:At},borderBottom:{themeKey:"borders",transform:At},borderLeft:{themeKey:"borders",transform:At},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:At},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Gt},color:{themeKey:"palette",transform:Yt},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Yt},backgroundColor:{themeKey:"palette",transform:Yt},p:{style:Mt},pt:{style:Mt},pr:{style:Mt},pb:{style:Mt},pl:{style:Mt},px:{style:Mt},py:{style:Mt},padding:{style:Mt},paddingTop:{style:Mt},paddingRight:{style:Mt},paddingBottom:{style:Mt},paddingLeft:{style:Mt},paddingX:{style:Mt},paddingY:{style:Mt},paddingInline:{style:Mt},paddingInlineStart:{style:Mt},paddingInlineEnd:{style:Mt},paddingBlock:{style:Mt},paddingBlockStart:{style:Mt},paddingBlockEnd:{style:Mt},m:{style:Et},mt:{style:Et},mr:{style:Et},mb:{style:Et},ml:{style:Et},mx:{style:Et},my:{style:Et},margin:{style:Et},marginTop:{style:Et},marginRight:{style:Et},marginBottom:{style:Et},marginLeft:{style:Et},marginX:{style:Et},marginY:{style:Et},marginInline:{style:Et},marginInlineStart:{style:Et},marginInlineEnd:{style:Et},marginBlock:{style:Et},marginBlockStart:{style:Et},marginBlockEnd:{style:Et},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Kt},rowGap:{style:Jt},columnGap:{style:Zt},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Xt},maxWidth:{style:eo},minWidth:{transform:Xt},height:{transform:Xt},maxHeight:{transform:Xt},minHeight:{transform:Xt},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function oo(){function e(e,a,r,n){const i={[e]:a,theme:r},t=n[e];if(!t)return{[e]:a};const{cssProperty:o=e,themeKey:s,transform:l,style:c}=t;if(null==a)return null;if("typography"===s&&"inherit"===a)return{[e]:a};const d=pt(r,s)||{};if(c)return c(i);return ht(i,a,(a=>{let r=bt(d,l,a);return a===r&&"string"==typeof a&&(r=bt(d,l,`${e}${"default"===a?"":mt(a)}`,a)),!1===o?r:{[o]:r}}))}return function a(r){var n;const{sx:i,theme:t={}}=r||{};if(!i)return null;const o=null!=(n=t.unstable_sxConfig)?n:to;function s(r){let n=r;if("function"==typeof r)n=r(t);else if("object"!=typeof r)return r;if(!n)return null;const i=function(e={}){var a;return(null==(a=e.keys)?void 0:a.reduce(((a,r)=>(a[e.up(r)]={},a)),{}))||{}}(t.breakpoints),s=Object.keys(i);let l=i;return Object.keys(n).forEach((r=>{const i=(s=n[r],c=t,"function"==typeof s?s(c):s);var s,c;if(null!=i)if("object"==typeof i)if(o[r])l=ct(l,e(r,i,t,o));else{const e=ht({theme:t},i,(e=>({[r]:e})));!function(...e){const a=e.reduce(((e,a)=>e.concat(Object.keys(a))),[]),r=new Set(a);return e.every((e=>r.size===Object.keys(e).length))}(e,i)?l=ct(l,e):l[r]=a({sx:i,theme:t})}else l=ct(l,e(r,i,t,o))})),function(e,a){return e.reduce(((e,a)=>{const r=e[a];return(!r||0===Object.keys(r).length)&&delete e[a],e}),a)}(s,l)}return Array.isArray(i)?i.map(s):s(i)}}const so=oo();function lo(e,a){const r=this;if(r.vars&&"function"==typeof r.getColorSchemeSelector){const n=r.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)");return{[n]:a}}return r.palette.mode===e?a:{}}so.filterProps=["sx"];const co=["breakpoints","palette","spacing","shape"];function uo(e={},...a){const{breakpoints:r={},palette:n={},spacing:i,shape:t={}}=e,o=kn(e,co),s=ot(r),l=function(e=8){if(e.mui)return e;const a=qt({spacing:e}),r=(...e)=>("production"!==process.env.NODE_ENV&&(e.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${e.length}`)),(0===e.length?[1]:e).map((e=>{const r=a(e);return"number"==typeof r?`${r}px`:r})).join(" "));return r.mui=!0,r}(i);let c=nt({breakpoints:s,direction:"ltr",components:{},palette:fn({mode:"light"},n),spacing:l,shape:fn({},st,t)},o);return c.applyStyles=lo,c=a.reduce(((e,a)=>nt(e,a)),c),c.unstable_sxConfig=fn({},to,null==o?void 0:o.unstable_sxConfig),c.unstable_sx=function(e){return so({sx:e,theme:this})},c}var ho=Object.freeze({__proto__:null,default:uo,private_createBreakpoints:ot,unstable_applyStyles:lo});function mo(a=null){const r=e.useContext(Fe);return r&&(n=r,0!==Object.keys(n).length)?r:a;var n}const go=uo();const po=["sx"];var bo=Object.freeze({__proto__:null,default:so,extendSxProp:function(e){const{sx:a}=e,r=kn(e,po),{systemProps:n,otherProps:i}=(e=>{var a,r;const n={systemProps:{},otherProps:{}},i=null!=(a=null==e||null==(r=e.theme)?void 0:r.unstable_sxConfig)?a:to;return Object.keys(e).forEach((a=>{i[a]?n.systemProps[a]=e[a]:n.otherProps[a]=e[a]})),n})(r);let t;return t=Array.isArray(a)?[n,...a]:"function"==typeof a?(...e)=>{const r=a(...e);return at(r)?fn({},n,r):n}:fn({},n,a),fn({},i,{sx:t})},unstable_createStyleFunctionSx:oo,unstable_defaultSxConfig:to});function fo(e){var a,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(a=0;a<i;a++)e[a]&&(r=fo(e[a]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ko(){for(var e,a,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(a=fo(e))&&(n&&(n+=" "),n+=a);return n}var yo,vo={exports:{}},wo={};var zo,jo={};
|
|
31
|
+
function(e,a){const r=sa(e,a);return"production"!==process.env.NODE_ENV?(...a)=>{const n="string"==typeof e?`"${e}"`:"component";return 0===a.length?console.error([`MUI: Seems like you called \`styled(${n})()\` without a \`style\` argument.`,'You must provide a `styles` argument: `styled("div")(styleYouForgotToPass)`.'].join("\n")):a.some((e=>void 0===e))&&console.error(`MUI: the styled(${n})(...args) API requires all its args to be defined.`),r(...a)}:r},internal_processStyles:(e,a)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=a(e.__emotion_styles))},keyframes:Re});function at(e){if("object"!=typeof e||null===e)return!1;const a=Object.getPrototypeOf(e);return!(null!==a&&a!==Object.prototype&&null!==Object.getPrototypeOf(a)||Symbol.toStringTag in e||Symbol.iterator in e)}function rt(a){if(e.isValidElement(a)||!at(a))return a;const r={};return Object.keys(a).forEach((e=>{r[e]=rt(a[e])})),r}function nt(a,r,n={clone:!0}){const i=n.clone?fn({},a):a;return at(a)&&at(r)&&Object.keys(r).forEach((t=>{e.isValidElement(r[t])?i[t]=r[t]:at(r[t])&&Object.prototype.hasOwnProperty.call(a,t)&&at(a[t])?i[t]=nt(a[t],r[t],n):n.clone?i[t]=at(r[t])?rt(r[t]):r[t]:i[t]=r[t]})),i}var it=Object.freeze({__proto__:null,default:nt,isPlainObject:at});const tt=["values","unit","step"];function ot(e){const{values:a={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:n=5}=e,i=kn(e,tt),t=(e=>{const a=Object.keys(e).map((a=>({key:a,val:e[a]})))||[];return a.sort(((e,a)=>e.val-a.val)),a.reduce(((e,a)=>fn({},e,{[a.key]:a.val})),{})})(a),o=Object.keys(t);function s(e){return`@media (min-width:${"number"==typeof a[e]?a[e]:e}${r})`}function l(e){return`@media (max-width:${("number"==typeof a[e]?a[e]:e)-n/100}${r})`}function c(e,i){const t=o.indexOf(i);return`@media (min-width:${"number"==typeof a[e]?a[e]:e}${r}) and (max-width:${(-1!==t&&"number"==typeof a[o[t]]?a[o[t]]:i)-n/100}${r})`}return fn({keys:o,values:t,up:s,down:l,between:c,only:function(e){return o.indexOf(e)+1<o.length?c(e,o[o.indexOf(e)+1]):s(e)},not:function(e){const a=o.indexOf(e);return 0===a?s(o[1]):a===o.length-1?l(o[a]):c(e,o[o.indexOf(e)+1]).replace("@media","@media not all and")},unit:r},i)}const st={borderRadius:4},lt="production"!==process.env.NODE_ENV?Wn.oneOfType([Wn.number,Wn.string,Wn.object,Wn.array]):{};function ct(e,a){return a?nt(e,a,{clone:!1}):e}const dt={xs:0,sm:600,md:900,lg:1200,xl:1536},ut={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${dt[e]}px)`};function ht(e,a,r){const n=e.theme||{};if(Array.isArray(a)){const e=n.breakpoints||ut;return a.reduce(((n,i,t)=>(n[e.up(e.keys[t])]=r(a[t]),n)),{})}if("object"==typeof a){const e=n.breakpoints||ut;return Object.keys(a).reduce(((n,i)=>{if(-1!==Object.keys(e.values||dt).indexOf(i)){n[e.up(i)]=r(a[i],i)}else{const e=i;n[e]=a[e]}return n}),{})}return r(a)}function mt(e){if("string"!=typeof e)throw new Error("production"!==process.env.NODE_ENV?"MUI: `capitalize(string)` expects a string argument.":yn(7));return e.charAt(0).toUpperCase()+e.slice(1)}var gt=Object.freeze({__proto__:null,default:mt});function pt(e,a,r=!0){if(!a||"string"!=typeof a)return null;if(e&&e.vars&&r){const r=`vars.${a}`.split(".").reduce(((e,a)=>e&&e[a]?e[a]:null),e);if(null!=r)return r}return a.split(".").reduce(((e,a)=>e&&null!=e[a]?e[a]:null),e)}function bt(e,a,r,n=r){let i;return i="function"==typeof e?e(r):Array.isArray(e)?e[r]||n:pt(e,r)||n,a&&(i=a(i,n,e)),i}function ft(e){const{prop:a,cssProperty:r=e.prop,themeKey:n,transform:i}=e,t=e=>{if(null==e[a])return null;const t=e[a],o=pt(e.theme,n)||{};return ht(e,t,(e=>{let n=bt(o,i,e);return e===n&&"string"==typeof e&&(n=bt(o,i,`${a}${"default"===e?"":mt(e)}`,e)),!1===r?n:{[r]:n}}))};return t.propTypes="production"!==process.env.NODE_ENV?{[a]:lt}:{},t.filterProps=[a],t}const kt={m:"margin",p:"padding"},yt={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},vt={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},wt=function(e){const a={};return r=>(void 0===a[r]&&(a[r]=e(r)),a[r])}((e=>{if(e.length>2){if(!vt[e])return[e];e=vt[e]}const[a,r]=e.split(""),n=kt[a],i=yt[r]||"";return Array.isArray(i)?i.map((e=>n+e)):[n+i]})),zt=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],jt=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],xt=[...zt,...jt];function $t(e,a,r,n){var i;const t=null!=(i=pt(e,a,!1))?i:r;return"number"==typeof t?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&"number"!=typeof e&&console.error(`MUI: Expected ${n} argument to be a number or a string, got ${e}.`),t*e):Array.isArray(t)?e=>"string"==typeof e?e:("production"!==process.env.NODE_ENV&&(Number.isInteger(e)?e>t.length-1&&console.error([`MUI: The value provided (${e}) overflows.`,`The supported values are: ${JSON.stringify(t)}.`,`${e} > ${t.length-1}, you need to add the missing values.`].join("\n")):console.error([`MUI: The \`theme.${a}\` array type cannot be combined with non integer values.You should either use an integer value that can be used as index, or define the \`theme.${a}\` as a number.`].join("\n"))),t[e]):"function"==typeof t?t:("production"!==process.env.NODE_ENV&&console.error([`MUI: The \`theme.${a}\` value (${t}) is invalid.`,"It should be a number, an array or a function."].join("\n")),()=>{})}function qt(e){return $t(e,"spacing",8,"spacing")}function Ct(e,a){if("string"==typeof a||null==a)return a;const r=e(Math.abs(a));return a>=0?r:"number"==typeof r?-r:`-${r}`}function St(e,a,r,n){if(-1===a.indexOf(r))return null;const i=function(e,a){return r=>e.reduce(((e,n)=>(e[n]=Ct(a,r),e)),{})}(wt(r),n);return ht(e,e[r],i)}function Ot(e,a){const r=qt(e.theme);return Object.keys(e).map((n=>St(e,a,n,r))).reduce(ct,{})}function Et(e){return Ot(e,zt)}function Mt(e){return Ot(e,jt)}function _t(...e){const a=e.reduce(((e,a)=>(a.filterProps.forEach((r=>{e[r]=a})),e)),{}),r=e=>Object.keys(e).reduce(((r,n)=>a[n]?ct(r,a[n](e)):r),{});return r.propTypes="production"!==process.env.NODE_ENV?e.reduce(((e,a)=>Object.assign(e,a.propTypes)),{}):{},r.filterProps=e.reduce(((e,a)=>e.concat(a.filterProps)),[]),r}function At(e){return"number"!=typeof e?e:`${e}px solid`}function Dt(e,a){return ft({prop:e,themeKey:"borders",transform:a})}Et.propTypes="production"!==process.env.NODE_ENV?zt.reduce(((e,a)=>(e[a]=lt,e)),{}):{},Et.filterProps=zt,Mt.propTypes="production"!==process.env.NODE_ENV?jt.reduce(((e,a)=>(e[a]=lt,e)),{}):{},Mt.filterProps=jt,"production"===process.env.NODE_ENV||xt.reduce(((e,a)=>(e[a]=lt,e)),{});const Nt=Dt("border",At),Tt=Dt("borderTop",At),It=Dt("borderRight",At),Ft=Dt("borderBottom",At),Pt=Dt("borderLeft",At),Rt=Dt("borderColor"),Lt=Dt("borderTopColor"),Bt=Dt("borderRightColor"),Vt=Dt("borderBottomColor"),Ht=Dt("borderLeftColor"),Wt=Dt("outline",At),Ut=Dt("outlineColor"),Gt=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){const a=$t(e.theme,"shape.borderRadius",4,"borderRadius"),r=e=>({borderRadius:Ct(a,e)});return ht(e,e.borderRadius,r)}return null};Gt.propTypes="production"!==process.env.NODE_ENV?{borderRadius:lt}:{},Gt.filterProps=["borderRadius"],_t(Nt,Tt,It,Ft,Pt,Rt,Lt,Bt,Vt,Ht,Gt,Wt,Ut);const Kt=e=>{if(void 0!==e.gap&&null!==e.gap){const a=$t(e.theme,"spacing",8,"gap"),r=e=>({gap:Ct(a,e)});return ht(e,e.gap,r)}return null};Kt.propTypes="production"!==process.env.NODE_ENV?{gap:lt}:{},Kt.filterProps=["gap"];const Zt=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){const a=$t(e.theme,"spacing",8,"columnGap"),r=e=>({columnGap:Ct(a,e)});return ht(e,e.columnGap,r)}return null};Zt.propTypes="production"!==process.env.NODE_ENV?{columnGap:lt}:{},Zt.filterProps=["columnGap"];const Jt=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){const a=$t(e.theme,"spacing",8,"rowGap"),r=e=>({rowGap:Ct(a,e)});return ht(e,e.rowGap,r)}return null};Jt.propTypes="production"!==process.env.NODE_ENV?{rowGap:lt}:{},Jt.filterProps=["rowGap"];function Yt(e,a){return"grey"===a?a:e}_t(Kt,Zt,Jt,ft({prop:"gridColumn"}),ft({prop:"gridRow"}),ft({prop:"gridAutoFlow"}),ft({prop:"gridAutoColumns"}),ft({prop:"gridAutoRows"}),ft({prop:"gridTemplateColumns"}),ft({prop:"gridTemplateRows"}),ft({prop:"gridTemplateAreas"}),ft({prop:"gridArea"}));function Xt(e){return e<=1&&0!==e?100*e+"%":e}_t(ft({prop:"color",themeKey:"palette",transform:Yt}),ft({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:Yt}),ft({prop:"backgroundColor",themeKey:"palette",transform:Yt}));const Qt=ft({prop:"width",transform:Xt}),eo=e=>{if(void 0!==e.maxWidth&&null!==e.maxWidth){const a=a=>{var r,n;const i=(null==(r=e.theme)||null==(r=r.breakpoints)||null==(r=r.values)?void 0:r[a])||dt[a];return i?"px"!==(null==(n=e.theme)||null==(n=n.breakpoints)?void 0:n.unit)?{maxWidth:`${i}${e.theme.breakpoints.unit}`}:{maxWidth:i}:{maxWidth:Xt(a)}};return ht(e,e.maxWidth,a)}return null};eo.filterProps=["maxWidth"];const ao=ft({prop:"minWidth",transform:Xt}),ro=ft({prop:"height",transform:Xt}),no=ft({prop:"maxHeight",transform:Xt}),io=ft({prop:"minHeight",transform:Xt});ft({prop:"size",cssProperty:"width",transform:Xt}),ft({prop:"size",cssProperty:"height",transform:Xt});_t(Qt,eo,ao,ro,no,io,ft({prop:"boxSizing"}));const to={border:{themeKey:"borders",transform:At},borderTop:{themeKey:"borders",transform:At},borderRight:{themeKey:"borders",transform:At},borderBottom:{themeKey:"borders",transform:At},borderLeft:{themeKey:"borders",transform:At},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:At},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:Gt},color:{themeKey:"palette",transform:Yt},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:Yt},backgroundColor:{themeKey:"palette",transform:Yt},p:{style:Mt},pt:{style:Mt},pr:{style:Mt},pb:{style:Mt},pl:{style:Mt},px:{style:Mt},py:{style:Mt},padding:{style:Mt},paddingTop:{style:Mt},paddingRight:{style:Mt},paddingBottom:{style:Mt},paddingLeft:{style:Mt},paddingX:{style:Mt},paddingY:{style:Mt},paddingInline:{style:Mt},paddingInlineStart:{style:Mt},paddingInlineEnd:{style:Mt},paddingBlock:{style:Mt},paddingBlockStart:{style:Mt},paddingBlockEnd:{style:Mt},m:{style:Et},mt:{style:Et},mr:{style:Et},mb:{style:Et},ml:{style:Et},mx:{style:Et},my:{style:Et},margin:{style:Et},marginTop:{style:Et},marginRight:{style:Et},marginBottom:{style:Et},marginLeft:{style:Et},marginX:{style:Et},marginY:{style:Et},marginInline:{style:Et},marginInlineStart:{style:Et},marginInlineEnd:{style:Et},marginBlock:{style:Et},marginBlockStart:{style:Et},marginBlockEnd:{style:Et},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:Kt},rowGap:{style:Jt},columnGap:{style:Zt},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:Xt},maxWidth:{style:eo},minWidth:{transform:Xt},height:{transform:Xt},maxHeight:{transform:Xt},minHeight:{transform:Xt},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}};function oo(){function e(e,a,r,n){const i={[e]:a,theme:r},t=n[e];if(!t)return{[e]:a};const{cssProperty:o=e,themeKey:s,transform:l,style:c}=t;if(null==a)return null;if("typography"===s&&"inherit"===a)return{[e]:a};const d=pt(r,s)||{};if(c)return c(i);return ht(i,a,(a=>{let r=bt(d,l,a);return a===r&&"string"==typeof a&&(r=bt(d,l,`${e}${"default"===a?"":mt(a)}`,a)),!1===o?r:{[o]:r}}))}return function a(r){var n;const{sx:i,theme:t={}}=r||{};if(!i)return null;const o=null!=(n=t.unstable_sxConfig)?n:to;function s(r){let n=r;if("function"==typeof r)n=r(t);else if("object"!=typeof r)return r;if(!n)return null;const i=function(e={}){var a;return(null==(a=e.keys)?void 0:a.reduce(((a,r)=>(a[e.up(r)]={},a)),{}))||{}}(t.breakpoints),s=Object.keys(i);let l=i;return Object.keys(n).forEach((r=>{const i=(s=n[r],c=t,"function"==typeof s?s(c):s);var s,c;if(null!=i)if("object"==typeof i)if(o[r])l=ct(l,e(r,i,t,o));else{const e=ht({theme:t},i,(e=>({[r]:e})));!function(...e){const a=e.reduce(((e,a)=>e.concat(Object.keys(a))),[]),r=new Set(a);return e.every((e=>r.size===Object.keys(e).length))}(e,i)?l=ct(l,e):l[r]=a({sx:i,theme:t})}else l=ct(l,e(r,i,t,o))})),function(e,a){return e.reduce(((e,a)=>{const r=e[a];return(!r||0===Object.keys(r).length)&&delete e[a],e}),a)}(s,l)}return Array.isArray(i)?i.map(s):s(i)}}const so=oo();function lo(e,a){const r=this;if(r.vars&&"function"==typeof r.getColorSchemeSelector){const n=r.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)");return{[n]:a}}return r.palette.mode===e?a:{}}so.filterProps=["sx"];const co=["breakpoints","palette","spacing","shape"];function uo(e={},...a){const{breakpoints:r={},palette:n={},spacing:i,shape:t={}}=e,o=kn(e,co),s=ot(r),l=function(e=8){if(e.mui)return e;const a=qt({spacing:e}),r=(...e)=>("production"!==process.env.NODE_ENV&&(e.length<=4||console.error(`MUI: Too many arguments provided, expected between 0 and 4, got ${e.length}`)),(0===e.length?[1]:e).map((e=>{const r=a(e);return"number"==typeof r?`${r}px`:r})).join(" "));return r.mui=!0,r}(i);let c=nt({breakpoints:s,direction:"ltr",components:{},palette:fn({mode:"light"},n),spacing:l,shape:fn({},st,t)},o);return c.applyStyles=lo,c=a.reduce(((e,a)=>nt(e,a)),c),c.unstable_sxConfig=fn({},to,null==o?void 0:o.unstable_sxConfig),c.unstable_sx=function(e){return so({sx:e,theme:this})},c}var ho=Object.freeze({__proto__:null,default:uo,private_createBreakpoints:ot,unstable_applyStyles:lo});function mo(a=null){const r=e.useContext(Fe);return r&&(n=r,0!==Object.keys(n).length)?r:a;var n}const go=uo();const po=["sx"];var bo=Object.freeze({__proto__:null,default:so,extendSxProp:function(e){const{sx:a}=e,r=kn(e,po),{systemProps:n,otherProps:i}=(e=>{var a,r;const n={systemProps:{},otherProps:{}},i=null!=(a=null==e||null==(r=e.theme)?void 0:r.unstable_sxConfig)?a:to;return Object.keys(e).forEach((a=>{i[a]?n.systemProps[a]=e[a]:n.otherProps[a]=e[a]})),n})(r);let t;return t=Array.isArray(a)?[n,...a]:"function"==typeof a?(...e)=>{const r=a(...e);return at(r)?fn({},n,r):n}:fn({},n,a),fn({},i,{sx:t})},unstable_createStyleFunctionSx:oo,unstable_defaultSxConfig:to});function fo(e){var a,r,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var i=e.length;for(a=0;a<i;a++)e[a]&&(r=fo(e[a]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function ko(){for(var e,a,r=0,n="",i=arguments.length;r<i;r++)(e=arguments[r])&&(a=fo(e))&&(n&&(n+=" "),n+=a);return n}var yo,vo={exports:{}},wo={};var zo,jo={};
|
|
32
32
|
/**
|
|
33
33
|
* @license React
|
|
34
34
|
* react-is.development.js
|
|
35
35
|
*
|
|
36
|
-
* Copyright (c)
|
|
36
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
37
37
|
*
|
|
38
38
|
* This source code is licensed under the MIT license found in the
|
|
39
39
|
* LICENSE file in the root directory of this source tree.
|
|
40
|
-
*/"production"===process.env.NODE_ENV?vo.exports=function(){if(yo)return wo;yo=1;var e,a=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),t=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen");function p(e){if("object"==typeof e&&null!==e){var g=e.$$typeof;switch(g){case a:switch(e=e.type){case n:case t:case i:case d:case u:return e;default:switch(e=e&&e.$$typeof){case l:case s:case c:case m:case h:case o:return e;default:return g}}case r:return g}}}return e=Symbol.for("react.module.reference"),wo.ContextConsumer=s,wo.ContextProvider=o,wo.Element=a,wo.ForwardRef=c,wo.Fragment=n,wo.Lazy=m,wo.Memo=h,wo.Portal=r,wo.Profiler=t,wo.StrictMode=i,wo.Suspense=d,wo.SuspenseList=u,wo.isAsyncMode=function(){return!1},wo.isConcurrentMode=function(){return!1},wo.isContextConsumer=function(e){return p(e)===s},wo.isContextProvider=function(e){return p(e)===o},wo.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},wo.isForwardRef=function(e){return p(e)===c},wo.isFragment=function(e){return p(e)===n},wo.isLazy=function(e){return p(e)===m},wo.isMemo=function(e){return p(e)===h},wo.isPortal=function(e){return p(e)===r},wo.isProfiler=function(e){return p(e)===t},wo.isStrictMode=function(e){return p(e)===i},wo.isSuspense=function(e){return p(e)===d},wo.isSuspenseList=function(e){return p(e)===u},wo.isValidElementType=function(a){return"string"==typeof a||"function"==typeof a||a===n||a===t||a===i||a===d||a===u||a===g||"object"==typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===h||a.$$typeof===o||a.$$typeof===s||a.$$typeof===c||a.$$typeof===e||void 0!==a.getModuleId)},wo.typeOf=p,wo}():vo.exports=(zo||(zo=1,"production"!==process.env.NODE_ENV&&function(){var e,a=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),t=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),s=Symbol.for("react.context"),l=Symbol.for("react.server_context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),u=Symbol.for("react.suspense_list"),h=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.offscreen");function p(e){if("object"==typeof e&&null!==e){var g=e.$$typeof;switch(g){case a:var p=e.type;switch(p){case n:case t:case i:case d:case u:return p;default:var b=p&&p.$$typeof;switch(b){case l:case s:case c:case m:case h:case o:return b;default:return g}}case r:return g}}}e=Symbol.for("react.module.reference");var b=s,f=o,k=a,y=c,v=n,w=m,z=h,j=r,x=t,$=i,q=d,C=u,S=!1,O=!1;jo.ContextConsumer=b,jo.ContextProvider=f,jo.Element=k,jo.ForwardRef=y,jo.Fragment=v,jo.Lazy=w,jo.Memo=z,jo.Portal=j,jo.Profiler=x,jo.StrictMode=$,jo.Suspense=q,jo.SuspenseList=C,jo.isAsyncMode=function(e){return S||(S=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")),!1},jo.isConcurrentMode=function(e){return O||(O=!0,console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")),!1},jo.isContextConsumer=function(e){return p(e)===s},jo.isContextProvider=function(e){return p(e)===o},jo.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},jo.isForwardRef=function(e){return p(e)===c},jo.isFragment=function(e){return p(e)===n},jo.isLazy=function(e){return p(e)===m},jo.isMemo=function(e){return p(e)===h},jo.isPortal=function(e){return p(e)===r},jo.isProfiler=function(e){return p(e)===t},jo.isStrictMode=function(e){return p(e)===i},jo.isSuspense=function(e){return p(e)===d},jo.isSuspenseList=function(e){return p(e)===u},jo.isValidElementType=function(a){return"string"==typeof a||"function"==typeof a||a===n||a===t||a===i||a===d||a===u||a===g||"object"==typeof a&&null!==a&&(a.$$typeof===m||a.$$typeof===h||a.$$typeof===o||a.$$typeof===s||a.$$typeof===c||a.$$typeof===e||void 0!==a.getModuleId)},jo.typeOf=p}()),jo);var xo=vo.exports;const $o=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function qo(e){const a=`${e}`.match($o);return a&&a[1]||""}function Co(e,a=""){return e.displayName||e.name||qo(e)||a}function So(e,a,r){const n=Co(a);return e.displayName||(""!==n?`${r}(${n})`:r)}var Oo=Object.freeze({__proto__:null,default:function(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return Co(e,"Component");if("object"==typeof e)switch(e.$$typeof){case xo.ForwardRef:return So(e,e.render,"ForwardRef");case xo.Memo:return So(e,e.type,"memo");default:return}}},getFunctionName:qo});function Eo(e,a){const r=fn({},a);return Object.keys(e).forEach((n=>{if(n.toString().match(/^(components|slots)$/))r[n]=fn({},e[n],r[n]);else if(n.toString().match(/^(componentsProps|slotProps)$/)){const i=e[n]||{},t=a[n];r[n]={},t&&Object.keys(t)?i&&Object.keys(i)?(r[n]=fn({},t),Object.keys(i).forEach((e=>{r[n][e]=Eo(i[e],t[e])}))):r[n]=t:r[n]=i}else void 0===r[n]&&(r[n]=e[n])})),r}const Mo="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function _o(a,r,n,i,t){const[o,s]=e.useState((()=>t&&n?n(a).matches:i?i(a).matches:r));return Mo((()=>{let e=!0;if(!n)return;const r=n(a),i=()=>{e&&s(r.matches)};return i(),r.addListener(i),()=>{e=!1,r.removeListener(i)}}),[a,n]),o}const Ao=e.useSyncExternalStore;function Do(a,r,n,i,t){const o=e.useCallback((()=>r),[r]),s=e.useMemo((()=>{if(t&&n)return()=>n(a).matches;if(null!==i){const{matches:e}=i(a);return()=>e}return o}),[o,a,i,t,n]),[l,c]=e.useMemo((()=>{if(null===n)return[o,()=>()=>{}];const e=n(a);return[()=>e.matches,a=>(e.addListener(a),()=>{e.removeListener(a)})]}),[o,n,a]);return Ao(c,l,s)}function No(a,r={}){const n=mo(),i="undefined"!=typeof window&&void 0!==window.matchMedia,{defaultMatches:t=!1,matchMedia:o=(i?window.matchMedia:null),ssrMatchMedia:s=null,noSsr:l=!1}=function(e){const{theme:a,name:r,props:n}=e;return a&&a.components&&a.components[r]&&a.components[r].defaultProps?Eo(a.components[r].defaultProps,n):n}({name:"MuiUseMediaQuery",props:r,theme:n});"production"!==process.env.NODE_ENV&&"function"==typeof a&&null===n&&console.error(["MUI: The `query` argument provided is invalid.","You are providing a function without a theme in the context.","One of the parent elements needs to use a ThemeProvider."].join("\n"));let c="function"==typeof a?a(n):a;c=c.replace(/^@media( ?)/m,"");const d=(void 0!==Ao?Do:_o)(c,t,o,s,l);return"production"!==process.env.NODE_ENV&&e.useDebugValue({query:c,match:d}),d}var To=Object.freeze({__proto__:null,default:function(e,a=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(a,Math.min(e,r))}});const Io="exact-prop: ";const Fo=e.createContext(null);function Po(){const a=e.useContext(Fo);return"production"!==process.env.NODE_ENV&&e.useDebugValue(a),a}"production"!==process.env.NODE_ENV&&(Fo.displayName="ThemeContext");var Ro="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";function Lo(a){const{children:r,theme:n}=a,i=Po();"production"!==process.env.NODE_ENV&&null===i&&"function"==typeof n&&console.error(["MUI: You are providing a theme function prop to the ThemeProvider component:","<ThemeProvider theme={outerTheme => outerTheme} />","","However, no outer theme is present.","Make sure a theme is already injected higher in the React tree or provide a theme object."].join("\n"));const t=e.useMemo((()=>{const e=null===i?n:function(e,a){if("function"==typeof a){const r=a(e);return"production"!==process.env.NODE_ENV&&(r||console.error(["MUI: You should return an object from your theme function, i.e.","<ThemeProvider theme={() => ({})} />"].join("\n"))),r}return fn({},e,a)}(i,n);return null!=e&&(e[Ro]=null!==i),e}),[n,i]);return pa.jsx(Fo.Provider,{value:t,children:r})}"production"!==process.env.NODE_ENV&&(Lo.propTypes={children:Wn.node,theme:Wn.oneOfType([Wn.object,Wn.func]).isRequired}),"production"!==process.env.NODE_ENV&&"production"!==process.env.NODE_ENV&&(Lo.propTypes=function(e){return"production"===process.env.NODE_ENV?e:fn({},e,{[Io]:a=>{const r=Object.keys(a).filter((a=>!e.hasOwnProperty(a)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}})}(Lo.propTypes));const Bo="exact-prop: ";const Vo=["value"],Ho=e.createContext();function Wo(e){let{value:a}=e,r=kn(e,Vo);return pa.jsx(Ho.Provider,fn({value:null==a||a},r))}"production"!==process.env.NODE_ENV&&(Wo.propTypes={children:Wn.node,value:Wn.bool});const Uo=e.createContext(void 0);function Go({value:e,children:a}){return pa.jsx(Uo.Provider,{value:e,children:a})}function Ko({props:a,name:r}){return function(e){const{theme:a,name:r,props:n}=e;if(!a||!a.components||!a.components[r])return n;const i=a.components[r];return i.defaultProps?Eo(i.defaultProps,n):i.styleOverrides||i.variants?n:Eo(i,n)}({props:a,name:r,theme:{components:e.useContext(Uo)}})}"production"!==process.env.NODE_ENV&&(Go.propTypes={children:Wn.node,value:Wn.object});const Zo={};function Jo(a,r,n,i=!1){return e.useMemo((()=>{const e=a&&r[a]||r;if("function"==typeof n){const t=n(e),o=a?fn({},r,{[a]:t}):t;return i?()=>o:o}return fn({},r,a?{[a]:n}:n)}),[a,r,n,i])}function Yo(e){const{children:a,theme:r,themeId:n}=e,i=mo(Zo),t=Po()||Zo;"production"!==process.env.NODE_ENV&&(null===i&&"function"==typeof r||n&&i&&!i[n]&&"function"==typeof r)&&console.error(["MUI: You are providing a theme function prop to the ThemeProvider component:","<ThemeProvider theme={outerTheme => outerTheme} />","","However, no outer theme is present.","Make sure a theme is already injected higher in the React tree or provide a theme object."].join("\n"));const o=Jo(n,i,r),s=Jo(n,t,r,!0),l="rtl"===o.direction;return pa.jsx(Lo,{theme:s,children:pa.jsx(Fe.Provider,{value:o,children:pa.jsx(Wo,{value:l,children:pa.jsx(Go,{value:null==o?void 0:o.components,children:a})})})})}function Xo(e){if("object"!=typeof e||null===e)return!1;const a=Object.getPrototypeOf(e);return!(null!==a&&a!==Object.prototype&&null!==Object.getPrototypeOf(a)||Symbol.toStringTag in e||Symbol.iterator in e)}function Qo(e){if(!Xo(e))return e;const a={};return Object.keys(e).forEach((r=>{a[r]=Qo(e[r])})),a}function es(e,a,r={clone:!0}){const n=r.clone?fn({},e):e;return Xo(e)&&Xo(a)&&Object.keys(a).forEach((i=>{Xo(a[i])&&Object.prototype.hasOwnProperty.call(e,i)&&Xo(e[i])?n[i]=es(e[i],a[i],r):r.clone?n[i]=Xo(a[i])?Qo(a[i]):a[i]:n[i]=a[i]})),n}"production"!==process.env.NODE_ENV&&(Yo.propTypes={children:Wn.node,theme:Wn.oneOfType([Wn.func,Wn.object]).isRequired,themeId:Wn.string}),"production"!==process.env.NODE_ENV&&"production"!==process.env.NODE_ENV&&(Yo.propTypes=function(e){return"production"===process.env.NODE_ENV?e:fn({},e,{[Bo]:a=>{const r=Object.keys(a).filter((a=>!e.hasOwnProperty(a)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}})}(Yo.propTypes));const as=e=>e,rs=(()=>{let e=as;return{configure(a){e=a},generate:a=>e(a),reset(){e=as}}})(),ns={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function is(e,a,r="Mui"){const n=ns[a];return n?`${r}-${n}`:`${rs.generate(e)}-${a}`}function ts(e,a){return fn({toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}}},a)}var ss,ls={},cs={exports:{}};(ss=cs).exports=function(e){return e&&e.__esModule?e:{default:e}},ss.exports.__esModule=!0,ss.exports.default=ss.exports;var ds=cs.exports,us=ca(wn),hs=ca(To),ms=ds;Object.defineProperty(ls,"__esModule",{value:!0}),ls.alpha=qs,ls.blend=function(e,a,r,n=1){const i=(e,a)=>Math.round((e**(1/n)*(1-r)+a**(1/n)*r)**n),t=ws(e),o=ws(a),s=[i(t.values[0],o.values[0]),i(t.values[1],o.values[1]),i(t.values[2],o.values[2])];return js({type:"rgb",values:s})},ls.colorChannel=void 0;var gs=ls.darken=Cs;ls.decomposeColor=ws,ls.emphasize=Os;var ps=ls.getContrastRatio=function(e,a){const r=$s(e),n=$s(a);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)};ls.getLuminance=$s,ls.hexToRgb=vs,ls.hslToRgb=xs;var bs=ls.lighten=Ss;ls.private_safeAlpha=function(e,a,r){try{return qs(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},ls.private_safeColorChannel=void 0,ls.private_safeDarken=function(e,a,r){try{return Cs(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},ls.private_safeEmphasize=function(e,a,r){try{return Os(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},ls.private_safeLighten=function(e,a,r){try{return Ss(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},ls.recomposeColor=js,ls.rgbToHex=function(e){if(0===e.indexOf("#"))return e;const{values:a}=ws(e);return`#${a.map(((e,a)=>function(e){const a=e.toString(16);return 1===a.length?`0${a}`:a}(3===a?Math.round(255*e):e))).join("")}`};var fs=ms(us),ks=ms(hs);function ys(e,a=0,r=1){return"production"!==process.env.NODE_ENV&&(e<a||e>r)&&console.error(`MUI: The value provided ${e} is out of range [${a}, ${r}].`),(0,ks.default)(e,a,r)}function vs(e){e=e.slice(1);const a=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(a);return r&&1===r[0].length&&(r=r.map((e=>e+e))),r?`rgb${4===r.length?"a":""}(${r.map(((e,a)=>a<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}function ws(e){if(e.type)return e;if("#"===e.charAt(0))return ws(vs(e));const a=e.indexOf("("),r=e.substring(0,a);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(r))throw new Error("production"!==process.env.NODE_ENV?`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:(0,fs.default)(9,e));let n,i=e.substring(a+1,e.length-1);if("color"===r){if(i=i.split(" "),n=i.shift(),4===i.length&&"/"===i[3].charAt(0)&&(i[3]=i[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(n))throw new Error("production"!==process.env.NODE_ENV?`MUI: unsupported \`${n}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:(0,fs.default)(10,n))}else i=i.split(",");return i=i.map((e=>parseFloat(e))),{type:r,values:i,colorSpace:n}}const zs=e=>{const a=ws(e);return a.values.slice(0,3).map(((e,r)=>-1!==a.type.indexOf("hsl")&&0!==r?`${e}%`:e)).join(" ")};ls.colorChannel=zs;function js(e){const{type:a,colorSpace:r}=e;let{values:n}=e;return-1!==a.indexOf("rgb")?n=n.map(((e,a)=>a<3?parseInt(e,10):e)):-1!==a.indexOf("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),n=-1!==a.indexOf("color")?`${r} ${n.join(" ")}`:`${n.join(", ")}`,`${a}(${n})`}function xs(e){e=ws(e);const{values:a}=e,r=a[0],n=a[1]/100,i=a[2]/100,t=n*Math.min(i,1-i),o=(e,a=(e+r/30)%12)=>i-t*Math.max(Math.min(a-3,9-a,1),-1);let s="rgb";const l=[Math.round(255*o(0)),Math.round(255*o(8)),Math.round(255*o(4))];return"hsla"===e.type&&(s+="a",l.push(a[3])),js({type:s,values:l})}function $s(e){let a="hsl"===(e=ws(e)).type||"hsla"===e.type?ws(xs(e)).values:e.values;return a=a.map((a=>("color"!==e.type&&(a/=255),a<=.03928?a/12.92:((a+.055)/1.055)**2.4))),Number((.2126*a[0]+.7152*a[1]+.0722*a[2]).toFixed(3))}function qs(e,a){return e=ws(e),a=ys(a),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${a}`:e.values[3]=a,js(e)}function Cs(e,a){if(e=ws(e),a=ys(a),-1!==e.type.indexOf("hsl"))e.values[2]*=1-a;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-a;return js(e)}function Ss(e,a){if(e=ws(e),a=ys(a),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*a;else if(-1!==e.type.indexOf("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*a;else if(-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*a;return js(e)}function Os(e,a=.15){return $s(e)>.5?Cs(e,a):Ss(e,a)}ls.private_safeColorChannel=(e,a)=>{try{return zs(e)}catch(r){return a&&"production"!==process.env.NODE_ENV&&console.warn(a),e}};const Es={black:"#000",white:"#fff"},Ms={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},_s="#f3e5f5",As="#ce93d8",Ds="#ba68c8",Ns="#ab47bc",Ts="#9c27b0",Is="#7b1fa2",Fs="#e57373",Ps="#ef5350",Rs="#f44336",Ls="#d32f2f",Bs="#c62828",Vs="#ffb74d",Hs="#ffa726",Ws="#ff9800",Us="#f57c00",Gs="#e65100",Ks="#e3f2fd",Zs="#90caf9",Js="#42a5f5",Ys="#1976d2",Xs="#1565c0",Qs="#4fc3f7",el="#29b6f6",al="#03a9f4",rl="#0288d1",nl="#01579b",il="#81c784",tl="#66bb6a",ol="#4caf50",sl="#388e3c",ll="#2e7d32",cl="#1b5e20",dl=["mode","contrastThreshold","tonalOffset"],ul={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Es.white,default:Es.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},hl={text:{primary:Es.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Es.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function ml(e,a,r,n){const i=n.light||n,t=n.dark||1.5*n;e[a]||(e.hasOwnProperty(r)?e[a]=e[r]:"light"===a?e.light=bs(e.main,i):"dark"===a&&(e.dark=gs(e.main,t)))}function gl(e){const{mode:a="light",contrastThreshold:r=3,tonalOffset:n=.2}=e,i=kn(e,dl),t=e.primary||function(e="light"){return"dark"===e?{main:Zs,light:Ks,dark:Js}:{main:Ys,light:Js,dark:Xs}}(a),o=e.secondary||function(e="light"){return"dark"===e?{main:As,light:_s,dark:Ns}:{main:Ts,light:Ds,dark:Is}}(a),s=e.error||function(e="light"){return"dark"===e?{main:Rs,light:Fs,dark:Ls}:{main:Ls,light:Ps,dark:Bs}}(a),l=e.info||function(e="light"){return"dark"===e?{main:el,light:Qs,dark:rl}:{main:rl,light:al,dark:nl}}(a),c=e.success||function(e="light"){return"dark"===e?{main:tl,light:il,dark:sl}:{main:ll,light:ol,dark:cl}}(a),d=e.warning||function(e="light"){return"dark"===e?{main:Hs,light:Vs,dark:Us}:{main:"#ed6c02",light:Ws,dark:Gs}}(a);function u(e){const a=ps(e,hl.text.primary)>=r?hl.text.primary:ul.text.primary;if("production"!==process.env.NODE_ENV){const r=ps(e,a);r<3&&console.error([`MUI: The contrast ratio of ${r}:1 for ${a} on ${e}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join("\n"))}return a}const h=({color:e,name:a,mainShade:r=500,lightShade:i=300,darkShade:t=700})=>{if(!(e=fn({},e)).main&&e[r]&&(e.main=e[r]),!e.hasOwnProperty("main"))throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${a?` (${a})`:""} provided to augmentColor(color) is invalid.\nThe color object needs to have a \`main\` property or a \`${r}\` property.`:pn(11,a?` (${a})`:"",r));if("string"!=typeof e.main)throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${a?` (${a})`:""} provided to augmentColor(color) is invalid.\n\`color.main\` should be a string, but \`${JSON.stringify(e.main)}\` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from "@mui/material/colors";\n\nconst theme1 = createTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createTheme({ palette: {\n primary: { main: green[500] },\n} });`:pn(12,a?` (${a})`:"",JSON.stringify(e.main)));return ml(e,"light",i,n),ml(e,"dark",t,n),e.contrastText||(e.contrastText=u(e.main)),e},m={dark:hl,light:ul};"production"!==process.env.NODE_ENV&&(m[a]||console.error(`MUI: The palette mode \`${a}\` is not supported.`));return es(fn({common:fn({},Es),mode:a,primary:h({color:t,name:"primary"}),secondary:h({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:h({color:s,name:"error"}),warning:h({color:d,name:"warning"}),info:h({color:l,name:"info"}),success:h({color:c,name:"success"}),grey:Ms,contrastThreshold:r,getContrastText:u,augmentColor:h,tonalOffset:n},m[a]),i)}const pl=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];const bl={textTransform:"uppercase"},fl='"Roboto", "Helvetica", "Arial", sans-serif';function kl(e,a){const r="function"==typeof a?a(e):a,{fontFamily:n=fl,fontSize:i=14,fontWeightLight:t=300,fontWeightRegular:o=400,fontWeightMedium:s=500,fontWeightBold:l=700,htmlFontSize:c=16,allVariants:d,pxToRem:u}=r,h=kn(r,pl);"production"!==process.env.NODE_ENV&&("number"!=typeof i&&console.error("MUI: `fontSize` is required to be a number."),"number"!=typeof c&&console.error("MUI: `htmlFontSize` is required to be a number."));const m=i/14,g=u||(e=>e/c*m+"rem"),p=(e,a,r,i,t)=>{return fn({fontFamily:n,fontWeight:e,fontSize:g(a),lineHeight:r},n===fl?{letterSpacing:(o=i/a,Math.round(1e5*o)/1e5)+"em"}:{},t,d);var o},b={h1:p(t,96,1.167,-1.5),h2:p(t,60,1.2,-.5),h3:p(o,48,1.167,0),h4:p(o,34,1.235,.25),h5:p(o,24,1.334,0),h6:p(s,20,1.6,.15),subtitle1:p(o,16,1.75,.15),subtitle2:p(s,14,1.57,.1),body1:p(o,16,1.5,.15),body2:p(o,14,1.43,.15),button:p(s,14,1.75,.4,bl),caption:p(o,12,1.66,.4),overline:p(o,12,2.66,1,bl),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return es(fn({htmlFontSize:c,pxToRem:g,fontFamily:n,fontSize:i,fontWeightLight:t,fontWeightRegular:o,fontWeightMedium:s,fontWeightBold:l},b),h,{clone:!1})}function yl(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,0.2)`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,0.14)`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,0.12)`].join(",")}const vl=["none",yl(0,2,1,-1,0,1,1,0,0,1,3,0),yl(0,3,1,-2,0,2,2,0,0,1,5,0),yl(0,3,3,-2,0,3,4,0,0,1,8,0),yl(0,2,4,-1,0,4,5,0,0,1,10,0),yl(0,3,5,-1,0,5,8,0,0,1,14,0),yl(0,3,5,-1,0,6,10,0,0,1,18,0),yl(0,4,5,-2,0,7,10,1,0,2,16,1),yl(0,5,5,-3,0,8,10,1,0,3,14,2),yl(0,5,6,-3,0,9,12,1,0,3,16,2),yl(0,6,6,-3,0,10,14,1,0,4,18,3),yl(0,6,7,-4,0,11,15,1,0,4,20,3),yl(0,7,8,-4,0,12,17,2,0,5,22,4),yl(0,7,8,-4,0,13,19,2,0,5,24,4),yl(0,7,9,-4,0,14,21,2,0,5,26,4),yl(0,8,9,-5,0,15,22,2,0,6,28,5),yl(0,8,10,-5,0,16,24,2,0,6,30,5),yl(0,8,11,-5,0,17,26,2,0,6,32,5),yl(0,9,11,-5,0,18,28,2,0,7,34,6),yl(0,9,12,-6,0,19,29,2,0,7,36,6),yl(0,10,13,-6,0,20,31,3,0,8,38,7),yl(0,10,13,-6,0,21,33,3,0,8,40,7),yl(0,10,14,-6,0,22,35,3,0,8,42,7),yl(0,11,14,-7,0,23,36,3,0,9,44,8),yl(0,11,15,-7,0,24,38,3,0,9,46,8)],wl=["duration","easing","delay"],zl={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},jl={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function xl(e){return`${Math.round(e)}ms`}function $l(e){if(!e)return 0;const a=e/36;return Math.round(10*(4+15*a**.25+a/5))}function ql(e){const a=fn({},zl,e.easing),r=fn({},jl,e.duration);return fn({getAutoHeightDuration:$l,create:(e=["all"],n={})=>{const{duration:i=r.standard,easing:t=a.easeInOut,delay:o=0}=n,s=kn(n,wl);if("production"!==process.env.NODE_ENV){const a=e=>"string"==typeof e,r=e=>!isNaN(parseFloat(e));a(e)||Array.isArray(e)||console.error('MUI: Argument "props" must be a string or Array.'),r(i)||a(i)||console.error(`MUI: Argument "duration" must be a number or a string but found ${i}.`),a(t)||console.error('MUI: Argument "easing" must be a string.'),r(o)||a(o)||console.error('MUI: Argument "delay" must be a number or a string.'),"object"!=typeof n&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join("\n")),0!==Object.keys(s).length&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(s).join(",")}].`)}return(Array.isArray(e)?e:[e]).map((e=>`${e} ${"string"==typeof i?i:xl(i)} ${t} ${"string"==typeof o?o:xl(o)}`)).join(",")}},e,{easing:a,duration:r})}const Cl={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},Sl=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];const Ol=function(e={},...a){const{mixins:r={},palette:n={},transitions:i={},typography:t={}}=e,o=kn(e,Sl);if(e.vars)throw new Error("production"!==process.env.NODE_ENV?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name.":pn(18));const s=gl(n),l=uo(e);let c=es(l,{mixins:ts(l.breakpoints,r),palette:s,shadows:vl.slice(),typography:kl(s,t),transitions:ql(i),zIndex:fn({},Cl)});if(c=es(c,o),c=a.reduce(((e,a)=>es(e,a)),c),"production"!==process.env.NODE_ENV){const e=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],a=(a,r)=>{let n;for(n in a){const i=a[n];if(-1!==e.indexOf(n)&&Object.keys(i).length>0){if("production"!==process.env.NODE_ENV){const e=is("",n);console.error([`MUI: The \`${r}\` component increases the CSS specificity of the \`${n}\` internal state.`,"You can not override it like this: ",JSON.stringify(a,null,2),"",`Instead, you need to use the '&.${e}' syntax:`,JSON.stringify({root:{[`&.${e}`]:i}},null,2),"","https://mui.com/r/state-classes-guide"].join("\n"))}a[n]={}}}};Object.keys(c.components).forEach((e=>{const r=c.components[e].styleOverrides;r&&0===e.indexOf("Mui")&&a(r,e)}))}return c.unstable_sxConfig=fn({},to,null==o?void 0:o.unstable_sxConfig),c.unstable_sx=function(e){return so({sx:e,theme:this})},c}();function El(){const a=function(e=go){return mo(e)}(Ol);return"production"!==process.env.NODE_ENV&&e.useDebugValue(a),a[bn]||a}var Ml,_l={},Al={exports:{}};var Dl,Nl={exports:{}};var Tl=ca(et),Il=ca(it),Fl=ca(gt),Pl=ca(Oo),Rl=ca(ho),Ll=ca(bo),Bl=ds;Object.defineProperty(_l,"__esModule",{value:!0});var Vl=_l.default=function(e={}){const{themeId:a,defaultTheme:r=nc,rootShouldForwardProp:n=rc,slotShouldForwardProp:i=rc}=e,t=e=>(0,Yl.default)((0,Hl.default)({},e,{theme:tc((0,Hl.default)({},e,{defaultTheme:r,themeId:a}))}));return t.__mui_systemSx=!0,(e,o={})=>{(0,Ul.internal_processStyles)(e,(e=>e.filter((e=>!(null!=e&&e.__mui_systemSx)))));const{name:s,slot:l,skipVariantsResolver:c,skipSx:d,overridesResolver:u=oc(ic(l))}=o,h=(0,Wl.default)(o,ec),m=void 0!==c?c:l&&"Root"!==l&&"root"!==l||!1,g=d||!1;let p;"production"!==process.env.NODE_ENV&&s&&(p=`${s}-${ic(l||"Root")}`);let b=rc;"Root"===l||"root"===l?b=n:l?b=i:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(b=void 0);const f=(0,Ul.default)(e,(0,Hl.default)({shouldForwardProp:b,label:p},h)),k=e=>"function"==typeof e&&e.__emotion_real!==e||(0,Gl.isPlainObject)(e)?n=>sc(e,(0,Hl.default)({},n,{theme:tc({theme:n.theme,defaultTheme:r,themeId:a})})):e,y=(n,...i)=>{let o=k(n);const c=i?i.map(k):[];s&&u&&c.push((e=>{const n=tc((0,Hl.default)({},e,{defaultTheme:r,themeId:a}));if(!n.components||!n.components[s]||!n.components[s].styleOverrides)return null;const i=n.components[s].styleOverrides,t={};return Object.entries(i).forEach((([a,r])=>{t[a]=sc(r,(0,Hl.default)({},e,{theme:n}))})),u(e,t)})),s&&!m&&c.push((e=>{var n;const i=tc((0,Hl.default)({},e,{defaultTheme:r,themeId:a}));return sc({variants:null==i||null==(n=i.components)||null==(n=n[s])?void 0:n.variants},(0,Hl.default)({},e,{theme:i}))})),g||c.push(t);const d=c.length-i.length;if(Array.isArray(n)&&d>0){const e=new Array(d).fill("");o=[...n,...e],o.raw=[...n.raw,...e]}const h=f(o,...c);if("production"!==process.env.NODE_ENV){let a;s&&(a=`${s}${(0,Kl.default)(l||"")}`),void 0===a&&(a=`Styled(${(0,Zl.default)(e)})`),h.displayName=a}return e.muiName&&(h.muiName=e.muiName),h};return f.withConfig&&(y.withConfig=f.withConfig),y}};_l.shouldForwardProp=rc,_l.systemDefaultTheme=void 0;var Hl=Bl((Ml||(Ml=1,function(e){function a(){return e.exports=a=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}(Al)),Al.exports)),Wl=Bl((Dl||(Dl=1,function(e){e.exports=function(e,a){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(a.includes(n))continue;r[n]=e[n]}return r},e.exports.__esModule=!0,e.exports.default=e.exports}(Nl)),Nl.exports)),Ul=function(e,a){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=ac(a);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in e)if("default"!==t&&Object.prototype.hasOwnProperty.call(e,t)){var o=i?Object.getOwnPropertyDescriptor(e,t):null;o&&(o.get||o.set)?Object.defineProperty(n,t,o):n[t]=e[t]}return n.default=e,r&&r.set(e,n),n}(Tl),Gl=Il,Kl=Bl(Fl),Zl=Bl(Pl),Jl=Bl(Rl),Yl=Bl(Ll);const Xl=["ownerState"],Ql=["variants"],ec=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function ac(e){if("function"!=typeof WeakMap)return null;var a=new WeakMap,r=new WeakMap;return(ac=function(e){return e?r:a})(e)}function rc(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const nc=_l.systemDefaultTheme=(0,Jl.default)(),ic=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function tc({defaultTheme:e,theme:a,themeId:r}){return n=a,0===Object.keys(n).length?e:a[r]||a;var n}function oc(e){return e?(a,r)=>r[e]:null}function sc(e,a){let{ownerState:r}=a,n=(0,Wl.default)(a,Xl);const i="function"==typeof e?e((0,Hl.default)({ownerState:r},n)):e;if(Array.isArray(i))return i.flatMap((e=>sc(e,(0,Hl.default)({ownerState:r},n))));if(i&&"object"==typeof i&&Array.isArray(i.variants)){const{variants:e=[]}=i;let a=(0,Wl.default)(i,Ql);return e.forEach((e=>{let i=!0;"function"==typeof e.props?i=e.props((0,Hl.default)({ownerState:r},n,r)):Object.keys(e.props).forEach((a=>{(null==r?void 0:r[a])!==e.props[a]&&n[a]!==e.props[a]&&(i=!1)})),i&&(Array.isArray(a)||(a=[a]),a.push("function"==typeof e.style?e.style((0,Hl.default)({ownerState:r},n,r)):e.style))})),a}return i}const lc=Vl({themeId:bn,defaultTheme:Ol,rootShouldForwardProp:e=>function(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}(e)&&"classes"!==e}),cc=["theme"];function dc(e){let{theme:a}=e,r=kn(e,cc);const n=a[bn];return pa.jsx(Yo,fn({},r,{themeId:n?bn:void 0,theme:n||a}))}"production"!==process.env.NODE_ENV&&(dc.propTypes={children:Wn.node,theme:Wn.oneOfType([Wn.object,Wn.func]).isRequired});const uc=()=>{const e=El();return[...e.breakpoints.keys].reduce(((a,r)=>No(e.breakpoints.up(r))?r:a),null)??"sm"},hc=({breakpoint:e})=>{const a=f(),r=Array.from({length:6},((e,a)=>a));return e||(e=uc()),pa.jsxs(v,{sx:{alignItems:"center",height:"100%",left:0,pointerEvents:"none",position:"fixed",top:0,width:"100%",zIndex:({zIndex:e})=>e.tooltip},children:[pa.jsx(A,{sx:{background:a.custom.palette.red[300],display:"flex",flex:1,opacity:.3,position:"relative"},children:pa.jsx(q,{sx:{background:a.custom.palette.purple[300],display:"flex",flex:1},children:pa.jsxs(I,{container:!0,spacing:2,children:[r.map((e=>pa.jsx(I,{item:!0,sm:!0,sx:{display:{sm:"none",md:"block"}},children:pa.jsx(q,{sx:{background:a.custom.palette.green[300],height:"100%"}})},`grid-1-${e}`))),r.map((e=>pa.jsx(I,{item:!0,sm:!0,sx:{display:{sm:"block"}},children:pa.jsx(q,{sx:{background:a.custom.palette.green[300],height:"100%"}})},`grid-2-${e}`)))]})})}),!!e&&pa.jsx(q,{sx:{backgroundColor:a.custom.palette.surface.default,borderRadius:a.spacing(a.custom.radius.md),bottom:16,filter:a.custom.elevationFilter.raised,display:"block",left:16,position:"fixed",px:2,py:1},children:pa.jsx(yr,{variation:"sm",component:"p",weight:"bold",children:e})})]})},mc=e=>({backgroundColor:e.custom.palette.interaction.none,color:e.custom.palette.icon.primary}),gc=e=>({backgroundColor:e.custom.palette.purple[100],color:e.custom.palette.icon.primary,"&:hover":{"&:before":{background:e.custom.palette.interaction.hoverOnDark}},"&:active":{"&:before":{background:e.custom.palette.interaction.pressOnDark}}}),pc=e=>({backgroundColor:e.custom.palette.surface.raised,border:`1px solid ${e.custom.palette.stroke.default}`,color:e.custom.palette.icon.primary,"&.MuiIconButton-root:disabled":{border:"none"}}),bc=e=>({backgroundColor:e.custom.palette.surface.raised,boxShadow:e.custom.elevation.raised,color:e.custom.palette.icon.primary,"&:focus-visible:after":{boxShadow:e.custom.boxShadow.input.focus},"&.MuiIconButton-root:disabled":{boxShadow:"none"}}),fc=(e,a)=>({borderRadius:"default"===e?a.spacing(a.custom.radius.md):a.custom.radius.round}),kc={xs:3*qa,sm:3.5*qa,md:4*qa,lg:5*qa,xl:6*qa},yc=e=>({height:kc[e],width:kc[e]}),vc={xs:2*qa,sm:2*qa,md:2*qa,lg:2.5*qa,xl:3*qa},wc=e=>({height:vc[e],width:vc[e]}),zc=j(R)((({theme:e,variation:a,shape:r="default",sizing:n})=>({boxSizing:"border-box",transition:"all 200ms ease","&:before, &:after":{...r&&{...fc(r,e)},transition:"all 250ms ease",content:'""',position:"absolute",inset:0},"&:hover:before":{backgroundColor:e.custom.palette.interaction.hover},"&:focus:before":{backgroundColor:e.custom.palette.interaction.hover},"&:active:before":{backgroundColor:e.custom.palette.interaction.press},"&:focus-visible":{boxShadow:e.custom.boxShadow.input.focus},...r&&{...fc(r,e)},...n&&{...yc(n)},"&.MuiIconButton-root":{..."default"===a&&{...mc(e)},..."toggle"===a&&{...gc(e)},..."outlined"===a&&{...pc(e)},..."raised"===a&&{...bc(e)},"&:disabled":{backgroundColor:e.custom.palette.interaction.disabled,color:e.custom.palette.icon.disabled}},"& .MuiSvgIcon-root":{...n&&{...wc(n)},position:"relative",zIndex:1}}))),jc=({icon:e,loading:a,sizing:r,...n})=>pa.jsx(zc,{...n,sizing:r,children:a?pa.jsx(Pr,{sizing:r}):e}),xc=(e,a)=>({"&:after":{content:'""',position:"absolute",bottom:0,width:0,height:1,borderBottom:`1px solid ${e.custom.palette.stroke.default}`,background:"grey"},borderRadius:0,"&:first-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderBottomLeftRadius:0,borderBottomRightRadius:0},"&:last-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopRightRadius:0,borderTopLeftRadius:0,"&:after":{content:"none"}}}),$c=(e,a)=>({"&:after":{content:'""',position:"absolute",right:0,width:1,height:0,borderRight:`1px solid ${e.custom.palette.stroke.default}`,background:"grey"},borderRadius:0,"&:first-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopRightRadius:0,borderBottomRightRadius:0},"&:last-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopLeftRadius:0,borderBottomLeftRadius:0,"&:after":{content:"none"}}}),qc=j(L)((({theme:e,variation:a,orientation:r="horizontal",iconColor:n,sizing:i="lg",groupRaised:t=!1})=>({"&.MuiButtonGroup-root":{border:`1px solid ${e.custom.palette.stroke.default}`,...t&&{boxShadow:e.custom.elevation.raised,border:"none"},"& > button":{..."default"===a&&{...mc(e)},..."toggle"===a&&{...gc(e)},..."vertical"===r&&{...xc(e)},..."horizontal"===r&&{...$c(e)},...i&&{...yc(i)}},"& .MuiSvgIcon-root":{...i&&{...wc(i)},fill:n||"inherit"}}}))),Cc=({ButtonGroupProps:e,children:a,...r})=>pa.jsx(qc,{...r,...e,children:a}),Sc=({sx:e,...a})=>pa.jsx(an,{...a,sx:ba({fontSize:{xs:qr.sm.body.md,sm:qr.sm.body.md,md:qr.sm.body.md,lg:qr.lg.body.md,xl:qr.lg.body.md}},!!e&&{...e})}),Oc=j(q)((({theme:e})=>({"& .MuiGrid-item":{"&:first-of-type":{"& .MuiBox-root":{"&:before":{width:wa,borderRadius:e.custom.radius.round,right:"50%",transform:`translateX(-${wa}px)`,left:"auto"}}},"&:last-child":{"& .MuiBox-root":{"&:after":{width:wa,borderRadius:e.custom.radius.round,right:"auto",left:"50%",transform:`translateX(${wa}px)`}}}}}))),Ec=({children:e,width:a})=>pa.jsx(Oc,{sx:{width:a},children:e}),Mc=j(rn)((()=>({lineHeight:"110%",textAlign:"center",width:"100%"}))),_c=({disabled:e,children:a})=>pa.jsx(Mc,{showicon:!1,disabled:e,sx:{cursor:"inherit"},children:a}),Ac=j(sn)((()=>({marginRight:0}))),Dc=j(q)((({theme:e})=>({posiion:"relative","&:before":{content:'""',position:"absolute",top:"50%",left:0,height:ya,width:`calc(50% - ${ja/2}px)`,zIndex:0,backgroundColor:e.custom.palette.stroke.default},"&:after":{content:'""',position:"absolute",top:"50%",right:0,height:ya,width:`calc(50% - ${ja/2}px)`,zIndex:0,backgroundColor:e.custom.palette.stroke.default}}))),Nc=e=>pa.jsx(Dc,{sx:{textAlign:"center",position:"relative"},children:pa.jsx(Ac,{...e})}),Tc=({options:e=[],disabled:a=!1,sizing:r="lg",onChange:n,internalChange:i,value:t})=>{const o=f();function s(e){console.warn(e),n(e.value),i&&i()}return pa.jsx(q,{children:pa.jsx(Ec,{children:pa.jsx(I,{container:!0,justifyContent:"space-between",children:e.map((e=>pa.jsxs(I,{item:!0,sm:!0,onClick:()=>s(e),sx:{cursor:"pointer",textAlign:"center","&:hover":{"& .MuiButtonBase-root.MuiRadio-root":{"&:before":{backgroundColor:o.custom.palette.interaction.hover}}},"&:active":{"& .MuiButtonBase-root.MuiRadio-root":{backgroundColor:o.custom.palette.input.default,borderColor:o.custom.palette.stroke.focus,boxShadow:o.custom.boxShadow.input.focus,"&:before":{backgroundColor:o.custom.palette.interaction.press},"&.Mui-checked":{backgroundColor:o.custom.palette.purple[500]}}}},children:[pa.jsx(Nc,{sizing:r,disabled:a,onChange:a=>s(e),checked:t===e.value},e.value),pa.jsx(q,{sx:{mt:Ca.xs,width:"100%"},children:pa.jsx(_c,{disabled:a,children:e.label})})]},e.value)))})})})},Ic=j(B)((({theme:e,disabled:a})=>({"&:focus-visible":{boxShadow:e.custom.boxShadow.input.focus,borderRadius:e.spacing(e.custom.radius.sm),outline:"none"},"&.MuiLink-root":{transition:"all 200ms ease",display:"inline",cursor:"pointer",color:a?e.custom.palette.text.lockedWhite:e.custom.palette.text.textLink,textDecorationColor:e.custom.palette.text.textLink,pointerEvents:a?"none":"auto","&:hover":{color:a?e.custom.palette.text.disabled:e.custom.palette.text.textLinkHover,textDecorationColor:a?e.custom.palette.text.disabled:e.custom.palette.text.textLinkHover},"&:active":{color:e.custom.palette.text.textLinkHover,textDecorationColor:e.custom.palette.text.textLinkHover},"&:visited":{color:a?e.custom.palette.text.disabled:e.custom.palette.text.textLink,textDecorationColor:a?e.custom.palette.text.disabled:e.custom.palette.text.textLink}}}))),Fc=e=>e.target&&"_blank"===e.target?pa.jsx(Ic,{rel:"noopener",...e}):pa.jsx(Ic,{...e}),Pc=()=>pa.jsx(q,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"calc(100dvh - 80px)"},children:pa.jsx("img",{src:"https://useloops-public.s3.eu-west-2.amazonaws.com/public/landing/brand/loading-animation.gif",width:125})}),Rc=e=>pa.jsx("svg",{viewBox:"0 0 80 25",fill:"currentColor",...e,children:pa.jsx("path",{d:"M8.72886 20.0975C7.43461 19.1995 7.16357 18.9302 7.16357 16.9549V0.988281H-0.000106812V1.28748L0.0165316 1.29764C1.3293 2.09875 1.92633 2.46309 1.92633 4.43011V16.9549C1.92633 18.9302 1.65553 19.1995 0.361043 20.0975V20.3965H8.72886V20.0975ZM14.5709 13.437C13.7868 9.01598 14.1045 7.0153 16.0905 6.66718C18.0767 6.31907 19.0631 8.09095 19.8472 12.512C20.6311 16.933 20.3137 18.9335 18.3275 19.2816C16.3415 19.6299 15.3548 17.8578 14.5709 13.437ZM9.11663 14.3934C9.93203 18.9911 14.141 21.3529 18.5575 20.5785C22.9743 19.8041 26.1169 16.1534 25.3015 11.5559C24.4861 6.95793 20.2773 4.5961 15.8605 5.3705C11.444 6.14467 8.30123 9.79541 9.11663 14.3934ZM33.3669 6.66718C31.381 7.0153 31.0633 9.01598 31.8474 13.437C32.6313 17.8578 33.618 19.6299 35.6039 19.2816C37.5901 18.9335 37.9076 16.933 37.1237 12.512C36.3396 8.09095 35.3531 6.31907 33.3669 6.66718ZM35.834 20.5785C31.4175 21.3529 27.2085 18.9911 26.3931 14.3934C25.5777 9.79541 28.7205 6.14467 33.137 5.3705C37.5538 4.5961 41.7625 6.95793 42.5779 11.5559C43.3933 16.1534 40.2508 19.8041 35.834 20.5785ZM52.9075 18.9002C51.0712 18.9002 49.6266 16.8353 49.6266 14.441V12.3162C49.6266 9.6524 50.9209 7.64737 52.9075 7.64737C54.9843 7.64737 56.0078 9.53285 56.0078 12.7351C56.0078 16.955 54.9542 18.9002 52.9075 18.9002ZM51.6733 24.5936C50.1696 23.7488 49.6266 23.4437 49.6266 21.5189V17.9125C50.4091 19.4689 51.9744 20.6958 54.5629 20.6958C58.476 20.6958 61.5762 17.763 61.5762 12.7052C61.5762 7.55754 58.5663 5.25308 55.1047 5.25308C52.2753 5.25308 50.3187 6.83937 49.6266 9.02405L49.5063 5.55228H42.5833V5.85171L42.5873 5.85427C43.8786 6.69033 44.3891 7.02081 44.3891 8.99411V21.5189C44.3891 23.4942 44.1183 23.7637 42.824 24.6613V24.9605H51.7937V24.6613L51.6733 24.5936ZM79.8954 18.9002C79.8954 19.8689 79.1055 20.6543 78.1313 20.6543C77.157 20.6543 76.3671 19.8689 76.3671 18.9002C76.3671 17.9315 77.157 17.1462 78.1313 17.1462C79.1055 17.1462 79.8954 17.9315 79.8954 18.9002ZM70.0692 10.2734C68.0387 9.67975 66.9044 9.34812 66.9044 8.15614C66.9044 7.16849 67.8074 6.71957 68.8309 6.71957C70.7874 6.71957 72.3224 7.827 74.0985 10.4007H74.5196V5.25306H74.2187L72.8642 6.24072C72.8031 6.21577 72.742 6.19075 72.681 6.16573C71.5696 5.71024 70.454 5.25306 68.7707 5.25306C65.55 5.25306 62.9916 7.22837 62.9916 10.1612C62.9916 12.795 64.2557 14.2912 68.8008 15.4585C70.4863 15.8775 71.6601 16.1767 71.6601 17.4636C71.6601 18.6608 70.4863 19.2293 69.0718 19.2293C66.9044 19.2293 65.3093 17.763 63.2021 14.9797H62.7509L63.0819 20.6661H63.413L64.6169 19.4688C65.5801 19.9477 67.0851 20.6958 69.1019 20.6958C72.9546 20.6958 75.6334 18.571 75.6334 15.5783C75.6334 12.4956 73.7672 11.3584 70.095 10.2809L70.0692 10.2734Z"})});function Lc(e,a){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&a.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)a.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}var Bc;function Vc(){}function Hc(e){return!!(e||"").match(/\d/)}function Wc(e){return null==e}function Uc(e){return Wc(e)||function(e){return"number"==typeof e&&isNaN(e)}(e)||"number"==typeof e&&!isFinite(e)}function Gc(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Kc(e,a){void 0===a&&(a=!0);var r="-"===e[0],n=r&&a,i=(e=e.replace("-","")).split(".");return{beforeDecimal:i[0],afterDecimal:i[1]||"",hasNegation:r,addNegation:n}}function Zc(e,a,r){for(var n="",i=r?"0":"",t=0;t<=a-1;t++)n+=e[t]||i;return n}function Jc(e,a){return Array(a+1).join(e)}function Yc(e){var a=e+"",r="-"===a[0]?"-":"";r&&(a=a.substring(1));var n=a.split(/[eE]/g),i=n[0],t=n[1];if(!(t=Number(t)))return r+i;var o=1+t,s=(i=i.replace(".","")).length;return o<0?i="0."+Jc("0",Math.abs(o))+i:o>=s?i+=Jc("0",o-s):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Xc(e,a,r){if(-1!==["","-"].indexOf(e))return e;var n=(-1!==e.indexOf(".")||r)&&a,i=Kc(e),t=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,l=parseFloat("0."+(o||"0")),c=(o.length<=a?"0."+o:l.toFixed(a)).split("."),d=t;return t&&Number(c[0])&&(d=t.split("").reverse().reduce((function(e,a,r){return e.length>r?(Number(e[0])+Number(a)).toString()+e.substring(1,e.length):a+e}),c[0])),""+(s?"-":"")+d+(n?".":"")+Zc(c[1]||"",a,r)}function Qc(e,a){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",a),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(a,a),!0):(e.focus(),!1)}}!function(e){e.event="event",e.props="prop"}(Bc||(Bc={}));var ed,ad,rd,nd=(ed=function(e,a){for(var r=0,n=0,i=e.length,t=a.length;e[r]===a[r]&&r<i;)r++;for(;e[i-1-n]===a[t-1-n]&&t-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:t-n}}},rd=void 0,function(){for(var e=[],a=arguments.length;a--;)e[a]=arguments[a];return ad&&e.length===ad.length&&e.every((function(e,a){return e===ad[a]}))?rd:(ad=e,rd=ed.apply(void 0,e))});function id(e){return Math.max(e.selectionStart,e.selectionEnd)}function td(e){var a=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return a[n]===r[i]}function od(e,a,r,n){var i,t,o,s=e.length;if(i=a,t=0,o=s,a=Math.min(Math.max(i,t),o),"left"===n){for(;a>=0&&!r[a];)a--;-1===a&&(a=r.indexOf(!0))}else{for(;a<=s&&!r[a];)a++;a>s&&(a=r.lastIndexOf(!0))}return-1===a&&(a=s),a}function sd(e){for(var a=Array.from({length:e.length+1}).map((function(){return!0})),r=0,n=a.length;r<n;r++)a[r]=Boolean(Hc(e[r])||Hc(e[r-1]));return a}function ld(e,a,i,o,s,l){void 0===l&&(l=Vc);var c=function(e){var a=r(e);a.current=e;var n=r((function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return a.current.apply(a,e)}));return n.current}((function(e,a){var r,n;return Uc(e)?(n="",r=""):"number"==typeof e||a?(n="number"==typeof e?Yc(e):e,r=o(n)):(n=s(e,void 0),r=o(n)),{formattedValue:r,numAsString:n}})),d=n((function(){return c(Wc(e)?a:e,i)})),u=d[0],h=d[1],m=e,g=i;Wc(e)&&(m=u.numAsString,g=!0);var p=c(m,g);return t((function(){h(p)}),[p.formattedValue]),[u,function(e,a){e.formattedValue!==u.formattedValue&&h({formattedValue:e.formattedValue,numAsString:e.value}),l(e,a)}]}function cd(e){return e.replace(/[^0-9]/g,"")}function dd(e){return e}function ud(e){var t=e.type;void 0===t&&(t="text");var s=e.displayType;void 0===s&&(s="input");var l=e.customInput,c=e.renderText,d=e.getInputRef,u=e.format;void 0===u&&(u=dd);var h=e.removeFormatting;void 0===h&&(h=cd);var m=e.defaultValue,g=e.valueIsNumericString,p=e.onValueChange,b=e.isAllowed,f=e.onChange;void 0===f&&(f=Vc);var k=e.onKeyDown;void 0===k&&(k=Vc);var y=e.onMouseUp;void 0===y&&(y=Vc);var v=e.onFocus;void 0===v&&(v=Vc);var w=e.onBlur;void 0===w&&(w=Vc);var z=e.value,j=e.getCaretBoundary;void 0===j&&(j=sd);var x=e.isValidInputCharacter;void 0===x&&(x=Hc);var $=e.isCharacterSame,q=Lc(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),C=ld(z,m,Boolean(g),u,h,p),S=C[0],O=S.formattedValue,E=S.numAsString,M=C[1],_=r(),A=r({formattedValue:O,numAsString:E}),D=function(e,a){A.current={formattedValue:e.formattedValue,numAsString:e.value},M(e,a)},N=n(!1),T=N[0],I=N[1],F=r(null),P=r({setCaretTimeout:null,focusTimeout:null});i((function(){return I(!0),function(){clearTimeout(P.current.setCaretTimeout),clearTimeout(P.current.focusTimeout)}}),[]);var R=u,L=function(e,a){var r=parseFloat(a);return{formattedValue:e,value:a,floatValue:isNaN(r)?void 0:r}},B=function(e,a,r){0===e.selectionStart&&e.selectionEnd===e.value.length||(Qc(e,a),P.current.setCaretTimeout=setTimeout((function(){e.value===r&&e.selectionStart!==a&&Qc(e,a)}),0))},V=function(e,a,r){return od(e,a,j(e),r)},H=function(e,a,r){var n=j(a),i=function(e,a,r,n,i,t,o){void 0===o&&(o=td);var s=i.findIndex((function(e){return e})),l=e.slice(0,s);a||r.startsWith(l)||(a=l,r=l+r,n+=l.length);for(var c=r.length,d=e.length,u={},h=new Array(c),m=0;m<c;m++){h[m]=-1;for(var g=0,p=d;g<p;g++)if(o({currentValue:r,lastValue:a,formattedValue:e,currentValueIndex:m,formattedValueIndex:g})&&!0!==u[g]){h[m]=g,u[g]=!0;break}}for(var b=n;b<c&&(-1===h[b]||!t(r[b]));)b++;var f=b===c||-1===h[b]?d:h[b];for(b=n-1;b>0&&-1===h[b];)b--;var k=-1===b||-1===h[b]?0:h[b]+1;return k>f?f:n-k<f-n?k:f}(a,O,e,r,n,x,$);return i=od(a,i,n)};i((function(){var e=A.current,a=e.formattedValue,r=e.numAsString;O===a&&E===r||D(L(O,E),{event:void 0,source:Bc.props})}),[O,E]);var W=F.current?id(F.current):void 0;("undefined"!=typeof window?o:i)((function(){var e=F.current;if(O!==A.current.formattedValue&&e){var a=H(A.current.formattedValue,O,W);e.value=O,B(e,a,O)}}),[O]);var U=function(e,a,r){var n=a.target,i=_.current?function(e,a){var r=Math.min(e.selectionStart,a);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:a}}}(_.current,n.selectionEnd):nd(O,e),t=Object.assign(Object.assign({},i),{lastValue:O}),o=h(e,t),s=R(o);if(o=h(s,void 0),b&&!b(L(s,o))){var l=a.target,c=id(l),d=H(e,O,c);return l.value=O,B(l,d,O),!1}return function(e){var a=e.formattedValue;void 0===a&&(a="");var r,n=e.input,i=e.source,t=e.event,o=e.numAsString;if(n){var s=e.inputValue||n.value,l=id(n);n.value=a,void 0!==(r=H(s,a,l))&&B(n,r,a)}a!==O&&D(L(a,o),{event:t,source:i})}({formattedValue:s,numAsString:o,inputValue:e,event:a,source:r,input:a.target}),!0},G=function(e,a){void 0===a&&(a=0);var r=e.selectionStart,n=e.selectionEnd;_.current={selectionStart:r,selectionEnd:n+a}},K=!T||"undefined"==typeof navigator||navigator.platform&&/iPhone|iPod/.test(navigator.platform)?void 0:"numeric",Z=Object.assign({inputMode:K},q,{type:t,value:O,onChange:function(e){var a=e.target.value;U(a,e,Bc.event)&&f(e),_.current=void 0},onKeyDown:function(e){var a,r=e.target,n=e.key,i=r.selectionStart,t=r.selectionEnd,o=r.value;void 0===o&&(o=""),"ArrowLeft"===n||"Backspace"===n?a=Math.max(i-1,0):"ArrowRight"===n?a=Math.min(i+1,o.length):"Delete"===n&&(a=i);var s=0;"Delete"===n&&i===t&&(s=1);var l="ArrowLeft"===n||"ArrowRight"===n;if(void 0===a||i!==t&&!l)return k(e),void G(r,s);var c=a;l?(c=V(o,a,"ArrowLeft"===n?"left":"right"))!==a&&e.preventDefault():"Delete"!==n||x(o[a])?"Backspace"!==n||x(o[a])||(c=V(o,a,"left")):c=V(o,a,"right");c!==a&&B(r,c,o),k(e),G(r,s)},onMouseUp:function(e){var a=e.target,r=function(){var e=a.selectionStart,r=a.selectionEnd,n=a.value;if(void 0===n&&(n=""),e===r){var i=V(n,e);i!==e&&B(a,i,n)}};r(),requestAnimationFrame((function(){r()})),y(e),G(a)},onFocus:function(e){e.persist&&e.persist();var a=e.target,r=e.currentTarget;F.current=a,P.current.focusTimeout=setTimeout((function(){var n=a.selectionStart,i=a.selectionEnd,t=a.value;void 0===t&&(t="");var o=V(t,n);o===n||0===n&&i===t.length||B(a,o,t),v(Object.assign(Object.assign({},e),{currentTarget:r}))}),0)},onBlur:function(e){F.current=null,clearTimeout(P.current.focusTimeout),clearTimeout(P.current.setCaretTimeout),w(e)}});if("text"===s)return c?a.createElement(a.Fragment,null,c(O,q)||null):a.createElement("span",Object.assign({},q,{ref:d}),O);if(l){var J=l;return a.createElement(J,Object.assign({},Z,{ref:d}))}return a.createElement("input",Object.assign({},Z,{ref:d}))}function hd(e,a){var r=a.decimalScale,n=a.fixedDecimalScale,i=a.prefix;void 0===i&&(i="");var t=a.suffix;void 0===t&&(t="");var o=a.allowNegative,s=a.thousandsGroupStyle;if(void 0===s&&(s="thousand"),""===e||"-"===e)return e;var l=md(a),c=l.thousandSeparator,d=l.decimalSeparator,u=0!==r&&-1!==e.indexOf(".")||r&&n,h=Kc(e,o),m=h.beforeDecimal,g=h.afterDecimal,p=h.addNegation;return void 0!==r&&(g=Zc(g,r,!!n)),c&&(m=function(e,a,r){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),i=e.search(/[1-9]/);return i=-1===i?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+a)}(m,c,s)),i&&(m=i+m),t&&(g+=t),p&&(m="-"+m),e=m+(u&&d||"")+g}function md(e){var a=e.decimalSeparator;void 0===a&&(a=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return!0===r&&(r=","),n||(n=[a,"."]),{decimalSeparator:a,thousandSeparator:r,allowedDecimalSeparators:n}}function gd(e,a,r){var n;void 0===a&&(a=function(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}(e));var i=r.allowNegative,t=r.prefix;void 0===t&&(t="");var o=r.suffix;void 0===o&&(o="");var s=r.decimalScale,l=a.from,c=a.to,d=c.start,u=c.end,h=md(r),m=h.allowedDecimalSeparators,g=h.decimalSeparator,p=e[u]===g;if(Hc(e)&&(e===t||e===o)&&""===a.lastValue)return e;if(u-d==1&&-1!==m.indexOf(e[d])){var b=0===s?"":g;e=e.substring(0,d)+b+e.substring(d+1,e.length)}var f=function(e,a,r){var n=!1,i=!1;t.startsWith("-")?n=!1:e.startsWith("--")?(n=!1,i=!0):o.startsWith("-")&&e.length===o.length?n=!1:"-"===e[0]&&(n=!0);var s=n?1:0;return i&&(s=2),s&&(e=e.substring(s),a-=s,r-=s),{value:e,start:a,end:r,hasNegation:n}},k=f(e,d,u),y=k.hasNegation;e=(n=k).value,d=n.start,u=n.end;var v=f(a.lastValue,l.start,l.end),w=v.start,z=v.end,j=v.value,x=e.substring(d,u);!(e.length&&j.length&&(w>j.length-o.length||z<t.length))||x&&o.startsWith(x)||(e=j);var $=0;e.startsWith(t)?$+=t.length:d<t.length&&($=d),u-=$;var q=(e=e.substring($)).length,C=e.length-o.length;e.endsWith(o)?q=C:(u>C||u>e.length-o.length)&&(q=u),e=e.substring(0,q),e=function(e,a){void 0===e&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),t=n.test(e);return e=e.replace(/-/g,""),i&&!t&&a&&(e="-"+e),e}(y?"-"+e:e,i),e=(e.match(function(e){return new RegExp("(^-)|[0-9]|"+Gc(e),"g")}(g))||[]).join("");var S=e.indexOf(g);e=e.replace(new RegExp(Gc(g),"g"),(function(e,a){return a===S?".":""}));var O=Kc(e,i),E=O.beforeDecimal,M=O.afterDecimal,_=O.addNegation;return c.end-c.start<l.end-l.start&&""===E&&p&&!parseFloat(M)&&(e=_?"-":""),e}function pd(e){e=function(e){var a=md(e),r=a.thousandSeparator,n=a.decimalSeparator,i=e.prefix;void 0===i&&(i="");var t=e.allowNegative;if(void 0===t&&(t=!0),r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");return i.startsWith("-")&&t&&(console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: "+i+"\n allowNegative: "+t+"\n "),t=!1),Object.assign(Object.assign({},e),{allowNegative:t})}(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var a=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;void 0===i&&(i=Vc);var t=e.onBlur;void 0===t&&(t=Vc);var o=e.thousandSeparator,s=e.decimalScale,l=e.fixedDecimalScale,c=e.prefix;void 0===c&&(c="");var d=e.defaultValue,u=e.value,h=e.valueIsNumericString,m=e.onValueChange,g=Lc(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),p=md(e),b=p.decimalSeparator,f=p.allowedDecimalSeparators,k=function(a){return hd(a,e)},y=function(a,r){return gd(a,r,e)},v=Wc(u)?d:u,w=null!=h?h:function(e,a,r){return""===e||!(null==a?void 0:a.match(/\d/))&&!(null==r?void 0:r.match(/\d/))&&"string"==typeof e&&!isNaN(Number(e))}(v,c,a);Wc(u)?Wc(d)||(w=w||"number"==typeof d):w=w||"number"==typeof u;var z=function(e){return Uc(e)?e:("number"==typeof e&&(e=Yc(e)),w&&"number"==typeof s?Xc(e,s,Boolean(l)):e)},j=ld(z(u),z(d),Boolean(w),k,y,m),x=j[0],$=x.numAsString,q=x.formattedValue,C=j[1];return Object.assign(Object.assign({},g),{value:q,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===b||Hc(e)},isCharacterSame:function(e){var a=e.currentValue,r=e.lastValue,n=e.formattedValue,i=e.currentValueIndex,t=e.formattedValueIndex,o=a[i],d=n[t],h=nd(r,a).to,m=function(e){return y(e).indexOf(".")+c.length};return!(0===u&&l&&s&&a[h.start]===b&&m(a)<i&&m(n)>t)&&(!!(i>=h.start&&i<h.end&&f&&f.includes(o)&&d===b)||o===d)},onValueChange:C,format:k,removeFormatting:y,getCaretBoundary:function(a){return function(e,a){var r=a.prefix;void 0===r&&(r="");var n=a.suffix;void 0===n&&(n="");var i=Array.from({length:e.length+1}).map((function(){return!0})),t="-"===e[0];i.fill(!1,0,r.length+(t?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}(a,e)},onKeyDown:function(e){var a=e.target,n=e.key,t=a.selectionStart,d=a.selectionEnd,u=a.value;if(void 0===u&&(u=""),("Backspace"===n||"Delete"===n)&&d<c.length)e.preventDefault();else if(t===d){"Backspace"===n&&"-"===u[0]&&t===c.length+1&&r&&Qc(a,1),s&&l&&("Backspace"===n&&u[t-1]===b?(Qc(a,t-1),e.preventDefault()):"Delete"===n&&u[t]===b&&e.preventDefault()),(null==f?void 0:f.includes(n))&&u[t]===b&&Qc(a,t+1);var h=!0===o?",":o;"Backspace"===n&&u[t-1]===h&&Qc(a,t-1),"Delete"===n&&u[t]===h&&Qc(a,t+1),i(e)}else i(e)},onBlur:function(a){var r=$;if(r.match(/\d/g)||(r=""),n||(r=function(e){if(!e)return e;var a="-"===e[0];a&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(a?"-":"")+n+(i?"."+i:"")}(r)),l&&s&&(r=Xc(r,s,l)),r!==$){var i=hd(r,e);C({formattedValue:i,value:r,floatValue:parseFloat(r)},{event:a,source:Bc.event})}t(a)}})}function bd(e){var r=pd(e);return a.createElement(ud,Object.assign({},r))}const fd=(e,a,r)=>0===e||e?a&&e<a?a:r&&e>r?r:e:a||0,kd=s((({inputRef:e,onChange:a,name:r,min:i,max:t,value:o,...s},c)=>{const d=f(),[u,h]=n(fd(o,i,t)||0),m=e=>{h((a=>fd(e?a+1:a-1,i,t)))},g=l((()=>{const e=fd(u,i,t);a&&a({target:{value:e}}),h(e)}),[u]);return pa.jsxs(pa.Fragment,{children:[pa.jsx(bd,{...s,style:{width:"100%"},getInputRef:e,allowNegative:i&&Math.sign(i),autoFocus:!1,value:u,onValueChange:({floatValue:e})=>{h(e)},onBlurCapture:g}),pa.jsxs(v,{sx:{position:"absolute",top:0,right:0,height:"100%",ml:"auto",width:32,borderLeft:`1px solid ${d.custom.palette.stroke.default}`},children:[pa.jsx(V,{onClick:()=>m(!0),sx:{flex:1,borderTopRightRadius:d.spacing(d.custom.radius.md),fontSize:16,"&:hover":{background:d.custom.palette.interaction.hover}},children:pa.jsx(Oe,{fontSize:"inherit"})}),pa.jsx(H,{}),pa.jsx(V,{onClick:()=>m(!1),sx:{flex:1,borderBottomRightRadius:d.spacing(d.custom.radius.md),fontSize:16,"&:hover":{background:d.custom.palette.interaction.hover}},children:pa.jsx(Ee,{fontSize:"inherit"})})]})]})})),yd=({startAdornment:e,endAdornment:a,placeholder:r,onChange:n,internalChange:i,inputRef:t,min:o,max:s,...l})=>pa.jsx(Gr,{placeholder:r,sx:{height:xa,"& .MuiOutlinedInput-input":{pl:e?1:2,pr:e?1:2}},inputRef:t,inputProps:{min:o,max:s},InputProps:{inputComponent:kd,endAdornment:a?pa.jsx(E,{position:"start",sx:{pr:1},children:a}):null},...l,onChange:e=>{n&&n(e),i&&i()}}),vd=(e,a)=>"light"===a?{fontWeight:400}:{fontWeight:500,textTransform:"uppercase"},wd=(e,a,r)=>{switch(a){case"peach":return{background:e.custom.palette.peach[100],color:"heavy"===r?e.custom.palette.peach[1e3]:e.custom.palette.peach[800]};case"peachDark":return{background:e.custom.palette.peach[800],color:e.custom.palette.peach[0]};case"purple":return{background:e.custom.palette.purple[100],color:"heavy"===r?e.custom.palette.purple[1e3]:e.custom.palette.purple[800]};default:return{background:e.custom.palette.neutral[100],color:"heavy"===r?e.custom.palette.neutral[1e3]:e.custom.palette.neutral[800]}}},zd=j(W)((({theme:e,variation:a,weight:r})=>({borderRadius:e.spacing(e.custom.radius.md),height:28,...wd(e,a,r),"& .MuiChip-label":{fontSize:`${qr.sm.body.sm}`,padding:`0 ${e.spacing(e.custom.padding.sm)}`,...vd(0,r)},"& .MuiChip-icon":{width:"0.8em",height:"0.8em",marginRight:-4,...wd(e,a,r),...vd(0,r)}}))),jd=({body:e,maxWidth:a,...r})=>pa.jsx(zd,{label:e,sx:{...a&&{maxWidth:`${a}px`}},...r}),xd=j("iframe")((()=>({border:"none",height:"100%",width:"100%"}))),$d=e=>{const[a,r]=n(null),i=a?.contentWindow?.document?.body,t=Ji({key:"css",container:a?.contentWindow?.document?.head,prepend:!0});return pa.jsx(xd,{ref:r,children:i&&Ve(pa.jsx(Te,{value:t,children:e.children}),i)})},qd=()=>pa.jsxs(v,{gap:.5,flexDirection:"row",children:[pa.jsx(k,{sx:{width:67,height:12},viewBox:"0 0 67 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:pa.jsx("path",{d:"M2.09034 4.64868H4.09536C5.65956 4.64868 6.41322 4.00878 6.41322 2.84274C6.41322 1.69092 5.65956 1.05102 4.09536 1.05102H2.09034V4.64868ZM2.09034 5.6583V9H0.86742V0.0413991H4.1238C6.34212 0.0413991 7.6077 1.09368 7.6077 2.84274C7.6077 4.60602 6.34212 5.6583 4.1238 5.6583H2.09034ZM9.27266 5.90004C9.27266 7.27938 9.96944 8.26056 11.2208 8.26056C12.4864 8.26056 13.1974 7.27938 13.1974 5.90004C13.1974 4.50648 12.4864 3.53952 11.2208 3.53952C9.96944 3.53952 9.27266 4.50648 9.27266 5.90004ZM14.4061 5.90004C14.4061 7.83396 13.0552 9.17064 11.2208 9.17064C9.40064 9.17064 8.06396 7.83396 8.06396 5.90004C8.06396 3.96612 9.40064 2.61522 11.2208 2.61522C13.0552 2.61522 14.4061 3.96612 14.4061 5.90004ZM19.9082 2.78586L21.2449 7.49268H21.3018L22.738 2.78586H23.8329L21.8564 9H20.7188L19.3963 4.36428H19.3394L18.0312 9H16.8936L14.9028 2.78586H16.083L17.5477 7.49268H17.6046L18.9128 2.78586H19.9082ZM29.4445 6.78168L30.4257 6.89544C30.1271 8.31744 29.0748 9.17064 27.5248 9.17064C25.6762 9.17064 24.3253 7.91928 24.3253 5.98536C24.3253 4.023 25.6762 2.61522 27.4679 2.61522C29.4445 2.61522 30.4541 4.023 30.4541 5.71518V6.17022H25.5056C25.5624 7.40736 26.4299 8.24634 27.539 8.24634C28.5771 8.24634 29.2028 7.74864 29.4445 6.78168ZM25.534 5.445H29.2454C29.217 4.43538 28.634 3.51108 27.4679 3.51108C26.3445 3.51108 25.662 4.40694 25.534 5.445ZM35.5059 2.89962L35.3921 3.96612C35.0509 3.78126 34.8091 3.71016 34.4252 3.71016C33.5293 3.71016 32.861 4.5207 32.861 5.71518V9H31.6807V2.78586H32.861V4.05144C33.0885 3.34044 33.7284 2.61522 34.6243 2.61522C35.0082 2.61522 35.2926 2.71476 35.5059 2.89962ZM40.9288 6.78168L41.91 6.89544C41.6114 8.31744 40.5591 9.17064 39.0091 9.17064C37.1605 9.17064 35.8096 7.91928 35.8096 5.98536C35.8096 4.023 37.1605 2.61522 38.9522 2.61522C40.9288 2.61522 41.9384 4.023 41.9384 5.71518V6.17022H36.9899C37.0468 7.40736 37.9142 8.24634 39.0233 8.24634C40.0614 8.24634 40.6871 7.74864 40.9288 6.78168ZM37.0183 5.445H40.7297C40.7013 4.43538 40.1183 3.51108 38.9522 3.51108C37.8289 3.51108 37.1463 4.40694 37.0183 5.445ZM47.8993 6.07068V5.71518C47.8993 4.36428 47.0461 3.56796 45.9227 3.56796C44.6998 3.56796 44.0172 4.47804 44.0172 5.90004C44.0172 7.32204 44.6998 8.23212 45.9227 8.23212C47.0461 8.23212 47.8993 7.4358 47.8993 6.07068ZM47.8851 9V7.70598C47.6007 8.47386 46.8186 9.17064 45.6525 9.17064C43.8039 9.17064 42.8085 7.73442 42.8085 5.90004C42.8085 4.06566 43.8039 2.61522 45.6525 2.61522C46.8186 2.61522 47.6007 3.32622 47.8851 4.0941V0.0413991H49.0653V9H47.8851ZM54.3847 5.71518V6.07068C54.3847 7.4358 55.2521 8.23212 56.3755 8.23212C57.5984 8.23212 58.2668 7.32204 58.2668 5.90004C58.2668 4.47804 57.5984 3.56796 56.3755 3.56796C55.2521 3.56796 54.3847 4.36428 54.3847 5.71518ZM54.3847 7.70598L54.1288 9H53.2329V0.0413991H54.4132V4.0941C54.6833 3.32622 55.4797 2.61522 56.6457 2.61522C58.4801 2.61522 59.4897 4.06566 59.4897 5.90004C59.4897 7.73442 58.4801 9.17064 56.6315 9.17064C55.4797 9.17064 54.6691 8.48808 54.3847 7.70598ZM62.6822 11.389H61.5304L62.54 8.98578L59.9235 2.78586H61.1607L63.1372 7.56378H63.1941L65.0996 2.78586H66.2656L62.6822 11.389Z",fill:"#473F5C"})}),pa.jsxs(k,{sx:{width:40,height:12},viewBox:"0 0 40 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[pa.jsx("g",{id:"Brand/Wordmark",clipPath:"url(#clip0_900_1816)",children:pa.jsx("path",{id:"Union",fillRule:"evenodd",clipRule:"evenodd",d:"M4.3189 9.56522C3.67851 9.11556 3.54429 8.98169 3.54429 7.99199V0H0V0.149886L0.00580287 0.153463C0.656931 0.554852 0.953183 0.737477 0.953183 1.72311V7.99199C0.953183 8.98169 0.818964 9.11556 0.17858 9.56522V9.7151H4.3189V9.56522ZM4.51113 6.71053C4.91378 9.01144 6.99646 10.1934 9.18264 9.80664C11.3677 9.41876 12.9226 7.58467 12.5199 5.28947C12.1173 2.99428 10.0346 1.80549 7.84841 2.19336C5.66223 2.58124 4.10847 4.40961 4.51113 6.71053ZM7.2103 6.23112C6.8247 4.01831 6.98053 3.01716 7.96215 2.84325C8.94377 2.66819 9.43515 3.55263 9.82074 5.76545C10.2063 7.97826 10.0516 8.97483 9.06889 9.15332C8.08613 9.33181 7.59589 8.44394 7.2103 6.23112ZM17.7306 9.80664C15.5455 10.1934 13.4629 9.01144 13.0591 6.71053C12.6553 4.40961 14.2102 2.58124 16.3963 2.19336C18.5825 1.80549 20.6641 2.99428 21.0678 5.28947C21.4716 7.58467 19.9156 9.41876 17.7306 9.80664ZM16.5101 2.84325C15.5273 3.01716 15.3726 4.01831 15.7582 6.23112C16.1438 8.44394 16.6341 9.33181 17.6168 9.15675C18.5996 8.98169 18.7543 7.98169 18.3687 5.76888C17.9831 3.55606 17.4928 2.66819 16.5101 2.84325ZM25.5683 11.8168C24.8234 11.3931 24.5553 11.2406 24.5553 10.2769L24.5575 8.4794C24.9443 9.25858 25.7189 9.873 26.9997 9.873C28.9356 9.873 30.47 8.40046 30.47 5.86842C30.47 3.29176 28.9743 2.13844 27.2681 2.13844C25.8679 2.13844 24.8988 2.93249 24.5575 4.02631L24.4973 2.28833H21.0724V2.43135L21.0731 2.43181C21.713 2.85024 21.9653 3.01524 21.9653 4.00458V10.2769C21.9653 11.2654 21.8322 11.4005 21.1907 11.8501V12H25.6267V11.8501L25.5683 11.8168ZM26.1784 8.9611C25.2696 8.9611 24.5553 7.92792 24.5553 6.72998V5.66247C24.5553 4.32952 25.1957 3.32494 26.1784 3.32494C27.2055 3.32494 27.7117 4.27002 27.7117 5.87185C27.7117 7.98741 27.1907 8.9611 26.1784 8.9611ZM38.6585 9.84325C39.1403 9.84325 39.5309 9.45034 39.5309 8.96567C39.5309 8.481 39.1403 8.0881 38.6585 8.0881C38.1767 8.0881 37.7861 8.481 37.7861 8.96567C37.7861 9.45034 38.1767 9.84325 38.6585 9.84325ZM34.6585 4.64621C33.661 4.35019 33.0998 4.18365 33.0998 3.5881C33.0998 3.08924 33.5548 2.86842 34.0552 2.86842C35.0244 2.86842 35.783 3.42334 36.6623 4.71167H36.8704V2.13501H36.7214L36.0515 2.62929C36.0223 2.61721 35.9931 2.6051 35.9639 2.59299C35.4126 2.36413 34.8607 2.13501 34.0257 2.13501C32.4321 2.13501 31.1661 3.12357 31.1661 4.59153C31.1661 5.90961 31.7929 6.65904 34.0416 7.24371C34.8765 7.45309 35.4566 7.60297 35.4566 8.24714C35.4566 8.84668 34.8765 9.13043 34.1758 9.13043C33.0998 9.13043 32.3138 8.39702 31.2799 7.00343H31.0524L31.2094 9.85011H31.3731L31.968 9.25057C32.4446 9.49085 33.1897 9.86499 34.1872 9.86499C36.0936 9.86499 37.4198 8.80091 37.4198 7.3032C37.4198 5.75973 36.4985 5.19107 34.6786 4.65217L34.6585 4.64621Z",fill:"#473F5C"})}),pa.jsx("defs",{children:pa.jsx("clipPath",{id:"clip0_900_1816",children:pa.jsx("rect",{width:"39.5321",height:"12",fill:"white"})})})]})]}),Cd=({options:e,onChange:a,other:r,value:t,internalChange:o,...s})=>{const l=r?.enabled,c="other-option",d=`${c}-value-`,[u,h]=n(t),[m,g]=n(!1);i((()=>{!m&&u?.includes(d)?g(!0):m&&g(!1)}),[u]);return pa.jsxs(pa.Fragment,{children:[pa.jsxs(T,{...s,value:u,sx:{display:"flex",gap:e=>e.custom.margin.sm,label:{"&:last-child":{mb:0},"&:hover":{"& .MuiRadio-root":{backgroundColor:e=>e.custom.palette.interaction.hover,"&.Mui-checked":{backgroundColor:e=>e.custom.palette.purple[500]}}}}},onChange:(e,r)=>{a&&a(r),h(r),o&&o()},children:[e?e.map(((e,a)=>pa.jsx(Vr,{sx:{"& .MuiButtonBase-root.MuiRadio-root":{alignSelf:"baseline"}},...e,control:pa.jsx(sn,{})},a))):null,l&&pa.jsx(Vr,{label:r?.label||"Other",value:d,control:pa.jsx(sn,{checked:u?.includes(d)})},c)]}),m&&pa.jsx(q,{sx:{mt:1},children:pa.jsx(Kr,{fullWidth:!0,autoFocus:!0,placeholder:r?.placeholder,defaultValue:u?.replace(d,""),onChange:e=>{var r;a&&a((r=e.target.value,`${d}${r}`)),o&&o()},required:!0})})]})},Sd=c({attributes:{},listeners:void 0,ref(){}}),Od=e=>ea({...e,wasDragging:!0});function Ed({children:e,top:a,bottom:r,id:n}){const{attributes:i,isDragging:o,listeners:s,setNodeRef:l,setActivatorNodeRef:c,transform:d,transition:u}=Qe({id:n,animateLayoutChanges:Od}),h=t((()=>({attributes:i,listeners:s,ref:c})),[i,s,c]),m={opacity:o?.4:void 0,transform:oa.Translate.toString(d),transition:u};return pa.jsx(Sd.Provider,{value:h,children:pa.jsxs(v,{className:"SortableItem",...i,sx:{position:"relative",...m,width:"100%"},ref:l,children:[a&&a,pa.jsx(q,{...s,sx:{display:"flex",cursor:"grab"},children:e}),r&&r]})})}const Md={sideEffects:He({styles:{active:{opacity:"0.4"}}})};function _d({children:e}){return Ve(pa.jsx(We,{zIndex:999999,dropAnimation:Md,children:e}),document.body)}const Ad=({nativeEvent:e})=>{let a=e.target;for(;a;){if(a.dataset.noDnd)return!1;a=a.parentElement}return!0};class Dd extends Ye{static activators=[{eventName:"onMouseDown",handler:Ad}]}class Nd extends Xe{static activators=[{eventName:"onTouchStart",handler:Ad}]}function Td({items:e,onChange:a,renderItem:r,disabled:i,direction:o}){if(!e)return;const[s,l]=n(null),c=t((()=>e.find((e=>e?.id===s?.id))),[s,e]),d=f(),h=U(d.breakpoints.down("md")),m=Ue(Ge(Dd,{activationConstraint:{distance:5}}),Ge(Nd,{activationConstraint:{delay:h?300:0,tolerance:8}}),Ge(Ke,{coordinateGetter:aa}));return pa.jsxs(Ze,{measuring:{droppable:{strategy:Je.Always}},sensors:m,onDragStart:({active:e})=>{l(e)},onDragEnd:({active:r,over:n})=>{if(n&&r.id!==n?.id){const i=e.findIndex((({id:e})=>e===r.id)),t=e.findIndex((({id:e})=>e===n.id));a(ra(e,i,t))}l(null)},onDragCancel:()=>{l(null)},children:[pa.jsx(na,{items:e,disabled:i,strategy:"horizontal"===o?ia:ta,children:pa.jsx(v,{sx:{..."horizontal"===o&&{flexDirection:"row"},display:"flex",m:0,gap:1,padding:0,alignContent:"flex-start"},children:e.map((e=>pa.jsx(u,{children:r(e)},e.id)))})}),pa.jsx(_d,{children:c?r(c,!0,!!s):null})]})}Td.Item=Ed,Td.DragHandle=function(){const{attributes:e,listeners:a,ref:r}=d(Sd);return pa.jsx(q,{...e,...a,ref:r,children:pa.jsx("svg",{viewBox:"0 0 20 20",width:"12",children:pa.jsx("path",{d:"M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"})})})};const Id=({handleSelectAll:e,isIndeterminate:a,isAllSelected:r,sizing:t})=>{const[o,s]=n(!1),l=f();return i((()=>{r&&s(r)}),[r]),pa.jsxs(v,{direction:"row",gap:l.spacing(l.custom.padding.sm),onClick:a=>{const r=!o;s(r),e(a,r)},sx:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"flex-end",p:e=>e.custom.padding.sm},children:[pa.jsx(G,{sx:{cursor:"pointer",fontSize:()=>t&&Sr[t]},children:"Select all"}),pa.jsx(Wr,{sizing:"default",indeterminate:a,checked:o})]})},Fd=s((({children:e,handleSelectAll:a,value:r=[],selections:n,sizing:i,...t},o)=>{const s=r.length===n.length,l=r.length>0&&r.length<n.length;return pa.jsxs("ul",{ref:o,...t,children:[pa.jsx(Id,{handleSelectAll:a,isIndeterminate:l,isAllSelected:s,sizing:i}),e]})})),Pd="0px 4px 8px 0px #06040D14, 0px 16px 24px 0px #06040D14, 0px 0px 4px 2px #06040D0A, 0px 0px 0px 1px #FFFFFF29",Rd=e=>{switch(e){case"xs":return 24;case"md":return 32;default:return 40}},Ld=(e,a)=>({"& .MuiTypography-root":{height:Rd(a),fontSize:Sr[a],display:"flex",alignItems:"center",paddingLeft:e.spacing("xs"===a?e.custom.padding.xs:e.custom.padding.sm),paddingRight:e.spacing("xs"===a?e.custom.padding.xs:e.custom.padding.sm)}}),Bd=e=>({fontSize:`${qr.sm.body.md}`,borderRadius:e.spacing(e.custom.radius.md),position:"relative",padding:e.spacing(e.custom.padding.sm),"& .MuiSelect-outlined":{padding:0},"& .MuiSelect-select.MuiInputBase-input":{paddingRight:e.spacing(Sa.md)},"&:before":{transition:e.custom.easing.input,content:'""',position:"absolute",background:e.custom.palette.interaction.none,borderRadius:e.spacing(e.custom.radius.md),inset:0,zIndex:0},"&:hover:before":{backgroundColor:e.custom.palette.interaction.hover},"&.Mui-focused:before":{backgroundColor:e.custom.palette.interaction.press},"&.Mui-disabled:before":{backgroundColor:e.custom.palette.interaction.none},"& .MuiSelect-select":{position:"relative"}}),Vd=(e,a)=>{switch(a){case"lg":return{height:Rd(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:Da.lg,height:Da.lg,top:`calc(50% - ${Da.lg/2}px)`}};case"md":return{height:Rd(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:Da.md,height:Da.md,top:`calc(50% - ${Da.md/2}px)`}};case"xs":return{height:Rd(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:Da.xs,height:Da.xs,top:`calc(50% - ${Da.xs/2}px)`}};default:return{height:Rd("lg"),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:Da.lg,height:Da.lg,top:`calc(50% - ${Da.lg/2}px)`}}}},Hd=e=>({position:"relative",fontSize:`${qr.sm.body.md}`,backgroundColor:e.custom.palette.interaction.none,color:e.custom.palette.text.primary,"&:before":{transition:e.custom.easing.input,content:'""',position:"absolute",inset:0,zIndex:1},"& > .MuiBox-root":{position:"relative",zIndex:2,width:"100%","& .MuiSvgIcon-root":{marginRight:e.spacing(e.custom.margin.sm),width:Da.xl,height:Da.xl},"& .MuiBox-root":{padding:e.spacing(e.custom.padding.sm),lineHeight:"22px"}}}),Wd=e=>({"&.MuiModal-root.MuiPopover-root":{"&.MuiMenu-root":{borderRadius:e.spacing(e.custom.radius.sm),"& .MuiPaper-root":{border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.raised,boxShadow:Pd}}}}),Ud=j(K)((({theme:e,sizing:a,value:r})=>({maxWidth:"100%",backgroundColor:e.custom.palette.surface.raised,borderRadius:e.spacing(e.custom.radius.md),border:`1px solid ${e.custom.palette.stroke.default}`,transition:e.custom.easing.input,"& .MuiSvgIcon-root":{...a&&{width:Da[a],height:Da[a]}},"&.MuiAutocomplete-root .MuiOutlinedInput-root .MuiAutocomplete-input":{...a&&{height:"xs"===a?2*qa+"px":3*qa+"px"},paddingTop:0,paddingBottom:0,paddingLeft:r&&r?.length>0?0:e.spacing(e.custom.padding.sm),justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"nowrap"},"& .MuiAutocomplete-inputRoot":{...a&&{fontSize:Sr[a],gap:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs)},display:"flex",alignItems:"flex-start",paddingRight:3*qa+"px",flexWrap:"wrap",height:"auto"},"& .MuiOutlinedInput-root":{display:"flex",alignItems:"center",padding:"0"},"& .MuiAutocomplete-tag":{...a&&{height:"xs"===a?2*qa+"px":3*qa+"px"},margin:0,"& .MuiSvgIcon-root":{height:"12px",width:"12px"}},"&.Mui-disabled":{backgroundColor:`${e.custom.palette.input.disabled}`,borderColor:`${e.custom.palette.stroke.disabled}`},"&.Mui-focused":{backgroundColor:e.custom.palette.input.default,borderColor:e.custom.palette.stroke.focus,boxShadow:e.custom.boxShadow.input.focus},"& .MuiChip-root .MuiChip-label":{height:20,lineHeight:"20px",maxWidth:140,...a&&{padding:`0 ${e.spacing(e.custom.padding.xs)}`}}}))),Gd=j(W)((({theme:e,sizing:a})=>({borderRadius:e.spacing(e.custom.radius.sm),border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.default,...a&&{padding:`0 ${e.spacing(e.custom.padding.xs)}`},"& .MuiChip-deleteIcon":{fill:e.custom.palette.icon.primary,borderRadius:e.custom.radius.round,margin:0,"&:hover":{backgroundColor:e.custom.palette.interaction.hover},"&:active":{backgroundColor:e.custom.palette.interaction.press},"&:disabled":{backgroundColor:e.custom.palette.interaction.disabled,fill:e.custom.palette.icon.disabled}}}))),Kd=j(O)((({theme:e,sizing:a})=>({"& .MuiOutlinedInput-root":{padding:0,...a&&{margin:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs)}},"& .MuiInputBase-input":{padding:"0 14px"},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}))),Zd=j(Z)((({theme:e,sizing:a})=>({"& .MuiPaper-root":{...a&&{margin:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs),marginLeft:"lg"===a?`-${e.spacing(e.custom.padding.sm)}`:`-${e.spacing(e.custom.padding.xs)}`,marginTop:`calc(${"lg"===a?e.spacing(e.custom.margin.sm):e.spacing(e.custom.margin.xs)} + ${e.spacing(e.custom.margin.xs)})`},border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.raised,boxShadow:Pd,borderRadius:e.spacing(e.custom.radius.sm)},[`& .${J.listbox}`]:{overflowX:"hidden",[`& .${J.option}`]:{fontSize:Sr[a],...a&&{height:"lg"===a?5*qa+"px":4*qa+"px"},"> span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'&[aria-selected="true"]':{backgroundColor:e.custom.palette.interaction.hover,display:"flex",alignItems:"center",justifyContent:"space-between"}}}}))),Jd=e=>pa.jsx(Zd,{...e}),Yd=({selections:e,disableClearable:a=!1,disabled:r,internalChange:i,onChange:t,placeholder:o="",renderListItem:l,sizing:c="lg",value:d=[]})=>{const[u,h]=n(e.filter((e=>d.includes(e?.value)))),m=(a,r)=>{if(t){const n=r?e.map((({value:e})=>e)):[];h(r?e:[]),t(a,n,"selectOption"),i&&i()}};return pa.jsx(Ud,{disabledItemsFocusable:!0,autoFocus:!1,disableCloseOnSelect:!0,blurOnSelect:!1,popupIcon:pa.jsx(Me,{}),sizing:c,disabled:r,disableClearable:a,autoComplete:!0,multiple:!0,renderInput:e=>pa.jsx(Kd,{...e,placeholder:u.length>0?void 0:o,sizing:c}),options:e,renderTags:(e,a)=>e.map(((e,r)=>{const{key:n,...i}=a({index:r});return pa.jsx(Gd,{sizing:c,deleteIcon:pa.jsx(_e,{fontSize:"small"}),label:e.label,...i},n)})),onChange:(e,a,r)=>{const n=a.map((({value:e})=>e));t&&(h(a),t(e,n,r)),i&&i()},PopperComponent:e=>pa.jsx(Jd,{...e,sizing:c}),isOptionEqualToValue:(e,a)=>e.value===a.value,renderOption:(e,a,{selected:r})=>{const{key:n,...i}=e;return pa.jsxs("li",{...i,children:[pa.jsx("span",{children:l?l(a.label):a.label}),pa.jsx($e,{sx:{visibility:r?"visible":"hidden",fontSize:"16px"}})]},n)},ListboxComponent:s(((a,r)=>pa.jsx(Fd,{ref:r,...a,handleSelectAll:m,value:u,selections:e,sizing:c}))),value:u})},Xd=j(P)((({theme:e})=>({...{...Hd(e)},"&.Mui-focusVisible":{backgroundColor:e.custom.palette.interaction.none},"&.Mui-selected":{backgroundColor:e.custom.palette.input.default,"&.Mui-focusVisible":{backgroundColor:e.custom.palette.input.default}},"&.MuiButtonBase-root.MuiMenuItem-root.Mui-disabled":{backgroundColor:e.custom.palette.input.default,color:e.custom.palette.text.disabled,"&:before":{backgroundColor:e.custom.palette.interaction.disabled}},"&:hover":{backgroundColor:e.custom.palette.input.default,"&:before":{backgroundColor:e.custom.palette.interaction.hover},"&.Mui-selected":{backgroundColor:e.custom.palette.input.default,"&.Mui-focusVisible":{"&:before":{backgroundColor:e.custom.palette.interaction.hover}},"&:before":{backgroundColor:e.custom.palette.interaction.hover}}},"&:active":{"&:before":{backgroundColor:e.custom.palette.interaction.press}}}))),Qd=({children:e,selected:a,...r})=>pa.jsx(Xd,{...r,children:pa.jsxs(q,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[pa.jsx(q,{children:e}),a&&pa.jsx($e,{})]})}),eu=j(Y)((({theme:e,sizing:a})=>({...{...Bd(e)},...a&&{...Vd(e,a)},...a&&{...Ld(e,a)},backgroundColor:e.custom.palette.surface.raised,border:`1px solid ${e.custom.palette.stroke.default}`,transition:e.custom.easing.input,"& .MuiOutlinedInput-notchedOutline":{border:e.custom.palette.stroke.default},"&:hover":{"& .MuiOutlinedInput-notchedOutline":{borderColor:e.custom.palette.stroke.default}},"&.Mui-focused":{backgroundColor:e.custom.palette.input.default,borderColor:e.custom.palette.stroke.focus,boxShadow:e.custom.boxShadow.input.focus},"&.Mui-disabled":{backgroundColor:e.custom.palette.input.disabled,borderColor:e.custom.palette.stroke.disabled,"& .MuiSvgIcon-root":{color:e.custom.palette.icon.disabled,transition:e.custom.easing.input}}}))),au=({selections:e,autoComplete:a=!1,disabled:r=!1,disablePortal:n=!1,inputRef:i,internalChange:t,onChange:o,placeholder:s="",selectOptionProps:l,sizing:c="lg",sx:d,value:u=[],renderListItem:h,...m})=>{const g=f(),p=uc();return a?pa.jsx(Yd,{selections:e,placeholder:s,disabled:r,sizing:c,onChange:(e,a)=>{o&&o(a),t&&t()},value:Array.isArray(u)?u:[],internalChange:t,renderListItem:h}):pa.jsxs(eu,{sizing:c,inputRef:i,MenuProps:{disablePortal:n,sx:Wd,anchorOrigin:{vertical:45,horizontal:"center"}},displayEmpty:!0,IconComponent:Me,renderValue:a=>s&&!a?pa.jsx(yr,{component:"p",variation:"sm"===p||"md"===p?"sm":"lg",sx:{color:g.custom.palette.text.placeholder},children:s}):pa.jsx(yr,{component:"p",variation:"sm"===p||"md"===p?"sm":"lg",children:e?.find((({value:e})=>e===a))?.label}),onChange:(e,a)=>{o&&o(e,a),t&&t()},sx:d,value:u,...m,children:[""!==s.trim()&&pa.jsx(Qd,{disabled:!0,value:"","aria-label":"placeholder",children:s},"placeholder"),e?.map((({value:e,label:a})=>pa.jsx(Qd,{value:e,...l,children:h?h(a):a},e)))]})},ru=j(q)((({theme:e,disabled:a,fullWidth:r})=>({width:r?"100%":"auto",minWidth:240,backgroundColor:a?e.custom.palette.input.disabled:e.custom.palette.surface.raised,border:`1px solid ${a?e.custom.palette.stroke.disabled:e.custom.palette.stroke.default}`,borderRadius:e.spacing(e.custom.radius.lg),padding:e.spacing(e.custom.padding.md),position:"relative",zIndex:0,"&:after":{content:'""',backgroundColor:e.custom.palette.interaction.none,borderRadius:e.spacing(e.custom.radius.lg),position:"absolute",inset:0},"&:hover":{"&:after":{backgroundColor:e.custom.palette.interaction.hover}},"&:active":{"&:after":{backgroundColor:e.custom.palette.interaction.press}},"& svg":{fill:e.custom.palette.icon.primary},...a&&{background:e.custom.palette.input.disabled,borderColor:e.custom.palette.stroke.disabled,"&:after":{backgroundColor:e.custom.palette.interaction.none},"& .MuiBox-root > .MuiSvgIcon-root":{fill:"none"}}}))),nu=j(Sc)((({theme:e})=>({fontSize:qr.button.md,color:e.custom.palette.text.primary,lineHeight:"120%",letterSpacing:"0.16px"}))),iu=({label:e="Placeholder",disabled:a,onChange:r,options:n,fullWidth:i})=>{const t=f(),o=n.map((e=>e.label)).indexOf(e);return pa.jsx(ru,{disabled:a,fullWidth:i,children:pa.jsxs(v,{display:"flex",justifyContent:"space-between",flexDirection:"row",alignItems:"center",sx:{position:"relative",zIndex:1},children:[pa.jsxs(q,{display:"flex",alignItems:"center",sx:{"& svg":{fill:t.custom.palette.icon.secondary}},children:[pa.jsx(Ae,{sx:{width:Da.lg,height:Da.lg,mr:t.custom.padding.sm}}),pa.jsx(nu,{align:"left",disabled:a,children:e})]}),pa.jsx(au,{sizing:"xs",selections:n.map(((e,a)=>({label:`${a+1}`,value:`${a}`}))),disabled:a,value:`${o}`,onChange:function(e){const a=o,i=Number(e.target.value),t=n;let s=1;const l=t.splice(a,s)[0];s=0,t.splice(i,s,l),r(t)},MenuProps:{anchorOrigin:{vertical:ja,horizontal:"center"}}})]})})},tu=({labelTop:e,labelBottom:a,disabled:r,fullWidth:i=!1,options:t,onChange:o,value:s,internalChange:l})=>{const c=f(),[d,u]=n(s||t);function h(e){u(e),o(e.map((({id:e})=>e))),l&&l()}return pa.jsxs(v,{gap:c.custom.margin.sm,textAlign:"center",sx:{width:i?"100%":"auto"},children:[e&&pa.jsx(Sc,{disabled:r,sx:{color:c.custom.palette.text.secondary},children:e}),pa.jsx(Td,{onChange:function(e){u(e),o(e.map((({id:e})=>e))),l&&l()},items:d,direction:"vertical",renderItem:({...e})=>pa.jsx(Ed,{id:e.id,children:pa.jsx(iu,{onChange:h,...e,options:d,disabled:r,selections:e.selections,fullWidth:i})})}),a&&pa.jsx(Sc,{disabled:r,sx:{color:c.custom.palette.text.secondary},children:a})]})};function ou(e){this.content=e}function su(e,a,r){for(let n=0;;n++){if(n==e.childCount||n==a.childCount)return e.childCount==a.childCount?null:r;let i=e.child(n),t=a.child(n);if(i!=t){if(!i.sameMarkup(t))return r;if(i.isText&&i.text!=t.text){for(let e=0;i.text[e]==t.text[e];e++)r++;return r}if(i.content.size||t.content.size){let e=su(i.content,t.content,r+1);if(null!=e)return e}r+=i.nodeSize}else r+=i.nodeSize}}function lu(e,a,r,n){for(let i=e.childCount,t=a.childCount;;){if(0==i||0==t)return i==t?null:{a:r,b:n};let o=e.child(--i),s=a.child(--t),l=o.nodeSize;if(o!=s){if(!o.sameMarkup(s))return{a:r,b:n};if(o.isText&&o.text!=s.text){let e=0,a=Math.min(o.text.length,s.text.length);for(;e<a&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,r--,n--;return{a:r,b:n}}if(o.content.size||s.content.size){let e=lu(o.content,s.content,r-1,n-1);if(e)return e}r-=l,n-=l}else r-=l,n-=l}}ou.prototype={constructor:ou,find:function(e){for(var a=0;a<this.content.length;a+=2)if(this.content[a]===e)return a;return-1},get:function(e){var a=this.find(e);return-1==a?void 0:this.content[a+1]},update:function(e,a,r){var n=r&&r!=e?this.remove(r):this,i=n.find(e),t=n.content.slice();return-1==i?t.push(r||e,a):(t[i+1]=a,r&&(t[i]=r)),new ou(t)},remove:function(e){var a=this.find(e);if(-1==a)return this;var r=this.content.slice();return r.splice(a,2),new ou(r)},addToStart:function(e,a){return new ou([e,a].concat(this.remove(e).content))},addToEnd:function(e,a){var r=this.remove(e).content.slice();return r.push(e,a),new ou(r)},addBefore:function(e,a,r){var n=this.remove(a),i=n.content.slice(),t=n.find(e);return i.splice(-1==t?i.length:t,0,a,r),new ou(i)},forEach:function(e){for(var a=0;a<this.content.length;a+=2)e(this.content[a],this.content[a+1])},prepend:function(e){return(e=ou.from(e)).size?new ou(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=ou.from(e)).size?new ou(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var a=this;e=ou.from(e);for(var r=0;r<e.content.length;r+=2)a=a.remove(e.content[r]);return a},toObject:function(){var e={};return this.forEach((function(a,r){e[a]=r})),e},get size(){return this.content.length>>1}},ou.from=function(e){if(e instanceof ou)return e;var a=[];if(e)for(var r in e)a.push(r,e[r]);return new ou(a)};class cu{constructor(e,a){if(this.content=e,this.size=a||0,null==a)for(let a=0;a<e.length;a++)this.size+=e[a].nodeSize}nodesBetween(e,a,r,n=0,i){for(let t=0,o=0;o<a;t++){let s=this.content[t],l=o+s.nodeSize;if(l>e&&!1!==r(s,n+o,i||null,t)&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,a-i),r,n+i)}o=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,a,r,n){let i="",t=!0;return this.nodesBetween(e,a,((o,s)=>{let l=o.isText?o.text.slice(Math.max(e,s)-s,a-s):o.isLeaf?n?"function"==typeof n?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&r&&(t?t=!1:i+=r),i+=l}),0),i}append(e){if(!e.size)return this;if(!this.size)return e;let a=this.lastChild,r=e.firstChild,n=this.content.slice(),i=0;for(a.isText&&a.sameMarkup(r)&&(n[n.length-1]=a.withText(a.text+r.text),i=1);i<e.content.length;i++)n.push(e.content[i]);return new cu(n,this.size+e.size)}cut(e,a=this.size){if(0==e&&a==this.size)return this;let r=[],n=0;if(a>e)for(let i=0,t=0;t<a;i++){let o=this.content[i],s=t+o.nodeSize;s>e&&((t<e||s>a)&&(o=o.isText?o.cut(Math.max(0,e-t),Math.min(o.text.length,a-t)):o.cut(Math.max(0,e-t-1),Math.min(o.content.size,a-t-1))),r.push(o),n+=o.nodeSize),t=s}return new cu(r,n)}cutByIndex(e,a){return e==a?cu.empty:0==e&&a==this.content.length?this:new cu(this.content.slice(e,a))}replaceChild(e,a){let r=this.content[e];if(r==a)return this;let n=this.content.slice(),i=this.size+a.nodeSize-r.nodeSize;return n[e]=a,new cu(n,i)}addToStart(e){return new cu([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new cu(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let a=0;a<this.content.length;a++)if(!this.content[a].eq(e.content[a]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let a=this.content[e];if(!a)throw new RangeError("Index "+e+" out of range for "+this);return a}maybeChild(e){return this.content[e]||null}forEach(e){for(let a=0,r=0;a<this.content.length;a++){let n=this.content[a];e(n,r,a),r+=n.nodeSize}}findDiffStart(e,a=0){return su(this,e,a)}findDiffEnd(e,a=this.size,r=e.size){return lu(this,e,a,r)}findIndex(e,a=-1){if(0==e)return uu(0,e);if(e==this.size)return uu(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,n=0;;r++){let i=n+this.child(r).nodeSize;if(i>=e)return i==e||a>0?uu(r+1,i):uu(r,n);n=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,a){if(!a)return cu.empty;if(!Array.isArray(a))throw new RangeError("Invalid input for Fragment.fromJSON");return new cu(a.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return cu.empty;let a,r=0;for(let n=0;n<e.length;n++){let i=e[n];r+=i.nodeSize,n&&i.isText&&e[n-1].sameMarkup(i)?(a||(a=e.slice(0,n)),a[a.length-1]=i.withText(a[a.length-1].text+i.text)):a&&a.push(i)}return new cu(a||e,r)}static from(e){if(!e)return cu.empty;if(e instanceof cu)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new cu([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}cu.empty=new cu([],0);const du={index:0,offset:0};function uu(e,a){return du.index=e,du.offset=a,du}function hu(e,a){if(e===a)return!0;if(!e||"object"!=typeof e||!a||"object"!=typeof a)return!1;let r=Array.isArray(e);if(Array.isArray(a)!=r)return!1;if(r){if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!hu(e[r],a[r]))return!1}else{for(let r in e)if(!(r in a)||!hu(e[r],a[r]))return!1;for(let r in a)if(!(r in e))return!1}return!0}let mu=class e{constructor(e,a){this.type=e,this.attrs=a}addToSet(e){let a,r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(this.eq(i))return e;if(this.type.excludes(i.type))a||(a=e.slice(0,n));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(a||(a=e.slice(0,n)),a.push(this),r=!0),a&&a.push(i)}}return a||(a=e.slice()),r||a.push(this),a}removeFromSet(e){for(let a=0;a<e.length;a++)if(this.eq(e[a]))return e.slice(0,a).concat(e.slice(a+1));return e}isInSet(e){for(let a=0;a<e.length;a++)if(this.eq(e[a]))return!0;return!1}eq(e){return this==e||this.type==e.type&&hu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let a in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,a){if(!a)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[a.type];if(!r)throw new RangeError(`There is no mark type ${a.type} in this schema`);let n=r.create(a.attrs);return r.checkAttrs(n.attrs),n}static sameSet(e,a){if(e==a)return!0;if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(a[r]))return!1;return!0}static setFrom(a){if(!a||Array.isArray(a)&&0==a.length)return e.none;if(a instanceof e)return[a];let r=a.slice();return r.sort(((e,a)=>e.type.rank-a.type.rank)),r}};mu.none=[];class gu extends Error{}class pu{constructor(e,a,r){this.content=e,this.openStart=a,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,a){let r=fu(this.content,e+this.openStart,a);return r&&new pu(r,this.openStart,this.openEnd)}removeBetween(e,a){return new pu(bu(this.content,e+this.openStart,a+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,a){if(!a)return pu.empty;let r=a.openStart||0,n=a.openEnd||0;if("number"!=typeof r||"number"!=typeof n)throw new RangeError("Invalid input for Slice.fromJSON");return new pu(cu.fromJSON(e,a.content),r,n)}static maxOpen(e,a=!0){let r=0,n=0;for(let n=e.firstChild;n&&!n.isLeaf&&(a||!n.type.spec.isolating);n=n.firstChild)r++;for(let r=e.lastChild;r&&!r.isLeaf&&(a||!r.type.spec.isolating);r=r.lastChild)n++;return new pu(e,r,n)}}function bu(e,a,r){let{index:n,offset:i}=e.findIndex(a),t=e.maybeChild(n),{index:o,offset:s}=e.findIndex(r);if(i==a||t.isText){if(s!=r&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,a).append(e.cut(r))}if(n!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(n,t.copy(bu(t.content,a-i-1,r-i-1)))}function fu(e,a,r,n){let{index:i,offset:t}=e.findIndex(a),o=e.maybeChild(i);if(t==a||o.isText)return e.cut(0,a).append(r).append(e.cut(a));let s=fu(o.content,a-t-1,r);return s&&e.replaceChild(i,o.copy(s))}function ku(e,a,r){if(r.openStart>e.depth)throw new gu("Inserted content deeper than insertion position");if(e.depth-r.openStart!=a.depth-r.openEnd)throw new gu("Inconsistent open depths");return yu(e,a,r,0)}function yu(e,a,r,n){let i=e.index(n),t=e.node(n);if(i==a.index(n)&&n<e.depth-r.openStart){let o=yu(e,a,r,n+1);return t.copy(t.content.replaceChild(i,o))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=n||a.depth!=n){let{start:i,end:o}=function(e,a){let r=a.depth-e.openStart,n=a.node(r),i=n.copy(e.content);for(let e=r-1;e>=0;e--)i=a.node(e).copy(cu.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}(r,e);return xu(t,$u(e,i,o,a,n))}{let n=e.parent,i=n.content;return xu(n,i.cut(0,e.parentOffset).append(r.content).append(i.cut(a.parentOffset)))}}return xu(t,qu(e,a,n))}function vu(e,a){if(!a.type.compatibleContent(e.type))throw new gu("Cannot join "+a.type.name+" onto "+e.type.name)}function wu(e,a,r){let n=e.node(r);return vu(n,a.node(r)),n}function zu(e,a){let r=a.length-1;r>=0&&e.isText&&e.sameMarkup(a[r])?a[r]=e.withText(a[r].text+e.text):a.push(e)}function ju(e,a,r,n){let i=(a||e).node(r),t=0,o=a?a.index(r):i.childCount;e&&(t=e.index(r),e.depth>r?t++:e.textOffset&&(zu(e.nodeAfter,n),t++));for(let e=t;e<o;e++)zu(i.child(e),n);a&&a.depth==r&&a.textOffset&&zu(a.nodeBefore,n)}function xu(e,a){return e.type.checkContent(a),e.copy(a)}function $u(e,a,r,n,i){let t=e.depth>i&&wu(e,a,i+1),o=n.depth>i&&wu(r,n,i+1),s=[];return ju(null,e,i,s),t&&o&&a.index(i)==r.index(i)?(vu(t,o),zu(xu(t,$u(e,a,r,n,i+1)),s)):(t&&zu(xu(t,qu(e,a,i+1)),s),ju(a,r,i,s),o&&zu(xu(o,qu(r,n,i+1)),s)),ju(n,null,i,s),new cu(s)}function qu(e,a,r){let n=[];if(ju(null,e,r,n),e.depth>r){zu(xu(wu(e,a,r+1),qu(e,a,r+1)),n)}return ju(a,null,r,n),new cu(n)}pu.empty=new pu(cu.empty,0,0);class Cu{constructor(e,a,r){this.pos=e,this.path=a,this.parentOffset=r,this.depth=a.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,a=this.index(this.depth);if(a==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=e.child(a);return r?e.child(a).cut(r):n}get nodeBefore(){let e=this.index(this.depth),a=this.pos-this.path[this.path.length-1];return a?this.parent.child(e).cut(0,a):0==e?null:this.parent.child(e-1)}posAtIndex(e,a){a=this.resolveDepth(a);let r=this.path[3*a],n=0==a?0:this.path[3*a-1]+1;for(let a=0;a<e;a++)n+=r.child(a).nodeSize;return n}marks(){let e=this.parent,a=this.index();if(0==e.content.size)return mu.none;if(this.textOffset)return e.child(a).marks;let r=e.maybeChild(a-1),n=e.maybeChild(a);if(!r){let e=r;r=n,n=e}let i=r.marks;for(var t=0;t<i.length;t++)!1!==i[t].type.spec.inclusive||n&&i[t].isInSet(n.marks)||(i=i[t--].removeFromSet(i));return i}marksAcross(e){let a=this.parent.maybeChild(this.index());if(!a||!a.isInline)return null;let r=a.marks,n=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||n&&r[i].isInSet(n.marks)||(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let a=this.depth;a>0;a--)if(this.start(a)<=e&&this.end(a)>=e)return a;return 0}blockRange(e=this,a){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!a||a(this.node(r))))return new Mu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let a=1;a<=this.depth;a++)e+=(e?"/":"")+this.node(a).type.name+"_"+this.index(a-1);return e+":"+this.parentOffset}static resolve(e,a){if(!(a>=0&&a<=e.content.size))throw new RangeError("Position "+a+" out of range");let r=[],n=0,i=a;for(let a=e;;){let{index:e,offset:t}=a.content.findIndex(i),o=i-t;if(r.push(a,e,n+t),!o)break;if(a=a.child(e),a.isText)break;i=o-1,n+=t+1}return new Cu(a,r,i)}static resolveCached(e,a){let r=Eu.get(e);if(r)for(let e=0;e<r.elts.length;e++){let n=r.elts[e];if(n.pos==a)return n}else Eu.set(e,r=new Su);let n=r.elts[r.i]=Cu.resolve(e,a);return r.i=(r.i+1)%Ou,n}}class Su{constructor(){this.elts=[],this.i=0}}const Ou=12,Eu=new WeakMap;class Mu{constructor(e,a,r){this.$from=e,this.$to=a,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const _u=Object.create(null);let Au=class e{constructor(e,a,r,n=mu.none){this.type=e,this.attrs=a,this.marks=n,this.content=r||cu.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,a,r,n=0){this.content.nodesBetween(e,a,r,n,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,a,r,n){return this.content.textBetween(e,a,r,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,a,r){return this.type==e&&hu(this.attrs,a||e.defaultAttrs||_u)&&mu.sameSet(this.marks,r||mu.none)}copy(a=null){return a==this.content?this:new e(this.type,this.attrs,a,this.marks)}mark(a){return a==this.marks?this:new e(this.type,this.attrs,this.content,a)}cut(e,a=this.content.size){return 0==e&&a==this.content.size?this:this.copy(this.content.cut(e,a))}slice(e,a=this.content.size,r=!1){if(e==a)return pu.empty;let n=this.resolve(e),i=this.resolve(a),t=r?0:n.sharedDepth(a),o=n.start(t),s=n.node(t).content.cut(n.pos-o,i.pos-o);return new pu(s,n.depth-t,i.depth-t)}replace(e,a,r){return ku(this.resolve(e),this.resolve(a),r)}nodeAt(e){for(let a=this;;){let{index:r,offset:n}=a.content.findIndex(e);if(a=a.maybeChild(r),!a)return null;if(n==e||a.isText)return a;e-=n+1}}childAfter(e){let{index:a,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(a),index:a,offset:r}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:a,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(a),index:a,offset:r};let n=this.content.child(a-1);return{node:n,index:a-1,offset:r-n.nodeSize}}resolve(e){return Cu.resolveCached(this,e)}resolveNoCache(e){return Cu.resolve(this,e)}rangeHasMark(e,a,r){let n=!1;return a>e&&this.nodesBetween(e,a,(e=>(r.isInSet(e.marks)&&(n=!0),!n))),n}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Nu(this.marks,e)}contentMatchAt(e){let a=this.type.contentMatch.matchFragment(this.content,0,e);if(!a)throw new Error("Called contentMatchAt on a node with invalid content");return a}canReplace(e,a,r=cu.empty,n=0,i=r.childCount){let t=this.contentMatchAt(e).matchFragment(r,n,i),o=t&&t.matchFragment(this.content,a);if(!o||!o.validEnd)return!1;for(let e=n;e<i;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,a,r,n){if(n&&!this.type.allowsMarks(n))return!1;let i=this.contentMatchAt(e).matchType(r),t=i&&i.matchFragment(this.content,a);return!!t&&t.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=mu.none;for(let a=0;a<this.marks.length;a++){let r=this.marks[a];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!mu.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.check()))}toJSON(){let e={type:this.type.name};for(let a in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,a){if(!a)throw new RangeError("Invalid input for Node.fromJSON");let r;if(a.marks){if(!Array.isArray(a.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=a.marks.map(e.markFromJSON)}if("text"==a.type){if("string"!=typeof a.text)throw new RangeError("Invalid text node in JSON");return e.text(a.text,r)}let n=cu.fromJSON(e,a.content),i=e.nodeType(a.type).create(a.attrs,n,r);return i.type.checkAttrs(i.attrs),i}};Au.prototype.text=void 0;class Du extends Au{constructor(e,a,r,n){if(super(e,a,null,n),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Nu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,a){return this.text.slice(e,a)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Du(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Du(this.type,this.attrs,e,this.marks)}cut(e=0,a=this.text.length){return 0==e&&a==this.text.length?this:this.withText(this.text.slice(e,a))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Nu(e,a){for(let r=e.length-1;r>=0;r--)a=e[r].type.name+"("+a+")";return a}class Tu{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,a){let r=new Iu(e,a);if(null==r.next)return Tu.empty;let n=Fu(r);r.next&&r.err("Unexpected trailing text");let i=function(e){let a=Object.create(null);return r(Hu(e,0));function r(n){let i=[];n.forEach((a=>{e[a].forEach((({term:a,to:r})=>{if(!a)return;let n;for(let e=0;e<i.length;e++)i[e][0]==a&&(n=i[e][1]);Hu(e,r).forEach((e=>{n||i.push([a,n=[]]),-1==n.indexOf(e)&&n.push(e)}))}))}));let t=a[n.join(",")]=new Tu(n.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let n=i[e][1].sort(Vu);t.next.push({type:i[e][0],next:a[n.join(",")]||r(n)})}return t}}(function(e){let a=[[]];return i(t(e,0),r()),a;function r(){return a.push([])-1}function n(e,r,n){let i={term:n,to:r};return a[e].push(i),i}function i(e,a){e.forEach((e=>e.to=a))}function t(e,a){if("choice"==e.type)return e.exprs.reduce(((e,r)=>e.concat(t(r,a))),[]);if("seq"!=e.type){if("star"==e.type){let o=r();return n(a,o),i(t(e.expr,o),o),[n(o)]}if("plus"==e.type){let o=r();return i(t(e.expr,a),o),i(t(e.expr,o),o),[n(o)]}if("opt"==e.type)return[n(a)].concat(t(e.expr,a));if("range"==e.type){let o=a;for(let a=0;a<e.min;a++){let a=r();i(t(e.expr,o),a),o=a}if(-1==e.max)i(t(e.expr,o),o);else for(let a=e.min;a<e.max;a++){let a=r();n(o,a),i(t(e.expr,o),a),o=a}return[n(o)]}if("name"==e.type)return[n(a,void 0,e.value)];throw new Error("Unknown expr type")}for(let n=0;;n++){let o=t(e.exprs[n],a);if(n==e.exprs.length-1)return o;i(o,a=r())}}}(n));return function(e,a){for(let r=0,n=[e];r<n.length;r++){let e=n[r],i=!e.validEnd,t=[];for(let a=0;a<e.next.length;a++){let{type:r,next:o}=e.next[a];t.push(r.name),!i||r.isText||r.hasRequiredAttrs()||(i=!1),-1==n.indexOf(o)&&n.push(o)}i&&a.err("Only non-generatable nodes ("+t.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,r),i}matchType(e){for(let a=0;a<this.next.length;a++)if(this.next[a].type==e)return this.next[a].next;return null}matchFragment(e,a=0,r=e.childCount){let n=this;for(let i=a;n&&i<r;i++)n=n.matchType(e.child(i).type);return n}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:a}=this.next[e];if(!a.isText&&!a.hasRequiredAttrs())return a}return null}compatible(e){for(let a=0;a<this.next.length;a++)for(let r=0;r<e.next.length;r++)if(this.next[a].type==e.next[r].type)return!0;return!1}fillBefore(e,a=!1,r=0){let n=[this];return function i(t,o){let s=t.matchFragment(e,r);if(s&&(!a||s.validEnd))return cu.from(o.map((e=>e.createAndFill())));for(let e=0;e<t.next.length;e++){let{type:a,next:r}=t.next[e];if(!a.isText&&!a.hasRequiredAttrs()&&-1==n.indexOf(r)){n.push(r);let e=i(r,o.concat(a));if(e)return e}}return null}(this,[])}findWrapping(e){for(let a=0;a<this.wrapCache.length;a+=2)if(this.wrapCache[a]==e)return this.wrapCache[a+1];let a=this.computeWrapping(e);return this.wrapCache.push(e,a),a}computeWrapping(e){let a=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let n=r.shift(),i=n.match;if(i.matchType(e)){let e=[];for(let a=n;a.type;a=a.via)e.push(a.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:t,next:o}=i.next[e];t.isLeaf||t.hasRequiredAttrs()||t.name in a||n.type&&!o.validEnd||(r.push({match:t.contentMatch,type:t,via:n}),a[t.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function a(r){e.push(r);for(let n=0;n<r.next.length;n++)-1==e.indexOf(r.next[n].next)&&a(r.next[n].next)}(this),e.map(((a,r)=>{let n=r+(a.validEnd?"*":" ")+" ";for(let r=0;r<a.next.length;r++)n+=(r?", ":"")+a.next[r].type.name+"->"+e.indexOf(a.next[r].next);return n})).join("\n")}}Tu.empty=new Tu(!0);class Iu{constructor(e,a){this.string=e,this.nodeTypes=a,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Fu(e){let a=[];do{a.push(Pu(e))}while(e.eat("|"));return 1==a.length?a[0]:{type:"choice",exprs:a}}function Pu(e){let a=[];do{a.push(Ru(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==a.length?a[0]:{type:"seq",exprs:a}}function Ru(e){let a=function(e){if(e.eat("(")){let a=Fu(e);return e.eat(")")||e.err("Missing closing paren"),a}if(!/\W/.test(e.next)){let a=function(e,a){let r=e.nodeTypes,n=r[a];if(n)return[n];let i=[];for(let e in r){let n=r[e];n.isInGroup(a)&&i.push(n)}0==i.length&&e.err("No node type or group '"+a+"' found");return i}(e,e.next).map((a=>(null==e.inline?e.inline=a.isInline:e.inline!=a.isInline&&e.err("Mixing inline and block content"),{type:"name",value:a})));return e.pos++,1==a.length?a[0]:{type:"choice",exprs:a}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))a={type:"plus",expr:a};else if(e.eat("*"))a={type:"star",expr:a};else if(e.eat("?"))a={type:"opt",expr:a};else{if(!e.eat("{"))break;a=Bu(e,a)}return a}function Lu(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let a=Number(e.next);return e.pos++,a}function Bu(e,a){let r=Lu(e),n=r;return e.eat(",")&&(n="}"!=e.next?Lu(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:a}}function Vu(e,a){return a-e}function Hu(e,a){let r=[];return function a(n){let i=e[n];if(1==i.length&&!i[0].term)return a(i[0].to);r.push(n);for(let e=0;e<i.length;e++){let{term:n,to:t}=i[e];n||-1!=r.indexOf(t)||a(t)}}(a),r.sort(Vu)}function Wu(e){let a=Object.create(null);for(let r in e){let n=e[r];if(!n.hasDefault)return null;a[r]=n.default}return a}function Uu(e,a){let r=Object.create(null);for(let n in e){let i=a&&a[n];if(void 0===i){let a=e[n];if(!a.hasDefault)throw new RangeError("No value supplied for attribute "+n);i=a.default}r[n]=i}return r}function Gu(e,a,r,n){for(let n in a)if(!(n in e))throw new RangeError(`Unsupported attribute ${n} for ${r} of type ${n}`);for(let r in e){let n=e[r];n.validate&&n.validate(a[r])}}function Ku(e,a){let r=Object.create(null);if(a)for(let n in a)r[n]=new Ju(e,n,a[n]);return r}let Zu=class e{constructor(e,a,r){this.name=e,this.schema=a,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ku(e,r.attrs),this.defaultAttrs=Wu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Tu.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Uu(this.attrs,e)}create(e=null,a,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Au(this,this.computeAttrs(e),cu.from(a),mu.setFrom(r))}createChecked(e=null,a,r){return a=cu.from(a),this.checkContent(a),new Au(this,this.computeAttrs(e),a,mu.setFrom(r))}createAndFill(e=null,a,r){if(e=this.computeAttrs(e),(a=cu.from(a)).size){let e=this.contentMatch.fillBefore(a);if(!e)return null;a=e.append(a)}let n=this.contentMatch.matchFragment(a),i=n&&n.fillBefore(cu.empty,!0);return i?new Au(this,e,a.append(i),mu.setFrom(r)):null}validContent(e){let a=this.contentMatch.matchFragment(e);if(!a||!a.validEnd)return!1;for(let a=0;a<e.childCount;a++)if(!this.allowsMarks(e.child(a).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Gu(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let a=0;a<e.length;a++)if(!this.allowsMarkType(e[a].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let a;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?a&&a.push(e[r]):a||(a=e.slice(0,r));return a?a.length?a:mu.none:e}static compile(a,r){let n=Object.create(null);a.forEach(((a,i)=>n[a]=new e(a,r,i)));let i=r.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};class Ju{constructor(e,a,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,a,r){let n=r.split("|");return r=>{let i=null===r?"null":typeof r;if(n.indexOf(i)<0)throw new RangeError(`Expected value of type ${n} for attribute ${a} on type ${e}, got ${i}`)}}(e,a,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Yu{constructor(e,a,r,n){this.name=e,this.rank=a,this.schema=r,this.spec=n,this.attrs=Ku(e,n.attrs),this.excluded=null;let i=Wu(this.attrs);this.instance=i?new mu(this,i):null}create(e=null){return!e&&this.instance?this.instance:new mu(this,Uu(this.attrs,e))}static compile(e,a){let r=Object.create(null),n=0;return e.forEach(((e,i)=>r[e]=new Yu(e,n++,a,i))),r}removeFromSet(e){for(var a=0;a<e.length;a++)e[a].type==this&&(e=e.slice(0,a).concat(e.slice(a+1)),a--);return e}isInSet(e){for(let a=0;a<e.length;a++)if(e[a].type==this)return e[a]}checkAttrs(e){Gu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Xu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let a=this.spec={};for(let r in e)a[r]=e[r];a.nodes=ou.from(e.nodes),a.marks=ou.from(e.marks||{}),this.nodes=Zu.compile(this.spec.nodes,this),this.marks=Yu.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let a=this.nodes[e],n=a.spec.content||"",i=a.spec.marks;if(a.contentMatch=r[n]||(r[n]=Tu.parse(n,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet="_"==i?null:i?Qu(this,i.split(" ")):""!=i&&a.inlineContent?null:[]}for(let e in this.marks){let a=this.marks[e],r=a.spec.excludes;a.excluded=null==r?[a]:""==r?[]:Qu(this,r.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,a=null,r,n){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Zu))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(a,r,n)}text(e,a){let r=this.nodes.text;return new Du(r,r.defaultAttrs,e,mu.setFrom(a))}mark(e,a){return"string"==typeof e&&(e=this.marks[e]),e.create(a)}nodeFromJSON(e){return Au.fromJSON(this,e)}markFromJSON(e){return mu.fromJSON(this,e)}nodeType(e){let a=this.nodes[e];if(!a)throw new RangeError("Unknown node type: "+e);return a}}function Qu(e,a){let r=[];for(let n=0;n<a.length;n++){let i=a[n],t=e.marks[i],o=t;if(t)r.push(t);else for(let a in e.marks){let n=e.marks[a];("_"==i||n.spec.group&&n.spec.group.split(" ").indexOf(i)>-1)&&r.push(o=n)}if(!o)throw new SyntaxError("Unknown mark type: '"+a[n]+"'")}return r}class eh{constructor(e,a){this.schema=e,this.rules=a,this.tags=[],this.styles=[];let r=this.matchedStyles=[];a.forEach((e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let a=/[^=]*/.exec(e.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(e)}})),this.normalizeLists=!this.tags.some((a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let r=e.nodes[a.node];return r.contentMatch.matchType(r)}))}parse(e,a={}){let r=new oh(this,a,!1);return r.addAll(e,mu.none,a.from,a.to),r.finish()}parseSlice(e,a={}){let r=new oh(this,a,!0);return r.addAll(e,mu.none,a.from,a.to),pu.maxOpen(r.finish())}matchTag(e,a,r){for(let n=r?this.tags.indexOf(r)+1:0;n<this.tags.length;n++){let r=this.tags[n];if(sh(e,r.tag)&&(void 0===r.namespace||e.namespaceURI==r.namespace)&&(!r.context||a.matchesContext(r.context))){if(r.getAttrs){let a=r.getAttrs(e);if(!1===a)continue;r.attrs=a||void 0}return r}}}matchStyle(e,a,r,n){for(let i=n?this.styles.indexOf(n)+1:0;i<this.styles.length;i++){let n=this.styles[i],t=n.style;if(!(0!=t.indexOf(e)||n.context&&!r.matchesContext(n.context)||t.length>e.length&&(61!=t.charCodeAt(e.length)||t.slice(e.length+1)!=a))){if(n.getAttrs){let e=n.getAttrs(a);if(!1===e)continue;n.attrs=e||void 0}return n}}}static schemaRules(e){let a=[];function r(e){let r=null==e.priority?50:e.priority,n=0;for(;n<a.length;n++){let e=a[n];if((null==e.priority?50:e.priority)<r)break}a.splice(n,0,e)}for(let a in e.marks){let n=e.marks[a].spec.parseDOM;n&&n.forEach((e=>{r(e=lh(e)),e.mark||e.ignore||e.clearMark||(e.mark=a)}))}for(let a in e.nodes){let n=e.nodes[a].spec.parseDOM;n&&n.forEach((e=>{r(e=lh(e)),e.node||e.ignore||e.mark||(e.node=a)}))}return a}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new eh(e,eh.schemaRules(e)))}}const ah={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},rh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},nh={ol:!0,ul:!0};function ih(e,a,r){return null!=a?(a?1:0)|("full"===a?2:0):e&&"pre"==e.whitespace?3:-5&r}class th{constructor(e,a,r,n,i,t){this.type=e,this.attrs=a,this.marks=r,this.solid=n,this.options=t,this.content=[],this.activeMarks=mu.none,this.match=i||(4&t?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let a=this.type.contentMatch.fillBefore(cu.from(e));if(!a){let a,r=this.type.contentMatch;return(a=r.findWrapping(e.type))?(this.match=r,a):null}this.match=this.type.contentMatch.matchFragment(a)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,a=this.content[this.content.length-1];if(a&&a.isText&&(e=/[ \t\r\n\u000c]+$/.exec(a.text))){let r=a;a.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-e[0].length))}}let a=cu.from(this.content);return!e&&this.match&&(a=a.append(this.match.fillBefore(cu.empty,!0))),this.type?this.type.create(this.attrs,a,this.marks):a}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ah.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class oh{constructor(e,a,r){this.parser=e,this.options=a,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let n,i=a.topNode,t=ih(null,a.preserveWhitespace,0)|(r?4:0);n=i?new th(i.type,i.attrs,mu.none,!0,a.topMatch||i.type.contentMatch,t):new th(r?null:e.schema.topNodeType,null,mu.none,!0,null,t),this.nodes=[n],this.find=a.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,a){3==e.nodeType?this.addTextNode(e,a):1==e.nodeType&&this.addElement(e,a)}addTextNode(e,a){let r=e.nodeValue,n=this.top,i=2&n.options?"full":this.localPreserveWS||(1&n.options)>0;if("full"===i||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)r="full"!==i?r.replace(/\r?\n|\r/g," "):r.replace(/\r\n?/g,"\n");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=n.content[n.content.length-1],i=e.previousSibling;(!a||i&&"BR"==i.nodeName||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),a),this.findInText(e)}else this.findInside(e)}addElement(e,a,r){let n=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let t,o=e.nodeName.toLowerCase();nh.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let a=e.firstChild,r=null;a;a=a.nextSibling){let e=1==a.nodeType?a.nodeName.toLowerCase():null;e&&nh.hasOwnProperty(e)&&r?(r.appendChild(a),a=r):"li"==e?r=a:e&&(r=null)}}(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(t=this.parser.matchTag(e,this,r));e:if(s?s.ignore:rh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,a);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let r,n=this.needsBlock;if(ah.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),r=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,a);break e}let t=s&&s.skip?a:this.readStyles(e,a);t&&this.addAll(e,t),r&&this.sync(i),this.needsBlock=n}else{let r=this.readStyles(e,a);r&&this.addElementByRule(e,s,r,!1===s.consuming?t:void 0)}this.localPreserveWS=n}leafFallback(e,a){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),a)}ignoreFallback(e,a){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),a)}readStyles(e,a){let r=e.style;if(r&&r.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let n=this.parser.matchedStyles[e],i=r.getPropertyValue(n);if(i)for(let e;;){let r=this.parser.matchStyle(n,i,this,e);if(!r)break;if(r.ignore)return null;if(a=r.clearMark?a.filter((e=>!r.clearMark(e))):a.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;e=r}}return a}addElementByRule(e,a,r,n){let i,t;if(a.node)if(t=this.parser.schema.nodes[a.node],t.isLeaf)this.insertNode(t.create(a.attrs),r)||this.leafFallback(e,r);else{let e=this.enter(t,a.attrs||null,r,a.preserveWhitespace);e&&(i=!0,r=e)}else{let e=this.parser.schema.marks[a.mark];r=r.concat(e.create(a.attrs))}let o=this.top;if(t&&t.isLeaf)this.findInside(e);else if(n)this.addElement(e,r,n);else if(a.getContent)this.findInside(e),a.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e,r)));else{let n=e;"string"==typeof a.contentElement?n=e.querySelector(a.contentElement):"function"==typeof a.contentElement?n=a.contentElement(e):a.contentElement&&(n=a.contentElement),this.findAround(e,n,!0),this.addAll(n,r),this.findAround(e,n,!1)}i&&this.sync(o)&&this.open--}addAll(e,a,r,n){let i=r||0;for(let t=r?e.childNodes[r]:e.firstChild,o=null==n?null:e.childNodes[n];t!=o;t=t.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(t,a);this.findAtPoint(e,i)}findPlace(e,a){let r,n;for(let a=this.open;a>=0;a--){let i=this.nodes[a],t=i.findWrapping(e);if(t&&(!r||r.length>t.length)&&(r=t,n=i,!t.length))break;if(i.solid)break}if(!r)return null;this.sync(n);for(let e=0;e<r.length;e++)a=this.enterInner(r[e],null,a,!1);return a}insertNode(e,a){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(a=this.enterInner(e,null,a))}let r=this.findPlace(e,a);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let n=mu.none;for(let i of r.concat(e.marks))(a.type?a.type.allowsMarkType(i.type):ch(i.type,e.type))&&(n=i.addToSet(n));return a.content.push(e.mark(n)),!0}return!1}enter(e,a,r,n){let i=this.findPlace(e.create(a),r);return i&&(i=this.enterInner(e,a,r,!0,n)),i}enterInner(e,a,r,n=!1,i){this.closeExtra();let t=this.top;t.match=t.match&&t.match.matchType(e);let o=ih(e,i,t.options);4&t.options&&0==t.content.length&&(o|=4);let s=mu.none;return r=r.filter((a=>!(t.type?t.type.allowsMarkType(a.type):ch(a.type,e))||(s=a.addToSet(s),!1))),this.nodes.push(new th(e,a,s,n,null,o)),this.open++,r}closeExtra(e=!1){let a=this.nodes.length-1;if(a>this.open){for(;a>this.open;a--)this.nodes[a-1].content.push(this.nodes[a].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let a=this.open;a>=0;a--){if(this.nodes[a]==e)return this.open=a,!0;this.localPreserveWS&&(this.nodes[a].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let a=this.open;a>=0;a--){let r=this.nodes[a].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;a&&e++}return e}findAtPoint(e,a){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==a&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let a=0;a<this.find.length;a++)null==this.find[a].pos&&1==e.nodeType&&e.contains(this.find[a].node)&&(this.find[a].pos=this.currentPos)}findAround(e,a,r){if(e!=a&&this.find)for(let n=0;n<this.find.length;n++)if(null==this.find[n].pos&&1==e.nodeType&&e.contains(this.find[n].node)){a.compareDocumentPosition(this.find[n].node)&(r?2:4)&&(this.find[n].pos=this.currentPos)}}findInText(e){if(this.find)for(let a=0;a<this.find.length;a++)this.find[a].node==e&&(this.find[a].pos=this.currentPos-(e.nodeValue.length-this.find[a].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let a=e.split("/"),r=this.options.context,n=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(n?0:1),t=(e,o)=>{for(;e>=0;e--){let s=a[e];if(""==s){if(e==a.length-1||0==e)continue;for(;o>=i;o--)if(t(e-1,o))return!0;return!1}{let e=o>0||0==o&&n?this.nodes[o].type:r&&o>=i?r.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return t(a.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let a=e.depth;a>=0;a--){let r=e.node(a).contentMatchAt(e.indexAfter(a)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let a=this.parser.schema.nodes[e];if(a.isTextblock&&a.defaultAttrs)return a}}}function sh(e,a){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,a)}function lh(e){let a={};for(let r in e)a[r]=e[r];return a}function ch(e,a){let r=a.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let t=[],o=e=>{t.push(e);for(let r=0;r<e.edgeCount;r++){let{type:n,next:i}=e.edge(r);if(n==a)return!0;if(t.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class dh{constructor(e,a){this.nodes=e,this.marks=a}serializeFragment(e,a={},r){r||(r=hh(a).createDocumentFragment());let n=r,i=[];return e.forEach((e=>{if(i.length||e.marks.length){let r=0,t=0;for(;r<i.length&&t<e.marks.length;){let a=e.marks[t];if(this.marks[a.type.name]){if(!a.eq(i[r][0])||!1===a.type.spec.spanning)break;r++,t++}else t++}for(;r<i.length;)n=i.pop()[1];for(;t<e.marks.length;){let r=e.marks[t++],o=this.serializeMark(r,e.isInline,a);o&&(i.push([r,n]),n.appendChild(o.dom),n=o.contentDOM||o.dom)}}n.appendChild(this.serializeNodeInner(e,a))})),r}serializeNodeInner(e,a){let{dom:r,contentDOM:n}=ph(hh(a),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,a,n)}return r}serializeNode(e,a={}){let r=this.serializeNodeInner(e,a);for(let n=e.marks.length-1;n>=0;n--){let i=this.serializeMark(e.marks[n],e.isInline,a);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,a,r={}){let n=this.marks[e.type.name];return n&&ph(hh(r),n(e,a),null,e.attrs)}static renderSpec(e,a,r=null,n){return ph(e,a,r,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new dh(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let a=uh(e.nodes);return a.text||(a.text=e=>e.text),a}static marksFromSchema(e){return uh(e.marks)}}function uh(e){let a={};for(let r in e){let n=e[r].spec.toDOM;n&&(a[r]=n)}return a}function hh(e){return e.document||window.document}const mh=new WeakMap;function gh(e){let a=mh.get(e);return void 0===a&&mh.set(e,a=function(e){let a=null;function r(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])a||(a=[]),a.push(e);else for(let a=0;a<e.length;a++)r(e[a]);else for(let a in e)r(e[a])}return r(e),a}(e)),a}function ph(e,a,r,n){if("string"==typeof a)return{dom:e.createTextNode(a)};if(null!=a.nodeType)return{dom:a};if(a.dom&&null!=a.dom.nodeType)return a;let i,t=a[0];if("string"!=typeof t)throw new RangeError("Invalid array passed to renderSpec");if(n&&(i=gh(n))&&i.indexOf(a)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o,s=t.indexOf(" ");s>0&&(r=t.slice(0,s),t=t.slice(s+1));let l=r?e.createElementNS(r,t):e.createElement(t),c=a[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let a=e.indexOf(" ");a>0?l.setAttributeNS(e.slice(0,a),e.slice(a+1),c[e]):l.setAttribute(e,c[e])}}for(let i=d;i<a.length;i++){let t=a[i];if(0===t){if(i<a.length-1||i>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:a,contentDOM:i}=ph(e,t,r,n);if(l.appendChild(a),i){if(o)throw new RangeError("Multiple content holes");o=i}}}return{dom:l,contentDOM:o}}const bh=Math.pow(2,16);function fh(e,a){return e+a*bh}function kh(e){return 65535&e}class yh{constructor(e,a,r){this.pos=e,this.delInfo=a,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class vh{constructor(e,a=!1){if(this.ranges=e,this.inverted=a,!e.length&&vh.empty)return vh.empty}recover(e){let a=0,r=kh(e);if(!this.inverted)for(let e=0;e<r;e++)a+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*r]+a+function(e){return(e-(65535&e))/bh}(e)}mapResult(e,a=1){return this._map(e,a,!1)}map(e,a=1){return this._map(e,a,!0)}_map(e,a,r){let n=0,i=this.inverted?2:1,t=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[o+i],c=this.ranges[o+t],d=s+l;if(e<=d){let i=s+n+((l?e==s?-1:e==d?1:a:a)<0?0:c);if(r)return i;let t=e==(a<0?s:d)?null:fh(o/3,e-s),u=e==s?2:e==d?1:4;return(a<0?e!=s:e!=d)&&(u|=8),new yh(i,u,t)}n+=c-l}return r?e+n:new yh(e+n,0,null)}touches(e,a){let r=0,n=kh(a),i=this.inverted?2:1,t=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let o=this.ranges[a]-(this.inverted?r:0);if(o>e)break;let s=this.ranges[a+i];if(e<=o+s&&a==3*n)return!0;r+=this.ranges[a+t]-s}return!1}forEach(e){let a=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n<this.ranges.length;n+=3){let t=this.ranges[n],o=t-(this.inverted?i:0),s=t+(this.inverted?0:i),l=this.ranges[n+a],c=this.ranges[n+r];e(o,o+l,s,s+c),i+=c-l}}invert(){return new vh(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?vh.empty:new vh(e<0?[0,-e,0]:[0,0,e])}}vh.empty=new vh([]);class wh{constructor(e=[],a,r=0,n=e.length){this.maps=e,this.mirror=a,this.from=r,this.to=n}slice(e=0,a=this.maps.length){return new wh(this.maps,this.mirror,e,a)}copy(){return new wh(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,a){this.to=this.maps.push(e),null!=a&&this.setMirror(this.maps.length-1,a)}appendMapping(e){for(let a=0,r=this.maps.length;a<e.maps.length;a++){let n=e.getMirror(a);this.appendMap(e.maps[a],null!=n&&n<a?r+n:void 0)}}getMirror(e){if(this.mirror)for(let a=0;a<this.mirror.length;a++)if(this.mirror[a]==e)return this.mirror[a+(a%2?-1:1)]}setMirror(e,a){this.mirror||(this.mirror=[]),this.mirror.push(e,a)}appendMappingInverted(e){for(let a=e.maps.length-1,r=this.maps.length+e.maps.length;a>=0;a--){let n=e.getMirror(a);this.appendMap(e.maps[a].invert(),null!=n&&n>a?r-n-1:void 0)}}invert(){let e=new wh;return e.appendMappingInverted(this),e}map(e,a=1){if(this.mirror)return this._map(e,a,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,a);return e}mapResult(e,a=1){return this._map(e,a,!1)}_map(e,a,r){let n=0;for(let r=this.from;r<this.to;r++){let i=this.maps[r].mapResult(e,a);if(null!=i.recover){let a=this.getMirror(r);if(null!=a&&a>r&&a<this.to){r=a,e=this.maps[a].recover(i.recover);continue}}n|=i.delInfo,e=i.pos}return r?e:new yh(e,n,null)}}const zh=Object.create(null);class jh{getMap(){return vh.empty}merge(e){return null}static fromJSON(e,a){if(!a||!a.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zh[a.stepType];if(!r)throw new RangeError(`No step type ${a.stepType} defined`);return r.fromJSON(e,a)}static jsonID(e,a){if(e in zh)throw new RangeError("Duplicate use of step JSON ID "+e);return zh[e]=a,a.prototype.jsonID=e,a}}class xh{constructor(e,a){this.doc=e,this.failed=a}static ok(e){return new xh(e,null)}static fail(e){return new xh(null,e)}static fromReplace(e,a,r,n){try{return xh.ok(e.replace(a,r,n))}catch(e){if(e instanceof gu)return xh.fail(e.message);throw e}}}function $h(e,a,r){let n=[];for(let i=0;i<e.childCount;i++){let t=e.child(i);t.content.size&&(t=t.copy($h(t.content,a,t))),t.isInline&&(t=a(t,r,i)),n.push(t)}return cu.fromArray(n)}class qh extends jh{constructor(e,a,r){super(),this.from=e,this.to=a,this.mark=r}apply(e){let a=e.slice(this.from,this.to),r=e.resolve(this.from),n=r.node(r.sharedDepth(this.to)),i=new pu($h(a.content,((e,a)=>e.isAtom&&a.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),n),a.openStart,a.openEnd);return xh.fromReplace(e,this.from,this.to,i)}invert(){return new Ch(this.from,this.to,this.mark)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deleted&&r.deleted||a.pos>=r.pos?null:new qh(a.pos,r.pos,this.mark)}merge(e){return e instanceof qh&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qh(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qh(a.from,a.to,e.markFromJSON(a.mark))}}jh.jsonID("addMark",qh);class Ch extends jh{constructor(e,a,r){super(),this.from=e,this.to=a,this.mark=r}apply(e){let a=e.slice(this.from,this.to),r=new pu($h(a.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),a.openStart,a.openEnd);return xh.fromReplace(e,this.from,this.to,r)}invert(){return new qh(this.from,this.to,this.mark)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deleted&&r.deleted||a.pos>=r.pos?null:new Ch(a.pos,r.pos,this.mark)}merge(e){return e instanceof Ch&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ch(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ch(a.from,a.to,e.markFromJSON(a.mark))}}jh.jsonID("removeMark",Ch);class Sh extends jh{constructor(e,a){super(),this.pos=e,this.mark=a}apply(e){let a=e.nodeAt(this.pos);if(!a)return xh.fail("No node at mark step's position");let r=a.type.create(a.attrs,null,this.mark.addToSet(a.marks));return xh.fromReplace(e,this.pos,this.pos+1,new pu(cu.from(r),0,a.isLeaf?0:1))}invert(e){let a=e.nodeAt(this.pos);if(a){let e=this.mark.addToSet(a.marks);if(e.length==a.marks.length){for(let r=0;r<a.marks.length;r++)if(!a.marks[r].isInSet(e))return new Sh(this.pos,a.marks[r]);return new Sh(this.pos,this.mark)}}return new Oh(this.pos,this.mark)}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new Sh(a.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Sh(a.pos,e.markFromJSON(a.mark))}}jh.jsonID("addNodeMark",Sh);class Oh extends jh{constructor(e,a){super(),this.pos=e,this.mark=a}apply(e){let a=e.nodeAt(this.pos);if(!a)return xh.fail("No node at mark step's position");let r=a.type.create(a.attrs,null,this.mark.removeFromSet(a.marks));return xh.fromReplace(e,this.pos,this.pos+1,new pu(cu.from(r),0,a.isLeaf?0:1))}invert(e){let a=e.nodeAt(this.pos);return a&&this.mark.isInSet(a.marks)?new Sh(this.pos,this.mark):this}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new Oh(a.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Oh(a.pos,e.markFromJSON(a.mark))}}jh.jsonID("removeNodeMark",Oh);class Eh extends jh{constructor(e,a,r,n=!1){super(),this.from=e,this.to=a,this.slice=r,this.structure=n}apply(e){return this.structure&&_h(e,this.from,this.to)?xh.fail("Structure replace would overwrite content"):xh.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new vh([this.from,this.to-this.from,this.slice.size])}invert(e){return new Eh(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deletedAcross&&r.deletedAcross?null:new Eh(a.pos,Math.max(a.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Eh)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let a=this.slice.size+e.slice.size==0?pu.empty:new pu(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Eh(e.from,this.to,a,this.structure)}}{let a=this.slice.size+e.slice.size==0?pu.empty:new pu(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Eh(this.from,this.to+(e.to-e.from),a,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Eh(a.from,a.to,pu.fromJSON(e,a.slice),!!a.structure)}}jh.jsonID("replace",Eh);class Mh extends jh{constructor(e,a,r,n,i,t,o=!1){super(),this.from=e,this.to=a,this.gapFrom=r,this.gapTo=n,this.slice=i,this.insert=t,this.structure=o}apply(e){if(this.structure&&(_h(e,this.from,this.gapFrom)||_h(e,this.gapTo,this.to)))return xh.fail("Structure gap-replace would overwrite content");let a=e.slice(this.gapFrom,this.gapTo);if(a.openStart||a.openEnd)return xh.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,a.content);return r?xh.fromReplace(e,this.from,this.to,r):xh.fail("Content does not fit in gap")}getMap(){return new vh([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let a=this.gapTo-this.gapFrom;return new Mh(this.from,this.from+this.slice.size+a,this.from+this.insert,this.from+this.insert+a,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),n=this.from==this.gapFrom?a.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return a.deletedAcross&&r.deletedAcross||n<a.pos||i>r.pos?null:new Mh(a.pos,r.pos,n,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,a){if("number"!=typeof a.from||"number"!=typeof a.to||"number"!=typeof a.gapFrom||"number"!=typeof a.gapTo||"number"!=typeof a.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Mh(a.from,a.to,a.gapFrom,a.gapTo,pu.fromJSON(e,a.slice),a.insert,!!a.structure)}}function _h(e,a,r){let n=e.resolve(a),i=r-a,t=n.depth;for(;i>0&&t>0&&n.indexAfter(t)==n.node(t).childCount;)t--,i--;if(i>0){let e=n.node(t).maybeChild(n.indexAfter(t));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Ah(e,a,r,n=r.contentMatch,i=!0){let t=e.doc.nodeAt(a),o=[],s=a+1;for(let a=0;a<t.childCount;a++){let l=t.child(a),c=s+l.nodeSize,d=n.matchType(l.type);if(d){n=d;for(let a=0;a<l.marks.length;a++)r.allowsMarkType(l.marks[a].type)||e.step(new Ch(s,c,l.marks[a]));if(i&&l.isText&&"pre"!=r.whitespace){let e,a,n=/\r?\n|\r/g;for(;e=n.exec(l.text);)a||(a=new pu(cu.from(r.schema.text(" ",r.allowedMarks(l.marks))),0,0)),o.push(new Eh(s+e.index,s+e.index+e[0].length,a))}}else o.push(new Eh(s,c,pu.empty));s=c}if(!n.validEnd){let a=n.fillBefore(cu.empty,!0);e.replace(s,s,new pu(a,0,0))}for(let a=o.length-1;a>=0;a--)e.step(o[a])}function Dh(e,a,r){return(0==a||e.canReplace(a,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function Nh(e){let a=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let n=e.$from.node(r),i=e.$from.index(r),t=e.$to.indexAfter(r);if(r<e.depth&&n.canReplace(i,t,a))return r;if(0==r||n.type.spec.isolating||!Dh(n,i,t))break}return null}function Th(e,a,r=null,n=e){let i=function(e,a){let{parent:r,startIndex:n,endIndex:i}=e,t=r.contentMatchAt(n).findWrapping(a);if(!t)return null;let o=t.length?t[0]:a;return r.canReplaceWith(n,i,o)?t:null}(e,a),t=i&&function(e,a){let{parent:r,startIndex:n,endIndex:i}=e,t=r.child(n),o=a.contentMatch.findWrapping(t.type);if(!o)return null;let s=(o.length?o[o.length-1]:a).contentMatch;for(let e=n;s&&e<i;e++)s=s.matchType(r.child(e).type);return s&&s.validEnd?o:null}(n,a);return t?i.map(Ih).concat({type:a,attrs:r}).concat(t.map(Ih)):null}function Ih(e){return{type:e,attrs:null}}function Fh(e,a,r,n){a.forEach(((i,t)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(n).map(r+1+t+o.index);e.replaceWith(i,i+1,a.type.schema.linebreakReplacement.create())}}}))}function Ph(e,a,r,n){a.forEach(((i,t)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(n).map(r+1+t);e.replaceWith(i,i+1,a.type.schema.text("\n"))}}))}function Rh(e,a,r=1,n){let i=e.resolve(a),t=i.depth-r,o=n&&n[n.length-1]||i.parent;if(t<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,a=r-2;e>t;e--,a--){let r=i.node(e),t=i.index(e);if(r.type.spec.isolating)return!1;let o=r.content.cutByIndex(t,r.childCount),s=n&&n[a+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let l=n&&n[a]||r;if(!r.canReplace(t+1,r.childCount)||!l.type.validContent(o))return!1}let s=i.indexAfter(t),l=n&&n[0];return i.node(t).canReplaceWith(s,s,l?l.type:i.node(t+1).type)}function Lh(e,a){let r=e.resolve(a),n=r.index();return Bh(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function Bh(e,a){return!(!e||!a||e.isLeaf||!function(e,a){a.content.size||e.type.compatibleContent(a.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i<a.childCount;i++){let t=a.child(i),o=t.type==n?e.type.schema.nodes.text:t.type;if(r=r.matchType(o),!r)return!1;if(!e.type.allowsMarks(t.marks))return!1}return r.validEnd}(e,a))}function Vh(e,a,r=-1){let n=e.resolve(a);for(let e=n.depth;;e--){let i,t,o=n.index(e);if(e==n.depth?(i=n.nodeBefore,t=n.nodeAfter):r>0?(i=n.node(e+1),o++,t=n.node(e).maybeChild(o)):(i=n.node(e).maybeChild(o-1),t=n.node(e+1)),i&&!i.isTextblock&&Bh(i,t)&&n.node(e).canReplace(o,o+1))return a;if(0==e)break;a=r<0?n.before(e):n.after(e)}}function Hh(e,a,r){let n=e.resolve(a);if(!r.content.size)return a;let i=r.content;for(let e=0;e<r.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==r.openStart&&r.size?2:1);e++)for(let a=n.depth;a>=0;a--){let r=a==n.depth?0:n.pos<=(n.start(a+1)+n.end(a+1))/2?-1:1,t=n.index(a)+(r>0?1:0),o=n.node(a),s=!1;if(1==e)s=o.canReplace(t,t,i);else{let e=o.contentMatchAt(t).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(t,t,e[0])}if(s)return 0==r?n.pos:r<0?n.before(a+1):n.after(a+1)}return null}function Wh(e,a,r=a,n=pu.empty){if(a==r&&!n.size)return null;let i=e.resolve(a),t=e.resolve(r);return Uh(i,t,n)?new Eh(a,r,n):new Gh(i,t,n).fit()}function Uh(e,a,r){return!r.openStart&&!r.openEnd&&e.start()==a.start()&&e.parent.canReplace(e.index(),a.index(),r.content)}jh.jsonID("replaceAround",Mh);class Gh{constructor(e,a,r){this.$from=e,this.$to=a,this.unplaced=r,this.frontier=[],this.placed=cu.empty;for(let a=0;a<=e.depth;a++){let r=e.node(a);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=cu.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),a=this.placed.size-this.depth-this.$from.depth,r=this.$from,n=this.close(e<0?this.$to:r.doc.resolve(e));if(!n)return null;let i=this.placed,t=r.depth,o=n.depth;for(;t&&o&&1==i.childCount;)i=i.firstChild.content,t--,o--;let s=new pu(i,t,o);return e>-1?new Mh(r.pos,e,this.$to.pos,this.$to.end(),s,a):s.size||r.pos!=this.$to.pos?new Eh(r.pos,n.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let a=this.unplaced.content,r=0,n=this.unplaced.openEnd;r<e;r++){let i=a.firstChild;if(a.childCount>1&&(n=0),i.type.spec.isolating&&n<=r){e=r;break}a=i.content}for(let a=1;a<=2;a++)for(let r=1==a?e:this.unplaced.openStart;r>=0;r--){let e,n=null;r?(n=Jh(this.unplaced.content,r-1).firstChild,e=n.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let t,{type:o,match:s}=this.frontier[e],l=null;if(1==a&&(i?s.matchType(i.type)||(l=s.fillBefore(cu.from(i),!1)):n&&o.compatibleContent(n.type)))return{sliceDepth:r,frontierDepth:e,parent:n,inject:l};if(2==a&&i&&(t=s.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:e,parent:n,wrap:t};if(n&&s.matchType(n.type))break}}}openMore(){let{content:e,openStart:a,openEnd:r}=this.unplaced,n=Jh(e,a);return!(!n.childCount||n.firstChild.isLeaf)&&(this.unplaced=new pu(e,a+1,Math.max(r,n.size+a>=e.size-r?a+1:0)),!0)}dropNode(){let{content:e,openStart:a,openEnd:r}=this.unplaced,n=Jh(e,a);if(n.childCount<=1&&a>0){let i=e.size-a<=a+n.size;this.unplaced=new pu(Kh(e,a-1,1),a-1,i?a-1:r)}else this.unplaced=new pu(Kh(e,a,1),a,r)}placeNodes({sliceDepth:e,frontierDepth:a,parent:r,inject:n,wrap:i}){for(;this.depth>a;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let t=this.unplaced,o=r?r.content:t.content,s=t.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[a];if(n){for(let e=0;e<n.childCount;e++)c.push(n.child(e));d=d.matchFragment(n)}let h=o.size+e-(t.content.size-t.openEnd);for(;l<o.childCount;){let e=o.child(l),a=d.matchType(e.type);if(!a)break;l++,(l>1||0==s||e.content.size)&&(d=a,c.push(Yh(e.mark(u.allowedMarks(e.marks)),1==l?s:0,l==o.childCount?h:-1)))}let m=l==o.childCount;m||(h=-1),this.placed=Zh(this.placed,a,cu.from(c)),this.frontier[a].match=d,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,a=o;e<h;e++){let e=a.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),a=e.content}this.unplaced=m?0==e?pu.empty:new pu(Kh(t.content,e-1,1),e-1,h<0?t.openEnd:e-1):new pu(Kh(t.content,e,l),t.openStart,t.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,a=this.frontier[this.depth];if(!a.type.isTextblock||!Xh(this.$to,this.$to.depth,a.type,a.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:r}=this.$to,n=this.$to.after(r);for(;r>1&&n==this.$to.end(--r);)++n;return n}findCloseLevel(e){e:for(let a=Math.min(this.depth,e.depth);a>=0;a--){let{match:r,type:n}=this.frontier[a],i=a<e.depth&&e.end(a+1)==e.pos+(e.depth-(a+1)),t=Xh(e,a,n,r,i);if(t){for(let r=a-1;r>=0;r--){let{match:a,type:n}=this.frontier[r],i=Xh(e,r,n,a,!0);if(!i||i.childCount)continue e}return{depth:a,fit:t,move:i?e.doc.resolve(e.after(a+1)):e}}}}close(e){let a=this.findCloseLevel(e);if(!a)return null;for(;this.depth>a.depth;)this.closeFrontierNode();a.fit.childCount&&(this.placed=Zh(this.placed,a.depth,a.fit)),e=a.move;for(let r=a.depth+1;r<=e.depth;r++){let a=e.node(r),n=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,n)}return e}openFrontierNode(e,a=null,r){let n=this.frontier[this.depth];n.match=n.match.matchType(e),this.placed=Zh(this.placed,this.depth,cu.from(e.create(a,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(cu.empty,!0);e.childCount&&(this.placed=Zh(this.placed,this.frontier.length,e))}}function Kh(e,a,r){return 0==a?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(Kh(e.firstChild.content,a-1,r)))}function Zh(e,a,r){return 0==a?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(Zh(e.lastChild.content,a-1,r)))}function Jh(e,a){for(let r=0;r<a;r++)e=e.firstChild.content;return e}function Yh(e,a,r){if(a<=0)return e;let n=e.content;return a>1&&(n=n.replaceChild(0,Yh(n.firstChild,a-1,1==n.childCount?r-1:0))),a>0&&(n=e.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(cu.empty,!0)))),e.copy(n)}function Xh(e,a,r,n,i){let t=e.node(a),o=i?e.indexAfter(a):e.index(a);if(o==t.childCount&&!r.compatibleContent(t.type))return null;let s=n.fillBefore(t.content,!0,o);return s&&!function(e,a,r){for(let n=r;n<a.childCount;n++)if(!e.allowsMarks(a.child(n).marks))return!0;return!1}(r,t.content,o)?s:null}function Qh(e,a,r,n,i){if(a<r){let i=e.firstChild;e=e.replaceChild(0,i.copy(Qh(i.content,a+1,r,n,i)))}if(a>n){let a=i.contentMatchAt(0),r=a.fillBefore(e).append(e);e=r.append(a.matchFragment(r).fillBefore(cu.empty,!0))}return e}function em(e,a){let r=[];for(let n=Math.min(e.depth,a.depth);n>=0;n--){let i=e.start(n);if(i<e.pos-(e.depth-n)||a.end(n)>a.pos+(a.depth-n)||e.node(n).type.spec.isolating||a.node(n).type.spec.isolating)break;(i==a.start(n)||n==e.depth&&n==a.depth&&e.parent.inlineContent&&a.parent.inlineContent&&n&&a.start(n-1)==i-1)&&r.push(n)}return r}class am extends jh{constructor(e,a,r){super(),this.pos=e,this.attr=a,this.value=r}apply(e){let a=e.nodeAt(this.pos);if(!a)return xh.fail("No node at attribute step's position");let r=Object.create(null);for(let e in a.attrs)r[e]=a.attrs[e];r[this.attr]=this.value;let n=a.type.create(r,null,a.marks);return xh.fromReplace(e,this.pos,this.pos+1,new pu(cu.from(n),0,a.isLeaf?0:1))}getMap(){return vh.empty}invert(e){return new am(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new am(a.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,a){if("number"!=typeof a.pos||"string"!=typeof a.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new am(a.pos,a.attr,a.value)}}jh.jsonID("attr",am);class rm extends jh{constructor(e,a){super(),this.attr=e,this.value=a}apply(e){let a=Object.create(null);for(let r in e.attrs)a[r]=e.attrs[r];a[this.attr]=this.value;let r=e.type.create(a,e.content,e.marks);return xh.ok(r)}getMap(){return vh.empty}invert(e){return new rm(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,a){if("string"!=typeof a.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new rm(a.attr,a.value)}}jh.jsonID("docAttr",rm);let nm=class extends Error{};nm=function e(a){let r=Error.call(this,a);return r.__proto__=e.prototype,r},(nm.prototype=Object.create(Error.prototype)).constructor=nm,nm.prototype.name="TransformError";class im{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wh}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let a=this.maybeStep(e);if(a.failed)throw new nm(a.failed);return this}maybeStep(e){let a=e.apply(this.doc);return a.failed||this.addStep(e,a.doc),a}get docChanged(){return this.steps.length>0}addStep(e,a){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=a}replace(e,a=e,r=pu.empty){let n=Wh(this.doc,e,a,r);return n&&this.step(n),this}replaceWith(e,a,r){return this.replace(e,a,new pu(cu.from(r),0,0))}delete(e,a){return this.replace(e,a,pu.empty)}insert(e,a){return this.replaceWith(e,e,a)}replaceRange(e,a,r){return function(e,a,r,n){if(!n.size)return e.deleteRange(a,r);let i=e.doc.resolve(a),t=e.doc.resolve(r);if(Uh(i,t,n))return e.step(new Eh(a,r,n));let o=em(i,e.doc.resolve(r));0==o[o.length-1]&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,a=i.pos-1;e>0;e--,a--){let r=i.node(e).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==a&&o.splice(1,0,-e)}let l=o.indexOf(s),c=[],d=n.openStart;for(let e=n.content,a=0;;a++){let r=e.firstChild;if(c.push(r),a==n.openStart)break;e=r.content}for(let e=d-1;e>=0;e--){let a=c[e],r=(u=a.type).spec.defining||u.spec.definingForContent;if(r&&!a.sameMarkup(i.node(Math.abs(s)-1)))d=e;else if(r||!a.type.isTextblock)break}var u;for(let a=n.openStart;a>=0;a--){let s=(a+d+1)%(n.openStart+1),u=c[s];if(u)for(let a=0;a<o.length;a++){let c=o[(a+l)%o.length],d=!0;c<0&&(d=!1,c=-c);let h=i.node(c-1),m=i.index(c-1);if(h.canReplaceWith(m,m,u.type,u.marks))return e.replace(i.before(c),d?t.after(c):r,new pu(Qh(n.content,0,n.openStart,s),s,n.openEnd))}}let h=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(a,r,n),!(e.steps.length>h));s--){let e=o[s];e<0||(a=i.before(e),r=t.after(e))}}(this,e,a,r),this}replaceRangeWith(e,a,r){return function(e,a,r,n){if(!n.isInline&&a==r&&e.doc.resolve(a).parent.content.size){let i=function(e,a,r){let n=e.resolve(a);if(n.parent.canReplaceWith(n.index(),n.index(),r))return a;if(0==n.parentOffset)for(let e=n.depth-1;e>=0;e--){let a=n.index(e);if(n.node(e).canReplaceWith(a,a,r))return n.before(e+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let e=n.depth-1;e>=0;e--){let a=n.indexAfter(e);if(n.node(e).canReplaceWith(a,a,r))return n.after(e+1);if(a<n.node(e).childCount)return null}return null}(e.doc,a,n.type);null!=i&&(a=r=i)}e.replaceRange(a,r,new pu(cu.from(n),0,0))}(this,e,a,r),this}deleteRange(e,a){return function(e,a,r){let n=e.doc.resolve(a),i=e.doc.resolve(r),t=em(n,i);for(let a=0;a<t.length;a++){let r=t[a],o=a==t.length-1;if(o&&0==r||n.node(r).type.contentMatch.validEnd)return e.delete(n.start(r),i.end(r));if(r>0&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return e.delete(n.before(r),i.after(r))}for(let t=1;t<=n.depth&&t<=i.depth;t++)if(a-n.start(t)==n.depth-t&&r>n.end(t)&&i.end(t)-r!=i.depth-t&&n.start(t-1)==i.start(t-1)&&n.node(t-1).canReplace(n.index(t-1),i.index(t-1)))return e.delete(n.before(t),r);e.delete(a,r)}(this,e,a),this}lift(e,a){return function(e,a,r){let{$from:n,$to:i,depth:t}=a,o=n.before(t+1),s=i.after(t+1),l=o,c=s,d=cu.empty,u=0;for(let e=t,a=!1;e>r;e--)a||n.index(e)>0?(a=!0,d=cu.from(n.node(e).copy(d)),u++):l--;let h=cu.empty,m=0;for(let e=t,a=!1;e>r;e--)a||i.after(e+1)<i.end(e)?(a=!0,h=cu.from(i.node(e).copy(h)),m++):c++;e.step(new Mh(l,c,o,s,new pu(d.append(h),u,m),d.size-u,!0))}(this,e,a),this}join(e,a=1){return function(e,a,r){let n=null,{linebreakReplacement:i}=e.doc.type.schema,t=e.doc.resolve(a-r),o=t.node().type;if(i&&o.inlineContent){let e="pre"==o.whitespace,a=!!o.contentMatch.matchType(i);e&&!a?n=!1:!e&&a&&(n=!0)}let s=e.steps.length;if(!1===n){let n=e.doc.resolve(a+r);Ph(e,n.node(),n.before(),s)}o.inlineContent&&Ah(e,a+r-1,o,t.node().contentMatchAt(t.index()),null==n);let l=e.mapping.slice(s),c=l.map(a-r);if(e.step(new Eh(c,l.map(a+r,-1),pu.empty,!0)),!0===n){let a=e.doc.resolve(c);Fh(e,a.node(),a.before(),e.steps.length)}}(this,e,a),this}wrap(e,a){return function(e,a,r){let n=cu.empty;for(let e=r.length-1;e>=0;e--){if(n.size){let a=r[e].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=cu.from(r[e].type.create(r[e].attrs,n))}let i=a.start,t=a.end;e.step(new Mh(i,t,i,t,new pu(n,0,0),r.length,!0))}(this,e,a),this}setBlockType(e,a=e,r,n=null){return function(e,a,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let t=e.steps.length;e.doc.nodesBetween(a,r,((a,r)=>{let o="function"==typeof i?i(a):i;if(a.isTextblock&&!a.hasMarkup(n,o)&&function(e,a,r){let n=e.resolve(a),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}(e.doc,e.mapping.slice(t).map(r),n)){let i=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,a=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!a?i=!1:!e&&a&&(i=!0)}!1===i&&Ph(e,a,r,t),Ah(e,e.mapping.slice(t).map(r,1),n,void 0,null===i);let s=e.mapping.slice(t),l=s.map(r,1),c=s.map(r+a.nodeSize,1);return e.step(new Mh(l,c,l+1,c-1,new pu(cu.from(n.create(o,null,a.marks)),0,0),1,!0)),!0===i&&Fh(e,a,r,t),!1}}))}(this,e,a,r,n),this}setNodeMarkup(e,a,r=null,n){return function(e,a,r,n,i){let t=e.doc.nodeAt(a);if(!t)throw new RangeError("No node at given position");r||(r=t.type);let o=r.create(n,null,i||t.marks);if(t.isLeaf)return e.replaceWith(a,a+t.nodeSize,o);if(!r.validContent(t.content))throw new RangeError("Invalid content for node type "+r.name);e.step(new Mh(a,a+t.nodeSize,a+1,a+t.nodeSize-1,new pu(cu.from(o),0,0),1,!0))}(this,e,a,r,n),this}setNodeAttribute(e,a,r){return this.step(new am(e,a,r)),this}setDocAttribute(e,a){return this.step(new rm(e,a)),this}addNodeMark(e,a){return this.step(new Sh(e,a)),this}removeNodeMark(e,a){if(!(a instanceof mu)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(!(a=a.isInSet(r.marks)))return this}return this.step(new Oh(e,a)),this}split(e,a=1,r){return function(e,a,r=1,n){let i=e.doc.resolve(a),t=cu.empty,o=cu.empty;for(let e=i.depth,a=i.depth-r,s=r-1;e>a;e--,s--){t=cu.from(i.node(e).copy(t));let a=n&&n[s];o=cu.from(a?a.type.create(a.attrs,o):i.node(e).copy(o))}e.step(new Eh(a,a,new pu(t.append(o),r,r),!0))}(this,e,a,r),this}addMark(e,a,r){return function(e,a,r,n){let i,t,o=[],s=[];e.doc.nodesBetween(a,r,((e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,a),u=Math.min(l+e.nodeSize,r),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:o.push(i=new Ch(c,u,d[e])));t&&t.to==c?t.to=u:s.push(t=new qh(c,u,n))}})),o.forEach((a=>e.step(a))),s.forEach((a=>e.step(a)))}(this,e,a,r),this}removeMark(e,a,r){return function(e,a,r,n){let i=[],t=0;e.doc.nodesBetween(a,r,((e,o)=>{if(!e.isInline)return;t++;let s=null;if(n instanceof Yu){let a,r=e.marks;for(;a=n.isInSet(r);)(s||(s=[])).push(a),r=a.removeFromSet(r)}else n?n.isInSet(e.marks)&&(s=[n]):s=e.marks;if(s&&s.length){let n=Math.min(o+e.nodeSize,r);for(let e=0;e<s.length;e++){let r,l=s[e];for(let e=0;e<i.length;e++){let a=i[e];a.step==t-1&&l.eq(i[e].style)&&(r=a)}r?(r.to=n,r.step=t):i.push({style:l,from:Math.max(o,a),to:n,step:t})}}})),i.forEach((a=>e.step(new Ch(a.from,a.to,a.style))))}(this,e,a,r),this}clearIncompatible(e,a,r){return Ah(this,e,a,r),this}}const tm=Object.create(null);class om{constructor(e,a,r){this.$anchor=e,this.$head=a,this.ranges=r||[new sm(e.min(a),e.max(a))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let a=0;a<e.length;a++)if(e[a].$from.pos!=e[a].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,a=pu.empty){let r=a.content.lastChild,n=null;for(let e=0;e<a.openEnd;e++)n=r,r=r.lastChild;let i=e.steps.length,t=this.ranges;for(let o=0;o<t.length;o++){let{$from:s,$to:l}=t[o],c=e.mapping.slice(i);e.replaceRange(c.map(s.pos),c.map(l.pos),o?pu.empty:a),0==o&&fm(e,i,(r?r.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,a){let r=e.steps.length,n=this.ranges;for(let i=0;i<n.length;i++){let{$from:t,$to:o}=n[i],s=e.mapping.slice(r),l=s.map(t.pos),c=s.map(o.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,a),fm(e,r,a.isInline?-1:1))}}static findFrom(e,a,r=!1){let n=e.parent.inlineContent?new dm(e):bm(e.node(0),e.parent,e.pos,e.index(),a,r);if(n)return n;for(let n=e.depth-1;n>=0;n--){let i=a<0?bm(e.node(0),e.node(n),e.before(n+1),e.index(n),a,r):bm(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,a,r);if(i)return i}return null}static near(e,a=1){return this.findFrom(e,a)||this.findFrom(e,-a)||new gm(e.node(0))}static atStart(e){return bm(e,e,0,0,1)||new gm(e)}static atEnd(e){return bm(e,e,e.content.size,e.childCount,-1)||new gm(e)}static fromJSON(e,a){if(!a||!a.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=tm[a.type];if(!r)throw new RangeError(`No selection type ${a.type} defined`);return r.fromJSON(e,a)}static jsonID(e,a){if(e in tm)throw new RangeError("Duplicate use of selection JSON ID "+e);return tm[e]=a,a.prototype.jsonID=e,a}getBookmark(){return dm.between(this.$anchor,this.$head).getBookmark()}}om.prototype.visible=!0;class sm{constructor(e,a){this.$from=e,this.$to=a}}let lm=!1;function cm(e){lm||e.parent.inlineContent||(lm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class dm extends om{constructor(e,a=e){cm(e),cm(a),super(e,a)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,a){let r=e.resolve(a.map(this.head));if(!r.parent.inlineContent)return om.near(r);let n=e.resolve(a.map(this.anchor));return new dm(n.parent.inlineContent?n:r,r)}replace(e,a=pu.empty){if(super.replace(e,a),a==pu.empty){let a=this.$from.marksAcross(this.$to);a&&e.ensureMarks(a)}}eq(e){return e instanceof dm&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new um(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,a){if("number"!=typeof a.anchor||"number"!=typeof a.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new dm(e.resolve(a.anchor),e.resolve(a.head))}static create(e,a,r=a){let n=e.resolve(a);return new this(n,r==a?n:e.resolve(r))}static between(e,a,r){let n=e.pos-a.pos;if(r&&!n||(r=n>=0?1:-1),!a.parent.inlineContent){let e=om.findFrom(a,r,!0)||om.findFrom(a,-r,!0);if(!e)return om.near(a,r);a=e.$head}return e.parent.inlineContent||(0==n||(e=(om.findFrom(e,-r,!0)||om.findFrom(e,r,!0)).$anchor).pos<a.pos!=n<0)&&(e=a),new dm(e,a)}}om.jsonID("text",dm);class um{constructor(e,a){this.anchor=e,this.head=a}map(e){return new um(e.map(this.anchor),e.map(this.head))}resolve(e){return dm.between(e.resolve(this.anchor),e.resolve(this.head))}}class hm extends om{constructor(e){let a=e.nodeAfter,r=e.node(0).resolve(e.pos+a.nodeSize);super(e,r),this.node=a}map(e,a){let{deleted:r,pos:n}=a.mapResult(this.anchor),i=e.resolve(n);return r?om.near(i):new hm(i)}content(){return new pu(cu.from(this.node),0,0)}eq(e){return e instanceof hm&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new mm(this.anchor)}static fromJSON(e,a){if("number"!=typeof a.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new hm(e.resolve(a.anchor))}static create(e,a){return new hm(e.resolve(a))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}hm.prototype.visible=!1,om.jsonID("node",hm);class mm{constructor(e){this.anchor=e}map(e){let{deleted:a,pos:r}=e.mapResult(this.anchor);return a?new um(r,r):new mm(r)}resolve(e){let a=e.resolve(this.anchor),r=a.nodeAfter;return r&&hm.isSelectable(r)?new hm(a):om.near(a)}}class gm extends om{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,a=pu.empty){if(a==pu.empty){e.delete(0,e.doc.content.size);let a=om.atStart(e.doc);a.eq(e.selection)||e.setSelection(a)}else super.replace(e,a)}toJSON(){return{type:"all"}}static fromJSON(e){return new gm(e)}map(e){return new gm(e)}eq(e){return e instanceof gm}getBookmark(){return pm}}om.jsonID("all",gm);const pm={map(){return this},resolve:e=>new gm(e)};function bm(e,a,r,n,i,t=!1){if(a.inlineContent)return dm.create(e,r);for(let o=n-(i>0?0:1);i>0?o<a.childCount:o>=0;o+=i){let n=a.child(o);if(n.isAtom){if(!t&&hm.isSelectable(n))return hm.create(e,r-(i<0?n.nodeSize:0))}else{let a=bm(e,n,r+i,i<0?n.childCount:0,i,t);if(a)return a}r+=n.nodeSize*i}return null}function fm(e,a,r){let n=e.steps.length-1;if(n<a)return;let i,t=e.steps[n];(t instanceof Eh||t instanceof Mh)&&(e.mapping.maps[n].forEach(((e,a,r,n)=>{null==i&&(i=n)})),e.setSelection(om.near(e.doc.resolve(i),r)))}class km extends im{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return mu.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,a){super.addStep(e,a),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,a=!0){let r=this.selection;return a&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||mu.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,a,r){let n=this.doc.type.schema;if(null==a)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(null==r&&(r=a),r=null==r?a:r,!e)return this.deleteRange(a,r);let i=this.storedMarks;if(!i){let e=this.doc.resolve(a);i=r==a?e.marks():e.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(a,r,n.text(e,i)),this.selection.empty||this.setSelection(om.near(this.selection.$to)),this}}setMeta(e,a){return this.meta["string"==typeof e?e:e.key]=a,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function ym(e,a){return a&&e?e.bind(a):e}class vm{constructor(e,a,r){this.name=e,this.init=ym(a.init,r),this.apply=ym(a.apply,r)}}const wm=[new vm("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new vm("selection",{init:(e,a)=>e.selection||om.atStart(a.doc),apply:e=>e.selection}),new vm("storedMarks",{init:e=>e.storedMarks||null,apply:(e,a,r,n)=>n.selection.$cursor?e.storedMarks:null}),new vm("scrollToSelection",{init:()=>0,apply:(e,a)=>e.scrolledIntoView?a+1:a})];class zm{constructor(e,a){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wm.slice(),a&&a.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new vm(e.key,e.spec.state,e))}))}}class jm{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,a=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=a){let a=this.config.plugins[r];if(a.spec.filterTransaction&&!a.spec.filterTransaction.call(a,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let a=[e],r=this.applyInner(e),n=null;for(;;){let i=!1;for(let t=0;t<this.config.plugins.length;t++){let o=this.config.plugins[t];if(o.spec.appendTransaction){let s=n?n[t].n:0,l=n?n[t].state:this,c=s<a.length&&o.spec.appendTransaction.call(o,s?a.slice(s):a,l,r);if(c&&r.filterTransaction(c,t)){if(c.setMeta("appendedTransaction",e),!n){n=[];for(let e=0;e<this.config.plugins.length;e++)n.push(e<t?{state:r,n:a.length}:{state:this,n:0})}a.push(c),r=r.applyInner(c),i=!0}n&&(n[t]={state:r,n:a.length})}}if(!i)return{state:r,transactions:a}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let a=new jm(this.config),r=this.config.fields;for(let n=0;n<r.length;n++){let i=r[n];a[i.name]=i.apply(e,this[i.name],this,a)}return a}get tr(){return new km(this)}static create(e){let a=new zm(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new jm(a);for(let n=0;n<a.fields.length;n++)r[a.fields[n].name]=a.fields[n].init(e,r);return r}reconfigure(e){let a=new zm(this.schema,e.plugins),r=a.fields,n=new jm(a);for(let a=0;a<r.length;a++){let i=r[a].name;n[i]=this.hasOwnProperty(i)?this[i]:r[a].init(e,n)}return n}toJSON(e){let a={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(a.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let r in e){if("doc"==r||"selection"==r)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[r],i=n.spec.state;i&&i.toJSON&&(a[r]=i.toJSON.call(n,this[n.key]))}return a}static fromJSON(e,a,r){if(!a)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let n=new zm(e.schema,e.plugins),i=new jm(n);return n.fields.forEach((n=>{if("doc"==n.name)i.doc=Au.fromJSON(e.schema,a.doc);else if("selection"==n.name)i.selection=om.fromJSON(i.doc,a.selection);else if("storedMarks"==n.name)a.storedMarks&&(i.storedMarks=a.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let t in r){let o=r[t],s=o.spec.state;if(o.key==n.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(a,t))return void(i[n.name]=s.fromJSON.call(o,e,a[t],i))}i[n.name]=n.init(e,i)}})),i}}function xm(e,a,r){for(let n in e){let i=e[n];i instanceof Function?i=i.bind(a):"handleDOMEvents"==n&&(i=xm(i,a,{})),r[n]=i}return r}class $m{constructor(e){this.spec=e,this.props={},e.props&&xm(e.props,this,this.props),this.key=e.key?e.key.key:Cm("plugin")}getState(e){return e[this.key]}}const qm=Object.create(null);function Cm(e){return e in qm?e+"$"+ ++qm[e]:(qm[e]=0,e+"$")}class Sm{constructor(e="key"){this.key=Cm(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Om=function(e){for(var a=0;;a++)if(!(e=e.previousSibling))return a},Em=function(e){let a=e.assignedSlot||e.parentNode;return a&&11==a.nodeType?a.host:a};let Mm=null;const _m=function(e,a,r){let n=Mm||(Mm=document.createRange());return n.setEnd(e,null==r?e.nodeValue.length:r),n.setStart(e,a||0),n},Am=function(e,a,r,n){return r&&(Nm(e,a,r,n,-1)||Nm(e,a,r,n,1))},Dm=/^(img|br|input|textarea|hr)$/i;function Nm(e,a,r,n,i){for(;;){if(e==r&&a==n)return!0;if(a==(i<0?0:Tm(e))){let r=e.parentNode;if(!r||1!=r.nodeType||Im(e)||Dm.test(e.nodeName)||"false"==e.contentEditable)return!1;a=Om(e)+(i<0?0:1),e=r}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[a+(i<0?-1:0)]).contentEditable)return!1;a=i<0?Tm(e):0}}}function Tm(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Im(e){let a;for(let r=e;r&&!(a=r.pmViewDesc);r=r.parentNode);return a&&a.node&&a.node.isBlock&&(a.dom==e||a.contentDOM==e)}const Fm=function(e){return e.focusNode&&Am(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Pm(e,a){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=a,r}const Rm="undefined"!=typeof navigator?navigator:null,Lm="undefined"!=typeof document?document:null,Bm=Rm&&Rm.userAgent||"",Vm=/Edge\/(\d+)/.exec(Bm),Hm=/MSIE \d/.exec(Bm),Wm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Bm),Um=!!(Hm||Wm||Vm),Gm=Hm?document.documentMode:Wm?+Wm[1]:Vm?+Vm[1]:0,Km=!Um&&/gecko\/(\d+)/i.test(Bm);Km&&(/Firefox\/(\d+)/.exec(Bm)||[0,0])[1];const Zm=!Um&&/Chrome\/(\d+)/.exec(Bm),Jm=!!Zm,Ym=Zm?+Zm[1]:0,Xm=!Um&&!!Rm&&/Apple Computer/.test(Rm.vendor),Qm=Xm&&(/Mobile\/\w+/.test(Bm)||!!Rm&&Rm.maxTouchPoints>2),eg=Qm||!!Rm&&/Mac/.test(Rm.platform),ag=!!Rm&&/Win/.test(Rm.platform),rg=/Android \d/.test(Bm),ng=!!Lm&&"webkitFontSmoothing"in Lm.documentElement.style,ig=ng?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tg(e){let a=e.defaultView&&e.defaultView.visualViewport;return a?{left:0,right:a.width,top:0,bottom:a.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function og(e,a){return"number"==typeof e?e:e[a]}function sg(e){let a=e.getBoundingClientRect(),r=a.width/e.offsetWidth||1,n=a.height/e.offsetHeight||1;return{left:a.left,right:a.left+e.clientWidth*r,top:a.top,bottom:a.top+e.clientHeight*n}}function lg(e,a,r){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,t=e.dom.ownerDocument;for(let o=r||e.dom;o;o=Em(o)){if(1!=o.nodeType)continue;let e=o,r=e==t.body,s=r?tg(t):sg(e),l=0,c=0;if(a.top<s.top+og(n,"top")?c=-(s.top-a.top+og(i,"top")):a.bottom>s.bottom-og(n,"bottom")&&(c=a.bottom-a.top>s.bottom-s.top?a.top+og(i,"top")-s.top:a.bottom-s.bottom+og(i,"bottom")),a.left<s.left+og(n,"left")?l=-(s.left-a.left+og(i,"left")):a.right>s.right-og(n,"right")&&(l=a.right-s.right+og(i,"right")),l||c)if(r)t.defaultView.scrollBy(l,c);else{let r=e.scrollLeft,n=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-r,t=e.scrollTop-n;a={left:a.left-i,top:a.top-t,right:a.right-i,bottom:a.bottom-t}}if(r||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function cg(e){let a=[],r=e.ownerDocument;for(let n=e;n&&(a.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=Em(n));return a}function dg(e,a){for(let r=0;r<e.length;r++){let{dom:n,top:i,left:t}=e[r];n.scrollTop!=i+a&&(n.scrollTop=i+a),n.scrollLeft!=t&&(n.scrollLeft=t)}}let ug=null;function hg(e,a){let r,n,i,t,o=2e8,s=0,l=a.top,c=a.top;for(let d=e.firstChild,u=0;d;d=d.nextSibling,u++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=_m(d).getClientRects()}for(let h=0;h<e.length;h++){let m=e[h];if(m.top<=l&&m.bottom>=c){l=Math.max(m.bottom,l),c=Math.min(m.top,c);let e=m.left>a.left?m.left-a.left:m.right<a.left?a.left-m.right:0;if(e<o){r=d,o=e,n=e&&3==r.nodeType?{left:m.right<a.left?m.right:m.left,top:a.top}:a,1==d.nodeType&&e&&(s=u+(a.left>=(m.left+m.right)/2?1:0));continue}}else m.top>a.top&&!i&&m.left<=a.left&&m.right>=a.left&&(i=d,t={left:Math.max(m.left,Math.min(m.right,a.left)),top:m.top});!r&&(a.left>=m.right&&a.top>=m.top||a.left>=m.left&&a.top>=m.bottom)&&(s=u+1)}}return!r&&i&&(r=i,n=t,o=0),r&&3==r.nodeType?function(e,a){let r=e.nodeValue.length,n=document.createRange();for(let i=0;i<r;i++){n.setEnd(e,i+1),n.setStart(e,i);let r=fg(n,1);if(r.top!=r.bottom&&mg(a,r))return{node:e,offset:i+(a.left>=(r.left+r.right)/2?1:0)}}return{node:e,offset:0}}(r,n):!r||o&&1==r.nodeType?{node:e,offset:s}:hg(r,n)}function mg(e,a){return e.left>=a.left-1&&e.left<=a.right+1&&e.top>=a.top-1&&e.top<=a.bottom+1}function gg(e,a,r){let n=e.childNodes.length;if(n&&r.top<r.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(a.top-r.top)/(r.bottom-r.top))-2)),t=i;;){let r=e.childNodes[t];if(1==r.nodeType){let e=r.getClientRects();for(let n=0;n<e.length;n++){let i=e[n];if(mg(a,i))return gg(r,a,i)}}if((t=(t+1)%n)==i)break}return e}function pg(e,a){let r,n=e.dom.ownerDocument,i=0,t=function(e,a,r){if(e.caretPositionFromPoint)try{let n=e.caretPositionFromPoint(a,r);if(n)return{node:n.offsetNode,offset:Math.min(Tm(n.offsetNode),n.offset)}}catch(e){}if(e.caretRangeFromPoint){let n=e.caretRangeFromPoint(a,r);if(n)return{node:n.startContainer,offset:Math.min(Tm(n.startContainer),n.startOffset)}}}(n,a.left,a.top);t&&({node:r,offset:i}=t);let o,s=(e.root.elementFromPoint?e.root:n).elementFromPoint(a.left,a.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){let r=e.dom.getBoundingClientRect();if(!mg(a,r))return null;if(s=gg(e.dom,a,r),!s)return null}if(Xm)for(let e=s;r&&e;e=Em(e))e.draggable&&(r=void 0);if(s=function(e,a){let r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&a.left<e.getBoundingClientRect().left?r:e}(s,a),r){if(Km&&1==r.nodeType&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e,n=r.childNodes[i];"IMG"==n.nodeName&&(e=n.getBoundingClientRect()).right<=a.left&&e.bottom>a.top&&i++}let n;ng&&i&&1==r.nodeType&&1==(n=r.childNodes[i-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=a.top&&i--,r==e.dom&&i==r.childNodes.length-1&&1==r.lastChild.nodeType&&a.top>r.lastChild.getBoundingClientRect().bottom?o=e.state.doc.content.size:0!=i&&1==r.nodeType&&"BR"==r.childNodes[i-1].nodeName||(o=function(e,a,r,n){let i=-1;for(let r=a,t=!1;r!=e.dom;){let a,o=e.docView.nearestDesc(r,!0);if(!o)return null;if(1==o.dom.nodeType&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((a=o.dom.getBoundingClientRect()).width||a.height)&&(o.node.isBlock&&o.parent&&(!t&&a.left>n.left||a.top>n.top?i=o.posBefore:(!t&&a.right<n.left||a.bottom<n.top)&&(i=o.posAfter),t=!0),!o.contentDOM&&i<0&&!o.node.isText))return(o.node.isBlock?n.top<(a.top+a.bottom)/2:n.left<(a.left+a.right)/2)?o.posBefore:o.posAfter;r=o.dom.parentNode}return i>-1?i:e.docView.posFromDOM(a,r,-1)}(e,r,i,a))}null==o&&(o=function(e,a,r){let{node:n,offset:i}=hg(a,r),t=-1;if(1==n.nodeType&&!n.firstChild){let e=n.getBoundingClientRect();t=e.left!=e.right&&r.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(n,i,t)}(e,s,a));let l=e.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function bg(e){return e.top<e.bottom||e.left<e.right}function fg(e,a){let r=e.getClientRects();if(r.length){let e=r[a<0?0:r.length-1];if(bg(e))return e}return Array.prototype.find.call(r,bg)||e.getBoundingClientRect()}const kg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function yg(e,a,r){let{node:n,offset:i,atom:t}=e.docView.domFromPos(a,r<0?-1:1),o=ng||Km;if(3==n.nodeType){if(!o||!kg.test(n.nodeValue)&&(r<0?i:i!=n.nodeValue.length)){let e=i,a=i,t=r<0?1:-1;return r<0&&!i?(a++,t=-1):r>=0&&i==n.nodeValue.length?(e--,t=1):r<0?e--:a++,vg(fg(_m(n,e,a),t),t<0)}{let e=fg(_m(n,i,i),r);if(Km&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let a=fg(_m(n,i-1,i-1),-1);if(a.top==e.top){let r=fg(_m(n,i,i+1),-1);if(r.top!=e.top)return vg(r,r.left<a.left)}}return e}}if(!e.state.doc.resolve(a-(t||0)).parent.inlineContent){if(null==t&&i&&(r<0||i==Tm(n))){let e=n.childNodes[i-1];if(1==e.nodeType)return wg(e.getBoundingClientRect(),!1)}if(null==t&&i<Tm(n)){let e=n.childNodes[i];if(1==e.nodeType)return wg(e.getBoundingClientRect(),!0)}return wg(n.getBoundingClientRect(),r>=0)}if(null==t&&i&&(r<0||i==Tm(n))){let e=n.childNodes[i-1],a=3==e.nodeType?_m(e,Tm(e)-(o?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(a)return vg(fg(a,1),!1)}if(null==t&&i<Tm(n)){let e=n.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let a=e?3==e.nodeType?_m(e,0,o?0:1):1==e.nodeType?e:null:null;if(a)return vg(fg(a,-1),!0)}return vg(fg(3==n.nodeType?_m(n):n,-r),r>=0)}function vg(e,a){if(0==e.width)return e;let r=a?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function wg(e,a){if(0==e.height)return e;let r=a?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function zg(e,a,r){let n=e.state,i=e.root.activeElement;n!=a&&e.updateState(a),i!=e.dom&&e.focus();try{return r()}finally{n!=a&&e.updateState(n),i!=e.dom&&i&&i.focus()}}const jg=/[\u0590-\u08ac]/;let xg=null,$g=null,qg=!1;function Cg(e,a,r){return xg==a&&$g==r?qg:(xg=a,$g=r,qg="up"==r||"down"==r?function(e,a,r){let n=a.selection,i="up"==r?n.$from:n.$to;return zg(e,a,(()=>{let{node:a}=e.docView.domFromPos(i.pos,"up"==r?-1:1);for(;;){let r=e.docView.nearestDesc(a,!0);if(!r)break;if(r.node.isBlock){a=r.contentDOM||r.dom;break}a=r.dom.parentNode}let n=yg(e,i.pos,1);for(let e=a.firstChild;e;e=e.nextSibling){let a;if(1==e.nodeType)a=e.getClientRects();else{if(3!=e.nodeType)continue;a=_m(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<a.length;e++){let i=a[e];if(i.bottom>i.top+1&&("up"==r?n.top-i.top>2*(i.bottom-n.top):i.bottom-n.bottom>2*(n.bottom-i.top)))return!1}}return!0}))}(e,a,r):function(e,a,r){let{$head:n}=a.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,t=!i,o=i==n.parent.content.size,s=e.domSelection();return s?jg.test(n.parent.textContent)&&s.modify?zg(e,a,(()=>{let{focusNode:a,focusOffset:i,anchorNode:t,anchorOffset:o}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",r,"character");let c=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||a==d&&i==u;try{s.collapse(t,o),a&&(a!=t||i!=o)&&s.extend&&s.extend(a,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),h})):"left"==r||"backward"==r?t:o:n.pos==n.start()||n.pos==n.end()}(e,a,r))}class Sg{constructor(e,a,r,n){this.parent=e,this.children=a,this.dom=r,this.contentDOM=n,this.dirty=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,a,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let a=0;a<this.children.length;a++)e+=this.children[a].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let a=0,r=this.posAtStart;;a++){let n=this.children[a];if(n==e)return r;r+=n.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,a,r){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(r<0){let r,n;if(e==this.contentDOM)r=e.childNodes[a-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(n=r.pmViewDesc)||n.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(n)+n.size:this.posAtStart}{let r,n;if(e==this.contentDOM)r=e.childNodes[a];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&(!(n=r.pmViewDesc)||n.parent!=this);)r=r.nextSibling;return r?this.posBeforeChild(n):this.posAtEnd}}let n;if(e==this.dom&&this.contentDOM)n=a>Om(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==a)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!1;break}if(a.previousSibling)break}if(null==n&&a==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!0;break}if(a.nextSibling)break}}return(null==n?r>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(e,a=!1){for(let r=!0,n=e;n;n=n.parentNode){let i,t=this.getDesc(n);if(t&&(!a||t.node)){if(!r||!(i=t.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return t;r=!1}}}getDesc(e){let a=e.pmViewDesc;for(let e=a;e;e=e.parent)if(e==this)return a}posFromDOM(e,a,r){for(let n=e;n;n=n.parentNode){let i=this.getDesc(n);if(i)return i.localPosFromDOM(e,a,r)}return-1}descAt(e){for(let a=0,r=0;a<this.children.length;a++){let n=this.children[a],i=r+n.size;if(r==e&&i!=r){for(;!n.border&&n.children.length;)n=n.children[0];return n}if(e<i)return n.descAt(e-r-n.border);r=i}}domFromPos(e,a){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,n=0;for(let a=0;r<this.children.length;r++){let i=this.children[r],t=a+i.size;if(t>e||i instanceof Ng){n=e-a;break}a=t}if(n)return this.children[r].domFromPos(n-this.children[r].border,a);for(let e;r&&!(e=this.children[r-1]).size&&e instanceof Og&&e.side>=0;r--);if(a<=0){let e,n=!0;for(;e=r?this.children[r-1]:null,e&&e.dom.parentNode!=this.contentDOM;r--,n=!1);return e&&a&&n&&!e.border&&!e.domAtom?e.domFromPos(e.size,a):{node:this.contentDOM,offset:e?Om(e.dom)+1:0}}{let e,n=!0;for(;e=r<this.children.length?this.children[r]:null,e&&e.dom.parentNode!=this.contentDOM;r++,n=!1);return e&&n&&!e.border&&!e.domAtom?e.domFromPos(0,a):{node:this.contentDOM,offset:e?Om(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,a,r=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:a,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,i=-1;for(let t=r,o=0;;o++){let r=this.children[o],s=t+r.size;if(-1==n&&e<=s){let i=t+r.border;if(e>=i&&a<=s-r.border&&r.node&&r.contentDOM&&this.contentDOM.contains(r.contentDOM))return r.parseRange(e,a,i);e=t;for(let a=o;a>0;a--){let r=this.children[a-1];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(1)){n=Om(r.dom)+1;break}e-=r.size}-1==n&&(n=0)}if(n>-1&&(s>a||o==this.children.length-1)){a=s;for(let e=o+1;e<this.children.length;e++){let r=this.children[e];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(-1)){i=Om(r.dom);break}a+=r.size}-1==i&&(i=this.contentDOM.childNodes.length);break}t=s}return{node:this.contentDOM,from:e,to:a,fromOffset:n,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let a=this.children[e<0?0:this.children.length-1];return 0==a.size||a.emptyChildAt(e)}domAfterPos(e){let{node:a,offset:r}=this.domFromPos(e,0);if(1!=a.nodeType||r==a.childNodes.length)throw new RangeError("No node after pos "+e);return a.childNodes[r]}setSelection(e,a,r,n=!1){let i=Math.min(e,a),t=Math.max(e,a);for(let o=0,s=0;o<this.children.length;o++){let l=this.children[o],c=s+l.size;if(i>s&&t<c)return l.setSelection(e-s-l.border,a-s-l.border,r,n);s=c}let o=this.domFromPos(e,e?-1:1),s=a==e?o:this.domFromPos(a,a?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Km||Xm)&&e==a){let{node:e,offset:a}=o;if(3==e.nodeType){if(d=!(!a||"\n"!=e.nodeValue[a-1]),d&&a==e.nodeValue.length)for(let a,r=e;r;r=r.parentNode){if(a=r.nextSibling){"BR"==a.nodeName&&(o=s={node:a.parentNode,offset:Om(a)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let r=e.childNodes[a-1];d=r&&("BR"==r.nodeName||"false"==r.contentEditable)}}if(Km&&c.focusNode&&c.focusNode!=s.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(n=!0)}if(!(n||d&&Xm)&&Am(o.node,o.offset,c.anchorNode,c.anchorOffset)&&Am(s.node,s.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==a)&&!d){l.collapse(o.node,o.offset);try{e!=a&&l.extend(s.node,s.offset),u=!0}catch(e){}}if(!u){if(e>a){let e=o;o=s,s=e}let r=document.createRange();r.setEnd(s.node,s.offset),r.setStart(o.node,o.offset),l.removeAllRanges(),l.addRange(r)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,a){for(let r=0,n=0;n<this.children.length;n++){let i=this.children[n],t=r+i.size;if(r==t?e<=t&&a>=r:e<t&&a>r){let n=r+i.border,o=t-i.border;if(e>=n&&a<=o)return this.dirty=e==r||a==t?2:1,void(e!=n||a!=o||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-n,a-n):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}r=t}this.dirty=2}markParentsDirty(){let e=1;for(let a=this.parent;a;a=a.parent,e++){let r=1==e?2:1;a.dirty<r&&(a.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Og extends Sg{constructor(e,a,r,n){let i,t=a.type.toDOM;if("function"==typeof t&&(t=t(r,(()=>i?i.parent?i.parent.posBeforeChild(i):void 0:n))),!a.type.spec.raw){if(1!=t.nodeType){let e=document.createElement("span");e.appendChild(t),t=e}t.contentEditable="false",t.classList.add("ProseMirror-widget")}super(e,[],t,null),this.widget=a,this.widget=a,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let a=this.widget.spec.stopEvent;return!!a&&a(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Eg extends Sg{constructor(e,a,r,n){super(e,[],a,null),this.textDOM=r,this.text=n}get size(){return this.text.length}localPosFromDOM(e,a){return e!=this.textDOM?this.posAtStart+(a?this.size:0):this.posAtStart+a}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Mg extends Sg{constructor(e,a,r,n,i){super(e,[],r,n),this.mark=a,this.spec=i}static create(e,a,r,n){let i=n.nodeViews[a.type.name],t=i&&i(a,n,r);return t&&t.dom||(t=dh.renderSpec(document,a.type.spec.toDOM(a,r),null,a.attrs)),new Mg(e,a,t.dom,t.contentDOM||t.dom,t)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,a){if(super.markDirty(e,a),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,a,r){let n=Mg.create(this.parent,this.mark,!0,r),i=this.children,t=this.size;a<t&&(i=Kg(i,a,t,r)),e>0&&(i=Kg(i,0,e,r));for(let e=0;e<i.length;e++)i[e].parent=n;return n.children=i,n}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class _g extends Sg{constructor(e,a,r,n,i,t,o,s,l){super(e,[],i,t),this.node=a,this.outerDeco=r,this.innerDeco=n,this.nodeDOM=o}static create(e,a,r,n,i,t){let o,s=i.nodeViews[a.type.name],l=s&&s(a,i,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:t),r,n),c=l&&l.dom,d=l&&l.contentDOM;if(a.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(a.text);else if(!c){let e=dh.renderSpec(document,a.type.spec.toDOM(a),null,a.attrs);({dom:c,contentDOM:d}=e)}d||a.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),a.type.spec.draggable&&(c.draggable=!0));let u=c;return c=Vg(c,r,a),l?o=new Tg(e,a,r,n,c,d||null,u,l,i,t+1):a.isText?new Dg(e,a,r,n,c,u,i):new _g(e,a,r,n,c,d||null,u,i,t+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let a=this.children.length-1;a>=0;a--){let r=this.children[a];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>cu.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,a,r){return 0==this.dirty&&e.eq(this.node)&&Hg(a,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,a){let r=this.node.inlineContent,n=a,i=e.composing?this.localCompositionInfo(e,a):null,t=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Ug(this,t&&t.node,e);!function(e,a,r,n){let i=a.locals(e),t=0;if(0==i.length){for(let r=0;r<e.childCount;r++){let o=e.child(r);n(o,i,a.forChild(t,o),r),t+=o.nodeSize}return}let o=0,s=[],l=null;for(let c=0;;){let d,u,h,m;for(;o<i.length&&i[o].to==t;){let e=i[o++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(Gg);for(let e=0;e<u.length;e++)r(u[e],c,!!l)}else r(d,c,!!l);if(l)m=-1,h=l,l=null;else{if(!(c<e.childCount))break;m=c,h=e.child(c++)}for(let e=0;e<s.length;e++)s[e].to<=t&&s.splice(e--,1);for(;o<i.length&&i[o].from<=t&&i[o].to>t;)s.push(i[o++]);let g=t+h.nodeSize;if(h.isText){let e=g;o<i.length&&i[o].from<e&&(e=i[o].from);for(let a=0;a<s.length;a++)s[a].to<e&&(e=s[a].to);e<g&&(l=h.cut(e-t),h=h.cut(0,e-t),g=e,m=-1)}else for(;o<i.length&&i[o].to<g;)o++;n(h,h.isInline&&!h.isLeaf?s.filter((e=>!e.inline)):s.slice(),a.forChild(t,h),m),t=g}}(this.node,this.innerDeco,((a,i,t)=>{a.spec.marks?s.syncToMarks(a.spec.marks,r,e):a.type.side>=0&&!t&&s.syncToMarks(i==this.node.childCount?mu.none:this.node.child(i).marks,r,e),s.placeWidget(a,e,n)}),((a,t,l,c)=>{let d;s.syncToMarks(a.marks,r,e),s.findNodeMatch(a,t,l,c)||o&&e.state.selection.from>n&&e.state.selection.to<n+a.nodeSize&&(d=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(a,t,l,d,e)||s.updateNextNode(a,t,l,e,c,n)||s.addNode(a,t,l,e,n),n+=a.nodeSize})),s.syncToMarks([],r,e),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(t&&this.protectLocalComposition(e,t),Ig(this.contentDOM,this.children,e),Qm&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let a=e.style.cssText;e.style.cssText=a+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=a}}(this.dom))}localCompositionInfo(e,a){let{from:r,to:n}=e.state.selection;if(!(e.state.selection instanceof dm)||r<a||n>a+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,t=function(e,a,r,n){for(let i=0,t=0;i<e.childCount&&t<=n;){let o=e.child(i++),s=t;if(t+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<e.childCount;){let a=e.child(i++);if(t+=a.nodeSize,!a.isText)break;l+=a.text}if(t>=r){if(t>=n&&l.slice(n-a.length-s,n-s)==a)return n-a.length;let e=s<n?l.lastIndexOf(a,n-s-1):-1;if(e>=0&&e+a.length+s>=r)return s+e;if(r==n&&l.length>=n+a.length-s&&l.slice(n-s,n-s+a.length)==a)return n}}return-1}(this.node.content,e,r-a,n-a);return t<0?null:{node:i,pos:t,text:e}}return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:a,pos:r,text:n}){if(this.getDesc(a))return;let i=a;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let t=new Eg(this,i,a,n);e.input.compositionNodes.push(t),this.children=Kg(this.children,r,r+n.length,e,t)}update(e,a,r,n){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,a,r,n),!0)}updateInner(e,a,r,n){this.updateOuterDeco(a),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Hg(e,this.outerDeco))return;let a=1!=this.nodeDOM.nodeType,r=this.dom;this.dom=Lg(this.dom,this.nodeDOM,Rg(this.outerDeco,this.node,a),Rg(e,this.node,a)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ag(e,a,r,n,i){Vg(n,a,e);let t=new _g(void 0,e,a,r,n,n,n,i,0);return t.contentDOM&&t.updateChildren(i,0),t}class Dg extends _g{constructor(e,a,r,n,i,t,o){super(e,a,r,n,i,null,t,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,a,r,n){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(a),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let a=this.nodeDOM;a;a=a.parentNode)if(a==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,a,r){return e==this.nodeDOM?this.posAtStart+Math.min(a,this.node.text.length):super.localPosFromDOM(e,a,r)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,a,r){let n=this.node.cut(e,a),i=document.createTextNode(n.text);return new Dg(this.parent,n,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,a){super.markDirty(e,a),this.dom==this.nodeDOM||0!=e&&a!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ng extends Sg{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Tg extends _g{constructor(e,a,r,n,i,t,o,s,l,c){super(e,a,r,n,i,t,o,l,c),this.spec=s}update(e,a,r,n){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,a,r);return i&&this.updateInner(e,a,r,n),i}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,a,r,n)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,a,r,n){this.spec.setSelection?this.spec.setSelection(e,a,r.root):super.setSelection(e,a,r,n)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ig(e,a,r){let n=e.firstChild,i=!1;for(let t=0;t<a.length;t++){let o=a[t],s=o.dom;if(s.parentNode==e){for(;s!=n;)n=Wg(n),i=!0;n=n.nextSibling}else i=!0,e.insertBefore(s,n);if(o instanceof Mg){let a=n?n.previousSibling:e.lastChild;Ig(o.contentDOM,o.children,r),n=a?a.nextSibling:e.firstChild}}for(;n;)n=Wg(n),i=!0;i&&r.trackWrites==e&&(r.trackWrites=null)}const Fg=function(e){e&&(this.nodeName=e)};Fg.prototype=Object.create(null);const Pg=[new Fg];function Rg(e,a,r){if(0==e.length)return Pg;let n=r?Pg[0]:new Fg,i=[n];for(let t=0;t<e.length;t++){let o=e[t].type.attrs;if(o){o.nodeName&&i.push(n=new Fg(o.nodeName));for(let e in o){let t=o[e];null!=t&&(r&&1==i.length&&i.push(n=new Fg(a.isInline?"span":"div")),"class"==e?n.class=(n.class?n.class+" ":"")+t:"style"==e?n.style=(n.style?n.style+";":"")+t:"nodeName"!=e&&(n[e]=t))}}}return i}function Lg(e,a,r,n){if(r==Pg&&n==Pg)return a;let i=a;for(let a=0;a<n.length;a++){let t=n[a],o=r[a];if(a){let a;o&&o.nodeName==t.nodeName&&i!=e&&(a=i.parentNode)&&a.nodeName.toLowerCase()==t.nodeName||(a=document.createElement(t.nodeName),a.pmIsDeco=!0,a.appendChild(i),o=Pg[0]),i=a}Bg(i,o||Pg[0],t)}return i}function Bg(e,a,r){for(let n in a)"class"==n||"style"==n||"nodeName"==n||n in r||e.removeAttribute(n);for(let n in r)"class"!=n&&"style"!=n&&"nodeName"!=n&&r[n]!=a[n]&&e.setAttribute(n,r[n]);if(a.class!=r.class){let n=a.class?a.class.split(" ").filter(Boolean):[],i=r.class?r.class.split(" ").filter(Boolean):[];for(let a=0;a<n.length;a++)-1==i.indexOf(n[a])&&e.classList.remove(n[a]);for(let a=0;a<i.length;a++)-1==n.indexOf(i[a])&&e.classList.add(i[a]);0==e.classList.length&&e.removeAttribute("class")}if(a.style!=r.style){if(a.style){let r,n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;r=n.exec(a.style);)e.style.removeProperty(r[1])}r.style&&(e.style.cssText+=r.style)}}function Vg(e,a,r){return Lg(e,e,Pg,Rg(a,r,1!=e.nodeType))}function Hg(e,a){if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].type.eq(a[r].type))return!1;return!0}function Wg(e){let a=e.nextSibling;return e.parentNode.removeChild(e),a}class Ug{constructor(e,a,r){this.lock=a,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,a){let r=a,n=r.children.length,i=e.childCount,t=new Map,o=[];e:for(;i>0;){let s;for(;;)if(n){let e=r.children[n-1];if(!(e instanceof Mg)){s=e,n--;break}r=e,n=e.children.length}else{if(r==a)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=s.node;if(l){if(l!=e.child(i-1))break;--i,t.set(s,i),o.push(s)}}return{index:i,matched:t,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,a){if(e!=a){for(let r=e;r<a;r++)this.top.children[r].destroy();this.top.children.splice(e,a-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,a,r){let n=0,i=this.stack.length>>1,t=Math.min(i,e.length);for(;n<t&&(n==i-1?this.top:this.stack[n+1<<1]).matchesMark(e[n])&&!1!==e[n].type.spec.spanning;)n++;for(;n<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let n=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let r=this.top.children[a];if(r.matchesMark(e[i])&&!this.isLocked(r.dom)){n=a;break}}if(n>-1)n>this.index&&(this.changed=!0,this.destroyBetween(this.index,n)),this.top=this.top.children[this.index];else{let n=Mg.create(this.top,e[i],a,r);this.top.children.splice(this.index,0,n),this.top=n,this.changed=!0}this.index=0,i++}}findNodeMatch(e,a,r,n){let i,t=-1;if(n>=this.preMatch.index&&(i=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&i.matchesNode(e,a,r))t=this.top.children.indexOf(i,this.index);else for(let n=this.index,i=Math.min(this.top.children.length,n+5);n<i;n++){let i=this.top.children[n];if(i.matchesNode(e,a,r)&&!this.preMatch.matched.has(i)){t=n;break}}return!(t<0)&&(this.destroyBetween(this.index,t),this.index++,!0)}updateNodeAt(e,a,r,n,i){let t=this.top.children[n];return 3==t.dirty&&t.dom==t.contentDOM&&(t.dirty=2),!!t.update(e,a,r,i)&&(this.destroyBetween(this.index,n),this.index++,!0)}findIndexWithChild(e){for(;;){let a=e.parentNode;if(!a)return-1;if(a==this.top.contentDOM){let a=e.pmViewDesc;if(a)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==a)return e;return-1}e=a}}updateNextNode(e,a,r,n,i,t){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof _g){let l=this.preMatch.matched.get(s);if(null!=l&&l!=i)return!1;let c,d=s.dom,u=this.isLocked(d)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&Hg(a,s.outerDeco));if(!u&&s.update(e,a,r,n))return this.destroyBetween(this.index,o),s.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(s,e,a,r,n,t)))return this.destroyBetween(this.index,o),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(n,t+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,a,r,n,i,t){if(e.dirty||a.isAtom||!e.children.length||!e.node.content.eq(a.content)||!Hg(r,e.outerDeco)||!n.eq(e.innerDeco))return null;let o=_g.create(this.top,a,r,n,i,t);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,a,r,n,i){let t=_g.create(this.top,e,a,r,n,i);t.contentDOM&&t.updateChildren(n,i+1),this.top.children.splice(this.index++,0,t),this.changed=!0}placeWidget(e,a,r){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(!n||!n.matchesWidget(e)||e!=n.widget&&n.widget.type.toDOM.parentNode){let n=new Og(this.top,e,a,r);this.top.children.splice(this.index++,0,n),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],a=this.top;for(;e instanceof Mg;)a=e,e=a.children[a.children.length-1];(!e||!(e instanceof Dg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Xm||Jm)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",a),this.addHackNode("BR",this.top))}addHackNode(e,a){if(a==this.top&&this.index<a.children.length&&a.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);"IMG"==e&&(r.className="ProseMirror-separator",r.alt=""),"BR"==e&&(r.className="ProseMirror-trailingBreak");let n=new Ng(this.top,[],r,null);a!=this.top?a.children.push(n):a.children.splice(this.index++,0,n),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Gg(e,a){return e.type.side-a.type.side}function Kg(e,a,r,n,i){let t=[];for(let o=0,s=0;o<e.length;o++){let l=e[o],c=s,d=s+=l.size;c>=r||d<=a?t.push(l):(c<a&&t.push(l.slice(0,a-c,n)),i&&(t.push(i),i=void 0),d>r&&t.push(l.slice(r-c,l.size,n)))}return t}function Zg(e,a=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),t=i&&0==i.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let s,l,c=n.resolve(o);if(Fm(r)){for(s=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&hm.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,a,r){for(let n=0==a,i=a==Tm(e);n||i;){if(e==r)return!0;let a=Om(e);if(!(e=e.parentNode))return!1;n=n&&0==a,i=i&&a==Tm(e)}}(r.focusNode,r.focusOffset,i.dom))){let e=i.posBefore;l=new hm(o==e?c:n.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let a=o,i=o;for(let n=0;n<r.rangeCount;n++){let t=r.getRangeAt(n);a=Math.min(a,e.docView.posFromDOM(t.startContainer,t.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(t.endContainer,t.endOffset,-1))}if(a<0)return null;[s,o]=i==e.state.selection.anchor?[i,a]:[a,i],c=n.resolve(o)}else s=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(s<0)return null}let d=n.resolve(s);if(!l){l=ip(e,d,c,"pointer"==a||e.state.selection.head<c.pos&&!t?1:-1)}return l}function Jg(e){return e.editable?e.hasFocus():op(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Yg(e,a=!1){let r=e.state.selection;if(rp(e,r),Jg(e)){if(!a&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Jm){let a=e.domSelectionRange(),r=e.domObserver.currentSelection;if(a.anchorNode&&r.anchorNode&&Am(a.anchorNode,a.anchorOffset,r.anchorNode,r.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let a=e.domSelection(),r=document.createRange();if(!a)return;let n=e.cursorWrapper.dom,i="IMG"==n.nodeName;i?r.setStart(n.parentNode,Om(n)+1):r.setStart(n,0);r.collapse(!0),a.removeAllRanges(),a.addRange(r),!i&&!e.state.selection.visible&&Um&&Gm<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let n,i,{anchor:t,head:o}=r;!Xg||r instanceof dm||(r.$from.parent.inlineContent||(n=Qg(e,r.from)),r.empty||r.$from.parent.inlineContent||(i=Qg(e,r.to))),e.docView.setSelection(t,o,e,a),Xg&&(n&&ap(n),i&&ap(i)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let a=e.dom.ownerDocument;a.removeEventListener("selectionchange",e.input.hideSelectionGuard);let r=e.domSelectionRange(),n=r.anchorNode,i=r.anchorOffset;a.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{r.anchorNode==n&&r.anchorOffset==i||(a.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Jg(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Xg=Xm||Jm&&Ym<63;function Qg(e,a){let{node:r,offset:n}=e.docView.domFromPos(a,0),i=n<r.childNodes.length?r.childNodes[n]:null,t=n?r.childNodes[n-1]:null;if(Xm&&i&&"false"==i.contentEditable)return ep(i);if(!(i&&"false"!=i.contentEditable||t&&"false"!=t.contentEditable)){if(i)return ep(i);if(t)return ep(t)}}function ep(e){return e.contentEditable="true",Xm&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ap(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function rp(e,a){if(a instanceof hm){let r=e.docView.descAt(a.from);r!=e.lastSelectedViewDesc&&(np(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else np(e)}function np(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ip(e,a,r,n){return e.someProp("createSelectionBetween",(n=>n(e,a,r)))||dm.between(a,r,n)}function tp(e){return!(e.editable&&!e.hasFocus())&&op(e)}function op(e){let a=e.domSelectionRange();if(!a.anchorNode)return!1;try{return e.dom.contains(3==a.anchorNode.nodeType?a.anchorNode.parentNode:a.anchorNode)&&(e.editable||e.dom.contains(3==a.focusNode.nodeType?a.focusNode.parentNode:a.focusNode))}catch(e){return!1}}function sp(e,a){let{$anchor:r,$head:n}=e.selection,i=a>0?r.max(n):r.min(n),t=i.parent.inlineContent?i.depth?e.doc.resolve(a>0?i.after():i.before()):null:i;return t&&om.findFrom(t,a)}function lp(e,a){return e.dispatch(e.state.tr.setSelection(a).scrollIntoView()),!0}function cp(e,a,r){let n=e.state.selection;if(!(n instanceof dm)){if(n instanceof hm&&n.node.isInline)return lp(e,new dm(a>0?n.$to:n.$from));{let r=sp(e.state,a);return!!r&&lp(e,r)}}if(r.indexOf("s")>-1){let{$head:r}=n,i=r.textOffset?null:a<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let t=e.state.doc.resolve(r.pos+i.nodeSize*(a<0?-1:1));return lp(e,new dm(n.$anchor,t))}if(!n.empty)return!1;if(e.endOfTextblock(a>0?"forward":"backward")){let r=sp(e.state,a);return!!(r&&r instanceof hm)&&lp(e,r)}if(!(eg&&r.indexOf("m")>-1)){let r,i=n.$head,t=i.textOffset?null:a<0?i.nodeBefore:i.nodeAfter;if(!t||t.isText)return!1;let o=a<0?i.pos-t.nodeSize:i.pos;return!!(t.isAtom||(r=e.docView.descAt(o))&&!r.contentDOM)&&(hm.isSelectable(t)?lp(e,new hm(a<0?e.state.doc.resolve(i.pos-t.nodeSize):i)):!!ng&&lp(e,new dm(e.state.doc.resolve(a<0?o:o+t.nodeSize))))}}function dp(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function up(e,a){let r=e.pmViewDesc;return r&&0==r.size&&(a<0||e.nextSibling||"BR"!=e.nodeName)}function hp(e,a){return a<0?function(e){let a=e.domSelectionRange(),r=a.focusNode,n=a.focusOffset;if(!r)return;let i,t,o=!1;Km&&1==r.nodeType&&n<dp(r)&&up(r.childNodes[n],-1)&&(o=!0);for(;;)if(n>0){if(1!=r.nodeType)break;{let e=r.childNodes[n-1];if(up(e,-1))i=r,t=--n;else{if(3!=e.nodeType)break;r=e,n=r.nodeValue.length}}}else{if(mp(r))break;{let a=r.previousSibling;for(;a&&up(a,-1);)i=r.parentNode,t=Om(a),a=a.previousSibling;if(a)r=a,n=dp(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}}o?gp(e,r,n):i&&gp(e,i,t)}(e):function(e){let a=e.domSelectionRange(),r=a.focusNode,n=a.focusOffset;if(!r)return;let i,t,o=dp(r);for(;;)if(n<o){if(1!=r.nodeType)break;if(!up(r.childNodes[n],1))break;i=r,t=++n}else{if(mp(r))break;{let a=r.nextSibling;for(;a&&up(a,1);)i=a.parentNode,t=Om(a)+1,a=a.nextSibling;if(a)r=a,n=0,o=dp(r);else{if(r=r.parentNode,r==e.dom)break;n=o=0}}}i&&gp(e,i,t)}(e)}function mp(e){let a=e.pmViewDesc;return a&&a.node&&a.node.isBlock}function gp(e,a,r){if(3!=a.nodeType){let e,n;(n=function(e,a){for(;e&&a==e.childNodes.length&&!Im(e);)a=Om(e)+1,e=e.parentNode;for(;e&&a<e.childNodes.length;){let r=e.childNodes[a];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;e=r,a=0}}(a,r))?(a=n,r=0):(e=function(e,a){for(;e&&!a&&!Im(e);)a=Om(e),e=e.parentNode;for(;e&&a;){let r=e.childNodes[a-1];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;a=(e=r).childNodes.length}}(a,r))&&(a=e,r=e.nodeValue.length)}let n=e.domSelection();if(!n)return;if(Fm(n)){let e=document.createRange();e.setEnd(a,r),e.setStart(a,r),n.removeAllRanges(),n.addRange(e)}else n.extend&&n.extend(a,r);e.domObserver.setCurSelection();let{state:i}=e;setTimeout((()=>{e.state==i&&Yg(e)}),50)}function pp(e,a){let r=e.state.doc.resolve(a);if(!Jm&&!ag&&r.parent.inlineContent){let n=e.coordsAtPos(a);if(a>r.start()){let r=e.coordsAtPos(a-1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left<n.left?"ltr":"rtl"}if(a<r.end()){let r=e.coordsAtPos(a+1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left>n.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function bp(e,a,r){let n=e.state.selection;if(n instanceof dm&&!n.empty||r.indexOf("s")>-1)return!1;if(eg&&r.indexOf("m")>-1)return!1;let{$from:i,$to:t}=n;if(!i.parent.inlineContent||e.endOfTextblock(a<0?"up":"down")){let r=sp(e.state,a);if(r&&r instanceof hm)return lp(e,r)}if(!i.parent.inlineContent){let r=a<0?i:t,o=n instanceof gm?om.near(r,a):om.findFrom(r,a);return!!o&&lp(e,o)}return!1}function fp(e,a){if(!(e.state.selection instanceof dm))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(a>0?"forward":"backward"))return!0;let t=!r.textOffset&&(a<0?r.nodeBefore:r.nodeAfter);if(t&&!t.isText){let n=e.state.tr;return a<0?n.delete(r.pos-t.nodeSize,r.pos):n.delete(r.pos,r.pos+t.nodeSize),e.dispatch(n),!0}return!1}function kp(e,a,r){e.domObserver.stop(),a.contentEditable=r,e.domObserver.start()}function yp(e,a){let r=a.keyCode,n=function(e){let a="";return e.ctrlKey&&(a+="c"),e.metaKey&&(a+="m"),e.altKey&&(a+="a"),e.shiftKey&&(a+="s"),a}(a);if(8==r||eg&&72==r&&"c"==n)return fp(e,-1)||hp(e,-1);if(46==r&&!a.shiftKey||eg&&68==r&&"c"==n)return fp(e,1)||hp(e,1);if(13==r||27==r)return!0;if(37==r||eg&&66==r&&"c"==n){let a=37==r?"ltr"==pp(e,e.state.selection.from)?-1:1:-1;return cp(e,a,n)||hp(e,a)}if(39==r||eg&&70==r&&"c"==n){let a=39==r?"ltr"==pp(e,e.state.selection.from)?1:-1:1;return cp(e,a,n)||hp(e,a)}return 38==r||eg&&80==r&&"c"==n?bp(e,-1,n)||hp(e,-1):40==r||eg&&78==r&&"c"==n?function(e){if(!Xm||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:a,focusOffset:r}=e.domSelectionRange();if(a&&1==a.nodeType&&0==r&&a.firstChild&&"false"==a.firstChild.contentEditable){let r=a.firstChild;kp(e,r,"true"),setTimeout((()=>kp(e,r,"false")),20)}return!1}(e)||bp(e,1,n)||hp(e,1):n==(eg?"m":"c")&&(66==r||73==r||89==r||90==r)}function vp(e,a){e.someProp("transformCopied",(r=>{a=r(a,e)}));let r=[],{content:n,openStart:i,openEnd:t}=a;for(;i>1&&t>1&&1==n.childCount&&1==n.firstChild.childCount;){i--,t--;let e=n.firstChild;r.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),n=e.content}let o=e.someProp("clipboardSerializer")||dh.fromSchema(e.state.schema),s=Ep(),l=s.createElement("div");l.appendChild(o.serializeFragment(n,{document:s}));let c,d=l.firstChild,u=0;for(;d&&1==d.nodeType&&(c=Sp[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let a=s.createElement(c[e]);for(;l.firstChild;)a.appendChild(l.firstChild);l.appendChild(a),u++}d=l.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${i} ${t}${u?` -${u}`:""} ${JSON.stringify(r)}`),{dom:l,text:e.someProp("clipboardTextSerializer",(r=>r(a,e)))||a.content.textBetween(0,a.content.size,"\n\n"),slice:a}}function wp(e,a,r,n,i){let t,o,s=i.parent.type.spec.code;if(!r&&!a)return null;let l=a&&(n||s||!r);if(l){if(e.someProp("transformPastedText",(r=>{a=r(a,s||n,e)})),s)return a?new pu(cu.from(e.state.schema.text(a.replace(/\r\n?/g,"\n"))),0,0):pu.empty;let r=e.someProp("clipboardTextParser",(r=>r(a,i,n,e)));if(r)o=r;else{let r=i.marks(),{schema:n}=e.state,o=dh.fromSchema(n);t=document.createElement("div"),a.split(/(?:\r\n?|\n)+/).forEach((e=>{let a=t.appendChild(document.createElement("p"));e&&a.appendChild(o.serializeNode(n.text(e,r)))}))}}else e.someProp("transformPastedHTML",(a=>{r=a(r,e)})),t=function(e){let a=/^(\s*<meta [^>]*>)*/.exec(e);a&&(e=e.slice(a[0].length));let r,n=Ep().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(r=i&&Sp[i[1].toLowerCase()])&&(e=r.map((e=>"<"+e+">")).join("")+e+r.map((e=>"</"+e+">")).reverse().join(""));if(n.innerHTML=function(e){let a=window.trustedTypes;if(!a)return e;Mp||(Mp=a.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Mp.createHTML(e)}(e),r)for(let e=0;e<r.length;e++)n=n.querySelector(r[e])||n;return n}(r),ng&&function(e){let a=e.querySelectorAll(Jm?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<a.length;r++){let n=a[r];1==n.childNodes.length&&" "==n.textContent&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}(t);let c=t&&t.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=t.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;t=e}if(!o){let a=e.someProp("clipboardParser")||e.someProp("domParser")||eh.fromSchema(e.state.schema);o=a.parseSlice(t,{preserveWhitespace:!(!l&&!d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||zp.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)o=function(e,a){if(!e.size)return e;let r,n=e.content.firstChild.type.schema;try{r=JSON.parse(a)}catch(a){return e}let{content:i,openStart:t,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let a=n.nodes[r[e]];if(!a||a.hasRequiredAttrs())break;i=cu.from(a.create(r[e+1],i)),t++,o++}return new pu(i,t,o)}(Cp(o,+d[1],+d[2]),d[4]);else if(o=pu.maxOpen(function(e,a){if(e.childCount<2)return e;for(let r=a.depth;r>=0;r--){let n,i=a.node(r).contentMatchAt(a.index(r)),t=[];if(e.forEach((e=>{if(!t)return;let a,r=i.findWrapping(e.type);if(!r)return t=null;if(a=t.length&&n.length&&xp(r,n,e,t[t.length-1],0))t[t.length-1]=a;else{t.length&&(t[t.length-1]=$p(t[t.length-1],n.length));let a=jp(e,r);t.push(a),i=i.matchType(a.type),n=r}})),t)return cu.from(t)}return e}(o.content,i),!0),o.openStart||o.openEnd){let e=0,a=0;for(let a=o.content.firstChild;e<o.openStart&&!a.type.spec.isolating;e++,a=a.firstChild);for(let e=o.content.lastChild;a<o.openEnd&&!e.type.spec.isolating;a++,e=e.lastChild);o=Cp(o,e,a)}return e.someProp("transformPasted",(a=>{o=a(o,e)})),o}const zp=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function jp(e,a,r=0){for(let n=a.length-1;n>=r;n--)e=a[n].create(null,cu.from(e));return e}function xp(e,a,r,n,i){if(i<e.length&&i<a.length&&e[i]==a[i]){let t=xp(e,a,r,n.lastChild,i+1);if(t)return n.copy(n.content.replaceChild(n.childCount-1,t));if(n.contentMatchAt(n.childCount).matchType(i==e.length-1?r.type:e[i+1]))return n.copy(n.content.append(cu.from(jp(r,e,i+1))))}}function $p(e,a){if(0==a)return e;let r=e.content.replaceChild(e.childCount-1,$p(e.lastChild,a-1)),n=e.contentMatchAt(e.childCount).fillBefore(cu.empty,!0);return e.copy(r.append(n))}function qp(e,a,r,n,i,t){let o=a<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(t=0),i<n-1&&(s=qp(s,a,r,n,i+1,t)),i>=r&&(s=a<0?o.contentMatchAt(0).fillBefore(s,t<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(cu.empty,!0))),e.replaceChild(a<0?0:e.childCount-1,o.copy(s))}function Cp(e,a,r){return a<e.openStart&&(e=new pu(qp(e.content,-1,a,e.openStart,0,e.openEnd),a,e.openEnd)),r<e.openEnd&&(e=new pu(qp(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}const Sp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Op=null;function Ep(){return Op||(Op=document.implementation.createHTMLDocument("title"))}let Mp=null;const _p={},Ap={},Dp={touchstart:!0,touchmove:!0};class Np{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Tp(e,a){e.input.lastSelectionOrigin=a,e.input.lastSelectionTime=Date.now()}function Ip(e){e.someProp("handleDOMEvents",(a=>{for(let r in a)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=a=>Fp(e,a))}))}function Fp(e,a){return e.someProp("handleDOMEvents",(r=>{let n=r[a.type];return!!n&&(n(e,a)||a.defaultPrevented)}))}function Pp(e,a){if(!a.bubbles)return!0;if(a.defaultPrevented)return!1;for(let r=a.target;r!=e.dom;r=r.parentNode)if(!r||11==r.nodeType||r.pmViewDesc&&r.pmViewDesc.stopEvent(a))return!1;return!0}function Rp(e){return{left:e.clientX,top:e.clientY}}function Lp(e,a,r,n,i){if(-1==n)return!1;let t=e.state.doc.resolve(n);for(let n=t.depth+1;n>0;n--)if(e.someProp(a,(a=>n>t.depth?a(e,r,t.nodeAfter,t.before(n),i,!0):a(e,r,t.node(n),t.before(n),i,!1))))return!0;return!1}function Bp(e,a,r){if(e.focused||e.focus(),e.state.selection.eq(a))return;let n=e.state.tr.setSelection(a);n.setMeta("pointer",!0),e.dispatch(n)}function Vp(e,a,r,n,i){return Lp(e,"handleClickOn",a,r,n)||e.someProp("handleClick",(r=>r(e,a,n)))||(i?function(e,a){if(-1==a)return!1;let r,n,i=e.state.selection;i instanceof hm&&(r=i.node);let t=e.state.doc.resolve(a);for(let e=t.depth+1;e>0;e--){let a=e>t.depth?t.nodeAfter:t.node(e);if(hm.isSelectable(a)){n=r&&i.$from.depth>0&&e>=i.$from.depth&&t.before(i.$from.depth+1)==i.$from.pos?t.before(i.$from.depth):t.before(e);break}}return null!=n&&(Bp(e,hm.create(e.state.doc,n)),!0)}(e,r):function(e,a){if(-1==a)return!1;let r=e.state.doc.resolve(a),n=r.nodeAfter;return!!(n&&n.isAtom&&hm.isSelectable(n))&&(Bp(e,new hm(r)),!0)}(e,r))}function Hp(e,a,r,n){return Lp(e,"handleDoubleClickOn",a,r,n)||e.someProp("handleDoubleClick",(r=>r(e,a,n)))}function Wp(e,a,r,n){return Lp(e,"handleTripleClickOn",a,r,n)||e.someProp("handleTripleClick",(r=>r(e,a,n)))||function(e,a,r){if(0!=r.button)return!1;let n=e.state.doc;if(-1==a)return!!n.inlineContent&&(Bp(e,dm.create(n,0,n.content.size)),!0);let i=n.resolve(a);for(let a=i.depth+1;a>0;a--){let r=a>i.depth?i.nodeAfter:i.node(a),t=i.before(a);if(r.inlineContent)Bp(e,dm.create(n,t+1,t+1+r.content.size));else{if(!hm.isSelectable(r))continue;Bp(e,hm.create(n,t))}return!0}}(e,r,n)}function Up(e){return eb(e)}Ap.keydown=(e,a)=>{let r=a;if(e.input.shiftKey=16==r.keyCode||r.shiftKey,!Zp(e,r)&&(e.input.lastKeyCode=r.keyCode,e.input.lastKeyCodeTime=Date.now(),!rg||!Jm||13!=r.keyCode))if(229!=r.keyCode&&e.domObserver.forceFlush(),!Qm||13!=r.keyCode||r.ctrlKey||r.altKey||r.metaKey)e.someProp("handleKeyDown",(a=>a(e,r)))||yp(e,r)?r.preventDefault():Tp(e,"key");else{let a=Date.now();e.input.lastIOSEnter=a,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==a&&(e.someProp("handleKeyDown",(a=>a(e,Pm(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},Ap.keyup=(e,a)=>{16==a.keyCode&&(e.input.shiftKey=!1)},Ap.keypress=(e,a)=>{let r=a;if(Zp(e,r)||!r.charCode||r.ctrlKey&&!r.altKey||eg&&r.metaKey)return;if(e.someProp("handleKeyPress",(a=>a(e,r))))return void r.preventDefault();let n=e.state.selection;if(!(n instanceof dm&&n.$from.sameParent(n.$to))){let a=String.fromCharCode(r.charCode);/[\r\n]/.test(a)||e.someProp("handleTextInput",(r=>r(e,n.$from.pos,n.$to.pos,a)))||e.dispatch(e.state.tr.insertText(a).scrollIntoView()),r.preventDefault()}};const Gp=eg?"metaKey":"ctrlKey";_p.mousedown=(e,a)=>{let r=a;e.input.shiftKey=r.shiftKey;let n=Up(e),i=Date.now(),t="singleClick";i-e.input.lastClick.time<500&&function(e,a){let r=a.x-e.clientX,n=a.y-e.clientY;return r*r+n*n<100}(r,e.input.lastClick)&&!r[Gp]&&("singleClick"==e.input.lastClick.type?t="doubleClick":"doubleClick"==e.input.lastClick.type&&(t="tripleClick")),e.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:t};let o=e.posAtCoords(Rp(r));o&&("singleClick"==t?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Kp(e,o,r,!!n)):("doubleClick"==t?Hp:Wp)(e,o.pos,o.inside,r)?r.preventDefault():Tp(e,"pointer"))};class Kp{constructor(e,a,r,n){let i,t;if(this.view=e,this.pos=a,this.event=r,this.flushed=n,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Gp],this.allowDefault=r.shiftKey,a.inside>-1)i=e.state.doc.nodeAt(a.inside),t=a.inside;else{let r=e.state.doc.resolve(a.pos);i=r.parent,t=r.depth?r.before():0}const o=n?null:r.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&1==s.dom.nodeType?s.dom:null;let{selection:l}=e.state;(0==r.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof hm&&l.from<=t&&l.to>t)&&(this.mightDrag={node:i,pos:t,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Km||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Tp(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>Yg(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let a=this.pos;this.view.state.doc!=this.startDoc&&(a=this.view.posAtCoords(Rp(e))),this.updateAllowDefault(e),this.allowDefault||!a?Tp(this.view,"pointer"):Vp(this.view,a.pos,a.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Xm&&this.mightDrag&&!this.mightDrag.node.isAtom||Jm&&!this.view.state.selection.visible&&Math.min(Math.abs(a.pos-this.view.state.selection.from),Math.abs(a.pos-this.view.state.selection.to))<=2)?(Bp(this.view,om.near(this.view.state.doc.resolve(a.pos))),e.preventDefault()):Tp(this.view,"pointer")}move(e){this.updateAllowDefault(e),Tp(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function Zp(e,a){return!!e.composing||!!(Xm&&Math.abs(a.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}_p.touchstart=e=>{e.input.lastTouch=Date.now(),Up(e),Tp(e,"pointer")},_p.touchmove=e=>{e.input.lastTouch=Date.now(),Tp(e,"pointer")},_p.contextmenu=e=>Up(e);const Jp=rg?5e3:-1;function Yp(e,a){clearTimeout(e.input.composingTimeout),a>-1&&(e.input.composingTimeout=setTimeout((()=>eb(e)),a))}function Xp(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Qp(e){let a=e.domSelectionRange();if(!a.focusNode)return null;let r=function(e,a){for(;;){if(3==e.nodeType&&a)return e;if(1==e.nodeType&&a>0){if("false"==e.contentEditable)return null;a=Tm(e=e.childNodes[a-1])}else{if(!e.parentNode||Im(e))return null;a=Om(e),e=e.parentNode}}}(a.focusNode,a.focusOffset),n=function(e,a){for(;;){if(3==e.nodeType&&a<e.nodeValue.length)return e;if(1==e.nodeType&&a<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[a],a=0}else{if(!e.parentNode||Im(e))return null;a=Om(e)+1,e=e.parentNode}}}(a.focusNode,a.focusOffset);if(r&&n&&r!=n){let a=n.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(r==i||n==i)return i;if(!a||!a.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let e=r.pmViewDesc;if(e&&e.isText(r.nodeValue))return n}}return r||n}function eb(e,a=!1){if(!(rg&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Xp(e),a||e.docView&&e.docView.dirty){let r=Zg(e);return r&&!r.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(r)):!e.markCursor&&!a||e.state.selection.empty?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Ap.compositionstart=Ap.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:a}=e,r=a.selection.$to;if(a.selection instanceof dm&&(a.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||r.marks(),eb(e,!0),e.markCursor=null;else if(eb(e,!a.selection.empty),Km&&a.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let a=e.domSelectionRange();for(let r=a.focusNode,n=a.focusOffset;r&&1==r.nodeType&&0!=n;){let a=n<0?r.lastChild:r.childNodes[n-1];if(!a)break;if(3==a.nodeType){let r=e.domSelection();r&&r.collapse(a,a.nodeValue.length);break}r=a,n=-1}}e.input.composing=!0}Yp(e,Jp)},Ap.compositionend=(e,a)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=a.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,Yp(e,20))};const ab=Um&&Gm<15||Qm&&ig<604;function rb(e,a,r,n,i){let t=wp(e,a,r,n,e.state.selection.$from);if(e.someProp("handlePaste",(a=>a(e,i,t||pu.empty))))return!0;if(!t)return!1;let o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(t),s=o?e.state.tr.replaceSelectionWith(o,n):e.state.tr.replaceSelection(t);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nb(e){let a=e.getData("text/plain")||e.getData("Text");if(a)return a;let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}_p.copy=Ap.cut=(e,a)=>{let r=a,n=e.state.selection,i="cut"==r.type;if(n.empty)return;let t=ab?null:r.clipboardData,o=n.content(),{dom:s,text:l}=vp(e,o);t?(r.preventDefault(),t.clearData(),t.setData("text/html",s.innerHTML),t.setData("text/plain",l)):function(e,a){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(a),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(a),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout((()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()}),50)}(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Ap.paste=(e,a)=>{let r=a;if(e.composing&&!rg)return;let n=ab?null:r.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&rb(e,nb(n),n.getData("text/html"),i,r)?r.preventDefault():function(e,a){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?rb(e,n.value,null,i,a):rb(e,n.textContent,n.innerHTML,i,a)}),50)}(e,r)};class ib{constructor(e,a,r){this.slice=e,this.move=a,this.node=r}}const tb=eg?"altKey":"ctrlKey";_p.dragstart=(e,a)=>{let r=a,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let i,t=e.state.selection,o=t.empty?null:e.posAtCoords(Rp(r));if(o&&o.pos>=t.from&&o.pos<=(t instanceof hm?t.to-1:t.to));else if(n&&n.mightDrag)i=hm.create(e.state.doc,n.mightDrag.pos);else if(r.target&&1==r.target.nodeType){let a=e.docView.nearestDesc(r.target,!0);a&&a.node.type.spec.draggable&&a!=e.docView&&(i=hm.create(e.state.doc,a.posBefore))}let s=(i||e.state.selection).content(),{dom:l,text:c,slice:d}=vp(e,s);(!r.dataTransfer.files.length||!Jm||Ym>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(ab?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",ab||r.dataTransfer.setData("text/plain",c),e.dragging=new ib(d,!r[tb],i)},_p.dragend=e=>{let a=e.dragging;window.setTimeout((()=>{e.dragging==a&&(e.dragging=null)}),50)},Ap.dragover=Ap.dragenter=(e,a)=>a.preventDefault(),Ap.drop=(e,a)=>{let r=a,n=e.dragging;if(e.dragging=null,!r.dataTransfer)return;let i=e.posAtCoords(Rp(r));if(!i)return;let t=e.state.doc.resolve(i.pos),o=n&&n.slice;o?e.someProp("transformPasted",(a=>{o=a(o,e)})):o=wp(e,nb(r.dataTransfer),ab?null:r.dataTransfer.getData("text/html"),!1,t);let s=!(!n||r[tb]);if(e.someProp("handleDrop",(a=>a(e,r,o||pu.empty,s))))return void r.preventDefault();if(!o)return;r.preventDefault();let l=o?Hh(e.state.doc,t.pos,o):t.pos;null==l&&(l=t.pos);let c=e.state.tr;if(s){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(h))return;let m=c.doc.resolve(d);if(u&&hm.isSelectable(o.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new hm(m));else{let a=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,r,n,i)=>a=i)),c.setSelection(ip(e,m,c.doc.resolve(a)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},_p.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Yg(e)}),20))},_p.blur=(e,a)=>{let r=a;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),r.relatedTarget&&e.dom.contains(r.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},_p.beforeinput=(e,a)=>{if(Jm&&rg&&"deleteContentBackward"==a.inputType){e.domObserver.flushSoon();let{domChangeCount:a}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=a)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(a=>a(e,Pm(8,"Backspace")))))return;let{$cursor:r}=e.state.selection;r&&r.pos>0&&e.dispatch(e.state.tr.delete(r.pos-1,r.pos).scrollIntoView())}),50)}};for(let e in Ap)_p[e]=Ap[e];function ob(e,a){if(e==a)return!0;for(let r in e)if(e[r]!==a[r])return!1;for(let r in a)if(!(r in e))return!1;return!0}class sb{constructor(e,a){this.toDOM=e,this.spec=a||hb,this.side=this.spec.side||0}map(e,a,r,n){let{pos:i,deleted:t}=e.mapResult(a.from+n,this.side<0?-1:1);return t?null:new db(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof sb&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ob(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class lb{constructor(e,a){this.attrs=e,this.spec=a||hb}map(e,a,r,n){let i=e.map(a.from+n,this.spec.inclusiveStart?-1:1)-r,t=e.map(a.to+n,this.spec.inclusiveEnd?1:-1)-r;return i>=t?null:new db(i,t,this)}valid(e,a){return a.from<a.to}eq(e){return this==e||e instanceof lb&&ob(this.attrs,e.attrs)&&ob(this.spec,e.spec)}static is(e){return e.type instanceof lb}destroy(){}}class cb{constructor(e,a){this.attrs=e,this.spec=a||hb}map(e,a,r,n){let i=e.mapResult(a.from+n,1);if(i.deleted)return null;let t=e.mapResult(a.to+n,-1);return t.deleted||t.pos<=i.pos?null:new db(i.pos-r,t.pos-r,this)}valid(e,a){let r,{index:n,offset:i}=e.content.findIndex(a.from);return i==a.from&&!(r=e.child(n)).isText&&i+r.nodeSize==a.to}eq(e){return this==e||e instanceof cb&&ob(this.attrs,e.attrs)&&ob(this.spec,e.spec)}destroy(){}}class db{constructor(e,a,r){this.from=e,this.to=a,this.type=r}copy(e,a){return new db(e,a,this.type)}eq(e,a=0){return this.type.eq(e.type)&&this.from+a==e.from&&this.to+a==e.to}map(e,a,r){return this.type.map(e,this,a,r)}static widget(e,a,r){return new db(e,e,new sb(a,r))}static inline(e,a,r,n){return new db(e,a,new lb(r,n))}static node(e,a,r,n){return new db(e,a,new cb(r,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof lb}get widget(){return this.type instanceof sb}}const ub=[],hb={};class mb{constructor(e,a){this.local=e.length?e:ub,this.children=a.length?a:ub}static create(e,a){return a.length?yb(a,e,0,hb):gb}find(e,a,r){let n=[];return this.findInner(null==e?0:e,null==a?1e9:a,n,0,r),n}findInner(e,a,r,n,i){for(let t=0;t<this.local.length;t++){let o=this.local[t];o.from<=a&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+n,o.to+n))}for(let t=0;t<this.children.length;t+=3)if(this.children[t]<a&&this.children[t+1]>e){let o=this.children[t]+1;this.children[t+2].findInner(e-o,a-o,r,n+o,i)}}map(e,a,r){return this==gb||0==e.maps.length?this:this.mapInner(e,a,0,0,r||hb)}mapInner(e,a,r,n,i){let t;for(let o=0;o<this.local.length;o++){let s=this.local[o].map(e,r,n);s&&s.type.valid(a,s)?(t||(t=[])).push(s):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,a,r,n,i,t,o){let s=e.slice();for(let e=0,a=t;e<r.maps.length;e++){let n=0;r.maps[e].forEach(((e,r,i,t)=>{let o=t-i-(r-e);for(let i=0;i<s.length;i+=3){let t=s[i+1];if(t<0||e>t+a-n)continue;let l=s[i]+a-n;r>=l?s[i+1]=e<=l?-2:-1:e>=a&&o&&(s[i]+=o,s[i+1]+=o)}n+=o})),a=r.maps[e].map(a,-1)}let l=!1;for(let a=0;a<s.length;a+=3)if(s[a+1]<0){if(-2==s[a+1]){l=!0,s[a+1]=-1;continue}let c=r.map(e[a]+t),d=c-i;if(d<0||d>=n.content.size){l=!0;continue}let u=r.map(e[a+1]+t,-1)-i,{index:h,offset:m}=n.content.findIndex(d),g=n.maybeChild(h);if(g&&m==d&&m+g.nodeSize==u){let n=s[a+2].mapInner(r,g,c+1,e[a]+t+1,o);n!=gb?(s[a]=d,s[a+1]=u,s[a+2]=n):(s[a+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,a,r,n,i,t,o){function s(e,a){for(let t=0;t<e.local.length;t++){let s=e.local[t].map(n,i,a);s?r.push(s):o.onRemove&&o.onRemove(e.local[t].spec)}for(let r=0;r<e.children.length;r+=3)s(e.children[r+2],e.children[r]+a+1)}for(let r=0;r<e.length;r+=3)-1==e[r+1]&&s(e[r+2],a[r]+t+1);return r}(s,e,a,r,i,t,o),c=yb(l,n,0,o);a=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,a=0;e<c.children.length;e+=3){let r=c.children[e];for(;a<s.length&&s[a]<r;)a+=3;s.splice(a,0,c.children[e],c.children[e+1],c.children[e+2])}}return new mb(a.sort(vb),s)}(this.children,t||[],e,a,r,n,i):t?new mb(t.sort(vb),ub):gb}add(e,a){return a.length?this==gb?mb.create(e,a):this.addInner(e,a,0):this}addInner(e,a,r){let n,i=0;e.forEach(((e,t)=>{let o,s=t+r;if(o=fb(a,e,s)){for(n||(n=this.children.slice());i<n.length&&n[i]<t;)i+=3;n[i]==t?n[i+2]=n[i+2].addInner(e,o,s+1):n.splice(i,0,t,t+e.nodeSize,yb(o,e,s+1,hb)),i+=3}}));let t=bb(i?kb(a):a,-r);for(let a=0;a<t.length;a++)t[a].type.valid(e,t[a])||t.splice(a--,1);return new mb(t.length?this.local.concat(t).sort(vb):this.local,n||this.children)}remove(e){return 0==e.length||this==gb?this:this.removeInner(e,0)}removeInner(e,a){let r=this.children,n=this.local;for(let n=0;n<r.length;n+=3){let i,t=r[n]+a,o=r[n+1]+a;for(let a,r=0;r<e.length;r++)(a=e[r])&&a.from>t&&a.to<o&&(e[r]=null,(i||(i=[])).push(a));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[n+2].removeInner(i,t+1);s!=gb?r[n+2]=s:(r.splice(n,3),n-=3)}if(n.length)for(let r,i=0;i<e.length;i++)if(r=e[i])for(let e=0;e<n.length;e++)n[e].eq(r,a)&&(n==this.local&&(n=this.local.slice()),n.splice(e--,1));return r==this.children&&n==this.local?this:n.length||r.length?new mb(n,r):gb}forChild(e,a){if(this==gb)return this;if(a.isLeaf)return mb.empty;let r,n;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,t=i+a.content.size;for(let e=0;e<this.local.length;e++){let a=this.local[e];if(a.from<t&&a.to>i&&a.type instanceof lb){let e=Math.max(i,a.from)-i,r=Math.min(t,a.to)-i;e<r&&(n||(n=[])).push(a.copy(e,r))}}if(n){let e=new mb(n.sort(vb),ub);return r?new pb([e,r]):e}return r||gb}eq(e){if(this==e)return!0;if(!(e instanceof mb)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let a=0;a<this.local.length;a++)if(!this.local[a].eq(e.local[a]))return!1;for(let a=0;a<this.children.length;a+=3)if(this.children[a]!=e.children[a]||this.children[a+1]!=e.children[a+1]||!this.children[a+2].eq(e.children[a+2]))return!1;return!0}locals(e){return wb(this.localsInner(e))}localsInner(e){if(this==gb)return ub;if(e.inlineContent||!this.local.some(lb.is))return this.local;let a=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof lb||a.push(this.local[e]);return a}forEachSet(e){e(this)}}mb.empty=new mb([],[]),mb.removeOverlap=wb;const gb=mb.empty;class pb{constructor(e){this.members=e}map(e,a){const r=this.members.map((r=>r.map(e,a,hb)));return pb.from(r)}forChild(e,a){if(a.isLeaf)return mb.empty;let r=[];for(let n=0;n<this.members.length;n++){let i=this.members[n].forChild(e,a);i!=gb&&(i instanceof pb?r=r.concat(i.members):r.push(i))}return pb.from(r)}eq(e){if(!(e instanceof pb)||e.members.length!=this.members.length)return!1;for(let a=0;a<this.members.length;a++)if(!this.members[a].eq(e.members[a]))return!1;return!0}locals(e){let a,r=!0;for(let n=0;n<this.members.length;n++){let i=this.members[n].localsInner(e);if(i.length)if(a){r&&(a=a.slice(),r=!1);for(let e=0;e<i.length;e++)a.push(i[e])}else a=i}return a?wb(r?a:a.sort(vb)):ub}static from(e){switch(e.length){case 0:return gb;case 1:return e[0];default:return new pb(e.every((e=>e instanceof mb))?e:e.reduce(((e,a)=>e.concat(a instanceof mb?a:a.members)),[]))}}forEachSet(e){for(let a=0;a<this.members.length;a++)this.members[a].forEachSet(e)}}function bb(e,a){if(!a||!e.length)return e;let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(new db(i.from+a,i.to+a,i.type))}return r}function fb(e,a,r){if(a.isLeaf)return null;let n=r+a.nodeSize,i=null;for(let a,t=0;t<e.length;t++)(a=e[t])&&a.from>r&&a.to<n&&((i||(i=[])).push(a),e[t]=null);return i}function kb(e){let a=[];for(let r=0;r<e.length;r++)null!=e[r]&&a.push(e[r]);return a}function yb(e,a,r,n){let i=[],t=!1;a.forEach(((a,o)=>{let s=fb(e,a,o+r);if(s){t=!0;let e=yb(s,a,r+o+1,n);e!=gb&&i.push(o,o+a.nodeSize,e)}}));let o=bb(t?kb(e):e,-r).sort(vb);for(let e=0;e<o.length;e++)o[e].type.valid(a,o[e])||(n.onRemove&&n.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new mb(o,i):gb}function vb(e,a){return e.from-a.from||e.to-a.to}function wb(e){let a=e;for(let r=0;r<a.length-1;r++){let n=a[r];if(n.from!=n.to)for(let i=r+1;i<a.length;i++){let t=a[i];if(t.from!=n.from){t.from<n.to&&(a==e&&(a=e.slice()),a[r]=n.copy(n.from,t.from),zb(a,i,n.copy(t.from,n.to)));break}t.to!=n.to&&(a==e&&(a=e.slice()),a[i]=t.copy(t.from,n.to),zb(a,i+1,t.copy(n.to,t.to)))}}return a}function zb(e,a,r){for(;a<e.length&&vb(r,e[a])>0;)a++;e.splice(a,0,r)}function jb(e){let a=[];return e.someProp("decorations",(r=>{let n=r(e.state);n&&n!=gb&&a.push(n)})),e.cursorWrapper&&a.push(mb.create(e.state.doc,[e.cursorWrapper.deco])),pb.from(a)}const xb={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},$b=Um&&Gm<=11;class qb{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Cb{constructor(e,a){this.view=e,this.handleDOMChange=a,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new qb,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let a=0;a<e.length;a++)this.queue.push(e[a]);Um&&Gm<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),$b&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,xb)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let a=0;a<e.length;a++)this.queue.push(e[a]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(tp(this.view)){if(this.suppressingSelectionUpdates)return Yg(this.view);if(Um&&Gm<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Am(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let a,r=new Set;for(let a=e.focusNode;a;a=Em(a))r.add(a);for(let n=e.anchorNode;n;n=Em(n))if(r.has(n)){a=n;break}let n=a&&this.view.docView.nearestDesc(a);return n&&n.ignoreMutation({type:"selection",target:3==a.nodeType?a.parentNode:a})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let a=this.pendingRecords();a.length&&(this.queue=[]);let r=e.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&tp(e)&&!this.ignoreSelectionChange(r),i=-1,t=-1,o=!1,s=[];if(e.editable)for(let e=0;e<a.length;e++){let r=this.registerMutation(a[e],s);r&&(i=i<0?r.from:Math.min(r.from,i),t=t<0?r.to:Math.max(r.to,t),r.typeOver&&(o=!0))}if(Km&&s.length){let a=s.filter((e=>"BR"==e.nodeName));if(2==a.length){let[e,r]=a;e.parentNode&&e.parentNode.parentNode==r.parentNode?r.remove():e.remove()}else{let{focusNode:r}=this.currentSelection;for(let n of a){let a=n.parentNode;!a||"LI"!=a.nodeName||r&&Mb(e,r)==a||n.remove()}}}let l=null;i<0&&n&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Fm(r)&&(l=Zg(e))&&l.eq(om.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Yg(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||n)&&(i>-1&&(e.docView.markDirty(i,t),function(e){if(Sb.has(e))return;if(Sb.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Km,Ob)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ob=!0}}(e)),this.handleDOMChange(i,t,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Yg(e),this.currentSelection.set(r))}registerMutation(e,a){if(a.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(r==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!r||r.ignoreMutation(e))return null;if("childList"==e.type){for(let r=0;r<e.addedNodes.length;r++){let n=e.addedNodes[r];a.push(n),3==n.nodeType&&(this.lastChangedTextNode=n)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let n=e.previousSibling,i=e.nextSibling;if(Um&&Gm<=11&&e.addedNodes.length)for(let a=0;a<e.addedNodes.length;a++){let{previousSibling:r,nextSibling:t}=e.addedNodes[a];(!r||Array.prototype.indexOf.call(e.addedNodes,r)<0)&&(n=r),(!t||Array.prototype.indexOf.call(e.addedNodes,t)<0)&&(i=t)}let t=n&&n.parentNode==e.target?Om(n)+1:0,o=r.localPosFromDOM(e.target,t,-1),s=i&&i.parentNode==e.target?Om(i):e.target.childNodes.length;return{from:o,to:r.localPosFromDOM(e.target,s,1)}}return"attributes"==e.type?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Sb=new WeakMap,Ob=!1;function Eb(e,a){let r=a.startContainer,n=a.startOffset,i=a.endContainer,t=a.endOffset,o=e.domAtPos(e.state.selection.anchor);return Am(o.node,o.offset,i,t)&&([r,n,i,t]=[i,t,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:t}}function Mb(e,a){for(let r=a.parentNode;r&&r!=e.dom;r=r.parentNode){let a=e.docView.nearestDesc(r,!0);if(a&&a.node.isBlock)return r}return null}function _b(e){let a=e.pmViewDesc;if(a)return a.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Xm&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||Xm&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Ab=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Db(e,a,r,n,i){let t=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,a<0){let a=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,r=Zg(e,a);if(r&&!e.state.selection.eq(r)){if(Jm&&rg&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(a=>a(e,Pm(13,"Enter")))))return;let n=e.state.tr.setSelection(r);"pointer"==a?n.setMeta("pointer",!0):"key"==a&&n.scrollIntoView(),t&&n.setMeta("composition",t),e.dispatch(n)}return}let o=e.state.doc.resolve(a),s=o.sharedDepth(r);a=o.before(s+1),r=e.state.doc.resolve(r).after(s+1);let l,c,d=e.state.selection,u=function(e,a,r){let n,{node:i,fromOffset:t,toOffset:o,from:s,to:l}=e.docView.parseRange(a,r),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(n=[{node:d,offset:c.anchorOffset}],Fm(c)||n.push({node:c.focusNode,offset:c.focusOffset})),Jm&&8===e.input.lastKeyCode)for(let e=o;e>t;e--){let a=i.childNodes[e-1],r=a.pmViewDesc;if("BR"==a.nodeName&&!r){o=e;break}if(!r||r.size)break}let u=e.state.doc,h=e.someProp("domParser")||eh.fromSchema(e.state.schema),m=u.resolve(s),g=null,p=h.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:t,to:o,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:n,ruleFromNode:_b,context:m});if(n&&null!=n[0].pos){let e=n[0].pos,a=n[1]&&n[1].pos;null==a&&(a=e),g={anchor:e+s,head:a+s}}return{doc:p,sel:g,from:s,to:l}}(e,a,r),h=e.state.doc,m=h.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let g=function(e,a,r,n,i){let t=e.findDiffStart(a,r);if(null==t)return null;let{a:o,b:s}=e.findDiffEnd(a,r+e.size,r+a.size);if("end"==i){n-=o+Math.max(0,t-Math.min(o,s))-t}if(o<t&&e.size<a.size){let e=n<=t&&n>=o?t-n:0;t-=e,t&&t<a.size&&Ib(a.textBetween(t-1,t+1))&&(t+=e?1:-1),s=t+(s-o),o=t}else if(s<t){let a=n<=t&&n>=s?t-n:0;t-=a,t&&t<e.size&&Ib(e.textBetween(t-1,t+1))&&(t+=a?1:-1),o=t+(o-s),s=t}return{start:t,endA:o,endB:s}}(m.content,u.doc.content,u.from,l,c);if(g&&e.input.domChangeCount++,(Qm&&e.input.lastIOSEnter>Date.now()-225||rg)&&i.some((e=>1==e.nodeType&&!Ab.test(e.nodeName)))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",(a=>a(e,Pm(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!g){if(!(n&&d instanceof dm&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let a=Nb(e,e.state.doc,u.sel);if(a&&!a.eq(e.state.selection)){let r=e.state.tr.setSelection(a);t&&r.setMeta("composition",t),e.dispatch(r)}}return}g={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof dm&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),Um&&Gm<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>u.from&&" "==u.doc.textBetween(g.start-u.from-1,g.start-u.from+1)&&(g.start--,g.endA--,g.endB--);let p,b=u.doc.resolveNoCache(g.start-u.from),f=u.doc.resolveNoCache(g.endB-u.from),k=h.resolve(g.start),y=b.sameParent(f)&&b.parent.inlineContent&&k.end()>=g.endA;if((Qm&&e.input.lastIOSEnter>Date.now()-225&&(!y||i.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!y&&b.pos<u.doc.content.size&&!b.sameParent(f)&&(p=om.findFrom(u.doc.resolve(b.pos+1),1,!0))&&p.head==f.pos)&&e.someProp("handleKeyDown",(a=>a(e,Pm(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>g.start&&function(e,a,r,n,i){if(r-a<=i.pos-n.pos||Tb(n,!0,!1)<i.pos)return!1;let t=e.resolve(a);if(!n.parent.isTextblock){let e=t.nodeAfter;return null!=e&&r==a+e.nodeSize}if(t.parentOffset<t.parent.content.size||!t.parent.isTextblock)return!1;let o=e.resolve(Tb(t,!0,!0));return!(!o.parent.isTextblock||o.pos>r||Tb(o,!0,!1)<r)&&n.parent.content.cut(n.parentOffset).eq(o.parent.content)}(h,g.start,g.endA,b,f)&&e.someProp("handleKeyDown",(a=>a(e,Pm(8,"Backspace")))))return void(rg&&Jm&&e.domObserver.suppressSelectionUpdates());Jm&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),rg&&!y&&b.start()!=f.start()&&0==f.parentOffset&&b.depth==f.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==g.endA&&(g.endB-=2,f=u.doc.resolveNoCache(g.endB-u.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(a){return a(e,Pm(13,"Enter"))}))}),20));let v,w,z,j=g.start,x=g.endA;if(y)if(b.pos==f.pos)Um&&Gm<=11&&0==b.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Yg(e)),20)),v=e.state.tr.delete(j,x),w=h.resolve(g.start).marksAcross(h.resolve(g.endA));else if(g.endA==g.endB&&(z=function(e,a){let r,n,i,t=e.firstChild.marks,o=a.firstChild.marks,s=t,l=o;for(let e=0;e<o.length;e++)s=o[e].removeFromSet(s);for(let e=0;e<t.length;e++)l=t[e].removeFromSet(l);if(1==s.length&&0==l.length)n=s[0],r="add",i=e=>e.mark(n.addToSet(e.marks));else{if(0!=s.length||1!=l.length)return null;n=l[0],r="remove",i=e=>e.mark(n.removeFromSet(e.marks))}let c=[];for(let e=0;e<a.childCount;e++)c.push(i(a.child(e)));if(cu.from(c).eq(e))return{mark:n,type:r}}(b.parent.content.cut(b.parentOffset,f.parentOffset),k.parent.content.cut(k.parentOffset,g.endA-k.start()))))v=e.state.tr,"add"==z.type?v.addMark(j,x,z.mark):v.removeMark(j,x,z.mark);else if(b.parent.child(b.index()).isText&&b.index()==f.index()-(f.textOffset?0:1)){let a=b.parent.textBetween(b.parentOffset,f.parentOffset);if(e.someProp("handleTextInput",(r=>r(e,j,x,a))))return;v=e.state.tr.insertText(a,j,x)}if(v||(v=e.state.tr.replace(j,x,u.doc.slice(g.start-u.from,g.endB-u.from))),u.sel){let a=Nb(e,v.doc,u.sel);a&&!(Jm&&e.composing&&a.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(a.head==j||a.head==v.mapping.map(x)-1)||Um&&a.empty&&a.head==j)&&v.setSelection(a)}w&&v.ensureMarks(w),t&&v.setMeta("composition",t),e.dispatch(v.scrollIntoView())}function Nb(e,a,r){return Math.max(r.anchor,r.head)>a.content.size?null:ip(e,a.resolve(r.anchor),a.resolve(r.head))}function Tb(e,a,r){let n=e.depth,i=a?e.end():e.pos;for(;n>0&&(a||e.indexAfter(n)==e.node(n).childCount);)n--,i++,a=!1;if(r){let a=e.node(n).maybeChild(e.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function Ib(e){if(2!=e.length)return!1;let a=e.charCodeAt(0),r=e.charCodeAt(1);return a>=56320&&a<=57343&&r>=55296&&r<=56319}class Fb{constructor(e,a){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Np,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=a,this.state=a.state,this.directPlugins=a.plugins||[],this.directPlugins.forEach(Vb),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Lb(this),Rb(this),this.nodeViews=Bb(this),this.docView=Ag(this.state.doc,Pb(this),jb(this),this.dom,this),this.domObserver=new Cb(this,((e,a,r,n)=>Db(this,e,a,r,n))),this.domObserver.start(),function(e){for(let a in _p){let r=_p[a];e.dom.addEventListener(a,e.input.eventHandlers[a]=a=>{!Pp(e,a)||Fp(e,a)||!e.editable&&a.type in Ap||r(e,a)},Dp[a]?{passive:!0}:void 0)}Xm&&e.dom.addEventListener("input",(()=>null)),Ip(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let a in e)this._props[a]=e[a];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ip(this);let a=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Vb),this.directPlugins=e.plugins),this.updateStateInner(e.state,a)}setProps(e){let a={};for(let e in this._props)a[e]=this._props[e];a.state=this.state;for(let r in e)a[r]=e[r];this.update(a)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,a){var r;let n=this.state,i=!1,t=!1;e.storedMarks&&this.composing&&(Xp(this),t=!0),this.state=e;let o=n.plugins!=e.plugins||this._props.plugins!=a.plugins;if(o||this._props.plugins!=a.plugins||this._props.nodeViews!=a.nodeViews){let e=Bb(this);(function(e,a){let r=0,n=0;for(let n in e){if(e[n]!=a[n])return!0;r++}for(let e in a)n++;return r!=n})(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(o||a.handleDOMEvents!=this._props.handleDOMEvents)&&Ip(this),this.editable=Lb(this),Rb(this);let s=jb(this),l=Pb(this),c=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(n.selection)||(t=!0);let u="preserve"==c&&t&&null==this.dom.style.overflowAnchor&&function(e){let a,r,n=e.dom.getBoundingClientRect(),i=Math.max(0,n.top);for(let t=(n.left+n.right)/2,o=i+1;o<Math.min(innerHeight,n.bottom);o+=5){let n=e.root.elementFromPoint(t,o);if(!n||n==e.dom||!e.dom.contains(n))continue;let s=n.getBoundingClientRect();if(s.top>=i-20){a=n,r=s.top;break}}return{refDOM:a,refTop:r,stack:cg(e.dom)}}(this);if(t){this.domObserver.stop();let a=d&&(Um||Jm)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,a){let r=Math.min(e.$anchor.sharedDepth(e.head),a.$anchor.sharedDepth(a.head));return e.$anchor.start(r)!=a.$anchor.start(r)}(n.selection,e.selection);if(d){let r=Jm?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Qp(this)),!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Ag(e.doc,l,s,this.dom,this)),r&&!this.trackWrites&&(a=!0)}a||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let a=e.docView.domFromPos(e.state.selection.anchor,0),r=e.domSelectionRange();return Am(a.node,a.offset,r.anchorNode,r.anchorOffset)}(this))?Yg(this,a):(rp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),(null===(r=this.dragging)||void 0===r?void 0:r.node)&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:e,refTop:a,stack:r}){let n=e?e.getBoundingClientRect().top:0;dg(r,0==n?0:n-a)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof hm){let a=this.docView.domAfterPos(this.state.selection.from);1==a.nodeType&&lg(this,a.getBoundingClientRect(),e)}else lg(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let a=0;a<this.pluginViews.length;a++){let r=this.pluginViews[a];r.update&&r.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let a=this.directPlugins[e];a.spec.view&&this.pluginViews.push(a.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let a=this.state.plugins[e];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}}updateDraggedNode(e,a){let r=e.node,n=-1;if(this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{let e=r.from+(this.state.doc.content.size-a.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==r.node&&(n=e)}this.dragging=new ib(e.slice,e.move,n<0?void 0:hm.create(this.state.doc,n))}someProp(e,a){let r,n=this._props&&this._props[e];if(null!=n&&(r=a?a(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=a?a(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let t=i[n].props[e];if(null!=t&&(r=a?a(t):t))return r}}hasFocus(){if(Um){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(ug)return e.focus(ug);let a=cg(e);e.focus(null==ug?{get preventScroll(){return ug={preventScroll:!0},!0}}:void 0),ug||(ug=!1,dg(a,0))}(this.dom),Yg(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return pg(this,e)}coordsAtPos(e,a=1){return yg(this,e,a)}domAtPos(e,a=0){return this.docView.domFromPos(e,a)}nodeDOM(e){let a=this.docView.descAt(e);return a?a.nodeDOM:null}posAtDOM(e,a,r=-1){let n=this.docView.posFromDOM(e,a,r);if(null==n)throw new RangeError("DOM position not inside the editor");return n}endOfTextblock(e,a){return Cg(this,a||this.state,e)}pasteHTML(e,a){return rb(this,"",e,!1,a||new ClipboardEvent("paste"))}pasteText(e,a){return rb(this,e,null,!0,a||new ClipboardEvent("paste"))}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let a in e.input.eventHandlers)e.dom.removeEventListener(a,e.input.eventHandlers[a]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],jb(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Mm=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,a){Fp(e,a)||!_p[a.type]||!e.editable&&a.type in Ap||_p[a.type](e,a)}(this,e)}dispatch(e){let a=this._props.dispatchTransaction;a?a.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Xm&&11===this.root.nodeType&&function(e){let a=e.activeElement;for(;a&&a.shadowRoot;)a=a.shadowRoot.activeElement;return a}(this.dom.ownerDocument)==this.dom&&function(e,a){if(a.getComposedRanges){let r=a.getComposedRanges(e.root)[0];if(r)return Eb(e,r)}let r;function n(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0),r?Eb(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Pb(e){let a=Object.create(null);return a.class="ProseMirror",a.contenteditable=String(e.editable),e.someProp("attributes",(r=>{if("function"==typeof r&&(r=r(e.state)),r)for(let e in r)"class"==e?a.class+=" "+r[e]:"style"==e?a.style=(a.style?a.style+";":"")+r[e]:a[e]||"contenteditable"==e||"nodeName"==e||(a[e]=String(r[e]))})),a.translate||(a.translate="no"),[db.node(0,e.state.doc.content.size,a)]}function Rb(e){if(e.markCursor){let a=document.createElement("img");a.className="ProseMirror-separator",a.setAttribute("mark-placeholder","true"),a.setAttribute("alt",""),e.cursorWrapper={dom:a,deco:db.widget(e.state.selection.from,a,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Lb(e){return!e.someProp("editable",(a=>!1===a(e.state)))}function Bb(e){let a=Object.create(null);function r(e){for(let r in e)Object.prototype.hasOwnProperty.call(a,r)||(a[r]=e[r])}return e.someProp("nodeViews",r),e.someProp("markViews",r),a}function Vb(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Hb={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Wb={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ub="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Gb="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kb=0;Kb<10;Kb++)Hb[48+Kb]=Hb[96+Kb]=String(Kb);for(Kb=1;Kb<=24;Kb++)Hb[Kb+111]="F"+Kb;for(Kb=65;Kb<=90;Kb++)Hb[Kb]=String.fromCharCode(Kb+32),Wb[Kb]=String.fromCharCode(Kb);for(var Zb in Hb)Wb.hasOwnProperty(Zb)||(Wb[Zb]=Hb[Zb]);const Jb="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Yb(e){let a,r,n,i,t=e.split(/-(?!$)/),o=t[t.length-1];"Space"==o&&(o=" ");for(let e=0;e<t.length-1;e++){let o=t[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))a=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))n=!0;else{if(!/^mod$/i.test(o))throw new Error("Unrecognized modifier name: "+o);Jb?i=!0:r=!0}}return a&&(o="Alt-"+o),r&&(o="Ctrl-"+o),i&&(o="Meta-"+o),n&&(o="Shift-"+o),o}function Xb(e,a,r=!0){return a.altKey&&(e="Alt-"+e),a.ctrlKey&&(e="Ctrl-"+e),a.metaKey&&(e="Meta-"+e),r&&a.shiftKey&&(e="Shift-"+e),e}function Qb(e){let a=function(e){let a=Object.create(null);for(let r in e)a[Yb(r)]=e[r];return a}(e);return function(e,r){let n,i=function(e){var a=!(Ub&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Gb&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Wb:Hb)[e.keyCode]||e.key||"Unidentified";return"Esc"==a&&(a="Escape"),"Del"==a&&(a="Delete"),"Left"==a&&(a="ArrowLeft"),"Up"==a&&(a="ArrowUp"),"Right"==a&&(a="ArrowRight"),"Down"==a&&(a="ArrowDown"),a}(r),t=a[Xb(i,r)];if(t&&t(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(r.shiftKey){let n=a[Xb(i,r,!1)];if(n&&n(e.state,e.dispatch,e))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(n=Hb[r.keyCode])&&n!=i){let i=a[Xb(n,r)];if(i&&i(e.state,e.dispatch,e))return!0}}return!1}}function ef(e,a){let{$cursor:r}=e.selection;return!r||(a?!a.endOfTextblock("backward",e):r.parentOffset>0)?null:r}function af(e,a,r){let n=a.nodeBefore,i=a.pos-1;for(;!n.isTextblock;i--){if(n.type.spec.isolating)return!1;let e=n.lastChild;if(!e)return!1;n=e}let t=a.nodeAfter,o=a.pos+1;for(;!t.isTextblock;o++){if(t.type.spec.isolating)return!1;let e=t.firstChild;if(!e)return!1;t=e}let s=Wh(e.doc,i,o,pu.empty);if(!s||s.from!=i||s instanceof Eh&&s.slice.size>=o-i)return!1;if(r){let a=e.tr.step(s);a.setSelection(dm.create(a.doc,i)),r(a.scrollIntoView())}return!0}function rf(e,a,r=!1){for(let n=e;n;n="start"==a?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&1!=n.childCount)return!1}return!1}function nf(e){if(!e.parent.type.spec.isolating)for(let a=e.depth-1;a>=0;a--){if(e.index(a)>0)return e.doc.resolve(e.before(a+1));if(e.node(a).type.spec.isolating)break}return null}function tf(e,a){let{$cursor:r}=e.selection;return!r||(a?!a.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)?null:r}function of(e){if(!e.parent.type.spec.isolating)for(let a=e.depth-1;a>=0;a--){let r=e.node(a);if(e.index(a)+1<r.childCount)return e.doc.resolve(e.after(a+1));if(r.type.spec.isolating)break}return null}function sf(e){for(let a=0;a<e.edgeCount;a++){let{type:r}=e.edge(a);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function lf(e,a,r,n){let i,t,o=a.nodeBefore,s=a.nodeAfter,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&function(e,a,r){let n=a.nodeBefore,i=a.nodeAfter,t=a.index();return!(!(n&&i&&n.type.compatibleContent(i.type))||(!n.content.size&&a.parent.canReplace(t-1,t)?(r&&r(e.tr.delete(a.pos-n.nodeSize,a.pos).scrollIntoView()),0):!a.parent.canReplace(t,t+1)||!i.isTextblock&&!Lh(e.doc,a.pos)||(r&&r(e.tr.join(a.pos).scrollIntoView()),0)))}(e,a,r))return!0;let c=!l&&a.parent.canReplace(a.index(),a.index()+1);if(c&&(i=(t=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&t.matchType(i[0]||s.type).validEnd){if(r){let n=a.pos+s.nodeSize,t=cu.empty;for(let e=i.length-1;e>=0;e--)t=cu.from(i[e].create(null,t));t=cu.from(o.copy(t));let l=e.tr.step(new Mh(a.pos-1,n,a.pos,n,new pu(t,1,0),i.length,!0)),c=l.doc.resolve(n+2*i.length);c.nodeAfter&&c.nodeAfter.type==o.type&&Lh(l.doc,c.pos)&&l.join(c.pos),r(l.scrollIntoView())}return!0}let d=s.type.spec.isolating||n>0&&l?null:om.findFrom(a,1),u=d&&d.$from.blockRange(d.$to),h=u&&Nh(u);if(null!=h&&h>=a.depth)return r&&r(e.tr.lift(u,h).scrollIntoView()),!0;if(c&&rf(s,"start",!0)&&rf(o,"end")){let n=o,i=[];for(;i.push(n),!n.isTextblock;)n=n.lastChild;let t=s,l=1;for(;!t.isTextblock;t=t.firstChild)l++;if(n.canReplace(n.childCount,n.childCount,t.content)){if(r){let n=cu.empty;for(let e=i.length-1;e>=0;e--)n=cu.from(i[e].copy(n));r(e.tr.step(new Mh(a.pos-i.length,a.pos+s.nodeSize,a.pos+l,a.pos+s.nodeSize-l,new pu(n,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function cf(e){return function(a,r){let n=a.selection,i=e<0?n.$from:n.$to,t=i.depth;for(;i.node(t).isInline;){if(!t)return!1;t--}return!!i.node(t).isTextblock&&(r&&r(a.tr.setSelection(dm.create(a.doc,e<0?i.start(t):i.end(t)))),!0)}}const df=cf(-1),uf=cf(1);function hf(e,a=null){return function(r,n){let i=!1;for(let n=0;n<r.selection.ranges.length&&!i;n++){let{$from:{pos:t},$to:{pos:o}}=r.selection.ranges[n];r.doc.nodesBetween(t,o,((n,t)=>{if(i)return!1;if(n.isTextblock&&!n.hasMarkup(e,a))if(n.type==e)i=!0;else{let a=r.doc.resolve(t),n=a.index();i=a.parent.canReplaceWith(n,n+1,e)}}))}if(!i)return!1;if(n){let i=r.tr;for(let n=0;n<r.selection.ranges.length;n++){let{$from:{pos:t},$to:{pos:o}}=r.selection.ranges[n];i.setBlockType(t,o,e,a)}n(i.scrollIntoView())}return!0}}function mf(e,a=null){return function(r,n){let{$from:i,$to:t}=r.selection,o=i.blockRange(t);if(!o)return!1;let s=n?r.tr:null;return!!function(e,a,r,n=null){let i=!1,t=a,o=a.$from.doc;if(a.depth>=2&&a.$from.node(a.depth-1).type.compatibleContent(r)&&0==a.startIndex){if(0==a.$from.index(a.depth-1))return!1;let e=o.resolve(a.start-2);t=new Mu(e,e,a.depth),a.endIndex<a.parent.childCount&&(a=new Mu(a.$from,o.resolve(a.$to.end(a.depth)),a.depth)),i=!0}let s=Th(t,r,n,a);if(!s)return!1;e&&function(e,a,r,n,i){let t=cu.empty;for(let e=r.length-1;e>=0;e--)t=cu.from(r[e].type.create(r[e].attrs,t));e.step(new Mh(a.start-(n?2:0),a.end,a.start,a.end,new pu(t,0,0),r.length,!0));let o=0;for(let e=0;e<r.length;e++)r[e].type==i&&(o=e+1);let s=r.length-o,l=a.start+r.length-(n?2:0),c=a.parent;for(let r=a.startIndex,n=a.endIndex,i=!0;r<n;r++,i=!1)!i&&Rh(e.doc,l,s)&&(e.split(l,s),l+=2*s),l+=c.child(r).nodeSize}(e,a,s,i,r);return!0}(s,o,e,a)&&(n&&n(s.scrollIntoView()),!0)}}function gf(e){return function(a,r){let{$from:n,$to:i}=a.selection,t=n.blockRange(i,(a=>a.childCount>0&&a.firstChild.type==e));return!!t&&(!r||(n.node(t.depth-1).type==e?function(e,a,r,n){let i=e.tr,t=n.end,o=n.$to.end(n.depth);t<o&&(i.step(new Mh(t-1,o,t,o,new pu(cu.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new Mu(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const s=Nh(n);if(null==s)return!1;i.lift(n,s);let l=i.mapping.map(t,-1)-1;Lh(i.doc,l)&&i.join(l);return a(i.scrollIntoView()),!0}(a,r,e,t):function(e,a,r){let n=e.tr,i=r.parent;for(let e=r.end,a=r.endIndex-1,t=r.startIndex;a>t;a--)e-=i.child(a).nodeSize,n.delete(e-1,e+1);let t=n.doc.resolve(r.start),o=t.nodeAfter;if(n.mapping.map(r.end)!=r.start+t.nodeAfter.nodeSize)return!1;let s=0==r.startIndex,l=r.endIndex==i.childCount,c=t.node(-1),d=t.index(-1);if(!c.canReplace(d+(s?0:1),d+1,o.content.append(l?cu.empty:cu.from(i))))return!1;let u=t.pos,h=u+o.nodeSize;return n.step(new Mh(u-(s?1:0),h+(l?1:0),u+1,h-1,new pu((s?cu.empty:cu.from(i.copy(cu.empty))).append(l?cu.empty:cu.from(i.copy(cu.empty))),s?0:1,l?0:1),s?0:1)),a(n.scrollIntoView()),!0}(a,r,t)))}}function pf(e){const{state:a,transaction:r}=e;let{selection:n}=r,{doc:i}=r,{storedMarks:t}=r;return{...a,apply:a.apply.bind(a),applyTransaction:a.applyTransaction.bind(a),plugins:a.plugins,schema:a.schema,reconfigure:a.reconfigure.bind(a),toJSON:a.toJSON.bind(a),get storedMarks(){return t},get selection(){return n},get doc(){return i},get tr(){return n=r.selection,i=r.doc,t=r.storedMarks,r}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class bf{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:a,state:r}=this,{view:n}=a,{tr:i}=r,t=this.buildProps(i);return Object.fromEntries(Object.entries(e).map((([e,a])=>[e,(...e)=>{const r=a(...e)(t);return i.getMeta("preventDispatch")||this.hasCustomState||n.dispatch(i),r}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,a=!0){const{rawCommands:r,editor:n,state:i}=this,{view:t}=n,o=[],s=!!e,l=e||i.tr,c={...Object.fromEntries(Object.entries(r).map((([e,r])=>[e,(...e)=>{const n=this.buildProps(l,a),i=r(...e)(n);return o.push(i),c}]))),run:()=>(s||!a||l.getMeta("preventDispatch")||this.hasCustomState||t.dispatch(l),o.every((e=>!0===e)))};return c}createCan(e){const{rawCommands:a,state:r}=this,n=!1,i=e||r.tr,t=this.buildProps(i,n),o=Object.fromEntries(Object.entries(a).map((([e,a])=>[e,(...e)=>a(...e)({...t,dispatch:void 0})])));return{...o,chain:()=>this.createChain(i,n)}}buildProps(e,a=!0){const{rawCommands:r,editor:n,state:i}=this,{view:t}=n,o={tr:e,editor:n,view:t,state:pf({state:i,transaction:e}),dispatch:a?()=>{}:void 0,chain:()=>this.createChain(e,a),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map((([e,a])=>[e,(...e)=>a(...e)(o)])))}};return o}}class ff{constructor(){this.callbacks={}}on(e,a){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(a),this}emit(e,...a){const r=this.callbacks[e];return r&&r.forEach((e=>e.apply(this,a))),this}off(e,a){const r=this.callbacks[e];return r&&(a?this.callbacks[e]=r.filter((e=>e!==a)):delete this.callbacks[e]),this}once(e,a){const r=(...n)=>{this.off(e,r),a.apply(this,n)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function kf(e,a,r){if(void 0===e.config[a]&&e.parent)return kf(e.parent,a,r);if("function"==typeof e.config[a]){return e.config[a].bind({...r,parent:e.parent?kf(e.parent,a,r):null})}return e.config[a]}function yf(e){return{baseExtensions:e.filter((e=>"extension"===e.type)),nodeExtensions:e.filter((e=>"node"===e.type)),markExtensions:e.filter((e=>"mark"===e.type))}}function vf(e){const a=[],{nodeExtensions:r,markExtensions:n}=yf(e),i=[...r,...n],t={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach((e=>{const r=kf(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:i});if(!r)return;r().forEach((e=>{e.types.forEach((r=>{Object.entries(e.attributes).forEach((([e,n])=>{a.push({type:r,name:e,attribute:{...t,...n}})}))}))}))})),i.forEach((e=>{const r={name:e.name,options:e.options,storage:e.storage},n=kf(e,"addAttributes",r);if(!n)return;const i=n();Object.entries(i).forEach((([r,n])=>{const i={...t,...n};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&void 0===(null==i?void 0:i.default)&&delete i.default,a.push({type:e.name,name:r,attribute:i})}))})),a}function wf(e,a){if("string"==typeof e){if(!a.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return a.nodes[e]}return e}function zf(...e){return e.filter((e=>!!e)).reduce(((e,a)=>{const r={...e};return Object.entries(a).forEach((([e,a])=>{if(r[e])if("class"===e){const n=a?String(a).split(" "):[],i=r[e]?r[e].split(" "):[],t=n.filter((e=>!i.includes(e)));r[e]=[...i,...t].join(" ")}else if("style"===e){const n=a?a.split(";").map((e=>e.trim())).filter(Boolean):[],i=r[e]?r[e].split(";").map((e=>e.trim())).filter(Boolean):[],t=new Map;i.forEach((e=>{const[a,r]=e.split(":").map((e=>e.trim()));t.set(a,r)})),n.forEach((e=>{const[a,r]=e.split(":").map((e=>e.trim()));t.set(a,r)})),r[e]=Array.from(t.entries()).map((([e,a])=>`${e}: ${a}`)).join("; ")}else r[e]=a;else r[e]=a})),r}),{})}function jf(e,a){return a.filter((a=>a.type===e.type.name)).filter((e=>e.attribute.rendered)).map((a=>a.attribute.renderHTML?a.attribute.renderHTML(e.attrs)||{}:{[a.name]:e.attrs[a.name]})).reduce(((e,a)=>zf(e,a)),{})}function xf(e){return"function"==typeof e}function $f(e,a=void 0,...r){return xf(e)?a?e.bind(a)(...r):e(...r):e}function qf(e,a){return"style"in e?e:{...e,getAttrs:r=>{const n=e.getAttrs?e.getAttrs(r):e.attrs;if(!1===n)return!1;const i=a.reduce(((e,a)=>{const n=a.attribute.parseHTML?a.attribute.parseHTML(r):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(r.getAttribute(a.name));return null==n?e:{...e,[a.name]:n}}),{});return{...n,...i}}}}function Cf(e){return Object.fromEntries(Object.entries(e).filter((([e,a])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(a))&&null!=a)))}function Sf(e,a){return a.nodes[e]||a.marks[e]||null}function Of(e,a){return Array.isArray(a)?a.some((a=>("string"==typeof a?a:a.name)===e.name)):a}function Ef(e,a){const r=dh.fromSchema(a).serializeFragment(e),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(r),n.innerHTML}function Mf(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class _f{constructor(e){this.find=e.find,this.handler=e.handler}}function Af(e){var a;const{editor:r,from:n,to:i,text:t,rules:o,plugin:s}=e,{view:l}=r;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||(null===(a=c.nodeBefore||c.nodeAfter)||void 0===a?void 0:a.marks.find((e=>e.type.spec.code))))return!1;let d=!1;const u=((e,a=500)=>{let r="";const n=e.parentOffset;return e.parent.nodesBetween(Math.max(0,n-a),n,((e,a,i,t)=>{var o,s;const l=(null===(s=(o=e.type.spec).toText)||void 0===s?void 0:s.call(o,{node:e,pos:a,parent:i,index:t}))||e.textContent||"%leaf%";r+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,n-a))})),r})(c)+t;return o.forEach((e=>{if(d)return;const a=((e,a)=>{if(Mf(a))return a.exec(e);const r=a(e);if(!r)return null;const n=[r.text];return n.index=r.index,n.input=e,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n})(u,e.find);if(!a)return;const o=l.state.tr,c=pf({state:l.state,transaction:o}),h={from:n-(a[0].length-t.length),to:i},{commands:m,chain:g,can:p}=new bf({editor:r,state:c});null!==e.handler({state:c,range:h,match:a,commands:m,chain:g,can:p})&&o.steps.length&&(o.setMeta(s,{transform:o,from:n,to:i,text:t}),l.dispatch(o),d=!0)})),d}function Df(e){const{editor:a,rules:r}=e,n=new $m({state:{init:()=>null,apply(e,i,t){const o=e.getMeta(n);if(o)return o;const s=e.getMeta("applyInputRules");return!!s&&setTimeout((()=>{let{text:e}=s;"string"==typeof e||(e=Ef(cu.from(e),t.schema));const{from:i}=s,o=i+e.length;Af({editor:a,from:i,to:o,text:e,rules:r,plugin:n})})),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,t,o)=>Af({editor:a,from:i,to:t,text:o,rules:r,plugin:n}),handleDOMEvents:{compositionend:e=>(setTimeout((()=>{const{$cursor:i}=e.state.selection;i&&Af({editor:a,from:i.pos,to:i.pos,text:"",rules:r,plugin:n})})),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;const{$cursor:t}=e.state.selection;return!!t&&Af({editor:a,from:t.pos,to:t.pos,text:"\n",rules:r,plugin:n})}},isInputRules:!0});return n}function Nf(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function Tf(e,a){const r={...e};return Nf(e)&&Nf(a)&&Object.keys(a).forEach((n=>{Nf(a[n])&&Nf(e[n])?r[n]=Tf(e[n],a[n]):r[n]=a[n]})),r}class If{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=$f(kf(this,"addOptions",{name:this.name}))),this.storage=$f(kf(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new If(e)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>Tf(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(e={}){const a=new If(e);return a.parent=this,this.child=a,a.name=e.name?e.name:a.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${a.name}".`),a.options=$f(kf(a,"addOptions",{name:a.name})),a.storage=$f(kf(a,"addStorage",{name:a.name,options:a.options})),a}static handleExit({editor:e,mark:a}){const{tr:r}=e.state,n=e.state.selection.$from;if(n.pos===n.end()){const i=n.marks();if(!!!i.find((e=>(null==e?void 0:e.type.name)===a.name)))return!1;const t=i.find((e=>(null==e?void 0:e.type.name)===a.name));return t&&r.removeStoredMark(t),r.insertText(" ",n.pos),e.view.dispatch(r),!0}return!1}}class Ff{constructor(e){this.find=e.find,this.handler=e.handler}}function Pf(e){const{editor:a,state:r,from:n,to:i,rule:t,pasteEvent:o,dropEvent:s}=e,{commands:l,chain:c,can:d}=new bf({editor:a,state:r}),u=[];r.doc.nodesBetween(n,i,((e,a)=>{if(!e.isTextblock||e.type.spec.code)return;const h=Math.max(n,a),m=Math.min(i,a+e.content.size),g=((e,a,r)=>{if(Mf(a))return[...e.matchAll(a)];const n=a(e,r);return n?n.map((a=>{const r=[a.text];return r.index=a.index,r.input=e,r.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),r.push(a.replaceWith)),r})):[]})(e.textBetween(h-a,m-a,void 0,""),t.find,o);g.forEach((e=>{if(void 0===e.index)return;const a=h+e.index+1,n=a+e[0].length,i={from:r.tr.mapping.map(a),to:r.tr.mapping.map(n)},m=t.handler({state:r,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:s});u.push(m)}))}));const h=u.every((e=>null!==e));return h}let Rf=null;function Lf(e){const{editor:a,rules:r}=e;let n,i=null,t=!1,o=!1,s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}const l=({state:e,from:r,to:i,rule:t,pasteEvt:o})=>{const l=e.tr,c=pf({state:e,transaction:l});if(Pf({editor:a,state:c,from:Math.max(r-1,0),to:i.b-1,rule:t,pasteEvent:o,dropEvent:n})&&l.steps.length){try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}return s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}},c=r.map((e=>new $m({view(e){const r=r=>{var n;i=(null===(n=e.dom.parentElement)||void 0===n?void 0:n.contains(r.target))?e.dom.parentElement:null,i&&(Rf=a)},n=()=>{Rf&&(Rf=null)};return window.addEventListener("dragstart",r),window.addEventListener("dragend",n),{destroy(){window.removeEventListener("dragstart",r),window.removeEventListener("dragend",n)}}},props:{handleDOMEvents:{drop:(e,a)=>{if(o=i===e.dom.parentElement,n=a,!o){const e=Rf;e&&setTimeout((()=>{const a=e.state.selection;a&&e.commands.deleteRange({from:a.from,to:a.to})}),10)}return!1},paste:(e,a)=>{var r;const n=null===(r=a.clipboardData)||void 0===r?void 0:r.getData("text/html");return s=a,t=!!(null==n?void 0:n.includes("data-pm-slice")),!1}}},appendTransaction:(a,r,n)=>{const i=a[0],c="paste"===i.getMeta("uiEvent")&&!t,d="drop"===i.getMeta("uiEvent")&&!o,u=i.getMeta("applyPasteRules"),h=!!u;if(!c&&!d&&!h)return;if(h){let{text:a}=u;"string"==typeof a||(a=Ef(cu.from(a),n.schema));const{from:r}=u,i=r+a.length,t=(e=>{var a;const r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(a=r.clipboardData)||void 0===a||a.setData("text/html",e),r})(a);return l({rule:e,state:n,from:r,to:{b:i},pasteEvt:t})}const m=r.doc.content.findDiffStart(n.doc.content),g=r.doc.content.findDiffEnd(n.doc.content);return"number"==typeof m&&g&&m!==g.b?l({rule:e,state:n,from:m,to:g,pasteEvt:s}):void 0}})));return c}class Bf{constructor(e,a){this.splittableMarks=[],this.editor=a,this.extensions=Bf.resolve(e),this.schema=function(e,a){var r;const n=vf(e),{nodeExtensions:i,markExtensions:t}=yf(e),o=null===(r=i.find((e=>kf(e,"topNode"))))||void 0===r?void 0:r.name,s=Object.fromEntries(i.map((r=>{const i=n.filter((e=>e.type===r.name)),t={name:r.name,options:r.options,storage:r.storage,editor:a},o=Cf({...e.reduce(((e,a)=>{const n=kf(a,"extendNodeSchema",t);return{...e,...n?n(r):{}}}),{}),content:$f(kf(r,"content",t)),marks:$f(kf(r,"marks",t)),group:$f(kf(r,"group",t)),inline:$f(kf(r,"inline",t)),atom:$f(kf(r,"atom",t)),selectable:$f(kf(r,"selectable",t)),draggable:$f(kf(r,"draggable",t)),code:$f(kf(r,"code",t)),whitespace:$f(kf(r,"whitespace",t)),linebreakReplacement:$f(kf(r,"linebreakReplacement",t)),defining:$f(kf(r,"defining",t)),isolating:$f(kf(r,"isolating",t)),attrs:Object.fromEntries(i.map((e=>{var a;return[e.name,{default:null===(a=null==e?void 0:e.attribute)||void 0===a?void 0:a.default}]})))}),s=$f(kf(r,"parseHTML",t));s&&(o.parseDOM=s.map((e=>qf(e,i))));const l=kf(r,"renderHTML",t);l&&(o.toDOM=e=>l({node:e,HTMLAttributes:jf(e,i)}));const c=kf(r,"renderText",t);return c&&(o.toText=c),[r.name,o]}))),l=Object.fromEntries(t.map((r=>{const i=n.filter((e=>e.type===r.name)),t={name:r.name,options:r.options,storage:r.storage,editor:a},o=Cf({...e.reduce(((e,a)=>{const n=kf(a,"extendMarkSchema",t);return{...e,...n?n(r):{}}}),{}),inclusive:$f(kf(r,"inclusive",t)),excludes:$f(kf(r,"excludes",t)),group:$f(kf(r,"group",t)),spanning:$f(kf(r,"spanning",t)),code:$f(kf(r,"code",t)),attrs:Object.fromEntries(i.map((e=>{var a;return[e.name,{default:null===(a=null==e?void 0:e.attribute)||void 0===a?void 0:a.default}]})))}),s=$f(kf(r,"parseHTML",t));s&&(o.parseDOM=s.map((e=>qf(e,i))));const l=kf(r,"renderHTML",t);return l&&(o.toDOM=e=>l({mark:e,HTMLAttributes:jf(e,i)})),[r.name,o]})));return new Xu({topNode:o,nodes:s,marks:l})}(this.extensions,a),this.setupExtensions()}static resolve(e){const a=Bf.sort(Bf.flatten(e)),r=function(e){const a=e.filter(((a,r)=>e.indexOf(a)!==r));return Array.from(new Set(a))}(a.map((e=>e.name)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((e=>`'${e}'`)).join(", ")}]. This can lead to issues.`),a}static flatten(e){return e.map((e=>{const a=kf(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return a?[e,...this.flatten(a())]:e})).flat(10)}static sort(e){return e.sort(((e,a)=>{const r=kf(e,"priority")||100,n=kf(a,"priority")||100;return r>n?-1:r<n?1:0}))}get commands(){return this.extensions.reduce(((e,a)=>{const r=kf(a,"addCommands",{name:a.name,options:a.options,storage:a.storage,editor:this.editor,type:Sf(a.name,this.schema)});return r?{...e,...r()}:e}),{})}get plugins(){const{editor:e}=this,a=Bf.sort([...this.extensions].reverse()),r=[],n=[],i=a.map((a=>{const i={name:a.name,options:a.options,storage:a.storage,editor:e,type:Sf(a.name,this.schema)},t=[],o=kf(a,"addKeyboardShortcuts",i);let s={};if("mark"===a.type&&kf(a,"exitable",i)&&(s.ArrowRight=()=>If.handleExit({editor:e,mark:a})),o){const a=Object.fromEntries(Object.entries(o()).map((([a,r])=>[a,()=>r({editor:e})])));s={...s,...a}}const l=new $m({props:{handleKeyDown:Qb(s)}});t.push(l);const c=kf(a,"addInputRules",i);Of(a,e.options.enableInputRules)&&c&&r.push(...c());const d=kf(a,"addPasteRules",i);Of(a,e.options.enablePasteRules)&&d&&n.push(...d());const u=kf(a,"addProseMirrorPlugins",i);if(u){const e=u();t.push(...e)}return t})).flat();return[Df({editor:e,rules:r}),...Lf({editor:e,rules:n}),...i]}get attributes(){return vf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:a}=yf(this.extensions);return Object.fromEntries(a.filter((e=>!!kf(e,"addNodeView"))).map((a=>{const r=this.attributes.filter((e=>e.type===a.name)),n={name:a.name,options:a.options,storage:a.storage,editor:e,type:wf(a.name,this.schema)},i=kf(a,"addNodeView",n);if(!i)return[];return[a.name,(n,t,o,s,l)=>{const c=jf(n,r);return i()({node:n,view:t,getPos:o,decorations:s,innerDecorations:l,editor:e,extension:a,HTMLAttributes:c})}]})))}setupExtensions(){this.extensions.forEach((e=>{var a;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Sf(e.name,this.schema)};if("mark"===e.type){(null===(a=$f(kf(e,"keepOnSplit",r)))||void 0===a||a)&&this.splittableMarks.push(e.name)}const n=kf(e,"onBeforeCreate",r),i=kf(e,"onCreate",r),t=kf(e,"onUpdate",r),o=kf(e,"onSelectionUpdate",r),s=kf(e,"onTransaction",r),l=kf(e,"onFocus",r),c=kf(e,"onBlur",r),d=kf(e,"onDestroy",r);n&&this.editor.on("beforeCreate",n),i&&this.editor.on("create",i),t&&this.editor.on("update",t),o&&this.editor.on("selectionUpdate",o),s&&this.editor.on("transaction",s),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}}class Vf{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=$f(kf(this,"addOptions",{name:this.name}))),this.storage=$f(kf(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Vf(e)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>Tf(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(e={}){const a=new Vf({...this.config,...e});return a.parent=this,this.child=a,a.name=e.name?e.name:a.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${a.name}".`),a.options=$f(kf(a,"addOptions",{name:a.name})),a.storage=$f(kf(a,"addStorage",{name:a.name,options:a.options})),a}}function Hf(e,a,r){const{from:n,to:i}=a,{blockSeparator:t="\n\n",textSerializers:o={}}=r||{};let s="";return e.nodesBetween(n,i,((e,r,l,c)=>{var d;e.isBlock&&r>n&&(s+=t);const u=null==o?void 0:o[e.type.name];if(u)return l&&(s+=u({node:e,pos:r,parent:l,index:c,range:a})),!1;e.isText&&(s+=null===(d=null==e?void 0:e.text)||void 0===d?void 0:d.slice(Math.max(n,r)-r,i-r))})),s}function Wf(e){return Object.fromEntries(Object.entries(e.nodes).filter((([,e])=>e.spec.toText)).map((([e,a])=>[e,a.spec.toText])))}const Uf=Vf.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new $m({key:new Sm("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:a,schema:r}=e,{doc:n,selection:i}=a,{ranges:t}=i,o=Math.min(...t.map((e=>e.$from.pos))),s=Math.max(...t.map((e=>e.$to.pos))),l=Wf(r);return Hf(n,{from:o,to:s},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});function Gf(e,a,r={strict:!0}){const n=Object.keys(a);return!n.length||n.every((n=>r.strict?a[n]===e[n]:Mf(a[n])?a[n].test(e[n]):a[n]===e[n]))}function Kf(e,a,r={}){return e.find((e=>e.type===a&&Gf(Object.fromEntries(Object.keys(r).map((a=>[a,e.attrs[a]]))),r)))}function Zf(e,a,r={}){return!!Kf(e,a,r)}function Jf(e,a,r){var n;if(!e||!a)return;let i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some((e=>e.type===a))||(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some((e=>e.type===a)))return;r=r||(null===(n=i.node.marks[0])||void 0===n?void 0:n.attrs);if(!Kf([...i.node.marks],a,r))return;let t=i.index,o=e.start()+i.offset,s=t+1,l=o+i.node.nodeSize;for(;t>0&&Zf([...e.parent.child(t-1).marks],a,r);)t-=1,o-=e.parent.child(t).nodeSize;for(;s<e.parent.childCount&&Zf([...e.parent.child(s).marks],a,r);)l+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:l}}function Yf(e,a){if("string"==typeof e){if(!a.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return a.marks[e]}return e}function Xf(e){return e instanceof dm}function Qf(e=0,a=0,r=0){return Math.min(Math.max(e,a),r)}function ek(e,a=null){if(!a)return null;const r=om.atStart(e),n=om.atEnd(e);if("start"===a||!0===a)return r;if("end"===a)return n;const i=r.from,t=n.to;return"all"===a?dm.create(e,Qf(0,i,t),Qf(e.content.size,i,t)):dm.create(e,Qf(a,i,t),Qf(a,i,t))}const ak=e=>{const a=e.childNodes;for(let r=a.length-1;r>=0;r-=1){const n=a[r];3===n.nodeType&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):1===n.nodeType&&ak(n)}return e};function rk(e){const a=`<body>${e}</body>`,r=(new window.DOMParser).parseFromString(a,"text/html").body;return ak(r)}function nk(e,a,r){if(e instanceof Au||e instanceof cu)return e;r={slice:!0,parseOptions:{},...r};const n="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return cu.fromArray(e.map((e=>a.nodeFromJSON(e))));const n=a.nodeFromJSON(e);return r.errorOnInvalidContent&&n.check(),n}catch(n){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:n});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",n),nk("",a,r)}if(n){if(r.errorOnInvalidContent){let n=!1,i="";const t=new Xu({topNode:a.spec.topNode,marks:a.spec.marks,nodes:a.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(n=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(r.slice?eh.fromSchema(t).parseSlice(rk(e),r.parseOptions):eh.fromSchema(t).parse(rk(e),r.parseOptions),r.errorOnInvalidContent&&n)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const n=eh.fromSchema(a);return r.slice?n.parseSlice(rk(e),r.parseOptions).content:n.parse(rk(e),r.parseOptions)}return nk("",a,r)}function ik(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function tk(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function ok(e,a,r={}){const{from:n,to:i,empty:t}=e.selection,o=a?wf(a,e.schema):null,s=[];e.doc.nodesBetween(n,i,((e,a)=>{if(e.isText)return;const r=Math.max(n,a),t=Math.min(i,a+e.nodeSize);s.push({node:e,from:r,to:t})}));const l=i-n,c=s.filter((e=>!o||o.name===e.node.type.name)).filter((e=>Gf(e.node.attrs,r,{strict:!1})));if(t)return!!c.length;return c.reduce(((e,a)=>e+a.to-a.from),0)>=l}function sk(e,a){return a.nodes[e]?"node":a.marks[e]?"mark":null}function lk(e,a){const r="string"==typeof a?[a]:a;return Object.keys(e).reduce(((a,n)=>(r.includes(n)||(a[n]=e[n]),a)),{})}function ck(e,a,r={},n={}){return nk(e,a,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}function dk(e,a){const r=Yf(a,e.schema),{from:n,to:i,empty:t}=e.selection,o=[];t?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,i,(e=>{o.push(...e.marks)}));const s=o.find((e=>e.type.name===r.name));return s?{...s.attrs}:{}}function uk(e){return a=>function(e,a){for(let r=e.depth;r>0;r-=1){const n=e.node(r);if(a(n))return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}(a.$from,e)}function hk(e,a){const r=sk("string"==typeof a?a:a.name,e.schema);return"node"===r?function(e,a){const r=wf(a,e.schema),{from:n,to:i}=e.selection,t=[];e.doc.nodesBetween(n,i,(e=>{t.push(e)}));const o=t.reverse().find((e=>e.type.name===r.name));return o?{...o.attrs}:{}}(e,a):"mark"===r?dk(e,a):{}}function mk(e,a,r){const n=[];return e===a?r.resolve(e).marks().forEach((a=>{const i=Jf(r.resolve(e),a.type);i&&n.push({mark:a,...i})})):r.nodesBetween(e,a,((e,a)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&n.push(...e.marks.map((r=>({from:a,to:a+e.nodeSize,mark:r}))))})),n}function gk(e,a,r){return Object.fromEntries(Object.entries(r).filter((([r])=>{const n=e.find((e=>e.type===a&&e.name===r));return!!n&&n.attribute.keepOnSplit})))}function pk(e,a,r={}){const{empty:n,ranges:i}=e.selection,t=a?Yf(a,e.schema):null;if(n)return!!(e.storedMarks||e.selection.$from.marks()).filter((e=>!t||t.name===e.type.name)).find((e=>Gf(e.attrs,r,{strict:!1})));let o=0;const s=[];if(i.forEach((({$from:a,$to:r})=>{const n=a.pos,i=r.pos;e.doc.nodesBetween(n,i,((e,a)=>{if(!e.isText&&!e.marks.length)return;const r=Math.max(n,a),t=Math.min(i,a+e.nodeSize);o+=t-r,s.push(...e.marks.map((e=>({mark:e,from:r,to:t}))))}))})),0===o)return!1;const l=s.filter((e=>!t||t.name===e.mark.type.name)).filter((e=>Gf(e.mark.attrs,r,{strict:!1}))).reduce(((e,a)=>e+a.to-a.from),0),c=s.filter((e=>!t||e.mark.type!==t&&e.mark.type.excludes(t))).reduce(((e,a)=>e+a.to-a.from),0);return(l>0?l+c:l)>=o}function bk(e,a){const{nodeExtensions:r}=yf(a),n=r.find((a=>a.name===e));if(!n)return!1;const i=$f(kf(n,"group",{name:n.name,options:n.options,storage:n.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function fk(e,{checkChildren:a=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!==(n=e.text)&&void 0!==n?n:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(a){let n=!0;return e.content.forEach((e=>{!1!==n&&(fk(e,{ignoreWhitespace:r,checkChildren:a})||(n=!1))})),n}return!1}function kk(e,a){const r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){const n=r.filter((e=>null==a?void 0:a.includes(e.type.name)));e.tr.ensureMarks(n)}}const yk=(e,a)=>{const r=uk((e=>e.type===a))(e.selection);if(!r)return!0;const n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(void 0===n)return!0;const i=e.doc.nodeAt(n);return r.node.type!==(null==i?void 0:i.type)||!Lh(e.doc,r.pos)||(e.join(r.pos),!0)},vk=(e,a)=>{const r=uk((e=>e.type===a))(e.selection);if(!r)return!0;const n=e.doc.resolve(r.start).after(r.depth);if(void 0===n)return!0;const i=e.doc.nodeAt(n);return r.node.type!==(null==i?void 0:i.type)||!Lh(e.doc,n)||(e.join(n),!0)};var wk=Object.freeze({__proto__:null,blur:()=>({editor:e,view:a})=>(requestAnimationFrame((()=>{var r;e.isDestroyed||(a.dom.blur(),null===(r=null===window||void 0===window?void 0:window.getSelection())||void 0===r||r.removeAllRanges())})),!0),clearContent:(e=!1)=>({commands:a})=>a.setContent("",e),clearNodes:()=>({state:e,tr:a,dispatch:r})=>{const{selection:n}=a,{ranges:i}=n;return!r||(i.forEach((({$from:r,$to:n})=>{e.doc.nodesBetween(r.pos,n.pos,((e,r)=>{if(e.type.isText)return;const{doc:n,mapping:i}=a,t=n.resolve(i.map(r)),o=n.resolve(i.map(r+e.nodeSize)),s=t.blockRange(o);if(!s)return;const l=Nh(s);if(e.type.isTextblock){const{defaultType:e}=t.parent.contentMatchAt(t.index());a.setNodeMarkup(s.start,e)}(l||0===l)&&a.lift(s,l)}))})),!0)},command:e=>a=>e(a),createParagraphNear:()=>({state:e,dispatch:a})=>((e,a)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof gm||n.parent.inlineContent||i.parent.inlineContent)return!1;let t=sf(i.parent.contentMatchAt(i.indexAfter()));if(!t||!t.isTextblock)return!1;if(a){let r=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,o=e.tr.insert(r,t.createAndFill());o.setSelection(dm.create(o.doc,r+1)),a(o.scrollIntoView())}return!0})(e,a),cut:(e,a)=>({editor:r,tr:n})=>{const{state:i}=r,t=i.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);const o=n.mapping.map(a);return n.insert(o,t.content),n.setSelection(new dm(n.doc.resolve(o-1))),!0},deleteCurrentNode:()=>({tr:e,dispatch:a})=>{const{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return!1;const i=e.selection.$anchor;for(let r=i.depth;r>0;r-=1){if(i.node(r).type===n.type){if(a){const a=i.before(r),n=i.after(r);e.delete(a,n).scrollIntoView()}return!0}}return!1},deleteNode:e=>({tr:a,state:r,dispatch:n})=>{const i=wf(e,r.schema),t=a.selection.$anchor;for(let e=t.depth;e>0;e-=1){if(t.node(e).type===i){if(n){const r=t.before(e),n=t.after(e);a.delete(r,n).scrollIntoView()}return!0}}return!1},deleteRange:e=>({tr:a,dispatch:r})=>{const{from:n,to:i}=e;return r&&a.delete(n,i),!0},deleteSelection:()=>({state:e,dispatch:a})=>((e,a)=>!e.selection.empty&&(a&&a(e.tr.deleteSelection().scrollIntoView()),!0))(e,a),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:a})=>((e,a)=>{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),t=r.indexAfter(-1),o=sf(i.contentMatchAt(t));if(!o||!i.canReplaceWith(t,t,o))return!1;if(a){let n=r.after(),i=e.tr.replaceWith(n,n,o.createAndFill());i.setSelection(om.near(i.doc.resolve(n),1)),a(i.scrollIntoView())}return!0})(e,a),extendMarkRange:(e,a={})=>({tr:r,state:n,dispatch:i})=>{const t=Yf(e,n.schema),{doc:o,selection:s}=r,{$from:l,from:c,to:d}=s;if(i){const e=Jf(l,t,a);if(e&&e.from<=c&&e.to>=d){const a=dm.create(o,e.from,e.to);r.setSelection(a)}}return!0},first:e=>a=>{const r="function"==typeof e?e(a):e;for(let e=0;e<r.length;e+=1)if(r[e](a))return!0;return!1},focus:(e=null,a={})=>({editor:r,view:n,tr:i,dispatch:t})=>{a={scrollIntoView:!0,...a};const o=()=>{n.dom.focus(),requestAnimationFrame((()=>{r.isDestroyed||(n.focus(),(null==a?void 0:a.scrollIntoView)&&r.commands.scrollIntoView())}))};if(n.hasFocus()&&null===e||!1===e)return!0;if(t&&null===e&&!Xf(r.state.selection))return o(),!0;const s=ek(i.doc,e)||r.state.selection,l=r.state.selection.eq(s);return t&&(l||i.setSelection(s),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},forEach:(e,a)=>r=>e.every(((e,n)=>a(e,{...r,index:n}))),insertContent:(e,a)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,a),insertContentAt:(e,a,r)=>({tr:n,dispatch:i,editor:t})=>{var o;if(i){let i;r={parseOptions:t.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};try{i=nk(a,t.schema,{parseOptions:{preserveWhitespace:"full",...r.parseOptions},errorOnInvalidContent:null!==(o=r.errorOnInvalidContent)&&void 0!==o?o:t.options.enableContentCheck})}catch(e){return t.emit("contentError",{editor:t,error:e,disableCollaboration:()=>{t.storage.collaboration&&(t.storage.collaboration.isDisabled=!0)}}),!1}let{from:s,to:l}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},c=!0,d=!0;if(("type"in i?[i]:i).forEach((e=>{e.check(),c=!!c&&(e.isText&&0===e.marks.length),d=!!d&&e.isBlock})),s===l&&d){const{parent:e}=n.doc.resolve(s);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(s-=1,l+=1)}let u;if(c){if(Array.isArray(a))u=a.map((e=>e.text||"")).join("");else if(a instanceof cu){let e="";a.forEach((a=>{a.text&&(e+=a.text)})),u=e}else u="object"==typeof a&&a&&a.text?a.text:a;n.insertText(u,s,l)}else u=i,n.replaceWith(s,l,u);r.updateSelection&&function(e,a,r){const n=e.steps.length-1;if(n<a)return;const i=e.steps[n];if(!(i instanceof Eh||i instanceof Mh))return;const t=e.mapping.maps[n];let o=0;t.forEach(((e,a,r,n)=>{0===o&&(o=n)})),e.setSelection(om.near(e.doc.resolve(o),r))}(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:s,text:u}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:s,text:u})}return!0},joinBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=ef(e,r);if(!n)return!1;let i=nf(n);if(!i){let r=n.blockRange(),i=r&&Nh(r);return null!=i&&(a&&a(e.tr.lift(r,i).scrollIntoView()),!0)}let t=i.nodeBefore;if(lf(e,i,a,-1))return!0;if(0==n.parent.content.size&&(rf(t,"end")||hm.isSelectable(t)))for(let r=n.depth;;r--){let o=Wh(e.doc,n.before(r),n.after(r),pu.empty);if(o&&o.slice.size<o.to-o.from){if(a){let r=e.tr.step(o);r.setSelection(rf(t,"end")?om.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):hm.create(r.doc,i.pos-t.nodeSize)),a(r.scrollIntoView())}return!0}if(1==r||n.node(r-1).childCount>1)break}return!(!t.isAtom||i.depth!=n.depth-1||(a&&a(e.tr.delete(i.pos-t.nodeSize,i.pos).scrollIntoView()),0))})(e,a),joinDown:()=>({state:e,dispatch:a})=>((e,a)=>{let r,n=e.selection;if(n instanceof hm){if(n.node.isTextblock||!Lh(e.doc,n.to))return!1;r=n.to}else if(r=Vh(e.doc,n.to,1),null==r)return!1;return a&&a(e.tr.join(r).scrollIntoView()),!0})(e,a),joinForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=tf(e,r);if(!n)return!1;let i=of(n);if(!i)return!1;let t=i.nodeAfter;if(lf(e,i,a,1))return!0;if(0==n.parent.content.size&&(rf(t,"start")||hm.isSelectable(t))){let r=Wh(e.doc,n.before(),n.after(),pu.empty);if(r&&r.slice.size<r.to-r.from){if(a){let n=e.tr.step(r);n.setSelection(rf(t,"start")?om.findFrom(n.doc.resolve(n.mapping.map(i.pos)),1):hm.create(n.doc,n.mapping.map(i.pos))),a(n.scrollIntoView())}return!0}}return!(!t.isAtom||i.depth!=n.depth-1||(a&&a(e.tr.delete(i.pos,i.pos+t.nodeSize).scrollIntoView()),0))})(e,a),joinItemBackward:()=>({state:e,dispatch:a,tr:r})=>{try{const n=Vh(e.doc,e.selection.$from.pos,-1);return null!=n&&(r.join(n,2),a&&a(r),!0)}catch{return!1}},joinItemForward:()=>({state:e,dispatch:a,tr:r})=>{try{const n=Vh(e.doc,e.selection.$from.pos,1);return null!=n&&(r.join(n,2),a&&a(r),!0)}catch{return!1}},joinTextblockBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=ef(e,r);if(!n)return!1;let i=nf(n);return!!i&&af(e,i,a)})(e,a),joinTextblockForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=tf(e,r);if(!n)return!1;let i=of(n);return!!i&&af(e,i,a)})(e,a),joinUp:()=>({state:e,dispatch:a})=>((e,a)=>{let r,n=e.selection,i=n instanceof hm;if(i){if(n.node.isTextblock||!Lh(e.doc,n.from))return!1;r=n.from}else if(r=Vh(e.doc,n.from,-1),null==r)return!1;if(a){let n=e.tr.join(r);i&&n.setSelection(hm.create(n.doc,r-e.doc.resolve(r).nodeBefore.nodeSize)),a(n.scrollIntoView())}return!0})(e,a),keyboardShortcut:e=>({editor:a,view:r,tr:n,dispatch:i})=>{const t=function(e){const a=e.split(/-(?!$)/);let r,n,i,t,o=a[a.length-1];"Space"===o&&(o=" ");for(let e=0;e<a.length-1;e+=1){const o=a[e];if(/^(cmd|meta|m)$/i.test(o))t=!0;else if(/^a(lt)?$/i.test(o))r=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))i=!0;else{if(!/^mod$/i.test(o))throw new Error(`Unrecognized modifier name: ${o}`);ik()||tk()?t=!0:n=!0}}return r&&(o=`Alt-${o}`),n&&(o=`Ctrl-${o}`),t&&(o=`Meta-${o}`),i&&(o=`Shift-${o}`),o}(e).split(/-(?!$)/),o=t.find((e=>!["Alt","Ctrl","Meta","Shift"].includes(e))),s=new KeyboardEvent("keydown",{key:"Space"===o?" ":o,altKey:t.includes("Alt"),ctrlKey:t.includes("Ctrl"),metaKey:t.includes("Meta"),shiftKey:t.includes("Shift"),bubbles:!0,cancelable:!0}),l=a.captureTransaction((()=>{r.someProp("handleKeyDown",(e=>e(r,s)))}));return null==l||l.steps.forEach((e=>{const a=e.map(n.mapping);a&&i&&n.maybeStep(a)})),!0},lift:(e,a={})=>({state:r,dispatch:n})=>!!ok(r,wf(e,r.schema),a)&&((e,a)=>{let{$from:r,$to:n}=e.selection,i=r.blockRange(n),t=i&&Nh(i);return null!=t&&(a&&a(e.tr.lift(i,t).scrollIntoView()),!0)})(r,n),liftEmptyBlock:()=>({state:e,dispatch:a})=>((e,a)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let n=r.before();if(Rh(e.doc,n))return a&&a(e.tr.split(n).scrollIntoView()),!0}let n=r.blockRange(),i=n&&Nh(n);return null!=i&&(a&&a(e.tr.lift(n,i).scrollIntoView()),!0)})(e,a),liftListItem:e=>({state:a,dispatch:r})=>gf(wf(e,a.schema))(a,r),newlineInCode:()=>({state:e,dispatch:a})=>((e,a)=>{let{$head:r,$anchor:n}=e.selection;return!(!r.parent.type.spec.code||!r.sameParent(n)||(a&&a(e.tr.insertText("\n").scrollIntoView()),0))})(e,a),resetAttributes:(e,a)=>({tr:r,state:n,dispatch:i})=>{let t=null,o=null;const s=sk("string"==typeof e?e:e.name,n.schema);return!!s&&("node"===s&&(t=wf(e,n.schema)),"mark"===s&&(o=Yf(e,n.schema)),i&&r.selection.ranges.forEach((e=>{n.doc.nodesBetween(e.$from.pos,e.$to.pos,((e,n)=>{t&&t===e.type&&r.setNodeMarkup(n,void 0,lk(e.attrs,a)),o&&e.marks.length&&e.marks.forEach((i=>{o===i.type&&r.addMark(n,n+e.nodeSize,o.create(lk(i.attrs,a)))}))}))})),!0)},scrollIntoView:()=>({tr:e,dispatch:a})=>(a&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:a})=>{if(a){const a=new gm(e.doc);e.setSelection(a)}return!0},selectNodeBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let{$head:n,empty:i}=e.selection,t=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;t=nf(n)}let o=t&&t.nodeBefore;return!(!o||!hm.isSelectable(o)||(a&&a(e.tr.setSelection(hm.create(e.doc,t.pos-o.nodeSize)).scrollIntoView()),0))})(e,a),selectNodeForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let{$head:n,empty:i}=e.selection,t=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;t=of(n)}let o=t&&t.nodeAfter;return!(!o||!hm.isSelectable(o)||(a&&a(e.tr.setSelection(hm.create(e.doc,t.pos)).scrollIntoView()),0))})(e,a),selectParentNode:()=>({state:e,dispatch:a})=>((e,a)=>{let r,{$from:n,to:i}=e.selection,t=n.sharedDepth(i);return 0!=t&&(r=n.before(t),a&&a(e.tr.setSelection(hm.create(e.doc,r))),!0)})(e,a),selectTextblockEnd:()=>({state:e,dispatch:a})=>uf(e,a),selectTextblockStart:()=>({state:e,dispatch:a})=>df(e,a),setContent:(e,a=!1,r={},n={})=>({editor:i,tr:t,dispatch:o,commands:s})=>{var l,c;const{doc:d}=t;if("full"!==r.preserveWhitespace){const s=ck(e,i.schema,r,{errorOnInvalidContent:null!==(l=n.errorOnInvalidContent)&&void 0!==l?l:i.options.enableContentCheck});return o&&t.replaceWith(0,d.content.size,s).setMeta("preventUpdate",!a),!0}return o&&t.setMeta("preventUpdate",!a),s.insertContentAt({from:0,to:d.content.size},e,{parseOptions:r,errorOnInvalidContent:null!==(c=n.errorOnInvalidContent)&&void 0!==c?c:i.options.enableContentCheck})},setMark:(e,a={})=>({tr:r,state:n,dispatch:i})=>{const{selection:t}=r,{empty:o,ranges:s}=t,l=Yf(e,n.schema);if(i)if(o){const e=dk(n,l);r.addStoredMark(l.create({...e,...a}))}else s.forEach((e=>{const i=e.$from.pos,t=e.$to.pos;n.doc.nodesBetween(i,t,((e,n)=>{const o=Math.max(n,i),s=Math.min(n+e.nodeSize,t);e.marks.find((e=>e.type===l))?e.marks.forEach((e=>{l===e.type&&r.addMark(o,s,l.create({...e.attrs,...a}))})):r.addMark(o,s,l.create(a))}))}));return function(e,a,r){var n;const{selection:i}=a;let t=null;if(Xf(i)&&(t=i.$cursor),t){const a=null!==(n=e.storedMarks)&&void 0!==n?n:t.marks();return!!r.isInSet(a)||!a.some((e=>e.type.excludes(r)))}const{ranges:o}=i;return o.some((({$from:a,$to:n})=>{let i=0===a.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(r);return e.doc.nodesBetween(a.pos,n.pos,((e,a,n)=>{if(i)return!1;if(e.isInline){const a=!n||n.type.allowsMarkType(r),t=!!r.isInSet(e.marks)||!e.marks.some((e=>e.type.excludes(r)));i=a&&t}return!i})),i}))}(n,r,l)},setMeta:(e,a)=>({tr:r})=>(r.setMeta(e,a),!0),setNode:(e,a={})=>({state:r,dispatch:n,chain:i})=>{const t=wf(e,r.schema);let o;return r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),t.isTextblock?i().command((({commands:e})=>!!hf(t,{...o,...a})(r)||e.clearNodes())).command((({state:e})=>hf(t,{...o,...a})(e,n))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:a,dispatch:r})=>{if(r){const{doc:r}=a,n=Qf(e,0,r.content.size),i=hm.create(r,n);a.setSelection(i)}return!0},setTextSelection:e=>({tr:a,dispatch:r})=>{if(r){const{doc:r}=a,{from:n,to:i}="number"==typeof e?{from:e,to:e}:e,t=dm.atStart(r).from,o=dm.atEnd(r).to,s=Qf(n,t,o),l=Qf(i,t,o),c=dm.create(r,s,l);a.setSelection(c)}return!0},sinkListItem:e=>({state:a,dispatch:r})=>{const n=wf(e,a.schema);return(i=n,function(e,a){let{$from:r,$to:n}=e.selection,t=r.blockRange(n,(e=>e.childCount>0&&e.firstChild.type==i));if(!t)return!1;let o=t.startIndex;if(0==o)return!1;let s=t.parent,l=s.child(o-1);if(l.type!=i)return!1;if(a){let r=l.lastChild&&l.lastChild.type==s.type,n=cu.from(r?i.create():null),o=new pu(cu.from(i.create(null,cu.from(s.type.create(null,n)))),r?3:1,0),c=t.start,d=t.end;a(e.tr.step(new Mh(c-(r?3:1),d,c,d,o,1,!0)).scrollIntoView())}return!0})(a,r);var i},splitBlock:({keepMarks:e=!0}={})=>({tr:a,state:r,dispatch:n,editor:i})=>{const{selection:t,doc:o}=a,{$from:s,$to:l}=t,c=gk(i.extensionManager.attributes,s.node().type.name,s.node().attrs);if(t instanceof hm&&t.node.isBlock)return!(!s.parentOffset||!Rh(o,s.pos))&&(n&&(e&&kk(r,i.extensionManager.splittableMarks),a.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,u=0===s.depth?void 0:function(e){for(let a=0;a<e.edgeCount;a+=1){const{type:r}=e.edge(a);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}(s.node(-1).contentMatchAt(s.indexAfter(-1)));let h=d&&u?[{type:u,attrs:c}]:void 0,m=Rh(a.doc,a.mapping.map(s.pos),1,h);if(h||m||!Rh(a.doc,a.mapping.map(s.pos),1,u?[{type:u}]:void 0)||(m=!0,h=u?[{type:u,attrs:c}]:void 0),n){if(m&&(t instanceof dm&&a.deleteSelection(),a.split(a.mapping.map(s.pos),1,h),u&&!d&&!s.parentOffset&&s.parent.type!==u)){const e=a.mapping.map(s.before()),r=a.doc.resolve(e);s.node(-1).canReplaceWith(r.index(),r.index()+1,u)&&a.setNodeMarkup(a.mapping.map(s.before()),u)}e&&kk(r,i.extensionManager.splittableMarks),a.scrollIntoView()}return m},splitListItem:(e,a={})=>({tr:r,state:n,dispatch:i,editor:t})=>{var o;const s=wf(e,n.schema),{$from:l,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==s)return!1;const h=t.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let e=cu.empty;const n=l.index(-1)?1:l.index(-2)?2:3;for(let a=l.depth-n;a>=l.depth-3;a-=1)e=cu.from(l.node(a).copy(e));const i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,t={...gk(h,l.node().type.name,l.node().attrs),...a},c=(null===(o=s.contentMatch.defaultType)||void 0===o?void 0:o.createAndFill(t))||void 0;e=e.append(cu.from(s.createAndFill(null,c)||void 0));const d=l.before(l.depth-(n-1));r.replace(d,l.after(-i),new pu(e,4-n,0));let u=-1;r.doc.nodesBetween(d,r.doc.content.size,((e,a)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=a+1)})),u>-1&&r.setSelection(dm.near(r.doc.resolve(u))),r.scrollIntoView()}return!0}const m=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,g={...gk(h,u.type.name,u.attrs),...a},p={...gk(h,l.node().type.name,l.node().attrs),...a};r.delete(l.pos,c.pos);const b=m?[{type:s,attrs:g},{type:m,attrs:p}]:[{type:s,attrs:g}];if(!Rh(r.doc,l.pos,2))return!1;if(i){const{selection:e,storedMarks:a}=n,{splittableMarks:o}=t.extensionManager,s=a||e.$to.parentOffset&&e.$from.marks();if(r.split(l.pos,2,b).scrollIntoView(),!s||!i)return!0;const c=s.filter((e=>o.includes(e.type.name)));r.ensureMarks(c)}return!0},toggleList:(e,a,r,n={})=>({editor:i,tr:t,state:o,dispatch:s,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,m=wf(e,o.schema),g=wf(a,o.schema),{selection:p,storedMarks:b}=o,{$from:f,$to:k}=p,y=f.blockRange(k),v=b||p.$to.parentOffset&&p.$from.marks();if(!y)return!1;const w=uk((e=>bk(e.type.name,u)))(p);if(y.depth>=1&&w&&y.depth-w.depth<=1){if(w.node.type===m)return c.liftListItem(g);if(bk(w.node.type.name,u)&&m.validContent(w.node.content)&&s)return l().command((()=>(t.setNodeMarkup(w.pos,m),!0))).command((()=>yk(t,m))).command((()=>vk(t,m))).run()}return r&&v&&s?l().command((()=>{const e=d().wrapInList(m,n),a=v.filter((e=>h.includes(e.type.name)));return t.ensureMarks(a),!!e||c.clearNodes()})).wrapInList(m,n).command((()=>yk(t,m))).command((()=>vk(t,m))).run():l().command((()=>!!d().wrapInList(m,n)||c.clearNodes())).wrapInList(m,n).command((()=>yk(t,m))).command((()=>vk(t,m))).run()},toggleMark:(e,a={},r={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:t=!1}=r,o=Yf(e,n.schema);return pk(n,o,a)?i.unsetMark(o,{extendEmptyMarkRange:t}):i.setMark(o,a)},toggleNode:(e,a,r={})=>({state:n,commands:i})=>{const t=wf(e,n.schema),o=wf(a,n.schema),s=ok(n,t,r);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s?i.setNode(o,l):i.setNode(t,{...l,...r})},toggleWrap:(e,a={})=>({state:r,commands:n})=>{const i=wf(e,r.schema);return ok(r,i,a)?n.lift(i):n.wrapIn(i,a)},undoInputRule:()=>({state:e,dispatch:a})=>{const r=e.plugins;for(let n=0;n<r.length;n+=1){const i=r[n];let t;if(i.spec.isInputRules&&(t=i.getState(e))){if(a){const a=e.tr,r=t.transform;for(let e=r.steps.length-1;e>=0;e-=1)a.step(r.steps[e].invert(r.docs[e]));if(t.text){const r=a.doc.resolve(t.from).marks();a.replaceWith(t.from,t.to,e.schema.text(t.text,r))}else a.delete(t.from,t.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:a})=>{const{selection:r}=e,{empty:n,ranges:i}=r;return n||a&&i.forEach((a=>{e.removeMark(a.$from.pos,a.$to.pos)})),!0},unsetMark:(e,a={})=>({tr:r,state:n,dispatch:i})=>{var t;const{extendEmptyMarkRange:o=!1}=a,{selection:s}=r,l=Yf(e,n.schema),{$from:c,empty:d,ranges:u}=s;if(!i)return!0;if(d&&o){let{from:e,to:a}=s;const n=null===(t=c.marks().find((e=>e.type===l)))||void 0===t?void 0:t.attrs,i=Jf(c,l,n);i&&(e=i.from,a=i.to),r.removeMark(e,a,l)}else u.forEach((e=>{r.removeMark(e.$from.pos,e.$to.pos,l)}));return r.removeStoredMark(l),!0},updateAttributes:(e,a={})=>({tr:r,state:n,dispatch:i})=>{let t=null,o=null;const s=sk("string"==typeof e?e:e.name,n.schema);return!!s&&("node"===s&&(t=wf(e,n.schema)),"mark"===s&&(o=Yf(e,n.schema)),i&&r.selection.ranges.forEach((e=>{const i=e.$from.pos,s=e.$to.pos;let l,c,d,u;r.selection.empty?n.doc.nodesBetween(i,s,((e,a)=>{t&&t===e.type&&(d=Math.max(a,i),u=Math.min(a+e.nodeSize,s),l=a,c=e)})):n.doc.nodesBetween(i,s,((e,n)=>{n<i&&t&&t===e.type&&(d=Math.max(n,i),u=Math.min(n+e.nodeSize,s),l=n,c=e),n>=i&&n<=s&&(t&&t===e.type&&r.setNodeMarkup(n,void 0,{...e.attrs,...a}),o&&e.marks.length&&e.marks.forEach((t=>{if(o===t.type){const l=Math.max(n,i),c=Math.min(n+e.nodeSize,s);r.addMark(l,c,o.create({...t.attrs,...a}))}})))})),c&&(void 0!==l&&r.setNodeMarkup(l,void 0,{...c.attrs,...a}),o&&c.marks.length&&c.marks.forEach((e=>{o===e.type&&r.addMark(d,u,o.create({...e.attrs,...a}))})))})),!0)},wrapIn:(e,a={})=>({state:r,dispatch:n})=>function(e,a=null){return function(r,n){let{$from:i,$to:t}=r.selection,o=i.blockRange(t),s=o&&Th(o,e,a);return!!s&&(n&&n(r.tr.wrap(o,s).scrollIntoView()),!0)}}(wf(e,r.schema),a)(r,n),wrapInList:(e,a={})=>({state:r,dispatch:n})=>mf(wf(e,r.schema),a)(r,n)});const zk=Vf.create({name:"commands",addCommands:()=>({...wk})}),jk=Vf.create({name:"drop",addProseMirrorPlugins(){return[new $m({key:new Sm("tiptapDrop"),props:{handleDrop:(e,a,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:a,slice:r,moved:n})}}})]}}),xk=Vf.create({name:"editable",addProseMirrorPlugins(){return[new $m({key:new Sm("editable"),props:{editable:()=>this.editor.options.editable}})]}}),$k=Vf.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new $m({key:new Sm("focusEvents"),props:{handleDOMEvents:{focus:(a,r)=>{e.isFocused=!0;const n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return a.dispatch(n),!1},blur:(a,r)=>{e.isFocused=!1;const n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return a.dispatch(n),!1}}}})]}}),qk=Vf.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first((({commands:e})=>[()=>e.undoInputRule(),()=>e.command((({tr:a})=>{const{selection:r,doc:n}=a,{empty:i,$anchor:t}=r,{pos:o,parent:s}=t,l=t.parent.isTextblock&&o>0?a.doc.resolve(o-1):t,c=l.parent.type.spec.isolating,d=t.pos-t.parentOffset,u=c&&1===l.parent.childCount?d===t.pos:om.atStart(n).from===o;return!(!i||!s.type.isTextblock||s.textContent.length||!u||u&&"paragraph"===t.parent.type.name)&&e.clearNodes()})),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])),a=()=>this.editor.commands.first((({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()])),r={Enter:()=>this.editor.commands.first((({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:a,"Mod-Delete":a,"Mod-a":()=>this.editor.commands.selectAll()},n={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":a,"Ctrl-Alt-Backspace":a,"Alt-Delete":a,"Alt-d":a,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ik()||tk()?i:n},addProseMirrorPlugins(){return[new $m({key:new Sm("clearDocument"),appendTransaction:(e,a,r)=>{const n=e.some((e=>e.docChanged))&&!a.doc.eq(r.doc),i=e.some((e=>e.getMeta("preventClearDocument")));if(!n||i)return;const{empty:t,from:o,to:s}=a.selection,l=om.atStart(a.doc).from,c=om.atEnd(a.doc).to;if(t||!(o===l&&s===c))return;if(!fk(r.doc))return;const d=r.tr,u=pf({state:r,transaction:d}),{commands:h}=new bf({editor:this.editor,state:u});return h.clearNodes(),d.steps.length?d:void 0}})]}}),Ck=Vf.create({name:"paste",addProseMirrorPlugins(){return[new $m({key:new Sm("tiptapPaste"),props:{handlePaste:(e,a,r)=>{this.editor.emit("paste",{editor:this.editor,event:a,slice:r})}}})]}}),Sk=Vf.create({name:"tabindex",addProseMirrorPlugins(){return[new $m({key:new Sm("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Ok=Object.freeze({__proto__:null,ClipboardTextSerializer:Uf,Commands:zk,Drop:jk,Editable:xk,FocusEvents:$k,Keymap:qk,Paste:Ck,Tabindex:Sk});class Ek{get name(){return this.node.type.name}constructor(e,a,r=!1,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=a,this.currentNode=n}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!==(e=this.actualDepth)&&void 0!==e?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let a=this.from,r=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);a=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:a,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),a=this.resolvedPos.doc.resolve(e);return new Ek(a,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Ek(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Ek(e,this.editor)}get children(){const e=[];return this.node.content.forEach(((a,r)=>{const n=a.isBlock&&!a.isTextblock,i=a.isAtom&&!a.isText,t=this.pos+r+(i?0:1),o=this.resolvedPos.doc.resolve(t);if(!n&&o.depth<=this.depth)return;const s=new Ek(o,this.editor,n,n?a:null);n&&(s.actualDepth=this.depth+1),e.push(new Ek(o,this.editor,n,n?a:null))})),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,a={}){let r=null,n=this.parent;for(;n&&!r;){if(n.node.type.name===e)if(Object.keys(a).length>0){const e=n.node.attrs,r=Object.keys(a);for(let n=0;n<r.length;n+=1){const i=r[n];if(e[i]!==a[i])break}}else r=n;n=n.parent}return r}querySelector(e,a={}){return this.querySelectorAll(e,a,!0)[0]||null}querySelectorAll(e,a={},r=!1){let n=[];if(!this.children||0===this.children.length)return n;const i=Object.keys(a);return this.children.forEach((t=>{if(!(r&&n.length>0)){if(t.node.type.name===e){i.every((e=>a[e]===t.node.attrs[e]))&&n.push(t)}r&&n.length>0||(n=n.concat(t.querySelectorAll(e,a,r)))}})),n}setAttribute(e){const{tr:a}=this.editor.state;a.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(a)}}class Mk extends ff{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",(({event:e,slice:a,moved:r})=>this.options.onDrop(e,a,r))),this.on("paste",(({event:e,slice:a})=>this.options.onPaste(e,a))),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(e,a){const r=document.querySelector("style[data-tiptap-style]");if(null!==r)return r;const n=document.createElement("style");return a&&n.setAttribute("nonce",a),n.setAttribute("data-tiptap-style",""),n.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(n),n}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,a=!0){this.setOptions({editable:e}),a&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,a){const r=xf(a)?a(e,[...this.state.plugins]):[...this.state.plugins,e],n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}unregisterPlugin(e){if(this.isDestroyed)return;const a=this.state.plugins;let r=a;if([].concat(e).forEach((e=>{const n="string"==typeof e?`${e}$`:e.key;r=a.filter((e=>!e.key.startsWith(n)))})),a.length===r.length)return;const n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}createExtensionManager(){var e,a;const r=[...this.options.enableCoreExtensions?[xk,Uf.configure({blockSeparator:null===(a=null===(e=this.options.coreExtensionOptions)||void 0===e?void 0:e.clipboardTextSerializer)||void 0===a?void 0:a.blockSeparator}),zk,$k,qk,Sk,jk,Ck].filter((e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name])):[],...this.options.extensions].filter((e=>["extension","node","mark"].includes(null==e?void 0:e.type)));this.extensionManager=new Bf(r,this)}createCommandManager(){this.commandManager=new bf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let a;try{a=ck(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter((e=>"collaboration"!==e.name)),this.createExtensionManager()}}),a=ck(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=ek(a,this.options.autofocus);this.view=new Fb(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null===(e=this.options.editorProps)||void 0===e?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:jm.create({doc:a,selection:r||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const a=this.capturedTransaction;return this.capturedTransaction=null,a}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach((e=>{var a;return null===(a=this.capturedTransaction)||void 0===a?void 0:a.step(e)})):void(this.capturedTransaction=e);const a=this.state.apply(e),r=!this.state.selection.eq(a.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:a}),this.view.updateState(a),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const n=e.getMeta("focus"),i=e.getMeta("blur");n&&this.emit("focus",{editor:this,event:n.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return hk(this.state,e)}isActive(e,a){const r="string"==typeof e?e:null,n="string"==typeof e?a:e;return function(e,a,r={}){if(!a)return ok(e,null,r)||pk(e,null,r);const n=sk(a,e.schema);return"node"===n?ok(e,a,r):"mark"===n&&pk(e,a,r)}(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ef(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:a="\n\n",textSerializers:r={}}=e||{};return function(e,a){return Hf(e,{from:0,to:e.content.size},a)}(this.state.doc,{blockSeparator:a,textSerializers:{...Wf(this.schema),...r}})}get isEmpty(){return fk(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}$node(e,a){var r;return(null===(r=this.$doc)||void 0===r?void 0:r.querySelector(e,a))||null}$nodes(e,a){var r;return(null===(r=this.$doc)||void 0===r?void 0:r.querySelectorAll(e,a))||null}$pos(e){const a=this.state.doc.resolve(e);return new Ek(a,this)}get $doc(){return this.$pos(0)}}function _k(e){return new _f({find:e.find,handler:({state:a,range:r,match:n})=>{const i=$f(e.getAttributes,void 0,n);if(!1===i||null===i)return null;const{tr:t}=a,o=n[n.length-1],s=n[0];if(o){const n=s.search(/\S/),l=r.from+s.indexOf(o),c=l+o.length;if(mk(r.from,r.to,a.doc).filter((a=>a.mark.type.excluded.find((r=>r===e.type&&r!==a.mark.type)))).filter((e=>e.to>l)).length)return null;c<r.to&&t.delete(c,r.to),l>r.from&&t.delete(r.from+n,l);const d=r.from+n+o.length;t.addMark(r.from+n,d,e.type.create(i||{})),t.removeStoredMark(e.type)}}})}function Ak(e){return new _f({find:e.find,handler:({state:a,range:r,match:n})=>{const i=$f(e.getAttributes,void 0,n)||{},{tr:t}=a,o=r.from;let s=r.to;const l=e.type.create(i);if(n[1]){let e=o+n[0].lastIndexOf(n[1]);e>s?e=s:s=e+n[1].length;const a=n[0][n[0].length-1];t.insertText(a,o+n[0].length-1),t.replaceWith(e,s,l)}else if(n[0]){const a=e.type.isInline?o:o-1;t.insert(a,e.type.create(i)).delete(t.mapping.map(o),t.mapping.map(s))}t.scrollIntoView()}})}function Dk(e){return new _f({find:e.find,handler:({state:a,range:r,match:n})=>{const i=a.doc.resolve(r.from),t=$f(e.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;a.tr.delete(r.from,r.to).setBlockType(r.from,r.from,e.type,t)}})}function Nk(e){return new _f({find:e.find,handler:({state:a,range:r,match:n,chain:i})=>{const t=$f(e.getAttributes,void 0,n)||{},o=a.tr.delete(r.from,r.to),s=o.doc.resolve(r.from).blockRange(),l=s&&Th(s,e.type,t);if(!l)return null;if(o.wrap(s,l),e.keepMarks&&e.editor){const{selection:r,storedMarks:n}=a,{splittableMarks:i}=e.editor.extensionManager,t=n||r.$to.parentOffset&&r.$from.marks();if(t){const e=t.filter((e=>i.includes(e.type.name)));o.ensureMarks(e)}}if(e.keepAttributes){const a="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(a,t).run()}const c=o.doc.resolve(r.from-1).nodeBefore;c&&c.type===e.type&&Lh(o.doc,r.from-1)&&(!e.joinPredicate||e.joinPredicate(n,c))&&o.join(r.from-1)}})}let Tk=class e{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=$f(kf(this,"addOptions",{name:this.name}))),this.storage=$f(kf(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(a={}){return new e(a)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>Tf(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(a={}){const r=new e(a);return r.parent=this,this.child=r,r.name=a.name?a.name:r.parent.name,a.defaultOptions&&Object.keys(a.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=$f(kf(r,"addOptions",{name:r.name})),r.storage=$f(kf(r,"addStorage",{name:r.name,options:r.options})),r}};function Ik(e){return new Ff({find:e.find,handler:({state:a,range:r,match:n,pasteEvent:i})=>{const t=$f(e.getAttributes,void 0,n,i);if(!1===t||null===t)return null;const{tr:o}=a,s=n[n.length-1],l=n[0];let c=r.to;if(s){const n=l.search(/\S/),i=r.from+l.indexOf(s),d=i+s.length;if(mk(r.from,r.to,a.doc).filter((a=>a.mark.type.excluded.find((r=>r===e.type&&r!==a.mark.type)))).filter((e=>e.to>i)).length)return null;d<r.to&&o.delete(d,r.to),i>r.from&&o.delete(r.from+n,i),c=r.from+n+s.length,o.addMark(r.from+n,c,e.type.create(t||{})),o.removeStoredMark(e.type)}}})}const Fk=Vf.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new $m({key:new Sm("placeholder"),props:{decorations:({doc:e,selection:a})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=a,i=[];if(!r)return null;const t=this.editor.isEmpty;return e.descendants(((e,a)=>{const r=n>=a&&n<=a+e.nodeSize,o=!e.isLeaf&&fk(e);if((r||!this.options.showOnlyCurrent)&&o){const n=[this.options.emptyNodeClass];t&&n.push(this.options.emptyEditorClass);const o=db.node(a,a+e.nodeSize,{class:n.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:a,hasAnchor:r}):this.options.placeholder});i.push(o)}return this.options.includeChildren})),mb.create(e,i)}}})]}}),Pk=If.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Rk=/^\s*>\s$/,Lk=Tk.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Nk({find:Rk,type:this.type})]}}),Bk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Vk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Hk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Wk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Uk=If.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[_k({find:Bk,type:this.type}),_k({find:Hk,type:this.type})]},addPasteRules(){return[Ik({find:Vk,type:this.type}),Ik({find:Wk,type:this.type})]}}),Gk="textStyle",Kk=/^\s*([-+*])\s$/,Zk=Tk.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:a})=>this.options.keepAttributes?a().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Gk)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Nk({find:Kk,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Nk({find:Kk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Gk),editor:this.editor})),[e]}}),Jk=/(^|[^`])`([^`]+)`(?!`)/,Yk=/(^|[^`])`([^`]+)`(?!`)/g,Xk=If.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[_k({find:Jk,type:this.type})]},addPasteRules(){return[Ik({find:Yk,type:this.type})]}}),Qk=/^```([a-z]+)?[\s\n]$/,ey=/^~~~([a-z]+)?[\s\n]$/,ay=Tk.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var a;const{languageClassPrefix:r}=this.options,n=[...(null===(a=e.firstElementChild)||void 0===a?void 0:a.classList)||[]].filter((e=>e.startsWith(r))).map((e=>e.replace(r,"")))[0];return n||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:a}){return["pre",zf(this.options.HTMLAttributes,a),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:a})=>a.setNode(this.name,e),toggleCodeBlock:e=>({commands:a})=>a.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:a}=this.editor.state.selection,r=1===a.pos;return!(!e||a.parent.type.name!==this.name)&&(!(!r&&a.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:a}=e,{selection:r}=a,{$from:n,empty:i}=r;if(!i||n.parent.type!==this.type)return!1;const t=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith("\n\n");return!(!t||!o)&&e.chain().command((({tr:e})=>(e.delete(n.pos-2,n.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:a}=e,{selection:r,doc:n}=a,{$from:i,empty:t}=r;if(!t||i.parent.type!==this.type)return!1;if(!(i.parentOffset===i.parent.nodeSize-2))return!1;const o=i.after();if(void 0===o)return!1;return n.nodeAt(o)?e.commands.command((({tr:e})=>(e.setSelection(om.near(n.resolve(o))),!0))):e.commands.exitCode()}}},addInputRules(){return[Dk({find:Qk,type:this.type,getAttributes:e=>({language:e[1]})}),Dk({find:ey,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new $m({key:new Sm("codeBlockVSCodeHandler"),props:{handlePaste:(e,a)=>{if(!a.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const r=a.clipboardData.getData("text/plain"),n=a.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,t=null==i?void 0:i.mode;if(!r||!t)return!1;const{tr:o,schema:s}=e.state,l=s.text(r.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:t},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(dm.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),ry=Tk.create({name:"doc",topNode:!0,content:"block+"});function ny(e={}){return new $m({view:a=>new iy(a,e)})}class iy{constructor(e,a){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(r=a.width)&&void 0!==r?r:1,this.color=!1===a.color?void 0:a.color||"black",this.class=a.class,this.handlers=["dragover","dragend","drop","dragleave"].map((a=>{let r=e=>{this[a](e)};return e.dom.addEventListener(a,r),{name:a,handler:r}}))}destroy(){this.handlers.forEach((({name:e,handler:a})=>this.editorView.dom.removeEventListener(e,a)))}update(e,a){null!=this.cursorPos&&a.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,a=this.editorView.state.doc.resolve(this.cursorPos),r=!a.parent.inlineContent;if(r){let r=a.nodeBefore,n=a.nodeAfter;if(r||n){let a=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0));if(a){let i=a.getBoundingClientRect(),t=r?i.bottom:i.top;r&&n&&(t=(t+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:i.left,right:i.right,top:t-this.width/2,bottom:t+this.width/2}}}}if(!e){let a=this.editorView.coordsAtPos(this.cursorPos);e={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let n,i,t=this.editorView.dom.offsetParent;if(this.element||(this.element=t.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),!t||t==document.body&&"static"==getComputedStyle(t).position)n=-pageXOffset,i=-pageYOffset;else{let e=t.getBoundingClientRect();n=e.left-t.scrollLeft,i=e.top-t.scrollTop}this.element.style.left=e.left-n+"px",this.element.style.top=e.top-i+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let a=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=a&&a.inside>=0&&this.editorView.state.doc.nodeAt(a.inside),n=r&&r.type.spec.disableDropCursor,i="function"==typeof n?n(this.editorView,a,e):n;if(a&&!i){let e=a.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Hh(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=a&&(e=a)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const ty=Vf.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[ny(this.options)]}});class oy extends om{constructor(e){super(e,e)}map(e,a){let r=e.resolve(a.map(this.head));return oy.valid(r)?new oy(r):om.near(r)}content(){return pu.empty}eq(e){return e instanceof oy&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new oy(e.resolve(a.pos))}getBookmark(){return new sy(this.anchor)}static valid(e){let a=e.parent;if(a.isTextblock||!function(e){for(let a=e.depth;a>=0;a--){let r=e.index(a),n=e.node(a);if(0!=r)for(let e=n.child(r-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(n.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let a=e.depth;a>=0;a--){let r=e.indexAfter(a),n=e.node(a);if(r!=n.childCount)for(let e=n.child(r);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(n.type.spec.isolating)return!0}return!0}(e))return!1;let r=a.type.spec.allowGapCursor;if(null!=r)return r;let n=a.contentMatchAt(e.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(e,a,r=!1){e:for(;;){if(!r&&oy.valid(e))return e;let n=e.pos,i=null;for(let r=e.depth;;r--){let t=e.node(r);if(a>0?e.indexAfter(r)<t.childCount:e.index(r)>0){i=t.child(a>0?e.indexAfter(r):e.index(r)-1);break}if(0==r)return null;n+=a;let o=e.doc.resolve(n);if(oy.valid(o))return o}for(;;){let t=a>0?i.firstChild:i.lastChild;if(!t){if(i.isAtom&&!i.isText&&!hm.isSelectable(i)){e=e.doc.resolve(n+i.nodeSize*a),r=!1;continue e}break}i=t,n+=a;let o=e.doc.resolve(n);if(oy.valid(o))return o}return null}}}oy.prototype.visible=!1,oy.findFrom=oy.findGapCursorFrom,om.jsonID("gapcursor",oy);class sy{constructor(e){this.pos=e}map(e){return new sy(e.map(this.pos))}resolve(e){let a=e.resolve(this.pos);return oy.valid(a)?new oy(a):om.near(a)}}const ly=Qb({ArrowLeft:cy("horiz",-1),ArrowRight:cy("horiz",1),ArrowUp:cy("vert",-1),ArrowDown:cy("vert",1)});function cy(e,a){const r="vert"==e?a>0?"down":"up":a>0?"right":"left";return function(e,n,i){let t=e.selection,o=a>0?t.$to:t.$from,s=t.empty;if(t instanceof dm){if(!i.endOfTextblock(r)||0==o.depth)return!1;s=!1,o=e.doc.resolve(a>0?o.after():o.before())}let l=oy.findGapCursorFrom(o,a,s);return!!l&&(n&&n(e.tr.setSelection(new oy(l))),!0)}}function dy(e,a,r){if(!e||!e.editable)return!1;let n=e.state.doc.resolve(a);if(!oy.valid(n))return!1;let i=e.posAtCoords({left:r.clientX,top:r.clientY});return!(i&&i.inside>-1&&hm.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new oy(n))),!0)}function uy(e,a){if("insertCompositionText"!=a.inputType||!(e.state.selection instanceof oy))return!1;let{$from:r}=e.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);if(!n)return!1;let i=cu.empty;for(let e=n.length-1;e>=0;e--)i=cu.from(n[e].createAndFill(null,i));let t=e.state.tr.replace(r.pos,r.pos,new pu(i,0,0));return t.setSelection(dm.near(t.doc.resolve(r.pos+1))),e.dispatch(t),!1}function hy(e){if(!(e.selection instanceof oy))return null;let a=document.createElement("div");return a.className="ProseMirror-gapcursor",mb.create(e.doc,[db.widget(e.selection.head,a,{key:"gapcursor"})])}const my=Vf.create({name:"gapCursor",addProseMirrorPlugins:()=>[new $m({props:{decorations:hy,createSelectionBetween:(e,a,r)=>a.pos==r.pos&&oy.valid(r)?new oy(r):null,handleClick:dy,handleKeyDown:ly,handleDOMEvents:{beforeinput:uy}}})],extendNodeSchema(e){var a;return{allowGapCursor:null!==(a=$f(kf(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))&&void 0!==a?a:null}}}),gy=Tk.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",zf(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:a,state:r,editor:n})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:i}=r;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:t}=this.options,{splittableMarks:o}=n.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return a().insertContent({type:this.name}).command((({tr:e,dispatch:a})=>{if(a&&s&&t){const a=s.filter((e=>o.includes(e.type.name)));e.ensureMarks(a)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),py=Tk.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:a}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,zf(this.options.HTMLAttributes,a),0]},addCommands(){return{setHeading:e=>({commands:a})=>!!this.options.levels.includes(e.level)&&a.setNode(this.name,e),toggleHeading:e=>({commands:a})=>!!this.options.levels.includes(e.level)&&a.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,a)=>({...e,[`Mod-Alt-${a}`]:()=>this.editor.commands.toggleHeading({level:a})})),{})},addInputRules(){return this.options.levels.map((e=>Dk({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}});var by=200,fy=function(){};fy.prototype.append=function(e){return e.length?(e=fy.from(e),!this.length&&e||e.length<by&&this.leafAppend(e)||this.length<by&&e.leafPrepend(this)||this.appendInner(e)):this},fy.prototype.prepend=function(e){return e.length?fy.from(e).append(this):this},fy.prototype.appendInner=function(e){return new yy(this,e)},fy.prototype.slice=function(e,a){return void 0===e&&(e=0),void 0===a&&(a=this.length),e>=a?fy.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,a))},fy.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},fy.prototype.forEach=function(e,a,r){void 0===a&&(a=0),void 0===r&&(r=this.length),a<=r?this.forEachInner(e,a,r,0):this.forEachInvertedInner(e,a,r,0)},fy.prototype.map=function(e,a,r){void 0===a&&(a=0),void 0===r&&(r=this.length);var n=[];return this.forEach((function(a,r){return n.push(e(a,r))}),a,r),n},fy.from=function(e){return e instanceof fy?e:e&&e.length?new ky(e):fy.empty};var ky=function(e){function a(a){e.call(this),this.values=a}e&&(a.__proto__=e),a.prototype=Object.create(e&&e.prototype),a.prototype.constructor=a;var r={length:{configurable:!0},depth:{configurable:!0}};return a.prototype.flatten=function(){return this.values},a.prototype.sliceInner=function(e,r){return 0==e&&r==this.length?this:new a(this.values.slice(e,r))},a.prototype.getInner=function(e){return this.values[e]},a.prototype.forEachInner=function(e,a,r,n){for(var i=a;i<r;i++)if(!1===e(this.values[i],n+i))return!1},a.prototype.forEachInvertedInner=function(e,a,r,n){for(var i=a-1;i>=r;i--)if(!1===e(this.values[i],n+i))return!1},a.prototype.leafAppend=function(e){if(this.length+e.length<=by)return new a(this.values.concat(e.flatten()))},a.prototype.leafPrepend=function(e){if(this.length+e.length<=by)return new a(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(a.prototype,r),a}(fy);fy.empty=new ky([]);var yy=function(e){function a(a,r){e.call(this),this.left=a,this.right=r,this.length=a.length+r.length,this.depth=Math.max(a.depth,r.depth)+1}return e&&(a.__proto__=e),a.prototype=Object.create(e&&e.prototype),a.prototype.constructor=a,a.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},a.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},a.prototype.forEachInner=function(e,a,r,n){var i=this.left.length;return!(a<i&&!1===this.left.forEachInner(e,a,Math.min(r,i),n))&&(!(r>i&&!1===this.right.forEachInner(e,Math.max(a-i,0),Math.min(this.length,r)-i,n+i))&&void 0)},a.prototype.forEachInvertedInner=function(e,a,r,n){var i=this.left.length;return!(a>i&&!1===this.right.forEachInvertedInner(e,a-i,Math.max(r,i)-i,n+i))&&(!(r<i&&!1===this.left.forEachInvertedInner(e,Math.min(a,i),r,n))&&void 0)},a.prototype.sliceInner=function(e,a){if(0==e&&a==this.length)return this;var r=this.left.length;return a<=r?this.left.slice(e,a):e>=r?this.right.slice(e-r,a-r):this.left.slice(e,r).append(this.right.slice(0,a-r))},a.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new a(this.left,r)},a.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new a(r,this.right)},a.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new a(this.left,new a(this.right,e)):new a(this,e)},a}(fy);class vy{constructor(e,a){this.items=e,this.eventCount=a}popEvent(e,a){if(0==this.eventCount)return null;let r,n,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}a&&(r=this.remapping(i,this.items.length),n=r.maps.length);let t,o,s=e.tr,l=[],c=[];return this.items.forEach(((e,a)=>{if(!e.step)return r||(r=this.remapping(i,a+1),n=r.maps.length),n--,void c.push(e);if(r){c.push(new wy(e.map));let a,i=e.step.map(r.slice(n));i&&s.maybeStep(i).doc&&(a=s.mapping.maps[s.mapping.maps.length-1],l.push(new wy(a,void 0,void 0,l.length+c.length))),n--,a&&r.appendMap(a,n)}else s.maybeStep(e.step);return e.selection?(t=r?e.selection.map(r.slice(n)):e.selection,o=new vy(this.items.slice(0,i).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:o,transform:s,selection:t}}addTransform(e,a,r,n){let i=[],t=this.eventCount,o=this.items,s=!n&&o.length?o.get(o.length-1):null;for(let r=0;r<e.steps.length;r++){let l,c=e.steps[r].invert(e.docs[r]),d=new wy(e.mapping.maps[r],c,a);(l=s&&s.merge(d))&&(d=l,r?i.pop():o=o.slice(0,o.length-1)),i.push(d),a&&(t++,a=void 0),n||(s=d)}let l=t-r.depth;return l>jy&&(o=function(e,a){let r;return e.forEach(((e,n)=>{if(e.selection&&0==a--)return r=n,!1})),e.slice(r)}(o,l),t-=l),new vy(o.append(i),t)}remapping(e,a){let r=new wh;return this.items.forEach(((a,n)=>{let i=null!=a.mirrorOffset&&n-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,i)}),e,a),r}addMaps(e){return 0==this.eventCount?this:new vy(this.items.append(e.map((e=>new wy(e)))),this.eventCount)}rebased(e,a){if(!this.eventCount)return this;let r=[],n=Math.max(0,this.items.length-a),i=e.mapping,t=e.steps.length,o=this.eventCount;this.items.forEach((e=>{e.selection&&o--}),n);let s=a;this.items.forEach((a=>{let n=i.getMirror(--s);if(null==n)return;t=Math.min(t,n);let l=i.maps[n];if(a.step){let t=e.steps[n].invert(e.docs[n]),c=a.selection&&a.selection.map(i.slice(s+1,n));c&&o++,r.push(new wy(l,t,c))}else r.push(new wy(l))}),n);let l=[];for(let e=a;e<t;e++)l.push(new wy(i.maps[e]));let c=this.items.slice(0,n).append(l).append(r),d=new vy(c,o);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach((a=>{a.step||e++})),e}compress(e=this.items.length){let a=this.remapping(0,e),r=a.maps.length,n=[],i=0;return this.items.forEach(((t,o)=>{if(o>=e)n.push(t),t.selection&&i++;else if(t.step){let e=t.step.map(a.slice(r)),o=e&&e.getMap();if(r--,o&&a.appendMap(o,r),e){let s=t.selection&&t.selection.map(a.slice(r));s&&i++;let l,c=new wy(o.invert(),e,s),d=n.length-1;(l=n.length&&n[d].merge(c))?n[d]=l:n.push(c)}}else t.map&&r--}),this.items.length,0),new vy(fy.from(n.reverse()),i)}}vy.empty=new vy(fy.empty,0);class wy{constructor(e,a,r,n){this.map=e,this.step=a,this.selection=r,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let a=e.step.merge(this.step);if(a)return new wy(a.getMap().invert(),a,this.selection)}}}class zy{constructor(e,a,r,n,i){this.done=e,this.undone=a,this.prevRanges=r,this.prevTime=n,this.prevComposition=i}}const jy=20;function xy(e){let a=[];for(let r=e.length-1;r>=0&&0==a.length;r--)e[r].forEach(((e,r,n,i)=>a.push(n,i)));return a}function $y(e,a){if(!e)return null;let r=[];for(let n=0;n<e.length;n+=2){let i=a.map(e[n],1),t=a.map(e[n+1],-1);i<=t&&r.push(i,t)}return r}let qy=!1,Cy=null;function Sy(e){let a=e.plugins;if(Cy!=a){qy=!1,Cy=a;for(let e=0;e<a.length;e++)if(a[e].spec.historyPreserveItems){qy=!0;break}}return qy}const Oy=new Sm("history"),Ey=new Sm("closeHistory");function My(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new $m({key:Oy,state:{init:()=>new zy(vy.empty,vy.empty,null,0,-1),apply:(a,r,n)=>function(e,a,r,n){let i,t=r.getMeta(Oy);if(t)return t.historyState;r.getMeta(Ey)&&(e=new zy(e.done,e.undone,null,0,-1));let o=r.getMeta("appendedTransaction");if(0==r.steps.length)return e;if(o&&o.getMeta(Oy))return o.getMeta(Oy).redo?new zy(e.done.addTransform(r,void 0,n,Sy(a)),e.undone,xy(r.mapping.maps),e.prevTime,e.prevComposition):new zy(e.done,e.undone.addTransform(r,void 0,n,Sy(a)),null,e.prevTime,e.prevComposition);if(!1===r.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))return(i=r.getMeta("rebased"))?new zy(e.done.rebased(r,i),e.undone.rebased(r,i),$y(e.prevRanges,r.mapping),e.prevTime,e.prevComposition):new zy(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),$y(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);{let i=r.getMeta("composition"),t=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(r.time||0)-n.newGroupDelay||!function(e,a){if(!a)return!1;if(!e.docChanged)return!0;let r=!1;return e.mapping.maps[0].forEach(((e,n)=>{for(let i=0;i<a.length;i+=2)e<=a[i+1]&&n>=a[i]&&(r=!0)})),r}(r,e.prevRanges)),s=o?$y(e.prevRanges,r.mapping):xy(r.mapping.maps);return new zy(e.done.addTransform(r,t?a.selection.getBookmark():void 0,n,Sy(a)),vy.empty,s,r.time,null==i?e.prevComposition:i)}}(r,n,a,e)},config:e,props:{handleDOMEvents:{beforeinput(e,a){let r=a.inputType,n="historyUndo"==r?Ay:"historyRedo"==r?Dy:null;return!!n&&(a.preventDefault(),n(e.state,e.dispatch))}}}})}function _y(e,a){return(r,n)=>{let i=Oy.getState(r);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(n){let t=function(e,a,r){let n=Sy(a),i=Oy.get(a).spec.config,t=(r?e.undone:e.done).popEvent(a,n);if(!t)return null;let o=t.selection.resolve(t.transform.doc),s=(r?e.done:e.undone).addTransform(t.transform,a.selection.getBookmark(),i,n),l=new zy(r?s:t.remaining,r?t.remaining:s,null,0,-1);return t.transform.setSelection(o).setMeta(Oy,{redo:r,historyState:l})}(i,r,e);t&&n(a?t.scrollIntoView():t)}return!0}}const Ay=_y(!1,!0),Dy=_y(!0,!0),Ny=Vf.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:a})=>Ay(e,a),redo:()=>({state:e,dispatch:a})=>Dy(e,a)}),addProseMirrorPlugins(){return[My(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Ty=Tk.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",zf(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:a})=>{const{selection:r}=a,{$from:n,$to:i}=r,t=e();return 0===n.parentOffset?t.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):r instanceof hm?t.insertContentAt(i.pos,{type:this.name}):t.insertContent({type:this.name}),t.command((({tr:e,dispatch:a})=>{var r;if(a){const{$to:a}=e.selection,n=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?e.setSelection(dm.create(e.doc,a.pos+1)):a.nodeAfter.isBlock?e.setSelection(hm.create(e.doc,a.pos)):e.setSelection(dm.create(e.doc,a.pos));else{const i=null===(r=a.parent.type.contentMatch.defaultType)||void 0===r?void 0:r.create();i&&(e.insert(n,i),e.setSelection(dm.create(e.doc,n+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[Ak({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Iy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Fy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Py=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ry=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ly=If.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[_k({find:Iy,type:this.type}),_k({find:Py,type:this.type})]},addPasteRules(){return[Ik({find:Fy,type:this.type}),Ik({find:Ry,type:this.type})]}}),By=Tk.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",zf(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Vy="textStyle",Hy=/^(\d+)\.\s$/,Wy=Tk.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:a,...r}=e;return 1===a?["ol",zf(this.options.HTMLAttributes,r),0]:["ol",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:a})=>this.options.keepAttributes?a().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Vy)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Nk({find:Hy,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,a)=>a.childCount+a.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Nk({find:Hy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Vy)}),joinPredicate:(e,a)=>a.childCount+a.attrs.start===+e[1],editor:this.editor})),[e]}}),Uy=Tk.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Gy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ky=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Zy=If.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[_k({find:Gy,type:this.type})]},addPasteRules(){return[Ik({find:Ky,type:this.type})]}}),Jy=Tk.create({name:"text",group:"inline"}),Yy=Vf.create({name:"starterKit",addExtensions(){var e,a,r,n,i,t,o,s,l,c,d,u,h,m,g,p,b,f;const k=[];return!1!==this.options.bold&&k.push(Uk.configure(null===(e=this.options)||void 0===e?void 0:e.bold)),!1!==this.options.blockquote&&k.push(Lk.configure(null===(a=this.options)||void 0===a?void 0:a.blockquote)),!1!==this.options.bulletList&&k.push(Zk.configure(null===(r=this.options)||void 0===r?void 0:r.bulletList)),!1!==this.options.code&&k.push(Xk.configure(null===(n=this.options)||void 0===n?void 0:n.code)),!1!==this.options.codeBlock&&k.push(ay.configure(null===(i=this.options)||void 0===i?void 0:i.codeBlock)),!1!==this.options.document&&k.push(ry.configure(null===(t=this.options)||void 0===t?void 0:t.document)),!1!==this.options.dropcursor&&k.push(ty.configure(null===(o=this.options)||void 0===o?void 0:o.dropcursor)),!1!==this.options.gapcursor&&k.push(my.configure(null===(s=this.options)||void 0===s?void 0:s.gapcursor)),!1!==this.options.hardBreak&&k.push(gy.configure(null===(l=this.options)||void 0===l?void 0:l.hardBreak)),!1!==this.options.heading&&k.push(py.configure(null===(c=this.options)||void 0===c?void 0:c.heading)),!1!==this.options.history&&k.push(Ny.configure(null===(d=this.options)||void 0===d?void 0:d.history)),!1!==this.options.horizontalRule&&k.push(Ty.configure(null===(u=this.options)||void 0===u?void 0:u.horizontalRule)),!1!==this.options.italic&&k.push(Ly.configure(null===(h=this.options)||void 0===h?void 0:h.italic)),!1!==this.options.listItem&&k.push(By.configure(null===(m=this.options)||void 0===m?void 0:m.listItem)),!1!==this.options.orderedList&&k.push(Wy.configure(null===(g=this.options)||void 0===g?void 0:g.orderedList)),!1!==this.options.paragraph&&k.push(Uy.configure(null===(p=this.options)||void 0===p?void 0:p.paragraph)),!1!==this.options.strike&&k.push(Zy.configure(null===(b=this.options)||void 0===b?void 0:b.strike)),!1!==this.options.text&&k.push(Jy.configure(null===(f=this.options)||void 0===f?void 0:f.text)),k}}),Xy=Object.fromEntries?Object.fromEntries:e=>{if(!e||!e[Symbol.iterator])throw new Error("Object.fromEntries() requires a single iterable argument");const a={};return Object.keys(e).forEach((r=>{const[n,i]=e[r];a[n]=i})),a};function Qy(e){return Object.keys(e)}function ev(e,a){if(!e)throw new Error(a)}function av(e,a){return a}const rv=e=>{const a=e.length;let r=0,n="";for(;r<a;r++){const a=e[r];if(null==a)continue;let i;switch(typeof a){case"boolean":break;case"object":if(Array.isArray(a))i=rv(a);else{ev(!av(0,!1)),"production"!==process.env.NODE_ENV&&void 0!==a.styles&&void 0!==a.name&&console.error("You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component."),i="";for(const e in a)a[e]&&e&&(i&&(i+=" "),i+=e)}break;default:i=a}i&&(n&&(n+=" "),n+=i)}return n};var nv={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},iv=/[A-Z]|^ms/g,tv=/_EMO_([^_]+?)_([^]*?)_EMO_/g,ov=function(e){return 45===e.charCodeAt(1)},sv=function(e){return null!=e&&"boolean"!=typeof e},lv=Ri((function(e){return ov(e)?e:e.replace(iv,"-$&").toLowerCase()})),cv=function(e,a){switch(e){case"animation":case"animationName":if("string"==typeof a)return a.replace(tv,(function(e,a,r){return uv={name:a,styles:r,next:uv},a}))}return 1===nv[e]||ov(e)||"number"!=typeof a||0===a?a:a+"px"};function dv(e,a,r){if(null==r)return"";var n=r;if(void 0!==n.__emotion_styles)return n;switch(typeof r){case"boolean":return"";case"object":var i=r;if(1===i.anim)return uv={name:i.name,styles:i.styles,next:uv},i.name;var t=r;if(void 0!==t.styles){var o=t.next;if(void 0!==o)for(;void 0!==o;)uv={name:o.name,styles:o.styles,next:uv},o=o.next;return t.styles+";"}return function(e,a,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=dv(e,a,r[i])+";";else for(var t in r){var o=r[t];if("object"!=typeof o){var s=o;null!=a&&void 0!==a[s]?n+=t+"{"+a[s]+"}":sv(s)&&(n+=lv(t)+":"+cv(t,s)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=a&&void 0!==a[o[0]]){var l=dv(e,a,o);switch(t){case"animation":case"animationName":n+=lv(t)+":"+l+";";break;default:n+=t+"{"+l+"}"}}else for(var c=0;c<o.length;c++)sv(o[c])&&(n+=lv(t)+":"+cv(t,o[c])+";")}return n}(e,a,r)}var s=r;if(null==a)return s;var l=a[s];return void 0!==l?l:s}var uv,hv=/label:\s*([^\s;{]+)\s*(;|$)/g;var mv="undefined"!=typeof document;const{createCssAndCx:gv}={createCssAndCx:function(e){const{cache:a}=e,r=(...e)=>{const r=function(e,a,r){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n=!0,i="";uv=void 0;var t=e[0];null==t||void 0===t.raw?(n=!1,i+=dv(r,a,t)):i+=t[0];for(var o=1;o<e.length;o++)i+=dv(r,a,e[o]),n&&(i+=t[o]);hv.lastIndex=0;for(var s,l="";null!==(s=hv.exec(i));)l+="-"+s[1];var c=function(e){for(var a,r=0,n=0,i=e.length;i>=4;++n,i-=4)a=1540483477*(65535&(a=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(a>>>16)<<16),r=1540483477*(65535&(a^=a>>>24))+(59797*(a>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(i){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)}(i)+l;return{name:c,styles:i,next:uv}}(e,a.registered);!function(e,a){!function(e,a){var r=e.key+"-"+a.name;void 0===e.registered[r]&&(e.registered[r]=a.styles)}(e,a);var r=e.key+"-"+a.name;if(void 0===e.inserted[a.name]){var n="",i=a;do{var t=e.insert(a===i?"."+r:"",i,e.sheet,!0);mv||void 0===t||(n+=t),i=i.next}while(void 0!==i);!mv&&n.length}}(a,r);const n=`${a.key}-${r.name}`;{const r=e[0];(function(e){return e instanceof Object&&!("styles"in e)&&!("length"in e)&&!("__emotion_styles"in e)})(r)&&bv.saveClassNameCSSObjectMapping(a,n,r)}return n};return{css:r,cx:(...e)=>{const n=rv(e),i=bv.fixClassName(a,n,r);return function(e,a,r){const n=[],i=function(e,a,r){var n="";return r.split(" ").forEach((function(r){void 0!==e[r]?a.push(e[r]+";"):r&&(n+=r+" ")})),n}(e,n,r);return n.length<2?r:i+a(n)}(a.registered,r,i)}}}};function pv(e){const{useCache:a}=e;return{useCssAndCx:function(){const e=a(),{css:n,cx:i}=function(e,a){var n;const i=r();return(!i.current||a.length!==(null===(n=i.current.prevDeps)||void 0===n?void 0:n.length)||i.current.prevDeps.map(((e,r)=>e===a[r])).indexOf(!1)>=0)&&(i.current={v:e(),prevDeps:[...a]}),i.current.v}((()=>gv({cache:e})),[e]);return{css:n,cx:i}}}}const bv=(()=>{const e=new WeakMap;return{saveClassNameCSSObjectMapping:(a,r,n)=>{let i=e.get(a);void 0===i&&(i=new Map,e.set(a,i)),i.set(r,n)},fixClassName:(a,r,n)=>{const i=e.get(a);return rv(function(e){let a=!1;return e.map((([e,r])=>{if(void 0===r)return e;let n;if(a)n={"&&":r};else{n=e;for(const e in r)if(e.startsWith("@media")){a=!0;break}}return n}))}(r.split(" ").map((e=>[e,null==i?void 0:i.get(e)]))).map((e=>"string"==typeof e?e:n(e))))}}})();function fv(e){if(!(e instanceof Object)||"function"==typeof e)return e;const a=[];for(const r in e){const n=e[r],i=typeof n;if("string"!==i&&("number"!==i||isNaN(n))&&"boolean"!==i&&null!=n)return e;a.push(`${r}:${i}_${n}`)}return"xSqLiJdLMd9s"+a.join("|")}function kv(e,a,r){if(!(a instanceof Object))return e;const n={};return Qy(e).forEach((i=>n[i]=r(e[i],a[i]))),Qy(a).forEach((r=>{if(r in e)return;const i=a[r];"string"==typeof i&&(n[r]=i)})),n}const yv=({classes:e,theme:a,muiStyleOverridesParams:r,css:n,cx:i,name:o})=>{var s,l;if("makeStyle no name"!==o){if(void 0!==r&&void 0===o)throw new Error("To use muiStyleOverridesParams, you must specify a name using .withName('MyComponent')")}else o=void 0;let c;try{c=void 0===o?void 0:(null===(l=null===(s=a.components)||void 0===s?void 0:s[o])||void 0===l?void 0:l.styleOverrides)||void 0}catch(e){}const d=t((()=>{if(void 0===c)return;const e={};for(const i in c){const t=c[i];t instanceof Object&&(e[i]=n("function"==typeof t?t({theme:a,ownerState:null==r?void 0:r.ownerState,...null==r?void 0:r.props}):t))}return e}),[c,fv(null==r?void 0:r.props),fv(null==r?void 0:r.ownerState),n]);return{classes:e=t((()=>kv(e,d,i)),[e,d,i])}};let vv=0;function wv(e){const{useTheme:a,cache:r}=e,{useCache:n}=jv({cacheProvidedAtInception:r}),{useCssAndCx:i}=pv({useCache:n});return{makeStyles:function(e){const{name:r,uniqId:o=""+vv++}=null!=e?e:{},s="object"!=typeof r?r:Object.keys(r)[0];return function(e){const r="function"==typeof e?e:()=>e;return function(e,l){const c=a();let{css:d,cx:u}=i();const h=n();let m=t((()=>{const a={},n="undefined"!=typeof Proxy&&new Proxy({},{get:(e,r)=>("symbol"==typeof r&&ev(!1),a[r]=`${h.key}-${o}${void 0!==s?`-${s}`:""}-${r}-ref`)}),i=r(c,e,n||{}),t=Xy(Qy(i).map((e=>{const r=i[e];return r.label||(r.label=`${void 0!==s?`${s}-`:""}${e}`),[e,`${d(r)}${av(0,e in a)?` ${a[e]}`:""}`]})));return Qy(a).forEach((e=>{e in t||(t[e]=a[e])})),t}),[h,d,u,c,fv(e)]);{const e=null==l?void 0:l.props.classes;m=t((()=>kv(m,e,u)),[m,fv(e),u])}{const e=yv({classes:m,css:d,cx:u,name:null!=s?s:"makeStyle no name",idOfUseStyles:o,muiStyleOverridesParams:l,theme:c});void 0!==e.classes&&(m=e.classes),void 0!==e.css&&(d=e.css),void 0!==e.cx&&(u=e.cx)}return{classes:m,theme:c,css:d,cx:u}}}},useStyles:function(){const e=a(),{css:r,cx:n}=i();return{theme:e,css:r,cx:n}}}}const zv=c(void 0),{createUseCache:jv}={createUseCache:function(e){const{cacheProvidedAtInception:a}=e;return{useCache:function(){var e;const r=Le(),n=d(zv),i=null!==(e=null!=a?a:n)&&void 0!==e?e:r;if(null===i)throw new Error(["In order to get SSR working with tss-react you need to explicitly provide an Emotion cache.","MUI users be aware: This is not an error strictly related to tss-react, with or without tss-react,","MUI needs an Emotion cache to be provided for SSR to work.","Here is the MUI documentation related to SSR setup: https://mui.com/material-ui/guides/server-rendering/","TSS provides helper that makes the process of setting up SSR easier: https://docs.tss-react.dev/ssr"].join("\n"));return i}}}};function xv(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $v(e){const{useTheme:r,cache:n}=e,{makeStyles:i}=wv({useTheme:r,cache:n});function t(e,r,n){const t="string"==typeof e?(()=>{const a=e,r=function({children:e,...r}){return h(a,r,e)};return Object.defineProperty(r,"name",{value:xv(a)}),r})():e,o=(()=>{{const{name:e}=null!=n?n:{};if(void 0!==e)return"object"!=typeof e?e:Object.keys(e)[0]}let e;{const a=t.displayName;"string"==typeof a&&""!==a&&(e=a)}e:{if(void 0!==e)break e;const a=t.name;"string"==typeof a&&""!==a&&(e=a)}if(void 0!==e)return e=e.replace(/\$/g,"usd"),e=e.replace(/\(/g,"_").replace(/\)/g,"_"),e=e.replace(/[^a-zA-Z0-9-_]/g,"_"),e})(),l=i({...n,name:o})("function"==typeof r?(e,a,n)=>Ov(r(e,a,n)):Ov(r));function c(e){for(const a in e)if("root"!==a)return!0;return!1}const d=s((function(r,n){const{className:i,classes:o,...s}=r,{classes:d,cx:u}=l(r,{props:r}),h=u(d.root,i);return qv.set(d,{...d,root:h}),a.createElement(t,{ref:n,className:c(d)?i:h,..."string"==typeof e?{}:{classes:d},...s})}));return void 0!==o&&(d.displayName=`${xv(o)}WithStyles`,Object.defineProperty(d,"name",{value:d.displayName})),d}return t.getClasses=Sv,{withStyles:t}}const qv=new WeakMap,Cv="getClasses should only be used in conjunction with withStyles";function Sv(e){const a=e.classes;if(void 0===a)throw new Error(Cv);const r=qv.get(a);if(void 0===r)throw new Error(Cv);return r}function Ov(e){const a={},r={};return Object.keys(e).forEach((n=>(n.startsWith("@media")?r:a)[n]=e[n])),Object.keys(r).forEach((e=>{const n=r[e];Object.keys(n).forEach((r=>{var i;return a[r]={...null!==(i=a[r])&&void 0!==i?i:{},[e]:n[r]}}))})),a}const Ev=(()=>{const e="object"==typeof document&&"function"==typeof(null===document||void 0===document?void 0:document.getElementById),a="undefined"!=typeof jest,r="undefined"!=typeof mocha,n="undefined"!=typeof __vitest_worker__;return!(e||a||r||n)})();function Mv(e){_v=0,Av.splice(0,Av.length);const{useContext:a,usePlugin:r,cache:n}=e,{useCache:i}=jv({cacheProvidedAtInception:n}),{useCssAndCx:t}=pv({useCache:i}),o=Dv({useContext:a,useCache:i,useCssAndCx:t,usePlugin:null!=r?r:({classes:e,cx:a,css:r})=>({classes:e,cx:a,css:r}),name:void 0,doesUseNestedSelectors:!1});return{tss:o}}let _v=0;const Av=[];function Dv(e){const{useContext:a,useCache:r,useCssAndCx:n,usePlugin:i,name:t,doesUseNestedSelectors:o}=e;return{withParams:()=>Dv({...e}),withName:a=>Dv({...e,name:"object"!=typeof a?a:Object.keys(a)[0]}),withNestedSelectors:()=>Dv({...e,doesUseNestedSelectors:!0}),create:e=>{const s="x"+_v++;if(void 0!==t)for(;;){const e=Av.find((e=>e.name===t));if(void 0===e)break;Av.splice(Av.indexOf(e),1)}const l="function"==typeof e?e:()=>e;return function(c){var d,u,h;const{classesOverrides:m,...g}=null!=c?c:{},p=a(),{css:b,cx:f}=n(),k=r(),y=function(e){const{cache:a,cssObjectByRuleNameOrGetCssObjectByRuleName:r,classesOverridesRef:n,paramsAndPluginParamsRef:i,idOfUseStyles:t,context:o,getClasses:s}=e;e:{const e=Nv.get(a);if(void 0===e)break e;const s=e.get(r);if(void 0===s)break e;const l=s.get(n);if(void 0===l)break e;const c=l.get(i);if(void 0===c)break e;const d=c.find((({context:e})=>{if(e===o)return!0;if(Qy(e).length!==Qy(o).length)return!1;for(const a in e)if(fv(e[a])!==fv(o[a]))return!1;return!0}));if(void 0!==d){if((null==d?void 0:d.idOfUseStyles)===t)return d.result;c.splice(c.indexOf(d),1)}}const l=s();{Nv.has(a)||Nv.set(a,new WeakMap);const e=Nv.get(a);ev(void 0!==e),e.has(r)||e.set(r,new Map);const s=e.get(r);ev(void 0!==s),s.has(n)||(s.size>200&&s.clear(),s.set(n,new Map));const c=s.get(n);if(ev(void 0!==c),!c.has(i)){{const e="string"==typeof i?257:5;c.size<e||c.clear()}c.set(i,[])}let d=c.get(i);ev(void 0!==d),d.length>5&&(d=[]),d.push({idOfUseStyles:t,context:o,result:l})}return l}({cache:k,cssObjectByRuleNameOrGetCssObjectByRuleName:e,classesOverridesRef:fv(m),paramsAndPluginParamsRef:fv(g),idOfUseStyles:s,context:p,getClasses:()=>{const e={},a=l({...c,...p,...o?{classes:"undefined"==typeof Proxy?{}:new Proxy({},{get:(a,r)=>{if("symbol"==typeof r&&ev(!1),Ev&&void 0===t)throw new Error(["tss-react: In SSR setups, in order to use nested selectors, you must also give a unique name to the useStyle function.",'Solution: Use tss.withName("ComponentName").withNestedSelectors<...>()... to set a name.'].join("\n"));e:{if(void 0===t)break e;let e=Av.find((e=>e.name===t&&e.idOfUseStyles===s));void 0===e&&(e={name:t,idOfUseStyles:s,nestedSelectorRuleNames:new Set},Av.push(e)),e.nestedSelectorRuleNames.add(r)}e:{if(void 0===t)break e;const e=void 0!==Av.find((e=>e.name===t&&e.idOfUseStyles!==s&&e.nestedSelectorRuleNames.has(r)));if(e)throw new Error([`tss-react: There are in your codebase two different useStyles named "${t}" that`,`both use use the nested selector ${r}.\n`,"This may lead to CSS class name collisions, causing nested selectors to target elements outside of the intended scope.\n","Solution: Ensure each useStyles using nested selectors has a unique name.\n",'Use: tss.withName("UniqueName").withNestedSelectors<...>()...'].join(" "))}return e[r]=`${k.key}-${void 0!==t?t:s}-${r}-ref`}})}:{}});let r=Xy(Qy(a).map((r=>{const n=a[r];return n.label||(n.label=`${void 0!==t?`${t}-`:""}${r}`),[r,`${b(n)}${av(0,r in e)?` ${e[r]}`:""}`]})));return Qy(e).forEach((a=>{a in r||(r[a]=e[a])})),r=kv(r,m,f),r}}),v=i({classes:y,css:b,cx:f,idOfUseStyles:s,name:t,...p,...g});return{classes:null!==(d=v.classes)&&void 0!==d?d:y,css:null!==(u=v.css)&&void 0!==u?u:b,cx:null!==(h=v.cx)&&void 0!==h?h:f,...p}}}}}const Nv=new WeakMap;const{tss:Tv}=Mv({useContext:()=>({})});Tv.create({});const{makeStyles:Iv,withStyles:Fv}={...wv(Pv={useTheme:El}),...$v(Pv)};var Pv;const{tss:Rv}=Mv({useContext:function(){return{theme:El()}},usePlugin:yv});Rv.create({});var Lv=function(e,a){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=a(e[r],r,e);return i};var Bv=function(){this.__data__=[],this.size=0};var Vv=function(e,a){return e===a||e!=e&&a!=a},Hv=Vv;var Wv=function(e,a){for(var r=e.length;r--;)if(Hv(e[r][0],a))return r;return-1},Uv=Wv,Gv=Array.prototype.splice;var Kv=function(e){var a=this.__data__,r=Uv(a,e);return!(r<0)&&(r==a.length-1?a.pop():Gv.call(a,r,1),--this.size,!0)},Zv=Wv;var Jv=function(e){var a=this.__data__,r=Zv(a,e);return r<0?void 0:a[r][1]},Yv=Wv;var Xv=Wv;var Qv=function(e,a){var r=this.__data__,n=Xv(r,e);return n<0?(++this.size,r.push([e,a])):r[n][1]=a,this},ew=Bv,aw=Kv,rw=Jv,nw=function(e){return Yv(this.__data__,e)>-1},iw=Qv;function tw(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}tw.prototype.clear=ew,tw.prototype.delete=aw,tw.prototype.get=rw,tw.prototype.has=nw,tw.prototype.set=iw;var ow=tw,sw=ow;var lw=function(){this.__data__=new sw,this.size=0};var cw=function(e){var a=this.__data__,r=a.delete(e);return this.size=a.size,r};var dw=function(e){return this.__data__.get(e)};var uw=function(e){return this.__data__.has(e)},hw="object"==typeof global&&global&&global.Object===Object&&global,mw=hw,gw="object"==typeof self&&self&&self.Object===Object&&self,pw=mw||gw||Function("return this")(),bw=pw.Symbol,fw=bw,kw=Object.prototype,yw=kw.hasOwnProperty,vw=kw.toString,ww=fw?fw.toStringTag:void 0;var zw=function(e){var a=yw.call(e,ww),r=e[ww];try{e[ww]=void 0;var n=!0}catch(e){}var i=vw.call(e);return n&&(a?e[ww]=r:delete e[ww]),i},jw=Object.prototype.toString;var xw=zw,$w=function(e){return jw.call(e)},qw=bw?bw.toStringTag:void 0;var Cw=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":qw&&qw in Object(e)?xw(e):$w(e)};var Sw=function(e){var a=typeof e;return null!=e&&("object"==a||"function"==a)},Ow=Cw,Ew=Sw;var Mw,_w=function(e){if(!Ew(e))return!1;var a=Ow(e);return"[object Function]"==a||"[object GeneratorFunction]"==a||"[object AsyncFunction]"==a||"[object Proxy]"==a},Aw=pw["__core-js_shared__"],Dw=(Mw=/[^.]+$/.exec(Aw&&Aw.keys&&Aw.keys.IE_PROTO||""))?"Symbol(src)_1."+Mw:"";var Nw=function(e){return!!Dw&&Dw in e},Tw=Function.prototype.toString;var Iw=function(e){if(null!=e){try{return Tw.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Fw=_w,Pw=Nw,Rw=Sw,Lw=Iw,Bw=/^\[object .+?Constructor\]$/,Vw=Function.prototype,Hw=Object.prototype,Ww=Vw.toString,Uw=Hw.hasOwnProperty,Gw=RegExp("^"+Ww.call(Uw).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Kw=function(e){return!(!Rw(e)||Pw(e))&&(Fw(e)?Gw:Bw).test(Lw(e))},Zw=function(e,a){return null==e?void 0:e[a]};var Jw=function(e,a){var r=Zw(e,a);return Kw(r)?r:void 0},Yw=Jw(pw,"Map"),Xw=Jw(Object,"create"),Qw=Xw;var ez=function(){this.__data__=Qw?Qw(null):{},this.size=0};var az=function(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a},rz=Xw,nz=Object.prototype.hasOwnProperty;var iz=function(e){var a=this.__data__;if(rz){var r=a[e];return"__lodash_hash_undefined__"===r?void 0:r}return nz.call(a,e)?a[e]:void 0},tz=Xw,oz=Object.prototype.hasOwnProperty;var sz=Xw;var lz=ez,cz=az,dz=iz,uz=function(e){var a=this.__data__;return tz?void 0!==a[e]:oz.call(a,e)},hz=function(e,a){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=sz&&void 0===a?"__lodash_hash_undefined__":a,this};function mz(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}mz.prototype.clear=lz,mz.prototype.delete=cz,mz.prototype.get=dz,mz.prototype.has=uz,mz.prototype.set=hz;var gz=mz,pz=ow,bz=Yw;var fz=function(e){var a=typeof e;return"string"==a||"number"==a||"symbol"==a||"boolean"==a?"__proto__"!==e:null===e};var kz=function(e,a){var r=e.__data__;return fz(a)?r["string"==typeof a?"string":"hash"]:r.map},yz=kz;var vz=function(e){var a=yz(this,e).delete(e);return this.size-=a?1:0,a},wz=kz;var zz=kz;var jz=kz;var xz=function(){this.size=0,this.__data__={hash:new gz,map:new(bz||pz),string:new gz}},$z=vz,qz=function(e){return wz(this,e).get(e)},Cz=function(e){return zz(this,e).has(e)},Sz=function(e,a){var r=jz(this,e),n=r.size;return r.set(e,a),this.size+=r.size==n?0:1,this};function Oz(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}Oz.prototype.clear=xz,Oz.prototype.delete=$z,Oz.prototype.get=qz,Oz.prototype.has=Cz,Oz.prototype.set=Sz;var Ez=Oz,Mz=ow,_z=Yw,Az=Ez;var Dz=ow,Nz=lw,Tz=cw,Iz=dw,Fz=uw,Pz=function(e,a){var r=this.__data__;if(r instanceof Mz){var n=r.__data__;if(!_z||n.length<199)return n.push([e,a]),this.size=++r.size,this;r=this.__data__=new Az(n)}return r.set(e,a),this.size=r.size,this};function Rz(e){var a=this.__data__=new Dz(e);this.size=a.size}Rz.prototype.clear=Nz,Rz.prototype.delete=Tz,Rz.prototype.get=Iz,Rz.prototype.has=Fz,Rz.prototype.set=Pz;var Lz=Rz;var Bz=function(e,a){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==a(e[r],r,e););return e},Vz=Jw,Hz=function(){try{var e=Vz(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Wz=Hz;var Uz=function(e,a,r){"__proto__"==a&&Wz?Wz(e,a,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[a]=r},Gz=Uz,Kz=Vv,Zz=Object.prototype.hasOwnProperty;var Jz=function(e,a,r){var n=e[a];Zz.call(e,a)&&Kz(n,r)&&(void 0!==r||a in e)||Gz(e,a,r)},Yz=Jz,Xz=Uz;var Qz=function(e,a,r,n){var i=!r;r||(r={});for(var t=-1,o=a.length;++t<o;){var s=a[t],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),i?Xz(r,s,l):Yz(r,s,l)}return r};var ej=function(e,a){for(var r=-1,n=Array(e);++r<e;)n[r]=a(r);return n};var aj=function(e){return null!=e&&"object"==typeof e},rj=Cw,nj=aj;var ij=function(e){return nj(e)&&"[object Arguments]"==rj(e)},tj=aj,oj=Object.prototype,sj=oj.hasOwnProperty,lj=oj.propertyIsEnumerable,cj=ij(function(){return arguments}())?ij:function(e){return tj(e)&&sj.call(e,"callee")&&!lj.call(e,"callee")},dj=Array.isArray,uj={exports:{}};var hj=function(){return!1};!function(e,a){var r=pw,n=hj,i=a&&!a.nodeType&&a,t=i&&e&&!e.nodeType&&e,o=t&&t.exports===i?r.Buffer:void 0,s=(o?o.isBuffer:void 0)||n;e.exports=s}(uj,uj.exports);var mj=uj.exports,gj=/^(?:0|[1-9]\d*)$/;var pj=function(e,a){var r=typeof e;return!!(a=null==a?9007199254740991:a)&&("number"==r||"symbol"!=r&&gj.test(e))&&e>-1&&e%1==0&&e<a};var bj=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},fj=Cw,kj=bj,yj=aj,vj={};vj["[object Float32Array]"]=vj["[object Float64Array]"]=vj["[object Int8Array]"]=vj["[object Int16Array]"]=vj["[object Int32Array]"]=vj["[object Uint8Array]"]=vj["[object Uint8ClampedArray]"]=vj["[object Uint16Array]"]=vj["[object Uint32Array]"]=!0,vj["[object Arguments]"]=vj["[object Array]"]=vj["[object ArrayBuffer]"]=vj["[object Boolean]"]=vj["[object DataView]"]=vj["[object Date]"]=vj["[object Error]"]=vj["[object Function]"]=vj["[object Map]"]=vj["[object Number]"]=vj["[object Object]"]=vj["[object RegExp]"]=vj["[object Set]"]=vj["[object String]"]=vj["[object WeakMap]"]=!1;var wj=function(e){return yj(e)&&kj(e.length)&&!!vj[fj(e)]};var zj=function(e){return function(a){return e(a)}},jj={exports:{}};!function(e,a){var r=hw,n=a&&!a.nodeType&&a,i=n&&e&&!e.nodeType&&e,t=i&&i.exports===n&&r.process,o=function(){try{var e=i&&i.require&&i.require("util").types;return e||t&&t.binding&&t.binding("util")}catch(e){}}();e.exports=o}(jj,jj.exports);var xj=jj.exports,$j=wj,qj=zj,Cj=xj&&xj.isTypedArray,Sj=Cj?qj(Cj):$j,Oj=ej,Ej=cj,Mj=dj,_j=mj,Aj=pj,Dj=Sj,Nj=Object.prototype.hasOwnProperty;var Tj=function(e,a){var r=Mj(e),n=!r&&Ej(e),i=!r&&!n&&_j(e),t=!r&&!n&&!i&&Dj(e),o=r||n||i||t,s=o?Oj(e.length,String):[],l=s.length;for(var c in e)!a&&!Nj.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||t&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Aj(c,l))||s.push(c);return s},Ij=Object.prototype;var Fj=function(e){var a=e&&e.constructor;return e===("function"==typeof a&&a.prototype||Ij)};var Pj=function(e,a){return function(r){return e(a(r))}},Rj=Pj(Object.keys,Object),Lj=Fj,Bj=Rj,Vj=Object.prototype.hasOwnProperty;var Hj=function(e){if(!Lj(e))return Bj(e);var a=[];for(var r in Object(e))Vj.call(e,r)&&"constructor"!=r&&a.push(r);return a},Wj=_w,Uj=bj;var Gj=function(e){return null!=e&&Uj(e.length)&&!Wj(e)},Kj=Tj,Zj=Hj,Jj=Gj;var Yj=function(e){return Jj(e)?Kj(e):Zj(e)},Xj=Qz,Qj=Yj;var ex=function(e,a){return e&&Xj(a,Qj(a),e)};var ax=function(e){var a=[];if(null!=e)for(var r in Object(e))a.push(r);return a},rx=Sw,nx=Fj,ix=ax,tx=Object.prototype.hasOwnProperty;var ox=function(e){if(!rx(e))return ix(e);var a=nx(e),r=[];for(var n in e)("constructor"!=n||!a&&tx.call(e,n))&&r.push(n);return r},sx=Tj,lx=ox,cx=Gj;var dx=function(e){return cx(e)?sx(e,!0):lx(e)},ux=Qz,hx=dx;var mx=function(e,a){return e&&ux(a,hx(a),e)},gx={exports:{}};!function(e,a){var r=pw,n=a&&!a.nodeType&&a,i=n&&e&&!e.nodeType&&e,t=i&&i.exports===n?r.Buffer:void 0,o=t?t.allocUnsafe:void 0;e.exports=function(e,a){if(a)return e.slice();var r=e.length,n=o?o(r):new e.constructor(r);return e.copy(n),n}}(gx,gx.exports);var px=gx.exports;var bx=function(e,a){var r=-1,n=e.length;for(a||(a=Array(n));++r<n;)a[r]=e[r];return a};var fx=function(e,a){for(var r=-1,n=null==e?0:e.length,i=0,t=[];++r<n;){var o=e[r];a(o,r,e)&&(t[i++]=o)}return t};var kx=function(){return[]},yx=fx,vx=kx,wx=Object.prototype.propertyIsEnumerable,zx=Object.getOwnPropertySymbols,jx=zx?function(e){return null==e?[]:(e=Object(e),yx(zx(e),(function(a){return wx.call(e,a)})))}:vx,xx=Qz,$x=jx;var qx=function(e,a){return xx(e,$x(e),a)};var Cx=function(e,a){for(var r=-1,n=a.length,i=e.length;++r<n;)e[i+r]=a[r];return e},Sx=Pj(Object.getPrototypeOf,Object),Ox=Cx,Ex=Sx,Mx=jx,_x=kx,Ax=Object.getOwnPropertySymbols?function(e){for(var a=[];e;)Ox(a,Mx(e)),e=Ex(e);return a}:_x,Dx=Qz,Nx=Ax;var Tx=function(e,a){return Dx(e,Nx(e),a)},Ix=Cx,Fx=dj;var Px=function(e,a,r){var n=a(e);return Fx(e)?n:Ix(n,r(e))},Rx=Px,Lx=jx,Bx=Yj;var Vx=function(e){return Rx(e,Bx,Lx)},Hx=Px,Wx=Ax,Ux=dx;var Gx=function(e){return Hx(e,Ux,Wx)},Kx=Jw(pw,"DataView"),Zx=Yw,Jx=Jw(pw,"Promise"),Yx=Jw(pw,"Set"),Xx=Jw(pw,"WeakMap"),Qx=Cw,e$=Iw,a$="[object Map]",r$="[object Promise]",n$="[object Set]",i$="[object WeakMap]",t$="[object DataView]",o$=e$(Kx),s$=e$(Zx),l$=e$(Jx),c$=e$(Yx),d$=e$(Xx),u$=Qx;(Kx&&u$(new Kx(new ArrayBuffer(1)))!=t$||Zx&&u$(new Zx)!=a$||Jx&&u$(Jx.resolve())!=r$||Yx&&u$(new Yx)!=n$||Xx&&u$(new Xx)!=i$)&&(u$=function(e){var a=Qx(e),r="[object Object]"==a?e.constructor:void 0,n=r?e$(r):"";if(n)switch(n){case o$:return t$;case s$:return a$;case l$:return r$;case c$:return n$;case d$:return i$}return a});var h$=u$,m$=Object.prototype.hasOwnProperty;var g$=function(e){var a=e.length,r=new e.constructor(a);return a&&"string"==typeof e[0]&&m$.call(e,"index")&&(r.index=e.index,r.input=e.input),r},p$=pw.Uint8Array;var b$=function(e){var a=new e.constructor(e.byteLength);return new p$(a).set(new p$(e)),a},f$=b$;var k$=function(e,a){var r=a?f$(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},y$=/\w*$/;var v$=function(e){var a=new e.constructor(e.source,y$.exec(e));return a.lastIndex=e.lastIndex,a},w$=bw?bw.prototype:void 0,z$=w$?w$.valueOf:void 0;var j$=b$;var x$=b$,$$=k$,q$=v$,C$=function(e){return z$?Object(z$.call(e)):{}},S$=function(e,a){var r=a?j$(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var O$=function(e,a,r){var n=e.constructor;switch(a){case"[object ArrayBuffer]":return x$(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return $$(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return S$(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return q$(e);case"[object Symbol]":return C$(e)}},E$=Sw,M$=Object.create,_$=function(){function e(){}return function(a){if(!E$(a))return{};if(M$)return M$(a);e.prototype=a;var r=new e;return e.prototype=void 0,r}}(),A$=_$,D$=Sx,N$=Fj;var T$=function(e){return"function"!=typeof e.constructor||N$(e)?{}:A$(D$(e))},I$=h$,F$=aj;var P$=function(e){return F$(e)&&"[object Map]"==I$(e)},R$=zj,L$=xj&&xj.isMap,B$=L$?R$(L$):P$,V$=h$,H$=aj;var W$=function(e){return H$(e)&&"[object Set]"==V$(e)},U$=zj,G$=xj&&xj.isSet,K$=G$?U$(G$):W$,Z$=Lz,J$=Bz,Y$=Jz,X$=ex,Q$=mx,eq=px,aq=bx,rq=qx,nq=Tx,iq=Vx,tq=Gx,oq=h$,sq=g$,lq=O$,cq=T$,dq=dj,uq=mj,hq=B$,mq=Sw,gq=K$,pq=Yj,bq=dx,fq="[object Arguments]",kq="[object Function]",yq="[object Object]",vq={};vq[fq]=vq["[object Array]"]=vq["[object ArrayBuffer]"]=vq["[object DataView]"]=vq["[object Boolean]"]=vq["[object Date]"]=vq["[object Float32Array]"]=vq["[object Float64Array]"]=vq["[object Int8Array]"]=vq["[object Int16Array]"]=vq["[object Int32Array]"]=vq["[object Map]"]=vq["[object Number]"]=vq[yq]=vq["[object RegExp]"]=vq["[object Set]"]=vq["[object String]"]=vq["[object Symbol]"]=vq["[object Uint8Array]"]=vq["[object Uint8ClampedArray]"]=vq["[object Uint16Array]"]=vq["[object Uint32Array]"]=!0,vq["[object Error]"]=vq[kq]=vq["[object WeakMap]"]=!1;var wq=function e(a,r,n,i,t,o){var s,l=1&r,c=2&r,d=4&r;if(n&&(s=t?n(a,i,t,o):n(a)),void 0!==s)return s;if(!mq(a))return a;var u=dq(a);if(u){if(s=sq(a),!l)return aq(a,s)}else{var h=oq(a),m=h==kq||"[object GeneratorFunction]"==h;if(uq(a))return eq(a,l);if(h==yq||h==fq||m&&!t){if(s=c||m?{}:cq(a),!l)return c?nq(a,Q$(s,a)):rq(a,X$(s,a))}else{if(!vq[h])return t?a:{};s=lq(a,h,l)}}o||(o=new Z$);var g=o.get(a);if(g)return g;o.set(a,s),gq(a)?a.forEach((function(i){s.add(e(i,r,n,i,a,o))})):hq(a)&&a.forEach((function(i,t){s.set(t,e(i,r,n,t,a,o))}));var p=u?void 0:(d?c?tq:iq:c?bq:pq)(a);return J$(p||a,(function(i,t){p&&(i=a[t=i]),Y$(s,t,e(i,r,n,t,a,o))})),s},zq=Cw,jq=aj;var xq=function(e){return"symbol"==typeof e||jq(e)&&"[object Symbol]"==zq(e)},$q=dj,qq=xq,Cq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Sq=/^\w*$/;var Oq=function(e,a){if($q(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!qq(e))||(Sq.test(e)||!Cq.test(e)||null!=a&&e in Object(a))},Eq=Ez;function Mq(e,a){if("function"!=typeof e||null!=a&&"function"!=typeof a)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=a?a.apply(this,n):n[0],t=r.cache;if(t.has(i))return t.get(i);var o=e.apply(this,n);return r.cache=t.set(i,o)||t,o};return r.cache=new(Mq.Cache||Eq),r}Mq.Cache=Eq;var _q=Mq;var Aq=function(e){var a=_q(e,(function(e){return 500===r.size&&r.clear(),e})),r=a.cache;return a},Dq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nq=/\\(\\)?/g,Tq=Aq((function(e){var a=[];return 46===e.charCodeAt(0)&&a.push(""),e.replace(Dq,(function(e,r,n,i){a.push(n?i.replace(Nq,"$1"):r||e)})),a})),Iq=Tq,Fq=Lv,Pq=dj,Rq=xq,Lq=bw?bw.prototype:void 0,Bq=Lq?Lq.toString:void 0;var Vq=function e(a){if("string"==typeof a)return a;if(Pq(a))return Fq(a,e)+"";if(Rq(a))return Bq?Bq.call(a):"";var r=a+"";return"0"==r&&1/a==-1/0?"-0":r},Hq=Vq;var Wq=dj,Uq=Oq,Gq=Iq,Kq=function(e){return null==e?"":Hq(e)};var Zq=function(e,a){return Wq(e)?e:Uq(e,a)?[e]:Gq(Kq(e))};var Jq=function(e){var a=null==e?0:e.length;return a?e[a-1]:void 0},Yq=xq;var Xq=function(e){if("string"==typeof e||Yq(e))return e;var a=e+"";return"0"==a&&1/e==-1/0?"-0":a},Qq=Zq,eC=Xq;var aC=function(e,a){for(var r=0,n=(a=Qq(a,e)).length;null!=e&&r<n;)e=e[eC(a[r++])];return r&&r==n?e:void 0};var rC=function(e,a,r){var n=-1,i=e.length;a<0&&(a=-a>i?0:i+a),(r=r>i?i:r)<0&&(r+=i),i=a>r?0:r-a>>>0,a>>>=0;for(var t=Array(i);++n<i;)t[n]=e[n+a];return t},nC=aC,iC=rC;var tC=Zq,oC=Jq,sC=function(e,a){return a.length<2?e:nC(e,iC(a,0,-1))},lC=Xq;var cC=function(e,a){return a=tC(a,e),null==(e=sC(e,a))||delete e[lC(oC(a))]},dC=Cw,uC=Sx,hC=aj,mC=Function.prototype,gC=Object.prototype,pC=mC.toString,bC=gC.hasOwnProperty,fC=pC.call(Object);var kC=function(e){if(!hC(e)||"[object Object]"!=dC(e))return!1;var a=uC(e);if(null===a)return!0;var r=bC.call(a,"constructor")&&a.constructor;return"function"==typeof r&&r instanceof r&&pC.call(r)==fC};var yC=function(e){return kC(e)?void 0:e},vC=cj,wC=dj,zC=bw?bw.isConcatSpreadable:void 0;var jC=Cx,xC=function(e){return wC(e)||vC(e)||!!(zC&&e&&e[zC])};var $C=function e(a,r,n,i,t){var o=-1,s=a.length;for(n||(n=xC),t||(t=[]);++o<s;){var l=a[o];r>0&&n(l)?r>1?e(l,r-1,n,i,t):jC(t,l):i||(t[t.length]=l)}return t},qC=$C;var CC=function(e){return(null==e?0:e.length)?qC(e,1):[]};var SC=function(e,a,r){switch(r.length){case 0:return e.call(a);case 1:return e.call(a,r[0]);case 2:return e.call(a,r[0],r[1]);case 3:return e.call(a,r[0],r[1],r[2])}return e.apply(a,r)},OC=Math.max;var EC=function(e,a,r){return a=OC(void 0===a?e.length-1:a,0),function(){for(var n=arguments,i=-1,t=OC(n.length-a,0),o=Array(t);++i<t;)o[i]=n[a+i];i=-1;for(var s=Array(a+1);++i<a;)s[i]=n[i];return s[a]=r(o),SC(e,this,s)}};var MC=function(e){return function(){return e}},_C=Hz,AC=_C?function(e,a){return _C(e,"toString",{configurable:!0,enumerable:!1,value:MC(a),writable:!0})}:function(e){return e},DC=Date.now;var NC=function(e){var a=0,r=0;return function(){var n=DC(),i=16-(n-r);if(r=n,i>0){if(++a>=800)return arguments[0]}else a=0;return e.apply(void 0,arguments)}}(AC),TC=CC,IC=EC,FC=NC;var PC=Lv,RC=wq,LC=cC,BC=Zq,VC=Qz,HC=yC,WC=Gx,UC=function(e){return FC(IC(e,void 0,TC),e+"")}((function(e,a){var r={};if(null==e)return r;var n=!1;a=PC(a,(function(a){return a=BC(a,e),n||(n=a.length>1),a})),VC(e,WC(e),r),n&&(r=RC(r,7,HC));for(var i=a.length;i--;)LC(r,a[i]);return r})),GC=la(UC);const KC=1,ZC=2,JC=2;function YC(e){const a=Object.keys(e.typography.h1).some((e=>e.includes("@media"))),r=Re`
|
|
40
|
+
*/"production"===process.env.NODE_ENV?vo.exports=function(){if(yo)return wo;yo=1;var e=Symbol.for("react.transitional.element"),a=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),t=Symbol.for("react.consumer"),o=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),l=Symbol.for("react.suspense"),c=Symbol.for("react.suspense_list"),d=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),h=Symbol.for("react.offscreen"),m=Symbol.for("react.client.reference");function g(h){if("object"==typeof h&&null!==h){var m=h.$$typeof;switch(m){case e:switch(h=h.type){case r:case i:case n:case l:case c:return h;default:switch(h=h&&h.$$typeof){case o:case s:case u:case d:case t:return h;default:return m}}case a:return m}}}return wo.ContextConsumer=t,wo.ContextProvider=o,wo.Element=e,wo.ForwardRef=s,wo.Fragment=r,wo.Lazy=u,wo.Memo=d,wo.Portal=a,wo.Profiler=i,wo.StrictMode=n,wo.Suspense=l,wo.SuspenseList=c,wo.isContextConsumer=function(e){return g(e)===t},wo.isContextProvider=function(e){return g(e)===o},wo.isElement=function(a){return"object"==typeof a&&null!==a&&a.$$typeof===e},wo.isForwardRef=function(e){return g(e)===s},wo.isFragment=function(e){return g(e)===r},wo.isLazy=function(e){return g(e)===u},wo.isMemo=function(e){return g(e)===d},wo.isPortal=function(e){return g(e)===a},wo.isProfiler=function(e){return g(e)===i},wo.isStrictMode=function(e){return g(e)===n},wo.isSuspense=function(e){return g(e)===l},wo.isSuspenseList=function(e){return g(e)===c},wo.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===i||e===n||e===l||e===c||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===u||e.$$typeof===d||e.$$typeof===o||e.$$typeof===t||e.$$typeof===s||e.$$typeof===m||void 0!==e.getModuleId)},wo.typeOf=g,wo}():vo.exports=(zo||(zo=1,"production"!==process.env.NODE_ENV&&function(){function e(e){if("object"==typeof e&&null!==e){var m=e.$$typeof;switch(m){case a:switch(e=e.type){case n:case t:case i:case c:case d:return e;default:switch(e=e&&e.$$typeof){case s:case l:case h:case u:case o:return e;default:return m}}case r:return m}}}var a=Symbol.for("react.transitional.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),t=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),s=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),u=Symbol.for("react.memo"),h=Symbol.for("react.lazy"),m=Symbol.for("react.offscreen"),g=Symbol.for("react.client.reference");jo.ContextConsumer=o,jo.ContextProvider=s,jo.Element=a,jo.ForwardRef=l,jo.Fragment=n,jo.Lazy=h,jo.Memo=u,jo.Portal=r,jo.Profiler=t,jo.StrictMode=i,jo.Suspense=c,jo.SuspenseList=d,jo.isContextConsumer=function(a){return e(a)===o},jo.isContextProvider=function(a){return e(a)===s},jo.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},jo.isForwardRef=function(a){return e(a)===l},jo.isFragment=function(a){return e(a)===n},jo.isLazy=function(a){return e(a)===h},jo.isMemo=function(a){return e(a)===u},jo.isPortal=function(a){return e(a)===r},jo.isProfiler=function(a){return e(a)===t},jo.isStrictMode=function(a){return e(a)===i},jo.isSuspense=function(a){return e(a)===c},jo.isSuspenseList=function(a){return e(a)===d},jo.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===n||e===t||e===i||e===c||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===u||e.$$typeof===s||e.$$typeof===o||e.$$typeof===l||e.$$typeof===g||void 0!==e.getModuleId)},jo.typeOf=e}()),jo);var xo=vo.exports;const $o=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function qo(e){const a=`${e}`.match($o);return a&&a[1]||""}function Co(e,a=""){return e.displayName||e.name||qo(e)||a}function So(e,a,r){const n=Co(a);return e.displayName||(""!==n?`${r}(${n})`:r)}var Oo=Object.freeze({__proto__:null,default:function(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return Co(e,"Component");if("object"==typeof e)switch(e.$$typeof){case xo.ForwardRef:return So(e,e.render,"ForwardRef");case xo.Memo:return So(e,e.type,"memo");default:return}}},getFunctionName:qo});function Eo(e,a){const r=fn({},a);return Object.keys(e).forEach((n=>{if(n.toString().match(/^(components|slots)$/))r[n]=fn({},e[n],r[n]);else if(n.toString().match(/^(componentsProps|slotProps)$/)){const i=e[n]||{},t=a[n];r[n]={},t&&Object.keys(t)?i&&Object.keys(i)?(r[n]=fn({},t),Object.keys(i).forEach((e=>{r[n][e]=Eo(i[e],t[e])}))):r[n]=t:r[n]=i}else void 0===r[n]&&(r[n]=e[n])})),r}const Mo="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function _o(a,r,n,i,t){const[o,s]=e.useState((()=>t&&n?n(a).matches:i?i(a).matches:r));return Mo((()=>{let e=!0;if(!n)return;const r=n(a),i=()=>{e&&s(r.matches)};return i(),r.addListener(i),()=>{e=!1,r.removeListener(i)}}),[a,n]),o}const Ao=e.useSyncExternalStore;function Do(a,r,n,i,t){const o=e.useCallback((()=>r),[r]),s=e.useMemo((()=>{if(t&&n)return()=>n(a).matches;if(null!==i){const{matches:e}=i(a);return()=>e}return o}),[o,a,i,t,n]),[l,c]=e.useMemo((()=>{if(null===n)return[o,()=>()=>{}];const e=n(a);return[()=>e.matches,a=>(e.addListener(a),()=>{e.removeListener(a)})]}),[o,n,a]);return Ao(c,l,s)}function No(a,r={}){const n=mo(),i="undefined"!=typeof window&&void 0!==window.matchMedia,{defaultMatches:t=!1,matchMedia:o=(i?window.matchMedia:null),ssrMatchMedia:s=null,noSsr:l=!1}=function(e){const{theme:a,name:r,props:n}=e;return a&&a.components&&a.components[r]&&a.components[r].defaultProps?Eo(a.components[r].defaultProps,n):n}({name:"MuiUseMediaQuery",props:r,theme:n});"production"!==process.env.NODE_ENV&&"function"==typeof a&&null===n&&console.error(["MUI: The `query` argument provided is invalid.","You are providing a function without a theme in the context.","One of the parent elements needs to use a ThemeProvider."].join("\n"));let c="function"==typeof a?a(n):a;c=c.replace(/^@media( ?)/m,"");const d=(void 0!==Ao?Do:_o)(c,t,o,s,l);return"production"!==process.env.NODE_ENV&&e.useDebugValue({query:c,match:d}),d}var To=Object.freeze({__proto__:null,default:function(e,a=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(a,Math.min(e,r))}});const Io="exact-prop: ";const Fo=e.createContext(null);function Po(){const a=e.useContext(Fo);return"production"!==process.env.NODE_ENV&&e.useDebugValue(a),a}"production"!==process.env.NODE_ENV&&(Fo.displayName="ThemeContext");var Ro="function"==typeof Symbol&&Symbol.for?Symbol.for("mui.nested"):"__THEME_NESTED__";function Lo(a){const{children:r,theme:n}=a,i=Po();"production"!==process.env.NODE_ENV&&null===i&&"function"==typeof n&&console.error(["MUI: You are providing a theme function prop to the ThemeProvider component:","<ThemeProvider theme={outerTheme => outerTheme} />","","However, no outer theme is present.","Make sure a theme is already injected higher in the React tree or provide a theme object."].join("\n"));const t=e.useMemo((()=>{const e=null===i?n:function(e,a){if("function"==typeof a){const r=a(e);return"production"!==process.env.NODE_ENV&&(r||console.error(["MUI: You should return an object from your theme function, i.e.","<ThemeProvider theme={() => ({})} />"].join("\n"))),r}return fn({},e,a)}(i,n);return null!=e&&(e[Ro]=null!==i),e}),[n,i]);return pa.jsx(Fo.Provider,{value:t,children:r})}"production"!==process.env.NODE_ENV&&(Lo.propTypes={children:Wn.node,theme:Wn.oneOfType([Wn.object,Wn.func]).isRequired}),"production"!==process.env.NODE_ENV&&"production"!==process.env.NODE_ENV&&(Lo.propTypes=function(e){return"production"===process.env.NODE_ENV?e:fn({},e,{[Io]:a=>{const r=Object.keys(a).filter((a=>!e.hasOwnProperty(a)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}})}(Lo.propTypes));const Bo="exact-prop: ";const Vo=["value"],Ho=e.createContext();function Wo(e){let{value:a}=e,r=kn(e,Vo);return pa.jsx(Ho.Provider,fn({value:null==a||a},r))}"production"!==process.env.NODE_ENV&&(Wo.propTypes={children:Wn.node,value:Wn.bool});const Uo=e.createContext(void 0);function Go({value:e,children:a}){return pa.jsx(Uo.Provider,{value:e,children:a})}function Ko({props:a,name:r}){return function(e){const{theme:a,name:r,props:n}=e;if(!a||!a.components||!a.components[r])return n;const i=a.components[r];return i.defaultProps?Eo(i.defaultProps,n):i.styleOverrides||i.variants?n:Eo(i,n)}({props:a,name:r,theme:{components:e.useContext(Uo)}})}"production"!==process.env.NODE_ENV&&(Go.propTypes={children:Wn.node,value:Wn.object});const Zo={};function Jo(a,r,n,i=!1){return e.useMemo((()=>{const e=a&&r[a]||r;if("function"==typeof n){const t=n(e),o=a?fn({},r,{[a]:t}):t;return i?()=>o:o}return fn({},r,a?{[a]:n}:n)}),[a,r,n,i])}function Yo(e){const{children:a,theme:r,themeId:n}=e,i=mo(Zo),t=Po()||Zo;"production"!==process.env.NODE_ENV&&(null===i&&"function"==typeof r||n&&i&&!i[n]&&"function"==typeof r)&&console.error(["MUI: You are providing a theme function prop to the ThemeProvider component:","<ThemeProvider theme={outerTheme => outerTheme} />","","However, no outer theme is present.","Make sure a theme is already injected higher in the React tree or provide a theme object."].join("\n"));const o=Jo(n,i,r),s=Jo(n,t,r,!0),l="rtl"===o.direction;return pa.jsx(Lo,{theme:s,children:pa.jsx(Fe.Provider,{value:o,children:pa.jsx(Wo,{value:l,children:pa.jsx(Go,{value:null==o?void 0:o.components,children:a})})})})}function Xo(e){if("object"!=typeof e||null===e)return!1;const a=Object.getPrototypeOf(e);return!(null!==a&&a!==Object.prototype&&null!==Object.getPrototypeOf(a)||Symbol.toStringTag in e||Symbol.iterator in e)}function Qo(a){if(e.isValidElement(a)||!Xo(a))return a;const r={};return Object.keys(a).forEach((e=>{r[e]=Qo(a[e])})),r}function es(a,r,n={clone:!0}){const i=n.clone?fn({},a):a;return Xo(a)&&Xo(r)&&Object.keys(r).forEach((t=>{e.isValidElement(r[t])?i[t]=r[t]:Xo(r[t])&&Object.prototype.hasOwnProperty.call(a,t)&&Xo(a[t])?i[t]=es(a[t],r[t],n):n.clone?i[t]=Xo(r[t])?Qo(r[t]):r[t]:i[t]=r[t]})),i}"production"!==process.env.NODE_ENV&&(Yo.propTypes={children:Wn.node,theme:Wn.oneOfType([Wn.func,Wn.object]).isRequired,themeId:Wn.string}),"production"!==process.env.NODE_ENV&&"production"!==process.env.NODE_ENV&&(Yo.propTypes=function(e){return"production"===process.env.NODE_ENV?e:fn({},e,{[Bo]:a=>{const r=Object.keys(a).filter((a=>!e.hasOwnProperty(a)));return r.length>0?new Error(`The following props are not supported: ${r.map((e=>`\`${e}\``)).join(", ")}. Please remove them.`):null}})}(Yo.propTypes));const as=e=>e,rs=(()=>{let e=as;return{configure(a){e=a},generate:a=>e(a),reset(){e=as}}})(),ns={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function is(e,a,r="Mui"){const n=ns[a];return n?`${r}-${n}`:`${rs.generate(e)}-${a}`}function ts(e,a){return fn({toolbar:{minHeight:56,[e.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[e.up("sm")]:{minHeight:64}}},a)}var ss,ls={},cs={exports:{}};(ss=cs).exports=function(e){return e&&e.__esModule?e:{default:e}},ss.exports.__esModule=!0,ss.exports.default=ss.exports;var ds=cs.exports,us=ca(wn),hs=ca(To),ms=ds;Object.defineProperty(ls,"__esModule",{value:!0}),ls.alpha=qs,ls.blend=function(e,a,r,n=1){const i=(e,a)=>Math.round((e**(1/n)*(1-r)+a**(1/n)*r)**n),t=ws(e),o=ws(a),s=[i(t.values[0],o.values[0]),i(t.values[1],o.values[1]),i(t.values[2],o.values[2])];return js({type:"rgb",values:s})},ls.colorChannel=void 0;var gs=ls.darken=Cs;ls.decomposeColor=ws,ls.emphasize=Os;var ps=ls.getContrastRatio=function(e,a){const r=$s(e),n=$s(a);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)};ls.getLuminance=$s,ls.hexToRgb=vs,ls.hslToRgb=xs;var bs=ls.lighten=Ss;ls.private_safeAlpha=function(e,a,r){try{return qs(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},ls.private_safeColorChannel=void 0,ls.private_safeDarken=function(e,a,r){try{return Cs(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},ls.private_safeEmphasize=function(e,a,r){try{return Os(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},ls.private_safeLighten=function(e,a,r){try{return Ss(e,a)}catch(a){return r&&"production"!==process.env.NODE_ENV&&console.warn(r),e}},ls.recomposeColor=js,ls.rgbToHex=function(e){if(0===e.indexOf("#"))return e;const{values:a}=ws(e);return`#${a.map(((e,a)=>function(e){const a=e.toString(16);return 1===a.length?`0${a}`:a}(3===a?Math.round(255*e):e))).join("")}`};var fs=ms(us),ks=ms(hs);function ys(e,a=0,r=1){return"production"!==process.env.NODE_ENV&&(e<a||e>r)&&console.error(`MUI: The value provided ${e} is out of range [${a}, ${r}].`),(0,ks.default)(e,a,r)}function vs(e){e=e.slice(1);const a=new RegExp(`.{1,${e.length>=6?2:1}}`,"g");let r=e.match(a);return r&&1===r[0].length&&(r=r.map((e=>e+e))),r?`rgb${4===r.length?"a":""}(${r.map(((e,a)=>a<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3)).join(", ")})`:""}function ws(e){if(e.type)return e;if("#"===e.charAt(0))return ws(vs(e));const a=e.indexOf("("),r=e.substring(0,a);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(r))throw new Error("production"!==process.env.NODE_ENV?`MUI: Unsupported \`${e}\` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().`:(0,fs.default)(9,e));let n,i=e.substring(a+1,e.length-1);if("color"===r){if(i=i.split(" "),n=i.shift(),4===i.length&&"/"===i[3].charAt(0)&&(i[3]=i[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(n))throw new Error("production"!==process.env.NODE_ENV?`MUI: unsupported \`${n}\` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.`:(0,fs.default)(10,n))}else i=i.split(",");return i=i.map((e=>parseFloat(e))),{type:r,values:i,colorSpace:n}}const zs=e=>{const a=ws(e);return a.values.slice(0,3).map(((e,r)=>-1!==a.type.indexOf("hsl")&&0!==r?`${e}%`:e)).join(" ")};ls.colorChannel=zs;function js(e){const{type:a,colorSpace:r}=e;let{values:n}=e;return-1!==a.indexOf("rgb")?n=n.map(((e,a)=>a<3?parseInt(e,10):e)):-1!==a.indexOf("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),n=-1!==a.indexOf("color")?`${r} ${n.join(" ")}`:`${n.join(", ")}`,`${a}(${n})`}function xs(e){e=ws(e);const{values:a}=e,r=a[0],n=a[1]/100,i=a[2]/100,t=n*Math.min(i,1-i),o=(e,a=(e+r/30)%12)=>i-t*Math.max(Math.min(a-3,9-a,1),-1);let s="rgb";const l=[Math.round(255*o(0)),Math.round(255*o(8)),Math.round(255*o(4))];return"hsla"===e.type&&(s+="a",l.push(a[3])),js({type:s,values:l})}function $s(e){let a="hsl"===(e=ws(e)).type||"hsla"===e.type?ws(xs(e)).values:e.values;return a=a.map((a=>("color"!==e.type&&(a/=255),a<=.03928?a/12.92:((a+.055)/1.055)**2.4))),Number((.2126*a[0]+.7152*a[1]+.0722*a[2]).toFixed(3))}function qs(e,a){return e=ws(e),a=ys(a),"rgb"!==e.type&&"hsl"!==e.type||(e.type+="a"),"color"===e.type?e.values[3]=`/${a}`:e.values[3]=a,js(e)}function Cs(e,a){if(e=ws(e),a=ys(a),-1!==e.type.indexOf("hsl"))e.values[2]*=1-a;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-a;return js(e)}function Ss(e,a){if(e=ws(e),a=ys(a),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*a;else if(-1!==e.type.indexOf("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*a;else if(-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*a;return js(e)}function Os(e,a=.15){return $s(e)>.5?Cs(e,a):Ss(e,a)}ls.private_safeColorChannel=(e,a)=>{try{return zs(e)}catch(r){return a&&"production"!==process.env.NODE_ENV&&console.warn(a),e}};const Es={black:"#000",white:"#fff"},Ms={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},_s="#f3e5f5",As="#ce93d8",Ds="#ba68c8",Ns="#ab47bc",Ts="#9c27b0",Is="#7b1fa2",Fs="#e57373",Ps="#ef5350",Rs="#f44336",Ls="#d32f2f",Bs="#c62828",Vs="#ffb74d",Hs="#ffa726",Ws="#ff9800",Us="#f57c00",Gs="#e65100",Ks="#e3f2fd",Zs="#90caf9",Js="#42a5f5",Ys="#1976d2",Xs="#1565c0",Qs="#4fc3f7",el="#29b6f6",al="#03a9f4",rl="#0288d1",nl="#01579b",il="#81c784",tl="#66bb6a",ol="#4caf50",sl="#388e3c",ll="#2e7d32",cl="#1b5e20",dl=["mode","contrastThreshold","tonalOffset"],ul={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:Es.white,default:Es.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},hl={text:{primary:Es.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:Es.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function ml(e,a,r,n){const i=n.light||n,t=n.dark||1.5*n;e[a]||(e.hasOwnProperty(r)?e[a]=e[r]:"light"===a?e.light=bs(e.main,i):"dark"===a&&(e.dark=gs(e.main,t)))}function gl(e){const{mode:a="light",contrastThreshold:r=3,tonalOffset:n=.2}=e,i=kn(e,dl),t=e.primary||function(e="light"){return"dark"===e?{main:Zs,light:Ks,dark:Js}:{main:Ys,light:Js,dark:Xs}}(a),o=e.secondary||function(e="light"){return"dark"===e?{main:As,light:_s,dark:Ns}:{main:Ts,light:Ds,dark:Is}}(a),s=e.error||function(e="light"){return"dark"===e?{main:Rs,light:Fs,dark:Ls}:{main:Ls,light:Ps,dark:Bs}}(a),l=e.info||function(e="light"){return"dark"===e?{main:el,light:Qs,dark:rl}:{main:rl,light:al,dark:nl}}(a),c=e.success||function(e="light"){return"dark"===e?{main:tl,light:il,dark:sl}:{main:ll,light:ol,dark:cl}}(a),d=e.warning||function(e="light"){return"dark"===e?{main:Hs,light:Vs,dark:Us}:{main:"#ed6c02",light:Ws,dark:Gs}}(a);function u(e){const a=ps(e,hl.text.primary)>=r?hl.text.primary:ul.text.primary;if("production"!==process.env.NODE_ENV){const r=ps(e,a);r<3&&console.error([`MUI: The contrast ratio of ${r}:1 for ${a} on ${e}`,"falls below the WCAG recommended absolute minimum contrast ratio of 3:1.","https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-contrast"].join("\n"))}return a}const h=({color:e,name:a,mainShade:r=500,lightShade:i=300,darkShade:t=700})=>{if(!(e=fn({},e)).main&&e[r]&&(e.main=e[r]),!e.hasOwnProperty("main"))throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${a?` (${a})`:""} provided to augmentColor(color) is invalid.\nThe color object needs to have a \`main\` property or a \`${r}\` property.`:pn(11,a?` (${a})`:"",r));if("string"!=typeof e.main)throw new Error("production"!==process.env.NODE_ENV?`MUI: The color${a?` (${a})`:""} provided to augmentColor(color) is invalid.\n\`color.main\` should be a string, but \`${JSON.stringify(e.main)}\` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from "@mui/material/colors";\n\nconst theme1 = createTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createTheme({ palette: {\n primary: { main: green[500] },\n} });`:pn(12,a?` (${a})`:"",JSON.stringify(e.main)));return ml(e,"light",i,n),ml(e,"dark",t,n),e.contrastText||(e.contrastText=u(e.main)),e},m={dark:hl,light:ul};"production"!==process.env.NODE_ENV&&(m[a]||console.error(`MUI: The palette mode \`${a}\` is not supported.`));return es(fn({common:fn({},Es),mode:a,primary:h({color:t,name:"primary"}),secondary:h({color:o,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:h({color:s,name:"error"}),warning:h({color:d,name:"warning"}),info:h({color:l,name:"info"}),success:h({color:c,name:"success"}),grey:Ms,contrastThreshold:r,getContrastText:u,augmentColor:h,tonalOffset:n},m[a]),i)}const pl=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"];const bl={textTransform:"uppercase"},fl='"Roboto", "Helvetica", "Arial", sans-serif';function kl(e,a){const r="function"==typeof a?a(e):a,{fontFamily:n=fl,fontSize:i=14,fontWeightLight:t=300,fontWeightRegular:o=400,fontWeightMedium:s=500,fontWeightBold:l=700,htmlFontSize:c=16,allVariants:d,pxToRem:u}=r,h=kn(r,pl);"production"!==process.env.NODE_ENV&&("number"!=typeof i&&console.error("MUI: `fontSize` is required to be a number."),"number"!=typeof c&&console.error("MUI: `htmlFontSize` is required to be a number."));const m=i/14,g=u||(e=>e/c*m+"rem"),p=(e,a,r,i,t)=>{return fn({fontFamily:n,fontWeight:e,fontSize:g(a),lineHeight:r},n===fl?{letterSpacing:(o=i/a,Math.round(1e5*o)/1e5)+"em"}:{},t,d);var o},b={h1:p(t,96,1.167,-1.5),h2:p(t,60,1.2,-.5),h3:p(o,48,1.167,0),h4:p(o,34,1.235,.25),h5:p(o,24,1.334,0),h6:p(s,20,1.6,.15),subtitle1:p(o,16,1.75,.15),subtitle2:p(s,14,1.57,.1),body1:p(o,16,1.5,.15),body2:p(o,14,1.43,.15),button:p(s,14,1.75,.4,bl),caption:p(o,12,1.66,.4),overline:p(o,12,2.66,1,bl),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return es(fn({htmlFontSize:c,pxToRem:g,fontFamily:n,fontSize:i,fontWeightLight:t,fontWeightRegular:o,fontWeightMedium:s,fontWeightBold:l},b),h,{clone:!1})}function yl(...e){return[`${e[0]}px ${e[1]}px ${e[2]}px ${e[3]}px rgba(0,0,0,0.2)`,`${e[4]}px ${e[5]}px ${e[6]}px ${e[7]}px rgba(0,0,0,0.14)`,`${e[8]}px ${e[9]}px ${e[10]}px ${e[11]}px rgba(0,0,0,0.12)`].join(",")}const vl=["none",yl(0,2,1,-1,0,1,1,0,0,1,3,0),yl(0,3,1,-2,0,2,2,0,0,1,5,0),yl(0,3,3,-2,0,3,4,0,0,1,8,0),yl(0,2,4,-1,0,4,5,0,0,1,10,0),yl(0,3,5,-1,0,5,8,0,0,1,14,0),yl(0,3,5,-1,0,6,10,0,0,1,18,0),yl(0,4,5,-2,0,7,10,1,0,2,16,1),yl(0,5,5,-3,0,8,10,1,0,3,14,2),yl(0,5,6,-3,0,9,12,1,0,3,16,2),yl(0,6,6,-3,0,10,14,1,0,4,18,3),yl(0,6,7,-4,0,11,15,1,0,4,20,3),yl(0,7,8,-4,0,12,17,2,0,5,22,4),yl(0,7,8,-4,0,13,19,2,0,5,24,4),yl(0,7,9,-4,0,14,21,2,0,5,26,4),yl(0,8,9,-5,0,15,22,2,0,6,28,5),yl(0,8,10,-5,0,16,24,2,0,6,30,5),yl(0,8,11,-5,0,17,26,2,0,6,32,5),yl(0,9,11,-5,0,18,28,2,0,7,34,6),yl(0,9,12,-6,0,19,29,2,0,7,36,6),yl(0,10,13,-6,0,20,31,3,0,8,38,7),yl(0,10,13,-6,0,21,33,3,0,8,40,7),yl(0,10,14,-6,0,22,35,3,0,8,42,7),yl(0,11,14,-7,0,23,36,3,0,9,44,8),yl(0,11,15,-7,0,24,38,3,0,9,46,8)],wl=["duration","easing","delay"],zl={easeInOut:"cubic-bezier(0.4, 0, 0.2, 1)",easeOut:"cubic-bezier(0.0, 0, 0.2, 1)",easeIn:"cubic-bezier(0.4, 0, 1, 1)",sharp:"cubic-bezier(0.4, 0, 0.6, 1)"},jl={shortest:150,shorter:200,short:250,standard:300,complex:375,enteringScreen:225,leavingScreen:195};function xl(e){return`${Math.round(e)}ms`}function $l(e){if(!e)return 0;const a=e/36;return Math.round(10*(4+15*a**.25+a/5))}function ql(e){const a=fn({},zl,e.easing),r=fn({},jl,e.duration);return fn({getAutoHeightDuration:$l,create:(e=["all"],n={})=>{const{duration:i=r.standard,easing:t=a.easeInOut,delay:o=0}=n,s=kn(n,wl);if("production"!==process.env.NODE_ENV){const a=e=>"string"==typeof e,r=e=>!isNaN(parseFloat(e));a(e)||Array.isArray(e)||console.error('MUI: Argument "props" must be a string or Array.'),r(i)||a(i)||console.error(`MUI: Argument "duration" must be a number or a string but found ${i}.`),a(t)||console.error('MUI: Argument "easing" must be a string.'),r(o)||a(o)||console.error('MUI: Argument "delay" must be a number or a string.'),"object"!=typeof n&&console.error(["MUI: Secong argument of transition.create must be an object.","Arguments should be either `create('prop1', options)` or `create(['prop1', 'prop2'], options)`"].join("\n")),0!==Object.keys(s).length&&console.error(`MUI: Unrecognized argument(s) [${Object.keys(s).join(",")}].`)}return(Array.isArray(e)?e:[e]).map((e=>`${e} ${"string"==typeof i?i:xl(i)} ${t} ${"string"==typeof o?o:xl(o)}`)).join(",")}},e,{easing:a,duration:r})}const Cl={mobileStepper:1e3,fab:1050,speedDial:1050,appBar:1100,drawer:1200,modal:1300,snackbar:1400,tooltip:1500},Sl=["breakpoints","mixins","spacing","palette","transitions","typography","shape"];const Ol=function(e={},...a){const{mixins:r={},palette:n={},transitions:i={},typography:t={}}=e,o=kn(e,Sl);if(e.vars)throw new Error("production"!==process.env.NODE_ENV?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name.":pn(18));const s=gl(n),l=uo(e);let c=es(l,{mixins:ts(l.breakpoints,r),palette:s,shadows:vl.slice(),typography:kl(s,t),transitions:ql(i),zIndex:fn({},Cl)});if(c=es(c,o),c=a.reduce(((e,a)=>es(e,a)),c),"production"!==process.env.NODE_ENV){const e=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],a=(a,r)=>{let n;for(n in a){const i=a[n];if(-1!==e.indexOf(n)&&Object.keys(i).length>0){if("production"!==process.env.NODE_ENV){const e=is("",n);console.error([`MUI: The \`${r}\` component increases the CSS specificity of the \`${n}\` internal state.`,"You can not override it like this: ",JSON.stringify(a,null,2),"",`Instead, you need to use the '&.${e}' syntax:`,JSON.stringify({root:{[`&.${e}`]:i}},null,2),"","https://mui.com/r/state-classes-guide"].join("\n"))}a[n]={}}}};Object.keys(c.components).forEach((e=>{const r=c.components[e].styleOverrides;r&&0===e.indexOf("Mui")&&a(r,e)}))}return c.unstable_sxConfig=fn({},to,null==o?void 0:o.unstable_sxConfig),c.unstable_sx=function(e){return so({sx:e,theme:this})},c}();function El(){const a=function(e=go){return mo(e)}(Ol);return"production"!==process.env.NODE_ENV&&e.useDebugValue(a),a[bn]||a}var Ml,_l={},Al={exports:{}};var Dl,Nl={exports:{}};var Tl=ca(et),Il=ca(it),Fl=ca(gt),Pl=ca(Oo),Rl=ca(ho),Ll=ca(bo),Bl=ds;Object.defineProperty(_l,"__esModule",{value:!0});var Vl=_l.default=function(e={}){const{themeId:a,defaultTheme:r=nc,rootShouldForwardProp:n=rc,slotShouldForwardProp:i=rc}=e,t=e=>(0,Yl.default)((0,Hl.default)({},e,{theme:tc((0,Hl.default)({},e,{defaultTheme:r,themeId:a}))}));return t.__mui_systemSx=!0,(e,o={})=>{(0,Ul.internal_processStyles)(e,(e=>e.filter((e=>!(null!=e&&e.__mui_systemSx)))));const{name:s,slot:l,skipVariantsResolver:c,skipSx:d,overridesResolver:u=oc(ic(l))}=o,h=(0,Wl.default)(o,ec),m=void 0!==c?c:l&&"Root"!==l&&"root"!==l||!1,g=d||!1;let p;"production"!==process.env.NODE_ENV&&s&&(p=`${s}-${ic(l||"Root")}`);let b=rc;"Root"===l||"root"===l?b=n:l?b=i:function(e){return"string"==typeof e&&e.charCodeAt(0)>96}(e)&&(b=void 0);const f=(0,Ul.default)(e,(0,Hl.default)({shouldForwardProp:b,label:p},h)),k=e=>"function"==typeof e&&e.__emotion_real!==e||(0,Gl.isPlainObject)(e)?n=>sc(e,(0,Hl.default)({},n,{theme:tc({theme:n.theme,defaultTheme:r,themeId:a})})):e,y=(n,...i)=>{let o=k(n);const c=i?i.map(k):[];s&&u&&c.push((e=>{const n=tc((0,Hl.default)({},e,{defaultTheme:r,themeId:a}));if(!n.components||!n.components[s]||!n.components[s].styleOverrides)return null;const i=n.components[s].styleOverrides,t={};return Object.entries(i).forEach((([a,r])=>{t[a]=sc(r,(0,Hl.default)({},e,{theme:n}))})),u(e,t)})),s&&!m&&c.push((e=>{var n;const i=tc((0,Hl.default)({},e,{defaultTheme:r,themeId:a}));return sc({variants:null==i||null==(n=i.components)||null==(n=n[s])?void 0:n.variants},(0,Hl.default)({},e,{theme:i}))})),g||c.push(t);const d=c.length-i.length;if(Array.isArray(n)&&d>0){const e=new Array(d).fill("");o=[...n,...e],o.raw=[...n.raw,...e]}const h=f(o,...c);if("production"!==process.env.NODE_ENV){let a;s&&(a=`${s}${(0,Kl.default)(l||"")}`),void 0===a&&(a=`Styled(${(0,Zl.default)(e)})`),h.displayName=a}return e.muiName&&(h.muiName=e.muiName),h};return f.withConfig&&(y.withConfig=f.withConfig),y}};_l.shouldForwardProp=rc,_l.systemDefaultTheme=void 0;var Hl=Bl((Ml||(Ml=1,function(e){function a(){return e.exports=a=Object.assign?Object.assign.bind():function(e){for(var a=1;a<arguments.length;a++){var r=arguments[a];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},e.exports.__esModule=!0,e.exports.default=e.exports,a.apply(null,arguments)}e.exports=a,e.exports.__esModule=!0,e.exports.default=e.exports}(Al)),Al.exports)),Wl=Bl((Dl||(Dl=1,function(e){e.exports=function(e,a){if(null==e)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(a.includes(n))continue;r[n]=e[n]}return r},e.exports.__esModule=!0,e.exports.default=e.exports}(Nl)),Nl.exports)),Ul=function(e,a){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=ac(a);if(r&&r.has(e))return r.get(e);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var t in e)if("default"!==t&&Object.prototype.hasOwnProperty.call(e,t)){var o=i?Object.getOwnPropertyDescriptor(e,t):null;o&&(o.get||o.set)?Object.defineProperty(n,t,o):n[t]=e[t]}return n.default=e,r&&r.set(e,n),n}(Tl),Gl=Il,Kl=Bl(Fl),Zl=Bl(Pl),Jl=Bl(Rl),Yl=Bl(Ll);const Xl=["ownerState"],Ql=["variants"],ec=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function ac(e){if("function"!=typeof WeakMap)return null;var a=new WeakMap,r=new WeakMap;return(ac=function(e){return e?r:a})(e)}function rc(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}const nc=_l.systemDefaultTheme=(0,Jl.default)(),ic=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function tc({defaultTheme:e,theme:a,themeId:r}){return n=a,0===Object.keys(n).length?e:a[r]||a;var n}function oc(e){return e?(a,r)=>r[e]:null}function sc(e,a){let{ownerState:r}=a,n=(0,Wl.default)(a,Xl);const i="function"==typeof e?e((0,Hl.default)({ownerState:r},n)):e;if(Array.isArray(i))return i.flatMap((e=>sc(e,(0,Hl.default)({ownerState:r},n))));if(i&&"object"==typeof i&&Array.isArray(i.variants)){const{variants:e=[]}=i;let a=(0,Wl.default)(i,Ql);return e.forEach((e=>{let i=!0;"function"==typeof e.props?i=e.props((0,Hl.default)({ownerState:r},n,r)):Object.keys(e.props).forEach((a=>{(null==r?void 0:r[a])!==e.props[a]&&n[a]!==e.props[a]&&(i=!1)})),i&&(Array.isArray(a)||(a=[a]),a.push("function"==typeof e.style?e.style((0,Hl.default)({ownerState:r},n,r)):e.style))})),a}return i}const lc=Vl({themeId:bn,defaultTheme:Ol,rootShouldForwardProp:e=>function(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}(e)&&"classes"!==e}),cc=["theme"];function dc(e){let{theme:a}=e,r=kn(e,cc);const n=a[bn];return pa.jsx(Yo,fn({},r,{themeId:n?bn:void 0,theme:n||a}))}"production"!==process.env.NODE_ENV&&(dc.propTypes={children:Wn.node,theme:Wn.oneOfType([Wn.object,Wn.func]).isRequired});const uc=()=>{const e=El();return[...e.breakpoints.keys].reduce(((a,r)=>No(e.breakpoints.up(r))?r:a),null)??"sm"},hc=({breakpoint:e})=>{const a=f(),r=Array.from({length:6},((e,a)=>a));return e||(e=uc()),pa.jsxs(v,{sx:{alignItems:"center",height:"100%",left:0,pointerEvents:"none",position:"fixed",top:0,width:"100%",zIndex:({zIndex:e})=>e.tooltip},children:[pa.jsx(A,{sx:{background:a.custom.palette.red[300],display:"flex",flex:1,opacity:.3,position:"relative"},children:pa.jsx(q,{sx:{background:a.custom.palette.purple[300],display:"flex",flex:1},children:pa.jsxs(I,{container:!0,spacing:2,children:[r.map((e=>pa.jsx(I,{item:!0,sm:!0,sx:{display:{sm:"none",md:"block"}},children:pa.jsx(q,{sx:{background:a.custom.palette.green[300],height:"100%"}})},`grid-1-${e}`))),r.map((e=>pa.jsx(I,{item:!0,sm:!0,sx:{display:{sm:"block"}},children:pa.jsx(q,{sx:{background:a.custom.palette.green[300],height:"100%"}})},`grid-2-${e}`)))]})})}),!!e&&pa.jsx(q,{sx:{backgroundColor:a.custom.palette.surface.default,borderRadius:a.spacing(a.custom.radius.md),bottom:16,filter:a.custom.elevationFilter.raised,display:"block",left:16,position:"fixed",px:2,py:1},children:pa.jsx(yr,{variation:"sm",component:"p",weight:"bold",children:e})})]})},mc=e=>({backgroundColor:e.custom.palette.interaction.none,color:e.custom.palette.icon.primary}),gc=e=>({backgroundColor:e.custom.palette.purple[100],color:e.custom.palette.icon.primary,"&:hover":{"&:before":{background:e.custom.palette.interaction.hoverOnDark}},"&:active":{"&:before":{background:e.custom.palette.interaction.pressOnDark}}}),pc=e=>({backgroundColor:e.custom.palette.surface.raised,border:`1px solid ${e.custom.palette.stroke.default}`,color:e.custom.palette.icon.primary,"&.MuiIconButton-root:disabled":{border:"none"}}),bc=e=>({backgroundColor:e.custom.palette.surface.raised,boxShadow:e.custom.elevation.raised,color:e.custom.palette.icon.primary,"&:focus-visible:after":{boxShadow:e.custom.boxShadow.input.focus},"&.MuiIconButton-root:disabled":{boxShadow:"none"}}),fc=(e,a)=>({borderRadius:"default"===e?a.spacing(a.custom.radius.md):a.custom.radius.round}),kc={xs:3*qa,sm:3.5*qa,md:4*qa,lg:5*qa,xl:6*qa},yc=e=>({height:kc[e],width:kc[e]}),vc={xs:2*qa,sm:2*qa,md:2*qa,lg:2.5*qa,xl:3*qa},wc=e=>({height:vc[e],width:vc[e]}),zc=j(R)((({theme:e,variation:a,shape:r="default",sizing:n})=>({boxSizing:"border-box",transition:"all 200ms ease","&:before, &:after":{...r&&{...fc(r,e)},transition:"all 250ms ease",content:'""',position:"absolute",inset:0},"&:hover:before":{backgroundColor:e.custom.palette.interaction.hover},"&:focus:before":{backgroundColor:e.custom.palette.interaction.hover},"&:active:before":{backgroundColor:e.custom.palette.interaction.press},"&:focus-visible":{boxShadow:e.custom.boxShadow.input.focus},...r&&{...fc(r,e)},...n&&{...yc(n)},"&.MuiIconButton-root":{..."default"===a&&{...mc(e)},..."toggle"===a&&{...gc(e)},..."outlined"===a&&{...pc(e)},..."raised"===a&&{...bc(e)},"&:disabled":{backgroundColor:e.custom.palette.interaction.disabled,color:e.custom.palette.icon.disabled}},"& .MuiSvgIcon-root":{...n&&{...wc(n)},position:"relative",zIndex:1}}))),jc=({icon:e,loading:a,sizing:r,...n})=>pa.jsx(zc,{...n,sizing:r,children:a?pa.jsx(Pr,{sizing:r}):e}),xc=(e,a)=>({"&:after":{content:'""',position:"absolute",bottom:0,width:0,height:1,borderBottom:`1px solid ${e.custom.palette.stroke.default}`,background:"grey"},borderRadius:0,"&:first-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderBottomLeftRadius:0,borderBottomRightRadius:0},"&:last-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopRightRadius:0,borderTopLeftRadius:0,"&:after":{content:"none"}}}),$c=(e,a)=>({"&:after":{content:'""',position:"absolute",right:0,width:1,height:0,borderRight:`1px solid ${e.custom.palette.stroke.default}`,background:"grey"},borderRadius:0,"&:first-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopRightRadius:0,borderBottomRightRadius:0},"&:last-of-type":{borderRadius:e.spacing(e.custom.radius.md),borderTopLeftRadius:0,borderBottomLeftRadius:0,"&:after":{content:"none"}}}),qc=j(L)((({theme:e,variation:a,orientation:r="horizontal",iconColor:n,sizing:i="lg",groupRaised:t=!1})=>({"&.MuiButtonGroup-root":{border:`1px solid ${e.custom.palette.stroke.default}`,...t&&{boxShadow:e.custom.elevation.raised,border:"none"},"& > button":{..."default"===a&&{...mc(e)},..."toggle"===a&&{...gc(e)},..."vertical"===r&&{...xc(e)},..."horizontal"===r&&{...$c(e)},...i&&{...yc(i)}},"& .MuiSvgIcon-root":{...i&&{...wc(i)},fill:n||"inherit"}}}))),Cc=({ButtonGroupProps:e,children:a,...r})=>pa.jsx(qc,{...r,...e,children:a}),Sc=({sx:e,...a})=>pa.jsx(an,{...a,sx:ba({fontSize:{xs:qr.sm.body.md,sm:qr.sm.body.md,md:qr.sm.body.md,lg:qr.lg.body.md,xl:qr.lg.body.md}},!!e&&{...e})}),Oc=j(q)((({theme:e})=>({"& .MuiGrid-item":{"&:first-of-type":{"& .MuiBox-root":{"&:before":{width:wa,borderRadius:e.custom.radius.round,right:"50%",transform:`translateX(-${wa}px)`,left:"auto"}}},"&:last-child":{"& .MuiBox-root":{"&:after":{width:wa,borderRadius:e.custom.radius.round,right:"auto",left:"50%",transform:`translateX(${wa}px)`}}}}}))),Ec=({children:e,width:a})=>pa.jsx(Oc,{sx:{width:a},children:e}),Mc=j(rn)((()=>({lineHeight:"110%",textAlign:"center",width:"100%"}))),_c=({disabled:e,children:a})=>pa.jsx(Mc,{showicon:!1,disabled:e,sx:{cursor:"inherit"},children:a}),Ac=j(sn)((()=>({marginRight:0}))),Dc=j(q)((({theme:e})=>({posiion:"relative","&:before":{content:'""',position:"absolute",top:"50%",left:0,height:ya,width:`calc(50% - ${ja/2}px)`,zIndex:0,backgroundColor:e.custom.palette.stroke.default},"&:after":{content:'""',position:"absolute",top:"50%",right:0,height:ya,width:`calc(50% - ${ja/2}px)`,zIndex:0,backgroundColor:e.custom.palette.stroke.default}}))),Nc=e=>pa.jsx(Dc,{sx:{textAlign:"center",position:"relative"},children:pa.jsx(Ac,{...e})}),Tc=({options:e=[],disabled:a=!1,sizing:r="lg",onChange:n,internalChange:i,value:t})=>{const o=f();function s(e){console.warn(e),n(e.value),i&&i()}return pa.jsx(q,{children:pa.jsx(Ec,{children:pa.jsx(I,{container:!0,justifyContent:"space-between",children:e.map((e=>pa.jsxs(I,{item:!0,sm:!0,onClick:()=>s(e),sx:{cursor:"pointer",textAlign:"center","&:hover":{"& .MuiButtonBase-root.MuiRadio-root":{"&:before":{backgroundColor:o.custom.palette.interaction.hover}}},"&:active":{"& .MuiButtonBase-root.MuiRadio-root":{backgroundColor:o.custom.palette.input.default,borderColor:o.custom.palette.stroke.focus,boxShadow:o.custom.boxShadow.input.focus,"&:before":{backgroundColor:o.custom.palette.interaction.press},"&.Mui-checked":{backgroundColor:o.custom.palette.purple[500]}}}},children:[pa.jsx(Nc,{sizing:r,disabled:a,onChange:a=>s(e),checked:t===e.value},e.value),pa.jsx(q,{sx:{mt:Ca.xs,width:"100%"},children:pa.jsx(_c,{disabled:a,children:e.label})})]},e.value)))})})})},Ic=j(B)((({theme:e,disabled:a})=>({"&:focus-visible":{boxShadow:e.custom.boxShadow.input.focus,borderRadius:e.spacing(e.custom.radius.sm),outline:"none"},"&.MuiLink-root":{transition:"all 200ms ease",display:"inline",cursor:"pointer",color:a?e.custom.palette.text.lockedWhite:e.custom.palette.text.textLink,textDecorationColor:e.custom.palette.text.textLink,pointerEvents:a?"none":"auto","&:hover":{color:a?e.custom.palette.text.disabled:e.custom.palette.text.textLinkHover,textDecorationColor:a?e.custom.palette.text.disabled:e.custom.palette.text.textLinkHover},"&:active":{color:e.custom.palette.text.textLinkHover,textDecorationColor:e.custom.palette.text.textLinkHover},"&:visited":{color:a?e.custom.palette.text.disabled:e.custom.palette.text.textLink,textDecorationColor:a?e.custom.palette.text.disabled:e.custom.palette.text.textLink}}}))),Fc=e=>e.target&&"_blank"===e.target?pa.jsx(Ic,{rel:"noopener",...e}):pa.jsx(Ic,{...e}),Pc=()=>pa.jsx(q,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"calc(100dvh - 80px)"},children:pa.jsx("img",{src:"https://useloops-public.s3.eu-west-2.amazonaws.com/public/landing/brand/loading-animation.gif",width:125})}),Rc=e=>pa.jsx("svg",{viewBox:"0 0 80 25",fill:"currentColor",...e,children:pa.jsx("path",{d:"M8.72886 20.0975C7.43461 19.1995 7.16357 18.9302 7.16357 16.9549V0.988281H-0.000106812V1.28748L0.0165316 1.29764C1.3293 2.09875 1.92633 2.46309 1.92633 4.43011V16.9549C1.92633 18.9302 1.65553 19.1995 0.361043 20.0975V20.3965H8.72886V20.0975ZM14.5709 13.437C13.7868 9.01598 14.1045 7.0153 16.0905 6.66718C18.0767 6.31907 19.0631 8.09095 19.8472 12.512C20.6311 16.933 20.3137 18.9335 18.3275 19.2816C16.3415 19.6299 15.3548 17.8578 14.5709 13.437ZM9.11663 14.3934C9.93203 18.9911 14.141 21.3529 18.5575 20.5785C22.9743 19.8041 26.1169 16.1534 25.3015 11.5559C24.4861 6.95793 20.2773 4.5961 15.8605 5.3705C11.444 6.14467 8.30123 9.79541 9.11663 14.3934ZM33.3669 6.66718C31.381 7.0153 31.0633 9.01598 31.8474 13.437C32.6313 17.8578 33.618 19.6299 35.6039 19.2816C37.5901 18.9335 37.9076 16.933 37.1237 12.512C36.3396 8.09095 35.3531 6.31907 33.3669 6.66718ZM35.834 20.5785C31.4175 21.3529 27.2085 18.9911 26.3931 14.3934C25.5777 9.79541 28.7205 6.14467 33.137 5.3705C37.5538 4.5961 41.7625 6.95793 42.5779 11.5559C43.3933 16.1534 40.2508 19.8041 35.834 20.5785ZM52.9075 18.9002C51.0712 18.9002 49.6266 16.8353 49.6266 14.441V12.3162C49.6266 9.6524 50.9209 7.64737 52.9075 7.64737C54.9843 7.64737 56.0078 9.53285 56.0078 12.7351C56.0078 16.955 54.9542 18.9002 52.9075 18.9002ZM51.6733 24.5936C50.1696 23.7488 49.6266 23.4437 49.6266 21.5189V17.9125C50.4091 19.4689 51.9744 20.6958 54.5629 20.6958C58.476 20.6958 61.5762 17.763 61.5762 12.7052C61.5762 7.55754 58.5663 5.25308 55.1047 5.25308C52.2753 5.25308 50.3187 6.83937 49.6266 9.02405L49.5063 5.55228H42.5833V5.85171L42.5873 5.85427C43.8786 6.69033 44.3891 7.02081 44.3891 8.99411V21.5189C44.3891 23.4942 44.1183 23.7637 42.824 24.6613V24.9605H51.7937V24.6613L51.6733 24.5936ZM79.8954 18.9002C79.8954 19.8689 79.1055 20.6543 78.1313 20.6543C77.157 20.6543 76.3671 19.8689 76.3671 18.9002C76.3671 17.9315 77.157 17.1462 78.1313 17.1462C79.1055 17.1462 79.8954 17.9315 79.8954 18.9002ZM70.0692 10.2734C68.0387 9.67975 66.9044 9.34812 66.9044 8.15614C66.9044 7.16849 67.8074 6.71957 68.8309 6.71957C70.7874 6.71957 72.3224 7.827 74.0985 10.4007H74.5196V5.25306H74.2187L72.8642 6.24072C72.8031 6.21577 72.742 6.19075 72.681 6.16573C71.5696 5.71024 70.454 5.25306 68.7707 5.25306C65.55 5.25306 62.9916 7.22837 62.9916 10.1612C62.9916 12.795 64.2557 14.2912 68.8008 15.4585C70.4863 15.8775 71.6601 16.1767 71.6601 17.4636C71.6601 18.6608 70.4863 19.2293 69.0718 19.2293C66.9044 19.2293 65.3093 17.763 63.2021 14.9797H62.7509L63.0819 20.6661H63.413L64.6169 19.4688C65.5801 19.9477 67.0851 20.6958 69.1019 20.6958C72.9546 20.6958 75.6334 18.571 75.6334 15.5783C75.6334 12.4956 73.7672 11.3584 70.095 10.2809L70.0692 10.2734Z"})});function Lc(e,a){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&a.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)a.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}var Bc;function Vc(){}function Hc(e){return!!(e||"").match(/\d/)}function Wc(e){return null==e}function Uc(e){return Wc(e)||function(e){return"number"==typeof e&&isNaN(e)}(e)||"number"==typeof e&&!isFinite(e)}function Gc(e){return e.replace(/[-[\]/{}()*+?.\\^$|]/g,"\\$&")}function Kc(e,a){void 0===a&&(a=!0);var r="-"===e[0],n=r&&a,i=(e=e.replace("-","")).split(".");return{beforeDecimal:i[0],afterDecimal:i[1]||"",hasNegation:r,addNegation:n}}function Zc(e,a,r){for(var n="",i=r?"0":"",t=0;t<=a-1;t++)n+=e[t]||i;return n}function Jc(e,a){return Array(a+1).join(e)}function Yc(e){var a=e+"",r="-"===a[0]?"-":"";r&&(a=a.substring(1));var n=a.split(/[eE]/g),i=n[0],t=n[1];if(!(t=Number(t)))return r+i;var o=1+t,s=(i=i.replace(".","")).length;return o<0?i="0."+Jc("0",Math.abs(o))+i:o>=s?i+=Jc("0",o-s):i=(i.substring(0,o)||"0")+"."+i.substring(o),r+i}function Xc(e,a,r){if(-1!==["","-"].indexOf(e))return e;var n=(-1!==e.indexOf(".")||r)&&a,i=Kc(e),t=i.beforeDecimal,o=i.afterDecimal,s=i.hasNegation,l=parseFloat("0."+(o||"0")),c=(o.length<=a?"0."+o:l.toFixed(a)).split("."),d=t;return t&&Number(c[0])&&(d=t.split("").reverse().reduce((function(e,a,r){return e.length>r?(Number(e[0])+Number(a)).toString()+e.substring(1,e.length):a+e}),c[0])),""+(s?"-":"")+d+(n?".":"")+Zc(c[1]||"",a,r)}function Qc(e,a){if(e.value=e.value,null!==e){if(e.createTextRange){var r=e.createTextRange();return r.move("character",a),r.select(),!0}return e.selectionStart||0===e.selectionStart?(e.focus(),e.setSelectionRange(a,a),!0):(e.focus(),!1)}}!function(e){e.event="event",e.props="prop"}(Bc||(Bc={}));var ed,ad,rd,nd=(ed=function(e,a){for(var r=0,n=0,i=e.length,t=a.length;e[r]===a[r]&&r<i;)r++;for(;e[i-1-n]===a[t-1-n]&&t-n>r&&i-n>r;)n++;return{from:{start:r,end:i-n},to:{start:r,end:t-n}}},rd=void 0,function(){for(var e=[],a=arguments.length;a--;)e[a]=arguments[a];return ad&&e.length===ad.length&&e.every((function(e,a){return e===ad[a]}))?rd:(ad=e,rd=ed.apply(void 0,e))});function id(e){return Math.max(e.selectionStart,e.selectionEnd)}function td(e){var a=e.currentValue,r=e.formattedValue,n=e.currentValueIndex,i=e.formattedValueIndex;return a[n]===r[i]}function od(e,a,r,n){var i,t,o,s=e.length;if(i=a,t=0,o=s,a=Math.min(Math.max(i,t),o),"left"===n){for(;a>=0&&!r[a];)a--;-1===a&&(a=r.indexOf(!0))}else{for(;a<=s&&!r[a];)a++;a>s&&(a=r.lastIndexOf(!0))}return-1===a&&(a=s),a}function sd(e){for(var a=Array.from({length:e.length+1}).map((function(){return!0})),r=0,n=a.length;r<n;r++)a[r]=Boolean(Hc(e[r])||Hc(e[r-1]));return a}function ld(e,a,i,o,s,l){void 0===l&&(l=Vc);var c=function(e){var a=r(e);a.current=e;var n=r((function(){for(var e=[],r=arguments.length;r--;)e[r]=arguments[r];return a.current.apply(a,e)}));return n.current}((function(e,a){var r,n;return Uc(e)?(n="",r=""):"number"==typeof e||a?(n="number"==typeof e?Yc(e):e,r=o(n)):(n=s(e,void 0),r=o(n)),{formattedValue:r,numAsString:n}})),d=n((function(){return c(Wc(e)?a:e,i)})),u=d[0],h=d[1],m=e,g=i;Wc(e)&&(m=u.numAsString,g=!0);var p=c(m,g);return t((function(){h(p)}),[p.formattedValue]),[u,function(e,a){e.formattedValue!==u.formattedValue&&h({formattedValue:e.formattedValue,numAsString:e.value}),l(e,a)}]}function cd(e){return e.replace(/[^0-9]/g,"")}function dd(e){return e}function ud(e){var t=e.type;void 0===t&&(t="text");var s=e.displayType;void 0===s&&(s="input");var l=e.customInput,c=e.renderText,d=e.getInputRef,u=e.format;void 0===u&&(u=dd);var h=e.removeFormatting;void 0===h&&(h=cd);var m=e.defaultValue,g=e.valueIsNumericString,p=e.onValueChange,b=e.isAllowed,f=e.onChange;void 0===f&&(f=Vc);var k=e.onKeyDown;void 0===k&&(k=Vc);var y=e.onMouseUp;void 0===y&&(y=Vc);var v=e.onFocus;void 0===v&&(v=Vc);var w=e.onBlur;void 0===w&&(w=Vc);var z=e.value,j=e.getCaretBoundary;void 0===j&&(j=sd);var x=e.isValidInputCharacter;void 0===x&&(x=Hc);var $=e.isCharacterSame,q=Lc(e,["type","displayType","customInput","renderText","getInputRef","format","removeFormatting","defaultValue","valueIsNumericString","onValueChange","isAllowed","onChange","onKeyDown","onMouseUp","onFocus","onBlur","value","getCaretBoundary","isValidInputCharacter","isCharacterSame"]),C=ld(z,m,Boolean(g),u,h,p),S=C[0],O=S.formattedValue,E=S.numAsString,M=C[1],_=r(),A=r({formattedValue:O,numAsString:E}),D=function(e,a){A.current={formattedValue:e.formattedValue,numAsString:e.value},M(e,a)},N=n(!1),T=N[0],I=N[1],F=r(null),P=r({setCaretTimeout:null,focusTimeout:null});i((function(){return I(!0),function(){clearTimeout(P.current.setCaretTimeout),clearTimeout(P.current.focusTimeout)}}),[]);var R=u,L=function(e,a){var r=parseFloat(a);return{formattedValue:e,value:a,floatValue:isNaN(r)?void 0:r}},B=function(e,a,r){0===e.selectionStart&&e.selectionEnd===e.value.length||(Qc(e,a),P.current.setCaretTimeout=setTimeout((function(){e.value===r&&e.selectionStart!==a&&Qc(e,a)}),0))},V=function(e,a,r){return od(e,a,j(e),r)},H=function(e,a,r){var n=j(a),i=function(e,a,r,n,i,t,o){void 0===o&&(o=td);var s=i.findIndex((function(e){return e})),l=e.slice(0,s);a||r.startsWith(l)||(a=l,r=l+r,n+=l.length);for(var c=r.length,d=e.length,u={},h=new Array(c),m=0;m<c;m++){h[m]=-1;for(var g=0,p=d;g<p;g++)if(o({currentValue:r,lastValue:a,formattedValue:e,currentValueIndex:m,formattedValueIndex:g})&&!0!==u[g]){h[m]=g,u[g]=!0;break}}for(var b=n;b<c&&(-1===h[b]||!t(r[b]));)b++;var f=b===c||-1===h[b]?d:h[b];for(b=n-1;b>0&&-1===h[b];)b--;var k=-1===b||-1===h[b]?0:h[b]+1;return k>f?f:n-k<f-n?k:f}(a,O,e,r,n,x,$);return i=od(a,i,n)};i((function(){var e=A.current,a=e.formattedValue,r=e.numAsString;O===a&&E===r||D(L(O,E),{event:void 0,source:Bc.props})}),[O,E]);var W=F.current?id(F.current):void 0;("undefined"!=typeof window?o:i)((function(){var e=F.current;if(O!==A.current.formattedValue&&e){var a=H(A.current.formattedValue,O,W);e.value=O,B(e,a,O)}}),[O]);var U=function(e,a,r){var n=a.target,i=_.current?function(e,a){var r=Math.min(e.selectionStart,a);return{from:{start:r,end:e.selectionEnd},to:{start:r,end:a}}}(_.current,n.selectionEnd):nd(O,e),t=Object.assign(Object.assign({},i),{lastValue:O}),o=h(e,t),s=R(o);if(o=h(s,void 0),b&&!b(L(s,o))){var l=a.target,c=id(l),d=H(e,O,c);return l.value=O,B(l,d,O),!1}return function(e){var a=e.formattedValue;void 0===a&&(a="");var r,n=e.input,i=e.source,t=e.event,o=e.numAsString;if(n){var s=e.inputValue||n.value,l=id(n);n.value=a,void 0!==(r=H(s,a,l))&&B(n,r,a)}a!==O&&D(L(a,o),{event:t,source:i})}({formattedValue:s,numAsString:o,inputValue:e,event:a,source:r,input:a.target}),!0},G=function(e,a){void 0===a&&(a=0);var r=e.selectionStart,n=e.selectionEnd;_.current={selectionStart:r,selectionEnd:n+a}},K=!T||"undefined"==typeof navigator||navigator.platform&&/iPhone|iPod/.test(navigator.platform)?void 0:"numeric",Z=Object.assign({inputMode:K},q,{type:t,value:O,onChange:function(e){var a=e.target.value;U(a,e,Bc.event)&&f(e),_.current=void 0},onKeyDown:function(e){var a,r=e.target,n=e.key,i=r.selectionStart,t=r.selectionEnd,o=r.value;void 0===o&&(o=""),"ArrowLeft"===n||"Backspace"===n?a=Math.max(i-1,0):"ArrowRight"===n?a=Math.min(i+1,o.length):"Delete"===n&&(a=i);var s=0;"Delete"===n&&i===t&&(s=1);var l="ArrowLeft"===n||"ArrowRight"===n;if(void 0===a||i!==t&&!l)return k(e),void G(r,s);var c=a;l?(c=V(o,a,"ArrowLeft"===n?"left":"right"))!==a&&e.preventDefault():"Delete"!==n||x(o[a])?"Backspace"!==n||x(o[a])||(c=V(o,a,"left")):c=V(o,a,"right");c!==a&&B(r,c,o),k(e),G(r,s)},onMouseUp:function(e){var a=e.target,r=function(){var e=a.selectionStart,r=a.selectionEnd,n=a.value;if(void 0===n&&(n=""),e===r){var i=V(n,e);i!==e&&B(a,i,n)}};r(),requestAnimationFrame((function(){r()})),y(e),G(a)},onFocus:function(e){e.persist&&e.persist();var a=e.target,r=e.currentTarget;F.current=a,P.current.focusTimeout=setTimeout((function(){var n=a.selectionStart,i=a.selectionEnd,t=a.value;void 0===t&&(t="");var o=V(t,n);o===n||0===n&&i===t.length||B(a,o,t),v(Object.assign(Object.assign({},e),{currentTarget:r}))}),0)},onBlur:function(e){F.current=null,clearTimeout(P.current.focusTimeout),clearTimeout(P.current.setCaretTimeout),w(e)}});if("text"===s)return c?a.createElement(a.Fragment,null,c(O,q)||null):a.createElement("span",Object.assign({},q,{ref:d}),O);if(l){var J=l;return a.createElement(J,Object.assign({},Z,{ref:d}))}return a.createElement("input",Object.assign({},Z,{ref:d}))}function hd(e,a){var r=a.decimalScale,n=a.fixedDecimalScale,i=a.prefix;void 0===i&&(i="");var t=a.suffix;void 0===t&&(t="");var o=a.allowNegative,s=a.thousandsGroupStyle;if(void 0===s&&(s="thousand"),""===e||"-"===e)return e;var l=md(a),c=l.thousandSeparator,d=l.decimalSeparator,u=0!==r&&-1!==e.indexOf(".")||r&&n,h=Kc(e,o),m=h.beforeDecimal,g=h.afterDecimal,p=h.addNegation;return void 0!==r&&(g=Zc(g,r,!!n)),c&&(m=function(e,a,r){var n=function(e){switch(e){case"lakh":return/(\d+?)(?=(\d\d)+(\d)(?!\d))(\.\d+)?/g;case"wan":return/(\d)(?=(\d{4})+(?!\d))/g;default:return/(\d)(?=(\d{3})+(?!\d))/g}}(r),i=e.search(/[1-9]/);return i=-1===i?e.length:i,e.substring(0,i)+e.substring(i,e.length).replace(n,"$1"+a)}(m,c,s)),i&&(m=i+m),t&&(g+=t),p&&(m="-"+m),e=m+(u&&d||"")+g}function md(e){var a=e.decimalSeparator;void 0===a&&(a=".");var r=e.thousandSeparator,n=e.allowedDecimalSeparators;return!0===r&&(r=","),n||(n=[a,"."]),{decimalSeparator:a,thousandSeparator:r,allowedDecimalSeparators:n}}function gd(e,a,r){var n;void 0===a&&(a=function(e){return{from:{start:0,end:0},to:{start:0,end:e.length},lastValue:""}}(e));var i=r.allowNegative,t=r.prefix;void 0===t&&(t="");var o=r.suffix;void 0===o&&(o="");var s=r.decimalScale,l=a.from,c=a.to,d=c.start,u=c.end,h=md(r),m=h.allowedDecimalSeparators,g=h.decimalSeparator,p=e[u]===g;if(Hc(e)&&(e===t||e===o)&&""===a.lastValue)return e;if(u-d==1&&-1!==m.indexOf(e[d])){var b=0===s?"":g;e=e.substring(0,d)+b+e.substring(d+1,e.length)}var f=function(e,a,r){var n=!1,i=!1;t.startsWith("-")?n=!1:e.startsWith("--")?(n=!1,i=!0):o.startsWith("-")&&e.length===o.length?n=!1:"-"===e[0]&&(n=!0);var s=n?1:0;return i&&(s=2),s&&(e=e.substring(s),a-=s,r-=s),{value:e,start:a,end:r,hasNegation:n}},k=f(e,d,u),y=k.hasNegation;e=(n=k).value,d=n.start,u=n.end;var v=f(a.lastValue,l.start,l.end),w=v.start,z=v.end,j=v.value,x=e.substring(d,u);!(e.length&&j.length&&(w>j.length-o.length||z<t.length))||x&&o.startsWith(x)||(e=j);var $=0;e.startsWith(t)?$+=t.length:d<t.length&&($=d),u-=$;var q=(e=e.substring($)).length,C=e.length-o.length;e.endsWith(o)?q=C:(u>C||u>e.length-o.length)&&(q=u),e=e.substring(0,q),e=function(e,a){void 0===e&&(e="");var r=new RegExp("(-)"),n=new RegExp("(-)(.)*(-)"),i=r.test(e),t=n.test(e);return e=e.replace(/-/g,""),i&&!t&&a&&(e="-"+e),e}(y?"-"+e:e,i),e=(e.match(function(e){return new RegExp("(^-)|[0-9]|"+Gc(e),"g")}(g))||[]).join("");var S=e.indexOf(g);e=e.replace(new RegExp(Gc(g),"g"),(function(e,a){return a===S?".":""}));var O=Kc(e,i),E=O.beforeDecimal,M=O.afterDecimal,_=O.addNegation;return c.end-c.start<l.end-l.start&&""===E&&p&&!parseFloat(M)&&(e=_?"-":""),e}function pd(e){e=function(e){var a=md(e),r=a.thousandSeparator,n=a.decimalSeparator,i=e.prefix;void 0===i&&(i="");var t=e.allowNegative;if(void 0===t&&(t=!0),r===n)throw new Error("\n Decimal separator can't be same as thousand separator.\n thousandSeparator: "+r+' (thousandSeparator = {true} is same as thousandSeparator = ",")\n decimalSeparator: '+n+" (default value for decimalSeparator is .)\n ");return i.startsWith("-")&&t&&(console.error("\n Prefix can't start with '-' when allowNegative is true.\n prefix: "+i+"\n allowNegative: "+t+"\n "),t=!1),Object.assign(Object.assign({},e),{allowNegative:t})}(e),e.decimalSeparator,e.allowedDecimalSeparators,e.thousandsGroupStyle;var a=e.suffix,r=e.allowNegative,n=e.allowLeadingZeros,i=e.onKeyDown;void 0===i&&(i=Vc);var t=e.onBlur;void 0===t&&(t=Vc);var o=e.thousandSeparator,s=e.decimalScale,l=e.fixedDecimalScale,c=e.prefix;void 0===c&&(c="");var d=e.defaultValue,u=e.value,h=e.valueIsNumericString,m=e.onValueChange,g=Lc(e,["decimalSeparator","allowedDecimalSeparators","thousandsGroupStyle","suffix","allowNegative","allowLeadingZeros","onKeyDown","onBlur","thousandSeparator","decimalScale","fixedDecimalScale","prefix","defaultValue","value","valueIsNumericString","onValueChange"]),p=md(e),b=p.decimalSeparator,f=p.allowedDecimalSeparators,k=function(a){return hd(a,e)},y=function(a,r){return gd(a,r,e)},v=Wc(u)?d:u,w=null!=h?h:function(e,a,r){return""===e||!(null==a?void 0:a.match(/\d/))&&!(null==r?void 0:r.match(/\d/))&&"string"==typeof e&&!isNaN(Number(e))}(v,c,a);Wc(u)?Wc(d)||(w=w||"number"==typeof d):w=w||"number"==typeof u;var z=function(e){return Uc(e)?e:("number"==typeof e&&(e=Yc(e)),w&&"number"==typeof s?Xc(e,s,Boolean(l)):e)},j=ld(z(u),z(d),Boolean(w),k,y,m),x=j[0],$=x.numAsString,q=x.formattedValue,C=j[1];return Object.assign(Object.assign({},g),{value:q,valueIsNumericString:!1,isValidInputCharacter:function(e){return e===b||Hc(e)},isCharacterSame:function(e){var a=e.currentValue,r=e.lastValue,n=e.formattedValue,i=e.currentValueIndex,t=e.formattedValueIndex,o=a[i],d=n[t],h=nd(r,a).to,m=function(e){return y(e).indexOf(".")+c.length};return!(0===u&&l&&s&&a[h.start]===b&&m(a)<i&&m(n)>t)&&(!!(i>=h.start&&i<h.end&&f&&f.includes(o)&&d===b)||o===d)},onValueChange:C,format:k,removeFormatting:y,getCaretBoundary:function(a){return function(e,a){var r=a.prefix;void 0===r&&(r="");var n=a.suffix;void 0===n&&(n="");var i=Array.from({length:e.length+1}).map((function(){return!0})),t="-"===e[0];i.fill(!1,0,r.length+(t?1:0));var o=e.length;return i.fill(!1,o-n.length+1,o+1),i}(a,e)},onKeyDown:function(e){var a=e.target,n=e.key,t=a.selectionStart,d=a.selectionEnd,u=a.value;if(void 0===u&&(u=""),("Backspace"===n||"Delete"===n)&&d<c.length)e.preventDefault();else if(t===d){"Backspace"===n&&"-"===u[0]&&t===c.length+1&&r&&Qc(a,1),s&&l&&("Backspace"===n&&u[t-1]===b?(Qc(a,t-1),e.preventDefault()):"Delete"===n&&u[t]===b&&e.preventDefault()),(null==f?void 0:f.includes(n))&&u[t]===b&&Qc(a,t+1);var h=!0===o?",":o;"Backspace"===n&&u[t-1]===h&&Qc(a,t-1),"Delete"===n&&u[t]===h&&Qc(a,t+1),i(e)}else i(e)},onBlur:function(a){var r=$;if(r.match(/\d/g)||(r=""),n||(r=function(e){if(!e)return e;var a="-"===e[0];a&&(e=e.substring(1,e.length));var r=e.split("."),n=r[0].replace(/^0+/,"")||"0",i=r[1]||"";return(a?"-":"")+n+(i?"."+i:"")}(r)),l&&s&&(r=Xc(r,s,l)),r!==$){var i=hd(r,e);C({formattedValue:i,value:r,floatValue:parseFloat(r)},{event:a,source:Bc.event})}t(a)}})}function bd(e){var r=pd(e);return a.createElement(ud,Object.assign({},r))}const fd=(e,a,r)=>0===e||e?a&&e<a?a:r&&e>r?r:e:a||0,kd=s((({inputRef:e,onChange:a,name:r,min:i,max:t,value:o,...s},c)=>{const d=f(),[u,h]=n(fd(o,i,t)||0),m=e=>{h((a=>fd(e?a+1:a-1,i,t)))},g=l((()=>{const e=fd(u,i,t);a&&a({target:{value:e}}),h(e)}),[u]);return pa.jsxs(pa.Fragment,{children:[pa.jsx(bd,{...s,style:{width:"100%"},getInputRef:e,allowNegative:i&&Math.sign(i),autoFocus:!1,value:u,onValueChange:({floatValue:e})=>{h(e)},onBlurCapture:g}),pa.jsxs(v,{sx:{position:"absolute",top:0,right:0,height:"100%",ml:"auto",width:32,borderLeft:`1px solid ${d.custom.palette.stroke.default}`},children:[pa.jsx(V,{onClick:()=>m(!0),sx:{flex:1,borderTopRightRadius:d.spacing(d.custom.radius.md),fontSize:16,"&:hover":{background:d.custom.palette.interaction.hover}},children:pa.jsx(Oe,{fontSize:"inherit"})}),pa.jsx(H,{}),pa.jsx(V,{onClick:()=>m(!1),sx:{flex:1,borderBottomRightRadius:d.spacing(d.custom.radius.md),fontSize:16,"&:hover":{background:d.custom.palette.interaction.hover}},children:pa.jsx(Ee,{fontSize:"inherit"})})]})]})})),yd=({startAdornment:e,endAdornment:a,placeholder:r,onChange:n,internalChange:i,inputRef:t,min:o,max:s,...l})=>pa.jsx(Gr,{placeholder:r,sx:{height:xa,"& .MuiOutlinedInput-input":{pl:e?1:2,pr:e?1:2}},inputRef:t,inputProps:{min:o,max:s},InputProps:{inputComponent:kd,endAdornment:a?pa.jsx(E,{position:"start",sx:{pr:1},children:a}):null},...l,onChange:e=>{n&&n(e),i&&i()}}),vd=(e,a)=>"light"===a?{fontWeight:400}:{fontWeight:500,textTransform:"uppercase"},wd=(e,a,r)=>{switch(a){case"peach":return{background:e.custom.palette.peach[100],color:"heavy"===r?e.custom.palette.peach[1e3]:e.custom.palette.peach[800]};case"peachDark":return{background:e.custom.palette.peach[800],color:e.custom.palette.peach[0]};case"purple":return{background:e.custom.palette.purple[100],color:"heavy"===r?e.custom.palette.purple[1e3]:e.custom.palette.purple[800]};default:return{background:e.custom.palette.neutral[100],color:"heavy"===r?e.custom.palette.neutral[1e3]:e.custom.palette.neutral[800]}}},zd=j(W)((({theme:e,variation:a,weight:r})=>({borderRadius:e.spacing(e.custom.radius.md),height:28,...wd(e,a,r),"& .MuiChip-label":{fontSize:`${qr.sm.body.sm}`,padding:`0 ${e.spacing(e.custom.padding.sm)}`,...vd(0,r)},"& .MuiChip-icon":{width:"0.8em",height:"0.8em",marginRight:-4,...wd(e,a,r),...vd(0,r)}}))),jd=({body:e,maxWidth:a,...r})=>pa.jsx(zd,{label:e,sx:{...a&&{maxWidth:`${a}px`}},...r}),xd=j("iframe")((()=>({border:"none",height:"100%",width:"100%"}))),$d=e=>{const[a,r]=n(null),i=a?.contentWindow?.document?.body,t=Ji({key:"css",container:a?.contentWindow?.document?.head,prepend:!0});return pa.jsx(xd,{ref:r,children:i&&Ve(pa.jsx(Te,{value:t,children:e.children}),i)})},qd=()=>pa.jsxs(v,{gap:.5,flexDirection:"row",children:[pa.jsx(k,{sx:{width:67,height:12},viewBox:"0 0 67 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:pa.jsx("path",{d:"M2.09034 4.64868H4.09536C5.65956 4.64868 6.41322 4.00878 6.41322 2.84274C6.41322 1.69092 5.65956 1.05102 4.09536 1.05102H2.09034V4.64868ZM2.09034 5.6583V9H0.86742V0.0413991H4.1238C6.34212 0.0413991 7.6077 1.09368 7.6077 2.84274C7.6077 4.60602 6.34212 5.6583 4.1238 5.6583H2.09034ZM9.27266 5.90004C9.27266 7.27938 9.96944 8.26056 11.2208 8.26056C12.4864 8.26056 13.1974 7.27938 13.1974 5.90004C13.1974 4.50648 12.4864 3.53952 11.2208 3.53952C9.96944 3.53952 9.27266 4.50648 9.27266 5.90004ZM14.4061 5.90004C14.4061 7.83396 13.0552 9.17064 11.2208 9.17064C9.40064 9.17064 8.06396 7.83396 8.06396 5.90004C8.06396 3.96612 9.40064 2.61522 11.2208 2.61522C13.0552 2.61522 14.4061 3.96612 14.4061 5.90004ZM19.9082 2.78586L21.2449 7.49268H21.3018L22.738 2.78586H23.8329L21.8564 9H20.7188L19.3963 4.36428H19.3394L18.0312 9H16.8936L14.9028 2.78586H16.083L17.5477 7.49268H17.6046L18.9128 2.78586H19.9082ZM29.4445 6.78168L30.4257 6.89544C30.1271 8.31744 29.0748 9.17064 27.5248 9.17064C25.6762 9.17064 24.3253 7.91928 24.3253 5.98536C24.3253 4.023 25.6762 2.61522 27.4679 2.61522C29.4445 2.61522 30.4541 4.023 30.4541 5.71518V6.17022H25.5056C25.5624 7.40736 26.4299 8.24634 27.539 8.24634C28.5771 8.24634 29.2028 7.74864 29.4445 6.78168ZM25.534 5.445H29.2454C29.217 4.43538 28.634 3.51108 27.4679 3.51108C26.3445 3.51108 25.662 4.40694 25.534 5.445ZM35.5059 2.89962L35.3921 3.96612C35.0509 3.78126 34.8091 3.71016 34.4252 3.71016C33.5293 3.71016 32.861 4.5207 32.861 5.71518V9H31.6807V2.78586H32.861V4.05144C33.0885 3.34044 33.7284 2.61522 34.6243 2.61522C35.0082 2.61522 35.2926 2.71476 35.5059 2.89962ZM40.9288 6.78168L41.91 6.89544C41.6114 8.31744 40.5591 9.17064 39.0091 9.17064C37.1605 9.17064 35.8096 7.91928 35.8096 5.98536C35.8096 4.023 37.1605 2.61522 38.9522 2.61522C40.9288 2.61522 41.9384 4.023 41.9384 5.71518V6.17022H36.9899C37.0468 7.40736 37.9142 8.24634 39.0233 8.24634C40.0614 8.24634 40.6871 7.74864 40.9288 6.78168ZM37.0183 5.445H40.7297C40.7013 4.43538 40.1183 3.51108 38.9522 3.51108C37.8289 3.51108 37.1463 4.40694 37.0183 5.445ZM47.8993 6.07068V5.71518C47.8993 4.36428 47.0461 3.56796 45.9227 3.56796C44.6998 3.56796 44.0172 4.47804 44.0172 5.90004C44.0172 7.32204 44.6998 8.23212 45.9227 8.23212C47.0461 8.23212 47.8993 7.4358 47.8993 6.07068ZM47.8851 9V7.70598C47.6007 8.47386 46.8186 9.17064 45.6525 9.17064C43.8039 9.17064 42.8085 7.73442 42.8085 5.90004C42.8085 4.06566 43.8039 2.61522 45.6525 2.61522C46.8186 2.61522 47.6007 3.32622 47.8851 4.0941V0.0413991H49.0653V9H47.8851ZM54.3847 5.71518V6.07068C54.3847 7.4358 55.2521 8.23212 56.3755 8.23212C57.5984 8.23212 58.2668 7.32204 58.2668 5.90004C58.2668 4.47804 57.5984 3.56796 56.3755 3.56796C55.2521 3.56796 54.3847 4.36428 54.3847 5.71518ZM54.3847 7.70598L54.1288 9H53.2329V0.0413991H54.4132V4.0941C54.6833 3.32622 55.4797 2.61522 56.6457 2.61522C58.4801 2.61522 59.4897 4.06566 59.4897 5.90004C59.4897 7.73442 58.4801 9.17064 56.6315 9.17064C55.4797 9.17064 54.6691 8.48808 54.3847 7.70598ZM62.6822 11.389H61.5304L62.54 8.98578L59.9235 2.78586H61.1607L63.1372 7.56378H63.1941L65.0996 2.78586H66.2656L62.6822 11.389Z",fill:"#473F5C"})}),pa.jsxs(k,{sx:{width:40,height:12},viewBox:"0 0 40 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[pa.jsx("g",{id:"Brand/Wordmark",clipPath:"url(#clip0_900_1816)",children:pa.jsx("path",{id:"Union",fillRule:"evenodd",clipRule:"evenodd",d:"M4.3189 9.56522C3.67851 9.11556 3.54429 8.98169 3.54429 7.99199V0H0V0.149886L0.00580287 0.153463C0.656931 0.554852 0.953183 0.737477 0.953183 1.72311V7.99199C0.953183 8.98169 0.818964 9.11556 0.17858 9.56522V9.7151H4.3189V9.56522ZM4.51113 6.71053C4.91378 9.01144 6.99646 10.1934 9.18264 9.80664C11.3677 9.41876 12.9226 7.58467 12.5199 5.28947C12.1173 2.99428 10.0346 1.80549 7.84841 2.19336C5.66223 2.58124 4.10847 4.40961 4.51113 6.71053ZM7.2103 6.23112C6.8247 4.01831 6.98053 3.01716 7.96215 2.84325C8.94377 2.66819 9.43515 3.55263 9.82074 5.76545C10.2063 7.97826 10.0516 8.97483 9.06889 9.15332C8.08613 9.33181 7.59589 8.44394 7.2103 6.23112ZM17.7306 9.80664C15.5455 10.1934 13.4629 9.01144 13.0591 6.71053C12.6553 4.40961 14.2102 2.58124 16.3963 2.19336C18.5825 1.80549 20.6641 2.99428 21.0678 5.28947C21.4716 7.58467 19.9156 9.41876 17.7306 9.80664ZM16.5101 2.84325C15.5273 3.01716 15.3726 4.01831 15.7582 6.23112C16.1438 8.44394 16.6341 9.33181 17.6168 9.15675C18.5996 8.98169 18.7543 7.98169 18.3687 5.76888C17.9831 3.55606 17.4928 2.66819 16.5101 2.84325ZM25.5683 11.8168C24.8234 11.3931 24.5553 11.2406 24.5553 10.2769L24.5575 8.4794C24.9443 9.25858 25.7189 9.873 26.9997 9.873C28.9356 9.873 30.47 8.40046 30.47 5.86842C30.47 3.29176 28.9743 2.13844 27.2681 2.13844C25.8679 2.13844 24.8988 2.93249 24.5575 4.02631L24.4973 2.28833H21.0724V2.43135L21.0731 2.43181C21.713 2.85024 21.9653 3.01524 21.9653 4.00458V10.2769C21.9653 11.2654 21.8322 11.4005 21.1907 11.8501V12H25.6267V11.8501L25.5683 11.8168ZM26.1784 8.9611C25.2696 8.9611 24.5553 7.92792 24.5553 6.72998V5.66247C24.5553 4.32952 25.1957 3.32494 26.1784 3.32494C27.2055 3.32494 27.7117 4.27002 27.7117 5.87185C27.7117 7.98741 27.1907 8.9611 26.1784 8.9611ZM38.6585 9.84325C39.1403 9.84325 39.5309 9.45034 39.5309 8.96567C39.5309 8.481 39.1403 8.0881 38.6585 8.0881C38.1767 8.0881 37.7861 8.481 37.7861 8.96567C37.7861 9.45034 38.1767 9.84325 38.6585 9.84325ZM34.6585 4.64621C33.661 4.35019 33.0998 4.18365 33.0998 3.5881C33.0998 3.08924 33.5548 2.86842 34.0552 2.86842C35.0244 2.86842 35.783 3.42334 36.6623 4.71167H36.8704V2.13501H36.7214L36.0515 2.62929C36.0223 2.61721 35.9931 2.6051 35.9639 2.59299C35.4126 2.36413 34.8607 2.13501 34.0257 2.13501C32.4321 2.13501 31.1661 3.12357 31.1661 4.59153C31.1661 5.90961 31.7929 6.65904 34.0416 7.24371C34.8765 7.45309 35.4566 7.60297 35.4566 8.24714C35.4566 8.84668 34.8765 9.13043 34.1758 9.13043C33.0998 9.13043 32.3138 8.39702 31.2799 7.00343H31.0524L31.2094 9.85011H31.3731L31.968 9.25057C32.4446 9.49085 33.1897 9.86499 34.1872 9.86499C36.0936 9.86499 37.4198 8.80091 37.4198 7.3032C37.4198 5.75973 36.4985 5.19107 34.6786 4.65217L34.6585 4.64621Z",fill:"#473F5C"})}),pa.jsx("defs",{children:pa.jsx("clipPath",{id:"clip0_900_1816",children:pa.jsx("rect",{width:"39.5321",height:"12",fill:"white"})})})]})]}),Cd=({options:e,onChange:a,other:r,value:t,internalChange:o,...s})=>{const l=r?.enabled,c="other-option",d=`${c}-value-`,[u,h]=n(t),[m,g]=n(!1);i((()=>{!m&&u?.includes(d)?g(!0):m&&g(!1)}),[u]);return pa.jsxs(pa.Fragment,{children:[pa.jsxs(T,{...s,value:u,sx:{display:"flex",gap:e=>e.custom.margin.sm,label:{"&:last-child":{mb:0},"&:hover":{"& .MuiRadio-root":{backgroundColor:e=>e.custom.palette.interaction.hover,"&.Mui-checked":{backgroundColor:e=>e.custom.palette.purple[500]}}}}},onChange:(e,r)=>{a&&a(r),h(r),o&&o()},children:[e?e.map(((e,a)=>pa.jsx(Vr,{sx:{"& .MuiButtonBase-root.MuiRadio-root":{alignSelf:"baseline"}},...e,control:pa.jsx(sn,{})},a))):null,l&&pa.jsx(Vr,{label:r?.label||"Other",value:d,control:pa.jsx(sn,{checked:u?.includes(d)})},c)]}),m&&pa.jsx(q,{sx:{mt:1},children:pa.jsx(Kr,{fullWidth:!0,autoFocus:!0,placeholder:r?.placeholder,defaultValue:u?.replace(d,""),onChange:e=>{var r;a&&a((r=e.target.value,`${d}${r}`)),o&&o()},required:!0})})]})},Sd=c({attributes:{},listeners:void 0,ref(){}}),Od=e=>ea({...e,wasDragging:!0});function Ed({children:e,top:a,bottom:r,id:n}){const{attributes:i,isDragging:o,listeners:s,setNodeRef:l,setActivatorNodeRef:c,transform:d,transition:u}=Qe({id:n,animateLayoutChanges:Od}),h=t((()=>({attributes:i,listeners:s,ref:c})),[i,s,c]),m={opacity:o?.4:void 0,transform:oa.Translate.toString(d),transition:u};return pa.jsx(Sd.Provider,{value:h,children:pa.jsxs(v,{className:"SortableItem",...i,sx:{position:"relative",...m,width:"100%"},ref:l,children:[a&&a,pa.jsx(q,{...s,sx:{display:"flex",cursor:"grab"},children:e}),r&&r]})})}const Md={sideEffects:He({styles:{active:{opacity:"0.4"}}})};function _d({children:e}){return Ve(pa.jsx(We,{zIndex:999999,dropAnimation:Md,children:e}),document.body)}const Ad=({nativeEvent:e})=>{let a=e.target;for(;a;){if(a.dataset.noDnd)return!1;a=a.parentElement}return!0};class Dd extends Ye{static activators=[{eventName:"onMouseDown",handler:Ad}]}class Nd extends Xe{static activators=[{eventName:"onTouchStart",handler:Ad}]}function Td({items:e,onChange:a,renderItem:r,disabled:i,direction:o}){if(!e)return;const[s,l]=n(null),c=t((()=>e.find((e=>e?.id===s?.id))),[s,e]),d=f(),h=U(d.breakpoints.down("md")),m=Ue(Ge(Dd,{activationConstraint:{distance:5}}),Ge(Nd,{activationConstraint:{delay:h?300:0,tolerance:8}}),Ge(Ke,{coordinateGetter:aa}));return pa.jsxs(Ze,{measuring:{droppable:{strategy:Je.Always}},sensors:m,onDragStart:({active:e})=>{l(e)},onDragEnd:({active:r,over:n})=>{if(n&&r.id!==n?.id){const i=e.findIndex((({id:e})=>e===r.id)),t=e.findIndex((({id:e})=>e===n.id));a(ra(e,i,t))}l(null)},onDragCancel:()=>{l(null)},children:[pa.jsx(na,{items:e,disabled:i,strategy:"horizontal"===o?ia:ta,children:pa.jsx(v,{sx:{..."horizontal"===o&&{flexDirection:"row"},display:"flex",m:0,gap:1,padding:0,alignContent:"flex-start"},children:e.map((e=>pa.jsx(u,{children:r(e)},e.id)))})}),pa.jsx(_d,{children:c?r(c,!0,!!s):null})]})}Td.Item=Ed,Td.DragHandle=function(){const{attributes:e,listeners:a,ref:r}=d(Sd);return pa.jsx(q,{...e,...a,ref:r,children:pa.jsx("svg",{viewBox:"0 0 20 20",width:"12",children:pa.jsx("path",{d:"M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"})})})};const Id=({handleSelectAll:e,isIndeterminate:a,isAllSelected:r,sizing:t})=>{const[o,s]=n(!1),l=f();return i((()=>{r&&s(r)}),[r]),pa.jsxs(v,{direction:"row",gap:l.spacing(l.custom.padding.sm),onClick:a=>{const r=!o;s(r),e(a,r)},sx:{marginLeft:"auto",display:"flex",alignItems:"center",justifyContent:"flex-end",p:e=>e.custom.padding.sm},children:[pa.jsx(G,{sx:{cursor:"pointer",fontSize:()=>t&&Sr[t]},children:"Select all"}),pa.jsx(Wr,{sizing:"default",indeterminate:a,checked:o})]})},Fd=s((({children:e,handleSelectAll:a,value:r=[],selections:n,sizing:i,...t},o)=>{const s=r.length===n.length,l=r.length>0&&r.length<n.length;return pa.jsxs("ul",{ref:o,...t,children:[pa.jsx(Id,{handleSelectAll:a,isIndeterminate:l,isAllSelected:s,sizing:i}),e]})})),Pd="0px 4px 8px 0px #06040D14, 0px 16px 24px 0px #06040D14, 0px 0px 4px 2px #06040D0A, 0px 0px 0px 1px #FFFFFF29",Rd=e=>{switch(e){case"xs":return 24;case"md":return 32;default:return 40}},Ld=(e,a)=>({"& .MuiTypography-root":{height:Rd(a),fontSize:Sr[a],display:"flex",alignItems:"center",paddingLeft:e.spacing("xs"===a?e.custom.padding.xs:e.custom.padding.sm),paddingRight:e.spacing("xs"===a?e.custom.padding.xs:e.custom.padding.sm)}}),Bd=e=>({fontSize:`${qr.sm.body.md}`,borderRadius:e.spacing(e.custom.radius.md),position:"relative",padding:e.spacing(e.custom.padding.sm),"& .MuiSelect-outlined":{padding:0},"& .MuiSelect-select.MuiInputBase-input":{paddingRight:e.spacing(Sa.md)},"&:before":{transition:e.custom.easing.input,content:'""',position:"absolute",background:e.custom.palette.interaction.none,borderRadius:e.spacing(e.custom.radius.md),inset:0,zIndex:0},"&:hover:before":{backgroundColor:e.custom.palette.interaction.hover},"&.Mui-focused:before":{backgroundColor:e.custom.palette.interaction.press},"&.Mui-disabled:before":{backgroundColor:e.custom.palette.interaction.none},"& .MuiSelect-select":{position:"relative"}}),Vd=(e,a)=>{switch(a){case"lg":return{height:Rd(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:Da.lg,height:Da.lg,top:`calc(50% - ${Da.lg/2}px)`}};case"md":return{height:Rd(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:Da.md,height:Da.md,top:`calc(50% - ${Da.md/2}px)`}};case"xs":return{height:Rd(a),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:Da.xs,height:Da.xs,top:`calc(50% - ${Da.xs/2}px)`}};default:return{height:Rd("lg"),"& .MuiSvgIcon-root":{color:e.custom.palette.icon.primary,transition:e.custom.easing.input,width:Da.lg,height:Da.lg,top:`calc(50% - ${Da.lg/2}px)`}}}},Hd=e=>({position:"relative",fontSize:`${qr.sm.body.md}`,backgroundColor:e.custom.palette.interaction.none,color:e.custom.palette.text.primary,"&:before":{transition:e.custom.easing.input,content:'""',position:"absolute",inset:0,zIndex:1},"& > .MuiBox-root":{position:"relative",zIndex:2,width:"100%","& .MuiSvgIcon-root":{marginRight:e.spacing(e.custom.margin.sm),width:Da.xl,height:Da.xl},"& .MuiBox-root":{padding:e.spacing(e.custom.padding.sm),lineHeight:"22px"}}}),Wd=e=>({"&.MuiModal-root.MuiPopover-root":{"&.MuiMenu-root":{borderRadius:e.spacing(e.custom.radius.sm),"& .MuiPaper-root":{border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.raised,boxShadow:Pd}}}}),Ud=j(K)((({theme:e,sizing:a,value:r})=>({maxWidth:"100%",backgroundColor:e.custom.palette.surface.raised,borderRadius:e.spacing(e.custom.radius.md),border:`1px solid ${e.custom.palette.stroke.default}`,transition:e.custom.easing.input,"& .MuiSvgIcon-root":{...a&&{width:Da[a],height:Da[a]}},"&.MuiAutocomplete-root .MuiOutlinedInput-root .MuiAutocomplete-input":{...a&&{height:"xs"===a?2*qa+"px":3*qa+"px"},paddingTop:0,paddingBottom:0,paddingLeft:r&&r?.length>0?0:e.spacing(e.custom.padding.sm),justifyContent:"center",textOverflow:"ellipsis",whiteSpace:"nowrap"},"& .MuiAutocomplete-inputRoot":{...a&&{fontSize:Sr[a],gap:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs)},display:"flex",alignItems:"flex-start",paddingRight:3*qa+"px",flexWrap:"wrap",height:"auto"},"& .MuiOutlinedInput-root":{display:"flex",alignItems:"center",padding:"0"},"& .MuiAutocomplete-tag":{...a&&{height:"xs"===a?2*qa+"px":3*qa+"px"},margin:0,"& .MuiSvgIcon-root":{height:"12px",width:"12px"}},"&.Mui-disabled":{backgroundColor:`${e.custom.palette.input.disabled}`,borderColor:`${e.custom.palette.stroke.disabled}`},"&.Mui-focused":{backgroundColor:e.custom.palette.input.default,borderColor:e.custom.palette.stroke.focus,boxShadow:e.custom.boxShadow.input.focus},"& .MuiChip-root .MuiChip-label":{height:20,lineHeight:"20px",maxWidth:140,...a&&{padding:`0 ${e.spacing(e.custom.padding.xs)}`}}}))),Gd=j(W)((({theme:e,sizing:a})=>({borderRadius:e.spacing(e.custom.radius.sm),border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.default,...a&&{padding:`0 ${e.spacing(e.custom.padding.xs)}`},"& .MuiChip-deleteIcon":{fill:e.custom.palette.icon.primary,borderRadius:e.custom.radius.round,margin:0,"&:hover":{backgroundColor:e.custom.palette.interaction.hover},"&:active":{backgroundColor:e.custom.palette.interaction.press},"&:disabled":{backgroundColor:e.custom.palette.interaction.disabled,fill:e.custom.palette.icon.disabled}}}))),Kd=j(O)((({theme:e,sizing:a})=>({"& .MuiOutlinedInput-root":{padding:0,...a&&{margin:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs)}},"& .MuiInputBase-input":{padding:"0 14px"},"& .MuiOutlinedInput-notchedOutline":{border:"none"}}))),Zd=j(Z)((({theme:e,sizing:a})=>({"& .MuiPaper-root":{...a&&{margin:"lg"===a?e.spacing(e.custom.padding.sm):e.spacing(e.custom.padding.xs),marginLeft:"lg"===a?`-${e.spacing(e.custom.padding.sm)}`:`-${e.spacing(e.custom.padding.xs)}`,marginTop:`calc(${"lg"===a?e.spacing(e.custom.margin.sm):e.spacing(e.custom.margin.xs)} + ${e.spacing(e.custom.margin.xs)})`},border:`1px solid ${e.custom.palette.stroke.default}`,backgroundColor:e.custom.palette.surface.raised,boxShadow:Pd,borderRadius:e.spacing(e.custom.radius.sm)},[`& .${J.listbox}`]:{overflowX:"hidden",[`& .${J.option}`]:{fontSize:Sr[a],...a&&{height:"lg"===a?5*qa+"px":4*qa+"px"},"> span":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},'&[aria-selected="true"]':{backgroundColor:e.custom.palette.interaction.hover,display:"flex",alignItems:"center",justifyContent:"space-between"}}}}))),Jd=e=>pa.jsx(Zd,{...e}),Yd=({selections:e,disableClearable:a=!1,disabled:r,internalChange:i,onChange:t,placeholder:o="",renderListItem:l,sizing:c="lg",value:d=[]})=>{const[u,h]=n(e.filter((e=>d.includes(e?.value)))),m=(a,r)=>{if(t){const n=r?e.map((({value:e})=>e)):[];h(r?e:[]),t(a,n,"selectOption"),i&&i()}};return pa.jsx(Ud,{disabledItemsFocusable:!0,autoFocus:!1,disableCloseOnSelect:!0,blurOnSelect:!1,popupIcon:pa.jsx(Me,{}),sizing:c,disabled:r,disableClearable:a,autoComplete:!0,multiple:!0,renderInput:e=>pa.jsx(Kd,{...e,placeholder:u.length>0?void 0:o,sizing:c}),options:e,renderTags:(e,a)=>e.map(((e,r)=>{const{key:n,...i}=a({index:r});return pa.jsx(Gd,{sizing:c,deleteIcon:pa.jsx(_e,{fontSize:"small"}),label:e.label,...i},n)})),onChange:(e,a,r)=>{const n=a.map((({value:e})=>e));t&&(h(a),t(e,n,r)),i&&i()},PopperComponent:e=>pa.jsx(Jd,{...e,sizing:c}),isOptionEqualToValue:(e,a)=>e.value===a.value,renderOption:(e,a,{selected:r})=>{const{key:n,...i}=e;return pa.jsxs("li",{...i,children:[pa.jsx("span",{children:l?l(a.label):a.label}),pa.jsx($e,{sx:{visibility:r?"visible":"hidden",fontSize:"16px"}})]},n)},ListboxComponent:s(((a,r)=>pa.jsx(Fd,{ref:r,...a,handleSelectAll:m,value:u,selections:e,sizing:c}))),value:u})},Xd=j(P)((({theme:e})=>({...{...Hd(e)},"&.Mui-focusVisible":{backgroundColor:e.custom.palette.interaction.none},"&.Mui-selected":{backgroundColor:e.custom.palette.input.default,"&.Mui-focusVisible":{backgroundColor:e.custom.palette.input.default}},"&.MuiButtonBase-root.MuiMenuItem-root.Mui-disabled":{backgroundColor:e.custom.palette.input.default,color:e.custom.palette.text.disabled,"&:before":{backgroundColor:e.custom.palette.interaction.disabled}},"&:hover":{backgroundColor:e.custom.palette.input.default,"&:before":{backgroundColor:e.custom.palette.interaction.hover},"&.Mui-selected":{backgroundColor:e.custom.palette.input.default,"&.Mui-focusVisible":{"&:before":{backgroundColor:e.custom.palette.interaction.hover}},"&:before":{backgroundColor:e.custom.palette.interaction.hover}}},"&:active":{"&:before":{backgroundColor:e.custom.palette.interaction.press}}}))),Qd=({children:e,selected:a,...r})=>pa.jsx(Xd,{...r,children:pa.jsxs(q,{display:"flex",justifyContent:"space-between",alignItems:"center",children:[pa.jsx(q,{children:e}),a&&pa.jsx($e,{})]})}),eu=j(Y)((({theme:e,sizing:a})=>({...{...Bd(e)},...a&&{...Vd(e,a)},...a&&{...Ld(e,a)},backgroundColor:e.custom.palette.surface.raised,border:`1px solid ${e.custom.palette.stroke.default}`,transition:e.custom.easing.input,"& .MuiOutlinedInput-notchedOutline":{border:e.custom.palette.stroke.default},"&:hover":{"& .MuiOutlinedInput-notchedOutline":{borderColor:e.custom.palette.stroke.default}},"&.Mui-focused":{backgroundColor:e.custom.palette.input.default,borderColor:e.custom.palette.stroke.focus,boxShadow:e.custom.boxShadow.input.focus},"&.Mui-disabled":{backgroundColor:e.custom.palette.input.disabled,borderColor:e.custom.palette.stroke.disabled,"& .MuiSvgIcon-root":{color:e.custom.palette.icon.disabled,transition:e.custom.easing.input}}}))),au=({selections:e,autoComplete:a=!1,disabled:r=!1,disablePortal:n=!1,inputRef:i,internalChange:t,onChange:o,placeholder:s="",selectOptionProps:l,sizing:c="lg",sx:d,value:u=[],renderListItem:h,...m})=>{const g=f(),p=uc();return a?pa.jsx(Yd,{selections:e,placeholder:s,disabled:r,sizing:c,onChange:(e,a)=>{o&&o(a),t&&t()},value:Array.isArray(u)?u:[],internalChange:t,renderListItem:h}):pa.jsxs(eu,{sizing:c,inputRef:i,MenuProps:{disablePortal:n,sx:Wd,anchorOrigin:{vertical:45,horizontal:"center"}},displayEmpty:!0,IconComponent:Me,renderValue:a=>s&&!a?pa.jsx(yr,{component:"p",variation:"sm"===p||"md"===p?"sm":"lg",sx:{color:g.custom.palette.text.placeholder},children:s}):pa.jsx(yr,{component:"p",variation:"sm"===p||"md"===p?"sm":"lg",children:e?.find((({value:e})=>e===a))?.label}),onChange:(e,a)=>{o&&o(e,a),t&&t()},sx:d,value:u,...m,children:[""!==s.trim()&&pa.jsx(Qd,{disabled:!0,value:"","aria-label":"placeholder",children:s},"placeholder"),e?.map((({value:e,label:a})=>pa.jsx(Qd,{value:e,...l,children:h?h(a):a},e)))]})},ru=j(q)((({theme:e,disabled:a,fullWidth:r})=>({width:r?"100%":"auto",minWidth:240,backgroundColor:a?e.custom.palette.input.disabled:e.custom.palette.surface.raised,border:`1px solid ${a?e.custom.palette.stroke.disabled:e.custom.palette.stroke.default}`,borderRadius:e.spacing(e.custom.radius.lg),padding:e.spacing(e.custom.padding.md),position:"relative",zIndex:0,"&:after":{content:'""',backgroundColor:e.custom.palette.interaction.none,borderRadius:e.spacing(e.custom.radius.lg),position:"absolute",inset:0},"&:hover":{"&:after":{backgroundColor:e.custom.palette.interaction.hover}},"&:active":{"&:after":{backgroundColor:e.custom.palette.interaction.press}},"& svg":{fill:e.custom.palette.icon.primary},...a&&{background:e.custom.palette.input.disabled,borderColor:e.custom.palette.stroke.disabled,"&:after":{backgroundColor:e.custom.palette.interaction.none},"& .MuiBox-root > .MuiSvgIcon-root":{fill:"none"}}}))),nu=j(Sc)((({theme:e})=>({fontSize:qr.button.md,color:e.custom.palette.text.primary,lineHeight:"120%",letterSpacing:"0.16px"}))),iu=({label:e="Placeholder",disabled:a,onChange:r,options:n,fullWidth:i})=>{const t=f(),o=n.map((e=>e.label)).indexOf(e);return pa.jsx(ru,{disabled:a,fullWidth:i,children:pa.jsxs(v,{display:"flex",justifyContent:"space-between",flexDirection:"row",alignItems:"center",sx:{position:"relative",zIndex:1},children:[pa.jsxs(q,{display:"flex",alignItems:"center",sx:{"& svg":{fill:t.custom.palette.icon.secondary}},children:[pa.jsx(Ae,{sx:{width:Da.lg,height:Da.lg,mr:t.custom.padding.sm}}),pa.jsx(nu,{align:"left",disabled:a,children:e})]}),pa.jsx(au,{sizing:"xs",selections:n.map(((e,a)=>({label:`${a+1}`,value:`${a}`}))),disabled:a,value:`${o}`,onChange:function(e){const a=o,i=Number(e.target.value),t=n;let s=1;const l=t.splice(a,s)[0];s=0,t.splice(i,s,l),r(t)},MenuProps:{anchorOrigin:{vertical:ja,horizontal:"center"}}})]})})},tu=({labelTop:e,labelBottom:a,disabled:r,fullWidth:i=!1,options:t,onChange:o,value:s,internalChange:l})=>{const c=f(),[d,u]=n(s||t);function h(e){u(e),o(e.map((({id:e})=>e))),l&&l()}return pa.jsxs(v,{gap:c.custom.margin.sm,textAlign:"center",sx:{width:i?"100%":"auto"},children:[e&&pa.jsx(Sc,{disabled:r,sx:{color:c.custom.palette.text.secondary},children:e}),pa.jsx(Td,{onChange:function(e){u(e),o(e.map((({id:e})=>e))),l&&l()},items:d,direction:"vertical",renderItem:({...e})=>pa.jsx(Ed,{id:e.id,children:pa.jsx(iu,{onChange:h,...e,options:d,disabled:r,selections:e.selections,fullWidth:i})})}),a&&pa.jsx(Sc,{disabled:r,sx:{color:c.custom.palette.text.secondary},children:a})]})};function ou(e){this.content=e}function su(e,a,r){for(let n=0;;n++){if(n==e.childCount||n==a.childCount)return e.childCount==a.childCount?null:r;let i=e.child(n),t=a.child(n);if(i!=t){if(!i.sameMarkup(t))return r;if(i.isText&&i.text!=t.text){for(let e=0;i.text[e]==t.text[e];e++)r++;return r}if(i.content.size||t.content.size){let e=su(i.content,t.content,r+1);if(null!=e)return e}r+=i.nodeSize}else r+=i.nodeSize}}function lu(e,a,r,n){for(let i=e.childCount,t=a.childCount;;){if(0==i||0==t)return i==t?null:{a:r,b:n};let o=e.child(--i),s=a.child(--t),l=o.nodeSize;if(o!=s){if(!o.sameMarkup(s))return{a:r,b:n};if(o.isText&&o.text!=s.text){let e=0,a=Math.min(o.text.length,s.text.length);for(;e<a&&o.text[o.text.length-e-1]==s.text[s.text.length-e-1];)e++,r--,n--;return{a:r,b:n}}if(o.content.size||s.content.size){let e=lu(o.content,s.content,r-1,n-1);if(e)return e}r-=l,n-=l}else r-=l,n-=l}}ou.prototype={constructor:ou,find:function(e){for(var a=0;a<this.content.length;a+=2)if(this.content[a]===e)return a;return-1},get:function(e){var a=this.find(e);return-1==a?void 0:this.content[a+1]},update:function(e,a,r){var n=r&&r!=e?this.remove(r):this,i=n.find(e),t=n.content.slice();return-1==i?t.push(r||e,a):(t[i+1]=a,r&&(t[i]=r)),new ou(t)},remove:function(e){var a=this.find(e);if(-1==a)return this;var r=this.content.slice();return r.splice(a,2),new ou(r)},addToStart:function(e,a){return new ou([e,a].concat(this.remove(e).content))},addToEnd:function(e,a){var r=this.remove(e).content.slice();return r.push(e,a),new ou(r)},addBefore:function(e,a,r){var n=this.remove(a),i=n.content.slice(),t=n.find(e);return i.splice(-1==t?i.length:t,0,a,r),new ou(i)},forEach:function(e){for(var a=0;a<this.content.length;a+=2)e(this.content[a],this.content[a+1])},prepend:function(e){return(e=ou.from(e)).size?new ou(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=ou.from(e)).size?new ou(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var a=this;e=ou.from(e);for(var r=0;r<e.content.length;r+=2)a=a.remove(e.content[r]);return a},toObject:function(){var e={};return this.forEach((function(a,r){e[a]=r})),e},get size(){return this.content.length>>1}},ou.from=function(e){if(e instanceof ou)return e;var a=[];if(e)for(var r in e)a.push(r,e[r]);return new ou(a)};class cu{constructor(e,a){if(this.content=e,this.size=a||0,null==a)for(let a=0;a<e.length;a++)this.size+=e[a].nodeSize}nodesBetween(e,a,r,n=0,i){for(let t=0,o=0;o<a;t++){let s=this.content[t],l=o+s.nodeSize;if(l>e&&!1!==r(s,n+o,i||null,t)&&s.content.size){let i=o+1;s.nodesBetween(Math.max(0,e-i),Math.min(s.content.size,a-i),r,n+i)}o=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,a,r,n){let i="",t=!0;return this.nodesBetween(e,a,((o,s)=>{let l=o.isText?o.text.slice(Math.max(e,s)-s,a-s):o.isLeaf?n?"function"==typeof n?n(o):n:o.type.spec.leafText?o.type.spec.leafText(o):"":"";o.isBlock&&(o.isLeaf&&l||o.isTextblock)&&r&&(t?t=!1:i+=r),i+=l}),0),i}append(e){if(!e.size)return this;if(!this.size)return e;let a=this.lastChild,r=e.firstChild,n=this.content.slice(),i=0;for(a.isText&&a.sameMarkup(r)&&(n[n.length-1]=a.withText(a.text+r.text),i=1);i<e.content.length;i++)n.push(e.content[i]);return new cu(n,this.size+e.size)}cut(e,a=this.size){if(0==e&&a==this.size)return this;let r=[],n=0;if(a>e)for(let i=0,t=0;t<a;i++){let o=this.content[i],s=t+o.nodeSize;s>e&&((t<e||s>a)&&(o=o.isText?o.cut(Math.max(0,e-t),Math.min(o.text.length,a-t)):o.cut(Math.max(0,e-t-1),Math.min(o.content.size,a-t-1))),r.push(o),n+=o.nodeSize),t=s}return new cu(r,n)}cutByIndex(e,a){return e==a?cu.empty:0==e&&a==this.content.length?this:new cu(this.content.slice(e,a))}replaceChild(e,a){let r=this.content[e];if(r==a)return this;let n=this.content.slice(),i=this.size+a.nodeSize-r.nodeSize;return n[e]=a,new cu(n,i)}addToStart(e){return new cu([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new cu(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let a=0;a<this.content.length;a++)if(!this.content[a].eq(e.content[a]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let a=this.content[e];if(!a)throw new RangeError("Index "+e+" out of range for "+this);return a}maybeChild(e){return this.content[e]||null}forEach(e){for(let a=0,r=0;a<this.content.length;a++){let n=this.content[a];e(n,r,a),r+=n.nodeSize}}findDiffStart(e,a=0){return su(this,e,a)}findDiffEnd(e,a=this.size,r=e.size){return lu(this,e,a,r)}findIndex(e,a=-1){if(0==e)return uu(0,e);if(e==this.size)return uu(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,n=0;;r++){let i=n+this.child(r).nodeSize;if(i>=e)return i==e||a>0?uu(r+1,i):uu(r,n);n=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((e=>e.toJSON())):null}static fromJSON(e,a){if(!a)return cu.empty;if(!Array.isArray(a))throw new RangeError("Invalid input for Fragment.fromJSON");return new cu(a.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return cu.empty;let a,r=0;for(let n=0;n<e.length;n++){let i=e[n];r+=i.nodeSize,n&&i.isText&&e[n-1].sameMarkup(i)?(a||(a=e.slice(0,n)),a[a.length-1]=i.withText(a[a.length-1].text+i.text)):a&&a.push(i)}return new cu(a||e,r)}static from(e){if(!e)return cu.empty;if(e instanceof cu)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new cu([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}cu.empty=new cu([],0);const du={index:0,offset:0};function uu(e,a){return du.index=e,du.offset=a,du}function hu(e,a){if(e===a)return!0;if(!e||"object"!=typeof e||!a||"object"!=typeof a)return!1;let r=Array.isArray(e);if(Array.isArray(a)!=r)return!1;if(r){if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!hu(e[r],a[r]))return!1}else{for(let r in e)if(!(r in a)||!hu(e[r],a[r]))return!1;for(let r in a)if(!(r in e))return!1}return!0}let mu=class e{constructor(e,a){this.type=e,this.attrs=a}addToSet(e){let a,r=!1;for(let n=0;n<e.length;n++){let i=e[n];if(this.eq(i))return e;if(this.type.excludes(i.type))a||(a=e.slice(0,n));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(a||(a=e.slice(0,n)),a.push(this),r=!0),a&&a.push(i)}}return a||(a=e.slice()),r||a.push(this),a}removeFromSet(e){for(let a=0;a<e.length;a++)if(this.eq(e[a]))return e.slice(0,a).concat(e.slice(a+1));return e}isInSet(e){for(let a=0;a<e.length;a++)if(this.eq(e[a]))return!0;return!1}eq(e){return this==e||this.type==e.type&&hu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let a in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,a){if(!a)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[a.type];if(!r)throw new RangeError(`There is no mark type ${a.type} in this schema`);let n=r.create(a.attrs);return r.checkAttrs(n.attrs),n}static sameSet(e,a){if(e==a)return!0;if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(a[r]))return!1;return!0}static setFrom(a){if(!a||Array.isArray(a)&&0==a.length)return e.none;if(a instanceof e)return[a];let r=a.slice();return r.sort(((e,a)=>e.type.rank-a.type.rank)),r}};mu.none=[];class gu extends Error{}class pu{constructor(e,a,r){this.content=e,this.openStart=a,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,a){let r=fu(this.content,e+this.openStart,a);return r&&new pu(r,this.openStart,this.openEnd)}removeBetween(e,a){return new pu(bu(this.content,e+this.openStart,a+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,a){if(!a)return pu.empty;let r=a.openStart||0,n=a.openEnd||0;if("number"!=typeof r||"number"!=typeof n)throw new RangeError("Invalid input for Slice.fromJSON");return new pu(cu.fromJSON(e,a.content),r,n)}static maxOpen(e,a=!0){let r=0,n=0;for(let n=e.firstChild;n&&!n.isLeaf&&(a||!n.type.spec.isolating);n=n.firstChild)r++;for(let r=e.lastChild;r&&!r.isLeaf&&(a||!r.type.spec.isolating);r=r.lastChild)n++;return new pu(e,r,n)}}function bu(e,a,r){let{index:n,offset:i}=e.findIndex(a),t=e.maybeChild(n),{index:o,offset:s}=e.findIndex(r);if(i==a||t.isText){if(s!=r&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,a).append(e.cut(r))}if(n!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(n,t.copy(bu(t.content,a-i-1,r-i-1)))}function fu(e,a,r,n){let{index:i,offset:t}=e.findIndex(a),o=e.maybeChild(i);if(t==a||o.isText)return e.cut(0,a).append(r).append(e.cut(a));let s=fu(o.content,a-t-1,r);return s&&e.replaceChild(i,o.copy(s))}function ku(e,a,r){if(r.openStart>e.depth)throw new gu("Inserted content deeper than insertion position");if(e.depth-r.openStart!=a.depth-r.openEnd)throw new gu("Inconsistent open depths");return yu(e,a,r,0)}function yu(e,a,r,n){let i=e.index(n),t=e.node(n);if(i==a.index(n)&&n<e.depth-r.openStart){let o=yu(e,a,r,n+1);return t.copy(t.content.replaceChild(i,o))}if(r.content.size){if(r.openStart||r.openEnd||e.depth!=n||a.depth!=n){let{start:i,end:o}=function(e,a){let r=a.depth-e.openStart,n=a.node(r),i=n.copy(e.content);for(let e=r-1;e>=0;e--)i=a.node(e).copy(cu.from(i));return{start:i.resolveNoCache(e.openStart+r),end:i.resolveNoCache(i.content.size-e.openEnd-r)}}(r,e);return xu(t,$u(e,i,o,a,n))}{let n=e.parent,i=n.content;return xu(n,i.cut(0,e.parentOffset).append(r.content).append(i.cut(a.parentOffset)))}}return xu(t,qu(e,a,n))}function vu(e,a){if(!a.type.compatibleContent(e.type))throw new gu("Cannot join "+a.type.name+" onto "+e.type.name)}function wu(e,a,r){let n=e.node(r);return vu(n,a.node(r)),n}function zu(e,a){let r=a.length-1;r>=0&&e.isText&&e.sameMarkup(a[r])?a[r]=e.withText(a[r].text+e.text):a.push(e)}function ju(e,a,r,n){let i=(a||e).node(r),t=0,o=a?a.index(r):i.childCount;e&&(t=e.index(r),e.depth>r?t++:e.textOffset&&(zu(e.nodeAfter,n),t++));for(let e=t;e<o;e++)zu(i.child(e),n);a&&a.depth==r&&a.textOffset&&zu(a.nodeBefore,n)}function xu(e,a){return e.type.checkContent(a),e.copy(a)}function $u(e,a,r,n,i){let t=e.depth>i&&wu(e,a,i+1),o=n.depth>i&&wu(r,n,i+1),s=[];return ju(null,e,i,s),t&&o&&a.index(i)==r.index(i)?(vu(t,o),zu(xu(t,$u(e,a,r,n,i+1)),s)):(t&&zu(xu(t,qu(e,a,i+1)),s),ju(a,r,i,s),o&&zu(xu(o,qu(r,n,i+1)),s)),ju(n,null,i,s),new cu(s)}function qu(e,a,r){let n=[];if(ju(null,e,r,n),e.depth>r){zu(xu(wu(e,a,r+1),qu(e,a,r+1)),n)}return ju(a,null,r,n),new cu(n)}pu.empty=new pu(cu.empty,0,0);class Cu{constructor(e,a,r){this.pos=e,this.path=a,this.parentOffset=r,this.depth=a.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,a=this.index(this.depth);if(a==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],n=e.child(a);return r?e.child(a).cut(r):n}get nodeBefore(){let e=this.index(this.depth),a=this.pos-this.path[this.path.length-1];return a?this.parent.child(e).cut(0,a):0==e?null:this.parent.child(e-1)}posAtIndex(e,a){a=this.resolveDepth(a);let r=this.path[3*a],n=0==a?0:this.path[3*a-1]+1;for(let a=0;a<e;a++)n+=r.child(a).nodeSize;return n}marks(){let e=this.parent,a=this.index();if(0==e.content.size)return mu.none;if(this.textOffset)return e.child(a).marks;let r=e.maybeChild(a-1),n=e.maybeChild(a);if(!r){let e=r;r=n,n=e}let i=r.marks;for(var t=0;t<i.length;t++)!1!==i[t].type.spec.inclusive||n&&i[t].isInSet(n.marks)||(i=i[t--].removeFromSet(i));return i}marksAcross(e){let a=this.parent.maybeChild(this.index());if(!a||!a.isInline)return null;let r=a.marks,n=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)!1!==r[i].type.spec.inclusive||n&&r[i].isInSet(n.marks)||(r=r[i--].removeFromSet(r));return r}sharedDepth(e){for(let a=this.depth;a>0;a--)if(this.start(a)<=e&&this.end(a)>=e)return a;return 0}blockRange(e=this,a){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!a||a(this.node(r))))return new Mu(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let a=1;a<=this.depth;a++)e+=(e?"/":"")+this.node(a).type.name+"_"+this.index(a-1);return e+":"+this.parentOffset}static resolve(e,a){if(!(a>=0&&a<=e.content.size))throw new RangeError("Position "+a+" out of range");let r=[],n=0,i=a;for(let a=e;;){let{index:e,offset:t}=a.content.findIndex(i),o=i-t;if(r.push(a,e,n+t),!o)break;if(a=a.child(e),a.isText)break;i=o-1,n+=t+1}return new Cu(a,r,i)}static resolveCached(e,a){let r=Eu.get(e);if(r)for(let e=0;e<r.elts.length;e++){let n=r.elts[e];if(n.pos==a)return n}else Eu.set(e,r=new Su);let n=r.elts[r.i]=Cu.resolve(e,a);return r.i=(r.i+1)%Ou,n}}class Su{constructor(){this.elts=[],this.i=0}}const Ou=12,Eu=new WeakMap;class Mu{constructor(e,a,r){this.$from=e,this.$to=a,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const _u=Object.create(null);let Au=class e{constructor(e,a,r,n=mu.none){this.type=e,this.attrs=a,this.marks=n,this.content=r||cu.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,a,r,n=0){this.content.nodesBetween(e,a,r,n,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,a,r,n){return this.content.textBetween(e,a,r,n)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,a,r){return this.type==e&&hu(this.attrs,a||e.defaultAttrs||_u)&&mu.sameSet(this.marks,r||mu.none)}copy(a=null){return a==this.content?this:new e(this.type,this.attrs,a,this.marks)}mark(a){return a==this.marks?this:new e(this.type,this.attrs,this.content,a)}cut(e,a=this.content.size){return 0==e&&a==this.content.size?this:this.copy(this.content.cut(e,a))}slice(e,a=this.content.size,r=!1){if(e==a)return pu.empty;let n=this.resolve(e),i=this.resolve(a),t=r?0:n.sharedDepth(a),o=n.start(t),s=n.node(t).content.cut(n.pos-o,i.pos-o);return new pu(s,n.depth-t,i.depth-t)}replace(e,a,r){return ku(this.resolve(e),this.resolve(a),r)}nodeAt(e){for(let a=this;;){let{index:r,offset:n}=a.content.findIndex(e);if(a=a.maybeChild(r),!a)return null;if(n==e||a.isText)return a;e-=n+1}}childAfter(e){let{index:a,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(a),index:a,offset:r}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:a,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(a),index:a,offset:r};let n=this.content.child(a-1);return{node:n,index:a-1,offset:r-n.nodeSize}}resolve(e){return Cu.resolveCached(this,e)}resolveNoCache(e){return Cu.resolve(this,e)}rangeHasMark(e,a,r){let n=!1;return a>e&&this.nodesBetween(e,a,(e=>(r.isInSet(e.marks)&&(n=!0),!n))),n}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),Nu(this.marks,e)}contentMatchAt(e){let a=this.type.contentMatch.matchFragment(this.content,0,e);if(!a)throw new Error("Called contentMatchAt on a node with invalid content");return a}canReplace(e,a,r=cu.empty,n=0,i=r.childCount){let t=this.contentMatchAt(e).matchFragment(r,n,i),o=t&&t.matchFragment(this.content,a);if(!o||!o.validEnd)return!1;for(let e=n;e<i;e++)if(!this.type.allowsMarks(r.child(e).marks))return!1;return!0}canReplaceWith(e,a,r,n){if(n&&!this.type.allowsMarks(n))return!1;let i=this.contentMatchAt(e).matchType(r),t=i&&i.matchFragment(this.content,a);return!!t&&t.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=mu.none;for(let a=0;a<this.marks.length;a++){let r=this.marks[a];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!mu.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map((e=>e.type.name))}`);this.content.forEach((e=>e.check()))}toJSON(){let e={type:this.type.name};for(let a in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map((e=>e.toJSON()))),e}static fromJSON(e,a){if(!a)throw new RangeError("Invalid input for Node.fromJSON");let r;if(a.marks){if(!Array.isArray(a.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=a.marks.map(e.markFromJSON)}if("text"==a.type){if("string"!=typeof a.text)throw new RangeError("Invalid text node in JSON");return e.text(a.text,r)}let n=cu.fromJSON(e,a.content),i=e.nodeType(a.type).create(a.attrs,n,r);return i.type.checkAttrs(i.attrs),i}};Au.prototype.text=void 0;class Du extends Au{constructor(e,a,r,n){if(super(e,a,null,n),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):Nu(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,a){return this.text.slice(e,a)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Du(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Du(this.type,this.attrs,e,this.marks)}cut(e=0,a=this.text.length){return 0==e&&a==this.text.length?this:this.withText(this.text.slice(e,a))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function Nu(e,a){for(let r=e.length-1;r>=0;r--)a=e[r].type.name+"("+a+")";return a}class Tu{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,a){let r=new Iu(e,a);if(null==r.next)return Tu.empty;let n=Fu(r);r.next&&r.err("Unexpected trailing text");let i=function(e){let a=Object.create(null);return r(Hu(e,0));function r(n){let i=[];n.forEach((a=>{e[a].forEach((({term:a,to:r})=>{if(!a)return;let n;for(let e=0;e<i.length;e++)i[e][0]==a&&(n=i[e][1]);Hu(e,r).forEach((e=>{n||i.push([a,n=[]]),-1==n.indexOf(e)&&n.push(e)}))}))}));let t=a[n.join(",")]=new Tu(n.indexOf(e.length-1)>-1);for(let e=0;e<i.length;e++){let n=i[e][1].sort(Vu);t.next.push({type:i[e][0],next:a[n.join(",")]||r(n)})}return t}}(function(e){let a=[[]];return i(t(e,0),r()),a;function r(){return a.push([])-1}function n(e,r,n){let i={term:n,to:r};return a[e].push(i),i}function i(e,a){e.forEach((e=>e.to=a))}function t(e,a){if("choice"==e.type)return e.exprs.reduce(((e,r)=>e.concat(t(r,a))),[]);if("seq"!=e.type){if("star"==e.type){let o=r();return n(a,o),i(t(e.expr,o),o),[n(o)]}if("plus"==e.type){let o=r();return i(t(e.expr,a),o),i(t(e.expr,o),o),[n(o)]}if("opt"==e.type)return[n(a)].concat(t(e.expr,a));if("range"==e.type){let o=a;for(let a=0;a<e.min;a++){let a=r();i(t(e.expr,o),a),o=a}if(-1==e.max)i(t(e.expr,o),o);else for(let a=e.min;a<e.max;a++){let a=r();n(o,a),i(t(e.expr,o),a),o=a}return[n(o)]}if("name"==e.type)return[n(a,void 0,e.value)];throw new Error("Unknown expr type")}for(let n=0;;n++){let o=t(e.exprs[n],a);if(n==e.exprs.length-1)return o;i(o,a=r())}}}(n));return function(e,a){for(let r=0,n=[e];r<n.length;r++){let e=n[r],i=!e.validEnd,t=[];for(let a=0;a<e.next.length;a++){let{type:r,next:o}=e.next[a];t.push(r.name),!i||r.isText||r.hasRequiredAttrs()||(i=!1),-1==n.indexOf(o)&&n.push(o)}i&&a.err("Only non-generatable nodes ("+t.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,r),i}matchType(e){for(let a=0;a<this.next.length;a++)if(this.next[a].type==e)return this.next[a].next;return null}matchFragment(e,a=0,r=e.childCount){let n=this;for(let i=a;n&&i<r;i++)n=n.matchType(e.child(i).type);return n}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:a}=this.next[e];if(!a.isText&&!a.hasRequiredAttrs())return a}return null}compatible(e){for(let a=0;a<this.next.length;a++)for(let r=0;r<e.next.length;r++)if(this.next[a].type==e.next[r].type)return!0;return!1}fillBefore(e,a=!1,r=0){let n=[this];return function i(t,o){let s=t.matchFragment(e,r);if(s&&(!a||s.validEnd))return cu.from(o.map((e=>e.createAndFill())));for(let e=0;e<t.next.length;e++){let{type:a,next:r}=t.next[e];if(!a.isText&&!a.hasRequiredAttrs()&&-1==n.indexOf(r)){n.push(r);let e=i(r,o.concat(a));if(e)return e}}return null}(this,[])}findWrapping(e){for(let a=0;a<this.wrapCache.length;a+=2)if(this.wrapCache[a]==e)return this.wrapCache[a+1];let a=this.computeWrapping(e);return this.wrapCache.push(e,a),a}computeWrapping(e){let a=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let n=r.shift(),i=n.match;if(i.matchType(e)){let e=[];for(let a=n;a.type;a=a.via)e.push(a.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:t,next:o}=i.next[e];t.isLeaf||t.hasRequiredAttrs()||t.name in a||n.type&&!o.validEnd||(r.push({match:t.contentMatch,type:t,via:n}),a[t.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function a(r){e.push(r);for(let n=0;n<r.next.length;n++)-1==e.indexOf(r.next[n].next)&&a(r.next[n].next)}(this),e.map(((a,r)=>{let n=r+(a.validEnd?"*":" ")+" ";for(let r=0;r<a.next.length;r++)n+=(r?", ":"")+a.next[r].type.name+"->"+e.indexOf(a.next[r].next);return n})).join("\n")}}Tu.empty=new Tu(!0);class Iu{constructor(e,a){this.string=e,this.nodeTypes=a,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Fu(e){let a=[];do{a.push(Pu(e))}while(e.eat("|"));return 1==a.length?a[0]:{type:"choice",exprs:a}}function Pu(e){let a=[];do{a.push(Ru(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==a.length?a[0]:{type:"seq",exprs:a}}function Ru(e){let a=function(e){if(e.eat("(")){let a=Fu(e);return e.eat(")")||e.err("Missing closing paren"),a}if(!/\W/.test(e.next)){let a=function(e,a){let r=e.nodeTypes,n=r[a];if(n)return[n];let i=[];for(let e in r){let n=r[e];n.isInGroup(a)&&i.push(n)}0==i.length&&e.err("No node type or group '"+a+"' found");return i}(e,e.next).map((a=>(null==e.inline?e.inline=a.isInline:e.inline!=a.isInline&&e.err("Mixing inline and block content"),{type:"name",value:a})));return e.pos++,1==a.length?a[0]:{type:"choice",exprs:a}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))a={type:"plus",expr:a};else if(e.eat("*"))a={type:"star",expr:a};else if(e.eat("?"))a={type:"opt",expr:a};else{if(!e.eat("{"))break;a=Bu(e,a)}return a}function Lu(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let a=Number(e.next);return e.pos++,a}function Bu(e,a){let r=Lu(e),n=r;return e.eat(",")&&(n="}"!=e.next?Lu(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:r,max:n,expr:a}}function Vu(e,a){return a-e}function Hu(e,a){let r=[];return function a(n){let i=e[n];if(1==i.length&&!i[0].term)return a(i[0].to);r.push(n);for(let e=0;e<i.length;e++){let{term:n,to:t}=i[e];n||-1!=r.indexOf(t)||a(t)}}(a),r.sort(Vu)}function Wu(e){let a=Object.create(null);for(let r in e){let n=e[r];if(!n.hasDefault)return null;a[r]=n.default}return a}function Uu(e,a){let r=Object.create(null);for(let n in e){let i=a&&a[n];if(void 0===i){let a=e[n];if(!a.hasDefault)throw new RangeError("No value supplied for attribute "+n);i=a.default}r[n]=i}return r}function Gu(e,a,r,n){for(let n in a)if(!(n in e))throw new RangeError(`Unsupported attribute ${n} for ${r} of type ${n}`);for(let r in e){let n=e[r];n.validate&&n.validate(a[r])}}function Ku(e,a){let r=Object.create(null);if(a)for(let n in a)r[n]=new Ju(e,n,a[n]);return r}let Zu=class e{constructor(e,a,r){this.name=e,this.schema=a,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Ku(e,r.attrs),this.defaultAttrs=Wu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Tu.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:Uu(this.attrs,e)}create(e=null,a,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Au(this,this.computeAttrs(e),cu.from(a),mu.setFrom(r))}createChecked(e=null,a,r){return a=cu.from(a),this.checkContent(a),new Au(this,this.computeAttrs(e),a,mu.setFrom(r))}createAndFill(e=null,a,r){if(e=this.computeAttrs(e),(a=cu.from(a)).size){let e=this.contentMatch.fillBefore(a);if(!e)return null;a=e.append(a)}let n=this.contentMatch.matchFragment(a),i=n&&n.fillBefore(cu.empty,!0);return i?new Au(this,e,a.append(i),mu.setFrom(r)):null}validContent(e){let a=this.contentMatch.matchFragment(e);if(!a||!a.validEnd)return!1;for(let a=0;a<e.childCount;a++)if(!this.allowsMarks(e.child(a).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Gu(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let a=0;a<e.length;a++)if(!this.allowsMarkType(e[a].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let a;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?a&&a.push(e[r]):a||(a=e.slice(0,r));return a?a.length?a:mu.none:e}static compile(a,r){let n=Object.create(null);a.forEach(((a,i)=>n[a]=new e(a,r,i)));let i=r.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}};class Ju{constructor(e,a,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,a,r){let n=r.split("|");return r=>{let i=null===r?"null":typeof r;if(n.indexOf(i)<0)throw new RangeError(`Expected value of type ${n} for attribute ${a} on type ${e}, got ${i}`)}}(e,a,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class Yu{constructor(e,a,r,n){this.name=e,this.rank=a,this.schema=r,this.spec=n,this.attrs=Ku(e,n.attrs),this.excluded=null;let i=Wu(this.attrs);this.instance=i?new mu(this,i):null}create(e=null){return!e&&this.instance?this.instance:new mu(this,Uu(this.attrs,e))}static compile(e,a){let r=Object.create(null),n=0;return e.forEach(((e,i)=>r[e]=new Yu(e,n++,a,i))),r}removeFromSet(e){for(var a=0;a<e.length;a++)e[a].type==this&&(e=e.slice(0,a).concat(e.slice(a+1)),a--);return e}isInSet(e){for(let a=0;a<e.length;a++)if(e[a].type==this)return e[a]}checkAttrs(e){Gu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Xu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let a=this.spec={};for(let r in e)a[r]=e[r];a.nodes=ou.from(e.nodes),a.marks=ou.from(e.marks||{}),this.nodes=Zu.compile(this.spec.nodes,this),this.marks=Yu.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let a=this.nodes[e],n=a.spec.content||"",i=a.spec.marks;if(a.contentMatch=r[n]||(r[n]=Tu.parse(n,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet="_"==i?null:i?Qu(this,i.split(" ")):""!=i&&a.inlineContent?null:[]}for(let e in this.marks){let a=this.marks[e],r=a.spec.excludes;a.excluded=null==r?[a]:""==r?[]:Qu(this,r.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,a=null,r,n){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof Zu))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(a,r,n)}text(e,a){let r=this.nodes.text;return new Du(r,r.defaultAttrs,e,mu.setFrom(a))}mark(e,a){return"string"==typeof e&&(e=this.marks[e]),e.create(a)}nodeFromJSON(e){return Au.fromJSON(this,e)}markFromJSON(e){return mu.fromJSON(this,e)}nodeType(e){let a=this.nodes[e];if(!a)throw new RangeError("Unknown node type: "+e);return a}}function Qu(e,a){let r=[];for(let n=0;n<a.length;n++){let i=a[n],t=e.marks[i],o=t;if(t)r.push(t);else for(let a in e.marks){let n=e.marks[a];("_"==i||n.spec.group&&n.spec.group.split(" ").indexOf(i)>-1)&&r.push(o=n)}if(!o)throw new SyntaxError("Unknown mark type: '"+a[n]+"'")}return r}class eh{constructor(e,a){this.schema=e,this.rules=a,this.tags=[],this.styles=[];let r=this.matchedStyles=[];a.forEach((e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let a=/[^=]*/.exec(e.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(e)}})),this.normalizeLists=!this.tags.some((a=>{if(!/^(ul|ol)\b/.test(a.tag)||!a.node)return!1;let r=e.nodes[a.node];return r.contentMatch.matchType(r)}))}parse(e,a={}){let r=new oh(this,a,!1);return r.addAll(e,mu.none,a.from,a.to),r.finish()}parseSlice(e,a={}){let r=new oh(this,a,!0);return r.addAll(e,mu.none,a.from,a.to),pu.maxOpen(r.finish())}matchTag(e,a,r){for(let n=r?this.tags.indexOf(r)+1:0;n<this.tags.length;n++){let r=this.tags[n];if(sh(e,r.tag)&&(void 0===r.namespace||e.namespaceURI==r.namespace)&&(!r.context||a.matchesContext(r.context))){if(r.getAttrs){let a=r.getAttrs(e);if(!1===a)continue;r.attrs=a||void 0}return r}}}matchStyle(e,a,r,n){for(let i=n?this.styles.indexOf(n)+1:0;i<this.styles.length;i++){let n=this.styles[i],t=n.style;if(!(0!=t.indexOf(e)||n.context&&!r.matchesContext(n.context)||t.length>e.length&&(61!=t.charCodeAt(e.length)||t.slice(e.length+1)!=a))){if(n.getAttrs){let e=n.getAttrs(a);if(!1===e)continue;n.attrs=e||void 0}return n}}}static schemaRules(e){let a=[];function r(e){let r=null==e.priority?50:e.priority,n=0;for(;n<a.length;n++){let e=a[n];if((null==e.priority?50:e.priority)<r)break}a.splice(n,0,e)}for(let a in e.marks){let n=e.marks[a].spec.parseDOM;n&&n.forEach((e=>{r(e=lh(e)),e.mark||e.ignore||e.clearMark||(e.mark=a)}))}for(let a in e.nodes){let n=e.nodes[a].spec.parseDOM;n&&n.forEach((e=>{r(e=lh(e)),e.node||e.ignore||e.mark||(e.node=a)}))}return a}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new eh(e,eh.schemaRules(e)))}}const ah={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},rh={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},nh={ol:!0,ul:!0};function ih(e,a,r){return null!=a?(a?1:0)|("full"===a?2:0):e&&"pre"==e.whitespace?3:-5&r}class th{constructor(e,a,r,n,i,t){this.type=e,this.attrs=a,this.marks=r,this.solid=n,this.options=t,this.content=[],this.activeMarks=mu.none,this.match=i||(4&t?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let a=this.type.contentMatch.fillBefore(cu.from(e));if(!a){let a,r=this.type.contentMatch;return(a=r.findWrapping(e.type))?(this.match=r,a):null}this.match=this.type.contentMatch.matchFragment(a)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,a=this.content[this.content.length-1];if(a&&a.isText&&(e=/[ \t\r\n\u000c]+$/.exec(a.text))){let r=a;a.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-e[0].length))}}let a=cu.from(this.content);return!e&&this.match&&(a=a.append(this.match.fillBefore(cu.empty,!0))),this.type?this.type.create(this.attrs,a,this.marks):a}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ah.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class oh{constructor(e,a,r){this.parser=e,this.options=a,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let n,i=a.topNode,t=ih(null,a.preserveWhitespace,0)|(r?4:0);n=i?new th(i.type,i.attrs,mu.none,!0,a.topMatch||i.type.contentMatch,t):new th(r?null:e.schema.topNodeType,null,mu.none,!0,null,t),this.nodes=[n],this.find=a.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,a){3==e.nodeType?this.addTextNode(e,a):1==e.nodeType&&this.addElement(e,a)}addTextNode(e,a){let r=e.nodeValue,n=this.top,i=2&n.options?"full":this.localPreserveWS||(1&n.options)>0;if("full"===i||n.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)r="full"!==i?r.replace(/\r?\n|\r/g," "):r.replace(/\r\n?/g,"\n");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=n.content[n.content.length-1],i=e.previousSibling;(!a||i&&"BR"==i.nodeName||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),a),this.findInText(e)}else this.findInside(e)}addElement(e,a,r){let n=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let t,o=e.nodeName.toLowerCase();nh.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let a=e.firstChild,r=null;a;a=a.nextSibling){let e=1==a.nodeType?a.nodeName.toLowerCase():null;e&&nh.hasOwnProperty(e)&&r?(r.appendChild(a),a=r):"li"==e?r=a:e&&(r=null)}}(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(t=this.parser.matchTag(e,this,r));e:if(s?s.ignore:rh.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,a);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let r,n=this.needsBlock;if(ah.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),r=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,a);break e}let t=s&&s.skip?a:this.readStyles(e,a);t&&this.addAll(e,t),r&&this.sync(i),this.needsBlock=n}else{let r=this.readStyles(e,a);r&&this.addElementByRule(e,s,r,!1===s.consuming?t:void 0)}this.localPreserveWS=n}leafFallback(e,a){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),a)}ignoreFallback(e,a){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),a)}readStyles(e,a){let r=e.style;if(r&&r.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let n=this.parser.matchedStyles[e],i=r.getPropertyValue(n);if(i)for(let e;;){let r=this.parser.matchStyle(n,i,this,e);if(!r)break;if(r.ignore)return null;if(a=r.clearMark?a.filter((e=>!r.clearMark(e))):a.concat(this.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming)break;e=r}}return a}addElementByRule(e,a,r,n){let i,t;if(a.node)if(t=this.parser.schema.nodes[a.node],t.isLeaf)this.insertNode(t.create(a.attrs),r)||this.leafFallback(e,r);else{let e=this.enter(t,a.attrs||null,r,a.preserveWhitespace);e&&(i=!0,r=e)}else{let e=this.parser.schema.marks[a.mark];r=r.concat(e.create(a.attrs))}let o=this.top;if(t&&t.isLeaf)this.findInside(e);else if(n)this.addElement(e,r,n);else if(a.getContent)this.findInside(e),a.getContent(e,this.parser.schema).forEach((e=>this.insertNode(e,r)));else{let n=e;"string"==typeof a.contentElement?n=e.querySelector(a.contentElement):"function"==typeof a.contentElement?n=a.contentElement(e):a.contentElement&&(n=a.contentElement),this.findAround(e,n,!0),this.addAll(n,r),this.findAround(e,n,!1)}i&&this.sync(o)&&this.open--}addAll(e,a,r,n){let i=r||0;for(let t=r?e.childNodes[r]:e.firstChild,o=null==n?null:e.childNodes[n];t!=o;t=t.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(t,a);this.findAtPoint(e,i)}findPlace(e,a){let r,n;for(let a=this.open;a>=0;a--){let i=this.nodes[a],t=i.findWrapping(e);if(t&&(!r||r.length>t.length)&&(r=t,n=i,!t.length))break;if(i.solid)break}if(!r)return null;this.sync(n);for(let e=0;e<r.length;e++)a=this.enterInner(r[e],null,a,!1);return a}insertNode(e,a){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(a=this.enterInner(e,null,a))}let r=this.findPlace(e,a);if(r){this.closeExtra();let a=this.top;a.match&&(a.match=a.match.matchType(e.type));let n=mu.none;for(let i of r.concat(e.marks))(a.type?a.type.allowsMarkType(i.type):ch(i.type,e.type))&&(n=i.addToSet(n));return a.content.push(e.mark(n)),!0}return!1}enter(e,a,r,n){let i=this.findPlace(e.create(a),r);return i&&(i=this.enterInner(e,a,r,!0,n)),i}enterInner(e,a,r,n=!1,i){this.closeExtra();let t=this.top;t.match=t.match&&t.match.matchType(e);let o=ih(e,i,t.options);4&t.options&&0==t.content.length&&(o|=4);let s=mu.none;return r=r.filter((a=>!(t.type?t.type.allowsMarkType(a.type):ch(a.type,e))||(s=a.addToSet(s),!1))),this.nodes.push(new th(e,a,s,n,null,o)),this.open++,r}closeExtra(e=!1){let a=this.nodes.length-1;if(a>this.open){for(;a>this.open;a--)this.nodes[a-1].content.push(this.nodes[a].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let a=this.open;a>=0;a--){if(this.nodes[a]==e)return this.open=a,!0;this.localPreserveWS&&(this.nodes[a].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let a=this.open;a>=0;a--){let r=this.nodes[a].content;for(let a=r.length-1;a>=0;a--)e+=r[a].nodeSize;a&&e++}return e}findAtPoint(e,a){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==a&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let a=0;a<this.find.length;a++)null==this.find[a].pos&&1==e.nodeType&&e.contains(this.find[a].node)&&(this.find[a].pos=this.currentPos)}findAround(e,a,r){if(e!=a&&this.find)for(let n=0;n<this.find.length;n++)if(null==this.find[n].pos&&1==e.nodeType&&e.contains(this.find[n].node)){a.compareDocumentPosition(this.find[n].node)&(r?2:4)&&(this.find[n].pos=this.currentPos)}}findInText(e){if(this.find)for(let a=0;a<this.find.length;a++)this.find[a].node==e&&(this.find[a].pos=this.currentPos-(e.nodeValue.length-this.find[a].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let a=e.split("/"),r=this.options.context,n=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(n?0:1),t=(e,o)=>{for(;e>=0;e--){let s=a[e];if(""==s){if(e==a.length-1||0==e)continue;for(;o>=i;o--)if(t(e-1,o))return!0;return!1}{let e=o>0||0==o&&n?this.nodes[o].type:r&&o>=i?r.node(o-i).type:null;if(!e||e.name!=s&&!e.isInGroup(s))return!1;o--}}return!0};return t(a.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let a=e.depth;a>=0;a--){let r=e.node(a).contentMatchAt(e.indexAfter(a)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let a=this.parser.schema.nodes[e];if(a.isTextblock&&a.defaultAttrs)return a}}}function sh(e,a){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,a)}function lh(e){let a={};for(let r in e)a[r]=e[r];return a}function ch(e,a){let r=a.schema.nodes;for(let n in r){let i=r[n];if(!i.allowsMarkType(e))continue;let t=[],o=e=>{t.push(e);for(let r=0;r<e.edgeCount;r++){let{type:n,next:i}=e.edge(r);if(n==a)return!0;if(t.indexOf(i)<0&&o(i))return!0}};if(o(i.contentMatch))return!0}}class dh{constructor(e,a){this.nodes=e,this.marks=a}serializeFragment(e,a={},r){r||(r=hh(a).createDocumentFragment());let n=r,i=[];return e.forEach((e=>{if(i.length||e.marks.length){let r=0,t=0;for(;r<i.length&&t<e.marks.length;){let a=e.marks[t];if(this.marks[a.type.name]){if(!a.eq(i[r][0])||!1===a.type.spec.spanning)break;r++,t++}else t++}for(;r<i.length;)n=i.pop()[1];for(;t<e.marks.length;){let r=e.marks[t++],o=this.serializeMark(r,e.isInline,a);o&&(i.push([r,n]),n.appendChild(o.dom),n=o.contentDOM||o.dom)}}n.appendChild(this.serializeNodeInner(e,a))})),r}serializeNodeInner(e,a){let{dom:r,contentDOM:n}=ph(hh(a),this.nodes[e.type.name](e),null,e.attrs);if(n){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,a,n)}return r}serializeNode(e,a={}){let r=this.serializeNodeInner(e,a);for(let n=e.marks.length-1;n>=0;n--){let i=this.serializeMark(e.marks[n],e.isInline,a);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,a,r={}){let n=this.marks[e.type.name];return n&&ph(hh(r),n(e,a),null,e.attrs)}static renderSpec(e,a,r=null,n){return ph(e,a,r,n)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new dh(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let a=uh(e.nodes);return a.text||(a.text=e=>e.text),a}static marksFromSchema(e){return uh(e.marks)}}function uh(e){let a={};for(let r in e){let n=e[r].spec.toDOM;n&&(a[r]=n)}return a}function hh(e){return e.document||window.document}const mh=new WeakMap;function gh(e){let a=mh.get(e);return void 0===a&&mh.set(e,a=function(e){let a=null;function r(e){if(e&&"object"==typeof e)if(Array.isArray(e))if("string"==typeof e[0])a||(a=[]),a.push(e);else for(let a=0;a<e.length;a++)r(e[a]);else for(let a in e)r(e[a])}return r(e),a}(e)),a}function ph(e,a,r,n){if("string"==typeof a)return{dom:e.createTextNode(a)};if(null!=a.nodeType)return{dom:a};if(a.dom&&null!=a.dom.nodeType)return a;let i,t=a[0];if("string"!=typeof t)throw new RangeError("Invalid array passed to renderSpec");if(n&&(i=gh(n))&&i.indexOf(a)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o,s=t.indexOf(" ");s>0&&(r=t.slice(0,s),t=t.slice(s+1));let l=r?e.createElementNS(r,t):e.createElement(t),c=a[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let a=e.indexOf(" ");a>0?l.setAttributeNS(e.slice(0,a),e.slice(a+1),c[e]):l.setAttribute(e,c[e])}}for(let i=d;i<a.length;i++){let t=a[i];if(0===t){if(i<a.length-1||i>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:a,contentDOM:i}=ph(e,t,r,n);if(l.appendChild(a),i){if(o)throw new RangeError("Multiple content holes");o=i}}}return{dom:l,contentDOM:o}}const bh=Math.pow(2,16);function fh(e,a){return e+a*bh}function kh(e){return 65535&e}class yh{constructor(e,a,r){this.pos=e,this.delInfo=a,this.recover=r}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class vh{constructor(e,a=!1){if(this.ranges=e,this.inverted=a,!e.length&&vh.empty)return vh.empty}recover(e){let a=0,r=kh(e);if(!this.inverted)for(let e=0;e<r;e++)a+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*r]+a+function(e){return(e-(65535&e))/bh}(e)}mapResult(e,a=1){return this._map(e,a,!1)}map(e,a=1){return this._map(e,a,!0)}_map(e,a,r){let n=0,i=this.inverted?2:1,t=this.inverted?1:2;for(let o=0;o<this.ranges.length;o+=3){let s=this.ranges[o]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[o+i],c=this.ranges[o+t],d=s+l;if(e<=d){let i=s+n+((l?e==s?-1:e==d?1:a:a)<0?0:c);if(r)return i;let t=e==(a<0?s:d)?null:fh(o/3,e-s),u=e==s?2:e==d?1:4;return(a<0?e!=s:e!=d)&&(u|=8),new yh(i,u,t)}n+=c-l}return r?e+n:new yh(e+n,0,null)}touches(e,a){let r=0,n=kh(a),i=this.inverted?2:1,t=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let o=this.ranges[a]-(this.inverted?r:0);if(o>e)break;let s=this.ranges[a+i];if(e<=o+s&&a==3*n)return!0;r+=this.ranges[a+t]-s}return!1}forEach(e){let a=this.inverted?2:1,r=this.inverted?1:2;for(let n=0,i=0;n<this.ranges.length;n+=3){let t=this.ranges[n],o=t-(this.inverted?i:0),s=t+(this.inverted?0:i),l=this.ranges[n+a],c=this.ranges[n+r];e(o,o+l,s,s+c),i+=c-l}}invert(){return new vh(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?vh.empty:new vh(e<0?[0,-e,0]:[0,0,e])}}vh.empty=new vh([]);class wh{constructor(e=[],a,r=0,n=e.length){this.maps=e,this.mirror=a,this.from=r,this.to=n}slice(e=0,a=this.maps.length){return new wh(this.maps,this.mirror,e,a)}copy(){return new wh(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,a){this.to=this.maps.push(e),null!=a&&this.setMirror(this.maps.length-1,a)}appendMapping(e){for(let a=0,r=this.maps.length;a<e.maps.length;a++){let n=e.getMirror(a);this.appendMap(e.maps[a],null!=n&&n<a?r+n:void 0)}}getMirror(e){if(this.mirror)for(let a=0;a<this.mirror.length;a++)if(this.mirror[a]==e)return this.mirror[a+(a%2?-1:1)]}setMirror(e,a){this.mirror||(this.mirror=[]),this.mirror.push(e,a)}appendMappingInverted(e){for(let a=e.maps.length-1,r=this.maps.length+e.maps.length;a>=0;a--){let n=e.getMirror(a);this.appendMap(e.maps[a].invert(),null!=n&&n>a?r-n-1:void 0)}}invert(){let e=new wh;return e.appendMappingInverted(this),e}map(e,a=1){if(this.mirror)return this._map(e,a,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,a);return e}mapResult(e,a=1){return this._map(e,a,!1)}_map(e,a,r){let n=0;for(let r=this.from;r<this.to;r++){let i=this.maps[r].mapResult(e,a);if(null!=i.recover){let a=this.getMirror(r);if(null!=a&&a>r&&a<this.to){r=a,e=this.maps[a].recover(i.recover);continue}}n|=i.delInfo,e=i.pos}return r?e:new yh(e,n,null)}}const zh=Object.create(null);class jh{getMap(){return vh.empty}merge(e){return null}static fromJSON(e,a){if(!a||!a.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=zh[a.stepType];if(!r)throw new RangeError(`No step type ${a.stepType} defined`);return r.fromJSON(e,a)}static jsonID(e,a){if(e in zh)throw new RangeError("Duplicate use of step JSON ID "+e);return zh[e]=a,a.prototype.jsonID=e,a}}class xh{constructor(e,a){this.doc=e,this.failed=a}static ok(e){return new xh(e,null)}static fail(e){return new xh(null,e)}static fromReplace(e,a,r,n){try{return xh.ok(e.replace(a,r,n))}catch(e){if(e instanceof gu)return xh.fail(e.message);throw e}}}function $h(e,a,r){let n=[];for(let i=0;i<e.childCount;i++){let t=e.child(i);t.content.size&&(t=t.copy($h(t.content,a,t))),t.isInline&&(t=a(t,r,i)),n.push(t)}return cu.fromArray(n)}class qh extends jh{constructor(e,a,r){super(),this.from=e,this.to=a,this.mark=r}apply(e){let a=e.slice(this.from,this.to),r=e.resolve(this.from),n=r.node(r.sharedDepth(this.to)),i=new pu($h(a.content,((e,a)=>e.isAtom&&a.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e),n),a.openStart,a.openEnd);return xh.fromReplace(e,this.from,this.to,i)}invert(){return new Ch(this.from,this.to,this.mark)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deleted&&r.deleted||a.pos>=r.pos?null:new qh(a.pos,r.pos,this.mark)}merge(e){return e instanceof qh&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qh(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qh(a.from,a.to,e.markFromJSON(a.mark))}}jh.jsonID("addMark",qh);class Ch extends jh{constructor(e,a,r){super(),this.from=e,this.to=a,this.mark=r}apply(e){let a=e.slice(this.from,this.to),r=new pu($h(a.content,(e=>e.mark(this.mark.removeFromSet(e.marks))),e),a.openStart,a.openEnd);return xh.fromReplace(e,this.from,this.to,r)}invert(){return new qh(this.from,this.to,this.mark)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deleted&&r.deleted||a.pos>=r.pos?null:new Ch(a.pos,r.pos,this.mark)}merge(e){return e instanceof Ch&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ch(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ch(a.from,a.to,e.markFromJSON(a.mark))}}jh.jsonID("removeMark",Ch);class Sh extends jh{constructor(e,a){super(),this.pos=e,this.mark=a}apply(e){let a=e.nodeAt(this.pos);if(!a)return xh.fail("No node at mark step's position");let r=a.type.create(a.attrs,null,this.mark.addToSet(a.marks));return xh.fromReplace(e,this.pos,this.pos+1,new pu(cu.from(r),0,a.isLeaf?0:1))}invert(e){let a=e.nodeAt(this.pos);if(a){let e=this.mark.addToSet(a.marks);if(e.length==a.marks.length){for(let r=0;r<a.marks.length;r++)if(!a.marks[r].isInSet(e))return new Sh(this.pos,a.marks[r]);return new Sh(this.pos,this.mark)}}return new Oh(this.pos,this.mark)}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new Sh(a.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Sh(a.pos,e.markFromJSON(a.mark))}}jh.jsonID("addNodeMark",Sh);class Oh extends jh{constructor(e,a){super(),this.pos=e,this.mark=a}apply(e){let a=e.nodeAt(this.pos);if(!a)return xh.fail("No node at mark step's position");let r=a.type.create(a.attrs,null,this.mark.removeFromSet(a.marks));return xh.fromReplace(e,this.pos,this.pos+1,new pu(cu.from(r),0,a.isLeaf?0:1))}invert(e){let a=e.nodeAt(this.pos);return a&&this.mark.isInSet(a.marks)?new Sh(this.pos,this.mark):this}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new Oh(a.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Oh(a.pos,e.markFromJSON(a.mark))}}jh.jsonID("removeNodeMark",Oh);class Eh extends jh{constructor(e,a,r,n=!1){super(),this.from=e,this.to=a,this.slice=r,this.structure=n}apply(e){return this.structure&&_h(e,this.from,this.to)?xh.fail("Structure replace would overwrite content"):xh.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new vh([this.from,this.to-this.from,this.slice.size])}invert(e){return new Eh(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return a.deletedAcross&&r.deletedAcross?null:new Eh(a.pos,Math.max(a.pos,r.pos),this.slice)}merge(e){if(!(e instanceof Eh)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let a=this.slice.size+e.slice.size==0?pu.empty:new pu(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Eh(e.from,this.to,a,this.structure)}}{let a=this.slice.size+e.slice.size==0?pu.empty:new pu(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Eh(this.from,this.to+(e.to-e.from),a,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,a){if("number"!=typeof a.from||"number"!=typeof a.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Eh(a.from,a.to,pu.fromJSON(e,a.slice),!!a.structure)}}jh.jsonID("replace",Eh);class Mh extends jh{constructor(e,a,r,n,i,t,o=!1){super(),this.from=e,this.to=a,this.gapFrom=r,this.gapTo=n,this.slice=i,this.insert=t,this.structure=o}apply(e){if(this.structure&&(_h(e,this.from,this.gapFrom)||_h(e,this.gapTo,this.to)))return xh.fail("Structure gap-replace would overwrite content");let a=e.slice(this.gapFrom,this.gapTo);if(a.openStart||a.openEnd)return xh.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,a.content);return r?xh.fromReplace(e,this.from,this.to,r):xh.fail("Content does not fit in gap")}getMap(){return new vh([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let a=this.gapTo-this.gapFrom;return new Mh(this.from,this.from+this.slice.size+a,this.from+this.insert,this.from+this.insert+a,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let a=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),n=this.from==this.gapFrom?a.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return a.deletedAcross&&r.deletedAcross||n<a.pos||i>r.pos?null:new Mh(a.pos,r.pos,n,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,a){if("number"!=typeof a.from||"number"!=typeof a.to||"number"!=typeof a.gapFrom||"number"!=typeof a.gapTo||"number"!=typeof a.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Mh(a.from,a.to,a.gapFrom,a.gapTo,pu.fromJSON(e,a.slice),a.insert,!!a.structure)}}function _h(e,a,r){let n=e.resolve(a),i=r-a,t=n.depth;for(;i>0&&t>0&&n.indexAfter(t)==n.node(t).childCount;)t--,i--;if(i>0){let e=n.node(t).maybeChild(n.indexAfter(t));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function Ah(e,a,r,n=r.contentMatch,i=!0){let t=e.doc.nodeAt(a),o=[],s=a+1;for(let a=0;a<t.childCount;a++){let l=t.child(a),c=s+l.nodeSize,d=n.matchType(l.type);if(d){n=d;for(let a=0;a<l.marks.length;a++)r.allowsMarkType(l.marks[a].type)||e.step(new Ch(s,c,l.marks[a]));if(i&&l.isText&&"pre"!=r.whitespace){let e,a,n=/\r?\n|\r/g;for(;e=n.exec(l.text);)a||(a=new pu(cu.from(r.schema.text(" ",r.allowedMarks(l.marks))),0,0)),o.push(new Eh(s+e.index,s+e.index+e[0].length,a))}}else o.push(new Eh(s,c,pu.empty));s=c}if(!n.validEnd){let a=n.fillBefore(cu.empty,!0);e.replace(s,s,new pu(a,0,0))}for(let a=o.length-1;a>=0;a--)e.step(o[a])}function Dh(e,a,r){return(0==a||e.canReplace(a,e.childCount))&&(r==e.childCount||e.canReplace(0,r))}function Nh(e){let a=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let n=e.$from.node(r),i=e.$from.index(r),t=e.$to.indexAfter(r);if(r<e.depth&&n.canReplace(i,t,a))return r;if(0==r||n.type.spec.isolating||!Dh(n,i,t))break}return null}function Th(e,a,r=null,n=e){let i=function(e,a){let{parent:r,startIndex:n,endIndex:i}=e,t=r.contentMatchAt(n).findWrapping(a);if(!t)return null;let o=t.length?t[0]:a;return r.canReplaceWith(n,i,o)?t:null}(e,a),t=i&&function(e,a){let{parent:r,startIndex:n,endIndex:i}=e,t=r.child(n),o=a.contentMatch.findWrapping(t.type);if(!o)return null;let s=(o.length?o[o.length-1]:a).contentMatch;for(let e=n;s&&e<i;e++)s=s.matchType(r.child(e).type);return s&&s.validEnd?o:null}(n,a);return t?i.map(Ih).concat({type:a,attrs:r}).concat(t.map(Ih)):null}function Ih(e){return{type:e,attrs:null}}function Fh(e,a,r,n){a.forEach(((i,t)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let i=e.mapping.slice(n).map(r+1+t+o.index);e.replaceWith(i,i+1,a.type.schema.linebreakReplacement.create())}}}))}function Ph(e,a,r,n){a.forEach(((i,t)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(n).map(r+1+t);e.replaceWith(i,i+1,a.type.schema.text("\n"))}}))}function Rh(e,a,r=1,n){let i=e.resolve(a),t=i.depth-r,o=n&&n[n.length-1]||i.parent;if(t<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,a=r-2;e>t;e--,a--){let r=i.node(e),t=i.index(e);if(r.type.spec.isolating)return!1;let o=r.content.cutByIndex(t,r.childCount),s=n&&n[a+1];s&&(o=o.replaceChild(0,s.type.create(s.attrs)));let l=n&&n[a]||r;if(!r.canReplace(t+1,r.childCount)||!l.type.validContent(o))return!1}let s=i.indexAfter(t),l=n&&n[0];return i.node(t).canReplaceWith(s,s,l?l.type:i.node(t+1).type)}function Lh(e,a){let r=e.resolve(a),n=r.index();return Bh(r.nodeBefore,r.nodeAfter)&&r.parent.canReplace(n,n+1)}function Bh(e,a){return!(!e||!a||e.isLeaf||!function(e,a){a.content.size||e.type.compatibleContent(a.type);let r=e.contentMatchAt(e.childCount),{linebreakReplacement:n}=e.type.schema;for(let i=0;i<a.childCount;i++){let t=a.child(i),o=t.type==n?e.type.schema.nodes.text:t.type;if(r=r.matchType(o),!r)return!1;if(!e.type.allowsMarks(t.marks))return!1}return r.validEnd}(e,a))}function Vh(e,a,r=-1){let n=e.resolve(a);for(let e=n.depth;;e--){let i,t,o=n.index(e);if(e==n.depth?(i=n.nodeBefore,t=n.nodeAfter):r>0?(i=n.node(e+1),o++,t=n.node(e).maybeChild(o)):(i=n.node(e).maybeChild(o-1),t=n.node(e+1)),i&&!i.isTextblock&&Bh(i,t)&&n.node(e).canReplace(o,o+1))return a;if(0==e)break;a=r<0?n.before(e):n.after(e)}}function Hh(e,a,r){let n=e.resolve(a);if(!r.content.size)return a;let i=r.content;for(let e=0;e<r.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==r.openStart&&r.size?2:1);e++)for(let a=n.depth;a>=0;a--){let r=a==n.depth?0:n.pos<=(n.start(a+1)+n.end(a+1))/2?-1:1,t=n.index(a)+(r>0?1:0),o=n.node(a),s=!1;if(1==e)s=o.canReplace(t,t,i);else{let e=o.contentMatchAt(t).findWrapping(i.firstChild.type);s=e&&o.canReplaceWith(t,t,e[0])}if(s)return 0==r?n.pos:r<0?n.before(a+1):n.after(a+1)}return null}function Wh(e,a,r=a,n=pu.empty){if(a==r&&!n.size)return null;let i=e.resolve(a),t=e.resolve(r);return Uh(i,t,n)?new Eh(a,r,n):new Gh(i,t,n).fit()}function Uh(e,a,r){return!r.openStart&&!r.openEnd&&e.start()==a.start()&&e.parent.canReplace(e.index(),a.index(),r.content)}jh.jsonID("replaceAround",Mh);class Gh{constructor(e,a,r){this.$from=e,this.$to=a,this.unplaced=r,this.frontier=[],this.placed=cu.empty;for(let a=0;a<=e.depth;a++){let r=e.node(a);this.frontier.push({type:r.type,match:r.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=cu.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),a=this.placed.size-this.depth-this.$from.depth,r=this.$from,n=this.close(e<0?this.$to:r.doc.resolve(e));if(!n)return null;let i=this.placed,t=r.depth,o=n.depth;for(;t&&o&&1==i.childCount;)i=i.firstChild.content,t--,o--;let s=new pu(i,t,o);return e>-1?new Mh(r.pos,e,this.$to.pos,this.$to.end(),s,a):s.size||r.pos!=this.$to.pos?new Eh(r.pos,n.pos,s):null}findFittable(){let e=this.unplaced.openStart;for(let a=this.unplaced.content,r=0,n=this.unplaced.openEnd;r<e;r++){let i=a.firstChild;if(a.childCount>1&&(n=0),i.type.spec.isolating&&n<=r){e=r;break}a=i.content}for(let a=1;a<=2;a++)for(let r=1==a?e:this.unplaced.openStart;r>=0;r--){let e,n=null;r?(n=Jh(this.unplaced.content,r-1).firstChild,e=n.content):e=this.unplaced.content;let i=e.firstChild;for(let e=this.depth;e>=0;e--){let t,{type:o,match:s}=this.frontier[e],l=null;if(1==a&&(i?s.matchType(i.type)||(l=s.fillBefore(cu.from(i),!1)):n&&o.compatibleContent(n.type)))return{sliceDepth:r,frontierDepth:e,parent:n,inject:l};if(2==a&&i&&(t=s.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:e,parent:n,wrap:t};if(n&&s.matchType(n.type))break}}}openMore(){let{content:e,openStart:a,openEnd:r}=this.unplaced,n=Jh(e,a);return!(!n.childCount||n.firstChild.isLeaf)&&(this.unplaced=new pu(e,a+1,Math.max(r,n.size+a>=e.size-r?a+1:0)),!0)}dropNode(){let{content:e,openStart:a,openEnd:r}=this.unplaced,n=Jh(e,a);if(n.childCount<=1&&a>0){let i=e.size-a<=a+n.size;this.unplaced=new pu(Kh(e,a-1,1),a-1,i?a-1:r)}else this.unplaced=new pu(Kh(e,a,1),a,r)}placeNodes({sliceDepth:e,frontierDepth:a,parent:r,inject:n,wrap:i}){for(;this.depth>a;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let t=this.unplaced,o=r?r.content:t.content,s=t.openStart-e,l=0,c=[],{match:d,type:u}=this.frontier[a];if(n){for(let e=0;e<n.childCount;e++)c.push(n.child(e));d=d.matchFragment(n)}let h=o.size+e-(t.content.size-t.openEnd);for(;l<o.childCount;){let e=o.child(l),a=d.matchType(e.type);if(!a)break;l++,(l>1||0==s||e.content.size)&&(d=a,c.push(Yh(e.mark(u.allowedMarks(e.marks)),1==l?s:0,l==o.childCount?h:-1)))}let m=l==o.childCount;m||(h=-1),this.placed=Zh(this.placed,a,cu.from(c)),this.frontier[a].match=d,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,a=o;e<h;e++){let e=a.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),a=e.content}this.unplaced=m?0==e?pu.empty:new pu(Kh(t.content,e-1,1),e-1,h<0?t.openEnd:e-1):new pu(Kh(t.content,e,l),t.openStart,t.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,a=this.frontier[this.depth];if(!a.type.isTextblock||!Xh(this.$to,this.$to.depth,a.type,a.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:r}=this.$to,n=this.$to.after(r);for(;r>1&&n==this.$to.end(--r);)++n;return n}findCloseLevel(e){e:for(let a=Math.min(this.depth,e.depth);a>=0;a--){let{match:r,type:n}=this.frontier[a],i=a<e.depth&&e.end(a+1)==e.pos+(e.depth-(a+1)),t=Xh(e,a,n,r,i);if(t){for(let r=a-1;r>=0;r--){let{match:a,type:n}=this.frontier[r],i=Xh(e,r,n,a,!0);if(!i||i.childCount)continue e}return{depth:a,fit:t,move:i?e.doc.resolve(e.after(a+1)):e}}}}close(e){let a=this.findCloseLevel(e);if(!a)return null;for(;this.depth>a.depth;)this.closeFrontierNode();a.fit.childCount&&(this.placed=Zh(this.placed,a.depth,a.fit)),e=a.move;for(let r=a.depth+1;r<=e.depth;r++){let a=e.node(r),n=a.type.contentMatch.fillBefore(a.content,!0,e.index(r));this.openFrontierNode(a.type,a.attrs,n)}return e}openFrontierNode(e,a=null,r){let n=this.frontier[this.depth];n.match=n.match.matchType(e),this.placed=Zh(this.placed,this.depth,cu.from(e.create(a,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(cu.empty,!0);e.childCount&&(this.placed=Zh(this.placed,this.frontier.length,e))}}function Kh(e,a,r){return 0==a?e.cutByIndex(r,e.childCount):e.replaceChild(0,e.firstChild.copy(Kh(e.firstChild.content,a-1,r)))}function Zh(e,a,r){return 0==a?e.append(r):e.replaceChild(e.childCount-1,e.lastChild.copy(Zh(e.lastChild.content,a-1,r)))}function Jh(e,a){for(let r=0;r<a;r++)e=e.firstChild.content;return e}function Yh(e,a,r){if(a<=0)return e;let n=e.content;return a>1&&(n=n.replaceChild(0,Yh(n.firstChild,a-1,1==n.childCount?r-1:0))),a>0&&(n=e.type.contentMatch.fillBefore(n).append(n),r<=0&&(n=n.append(e.type.contentMatch.matchFragment(n).fillBefore(cu.empty,!0)))),e.copy(n)}function Xh(e,a,r,n,i){let t=e.node(a),o=i?e.indexAfter(a):e.index(a);if(o==t.childCount&&!r.compatibleContent(t.type))return null;let s=n.fillBefore(t.content,!0,o);return s&&!function(e,a,r){for(let n=r;n<a.childCount;n++)if(!e.allowsMarks(a.child(n).marks))return!0;return!1}(r,t.content,o)?s:null}function Qh(e,a,r,n,i){if(a<r){let i=e.firstChild;e=e.replaceChild(0,i.copy(Qh(i.content,a+1,r,n,i)))}if(a>n){let a=i.contentMatchAt(0),r=a.fillBefore(e).append(e);e=r.append(a.matchFragment(r).fillBefore(cu.empty,!0))}return e}function em(e,a){let r=[];for(let n=Math.min(e.depth,a.depth);n>=0;n--){let i=e.start(n);if(i<e.pos-(e.depth-n)||a.end(n)>a.pos+(a.depth-n)||e.node(n).type.spec.isolating||a.node(n).type.spec.isolating)break;(i==a.start(n)||n==e.depth&&n==a.depth&&e.parent.inlineContent&&a.parent.inlineContent&&n&&a.start(n-1)==i-1)&&r.push(n)}return r}class am extends jh{constructor(e,a,r){super(),this.pos=e,this.attr=a,this.value=r}apply(e){let a=e.nodeAt(this.pos);if(!a)return xh.fail("No node at attribute step's position");let r=Object.create(null);for(let e in a.attrs)r[e]=a.attrs[e];r[this.attr]=this.value;let n=a.type.create(r,null,a.marks);return xh.fromReplace(e,this.pos,this.pos+1,new pu(cu.from(n),0,a.isLeaf?0:1))}getMap(){return vh.empty}invert(e){return new am(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let a=e.mapResult(this.pos,1);return a.deletedAfter?null:new am(a.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,a){if("number"!=typeof a.pos||"string"!=typeof a.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new am(a.pos,a.attr,a.value)}}jh.jsonID("attr",am);class rm extends jh{constructor(e,a){super(),this.attr=e,this.value=a}apply(e){let a=Object.create(null);for(let r in e.attrs)a[r]=e.attrs[r];a[this.attr]=this.value;let r=e.type.create(a,e.content,e.marks);return xh.ok(r)}getMap(){return vh.empty}invert(e){return new rm(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,a){if("string"!=typeof a.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new rm(a.attr,a.value)}}jh.jsonID("docAttr",rm);let nm=class extends Error{};nm=function e(a){let r=Error.call(this,a);return r.__proto__=e.prototype,r},(nm.prototype=Object.create(Error.prototype)).constructor=nm,nm.prototype.name="TransformError";class im{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new wh}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let a=this.maybeStep(e);if(a.failed)throw new nm(a.failed);return this}maybeStep(e){let a=e.apply(this.doc);return a.failed||this.addStep(e,a.doc),a}get docChanged(){return this.steps.length>0}addStep(e,a){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=a}replace(e,a=e,r=pu.empty){let n=Wh(this.doc,e,a,r);return n&&this.step(n),this}replaceWith(e,a,r){return this.replace(e,a,new pu(cu.from(r),0,0))}delete(e,a){return this.replace(e,a,pu.empty)}insert(e,a){return this.replaceWith(e,e,a)}replaceRange(e,a,r){return function(e,a,r,n){if(!n.size)return e.deleteRange(a,r);let i=e.doc.resolve(a),t=e.doc.resolve(r);if(Uh(i,t,n))return e.step(new Eh(a,r,n));let o=em(i,e.doc.resolve(r));0==o[o.length-1]&&o.pop();let s=-(i.depth+1);o.unshift(s);for(let e=i.depth,a=i.pos-1;e>0;e--,a--){let r=i.node(e).type.spec;if(r.defining||r.definingAsContext||r.isolating)break;o.indexOf(e)>-1?s=e:i.before(e)==a&&o.splice(1,0,-e)}let l=o.indexOf(s),c=[],d=n.openStart;for(let e=n.content,a=0;;a++){let r=e.firstChild;if(c.push(r),a==n.openStart)break;e=r.content}for(let e=d-1;e>=0;e--){let a=c[e],r=(u=a.type).spec.defining||u.spec.definingForContent;if(r&&!a.sameMarkup(i.node(Math.abs(s)-1)))d=e;else if(r||!a.type.isTextblock)break}var u;for(let a=n.openStart;a>=0;a--){let s=(a+d+1)%(n.openStart+1),u=c[s];if(u)for(let a=0;a<o.length;a++){let c=o[(a+l)%o.length],d=!0;c<0&&(d=!1,c=-c);let h=i.node(c-1),m=i.index(c-1);if(h.canReplaceWith(m,m,u.type,u.marks))return e.replace(i.before(c),d?t.after(c):r,new pu(Qh(n.content,0,n.openStart,s),s,n.openEnd))}}let h=e.steps.length;for(let s=o.length-1;s>=0&&(e.replace(a,r,n),!(e.steps.length>h));s--){let e=o[s];e<0||(a=i.before(e),r=t.after(e))}}(this,e,a,r),this}replaceRangeWith(e,a,r){return function(e,a,r,n){if(!n.isInline&&a==r&&e.doc.resolve(a).parent.content.size){let i=function(e,a,r){let n=e.resolve(a);if(n.parent.canReplaceWith(n.index(),n.index(),r))return a;if(0==n.parentOffset)for(let e=n.depth-1;e>=0;e--){let a=n.index(e);if(n.node(e).canReplaceWith(a,a,r))return n.before(e+1);if(a>0)return null}if(n.parentOffset==n.parent.content.size)for(let e=n.depth-1;e>=0;e--){let a=n.indexAfter(e);if(n.node(e).canReplaceWith(a,a,r))return n.after(e+1);if(a<n.node(e).childCount)return null}return null}(e.doc,a,n.type);null!=i&&(a=r=i)}e.replaceRange(a,r,new pu(cu.from(n),0,0))}(this,e,a,r),this}deleteRange(e,a){return function(e,a,r){let n=e.doc.resolve(a),i=e.doc.resolve(r),t=em(n,i);for(let a=0;a<t.length;a++){let r=t[a],o=a==t.length-1;if(o&&0==r||n.node(r).type.contentMatch.validEnd)return e.delete(n.start(r),i.end(r));if(r>0&&(o||n.node(r-1).canReplace(n.index(r-1),i.indexAfter(r-1))))return e.delete(n.before(r),i.after(r))}for(let t=1;t<=n.depth&&t<=i.depth;t++)if(a-n.start(t)==n.depth-t&&r>n.end(t)&&i.end(t)-r!=i.depth-t&&n.start(t-1)==i.start(t-1)&&n.node(t-1).canReplace(n.index(t-1),i.index(t-1)))return e.delete(n.before(t),r);e.delete(a,r)}(this,e,a),this}lift(e,a){return function(e,a,r){let{$from:n,$to:i,depth:t}=a,o=n.before(t+1),s=i.after(t+1),l=o,c=s,d=cu.empty,u=0;for(let e=t,a=!1;e>r;e--)a||n.index(e)>0?(a=!0,d=cu.from(n.node(e).copy(d)),u++):l--;let h=cu.empty,m=0;for(let e=t,a=!1;e>r;e--)a||i.after(e+1)<i.end(e)?(a=!0,h=cu.from(i.node(e).copy(h)),m++):c++;e.step(new Mh(l,c,o,s,new pu(d.append(h),u,m),d.size-u,!0))}(this,e,a),this}join(e,a=1){return function(e,a,r){let n=null,{linebreakReplacement:i}=e.doc.type.schema,t=e.doc.resolve(a-r),o=t.node().type;if(i&&o.inlineContent){let e="pre"==o.whitespace,a=!!o.contentMatch.matchType(i);e&&!a?n=!1:!e&&a&&(n=!0)}let s=e.steps.length;if(!1===n){let n=e.doc.resolve(a+r);Ph(e,n.node(),n.before(),s)}o.inlineContent&&Ah(e,a+r-1,o,t.node().contentMatchAt(t.index()),null==n);let l=e.mapping.slice(s),c=l.map(a-r);if(e.step(new Eh(c,l.map(a+r,-1),pu.empty,!0)),!0===n){let a=e.doc.resolve(c);Fh(e,a.node(),a.before(),e.steps.length)}}(this,e,a),this}wrap(e,a){return function(e,a,r){let n=cu.empty;for(let e=r.length-1;e>=0;e--){if(n.size){let a=r[e].type.contentMatch.matchFragment(n);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=cu.from(r[e].type.create(r[e].attrs,n))}let i=a.start,t=a.end;e.step(new Mh(i,t,i,t,new pu(n,0,0),r.length,!0))}(this,e,a),this}setBlockType(e,a=e,r,n=null){return function(e,a,r,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let t=e.steps.length;e.doc.nodesBetween(a,r,((a,r)=>{let o="function"==typeof i?i(a):i;if(a.isTextblock&&!a.hasMarkup(n,o)&&function(e,a,r){let n=e.resolve(a),i=n.index();return n.parent.canReplaceWith(i,i+1,r)}(e.doc,e.mapping.slice(t).map(r),n)){let i=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,a=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!a?i=!1:!e&&a&&(i=!0)}!1===i&&Ph(e,a,r,t),Ah(e,e.mapping.slice(t).map(r,1),n,void 0,null===i);let s=e.mapping.slice(t),l=s.map(r,1),c=s.map(r+a.nodeSize,1);return e.step(new Mh(l,c,l+1,c-1,new pu(cu.from(n.create(o,null,a.marks)),0,0),1,!0)),!0===i&&Fh(e,a,r,t),!1}}))}(this,e,a,r,n),this}setNodeMarkup(e,a,r=null,n){return function(e,a,r,n,i){let t=e.doc.nodeAt(a);if(!t)throw new RangeError("No node at given position");r||(r=t.type);let o=r.create(n,null,i||t.marks);if(t.isLeaf)return e.replaceWith(a,a+t.nodeSize,o);if(!r.validContent(t.content))throw new RangeError("Invalid content for node type "+r.name);e.step(new Mh(a,a+t.nodeSize,a+1,a+t.nodeSize-1,new pu(cu.from(o),0,0),1,!0))}(this,e,a,r,n),this}setNodeAttribute(e,a,r){return this.step(new am(e,a,r)),this}setDocAttribute(e,a){return this.step(new rm(e,a)),this}addNodeMark(e,a){return this.step(new Sh(e,a)),this}removeNodeMark(e,a){if(!(a instanceof mu)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(!(a=a.isInSet(r.marks)))return this}return this.step(new Oh(e,a)),this}split(e,a=1,r){return function(e,a,r=1,n){let i=e.doc.resolve(a),t=cu.empty,o=cu.empty;for(let e=i.depth,a=i.depth-r,s=r-1;e>a;e--,s--){t=cu.from(i.node(e).copy(t));let a=n&&n[s];o=cu.from(a?a.type.create(a.attrs,o):i.node(e).copy(o))}e.step(new Eh(a,a,new pu(t.append(o),r,r),!0))}(this,e,a,r),this}addMark(e,a,r){return function(e,a,r,n){let i,t,o=[],s=[];e.doc.nodesBetween(a,r,((e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(l,a),u=Math.min(l+e.nodeSize,r),h=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=u:o.push(i=new Ch(c,u,d[e])));t&&t.to==c?t.to=u:s.push(t=new qh(c,u,n))}})),o.forEach((a=>e.step(a))),s.forEach((a=>e.step(a)))}(this,e,a,r),this}removeMark(e,a,r){return function(e,a,r,n){let i=[],t=0;e.doc.nodesBetween(a,r,((e,o)=>{if(!e.isInline)return;t++;let s=null;if(n instanceof Yu){let a,r=e.marks;for(;a=n.isInSet(r);)(s||(s=[])).push(a),r=a.removeFromSet(r)}else n?n.isInSet(e.marks)&&(s=[n]):s=e.marks;if(s&&s.length){let n=Math.min(o+e.nodeSize,r);for(let e=0;e<s.length;e++){let r,l=s[e];for(let e=0;e<i.length;e++){let a=i[e];a.step==t-1&&l.eq(i[e].style)&&(r=a)}r?(r.to=n,r.step=t):i.push({style:l,from:Math.max(o,a),to:n,step:t})}}})),i.forEach((a=>e.step(new Ch(a.from,a.to,a.style))))}(this,e,a,r),this}clearIncompatible(e,a,r){return Ah(this,e,a,r),this}}const tm=Object.create(null);class om{constructor(e,a,r){this.$anchor=e,this.$head=a,this.ranges=r||[new sm(e.min(a),e.max(a))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let a=0;a<e.length;a++)if(e[a].$from.pos!=e[a].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,a=pu.empty){let r=a.content.lastChild,n=null;for(let e=0;e<a.openEnd;e++)n=r,r=r.lastChild;let i=e.steps.length,t=this.ranges;for(let o=0;o<t.length;o++){let{$from:s,$to:l}=t[o],c=e.mapping.slice(i);e.replaceRange(c.map(s.pos),c.map(l.pos),o?pu.empty:a),0==o&&fm(e,i,(r?r.isInline:n&&n.isTextblock)?-1:1)}}replaceWith(e,a){let r=e.steps.length,n=this.ranges;for(let i=0;i<n.length;i++){let{$from:t,$to:o}=n[i],s=e.mapping.slice(r),l=s.map(t.pos),c=s.map(o.pos);i?e.deleteRange(l,c):(e.replaceRangeWith(l,c,a),fm(e,r,a.isInline?-1:1))}}static findFrom(e,a,r=!1){let n=e.parent.inlineContent?new dm(e):bm(e.node(0),e.parent,e.pos,e.index(),a,r);if(n)return n;for(let n=e.depth-1;n>=0;n--){let i=a<0?bm(e.node(0),e.node(n),e.before(n+1),e.index(n),a,r):bm(e.node(0),e.node(n),e.after(n+1),e.index(n)+1,a,r);if(i)return i}return null}static near(e,a=1){return this.findFrom(e,a)||this.findFrom(e,-a)||new gm(e.node(0))}static atStart(e){return bm(e,e,0,0,1)||new gm(e)}static atEnd(e){return bm(e,e,e.content.size,e.childCount,-1)||new gm(e)}static fromJSON(e,a){if(!a||!a.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=tm[a.type];if(!r)throw new RangeError(`No selection type ${a.type} defined`);return r.fromJSON(e,a)}static jsonID(e,a){if(e in tm)throw new RangeError("Duplicate use of selection JSON ID "+e);return tm[e]=a,a.prototype.jsonID=e,a}getBookmark(){return dm.between(this.$anchor,this.$head).getBookmark()}}om.prototype.visible=!0;class sm{constructor(e,a){this.$from=e,this.$to=a}}let lm=!1;function cm(e){lm||e.parent.inlineContent||(lm=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class dm extends om{constructor(e,a=e){cm(e),cm(a),super(e,a)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,a){let r=e.resolve(a.map(this.head));if(!r.parent.inlineContent)return om.near(r);let n=e.resolve(a.map(this.anchor));return new dm(n.parent.inlineContent?n:r,r)}replace(e,a=pu.empty){if(super.replace(e,a),a==pu.empty){let a=this.$from.marksAcross(this.$to);a&&e.ensureMarks(a)}}eq(e){return e instanceof dm&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new um(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,a){if("number"!=typeof a.anchor||"number"!=typeof a.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new dm(e.resolve(a.anchor),e.resolve(a.head))}static create(e,a,r=a){let n=e.resolve(a);return new this(n,r==a?n:e.resolve(r))}static between(e,a,r){let n=e.pos-a.pos;if(r&&!n||(r=n>=0?1:-1),!a.parent.inlineContent){let e=om.findFrom(a,r,!0)||om.findFrom(a,-r,!0);if(!e)return om.near(a,r);a=e.$head}return e.parent.inlineContent||(0==n||(e=(om.findFrom(e,-r,!0)||om.findFrom(e,r,!0)).$anchor).pos<a.pos!=n<0)&&(e=a),new dm(e,a)}}om.jsonID("text",dm);class um{constructor(e,a){this.anchor=e,this.head=a}map(e){return new um(e.map(this.anchor),e.map(this.head))}resolve(e){return dm.between(e.resolve(this.anchor),e.resolve(this.head))}}class hm extends om{constructor(e){let a=e.nodeAfter,r=e.node(0).resolve(e.pos+a.nodeSize);super(e,r),this.node=a}map(e,a){let{deleted:r,pos:n}=a.mapResult(this.anchor),i=e.resolve(n);return r?om.near(i):new hm(i)}content(){return new pu(cu.from(this.node),0,0)}eq(e){return e instanceof hm&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new mm(this.anchor)}static fromJSON(e,a){if("number"!=typeof a.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new hm(e.resolve(a.anchor))}static create(e,a){return new hm(e.resolve(a))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}hm.prototype.visible=!1,om.jsonID("node",hm);class mm{constructor(e){this.anchor=e}map(e){let{deleted:a,pos:r}=e.mapResult(this.anchor);return a?new um(r,r):new mm(r)}resolve(e){let a=e.resolve(this.anchor),r=a.nodeAfter;return r&&hm.isSelectable(r)?new hm(a):om.near(a)}}class gm extends om{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,a=pu.empty){if(a==pu.empty){e.delete(0,e.doc.content.size);let a=om.atStart(e.doc);a.eq(e.selection)||e.setSelection(a)}else super.replace(e,a)}toJSON(){return{type:"all"}}static fromJSON(e){return new gm(e)}map(e){return new gm(e)}eq(e){return e instanceof gm}getBookmark(){return pm}}om.jsonID("all",gm);const pm={map(){return this},resolve:e=>new gm(e)};function bm(e,a,r,n,i,t=!1){if(a.inlineContent)return dm.create(e,r);for(let o=n-(i>0?0:1);i>0?o<a.childCount:o>=0;o+=i){let n=a.child(o);if(n.isAtom){if(!t&&hm.isSelectable(n))return hm.create(e,r-(i<0?n.nodeSize:0))}else{let a=bm(e,n,r+i,i<0?n.childCount:0,i,t);if(a)return a}r+=n.nodeSize*i}return null}function fm(e,a,r){let n=e.steps.length-1;if(n<a)return;let i,t=e.steps[n];(t instanceof Eh||t instanceof Mh)&&(e.mapping.maps[n].forEach(((e,a,r,n)=>{null==i&&(i=n)})),e.setSelection(om.near(e.doc.resolve(i),r)))}class km extends im{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return mu.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,a){super.addStep(e,a),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,a=!0){let r=this.selection;return a&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||mu.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,a,r){let n=this.doc.type.schema;if(null==a)return e?this.replaceSelectionWith(n.text(e),!0):this.deleteSelection();{if(null==r&&(r=a),r=null==r?a:r,!e)return this.deleteRange(a,r);let i=this.storedMarks;if(!i){let e=this.doc.resolve(a);i=r==a?e.marks():e.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(a,r,n.text(e,i)),this.selection.empty||this.setSelection(om.near(this.selection.$to)),this}}setMeta(e,a){return this.meta["string"==typeof e?e:e.key]=a,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function ym(e,a){return a&&e?e.bind(a):e}class vm{constructor(e,a,r){this.name=e,this.init=ym(a.init,r),this.apply=ym(a.apply,r)}}const wm=[new vm("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new vm("selection",{init:(e,a)=>e.selection||om.atStart(a.doc),apply:e=>e.selection}),new vm("storedMarks",{init:e=>e.storedMarks||null,apply:(e,a,r,n)=>n.selection.$cursor?e.storedMarks:null}),new vm("scrollToSelection",{init:()=>0,apply:(e,a)=>e.scrolledIntoView?a+1:a})];class zm{constructor(e,a){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=wm.slice(),a&&a.forEach((e=>{if(this.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new vm(e.key,e.spec.state,e))}))}}class jm{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,a=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=a){let a=this.config.plugins[r];if(a.spec.filterTransaction&&!a.spec.filterTransaction.call(a,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let a=[e],r=this.applyInner(e),n=null;for(;;){let i=!1;for(let t=0;t<this.config.plugins.length;t++){let o=this.config.plugins[t];if(o.spec.appendTransaction){let s=n?n[t].n:0,l=n?n[t].state:this,c=s<a.length&&o.spec.appendTransaction.call(o,s?a.slice(s):a,l,r);if(c&&r.filterTransaction(c,t)){if(c.setMeta("appendedTransaction",e),!n){n=[];for(let e=0;e<this.config.plugins.length;e++)n.push(e<t?{state:r,n:a.length}:{state:this,n:0})}a.push(c),r=r.applyInner(c),i=!0}n&&(n[t]={state:r,n:a.length})}}if(!i)return{state:r,transactions:a}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let a=new jm(this.config),r=this.config.fields;for(let n=0;n<r.length;n++){let i=r[n];a[i.name]=i.apply(e,this[i.name],this,a)}return a}get tr(){return new km(this)}static create(e){let a=new zm(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new jm(a);for(let n=0;n<a.fields.length;n++)r[a.fields[n].name]=a.fields[n].init(e,r);return r}reconfigure(e){let a=new zm(this.schema,e.plugins),r=a.fields,n=new jm(a);for(let a=0;a<r.length;a++){let i=r[a].name;n[i]=this.hasOwnProperty(i)?this[i]:r[a].init(e,n)}return n}toJSON(e){let a={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(a.storedMarks=this.storedMarks.map((e=>e.toJSON()))),e&&"object"==typeof e)for(let r in e){if("doc"==r||"selection"==r)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let n=e[r],i=n.spec.state;i&&i.toJSON&&(a[r]=i.toJSON.call(n,this[n.key]))}return a}static fromJSON(e,a,r){if(!a)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let n=new zm(e.schema,e.plugins),i=new jm(n);return n.fields.forEach((n=>{if("doc"==n.name)i.doc=Au.fromJSON(e.schema,a.doc);else if("selection"==n.name)i.selection=om.fromJSON(i.doc,a.selection);else if("storedMarks"==n.name)a.storedMarks&&(i.storedMarks=a.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let t in r){let o=r[t],s=o.spec.state;if(o.key==n.name&&s&&s.fromJSON&&Object.prototype.hasOwnProperty.call(a,t))return void(i[n.name]=s.fromJSON.call(o,e,a[t],i))}i[n.name]=n.init(e,i)}})),i}}function xm(e,a,r){for(let n in e){let i=e[n];i instanceof Function?i=i.bind(a):"handleDOMEvents"==n&&(i=xm(i,a,{})),r[n]=i}return r}class $m{constructor(e){this.spec=e,this.props={},e.props&&xm(e.props,this,this.props),this.key=e.key?e.key.key:Cm("plugin")}getState(e){return e[this.key]}}const qm=Object.create(null);function Cm(e){return e in qm?e+"$"+ ++qm[e]:(qm[e]=0,e+"$")}class Sm{constructor(e="key"){this.key=Cm(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Om=function(e){for(var a=0;;a++)if(!(e=e.previousSibling))return a},Em=function(e){let a=e.assignedSlot||e.parentNode;return a&&11==a.nodeType?a.host:a};let Mm=null;const _m=function(e,a,r){let n=Mm||(Mm=document.createRange());return n.setEnd(e,null==r?e.nodeValue.length:r),n.setStart(e,a||0),n},Am=function(e,a,r,n){return r&&(Nm(e,a,r,n,-1)||Nm(e,a,r,n,1))},Dm=/^(img|br|input|textarea|hr)$/i;function Nm(e,a,r,n,i){for(;;){if(e==r&&a==n)return!0;if(a==(i<0?0:Tm(e))){let r=e.parentNode;if(!r||1!=r.nodeType||Im(e)||Dm.test(e.nodeName)||"false"==e.contentEditable)return!1;a=Om(e)+(i<0?0:1),e=r}else{if(1!=e.nodeType)return!1;if("false"==(e=e.childNodes[a+(i<0?-1:0)]).contentEditable)return!1;a=i<0?Tm(e):0}}}function Tm(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function Im(e){let a;for(let r=e;r&&!(a=r.pmViewDesc);r=r.parentNode);return a&&a.node&&a.node.isBlock&&(a.dom==e||a.contentDOM==e)}const Fm=function(e){return e.focusNode&&Am(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function Pm(e,a){let r=document.createEvent("Event");return r.initEvent("keydown",!0,!0),r.keyCode=e,r.key=r.code=a,r}const Rm="undefined"!=typeof navigator?navigator:null,Lm="undefined"!=typeof document?document:null,Bm=Rm&&Rm.userAgent||"",Vm=/Edge\/(\d+)/.exec(Bm),Hm=/MSIE \d/.exec(Bm),Wm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Bm),Um=!!(Hm||Wm||Vm),Gm=Hm?document.documentMode:Wm?+Wm[1]:Vm?+Vm[1]:0,Km=!Um&&/gecko\/(\d+)/i.test(Bm);Km&&(/Firefox\/(\d+)/.exec(Bm)||[0,0])[1];const Zm=!Um&&/Chrome\/(\d+)/.exec(Bm),Jm=!!Zm,Ym=Zm?+Zm[1]:0,Xm=!Um&&!!Rm&&/Apple Computer/.test(Rm.vendor),Qm=Xm&&(/Mobile\/\w+/.test(Bm)||!!Rm&&Rm.maxTouchPoints>2),eg=Qm||!!Rm&&/Mac/.test(Rm.platform),ag=!!Rm&&/Win/.test(Rm.platform),rg=/Android \d/.test(Bm),ng=!!Lm&&"webkitFontSmoothing"in Lm.documentElement.style,ig=ng?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tg(e){let a=e.defaultView&&e.defaultView.visualViewport;return a?{left:0,right:a.width,top:0,bottom:a.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function og(e,a){return"number"==typeof e?e:e[a]}function sg(e){let a=e.getBoundingClientRect(),r=a.width/e.offsetWidth||1,n=a.height/e.offsetHeight||1;return{left:a.left,right:a.left+e.clientWidth*r,top:a.top,bottom:a.top+e.clientHeight*n}}function lg(e,a,r){let n=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,t=e.dom.ownerDocument;for(let o=r||e.dom;o;o=Em(o)){if(1!=o.nodeType)continue;let e=o,r=e==t.body,s=r?tg(t):sg(e),l=0,c=0;if(a.top<s.top+og(n,"top")?c=-(s.top-a.top+og(i,"top")):a.bottom>s.bottom-og(n,"bottom")&&(c=a.bottom-a.top>s.bottom-s.top?a.top+og(i,"top")-s.top:a.bottom-s.bottom+og(i,"bottom")),a.left<s.left+og(n,"left")?l=-(s.left-a.left+og(i,"left")):a.right>s.right-og(n,"right")&&(l=a.right-s.right+og(i,"right")),l||c)if(r)t.defaultView.scrollBy(l,c);else{let r=e.scrollLeft,n=e.scrollTop;c&&(e.scrollTop+=c),l&&(e.scrollLeft+=l);let i=e.scrollLeft-r,t=e.scrollTop-n;a={left:a.left-i,top:a.top-t,right:a.right-i,bottom:a.bottom-t}}if(r||/^(fixed|sticky)$/.test(getComputedStyle(o).position))break}}function cg(e){let a=[],r=e.ownerDocument;for(let n=e;n&&(a.push({dom:n,top:n.scrollTop,left:n.scrollLeft}),e!=r);n=Em(n));return a}function dg(e,a){for(let r=0;r<e.length;r++){let{dom:n,top:i,left:t}=e[r];n.scrollTop!=i+a&&(n.scrollTop=i+a),n.scrollLeft!=t&&(n.scrollLeft=t)}}let ug=null;function hg(e,a){let r,n,i,t,o=2e8,s=0,l=a.top,c=a.top;for(let d=e.firstChild,u=0;d;d=d.nextSibling,u++){let e;if(1==d.nodeType)e=d.getClientRects();else{if(3!=d.nodeType)continue;e=_m(d).getClientRects()}for(let h=0;h<e.length;h++){let m=e[h];if(m.top<=l&&m.bottom>=c){l=Math.max(m.bottom,l),c=Math.min(m.top,c);let e=m.left>a.left?m.left-a.left:m.right<a.left?a.left-m.right:0;if(e<o){r=d,o=e,n=e&&3==r.nodeType?{left:m.right<a.left?m.right:m.left,top:a.top}:a,1==d.nodeType&&e&&(s=u+(a.left>=(m.left+m.right)/2?1:0));continue}}else m.top>a.top&&!i&&m.left<=a.left&&m.right>=a.left&&(i=d,t={left:Math.max(m.left,Math.min(m.right,a.left)),top:m.top});!r&&(a.left>=m.right&&a.top>=m.top||a.left>=m.left&&a.top>=m.bottom)&&(s=u+1)}}return!r&&i&&(r=i,n=t,o=0),r&&3==r.nodeType?function(e,a){let r=e.nodeValue.length,n=document.createRange();for(let i=0;i<r;i++){n.setEnd(e,i+1),n.setStart(e,i);let r=fg(n,1);if(r.top!=r.bottom&&mg(a,r))return{node:e,offset:i+(a.left>=(r.left+r.right)/2?1:0)}}return{node:e,offset:0}}(r,n):!r||o&&1==r.nodeType?{node:e,offset:s}:hg(r,n)}function mg(e,a){return e.left>=a.left-1&&e.left<=a.right+1&&e.top>=a.top-1&&e.top<=a.bottom+1}function gg(e,a,r){let n=e.childNodes.length;if(n&&r.top<r.bottom)for(let i=Math.max(0,Math.min(n-1,Math.floor(n*(a.top-r.top)/(r.bottom-r.top))-2)),t=i;;){let r=e.childNodes[t];if(1==r.nodeType){let e=r.getClientRects();for(let n=0;n<e.length;n++){let i=e[n];if(mg(a,i))return gg(r,a,i)}}if((t=(t+1)%n)==i)break}return e}function pg(e,a){let r,n=e.dom.ownerDocument,i=0,t=function(e,a,r){if(e.caretPositionFromPoint)try{let n=e.caretPositionFromPoint(a,r);if(n)return{node:n.offsetNode,offset:Math.min(Tm(n.offsetNode),n.offset)}}catch(e){}if(e.caretRangeFromPoint){let n=e.caretRangeFromPoint(a,r);if(n)return{node:n.startContainer,offset:Math.min(Tm(n.startContainer),n.startOffset)}}}(n,a.left,a.top);t&&({node:r,offset:i}=t);let o,s=(e.root.elementFromPoint?e.root:n).elementFromPoint(a.left,a.top);if(!s||!e.dom.contains(1!=s.nodeType?s.parentNode:s)){let r=e.dom.getBoundingClientRect();if(!mg(a,r))return null;if(s=gg(e.dom,a,r),!s)return null}if(Xm)for(let e=s;r&&e;e=Em(e))e.draggable&&(r=void 0);if(s=function(e,a){let r=e.parentNode;return r&&/^li$/i.test(r.nodeName)&&a.left<e.getBoundingClientRect().left?r:e}(s,a),r){if(Km&&1==r.nodeType&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let e,n=r.childNodes[i];"IMG"==n.nodeName&&(e=n.getBoundingClientRect()).right<=a.left&&e.bottom>a.top&&i++}let n;ng&&i&&1==r.nodeType&&1==(n=r.childNodes[i-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=a.top&&i--,r==e.dom&&i==r.childNodes.length-1&&1==r.lastChild.nodeType&&a.top>r.lastChild.getBoundingClientRect().bottom?o=e.state.doc.content.size:0!=i&&1==r.nodeType&&"BR"==r.childNodes[i-1].nodeName||(o=function(e,a,r,n){let i=-1;for(let r=a,t=!1;r!=e.dom;){let a,o=e.docView.nearestDesc(r,!0);if(!o)return null;if(1==o.dom.nodeType&&(o.node.isBlock&&o.parent||!o.contentDOM)&&((a=o.dom.getBoundingClientRect()).width||a.height)&&(o.node.isBlock&&o.parent&&(!t&&a.left>n.left||a.top>n.top?i=o.posBefore:(!t&&a.right<n.left||a.bottom<n.top)&&(i=o.posAfter),t=!0),!o.contentDOM&&i<0&&!o.node.isText))return(o.node.isBlock?n.top<(a.top+a.bottom)/2:n.left<(a.left+a.right)/2)?o.posBefore:o.posAfter;r=o.dom.parentNode}return i>-1?i:e.docView.posFromDOM(a,r,-1)}(e,r,i,a))}null==o&&(o=function(e,a,r){let{node:n,offset:i}=hg(a,r),t=-1;if(1==n.nodeType&&!n.firstChild){let e=n.getBoundingClientRect();t=e.left!=e.right&&r.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(n,i,t)}(e,s,a));let l=e.docView.nearestDesc(s,!0);return{pos:o,inside:l?l.posAtStart-l.border:-1}}function bg(e){return e.top<e.bottom||e.left<e.right}function fg(e,a){let r=e.getClientRects();if(r.length){let e=r[a<0?0:r.length-1];if(bg(e))return e}return Array.prototype.find.call(r,bg)||e.getBoundingClientRect()}const kg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function yg(e,a,r){let{node:n,offset:i,atom:t}=e.docView.domFromPos(a,r<0?-1:1),o=ng||Km;if(3==n.nodeType){if(!o||!kg.test(n.nodeValue)&&(r<0?i:i!=n.nodeValue.length)){let e=i,a=i,t=r<0?1:-1;return r<0&&!i?(a++,t=-1):r>=0&&i==n.nodeValue.length?(e--,t=1):r<0?e--:a++,vg(fg(_m(n,e,a),t),t<0)}{let e=fg(_m(n,i,i),r);if(Km&&i&&/\s/.test(n.nodeValue[i-1])&&i<n.nodeValue.length){let a=fg(_m(n,i-1,i-1),-1);if(a.top==e.top){let r=fg(_m(n,i,i+1),-1);if(r.top!=e.top)return vg(r,r.left<a.left)}}return e}}if(!e.state.doc.resolve(a-(t||0)).parent.inlineContent){if(null==t&&i&&(r<0||i==Tm(n))){let e=n.childNodes[i-1];if(1==e.nodeType)return wg(e.getBoundingClientRect(),!1)}if(null==t&&i<Tm(n)){let e=n.childNodes[i];if(1==e.nodeType)return wg(e.getBoundingClientRect(),!0)}return wg(n.getBoundingClientRect(),r>=0)}if(null==t&&i&&(r<0||i==Tm(n))){let e=n.childNodes[i-1],a=3==e.nodeType?_m(e,Tm(e)-(o?0:1)):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(a)return vg(fg(a,1),!1)}if(null==t&&i<Tm(n)){let e=n.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let a=e?3==e.nodeType?_m(e,0,o?0:1):1==e.nodeType?e:null:null;if(a)return vg(fg(a,-1),!0)}return vg(fg(3==n.nodeType?_m(n):n,-r),r>=0)}function vg(e,a){if(0==e.width)return e;let r=a?e.left:e.right;return{top:e.top,bottom:e.bottom,left:r,right:r}}function wg(e,a){if(0==e.height)return e;let r=a?e.top:e.bottom;return{top:r,bottom:r,left:e.left,right:e.right}}function zg(e,a,r){let n=e.state,i=e.root.activeElement;n!=a&&e.updateState(a),i!=e.dom&&e.focus();try{return r()}finally{n!=a&&e.updateState(n),i!=e.dom&&i&&i.focus()}}const jg=/[\u0590-\u08ac]/;let xg=null,$g=null,qg=!1;function Cg(e,a,r){return xg==a&&$g==r?qg:(xg=a,$g=r,qg="up"==r||"down"==r?function(e,a,r){let n=a.selection,i="up"==r?n.$from:n.$to;return zg(e,a,(()=>{let{node:a}=e.docView.domFromPos(i.pos,"up"==r?-1:1);for(;;){let r=e.docView.nearestDesc(a,!0);if(!r)break;if(r.node.isBlock){a=r.contentDOM||r.dom;break}a=r.dom.parentNode}let n=yg(e,i.pos,1);for(let e=a.firstChild;e;e=e.nextSibling){let a;if(1==e.nodeType)a=e.getClientRects();else{if(3!=e.nodeType)continue;a=_m(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<a.length;e++){let i=a[e];if(i.bottom>i.top+1&&("up"==r?n.top-i.top>2*(i.bottom-n.top):i.bottom-n.bottom>2*(n.bottom-i.top)))return!1}}return!0}))}(e,a,r):function(e,a,r){let{$head:n}=a.selection;if(!n.parent.isTextblock)return!1;let i=n.parentOffset,t=!i,o=i==n.parent.content.size,s=e.domSelection();return s?jg.test(n.parent.textContent)&&s.modify?zg(e,a,(()=>{let{focusNode:a,focusOffset:i,anchorNode:t,anchorOffset:o}=e.domSelectionRange(),l=s.caretBidiLevel;s.modify("move",r,"character");let c=n.depth?e.docView.domAfterPos(n.before()):e.dom,{focusNode:d,focusOffset:u}=e.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||a==d&&i==u;try{s.collapse(t,o),a&&(a!=t||i!=o)&&s.extend&&s.extend(a,i)}catch(e){}return null!=l&&(s.caretBidiLevel=l),h})):"left"==r||"backward"==r?t:o:n.pos==n.start()||n.pos==n.end()}(e,a,r))}class Sg{constructor(e,a,r,n){this.parent=e,this.children=a,this.dom=r,this.contentDOM=n,this.dirty=0,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,a,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let a=0;a<this.children.length;a++)e+=this.children[a].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let a=0,r=this.posAtStart;;a++){let n=this.children[a];if(n==e)return r;r+=n.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,a,r){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(r<0){let r,n;if(e==this.contentDOM)r=e.childNodes[a-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(n=r.pmViewDesc)||n.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(n)+n.size:this.posAtStart}{let r,n;if(e==this.contentDOM)r=e.childNodes[a];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.nextSibling}for(;r&&(!(n=r.pmViewDesc)||n.parent!=this);)r=r.nextSibling;return r?this.posBeforeChild(n):this.posAtEnd}}let n;if(e==this.dom&&this.contentDOM)n=a>Om(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))n=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==a)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!1;break}if(a.previousSibling)break}if(null==n&&a==e.childNodes.length)for(let a=e;;a=a.parentNode){if(a==this.dom){n=!0;break}if(a.nextSibling)break}}return(null==n?r>0:n)?this.posAtEnd:this.posAtStart}nearestDesc(e,a=!1){for(let r=!0,n=e;n;n=n.parentNode){let i,t=this.getDesc(n);if(t&&(!a||t.node)){if(!r||!(i=t.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return t;r=!1}}}getDesc(e){let a=e.pmViewDesc;for(let e=a;e;e=e.parent)if(e==this)return a}posFromDOM(e,a,r){for(let n=e;n;n=n.parentNode){let i=this.getDesc(n);if(i)return i.localPosFromDOM(e,a,r)}return-1}descAt(e){for(let a=0,r=0;a<this.children.length;a++){let n=this.children[a],i=r+n.size;if(r==e&&i!=r){for(;!n.border&&n.children.length;)n=n.children[0];return n}if(e<i)return n.descAt(e-r-n.border);r=i}}domFromPos(e,a){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,n=0;for(let a=0;r<this.children.length;r++){let i=this.children[r],t=a+i.size;if(t>e||i instanceof Ng){n=e-a;break}a=t}if(n)return this.children[r].domFromPos(n-this.children[r].border,a);for(let e;r&&!(e=this.children[r-1]).size&&e instanceof Og&&e.side>=0;r--);if(a<=0){let e,n=!0;for(;e=r?this.children[r-1]:null,e&&e.dom.parentNode!=this.contentDOM;r--,n=!1);return e&&a&&n&&!e.border&&!e.domAtom?e.domFromPos(e.size,a):{node:this.contentDOM,offset:e?Om(e.dom)+1:0}}{let e,n=!0;for(;e=r<this.children.length?this.children[r]:null,e&&e.dom.parentNode!=this.contentDOM;r++,n=!1);return e&&n&&!e.border&&!e.domAtom?e.domFromPos(0,a):{node:this.contentDOM,offset:e?Om(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,a,r=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:a,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let n=-1,i=-1;for(let t=r,o=0;;o++){let r=this.children[o],s=t+r.size;if(-1==n&&e<=s){let i=t+r.border;if(e>=i&&a<=s-r.border&&r.node&&r.contentDOM&&this.contentDOM.contains(r.contentDOM))return r.parseRange(e,a,i);e=t;for(let a=o;a>0;a--){let r=this.children[a-1];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(1)){n=Om(r.dom)+1;break}e-=r.size}-1==n&&(n=0)}if(n>-1&&(s>a||o==this.children.length-1)){a=s;for(let e=o+1;e<this.children.length;e++){let r=this.children[e];if(r.size&&r.dom.parentNode==this.contentDOM&&!r.emptyChildAt(-1)){i=Om(r.dom);break}a+=r.size}-1==i&&(i=this.contentDOM.childNodes.length);break}t=s}return{node:this.contentDOM,from:e,to:a,fromOffset:n,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let a=this.children[e<0?0:this.children.length-1];return 0==a.size||a.emptyChildAt(e)}domAfterPos(e){let{node:a,offset:r}=this.domFromPos(e,0);if(1!=a.nodeType||r==a.childNodes.length)throw new RangeError("No node after pos "+e);return a.childNodes[r]}setSelection(e,a,r,n=!1){let i=Math.min(e,a),t=Math.max(e,a);for(let o=0,s=0;o<this.children.length;o++){let l=this.children[o],c=s+l.size;if(i>s&&t<c)return l.setSelection(e-s-l.border,a-s-l.border,r,n);s=c}let o=this.domFromPos(e,e?-1:1),s=a==e?o:this.domFromPos(a,a?-1:1),l=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((Km||Xm)&&e==a){let{node:e,offset:a}=o;if(3==e.nodeType){if(d=!(!a||"\n"!=e.nodeValue[a-1]),d&&a==e.nodeValue.length)for(let a,r=e;r;r=r.parentNode){if(a=r.nextSibling){"BR"==a.nodeName&&(o=s={node:a.parentNode,offset:Om(a)+1});break}let e=r.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let r=e.childNodes[a-1];d=r&&("BR"==r.nodeName||"false"==r.contentEditable)}}if(Km&&c.focusNode&&c.focusNode!=s.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(n=!0)}if(!(n||d&&Xm)&&Am(o.node,o.offset,c.anchorNode,c.anchorOffset)&&Am(s.node,s.offset,c.focusNode,c.focusOffset))return;let u=!1;if((l.extend||e==a)&&!d){l.collapse(o.node,o.offset);try{e!=a&&l.extend(s.node,s.offset),u=!0}catch(e){}}if(!u){if(e>a){let e=o;o=s,s=e}let r=document.createRange();r.setEnd(s.node,s.offset),r.setStart(o.node,o.offset),l.removeAllRanges(),l.addRange(r)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,a){for(let r=0,n=0;n<this.children.length;n++){let i=this.children[n],t=r+i.size;if(r==t?e<=t&&a>=r:e<t&&a>r){let n=r+i.border,o=t-i.border;if(e>=n&&a<=o)return this.dirty=e==r||a==t?2:1,void(e!=n||a!=o||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(e-n,a-n):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}r=t}this.dirty=2}markParentsDirty(){let e=1;for(let a=this.parent;a;a=a.parent,e++){let r=1==e?2:1;a.dirty<r&&(a.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}isText(e){return!1}}class Og extends Sg{constructor(e,a,r,n){let i,t=a.type.toDOM;if("function"==typeof t&&(t=t(r,(()=>i?i.parent?i.parent.posBeforeChild(i):void 0:n))),!a.type.spec.raw){if(1!=t.nodeType){let e=document.createElement("span");e.appendChild(t),t=e}t.contentEditable="false",t.classList.add("ProseMirror-widget")}super(e,[],t,null),this.widget=a,this.widget=a,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let a=this.widget.spec.stopEvent;return!!a&&a(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class Eg extends Sg{constructor(e,a,r,n){super(e,[],a,null),this.textDOM=r,this.text=n}get size(){return this.text.length}localPosFromDOM(e,a){return e!=this.textDOM?this.posAtStart+(a?this.size:0):this.posAtStart+a}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class Mg extends Sg{constructor(e,a,r,n,i){super(e,[],r,n),this.mark=a,this.spec=i}static create(e,a,r,n){let i=n.nodeViews[a.type.name],t=i&&i(a,n,r);return t&&t.dom||(t=dh.renderSpec(document,a.type.spec.toDOM(a,r),null,a.attrs)),new Mg(e,a,t.dom,t.contentDOM||t.dom,t)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,a){if(super.markDirty(e,a),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,a,r){let n=Mg.create(this.parent,this.mark,!0,r),i=this.children,t=this.size;a<t&&(i=Kg(i,a,t,r)),e>0&&(i=Kg(i,0,e,r));for(let e=0;e<i.length;e++)i[e].parent=n;return n.children=i,n}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class _g extends Sg{constructor(e,a,r,n,i,t,o,s,l){super(e,[],i,t),this.node=a,this.outerDeco=r,this.innerDeco=n,this.nodeDOM=o}static create(e,a,r,n,i,t){let o,s=i.nodeViews[a.type.name],l=s&&s(a,i,(()=>o?o.parent?o.parent.posBeforeChild(o):void 0:t),r,n),c=l&&l.dom,d=l&&l.contentDOM;if(a.isText)if(c){if(3!=c.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(a.text);else if(!c){let e=dh.renderSpec(document,a.type.spec.toDOM(a),null,a.attrs);({dom:c,contentDOM:d}=e)}d||a.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),a.type.spec.draggable&&(c.draggable=!0));let u=c;return c=Vg(c,r,a),l?o=new Tg(e,a,r,n,c,d||null,u,l,i,t+1):a.isText?new Dg(e,a,r,n,c,u,i):new _g(e,a,r,n,c,d||null,u,i,t+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(e.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let a=this.children.length-1;a>=0;a--){let r=this.children[a];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>cu.empty)}else e.contentElement=this.contentDOM;else e.getContent=()=>this.node.content;return e}matchesNode(e,a,r){return 0==this.dirty&&e.eq(this.node)&&Hg(a,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,a){let r=this.node.inlineContent,n=a,i=e.composing?this.localCompositionInfo(e,a):null,t=i&&i.pos>-1?i:null,o=i&&i.pos<0,s=new Ug(this,t&&t.node,e);!function(e,a,r,n){let i=a.locals(e),t=0;if(0==i.length){for(let r=0;r<e.childCount;r++){let o=e.child(r);n(o,i,a.forChild(t,o),r),t+=o.nodeSize}return}let o=0,s=[],l=null;for(let c=0;;){let d,u,h,m;for(;o<i.length&&i[o].to==t;){let e=i[o++];e.widget&&(d?(u||(u=[d])).push(e):d=e)}if(d)if(u){u.sort(Gg);for(let e=0;e<u.length;e++)r(u[e],c,!!l)}else r(d,c,!!l);if(l)m=-1,h=l,l=null;else{if(!(c<e.childCount))break;m=c,h=e.child(c++)}for(let e=0;e<s.length;e++)s[e].to<=t&&s.splice(e--,1);for(;o<i.length&&i[o].from<=t&&i[o].to>t;)s.push(i[o++]);let g=t+h.nodeSize;if(h.isText){let e=g;o<i.length&&i[o].from<e&&(e=i[o].from);for(let a=0;a<s.length;a++)s[a].to<e&&(e=s[a].to);e<g&&(l=h.cut(e-t),h=h.cut(0,e-t),g=e,m=-1)}else for(;o<i.length&&i[o].to<g;)o++;n(h,h.isInline&&!h.isLeaf?s.filter((e=>!e.inline)):s.slice(),a.forChild(t,h),m),t=g}}(this.node,this.innerDeco,((a,i,t)=>{a.spec.marks?s.syncToMarks(a.spec.marks,r,e):a.type.side>=0&&!t&&s.syncToMarks(i==this.node.childCount?mu.none:this.node.child(i).marks,r,e),s.placeWidget(a,e,n)}),((a,t,l,c)=>{let d;s.syncToMarks(a.marks,r,e),s.findNodeMatch(a,t,l,c)||o&&e.state.selection.from>n&&e.state.selection.to<n+a.nodeSize&&(d=s.findIndexWithChild(i.node))>-1&&s.updateNodeAt(a,t,l,d,e)||s.updateNextNode(a,t,l,e,c,n)||s.addNode(a,t,l,e,n),n+=a.nodeSize})),s.syncToMarks([],r,e),this.node.isTextblock&&s.addTextblockHacks(),s.destroyRest(),(s.changed||2==this.dirty)&&(t&&this.protectLocalComposition(e,t),Ig(this.contentDOM,this.children,e),Qm&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let a=e.style.cssText;e.style.cssText=a+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=a}}(this.dom))}localCompositionInfo(e,a){let{from:r,to:n}=e.state.selection;if(!(e.state.selection instanceof dm)||r<a||n>a+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let e=i.nodeValue,t=function(e,a,r,n){for(let i=0,t=0;i<e.childCount&&t<=n;){let o=e.child(i++),s=t;if(t+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<e.childCount;){let a=e.child(i++);if(t+=a.nodeSize,!a.isText)break;l+=a.text}if(t>=r){if(t>=n&&l.slice(n-a.length-s,n-s)==a)return n-a.length;let e=s<n?l.lastIndexOf(a,n-s-1):-1;if(e>=0&&e+a.length+s>=r)return s+e;if(r==n&&l.length>=n+a.length-s&&l.slice(n-s,n-s+a.length)==a)return n}}return-1}(this.node.content,e,r-a,n-a);return t<0?null:{node:i,pos:t,text:e}}return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:a,pos:r,text:n}){if(this.getDesc(a))return;let i=a;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let t=new Eg(this,i,a,n);e.input.compositionNodes.push(t),this.children=Kg(this.children,r,r+n.length,e,t)}update(e,a,r,n){return!(3==this.dirty||!e.sameMarkup(this.node))&&(this.updateInner(e,a,r,n),!0)}updateInner(e,a,r,n){this.updateOuterDeco(a),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(n,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(Hg(e,this.outerDeco))return;let a=1!=this.nodeDOM.nodeType,r=this.dom;this.dom=Lg(this.dom,this.nodeDOM,Rg(this.outerDeco,this.node,a),Rg(e,this.node,a)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ag(e,a,r,n,i){Vg(n,a,e);let t=new _g(void 0,e,a,r,n,n,n,i,0);return t.contentDOM&&t.updateChildren(i,0),t}class Dg extends _g{constructor(e,a,r,n,i,t,o){super(e,a,r,n,i,null,t,o,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,a,r,n){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node))&&(this.updateOuterDeco(a),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,n.trackWrites==this.nodeDOM&&(n.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let a=this.nodeDOM;a;a=a.parentNode)if(a==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,a,r){return e==this.nodeDOM?this.posAtStart+Math.min(a,this.node.text.length):super.localPosFromDOM(e,a,r)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,a,r){let n=this.node.cut(e,a),i=document.createTextNode(n.text);return new Dg(this.parent,n,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,a){super.markDirty(e,a),this.dom==this.nodeDOM||0!=e&&a!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Ng extends Sg{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class Tg extends _g{constructor(e,a,r,n,i,t,o,s,l,c){super(e,a,r,n,i,t,o,l,c),this.spec=s}update(e,a,r,n){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,a,r);return i&&this.updateInner(e,a,r,n),i}return!(!this.contentDOM&&!e.isLeaf)&&super.update(e,a,r,n)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,a,r,n){this.spec.setSelection?this.spec.setSelection(e,a,r.root):super.setSelection(e,a,r,n)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Ig(e,a,r){let n=e.firstChild,i=!1;for(let t=0;t<a.length;t++){let o=a[t],s=o.dom;if(s.parentNode==e){for(;s!=n;)n=Wg(n),i=!0;n=n.nextSibling}else i=!0,e.insertBefore(s,n);if(o instanceof Mg){let a=n?n.previousSibling:e.lastChild;Ig(o.contentDOM,o.children,r),n=a?a.nextSibling:e.firstChild}}for(;n;)n=Wg(n),i=!0;i&&r.trackWrites==e&&(r.trackWrites=null)}const Fg=function(e){e&&(this.nodeName=e)};Fg.prototype=Object.create(null);const Pg=[new Fg];function Rg(e,a,r){if(0==e.length)return Pg;let n=r?Pg[0]:new Fg,i=[n];for(let t=0;t<e.length;t++){let o=e[t].type.attrs;if(o){o.nodeName&&i.push(n=new Fg(o.nodeName));for(let e in o){let t=o[e];null!=t&&(r&&1==i.length&&i.push(n=new Fg(a.isInline?"span":"div")),"class"==e?n.class=(n.class?n.class+" ":"")+t:"style"==e?n.style=(n.style?n.style+";":"")+t:"nodeName"!=e&&(n[e]=t))}}}return i}function Lg(e,a,r,n){if(r==Pg&&n==Pg)return a;let i=a;for(let a=0;a<n.length;a++){let t=n[a],o=r[a];if(a){let a;o&&o.nodeName==t.nodeName&&i!=e&&(a=i.parentNode)&&a.nodeName.toLowerCase()==t.nodeName||(a=document.createElement(t.nodeName),a.pmIsDeco=!0,a.appendChild(i),o=Pg[0]),i=a}Bg(i,o||Pg[0],t)}return i}function Bg(e,a,r){for(let n in a)"class"==n||"style"==n||"nodeName"==n||n in r||e.removeAttribute(n);for(let n in r)"class"!=n&&"style"!=n&&"nodeName"!=n&&r[n]!=a[n]&&e.setAttribute(n,r[n]);if(a.class!=r.class){let n=a.class?a.class.split(" ").filter(Boolean):[],i=r.class?r.class.split(" ").filter(Boolean):[];for(let a=0;a<n.length;a++)-1==i.indexOf(n[a])&&e.classList.remove(n[a]);for(let a=0;a<i.length;a++)-1==n.indexOf(i[a])&&e.classList.add(i[a]);0==e.classList.length&&e.removeAttribute("class")}if(a.style!=r.style){if(a.style){let r,n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;for(;r=n.exec(a.style);)e.style.removeProperty(r[1])}r.style&&(e.style.cssText+=r.style)}}function Vg(e,a,r){return Lg(e,e,Pg,Rg(a,r,1!=e.nodeType))}function Hg(e,a){if(e.length!=a.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].type.eq(a[r].type))return!1;return!0}function Wg(e){let a=e.nextSibling;return e.parentNode.removeChild(e),a}class Ug{constructor(e,a,r){this.lock=a,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,a){let r=a,n=r.children.length,i=e.childCount,t=new Map,o=[];e:for(;i>0;){let s;for(;;)if(n){let e=r.children[n-1];if(!(e instanceof Mg)){s=e,n--;break}r=e,n=e.children.length}else{if(r==a)break e;n=r.parent.children.indexOf(r),r=r.parent}let l=s.node;if(l){if(l!=e.child(i-1))break;--i,t.set(s,i),o.push(s)}}return{index:i,matched:t,matches:o.reverse()}}(e.node.content,e)}destroyBetween(e,a){if(e!=a){for(let r=e;r<a;r++)this.top.children[r].destroy();this.top.children.splice(e,a-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,a,r){let n=0,i=this.stack.length>>1,t=Math.min(i,e.length);for(;n<t&&(n==i-1?this.top:this.stack[n+1<<1]).matchesMark(e[n])&&!1!==e[n].type.spec.spanning;)n++;for(;n<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);let n=-1;for(let a=this.index;a<Math.min(this.index+3,this.top.children.length);a++){let r=this.top.children[a];if(r.matchesMark(e[i])&&!this.isLocked(r.dom)){n=a;break}}if(n>-1)n>this.index&&(this.changed=!0,this.destroyBetween(this.index,n)),this.top=this.top.children[this.index];else{let n=Mg.create(this.top,e[i],a,r);this.top.children.splice(this.index,0,n),this.top=n,this.changed=!0}this.index=0,i++}}findNodeMatch(e,a,r,n){let i,t=-1;if(n>=this.preMatch.index&&(i=this.preMatch.matches[n-this.preMatch.index]).parent==this.top&&i.matchesNode(e,a,r))t=this.top.children.indexOf(i,this.index);else for(let n=this.index,i=Math.min(this.top.children.length,n+5);n<i;n++){let i=this.top.children[n];if(i.matchesNode(e,a,r)&&!this.preMatch.matched.has(i)){t=n;break}}return!(t<0)&&(this.destroyBetween(this.index,t),this.index++,!0)}updateNodeAt(e,a,r,n,i){let t=this.top.children[n];return 3==t.dirty&&t.dom==t.contentDOM&&(t.dirty=2),!!t.update(e,a,r,i)&&(this.destroyBetween(this.index,n),this.index++,!0)}findIndexWithChild(e){for(;;){let a=e.parentNode;if(!a)return-1;if(a==this.top.contentDOM){let a=e.pmViewDesc;if(a)for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==a)return e;return-1}e=a}}updateNextNode(e,a,r,n,i,t){for(let o=this.index;o<this.top.children.length;o++){let s=this.top.children[o];if(s instanceof _g){let l=this.preMatch.matched.get(s);if(null!=l&&l!=i)return!1;let c,d=s.dom,u=this.isLocked(d)&&!(e.isText&&s.node&&s.node.isText&&s.nodeDOM.nodeValue==e.text&&3!=s.dirty&&Hg(a,s.outerDeco));if(!u&&s.update(e,a,r,n))return this.destroyBetween(this.index,o),s.dom!=d&&(this.changed=!0),this.index++,!0;if(!u&&(c=this.recreateWrapper(s,e,a,r,n,t)))return this.destroyBetween(this.index,o),this.top.children[this.index]=c,c.contentDOM&&(c.dirty=2,c.updateChildren(n,t+1),c.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,a,r,n,i,t){if(e.dirty||a.isAtom||!e.children.length||!e.node.content.eq(a.content)||!Hg(r,e.outerDeco)||!n.eq(e.innerDeco))return null;let o=_g.create(this.top,a,r,n,i,t);if(o.contentDOM){o.children=e.children,e.children=[];for(let e of o.children)e.parent=o}return e.destroy(),o}addNode(e,a,r,n,i){let t=_g.create(this.top,e,a,r,n,i);t.contentDOM&&t.updateChildren(n,i+1),this.top.children.splice(this.index++,0,t),this.changed=!0}placeWidget(e,a,r){let n=this.index<this.top.children.length?this.top.children[this.index]:null;if(!n||!n.matchesWidget(e)||e!=n.widget&&n.widget.type.toDOM.parentNode){let n=new Og(this.top,e,a,r);this.top.children.splice(this.index++,0,n),this.changed=!0}else this.index++}addTextblockHacks(){let e=this.top.children[this.index-1],a=this.top;for(;e instanceof Mg;)a=e,e=a.children[a.children.length-1];(!e||!(e instanceof Dg)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((Xm||Jm)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",a),this.addHackNode("BR",this.top))}addHackNode(e,a){if(a==this.top&&this.index<a.children.length&&a.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);"IMG"==e&&(r.className="ProseMirror-separator",r.alt=""),"BR"==e&&(r.className="ProseMirror-trailingBreak");let n=new Ng(this.top,[],r,null);a!=this.top?a.children.push(n):a.children.splice(this.index++,0,n),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function Gg(e,a){return e.type.side-a.type.side}function Kg(e,a,r,n,i){let t=[];for(let o=0,s=0;o<e.length;o++){let l=e[o],c=s,d=s+=l.size;c>=r||d<=a?t.push(l):(c<a&&t.push(l.slice(0,a-c,n)),i&&(t.push(i),i=void 0),d>r&&t.push(l.slice(r-c,l.size,n)))}return t}function Zg(e,a=null){let r=e.domSelectionRange(),n=e.state.doc;if(!r.focusNode)return null;let i=e.docView.nearestDesc(r.focusNode),t=i&&0==i.size,o=e.docView.posFromDOM(r.focusNode,r.focusOffset,1);if(o<0)return null;let s,l,c=n.resolve(o);if(Fm(r)){for(s=o;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&hm.isSelectable(e)&&i.parent&&(!e.isInline||!function(e,a,r){for(let n=0==a,i=a==Tm(e);n||i;){if(e==r)return!0;let a=Om(e);if(!(e=e.parentNode))return!1;n=n&&0==a,i=i&&a==Tm(e)}}(r.focusNode,r.focusOffset,i.dom))){let e=i.posBefore;l=new hm(o==e?c:n.resolve(e))}}else{if(r instanceof e.dom.ownerDocument.defaultView.Selection&&r.rangeCount>1){let a=o,i=o;for(let n=0;n<r.rangeCount;n++){let t=r.getRangeAt(n);a=Math.min(a,e.docView.posFromDOM(t.startContainer,t.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(t.endContainer,t.endOffset,-1))}if(a<0)return null;[s,o]=i==e.state.selection.anchor?[i,a]:[a,i],c=n.resolve(o)}else s=e.docView.posFromDOM(r.anchorNode,r.anchorOffset,1);if(s<0)return null}let d=n.resolve(s);if(!l){l=ip(e,d,c,"pointer"==a||e.state.selection.head<c.pos&&!t?1:-1)}return l}function Jg(e){return e.editable?e.hasFocus():op(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Yg(e,a=!1){let r=e.state.selection;if(rp(e,r),Jg(e)){if(!a&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&Jm){let a=e.domSelectionRange(),r=e.domObserver.currentSelection;if(a.anchorNode&&r.anchorNode&&Am(a.anchorNode,a.anchorOffset,r.anchorNode,r.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let a=e.domSelection(),r=document.createRange();if(!a)return;let n=e.cursorWrapper.dom,i="IMG"==n.nodeName;i?r.setStart(n.parentNode,Om(n)+1):r.setStart(n,0);r.collapse(!0),a.removeAllRanges(),a.addRange(r),!i&&!e.state.selection.visible&&Um&&Gm<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let n,i,{anchor:t,head:o}=r;!Xg||r instanceof dm||(r.$from.parent.inlineContent||(n=Qg(e,r.from)),r.empty||r.$from.parent.inlineContent||(i=Qg(e,r.to))),e.docView.setSelection(t,o,e,a),Xg&&(n&&ap(n),i&&ap(i)),r.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let a=e.dom.ownerDocument;a.removeEventListener("selectionchange",e.input.hideSelectionGuard);let r=e.domSelectionRange(),n=r.anchorNode,i=r.anchorOffset;a.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{r.anchorNode==n&&r.anchorOffset==i||(a.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout((()=>{Jg(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")}),20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Xg=Xm||Jm&&Ym<63;function Qg(e,a){let{node:r,offset:n}=e.docView.domFromPos(a,0),i=n<r.childNodes.length?r.childNodes[n]:null,t=n?r.childNodes[n-1]:null;if(Xm&&i&&"false"==i.contentEditable)return ep(i);if(!(i&&"false"!=i.contentEditable||t&&"false"!=t.contentEditable)){if(i)return ep(i);if(t)return ep(t)}}function ep(e){return e.contentEditable="true",Xm&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function ap(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function rp(e,a){if(a instanceof hm){let r=e.docView.descAt(a.from);r!=e.lastSelectedViewDesc&&(np(e),r&&r.selectNode(),e.lastSelectedViewDesc=r)}else np(e)}function np(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function ip(e,a,r,n){return e.someProp("createSelectionBetween",(n=>n(e,a,r)))||dm.between(a,r,n)}function tp(e){return!(e.editable&&!e.hasFocus())&&op(e)}function op(e){let a=e.domSelectionRange();if(!a.anchorNode)return!1;try{return e.dom.contains(3==a.anchorNode.nodeType?a.anchorNode.parentNode:a.anchorNode)&&(e.editable||e.dom.contains(3==a.focusNode.nodeType?a.focusNode.parentNode:a.focusNode))}catch(e){return!1}}function sp(e,a){let{$anchor:r,$head:n}=e.selection,i=a>0?r.max(n):r.min(n),t=i.parent.inlineContent?i.depth?e.doc.resolve(a>0?i.after():i.before()):null:i;return t&&om.findFrom(t,a)}function lp(e,a){return e.dispatch(e.state.tr.setSelection(a).scrollIntoView()),!0}function cp(e,a,r){let n=e.state.selection;if(!(n instanceof dm)){if(n instanceof hm&&n.node.isInline)return lp(e,new dm(a>0?n.$to:n.$from));{let r=sp(e.state,a);return!!r&&lp(e,r)}}if(r.indexOf("s")>-1){let{$head:r}=n,i=r.textOffset?null:a<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let t=e.state.doc.resolve(r.pos+i.nodeSize*(a<0?-1:1));return lp(e,new dm(n.$anchor,t))}if(!n.empty)return!1;if(e.endOfTextblock(a>0?"forward":"backward")){let r=sp(e.state,a);return!!(r&&r instanceof hm)&&lp(e,r)}if(!(eg&&r.indexOf("m")>-1)){let r,i=n.$head,t=i.textOffset?null:a<0?i.nodeBefore:i.nodeAfter;if(!t||t.isText)return!1;let o=a<0?i.pos-t.nodeSize:i.pos;return!!(t.isAtom||(r=e.docView.descAt(o))&&!r.contentDOM)&&(hm.isSelectable(t)?lp(e,new hm(a<0?e.state.doc.resolve(i.pos-t.nodeSize):i)):!!ng&&lp(e,new dm(e.state.doc.resolve(a<0?o:o+t.nodeSize))))}}function dp(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function up(e,a){let r=e.pmViewDesc;return r&&0==r.size&&(a<0||e.nextSibling||"BR"!=e.nodeName)}function hp(e,a){return a<0?function(e){let a=e.domSelectionRange(),r=a.focusNode,n=a.focusOffset;if(!r)return;let i,t,o=!1;Km&&1==r.nodeType&&n<dp(r)&&up(r.childNodes[n],-1)&&(o=!0);for(;;)if(n>0){if(1!=r.nodeType)break;{let e=r.childNodes[n-1];if(up(e,-1))i=r,t=--n;else{if(3!=e.nodeType)break;r=e,n=r.nodeValue.length}}}else{if(mp(r))break;{let a=r.previousSibling;for(;a&&up(a,-1);)i=r.parentNode,t=Om(a),a=a.previousSibling;if(a)r=a,n=dp(r);else{if(r=r.parentNode,r==e.dom)break;n=0}}}o?gp(e,r,n):i&&gp(e,i,t)}(e):function(e){let a=e.domSelectionRange(),r=a.focusNode,n=a.focusOffset;if(!r)return;let i,t,o=dp(r);for(;;)if(n<o){if(1!=r.nodeType)break;if(!up(r.childNodes[n],1))break;i=r,t=++n}else{if(mp(r))break;{let a=r.nextSibling;for(;a&&up(a,1);)i=a.parentNode,t=Om(a)+1,a=a.nextSibling;if(a)r=a,n=0,o=dp(r);else{if(r=r.parentNode,r==e.dom)break;n=o=0}}}i&&gp(e,i,t)}(e)}function mp(e){let a=e.pmViewDesc;return a&&a.node&&a.node.isBlock}function gp(e,a,r){if(3!=a.nodeType){let e,n;(n=function(e,a){for(;e&&a==e.childNodes.length&&!Im(e);)a=Om(e)+1,e=e.parentNode;for(;e&&a<e.childNodes.length;){let r=e.childNodes[a];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;e=r,a=0}}(a,r))?(a=n,r=0):(e=function(e,a){for(;e&&!a&&!Im(e);)a=Om(e),e=e.parentNode;for(;e&&a;){let r=e.childNodes[a-1];if(3==r.nodeType)return r;if(1==r.nodeType&&"false"==r.contentEditable)break;a=(e=r).childNodes.length}}(a,r))&&(a=e,r=e.nodeValue.length)}let n=e.domSelection();if(!n)return;if(Fm(n)){let e=document.createRange();e.setEnd(a,r),e.setStart(a,r),n.removeAllRanges(),n.addRange(e)}else n.extend&&n.extend(a,r);e.domObserver.setCurSelection();let{state:i}=e;setTimeout((()=>{e.state==i&&Yg(e)}),50)}function pp(e,a){let r=e.state.doc.resolve(a);if(!Jm&&!ag&&r.parent.inlineContent){let n=e.coordsAtPos(a);if(a>r.start()){let r=e.coordsAtPos(a-1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left<n.left?"ltr":"rtl"}if(a<r.end()){let r=e.coordsAtPos(a+1),i=(r.top+r.bottom)/2;if(i>n.top&&i<n.bottom&&Math.abs(r.left-n.left)>1)return r.left>n.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function bp(e,a,r){let n=e.state.selection;if(n instanceof dm&&!n.empty||r.indexOf("s")>-1)return!1;if(eg&&r.indexOf("m")>-1)return!1;let{$from:i,$to:t}=n;if(!i.parent.inlineContent||e.endOfTextblock(a<0?"up":"down")){let r=sp(e.state,a);if(r&&r instanceof hm)return lp(e,r)}if(!i.parent.inlineContent){let r=a<0?i:t,o=n instanceof gm?om.near(r,a):om.findFrom(r,a);return!!o&&lp(e,o)}return!1}function fp(e,a){if(!(e.state.selection instanceof dm))return!0;let{$head:r,$anchor:n,empty:i}=e.state.selection;if(!r.sameParent(n))return!0;if(!i)return!1;if(e.endOfTextblock(a>0?"forward":"backward"))return!0;let t=!r.textOffset&&(a<0?r.nodeBefore:r.nodeAfter);if(t&&!t.isText){let n=e.state.tr;return a<0?n.delete(r.pos-t.nodeSize,r.pos):n.delete(r.pos,r.pos+t.nodeSize),e.dispatch(n),!0}return!1}function kp(e,a,r){e.domObserver.stop(),a.contentEditable=r,e.domObserver.start()}function yp(e,a){let r=a.keyCode,n=function(e){let a="";return e.ctrlKey&&(a+="c"),e.metaKey&&(a+="m"),e.altKey&&(a+="a"),e.shiftKey&&(a+="s"),a}(a);if(8==r||eg&&72==r&&"c"==n)return fp(e,-1)||hp(e,-1);if(46==r&&!a.shiftKey||eg&&68==r&&"c"==n)return fp(e,1)||hp(e,1);if(13==r||27==r)return!0;if(37==r||eg&&66==r&&"c"==n){let a=37==r?"ltr"==pp(e,e.state.selection.from)?-1:1:-1;return cp(e,a,n)||hp(e,a)}if(39==r||eg&&70==r&&"c"==n){let a=39==r?"ltr"==pp(e,e.state.selection.from)?1:-1:1;return cp(e,a,n)||hp(e,a)}return 38==r||eg&&80==r&&"c"==n?bp(e,-1,n)||hp(e,-1):40==r||eg&&78==r&&"c"==n?function(e){if(!Xm||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:a,focusOffset:r}=e.domSelectionRange();if(a&&1==a.nodeType&&0==r&&a.firstChild&&"false"==a.firstChild.contentEditable){let r=a.firstChild;kp(e,r,"true"),setTimeout((()=>kp(e,r,"false")),20)}return!1}(e)||bp(e,1,n)||hp(e,1):n==(eg?"m":"c")&&(66==r||73==r||89==r||90==r)}function vp(e,a){e.someProp("transformCopied",(r=>{a=r(a,e)}));let r=[],{content:n,openStart:i,openEnd:t}=a;for(;i>1&&t>1&&1==n.childCount&&1==n.firstChild.childCount;){i--,t--;let e=n.firstChild;r.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),n=e.content}let o=e.someProp("clipboardSerializer")||dh.fromSchema(e.state.schema),s=Ep(),l=s.createElement("div");l.appendChild(o.serializeFragment(n,{document:s}));let c,d=l.firstChild,u=0;for(;d&&1==d.nodeType&&(c=Sp[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let a=s.createElement(c[e]);for(;l.firstChild;)a.appendChild(l.firstChild);l.appendChild(a),u++}d=l.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${i} ${t}${u?` -${u}`:""} ${JSON.stringify(r)}`),{dom:l,text:e.someProp("clipboardTextSerializer",(r=>r(a,e)))||a.content.textBetween(0,a.content.size,"\n\n"),slice:a}}function wp(e,a,r,n,i){let t,o,s=i.parent.type.spec.code;if(!r&&!a)return null;let l=a&&(n||s||!r);if(l){if(e.someProp("transformPastedText",(r=>{a=r(a,s||n,e)})),s)return a?new pu(cu.from(e.state.schema.text(a.replace(/\r\n?/g,"\n"))),0,0):pu.empty;let r=e.someProp("clipboardTextParser",(r=>r(a,i,n,e)));if(r)o=r;else{let r=i.marks(),{schema:n}=e.state,o=dh.fromSchema(n);t=document.createElement("div"),a.split(/(?:\r\n?|\n)+/).forEach((e=>{let a=t.appendChild(document.createElement("p"));e&&a.appendChild(o.serializeNode(n.text(e,r)))}))}}else e.someProp("transformPastedHTML",(a=>{r=a(r,e)})),t=function(e){let a=/^(\s*<meta [^>]*>)*/.exec(e);a&&(e=e.slice(a[0].length));let r,n=Ep().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(e);(r=i&&Sp[i[1].toLowerCase()])&&(e=r.map((e=>"<"+e+">")).join("")+e+r.map((e=>"</"+e+">")).reverse().join(""));if(n.innerHTML=function(e){let a=window.trustedTypes;if(!a)return e;Mp||(Mp=a.createPolicy("ProseMirrorClipboard",{createHTML:e=>e}));return Mp.createHTML(e)}(e),r)for(let e=0;e<r.length;e++)n=n.querySelector(r[e])||n;return n}(r),ng&&function(e){let a=e.querySelectorAll(Jm?"span:not([class]):not([style])":"span.Apple-converted-space");for(let r=0;r<a.length;r++){let n=a[r];1==n.childNodes.length&&" "==n.textContent&&n.parentNode&&n.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),n)}}(t);let c=t&&t.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=t.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;t=e}if(!o){let a=e.someProp("clipboardParser")||e.someProp("domParser")||eh.fromSchema(e.state.schema);o=a.parseSlice(t,{preserveWhitespace:!(!l&&!d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||zp.test(e.parentNode.nodeName)?null:{ignore:!0}})}if(d)o=function(e,a){if(!e.size)return e;let r,n=e.content.firstChild.type.schema;try{r=JSON.parse(a)}catch(a){return e}let{content:i,openStart:t,openEnd:o}=e;for(let e=r.length-2;e>=0;e-=2){let a=n.nodes[r[e]];if(!a||a.hasRequiredAttrs())break;i=cu.from(a.create(r[e+1],i)),t++,o++}return new pu(i,t,o)}(Cp(o,+d[1],+d[2]),d[4]);else if(o=pu.maxOpen(function(e,a){if(e.childCount<2)return e;for(let r=a.depth;r>=0;r--){let n,i=a.node(r).contentMatchAt(a.index(r)),t=[];if(e.forEach((e=>{if(!t)return;let a,r=i.findWrapping(e.type);if(!r)return t=null;if(a=t.length&&n.length&&xp(r,n,e,t[t.length-1],0))t[t.length-1]=a;else{t.length&&(t[t.length-1]=$p(t[t.length-1],n.length));let a=jp(e,r);t.push(a),i=i.matchType(a.type),n=r}})),t)return cu.from(t)}return e}(o.content,i),!0),o.openStart||o.openEnd){let e=0,a=0;for(let a=o.content.firstChild;e<o.openStart&&!a.type.spec.isolating;e++,a=a.firstChild);for(let e=o.content.lastChild;a<o.openEnd&&!e.type.spec.isolating;a++,e=e.lastChild);o=Cp(o,e,a)}return e.someProp("transformPasted",(a=>{o=a(o,e)})),o}const zp=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function jp(e,a,r=0){for(let n=a.length-1;n>=r;n--)e=a[n].create(null,cu.from(e));return e}function xp(e,a,r,n,i){if(i<e.length&&i<a.length&&e[i]==a[i]){let t=xp(e,a,r,n.lastChild,i+1);if(t)return n.copy(n.content.replaceChild(n.childCount-1,t));if(n.contentMatchAt(n.childCount).matchType(i==e.length-1?r.type:e[i+1]))return n.copy(n.content.append(cu.from(jp(r,e,i+1))))}}function $p(e,a){if(0==a)return e;let r=e.content.replaceChild(e.childCount-1,$p(e.lastChild,a-1)),n=e.contentMatchAt(e.childCount).fillBefore(cu.empty,!0);return e.copy(r.append(n))}function qp(e,a,r,n,i,t){let o=a<0?e.firstChild:e.lastChild,s=o.content;return e.childCount>1&&(t=0),i<n-1&&(s=qp(s,a,r,n,i+1,t)),i>=r&&(s=a<0?o.contentMatchAt(0).fillBefore(s,t<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(cu.empty,!0))),e.replaceChild(a<0?0:e.childCount-1,o.copy(s))}function Cp(e,a,r){return a<e.openStart&&(e=new pu(qp(e.content,-1,a,e.openStart,0,e.openEnd),a,e.openEnd)),r<e.openEnd&&(e=new pu(qp(e.content,1,r,e.openEnd,0,0),e.openStart,r)),e}const Sp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Op=null;function Ep(){return Op||(Op=document.implementation.createHTMLDocument("title"))}let Mp=null;const _p={},Ap={},Dp={touchstart:!0,touchmove:!0};class Np{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function Tp(e,a){e.input.lastSelectionOrigin=a,e.input.lastSelectionTime=Date.now()}function Ip(e){e.someProp("handleDOMEvents",(a=>{for(let r in a)e.input.eventHandlers[r]||e.dom.addEventListener(r,e.input.eventHandlers[r]=a=>Fp(e,a))}))}function Fp(e,a){return e.someProp("handleDOMEvents",(r=>{let n=r[a.type];return!!n&&(n(e,a)||a.defaultPrevented)}))}function Pp(e,a){if(!a.bubbles)return!0;if(a.defaultPrevented)return!1;for(let r=a.target;r!=e.dom;r=r.parentNode)if(!r||11==r.nodeType||r.pmViewDesc&&r.pmViewDesc.stopEvent(a))return!1;return!0}function Rp(e){return{left:e.clientX,top:e.clientY}}function Lp(e,a,r,n,i){if(-1==n)return!1;let t=e.state.doc.resolve(n);for(let n=t.depth+1;n>0;n--)if(e.someProp(a,(a=>n>t.depth?a(e,r,t.nodeAfter,t.before(n),i,!0):a(e,r,t.node(n),t.before(n),i,!1))))return!0;return!1}function Bp(e,a,r){if(e.focused||e.focus(),e.state.selection.eq(a))return;let n=e.state.tr.setSelection(a);n.setMeta("pointer",!0),e.dispatch(n)}function Vp(e,a,r,n,i){return Lp(e,"handleClickOn",a,r,n)||e.someProp("handleClick",(r=>r(e,a,n)))||(i?function(e,a){if(-1==a)return!1;let r,n,i=e.state.selection;i instanceof hm&&(r=i.node);let t=e.state.doc.resolve(a);for(let e=t.depth+1;e>0;e--){let a=e>t.depth?t.nodeAfter:t.node(e);if(hm.isSelectable(a)){n=r&&i.$from.depth>0&&e>=i.$from.depth&&t.before(i.$from.depth+1)==i.$from.pos?t.before(i.$from.depth):t.before(e);break}}return null!=n&&(Bp(e,hm.create(e.state.doc,n)),!0)}(e,r):function(e,a){if(-1==a)return!1;let r=e.state.doc.resolve(a),n=r.nodeAfter;return!!(n&&n.isAtom&&hm.isSelectable(n))&&(Bp(e,new hm(r)),!0)}(e,r))}function Hp(e,a,r,n){return Lp(e,"handleDoubleClickOn",a,r,n)||e.someProp("handleDoubleClick",(r=>r(e,a,n)))}function Wp(e,a,r,n){return Lp(e,"handleTripleClickOn",a,r,n)||e.someProp("handleTripleClick",(r=>r(e,a,n)))||function(e,a,r){if(0!=r.button)return!1;let n=e.state.doc;if(-1==a)return!!n.inlineContent&&(Bp(e,dm.create(n,0,n.content.size)),!0);let i=n.resolve(a);for(let a=i.depth+1;a>0;a--){let r=a>i.depth?i.nodeAfter:i.node(a),t=i.before(a);if(r.inlineContent)Bp(e,dm.create(n,t+1,t+1+r.content.size));else{if(!hm.isSelectable(r))continue;Bp(e,hm.create(n,t))}return!0}}(e,r,n)}function Up(e){return eb(e)}Ap.keydown=(e,a)=>{let r=a;if(e.input.shiftKey=16==r.keyCode||r.shiftKey,!Zp(e,r)&&(e.input.lastKeyCode=r.keyCode,e.input.lastKeyCodeTime=Date.now(),!rg||!Jm||13!=r.keyCode))if(229!=r.keyCode&&e.domObserver.forceFlush(),!Qm||13!=r.keyCode||r.ctrlKey||r.altKey||r.metaKey)e.someProp("handleKeyDown",(a=>a(e,r)))||yp(e,r)?r.preventDefault():Tp(e,"key");else{let a=Date.now();e.input.lastIOSEnter=a,e.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{e.input.lastIOSEnter==a&&(e.someProp("handleKeyDown",(a=>a(e,Pm(13,"Enter")))),e.input.lastIOSEnter=0)}),200)}},Ap.keyup=(e,a)=>{16==a.keyCode&&(e.input.shiftKey=!1)},Ap.keypress=(e,a)=>{let r=a;if(Zp(e,r)||!r.charCode||r.ctrlKey&&!r.altKey||eg&&r.metaKey)return;if(e.someProp("handleKeyPress",(a=>a(e,r))))return void r.preventDefault();let n=e.state.selection;if(!(n instanceof dm&&n.$from.sameParent(n.$to))){let a=String.fromCharCode(r.charCode);/[\r\n]/.test(a)||e.someProp("handleTextInput",(r=>r(e,n.$from.pos,n.$to.pos,a)))||e.dispatch(e.state.tr.insertText(a).scrollIntoView()),r.preventDefault()}};const Gp=eg?"metaKey":"ctrlKey";_p.mousedown=(e,a)=>{let r=a;e.input.shiftKey=r.shiftKey;let n=Up(e),i=Date.now(),t="singleClick";i-e.input.lastClick.time<500&&function(e,a){let r=a.x-e.clientX,n=a.y-e.clientY;return r*r+n*n<100}(r,e.input.lastClick)&&!r[Gp]&&("singleClick"==e.input.lastClick.type?t="doubleClick":"doubleClick"==e.input.lastClick.type&&(t="tripleClick")),e.input.lastClick={time:i,x:r.clientX,y:r.clientY,type:t};let o=e.posAtCoords(Rp(r));o&&("singleClick"==t?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Kp(e,o,r,!!n)):("doubleClick"==t?Hp:Wp)(e,o.pos,o.inside,r)?r.preventDefault():Tp(e,"pointer"))};class Kp{constructor(e,a,r,n){let i,t;if(this.view=e,this.pos=a,this.event=r,this.flushed=n,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Gp],this.allowDefault=r.shiftKey,a.inside>-1)i=e.state.doc.nodeAt(a.inside),t=a.inside;else{let r=e.state.doc.resolve(a.pos);i=r.parent,t=r.depth?r.before():0}const o=n?null:r.target,s=o?e.docView.nearestDesc(o,!0):null;this.target=s&&1==s.dom.nodeType?s.dom:null;let{selection:l}=e.state;(0==r.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||l instanceof hm&&l.from<=t&&l.to>t)&&(this.mightDrag={node:i,pos:t,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!Km||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout((()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")}),20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Tp(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout((()=>Yg(this.view))),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let a=this.pos;this.view.state.doc!=this.startDoc&&(a=this.view.posAtCoords(Rp(e))),this.updateAllowDefault(e),this.allowDefault||!a?Tp(this.view,"pointer"):Vp(this.view,a.pos,a.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||Xm&&this.mightDrag&&!this.mightDrag.node.isAtom||Jm&&!this.view.state.selection.visible&&Math.min(Math.abs(a.pos-this.view.state.selection.from),Math.abs(a.pos-this.view.state.selection.to))<=2)?(Bp(this.view,om.near(this.view.state.doc.resolve(a.pos))),e.preventDefault()):Tp(this.view,"pointer")}move(e){this.updateAllowDefault(e),Tp(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function Zp(e,a){return!!e.composing||!!(Xm&&Math.abs(a.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}_p.touchstart=e=>{e.input.lastTouch=Date.now(),Up(e),Tp(e,"pointer")},_p.touchmove=e=>{e.input.lastTouch=Date.now(),Tp(e,"pointer")},_p.contextmenu=e=>Up(e);const Jp=rg?5e3:-1;function Yp(e,a){clearTimeout(e.input.composingTimeout),a>-1&&(e.input.composingTimeout=setTimeout((()=>eb(e)),a))}function Xp(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Qp(e){let a=e.domSelectionRange();if(!a.focusNode)return null;let r=function(e,a){for(;;){if(3==e.nodeType&&a)return e;if(1==e.nodeType&&a>0){if("false"==e.contentEditable)return null;a=Tm(e=e.childNodes[a-1])}else{if(!e.parentNode||Im(e))return null;a=Om(e),e=e.parentNode}}}(a.focusNode,a.focusOffset),n=function(e,a){for(;;){if(3==e.nodeType&&a<e.nodeValue.length)return e;if(1==e.nodeType&&a<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[a],a=0}else{if(!e.parentNode||Im(e))return null;a=Om(e)+1,e=e.parentNode}}}(a.focusNode,a.focusOffset);if(r&&n&&r!=n){let a=n.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(r==i||n==i)return i;if(!a||!a.isText(n.nodeValue))return n;if(e.input.compositionNode==n){let e=r.pmViewDesc;if(e&&e.isText(r.nodeValue))return n}}return r||n}function eb(e,a=!1){if(!(rg&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),Xp(e),a||e.docView&&e.docView.dirty){let r=Zg(e);return r&&!r.eq(e.state.selection)?e.dispatch(e.state.tr.setSelection(r)):!e.markCursor&&!a||e.state.selection.empty?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}Ap.compositionstart=Ap.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:a}=e,r=a.selection.$to;if(a.selection instanceof dm&&(a.storedMarks||!r.textOffset&&r.parentOffset&&r.nodeBefore.marks.some((e=>!1===e.type.spec.inclusive))))e.markCursor=e.state.storedMarks||r.marks(),eb(e,!0),e.markCursor=null;else if(eb(e,!a.selection.empty),Km&&a.selection.empty&&r.parentOffset&&!r.textOffset&&r.nodeBefore.marks.length){let a=e.domSelectionRange();for(let r=a.focusNode,n=a.focusOffset;r&&1==r.nodeType&&0!=n;){let a=n<0?r.lastChild:r.childNodes[n-1];if(!a)break;if(3==a.nodeType){let r=e.domSelection();r&&r.collapse(a,a.nodeValue.length);break}r=a,n=-1}}e.input.composing=!0}Yp(e,Jp)},Ap.compositionend=(e,a)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=a.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then((()=>e.domObserver.flush())),e.input.compositionID++,Yp(e,20))};const ab=Um&&Gm<15||Qm&&ig<604;function rb(e,a,r,n,i){let t=wp(e,a,r,n,e.state.selection.$from);if(e.someProp("handlePaste",(a=>a(e,i,t||pu.empty))))return!0;if(!t)return!1;let o=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(t),s=o?e.state.tr.replaceSelectionWith(o,n):e.state.tr.replaceSelection(t);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nb(e){let a=e.getData("text/plain")||e.getData("Text");if(a)return a;let r=e.getData("text/uri-list");return r?r.replace(/\r?\n/g," "):""}_p.copy=Ap.cut=(e,a)=>{let r=a,n=e.state.selection,i="cut"==r.type;if(n.empty)return;let t=ab?null:r.clipboardData,o=n.content(),{dom:s,text:l}=vp(e,o);t?(r.preventDefault(),t.clearData(),t.setData("text/html",s.innerHTML),t.setData("text/plain",l)):function(e,a){if(!e.dom.parentNode)return;let r=e.dom.parentNode.appendChild(document.createElement("div"));r.appendChild(a),r.style.cssText="position: fixed; left: -10000px; top: 10px";let n=getSelection(),i=document.createRange();i.selectNodeContents(a),e.dom.blur(),n.removeAllRanges(),n.addRange(i),setTimeout((()=>{r.parentNode&&r.parentNode.removeChild(r),e.focus()}),50)}(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},Ap.paste=(e,a)=>{let r=a;if(e.composing&&!rg)return;let n=ab?null:r.clipboardData,i=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&rb(e,nb(n),n.getData("text/html"),i,r)?r.preventDefault():function(e,a){if(!e.dom.parentNode)return;let r=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,n=e.dom.parentNode.appendChild(document.createElement(r?"textarea":"div"));r||(n.contentEditable="true"),n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout((()=>{e.focus(),n.parentNode&&n.parentNode.removeChild(n),r?rb(e,n.value,null,i,a):rb(e,n.textContent,n.innerHTML,i,a)}),50)}(e,r)};class ib{constructor(e,a,r){this.slice=e,this.move=a,this.node=r}}const tb=eg?"altKey":"ctrlKey";_p.dragstart=(e,a)=>{let r=a,n=e.input.mouseDown;if(n&&n.done(),!r.dataTransfer)return;let i,t=e.state.selection,o=t.empty?null:e.posAtCoords(Rp(r));if(o&&o.pos>=t.from&&o.pos<=(t instanceof hm?t.to-1:t.to));else if(n&&n.mightDrag)i=hm.create(e.state.doc,n.mightDrag.pos);else if(r.target&&1==r.target.nodeType){let a=e.docView.nearestDesc(r.target,!0);a&&a.node.type.spec.draggable&&a!=e.docView&&(i=hm.create(e.state.doc,a.posBefore))}let s=(i||e.state.selection).content(),{dom:l,text:c,slice:d}=vp(e,s);(!r.dataTransfer.files.length||!Jm||Ym>120)&&r.dataTransfer.clearData(),r.dataTransfer.setData(ab?"Text":"text/html",l.innerHTML),r.dataTransfer.effectAllowed="copyMove",ab||r.dataTransfer.setData("text/plain",c),e.dragging=new ib(d,!r[tb],i)},_p.dragend=e=>{let a=e.dragging;window.setTimeout((()=>{e.dragging==a&&(e.dragging=null)}),50)},Ap.dragover=Ap.dragenter=(e,a)=>a.preventDefault(),Ap.drop=(e,a)=>{let r=a,n=e.dragging;if(e.dragging=null,!r.dataTransfer)return;let i=e.posAtCoords(Rp(r));if(!i)return;let t=e.state.doc.resolve(i.pos),o=n&&n.slice;o?e.someProp("transformPasted",(a=>{o=a(o,e)})):o=wp(e,nb(r.dataTransfer),ab?null:r.dataTransfer.getData("text/html"),!1,t);let s=!(!n||r[tb]);if(e.someProp("handleDrop",(a=>a(e,r,o||pu.empty,s))))return void r.preventDefault();if(!o)return;r.preventDefault();let l=o?Hh(e.state.doc,t.pos,o):t.pos;null==l&&(l=t.pos);let c=e.state.tr;if(s){let{node:e}=n;e?e.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=c.doc;if(u?c.replaceRangeWith(d,d,o.content.firstChild):c.replaceRange(d,d,o),c.doc.eq(h))return;let m=c.doc.resolve(d);if(u&&hm.isSelectable(o.content.firstChild)&&m.nodeAfter&&m.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new hm(m));else{let a=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach(((e,r,n,i)=>a=i)),c.setSelection(ip(e,m,c.doc.resolve(a)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))},_p.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout((()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Yg(e)}),20))},_p.blur=(e,a)=>{let r=a;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),r.relatedTarget&&e.dom.contains(r.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},_p.beforeinput=(e,a)=>{if(Jm&&rg&&"deleteContentBackward"==a.inputType){e.domObserver.flushSoon();let{domChangeCount:a}=e.input;setTimeout((()=>{if(e.input.domChangeCount!=a)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",(a=>a(e,Pm(8,"Backspace")))))return;let{$cursor:r}=e.state.selection;r&&r.pos>0&&e.dispatch(e.state.tr.delete(r.pos-1,r.pos).scrollIntoView())}),50)}};for(let e in Ap)_p[e]=Ap[e];function ob(e,a){if(e==a)return!0;for(let r in e)if(e[r]!==a[r])return!1;for(let r in a)if(!(r in e))return!1;return!0}class sb{constructor(e,a){this.toDOM=e,this.spec=a||hb,this.side=this.spec.side||0}map(e,a,r,n){let{pos:i,deleted:t}=e.mapResult(a.from+n,this.side<0?-1:1);return t?null:new db(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof sb&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ob(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class lb{constructor(e,a){this.attrs=e,this.spec=a||hb}map(e,a,r,n){let i=e.map(a.from+n,this.spec.inclusiveStart?-1:1)-r,t=e.map(a.to+n,this.spec.inclusiveEnd?1:-1)-r;return i>=t?null:new db(i,t,this)}valid(e,a){return a.from<a.to}eq(e){return this==e||e instanceof lb&&ob(this.attrs,e.attrs)&&ob(this.spec,e.spec)}static is(e){return e.type instanceof lb}destroy(){}}class cb{constructor(e,a){this.attrs=e,this.spec=a||hb}map(e,a,r,n){let i=e.mapResult(a.from+n,1);if(i.deleted)return null;let t=e.mapResult(a.to+n,-1);return t.deleted||t.pos<=i.pos?null:new db(i.pos-r,t.pos-r,this)}valid(e,a){let r,{index:n,offset:i}=e.content.findIndex(a.from);return i==a.from&&!(r=e.child(n)).isText&&i+r.nodeSize==a.to}eq(e){return this==e||e instanceof cb&&ob(this.attrs,e.attrs)&&ob(this.spec,e.spec)}destroy(){}}class db{constructor(e,a,r){this.from=e,this.to=a,this.type=r}copy(e,a){return new db(e,a,this.type)}eq(e,a=0){return this.type.eq(e.type)&&this.from+a==e.from&&this.to+a==e.to}map(e,a,r){return this.type.map(e,this,a,r)}static widget(e,a,r){return new db(e,e,new sb(a,r))}static inline(e,a,r,n){return new db(e,a,new lb(r,n))}static node(e,a,r,n){return new db(e,a,new cb(r,n))}get spec(){return this.type.spec}get inline(){return this.type instanceof lb}get widget(){return this.type instanceof sb}}const ub=[],hb={};class mb{constructor(e,a){this.local=e.length?e:ub,this.children=a.length?a:ub}static create(e,a){return a.length?yb(a,e,0,hb):gb}find(e,a,r){let n=[];return this.findInner(null==e?0:e,null==a?1e9:a,n,0,r),n}findInner(e,a,r,n,i){for(let t=0;t<this.local.length;t++){let o=this.local[t];o.from<=a&&o.to>=e&&(!i||i(o.spec))&&r.push(o.copy(o.from+n,o.to+n))}for(let t=0;t<this.children.length;t+=3)if(this.children[t]<a&&this.children[t+1]>e){let o=this.children[t]+1;this.children[t+2].findInner(e-o,a-o,r,n+o,i)}}map(e,a,r){return this==gb||0==e.maps.length?this:this.mapInner(e,a,0,0,r||hb)}mapInner(e,a,r,n,i){let t;for(let o=0;o<this.local.length;o++){let s=this.local[o].map(e,r,n);s&&s.type.valid(a,s)?(t||(t=[])).push(s):i.onRemove&&i.onRemove(this.local[o].spec)}return this.children.length?function(e,a,r,n,i,t,o){let s=e.slice();for(let e=0,a=t;e<r.maps.length;e++){let n=0;r.maps[e].forEach(((e,r,i,t)=>{let o=t-i-(r-e);for(let i=0;i<s.length;i+=3){let t=s[i+1];if(t<0||e>t+a-n)continue;let l=s[i]+a-n;r>=l?s[i+1]=e<=l?-2:-1:e>=a&&o&&(s[i]+=o,s[i+1]+=o)}n+=o})),a=r.maps[e].map(a,-1)}let l=!1;for(let a=0;a<s.length;a+=3)if(s[a+1]<0){if(-2==s[a+1]){l=!0,s[a+1]=-1;continue}let c=r.map(e[a]+t),d=c-i;if(d<0||d>=n.content.size){l=!0;continue}let u=r.map(e[a+1]+t,-1)-i,{index:h,offset:m}=n.content.findIndex(d),g=n.maybeChild(h);if(g&&m==d&&m+g.nodeSize==u){let n=s[a+2].mapInner(r,g,c+1,e[a]+t+1,o);n!=gb?(s[a]=d,s[a+1]=u,s[a+2]=n):(s[a+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,a,r,n,i,t,o){function s(e,a){for(let t=0;t<e.local.length;t++){let s=e.local[t].map(n,i,a);s?r.push(s):o.onRemove&&o.onRemove(e.local[t].spec)}for(let r=0;r<e.children.length;r+=3)s(e.children[r+2],e.children[r]+a+1)}for(let r=0;r<e.length;r+=3)-1==e[r+1]&&s(e[r+2],a[r]+t+1);return r}(s,e,a,r,i,t,o),c=yb(l,n,0,o);a=c.local;for(let e=0;e<s.length;e+=3)s[e+1]<0&&(s.splice(e,3),e-=3);for(let e=0,a=0;e<c.children.length;e+=3){let r=c.children[e];for(;a<s.length&&s[a]<r;)a+=3;s.splice(a,0,c.children[e],c.children[e+1],c.children[e+2])}}return new mb(a.sort(vb),s)}(this.children,t||[],e,a,r,n,i):t?new mb(t.sort(vb),ub):gb}add(e,a){return a.length?this==gb?mb.create(e,a):this.addInner(e,a,0):this}addInner(e,a,r){let n,i=0;e.forEach(((e,t)=>{let o,s=t+r;if(o=fb(a,e,s)){for(n||(n=this.children.slice());i<n.length&&n[i]<t;)i+=3;n[i]==t?n[i+2]=n[i+2].addInner(e,o,s+1):n.splice(i,0,t,t+e.nodeSize,yb(o,e,s+1,hb)),i+=3}}));let t=bb(i?kb(a):a,-r);for(let a=0;a<t.length;a++)t[a].type.valid(e,t[a])||t.splice(a--,1);return new mb(t.length?this.local.concat(t).sort(vb):this.local,n||this.children)}remove(e){return 0==e.length||this==gb?this:this.removeInner(e,0)}removeInner(e,a){let r=this.children,n=this.local;for(let n=0;n<r.length;n+=3){let i,t=r[n]+a,o=r[n+1]+a;for(let a,r=0;r<e.length;r++)(a=e[r])&&a.from>t&&a.to<o&&(e[r]=null,(i||(i=[])).push(a));if(!i)continue;r==this.children&&(r=this.children.slice());let s=r[n+2].removeInner(i,t+1);s!=gb?r[n+2]=s:(r.splice(n,3),n-=3)}if(n.length)for(let r,i=0;i<e.length;i++)if(r=e[i])for(let e=0;e<n.length;e++)n[e].eq(r,a)&&(n==this.local&&(n=this.local.slice()),n.splice(e--,1));return r==this.children&&n==this.local?this:n.length||r.length?new mb(n,r):gb}forChild(e,a){if(this==gb)return this;if(a.isLeaf)return mb.empty;let r,n;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,t=i+a.content.size;for(let e=0;e<this.local.length;e++){let a=this.local[e];if(a.from<t&&a.to>i&&a.type instanceof lb){let e=Math.max(i,a.from)-i,r=Math.min(t,a.to)-i;e<r&&(n||(n=[])).push(a.copy(e,r))}}if(n){let e=new mb(n.sort(vb),ub);return r?new pb([e,r]):e}return r||gb}eq(e){if(this==e)return!0;if(!(e instanceof mb)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let a=0;a<this.local.length;a++)if(!this.local[a].eq(e.local[a]))return!1;for(let a=0;a<this.children.length;a+=3)if(this.children[a]!=e.children[a]||this.children[a+1]!=e.children[a+1]||!this.children[a+2].eq(e.children[a+2]))return!1;return!0}locals(e){return wb(this.localsInner(e))}localsInner(e){if(this==gb)return ub;if(e.inlineContent||!this.local.some(lb.is))return this.local;let a=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof lb||a.push(this.local[e]);return a}forEachSet(e){e(this)}}mb.empty=new mb([],[]),mb.removeOverlap=wb;const gb=mb.empty;class pb{constructor(e){this.members=e}map(e,a){const r=this.members.map((r=>r.map(e,a,hb)));return pb.from(r)}forChild(e,a){if(a.isLeaf)return mb.empty;let r=[];for(let n=0;n<this.members.length;n++){let i=this.members[n].forChild(e,a);i!=gb&&(i instanceof pb?r=r.concat(i.members):r.push(i))}return pb.from(r)}eq(e){if(!(e instanceof pb)||e.members.length!=this.members.length)return!1;for(let a=0;a<this.members.length;a++)if(!this.members[a].eq(e.members[a]))return!1;return!0}locals(e){let a,r=!0;for(let n=0;n<this.members.length;n++){let i=this.members[n].localsInner(e);if(i.length)if(a){r&&(a=a.slice(),r=!1);for(let e=0;e<i.length;e++)a.push(i[e])}else a=i}return a?wb(r?a:a.sort(vb)):ub}static from(e){switch(e.length){case 0:return gb;case 1:return e[0];default:return new pb(e.every((e=>e instanceof mb))?e:e.reduce(((e,a)=>e.concat(a instanceof mb?a:a.members)),[]))}}forEachSet(e){for(let a=0;a<this.members.length;a++)this.members[a].forEachSet(e)}}function bb(e,a){if(!a||!e.length)return e;let r=[];for(let n=0;n<e.length;n++){let i=e[n];r.push(new db(i.from+a,i.to+a,i.type))}return r}function fb(e,a,r){if(a.isLeaf)return null;let n=r+a.nodeSize,i=null;for(let a,t=0;t<e.length;t++)(a=e[t])&&a.from>r&&a.to<n&&((i||(i=[])).push(a),e[t]=null);return i}function kb(e){let a=[];for(let r=0;r<e.length;r++)null!=e[r]&&a.push(e[r]);return a}function yb(e,a,r,n){let i=[],t=!1;a.forEach(((a,o)=>{let s=fb(e,a,o+r);if(s){t=!0;let e=yb(s,a,r+o+1,n);e!=gb&&i.push(o,o+a.nodeSize,e)}}));let o=bb(t?kb(e):e,-r).sort(vb);for(let e=0;e<o.length;e++)o[e].type.valid(a,o[e])||(n.onRemove&&n.onRemove(o[e].spec),o.splice(e--,1));return o.length||i.length?new mb(o,i):gb}function vb(e,a){return e.from-a.from||e.to-a.to}function wb(e){let a=e;for(let r=0;r<a.length-1;r++){let n=a[r];if(n.from!=n.to)for(let i=r+1;i<a.length;i++){let t=a[i];if(t.from!=n.from){t.from<n.to&&(a==e&&(a=e.slice()),a[r]=n.copy(n.from,t.from),zb(a,i,n.copy(t.from,n.to)));break}t.to!=n.to&&(a==e&&(a=e.slice()),a[i]=t.copy(t.from,n.to),zb(a,i+1,t.copy(n.to,t.to)))}}return a}function zb(e,a,r){for(;a<e.length&&vb(r,e[a])>0;)a++;e.splice(a,0,r)}function jb(e){let a=[];return e.someProp("decorations",(r=>{let n=r(e.state);n&&n!=gb&&a.push(n)})),e.cursorWrapper&&a.push(mb.create(e.state.doc,[e.cursorWrapper.deco])),pb.from(a)}const xb={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},$b=Um&&Gm<=11;class qb{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Cb{constructor(e,a){this.view=e,this.handleDOMChange=a,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new qb,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((e=>{for(let a=0;a<e.length;a++)this.queue.push(e[a]);Um&&Gm<=11&&e.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),$b&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout((()=>{this.flushingSoon=-1,this.flush()}),20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,xb)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let a=0;a<e.length;a++)this.queue.push(e[a]);window.setTimeout((()=>this.flush()),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout((()=>this.suppressingSelectionUpdates=!1),50)}onSelectionChange(){if(tp(this.view)){if(this.suppressingSelectionUpdates)return Yg(this.view);if(Um&&Gm<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Am(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let a,r=new Set;for(let a=e.focusNode;a;a=Em(a))r.add(a);for(let n=e.anchorNode;n;n=Em(n))if(r.has(n)){a=n;break}let n=a&&this.view.docView.nearestDesc(a);return n&&n.ignoreMutation({type:"selection",target:3==a.nodeType?a.parentNode:a})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let a=this.pendingRecords();a.length&&(this.queue=[]);let r=e.domSelectionRange(),n=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&tp(e)&&!this.ignoreSelectionChange(r),i=-1,t=-1,o=!1,s=[];if(e.editable)for(let e=0;e<a.length;e++){let r=this.registerMutation(a[e],s);r&&(i=i<0?r.from:Math.min(r.from,i),t=t<0?r.to:Math.max(r.to,t),r.typeOver&&(o=!0))}if(Km&&s.length){let a=s.filter((e=>"BR"==e.nodeName));if(2==a.length){let[e,r]=a;e.parentNode&&e.parentNode.parentNode==r.parentNode?r.remove():e.remove()}else{let{focusNode:r}=this.currentSelection;for(let n of a){let a=n.parentNode;!a||"LI"!=a.nodeName||r&&Mb(e,r)==a||n.remove()}}}let l=null;i<0&&n&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Fm(r)&&(l=Zg(e))&&l.eq(om.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Yg(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||n)&&(i>-1&&(e.docView.markDirty(i,t),function(e){if(Sb.has(e))return;if(Sb.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)){if(e.requiresGeckoHackNode=Km,Ob)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Ob=!0}}(e)),this.handleDOMChange(i,t,o,s),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Yg(e),this.currentSelection.set(r))}registerMutation(e,a){if(a.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(r==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!r||r.ignoreMutation(e))return null;if("childList"==e.type){for(let r=0;r<e.addedNodes.length;r++){let n=e.addedNodes[r];a.push(n),3==n.nodeType&&(this.lastChangedTextNode=n)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let n=e.previousSibling,i=e.nextSibling;if(Um&&Gm<=11&&e.addedNodes.length)for(let a=0;a<e.addedNodes.length;a++){let{previousSibling:r,nextSibling:t}=e.addedNodes[a];(!r||Array.prototype.indexOf.call(e.addedNodes,r)<0)&&(n=r),(!t||Array.prototype.indexOf.call(e.addedNodes,t)<0)&&(i=t)}let t=n&&n.parentNode==e.target?Om(n)+1:0,o=r.localPosFromDOM(e.target,t,-1),s=i&&i.parentNode==e.target?Om(i):e.target.childNodes.length;return{from:o,to:r.localPosFromDOM(e.target,s,1)}}return"attributes"==e.type?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Sb=new WeakMap,Ob=!1;function Eb(e,a){let r=a.startContainer,n=a.startOffset,i=a.endContainer,t=a.endOffset,o=e.domAtPos(e.state.selection.anchor);return Am(o.node,o.offset,i,t)&&([r,n,i,t]=[i,t,r,n]),{anchorNode:r,anchorOffset:n,focusNode:i,focusOffset:t}}function Mb(e,a){for(let r=a.parentNode;r&&r!=e.dom;r=r.parentNode){let a=e.docView.nearestDesc(r,!0);if(a&&a.node.isBlock)return r}return null}function _b(e){let a=e.pmViewDesc;if(a)return a.parseRule();if("BR"==e.nodeName&&e.parentNode){if(Xm&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}if(e.parentNode.lastChild==e||Xm&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Ab=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Db(e,a,r,n,i){let t=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,a<0){let a=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,r=Zg(e,a);if(r&&!e.state.selection.eq(r)){if(Jm&&rg&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",(a=>a(e,Pm(13,"Enter")))))return;let n=e.state.tr.setSelection(r);"pointer"==a?n.setMeta("pointer",!0):"key"==a&&n.scrollIntoView(),t&&n.setMeta("composition",t),e.dispatch(n)}return}let o=e.state.doc.resolve(a),s=o.sharedDepth(r);a=o.before(s+1),r=e.state.doc.resolve(r).after(s+1);let l,c,d=e.state.selection,u=function(e,a,r){let n,{node:i,fromOffset:t,toOffset:o,from:s,to:l}=e.docView.parseRange(a,r),c=e.domSelectionRange(),d=c.anchorNode;if(d&&e.dom.contains(1==d.nodeType?d:d.parentNode)&&(n=[{node:d,offset:c.anchorOffset}],Fm(c)||n.push({node:c.focusNode,offset:c.focusOffset})),Jm&&8===e.input.lastKeyCode)for(let e=o;e>t;e--){let a=i.childNodes[e-1],r=a.pmViewDesc;if("BR"==a.nodeName&&!r){o=e;break}if(!r||r.size)break}let u=e.state.doc,h=e.someProp("domParser")||eh.fromSchema(e.state.schema),m=u.resolve(s),g=null,p=h.parse(i,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:t,to:o,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:n,ruleFromNode:_b,context:m});if(n&&null!=n[0].pos){let e=n[0].pos,a=n[1]&&n[1].pos;null==a&&(a=e),g={anchor:e+s,head:a+s}}return{doc:p,sel:g,from:s,to:l}}(e,a,r),h=e.state.doc,m=h.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(l=e.state.selection.to,c="end"):(l=e.state.selection.from,c="start"),e.input.lastKeyCode=null;let g=function(e,a,r,n,i){let t=e.findDiffStart(a,r);if(null==t)return null;let{a:o,b:s}=e.findDiffEnd(a,r+e.size,r+a.size);if("end"==i){n-=o+Math.max(0,t-Math.min(o,s))-t}if(o<t&&e.size<a.size){let e=n<=t&&n>=o?t-n:0;t-=e,t&&t<a.size&&Ib(a.textBetween(t-1,t+1))&&(t+=e?1:-1),s=t+(s-o),o=t}else if(s<t){let a=n<=t&&n>=s?t-n:0;t-=a,t&&t<e.size&&Ib(e.textBetween(t-1,t+1))&&(t+=a?1:-1),o=t+(o-s),s=t}return{start:t,endA:o,endB:s}}(m.content,u.doc.content,u.from,l,c);if(g&&e.input.domChangeCount++,(Qm&&e.input.lastIOSEnter>Date.now()-225||rg)&&i.some((e=>1==e.nodeType&&!Ab.test(e.nodeName)))&&(!g||g.endA>=g.endB)&&e.someProp("handleKeyDown",(a=>a(e,Pm(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(!g){if(!(n&&d instanceof dm&&!d.empty&&d.$head.sameParent(d.$anchor))||e.composing||u.sel&&u.sel.anchor!=u.sel.head){if(u.sel){let a=Nb(e,e.state.doc,u.sel);if(a&&!a.eq(e.state.selection)){let r=e.state.tr.setSelection(a);t&&r.setMeta("composition",t),e.dispatch(r)}}return}g={start:d.from,endA:d.to,endB:d.to}}e.state.selection.from<e.state.selection.to&&g.start==g.endB&&e.state.selection instanceof dm&&(g.start>e.state.selection.from&&g.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?g.start=e.state.selection.from:g.endA<e.state.selection.to&&g.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(g.endB+=e.state.selection.to-g.endA,g.endA=e.state.selection.to)),Um&&Gm<=11&&g.endB==g.start+1&&g.endA==g.start&&g.start>u.from&&" "==u.doc.textBetween(g.start-u.from-1,g.start-u.from+1)&&(g.start--,g.endA--,g.endB--);let p,b=u.doc.resolveNoCache(g.start-u.from),f=u.doc.resolveNoCache(g.endB-u.from),k=h.resolve(g.start),y=b.sameParent(f)&&b.parent.inlineContent&&k.end()>=g.endA;if((Qm&&e.input.lastIOSEnter>Date.now()-225&&(!y||i.some((e=>"DIV"==e.nodeName||"P"==e.nodeName)))||!y&&b.pos<u.doc.content.size&&!b.sameParent(f)&&(p=om.findFrom(u.doc.resolve(b.pos+1),1,!0))&&p.head==f.pos)&&e.someProp("handleKeyDown",(a=>a(e,Pm(13,"Enter")))))return void(e.input.lastIOSEnter=0);if(e.state.selection.anchor>g.start&&function(e,a,r,n,i){if(r-a<=i.pos-n.pos||Tb(n,!0,!1)<i.pos)return!1;let t=e.resolve(a);if(!n.parent.isTextblock){let e=t.nodeAfter;return null!=e&&r==a+e.nodeSize}if(t.parentOffset<t.parent.content.size||!t.parent.isTextblock)return!1;let o=e.resolve(Tb(t,!0,!0));return!(!o.parent.isTextblock||o.pos>r||Tb(o,!0,!1)<r)&&n.parent.content.cut(n.parentOffset).eq(o.parent.content)}(h,g.start,g.endA,b,f)&&e.someProp("handleKeyDown",(a=>a(e,Pm(8,"Backspace")))))return void(rg&&Jm&&e.domObserver.suppressSelectionUpdates());Jm&&g.endB==g.start&&(e.input.lastChromeDelete=Date.now()),rg&&!y&&b.start()!=f.start()&&0==f.parentOffset&&b.depth==f.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==g.endA&&(g.endB-=2,f=u.doc.resolveNoCache(g.endB-u.from),setTimeout((()=>{e.someProp("handleKeyDown",(function(a){return a(e,Pm(13,"Enter"))}))}),20));let v,w,z,j=g.start,x=g.endA;if(y)if(b.pos==f.pos)Um&&Gm<=11&&0==b.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout((()=>Yg(e)),20)),v=e.state.tr.delete(j,x),w=h.resolve(g.start).marksAcross(h.resolve(g.endA));else if(g.endA==g.endB&&(z=function(e,a){let r,n,i,t=e.firstChild.marks,o=a.firstChild.marks,s=t,l=o;for(let e=0;e<o.length;e++)s=o[e].removeFromSet(s);for(let e=0;e<t.length;e++)l=t[e].removeFromSet(l);if(1==s.length&&0==l.length)n=s[0],r="add",i=e=>e.mark(n.addToSet(e.marks));else{if(0!=s.length||1!=l.length)return null;n=l[0],r="remove",i=e=>e.mark(n.removeFromSet(e.marks))}let c=[];for(let e=0;e<a.childCount;e++)c.push(i(a.child(e)));if(cu.from(c).eq(e))return{mark:n,type:r}}(b.parent.content.cut(b.parentOffset,f.parentOffset),k.parent.content.cut(k.parentOffset,g.endA-k.start()))))v=e.state.tr,"add"==z.type?v.addMark(j,x,z.mark):v.removeMark(j,x,z.mark);else if(b.parent.child(b.index()).isText&&b.index()==f.index()-(f.textOffset?0:1)){let a=b.parent.textBetween(b.parentOffset,f.parentOffset);if(e.someProp("handleTextInput",(r=>r(e,j,x,a))))return;v=e.state.tr.insertText(a,j,x)}if(v||(v=e.state.tr.replace(j,x,u.doc.slice(g.start-u.from,g.endB-u.from))),u.sel){let a=Nb(e,v.doc,u.sel);a&&!(Jm&&e.composing&&a.empty&&(g.start!=g.endB||e.input.lastChromeDelete<Date.now()-100)&&(a.head==j||a.head==v.mapping.map(x)-1)||Um&&a.empty&&a.head==j)&&v.setSelection(a)}w&&v.ensureMarks(w),t&&v.setMeta("composition",t),e.dispatch(v.scrollIntoView())}function Nb(e,a,r){return Math.max(r.anchor,r.head)>a.content.size?null:ip(e,a.resolve(r.anchor),a.resolve(r.head))}function Tb(e,a,r){let n=e.depth,i=a?e.end():e.pos;for(;n>0&&(a||e.indexAfter(n)==e.node(n).childCount);)n--,i++,a=!1;if(r){let a=e.node(n).maybeChild(e.indexAfter(n));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function Ib(e){if(2!=e.length)return!1;let a=e.charCodeAt(0),r=e.charCodeAt(1);return a>=56320&&a<=57343&&r>=55296&&r<=56319}class Fb{constructor(e,a){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new Np,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=a,this.state=a.state,this.directPlugins=a.plugins||[],this.directPlugins.forEach(Vb),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=Lb(this),Rb(this),this.nodeViews=Bb(this),this.docView=Ag(this.state.doc,Pb(this),jb(this),this.dom,this),this.domObserver=new Cb(this,((e,a,r,n)=>Db(this,e,a,r,n))),this.domObserver.start(),function(e){for(let a in _p){let r=_p[a];e.dom.addEventListener(a,e.input.eventHandlers[a]=a=>{!Pp(e,a)||Fp(e,a)||!e.editable&&a.type in Ap||r(e,a)},Dp[a]?{passive:!0}:void 0)}Xm&&e.dom.addEventListener("input",(()=>null)),Ip(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let a in e)this._props[a]=e[a];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Ip(this);let a=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Vb),this.directPlugins=e.plugins),this.updateStateInner(e.state,a)}setProps(e){let a={};for(let e in this._props)a[e]=this._props[e];a.state=this.state;for(let r in e)a[r]=e[r];this.update(a)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,a){var r;let n=this.state,i=!1,t=!1;e.storedMarks&&this.composing&&(Xp(this),t=!0),this.state=e;let o=n.plugins!=e.plugins||this._props.plugins!=a.plugins;if(o||this._props.plugins!=a.plugins||this._props.nodeViews!=a.nodeViews){let e=Bb(this);(function(e,a){let r=0,n=0;for(let n in e){if(e[n]!=a[n])return!0;r++}for(let e in a)n++;return r!=n})(e,this.nodeViews)&&(this.nodeViews=e,i=!0)}(o||a.handleDOMEvents!=this._props.handleDOMEvents)&&Ip(this),this.editable=Lb(this),Rb(this);let s=jb(this),l=Pb(this),c=n.plugins==e.plugins||n.doc.eq(e.doc)?e.scrollToSelection>n.scrollToSelection?"to selection":"preserve":"reset",d=i||!this.docView.matchesNode(e.doc,l,s);!d&&e.selection.eq(n.selection)||(t=!0);let u="preserve"==c&&t&&null==this.dom.style.overflowAnchor&&function(e){let a,r,n=e.dom.getBoundingClientRect(),i=Math.max(0,n.top);for(let t=(n.left+n.right)/2,o=i+1;o<Math.min(innerHeight,n.bottom);o+=5){let n=e.root.elementFromPoint(t,o);if(!n||n==e.dom||!e.dom.contains(n))continue;let s=n.getBoundingClientRect();if(s.top>=i-20){a=n,r=s.top;break}}return{refDOM:a,refTop:r,stack:cg(e.dom)}}(this);if(t){this.domObserver.stop();let a=d&&(Um||Jm)&&!this.composing&&!n.selection.empty&&!e.selection.empty&&function(e,a){let r=Math.min(e.$anchor.sharedDepth(e.head),a.$anchor.sharedDepth(a.head));return e.$anchor.start(r)!=a.$anchor.start(r)}(n.selection,e.selection);if(d){let r=Jm?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Qp(this)),!i&&this.docView.update(e.doc,l,s,this)||(this.docView.updateOuterDeco(l),this.docView.destroy(),this.docView=Ag(e.doc,l,s,this.dom,this)),r&&!this.trackWrites&&(a=!0)}a||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&function(e){let a=e.docView.domFromPos(e.state.selection.anchor,0),r=e.domSelectionRange();return Am(a.node,a.offset,r.anchorNode,r.anchorOffset)}(this))?Yg(this,a):(rp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(n),(null===(r=this.dragging)||void 0===r?void 0:r.node)&&!n.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,n),"reset"==c?this.dom.scrollTop=0:"to selection"==c?this.scrollToSelection():u&&function({refDOM:e,refTop:a,stack:r}){let n=e?e.getBoundingClientRect().top:0;dg(r,0==n?0:n-a)}(u)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(this.someProp("handleScrollToSelection",(e=>e(this))));else if(this.state.selection instanceof hm){let a=this.docView.domAfterPos(this.state.selection.from);1==a.nodeType&&lg(this,a.getBoundingClientRect(),e)}else lg(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let a=0;a<this.pluginViews.length;a++){let r=this.pluginViews[a];r.update&&r.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let a=this.directPlugins[e];a.spec.view&&this.pluginViews.push(a.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let a=this.state.plugins[e];a.spec.view&&this.pluginViews.push(a.spec.view(this))}}}updateDraggedNode(e,a){let r=e.node,n=-1;if(this.state.doc.nodeAt(r.from)==r.node)n=r.from;else{let e=r.from+(this.state.doc.content.size-a.doc.content.size);(e>0&&this.state.doc.nodeAt(e))==r.node&&(n=e)}this.dragging=new ib(e.slice,e.move,n<0?void 0:hm.create(this.state.doc,n))}someProp(e,a){let r,n=this._props&&this._props[e];if(null!=n&&(r=a?a(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=a?a(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let t=i[n].props[e];if(null!=t&&(r=a?a(t):t))return r}}hasFocus(){if(Um){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(ug)return e.focus(ug);let a=cg(e);e.focus(null==ug?{get preventScroll(){return ug={preventScroll:!0},!0}}:void 0),ug||(ug=!1,dg(a,0))}(this.dom),Yg(this),this.domObserver.start()}get root(){let e=this._root;if(null==e)for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e;return e||document}updateRoot(){this._root=null}posAtCoords(e){return pg(this,e)}coordsAtPos(e,a=1){return yg(this,e,a)}domAtPos(e,a=0){return this.docView.domFromPos(e,a)}nodeDOM(e){let a=this.docView.descAt(e);return a?a.nodeDOM:null}posAtDOM(e,a,r=-1){let n=this.docView.posFromDOM(e,a,r);if(null==n)throw new RangeError("DOM position not inside the editor");return n}endOfTextblock(e,a){return Cg(this,a||this.state,e)}pasteHTML(e,a){return rb(this,"",e,!1,a||new ClipboardEvent("paste"))}pasteText(e,a){return rb(this,e,null,!0,a||new ClipboardEvent("paste"))}destroy(){this.docView&&(!function(e){e.domObserver.stop();for(let a in e.input.eventHandlers)e.dom.removeEventListener(a,e.input.eventHandlers[a]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],jb(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Mm=null)}get isDestroyed(){return null==this.docView}dispatchEvent(e){return function(e,a){Fp(e,a)||!_p[a.type]||!e.editable&&a.type in Ap||_p[a.type](e,a)}(this,e)}dispatch(e){let a=this._props.dispatchTransaction;a?a.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){let e=this.domSelection();return e?Xm&&11===this.root.nodeType&&function(e){let a=e.activeElement;for(;a&&a.shadowRoot;)a=a.shadowRoot.activeElement;return a}(this.dom.ownerDocument)==this.dom&&function(e,a){if(a.getComposedRanges){let r=a.getComposedRanges(e.root)[0];if(r)return Eb(e,r)}let r;function n(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",n,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",n,!0),r?Eb(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function Pb(e){let a=Object.create(null);return a.class="ProseMirror",a.contenteditable=String(e.editable),e.someProp("attributes",(r=>{if("function"==typeof r&&(r=r(e.state)),r)for(let e in r)"class"==e?a.class+=" "+r[e]:"style"==e?a.style=(a.style?a.style+";":"")+r[e]:a[e]||"contenteditable"==e||"nodeName"==e||(a[e]=String(r[e]))})),a.translate||(a.translate="no"),[db.node(0,e.state.doc.content.size,a)]}function Rb(e){if(e.markCursor){let a=document.createElement("img");a.className="ProseMirror-separator",a.setAttribute("mark-placeholder","true"),a.setAttribute("alt",""),e.cursorWrapper={dom:a,deco:db.widget(e.state.selection.from,a,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Lb(e){return!e.someProp("editable",(a=>!1===a(e.state)))}function Bb(e){let a=Object.create(null);function r(e){for(let r in e)Object.prototype.hasOwnProperty.call(a,r)||(a[r]=e[r])}return e.someProp("nodeViews",r),e.someProp("markViews",r),a}function Vb(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var Hb={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Wb={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Ub="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Gb="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Kb=0;Kb<10;Kb++)Hb[48+Kb]=Hb[96+Kb]=String(Kb);for(Kb=1;Kb<=24;Kb++)Hb[Kb+111]="F"+Kb;for(Kb=65;Kb<=90;Kb++)Hb[Kb]=String.fromCharCode(Kb+32),Wb[Kb]=String.fromCharCode(Kb);for(var Zb in Hb)Wb.hasOwnProperty(Zb)||(Wb[Zb]=Hb[Zb]);const Jb="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function Yb(e){let a,r,n,i,t=e.split(/-(?!$)/),o=t[t.length-1];"Space"==o&&(o=" ");for(let e=0;e<t.length-1;e++){let o=t[e];if(/^(cmd|meta|m)$/i.test(o))i=!0;else if(/^a(lt)?$/i.test(o))a=!0;else if(/^(c|ctrl|control)$/i.test(o))r=!0;else if(/^s(hift)?$/i.test(o))n=!0;else{if(!/^mod$/i.test(o))throw new Error("Unrecognized modifier name: "+o);Jb?i=!0:r=!0}}return a&&(o="Alt-"+o),r&&(o="Ctrl-"+o),i&&(o="Meta-"+o),n&&(o="Shift-"+o),o}function Xb(e,a,r=!0){return a.altKey&&(e="Alt-"+e),a.ctrlKey&&(e="Ctrl-"+e),a.metaKey&&(e="Meta-"+e),r&&a.shiftKey&&(e="Shift-"+e),e}function Qb(e){let a=function(e){let a=Object.create(null);for(let r in e)a[Yb(r)]=e[r];return a}(e);return function(e,r){let n,i=function(e){var a=!(Ub&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Gb&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Wb:Hb)[e.keyCode]||e.key||"Unidentified";return"Esc"==a&&(a="Escape"),"Del"==a&&(a="Delete"),"Left"==a&&(a="ArrowLeft"),"Up"==a&&(a="ArrowUp"),"Right"==a&&(a="ArrowRight"),"Down"==a&&(a="ArrowDown"),a}(r),t=a[Xb(i,r)];if(t&&t(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(r.shiftKey){let n=a[Xb(i,r,!1)];if(n&&n(e.state,e.dispatch,e))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(n=Hb[r.keyCode])&&n!=i){let i=a[Xb(n,r)];if(i&&i(e.state,e.dispatch,e))return!0}}return!1}}function ef(e,a){let{$cursor:r}=e.selection;return!r||(a?!a.endOfTextblock("backward",e):r.parentOffset>0)?null:r}function af(e,a,r){let n=a.nodeBefore,i=a.pos-1;for(;!n.isTextblock;i--){if(n.type.spec.isolating)return!1;let e=n.lastChild;if(!e)return!1;n=e}let t=a.nodeAfter,o=a.pos+1;for(;!t.isTextblock;o++){if(t.type.spec.isolating)return!1;let e=t.firstChild;if(!e)return!1;t=e}let s=Wh(e.doc,i,o,pu.empty);if(!s||s.from!=i||s instanceof Eh&&s.slice.size>=o-i)return!1;if(r){let a=e.tr.step(s);a.setSelection(dm.create(a.doc,i)),r(a.scrollIntoView())}return!0}function rf(e,a,r=!1){for(let n=e;n;n="start"==a?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(r&&1!=n.childCount)return!1}return!1}function nf(e){if(!e.parent.type.spec.isolating)for(let a=e.depth-1;a>=0;a--){if(e.index(a)>0)return e.doc.resolve(e.before(a+1));if(e.node(a).type.spec.isolating)break}return null}function tf(e,a){let{$cursor:r}=e.selection;return!r||(a?!a.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)?null:r}function of(e){if(!e.parent.type.spec.isolating)for(let a=e.depth-1;a>=0;a--){let r=e.node(a);if(e.index(a)+1<r.childCount)return e.doc.resolve(e.after(a+1));if(r.type.spec.isolating)break}return null}function sf(e){for(let a=0;a<e.edgeCount;a++){let{type:r}=e.edge(a);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}function lf(e,a,r,n){let i,t,o=a.nodeBefore,s=a.nodeAfter,l=o.type.spec.isolating||s.type.spec.isolating;if(!l&&function(e,a,r){let n=a.nodeBefore,i=a.nodeAfter,t=a.index();return!(!(n&&i&&n.type.compatibleContent(i.type))||(!n.content.size&&a.parent.canReplace(t-1,t)?(r&&r(e.tr.delete(a.pos-n.nodeSize,a.pos).scrollIntoView()),0):!a.parent.canReplace(t,t+1)||!i.isTextblock&&!Lh(e.doc,a.pos)||(r&&r(e.tr.join(a.pos).scrollIntoView()),0)))}(e,a,r))return!0;let c=!l&&a.parent.canReplace(a.index(),a.index()+1);if(c&&(i=(t=o.contentMatchAt(o.childCount)).findWrapping(s.type))&&t.matchType(i[0]||s.type).validEnd){if(r){let n=a.pos+s.nodeSize,t=cu.empty;for(let e=i.length-1;e>=0;e--)t=cu.from(i[e].create(null,t));t=cu.from(o.copy(t));let l=e.tr.step(new Mh(a.pos-1,n,a.pos,n,new pu(t,1,0),i.length,!0)),c=l.doc.resolve(n+2*i.length);c.nodeAfter&&c.nodeAfter.type==o.type&&Lh(l.doc,c.pos)&&l.join(c.pos),r(l.scrollIntoView())}return!0}let d=s.type.spec.isolating||n>0&&l?null:om.findFrom(a,1),u=d&&d.$from.blockRange(d.$to),h=u&&Nh(u);if(null!=h&&h>=a.depth)return r&&r(e.tr.lift(u,h).scrollIntoView()),!0;if(c&&rf(s,"start",!0)&&rf(o,"end")){let n=o,i=[];for(;i.push(n),!n.isTextblock;)n=n.lastChild;let t=s,l=1;for(;!t.isTextblock;t=t.firstChild)l++;if(n.canReplace(n.childCount,n.childCount,t.content)){if(r){let n=cu.empty;for(let e=i.length-1;e>=0;e--)n=cu.from(i[e].copy(n));r(e.tr.step(new Mh(a.pos-i.length,a.pos+s.nodeSize,a.pos+l,a.pos+s.nodeSize-l,new pu(n,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function cf(e){return function(a,r){let n=a.selection,i=e<0?n.$from:n.$to,t=i.depth;for(;i.node(t).isInline;){if(!t)return!1;t--}return!!i.node(t).isTextblock&&(r&&r(a.tr.setSelection(dm.create(a.doc,e<0?i.start(t):i.end(t)))),!0)}}const df=cf(-1),uf=cf(1);function hf(e,a=null){return function(r,n){let i=!1;for(let n=0;n<r.selection.ranges.length&&!i;n++){let{$from:{pos:t},$to:{pos:o}}=r.selection.ranges[n];r.doc.nodesBetween(t,o,((n,t)=>{if(i)return!1;if(n.isTextblock&&!n.hasMarkup(e,a))if(n.type==e)i=!0;else{let a=r.doc.resolve(t),n=a.index();i=a.parent.canReplaceWith(n,n+1,e)}}))}if(!i)return!1;if(n){let i=r.tr;for(let n=0;n<r.selection.ranges.length;n++){let{$from:{pos:t},$to:{pos:o}}=r.selection.ranges[n];i.setBlockType(t,o,e,a)}n(i.scrollIntoView())}return!0}}function mf(e,a=null){return function(r,n){let{$from:i,$to:t}=r.selection,o=i.blockRange(t);if(!o)return!1;let s=n?r.tr:null;return!!function(e,a,r,n=null){let i=!1,t=a,o=a.$from.doc;if(a.depth>=2&&a.$from.node(a.depth-1).type.compatibleContent(r)&&0==a.startIndex){if(0==a.$from.index(a.depth-1))return!1;let e=o.resolve(a.start-2);t=new Mu(e,e,a.depth),a.endIndex<a.parent.childCount&&(a=new Mu(a.$from,o.resolve(a.$to.end(a.depth)),a.depth)),i=!0}let s=Th(t,r,n,a);if(!s)return!1;e&&function(e,a,r,n,i){let t=cu.empty;for(let e=r.length-1;e>=0;e--)t=cu.from(r[e].type.create(r[e].attrs,t));e.step(new Mh(a.start-(n?2:0),a.end,a.start,a.end,new pu(t,0,0),r.length,!0));let o=0;for(let e=0;e<r.length;e++)r[e].type==i&&(o=e+1);let s=r.length-o,l=a.start+r.length-(n?2:0),c=a.parent;for(let r=a.startIndex,n=a.endIndex,i=!0;r<n;r++,i=!1)!i&&Rh(e.doc,l,s)&&(e.split(l,s),l+=2*s),l+=c.child(r).nodeSize}(e,a,s,i,r);return!0}(s,o,e,a)&&(n&&n(s.scrollIntoView()),!0)}}function gf(e){return function(a,r){let{$from:n,$to:i}=a.selection,t=n.blockRange(i,(a=>a.childCount>0&&a.firstChild.type==e));return!!t&&(!r||(n.node(t.depth-1).type==e?function(e,a,r,n){let i=e.tr,t=n.end,o=n.$to.end(n.depth);t<o&&(i.step(new Mh(t-1,o,t,o,new pu(cu.from(r.create(null,n.parent.copy())),1,0),1,!0)),n=new Mu(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const s=Nh(n);if(null==s)return!1;i.lift(n,s);let l=i.mapping.map(t,-1)-1;Lh(i.doc,l)&&i.join(l);return a(i.scrollIntoView()),!0}(a,r,e,t):function(e,a,r){let n=e.tr,i=r.parent;for(let e=r.end,a=r.endIndex-1,t=r.startIndex;a>t;a--)e-=i.child(a).nodeSize,n.delete(e-1,e+1);let t=n.doc.resolve(r.start),o=t.nodeAfter;if(n.mapping.map(r.end)!=r.start+t.nodeAfter.nodeSize)return!1;let s=0==r.startIndex,l=r.endIndex==i.childCount,c=t.node(-1),d=t.index(-1);if(!c.canReplace(d+(s?0:1),d+1,o.content.append(l?cu.empty:cu.from(i))))return!1;let u=t.pos,h=u+o.nodeSize;return n.step(new Mh(u-(s?1:0),h+(l?1:0),u+1,h-1,new pu((s?cu.empty:cu.from(i.copy(cu.empty))).append(l?cu.empty:cu.from(i.copy(cu.empty))),s?0:1,l?0:1),s?0:1)),a(n.scrollIntoView()),!0}(a,r,t)))}}function pf(e){const{state:a,transaction:r}=e;let{selection:n}=r,{doc:i}=r,{storedMarks:t}=r;return{...a,apply:a.apply.bind(a),applyTransaction:a.applyTransaction.bind(a),plugins:a.plugins,schema:a.schema,reconfigure:a.reconfigure.bind(a),toJSON:a.toJSON.bind(a),get storedMarks(){return t},get selection(){return n},get doc(){return i},get tr(){return n=r.selection,i=r.doc,t=r.storedMarks,r}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class bf{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:a,state:r}=this,{view:n}=a,{tr:i}=r,t=this.buildProps(i);return Object.fromEntries(Object.entries(e).map((([e,a])=>[e,(...e)=>{const r=a(...e)(t);return i.getMeta("preventDispatch")||this.hasCustomState||n.dispatch(i),r}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,a=!0){const{rawCommands:r,editor:n,state:i}=this,{view:t}=n,o=[],s=!!e,l=e||i.tr,c={...Object.fromEntries(Object.entries(r).map((([e,r])=>[e,(...e)=>{const n=this.buildProps(l,a),i=r(...e)(n);return o.push(i),c}]))),run:()=>(s||!a||l.getMeta("preventDispatch")||this.hasCustomState||t.dispatch(l),o.every((e=>!0===e)))};return c}createCan(e){const{rawCommands:a,state:r}=this,n=!1,i=e||r.tr,t=this.buildProps(i,n),o=Object.fromEntries(Object.entries(a).map((([e,a])=>[e,(...e)=>a(...e)({...t,dispatch:void 0})])));return{...o,chain:()=>this.createChain(i,n)}}buildProps(e,a=!0){const{rawCommands:r,editor:n,state:i}=this,{view:t}=n,o={tr:e,editor:n,view:t,state:pf({state:i,transaction:e}),dispatch:a?()=>{}:void 0,chain:()=>this.createChain(e,a),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map((([e,a])=>[e,(...e)=>a(...e)(o)])))}};return o}}class ff{constructor(){this.callbacks={}}on(e,a){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(a),this}emit(e,...a){const r=this.callbacks[e];return r&&r.forEach((e=>e.apply(this,a))),this}off(e,a){const r=this.callbacks[e];return r&&(a?this.callbacks[e]=r.filter((e=>e!==a)):delete this.callbacks[e]),this}once(e,a){const r=(...n)=>{this.off(e,r),a.apply(this,n)};return this.on(e,r)}removeAllListeners(){this.callbacks={}}}function kf(e,a,r){if(void 0===e.config[a]&&e.parent)return kf(e.parent,a,r);if("function"==typeof e.config[a]){return e.config[a].bind({...r,parent:e.parent?kf(e.parent,a,r):null})}return e.config[a]}function yf(e){return{baseExtensions:e.filter((e=>"extension"===e.type)),nodeExtensions:e.filter((e=>"node"===e.type)),markExtensions:e.filter((e=>"mark"===e.type))}}function vf(e){const a=[],{nodeExtensions:r,markExtensions:n}=yf(e),i=[...r,...n],t={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach((e=>{const r=kf(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:i});if(!r)return;r().forEach((e=>{e.types.forEach((r=>{Object.entries(e.attributes).forEach((([e,n])=>{a.push({type:r,name:e,attribute:{...t,...n}})}))}))}))})),i.forEach((e=>{const r={name:e.name,options:e.options,storage:e.storage},n=kf(e,"addAttributes",r);if(!n)return;const i=n();Object.entries(i).forEach((([r,n])=>{const i={...t,...n};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&void 0===(null==i?void 0:i.default)&&delete i.default,a.push({type:e.name,name:r,attribute:i})}))})),a}function wf(e,a){if("string"==typeof e){if(!a.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return a.nodes[e]}return e}function zf(...e){return e.filter((e=>!!e)).reduce(((e,a)=>{const r={...e};return Object.entries(a).forEach((([e,a])=>{if(r[e])if("class"===e){const n=a?String(a).split(" "):[],i=r[e]?r[e].split(" "):[],t=n.filter((e=>!i.includes(e)));r[e]=[...i,...t].join(" ")}else if("style"===e){const n=a?a.split(";").map((e=>e.trim())).filter(Boolean):[],i=r[e]?r[e].split(";").map((e=>e.trim())).filter(Boolean):[],t=new Map;i.forEach((e=>{const[a,r]=e.split(":").map((e=>e.trim()));t.set(a,r)})),n.forEach((e=>{const[a,r]=e.split(":").map((e=>e.trim()));t.set(a,r)})),r[e]=Array.from(t.entries()).map((([e,a])=>`${e}: ${a}`)).join("; ")}else r[e]=a;else r[e]=a})),r}),{})}function jf(e,a){return a.filter((a=>a.type===e.type.name)).filter((e=>e.attribute.rendered)).map((a=>a.attribute.renderHTML?a.attribute.renderHTML(e.attrs)||{}:{[a.name]:e.attrs[a.name]})).reduce(((e,a)=>zf(e,a)),{})}function xf(e){return"function"==typeof e}function $f(e,a=void 0,...r){return xf(e)?a?e.bind(a)(...r):e(...r):e}function qf(e,a){return"style"in e?e:{...e,getAttrs:r=>{const n=e.getAttrs?e.getAttrs(r):e.attrs;if(!1===n)return!1;const i=a.reduce(((e,a)=>{const n=a.attribute.parseHTML?a.attribute.parseHTML(r):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(r.getAttribute(a.name));return null==n?e:{...e,[a.name]:n}}),{});return{...n,...i}}}}function Cf(e){return Object.fromEntries(Object.entries(e).filter((([e,a])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(a))&&null!=a)))}function Sf(e,a){return a.nodes[e]||a.marks[e]||null}function Of(e,a){return Array.isArray(a)?a.some((a=>("string"==typeof a?a:a.name)===e.name)):a}function Ef(e,a){const r=dh.fromSchema(a).serializeFragment(e),n=document.implementation.createHTMLDocument().createElement("div");return n.appendChild(r),n.innerHTML}function Mf(e){return"[object RegExp]"===Object.prototype.toString.call(e)}class _f{constructor(e){this.find=e.find,this.handler=e.handler}}function Af(e){var a;const{editor:r,from:n,to:i,text:t,rules:o,plugin:s}=e,{view:l}=r;if(l.composing)return!1;const c=l.state.doc.resolve(n);if(c.parent.type.spec.code||(null===(a=c.nodeBefore||c.nodeAfter)||void 0===a?void 0:a.marks.find((e=>e.type.spec.code))))return!1;let d=!1;const u=((e,a=500)=>{let r="";const n=e.parentOffset;return e.parent.nodesBetween(Math.max(0,n-a),n,((e,a,i,t)=>{var o,s;const l=(null===(s=(o=e.type.spec).toText)||void 0===s?void 0:s.call(o,{node:e,pos:a,parent:i,index:t}))||e.textContent||"%leaf%";r+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,n-a))})),r})(c)+t;return o.forEach((e=>{if(d)return;const a=((e,a)=>{if(Mf(a))return a.exec(e);const r=a(e);if(!r)return null;const n=[r.text];return n.index=r.index,n.input=e,n.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),n.push(r.replaceWith)),n})(u,e.find);if(!a)return;const o=l.state.tr,c=pf({state:l.state,transaction:o}),h={from:n-(a[0].length-t.length),to:i},{commands:m,chain:g,can:p}=new bf({editor:r,state:c});null!==e.handler({state:c,range:h,match:a,commands:m,chain:g,can:p})&&o.steps.length&&(o.setMeta(s,{transform:o,from:n,to:i,text:t}),l.dispatch(o),d=!0)})),d}function Df(e){const{editor:a,rules:r}=e,n=new $m({state:{init:()=>null,apply(e,i,t){const o=e.getMeta(n);if(o)return o;const s=e.getMeta("applyInputRules");return!!s&&setTimeout((()=>{let{text:e}=s;"string"==typeof e||(e=Ef(cu.from(e),t.schema));const{from:i}=s,o=i+e.length;Af({editor:a,from:i,to:o,text:e,rules:r,plugin:n})})),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,t,o)=>Af({editor:a,from:i,to:t,text:o,rules:r,plugin:n}),handleDOMEvents:{compositionend:e=>(setTimeout((()=>{const{$cursor:i}=e.state.selection;i&&Af({editor:a,from:i.pos,to:i.pos,text:"",rules:r,plugin:n})})),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;const{$cursor:t}=e.state.selection;return!!t&&Af({editor:a,from:t.pos,to:t.pos,text:"\n",rules:r,plugin:n})}},isInputRules:!0});return n}function Nf(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&(e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype)}function Tf(e,a){const r={...e};return Nf(e)&&Nf(a)&&Object.keys(a).forEach((n=>{Nf(a[n])&&Nf(e[n])?r[n]=Tf(e[n],a[n]):r[n]=a[n]})),r}class If{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=$f(kf(this,"addOptions",{name:this.name}))),this.storage=$f(kf(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new If(e)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>Tf(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(e={}){const a=new If(e);return a.parent=this,this.child=a,a.name=e.name?e.name:a.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${a.name}".`),a.options=$f(kf(a,"addOptions",{name:a.name})),a.storage=$f(kf(a,"addStorage",{name:a.name,options:a.options})),a}static handleExit({editor:e,mark:a}){const{tr:r}=e.state,n=e.state.selection.$from;if(n.pos===n.end()){const i=n.marks();if(!!!i.find((e=>(null==e?void 0:e.type.name)===a.name)))return!1;const t=i.find((e=>(null==e?void 0:e.type.name)===a.name));return t&&r.removeStoredMark(t),r.insertText(" ",n.pos),e.view.dispatch(r),!0}return!1}}class Ff{constructor(e){this.find=e.find,this.handler=e.handler}}function Pf(e){const{editor:a,state:r,from:n,to:i,rule:t,pasteEvent:o,dropEvent:s}=e,{commands:l,chain:c,can:d}=new bf({editor:a,state:r}),u=[];r.doc.nodesBetween(n,i,((e,a)=>{if(!e.isTextblock||e.type.spec.code)return;const h=Math.max(n,a),m=Math.min(i,a+e.content.size),g=((e,a,r)=>{if(Mf(a))return[...e.matchAll(a)];const n=a(e,r);return n?n.map((a=>{const r=[a.text];return r.index=a.index,r.input=e,r.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),r.push(a.replaceWith)),r})):[]})(e.textBetween(h-a,m-a,void 0,""),t.find,o);g.forEach((e=>{if(void 0===e.index)return;const a=h+e.index+1,n=a+e[0].length,i={from:r.tr.mapping.map(a),to:r.tr.mapping.map(n)},m=t.handler({state:r,range:i,match:e,commands:l,chain:c,can:d,pasteEvent:o,dropEvent:s});u.push(m)}))}));const h=u.every((e=>null!==e));return h}let Rf=null;function Lf(e){const{editor:a,rules:r}=e;let n,i=null,t=!1,o=!1,s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}const l=({state:e,from:r,to:i,rule:t,pasteEvt:o})=>{const l=e.tr,c=pf({state:e,transaction:l});if(Pf({editor:a,state:c,from:Math.max(r-1,0),to:i.b-1,rule:t,pasteEvent:o,dropEvent:n})&&l.steps.length){try{n="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{n=null}return s="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}},c=r.map((e=>new $m({view(e){const r=r=>{var n;i=(null===(n=e.dom.parentElement)||void 0===n?void 0:n.contains(r.target))?e.dom.parentElement:null,i&&(Rf=a)},n=()=>{Rf&&(Rf=null)};return window.addEventListener("dragstart",r),window.addEventListener("dragend",n),{destroy(){window.removeEventListener("dragstart",r),window.removeEventListener("dragend",n)}}},props:{handleDOMEvents:{drop:(e,a)=>{if(o=i===e.dom.parentElement,n=a,!o){const e=Rf;e&&setTimeout((()=>{const a=e.state.selection;a&&e.commands.deleteRange({from:a.from,to:a.to})}),10)}return!1},paste:(e,a)=>{var r;const n=null===(r=a.clipboardData)||void 0===r?void 0:r.getData("text/html");return s=a,t=!!(null==n?void 0:n.includes("data-pm-slice")),!1}}},appendTransaction:(a,r,n)=>{const i=a[0],c="paste"===i.getMeta("uiEvent")&&!t,d="drop"===i.getMeta("uiEvent")&&!o,u=i.getMeta("applyPasteRules"),h=!!u;if(!c&&!d&&!h)return;if(h){let{text:a}=u;"string"==typeof a||(a=Ef(cu.from(a),n.schema));const{from:r}=u,i=r+a.length,t=(e=>{var a;const r=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(a=r.clipboardData)||void 0===a||a.setData("text/html",e),r})(a);return l({rule:e,state:n,from:r,to:{b:i},pasteEvt:t})}const m=r.doc.content.findDiffStart(n.doc.content),g=r.doc.content.findDiffEnd(n.doc.content);return"number"==typeof m&&g&&m!==g.b?l({rule:e,state:n,from:m,to:g,pasteEvt:s}):void 0}})));return c}class Bf{constructor(e,a){this.splittableMarks=[],this.editor=a,this.extensions=Bf.resolve(e),this.schema=function(e,a){var r;const n=vf(e),{nodeExtensions:i,markExtensions:t}=yf(e),o=null===(r=i.find((e=>kf(e,"topNode"))))||void 0===r?void 0:r.name,s=Object.fromEntries(i.map((r=>{const i=n.filter((e=>e.type===r.name)),t={name:r.name,options:r.options,storage:r.storage,editor:a},o=Cf({...e.reduce(((e,a)=>{const n=kf(a,"extendNodeSchema",t);return{...e,...n?n(r):{}}}),{}),content:$f(kf(r,"content",t)),marks:$f(kf(r,"marks",t)),group:$f(kf(r,"group",t)),inline:$f(kf(r,"inline",t)),atom:$f(kf(r,"atom",t)),selectable:$f(kf(r,"selectable",t)),draggable:$f(kf(r,"draggable",t)),code:$f(kf(r,"code",t)),whitespace:$f(kf(r,"whitespace",t)),linebreakReplacement:$f(kf(r,"linebreakReplacement",t)),defining:$f(kf(r,"defining",t)),isolating:$f(kf(r,"isolating",t)),attrs:Object.fromEntries(i.map((e=>{var a;return[e.name,{default:null===(a=null==e?void 0:e.attribute)||void 0===a?void 0:a.default}]})))}),s=$f(kf(r,"parseHTML",t));s&&(o.parseDOM=s.map((e=>qf(e,i))));const l=kf(r,"renderHTML",t);l&&(o.toDOM=e=>l({node:e,HTMLAttributes:jf(e,i)}));const c=kf(r,"renderText",t);return c&&(o.toText=c),[r.name,o]}))),l=Object.fromEntries(t.map((r=>{const i=n.filter((e=>e.type===r.name)),t={name:r.name,options:r.options,storage:r.storage,editor:a},o=Cf({...e.reduce(((e,a)=>{const n=kf(a,"extendMarkSchema",t);return{...e,...n?n(r):{}}}),{}),inclusive:$f(kf(r,"inclusive",t)),excludes:$f(kf(r,"excludes",t)),group:$f(kf(r,"group",t)),spanning:$f(kf(r,"spanning",t)),code:$f(kf(r,"code",t)),attrs:Object.fromEntries(i.map((e=>{var a;return[e.name,{default:null===(a=null==e?void 0:e.attribute)||void 0===a?void 0:a.default}]})))}),s=$f(kf(r,"parseHTML",t));s&&(o.parseDOM=s.map((e=>qf(e,i))));const l=kf(r,"renderHTML",t);return l&&(o.toDOM=e=>l({mark:e,HTMLAttributes:jf(e,i)})),[r.name,o]})));return new Xu({topNode:o,nodes:s,marks:l})}(this.extensions,a),this.setupExtensions()}static resolve(e){const a=Bf.sort(Bf.flatten(e)),r=function(e){const a=e.filter(((a,r)=>e.indexOf(a)!==r));return Array.from(new Set(a))}(a.map((e=>e.name)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map((e=>`'${e}'`)).join(", ")}]. This can lead to issues.`),a}static flatten(e){return e.map((e=>{const a=kf(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return a?[e,...this.flatten(a())]:e})).flat(10)}static sort(e){return e.sort(((e,a)=>{const r=kf(e,"priority")||100,n=kf(a,"priority")||100;return r>n?-1:r<n?1:0}))}get commands(){return this.extensions.reduce(((e,a)=>{const r=kf(a,"addCommands",{name:a.name,options:a.options,storage:a.storage,editor:this.editor,type:Sf(a.name,this.schema)});return r?{...e,...r()}:e}),{})}get plugins(){const{editor:e}=this,a=Bf.sort([...this.extensions].reverse()),r=[],n=[],i=a.map((a=>{const i={name:a.name,options:a.options,storage:a.storage,editor:e,type:Sf(a.name,this.schema)},t=[],o=kf(a,"addKeyboardShortcuts",i);let s={};if("mark"===a.type&&kf(a,"exitable",i)&&(s.ArrowRight=()=>If.handleExit({editor:e,mark:a})),o){const a=Object.fromEntries(Object.entries(o()).map((([a,r])=>[a,()=>r({editor:e})])));s={...s,...a}}const l=new $m({props:{handleKeyDown:Qb(s)}});t.push(l);const c=kf(a,"addInputRules",i);Of(a,e.options.enableInputRules)&&c&&r.push(...c());const d=kf(a,"addPasteRules",i);Of(a,e.options.enablePasteRules)&&d&&n.push(...d());const u=kf(a,"addProseMirrorPlugins",i);if(u){const e=u();t.push(...e)}return t})).flat();return[Df({editor:e,rules:r}),...Lf({editor:e,rules:n}),...i]}get attributes(){return vf(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:a}=yf(this.extensions);return Object.fromEntries(a.filter((e=>!!kf(e,"addNodeView"))).map((a=>{const r=this.attributes.filter((e=>e.type===a.name)),n={name:a.name,options:a.options,storage:a.storage,editor:e,type:wf(a.name,this.schema)},i=kf(a,"addNodeView",n);if(!i)return[];return[a.name,(n,t,o,s,l)=>{const c=jf(n,r);return i()({node:n,view:t,getPos:o,decorations:s,innerDecorations:l,editor:e,extension:a,HTMLAttributes:c})}]})))}setupExtensions(){this.extensions.forEach((e=>{var a;this.editor.extensionStorage[e.name]=e.storage;const r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Sf(e.name,this.schema)};if("mark"===e.type){(null===(a=$f(kf(e,"keepOnSplit",r)))||void 0===a||a)&&this.splittableMarks.push(e.name)}const n=kf(e,"onBeforeCreate",r),i=kf(e,"onCreate",r),t=kf(e,"onUpdate",r),o=kf(e,"onSelectionUpdate",r),s=kf(e,"onTransaction",r),l=kf(e,"onFocus",r),c=kf(e,"onBlur",r),d=kf(e,"onDestroy",r);n&&this.editor.on("beforeCreate",n),i&&this.editor.on("create",i),t&&this.editor.on("update",t),o&&this.editor.on("selectionUpdate",o),s&&this.editor.on("transaction",s),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}}class Vf{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=$f(kf(this,"addOptions",{name:this.name}))),this.storage=$f(kf(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Vf(e)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>Tf(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(e={}){const a=new Vf({...this.config,...e});return a.parent=this,this.child=a,a.name=e.name?e.name:a.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${a.name}".`),a.options=$f(kf(a,"addOptions",{name:a.name})),a.storage=$f(kf(a,"addStorage",{name:a.name,options:a.options})),a}}function Hf(e,a,r){const{from:n,to:i}=a,{blockSeparator:t="\n\n",textSerializers:o={}}=r||{};let s="";return e.nodesBetween(n,i,((e,r,l,c)=>{var d;e.isBlock&&r>n&&(s+=t);const u=null==o?void 0:o[e.type.name];if(u)return l&&(s+=u({node:e,pos:r,parent:l,index:c,range:a})),!1;e.isText&&(s+=null===(d=null==e?void 0:e.text)||void 0===d?void 0:d.slice(Math.max(n,r)-r,i-r))})),s}function Wf(e){return Object.fromEntries(Object.entries(e.nodes).filter((([,e])=>e.spec.toText)).map((([e,a])=>[e,a.spec.toText])))}const Uf=Vf.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new $m({key:new Sm("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:a,schema:r}=e,{doc:n,selection:i}=a,{ranges:t}=i,o=Math.min(...t.map((e=>e.$from.pos))),s=Math.max(...t.map((e=>e.$to.pos))),l=Wf(r);return Hf(n,{from:o,to:s},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});function Gf(e,a,r={strict:!0}){const n=Object.keys(a);return!n.length||n.every((n=>r.strict?a[n]===e[n]:Mf(a[n])?a[n].test(e[n]):a[n]===e[n]))}function Kf(e,a,r={}){return e.find((e=>e.type===a&&Gf(Object.fromEntries(Object.keys(r).map((a=>[a,e.attrs[a]]))),r)))}function Zf(e,a,r={}){return!!Kf(e,a,r)}function Jf(e,a,r){var n;if(!e||!a)return;let i=e.parent.childAfter(e.parentOffset);if(i.node&&i.node.marks.some((e=>e.type===a))||(i=e.parent.childBefore(e.parentOffset)),!i.node||!i.node.marks.some((e=>e.type===a)))return;r=r||(null===(n=i.node.marks[0])||void 0===n?void 0:n.attrs);if(!Kf([...i.node.marks],a,r))return;let t=i.index,o=e.start()+i.offset,s=t+1,l=o+i.node.nodeSize;for(;t>0&&Zf([...e.parent.child(t-1).marks],a,r);)t-=1,o-=e.parent.child(t).nodeSize;for(;s<e.parent.childCount&&Zf([...e.parent.child(s).marks],a,r);)l+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:l}}function Yf(e,a){if("string"==typeof e){if(!a.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return a.marks[e]}return e}function Xf(e){return e instanceof dm}function Qf(e=0,a=0,r=0){return Math.min(Math.max(e,a),r)}function ek(e,a=null){if(!a)return null;const r=om.atStart(e),n=om.atEnd(e);if("start"===a||!0===a)return r;if("end"===a)return n;const i=r.from,t=n.to;return"all"===a?dm.create(e,Qf(0,i,t),Qf(e.content.size,i,t)):dm.create(e,Qf(a,i,t),Qf(a,i,t))}const ak=e=>{const a=e.childNodes;for(let r=a.length-1;r>=0;r-=1){const n=a[r];3===n.nodeType&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?e.removeChild(n):1===n.nodeType&&ak(n)}return e};function rk(e){const a=`<body>${e}</body>`,r=(new window.DOMParser).parseFromString(a,"text/html").body;return ak(r)}function nk(e,a,r){if(e instanceof Au||e instanceof cu)return e;r={slice:!0,parseOptions:{},...r};const n="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return cu.fromArray(e.map((e=>a.nodeFromJSON(e))));const n=a.nodeFromJSON(e);return r.errorOnInvalidContent&&n.check(),n}catch(n){if(r.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:n});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",n),nk("",a,r)}if(n){if(r.errorOnInvalidContent){let n=!1,i="";const t=new Xu({topNode:a.spec.topNode,marks:a.spec.marks,nodes:a.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(n=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(r.slice?eh.fromSchema(t).parseSlice(rk(e),r.parseOptions):eh.fromSchema(t).parse(rk(e),r.parseOptions),r.errorOnInvalidContent&&n)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const n=eh.fromSchema(a);return r.slice?n.parseSlice(rk(e),r.parseOptions).content:n.parse(rk(e),r.parseOptions)}return nk("",a,r)}function ik(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function tk(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function ok(e,a,r={}){const{from:n,to:i,empty:t}=e.selection,o=a?wf(a,e.schema):null,s=[];e.doc.nodesBetween(n,i,((e,a)=>{if(e.isText)return;const r=Math.max(n,a),t=Math.min(i,a+e.nodeSize);s.push({node:e,from:r,to:t})}));const l=i-n,c=s.filter((e=>!o||o.name===e.node.type.name)).filter((e=>Gf(e.node.attrs,r,{strict:!1})));if(t)return!!c.length;return c.reduce(((e,a)=>e+a.to-a.from),0)>=l}function sk(e,a){return a.nodes[e]?"node":a.marks[e]?"mark":null}function lk(e,a){const r="string"==typeof a?[a]:a;return Object.keys(e).reduce(((a,n)=>(r.includes(n)||(a[n]=e[n]),a)),{})}function ck(e,a,r={},n={}){return nk(e,a,{slice:!1,parseOptions:r,errorOnInvalidContent:n.errorOnInvalidContent})}function dk(e,a){const r=Yf(a,e.schema),{from:n,to:i,empty:t}=e.selection,o=[];t?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(n,i,(e=>{o.push(...e.marks)}));const s=o.find((e=>e.type.name===r.name));return s?{...s.attrs}:{}}function uk(e){return a=>function(e,a){for(let r=e.depth;r>0;r-=1){const n=e.node(r);if(a(n))return{pos:r>0?e.before(r):0,start:e.start(r),depth:r,node:n}}}(a.$from,e)}function hk(e,a){const r=sk("string"==typeof a?a:a.name,e.schema);return"node"===r?function(e,a){const r=wf(a,e.schema),{from:n,to:i}=e.selection,t=[];e.doc.nodesBetween(n,i,(e=>{t.push(e)}));const o=t.reverse().find((e=>e.type.name===r.name));return o?{...o.attrs}:{}}(e,a):"mark"===r?dk(e,a):{}}function mk(e,a,r){const n=[];return e===a?r.resolve(e).marks().forEach((a=>{const i=Jf(r.resolve(e),a.type);i&&n.push({mark:a,...i})})):r.nodesBetween(e,a,((e,a)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&n.push(...e.marks.map((r=>({from:a,to:a+e.nodeSize,mark:r}))))})),n}function gk(e,a,r){return Object.fromEntries(Object.entries(r).filter((([r])=>{const n=e.find((e=>e.type===a&&e.name===r));return!!n&&n.attribute.keepOnSplit})))}function pk(e,a,r={}){const{empty:n,ranges:i}=e.selection,t=a?Yf(a,e.schema):null;if(n)return!!(e.storedMarks||e.selection.$from.marks()).filter((e=>!t||t.name===e.type.name)).find((e=>Gf(e.attrs,r,{strict:!1})));let o=0;const s=[];if(i.forEach((({$from:a,$to:r})=>{const n=a.pos,i=r.pos;e.doc.nodesBetween(n,i,((e,a)=>{if(!e.isText&&!e.marks.length)return;const r=Math.max(n,a),t=Math.min(i,a+e.nodeSize);o+=t-r,s.push(...e.marks.map((e=>({mark:e,from:r,to:t}))))}))})),0===o)return!1;const l=s.filter((e=>!t||t.name===e.mark.type.name)).filter((e=>Gf(e.mark.attrs,r,{strict:!1}))).reduce(((e,a)=>e+a.to-a.from),0),c=s.filter((e=>!t||e.mark.type!==t&&e.mark.type.excludes(t))).reduce(((e,a)=>e+a.to-a.from),0);return(l>0?l+c:l)>=o}function bk(e,a){const{nodeExtensions:r}=yf(a),n=r.find((a=>a.name===e));if(!n)return!1;const i=$f(kf(n,"group",{name:n.name,options:n.options,storage:n.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function fk(e,{checkChildren:a=!0,ignoreWhitespace:r=!1}={}){var n;if(r){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!==(n=e.text)&&void 0!==n?n:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(a){let n=!0;return e.content.forEach((e=>{!1!==n&&(fk(e,{ignoreWhitespace:r,checkChildren:a})||(n=!1))})),n}return!1}function kk(e,a){const r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(r){const n=r.filter((e=>null==a?void 0:a.includes(e.type.name)));e.tr.ensureMarks(n)}}const yk=(e,a)=>{const r=uk((e=>e.type===a))(e.selection);if(!r)return!0;const n=e.doc.resolve(Math.max(0,r.pos-1)).before(r.depth);if(void 0===n)return!0;const i=e.doc.nodeAt(n);return r.node.type!==(null==i?void 0:i.type)||!Lh(e.doc,r.pos)||(e.join(r.pos),!0)},vk=(e,a)=>{const r=uk((e=>e.type===a))(e.selection);if(!r)return!0;const n=e.doc.resolve(r.start).after(r.depth);if(void 0===n)return!0;const i=e.doc.nodeAt(n);return r.node.type!==(null==i?void 0:i.type)||!Lh(e.doc,n)||(e.join(n),!0)};var wk=Object.freeze({__proto__:null,blur:()=>({editor:e,view:a})=>(requestAnimationFrame((()=>{var r;e.isDestroyed||(a.dom.blur(),null===(r=null===window||void 0===window?void 0:window.getSelection())||void 0===r||r.removeAllRanges())})),!0),clearContent:(e=!1)=>({commands:a})=>a.setContent("",e),clearNodes:()=>({state:e,tr:a,dispatch:r})=>{const{selection:n}=a,{ranges:i}=n;return!r||(i.forEach((({$from:r,$to:n})=>{e.doc.nodesBetween(r.pos,n.pos,((e,r)=>{if(e.type.isText)return;const{doc:n,mapping:i}=a,t=n.resolve(i.map(r)),o=n.resolve(i.map(r+e.nodeSize)),s=t.blockRange(o);if(!s)return;const l=Nh(s);if(e.type.isTextblock){const{defaultType:e}=t.parent.contentMatchAt(t.index());a.setNodeMarkup(s.start,e)}(l||0===l)&&a.lift(s,l)}))})),!0)},command:e=>a=>e(a),createParagraphNear:()=>({state:e,dispatch:a})=>((e,a)=>{let r=e.selection,{$from:n,$to:i}=r;if(r instanceof gm||n.parent.inlineContent||i.parent.inlineContent)return!1;let t=sf(i.parent.contentMatchAt(i.indexAfter()));if(!t||!t.isTextblock)return!1;if(a){let r=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,o=e.tr.insert(r,t.createAndFill());o.setSelection(dm.create(o.doc,r+1)),a(o.scrollIntoView())}return!0})(e,a),cut:(e,a)=>({editor:r,tr:n})=>{const{state:i}=r,t=i.doc.slice(e.from,e.to);n.deleteRange(e.from,e.to);const o=n.mapping.map(a);return n.insert(o,t.content),n.setSelection(new dm(n.doc.resolve(o-1))),!0},deleteCurrentNode:()=>({tr:e,dispatch:a})=>{const{selection:r}=e,n=r.$anchor.node();if(n.content.size>0)return!1;const i=e.selection.$anchor;for(let r=i.depth;r>0;r-=1){if(i.node(r).type===n.type){if(a){const a=i.before(r),n=i.after(r);e.delete(a,n).scrollIntoView()}return!0}}return!1},deleteNode:e=>({tr:a,state:r,dispatch:n})=>{const i=wf(e,r.schema),t=a.selection.$anchor;for(let e=t.depth;e>0;e-=1){if(t.node(e).type===i){if(n){const r=t.before(e),n=t.after(e);a.delete(r,n).scrollIntoView()}return!0}}return!1},deleteRange:e=>({tr:a,dispatch:r})=>{const{from:n,to:i}=e;return r&&a.delete(n,i),!0},deleteSelection:()=>({state:e,dispatch:a})=>((e,a)=>!e.selection.empty&&(a&&a(e.tr.deleteSelection().scrollIntoView()),!0))(e,a),enter:()=>({commands:e})=>e.keyboardShortcut("Enter"),exitCode:()=>({state:e,dispatch:a})=>((e,a)=>{let{$head:r,$anchor:n}=e.selection;if(!r.parent.type.spec.code||!r.sameParent(n))return!1;let i=r.node(-1),t=r.indexAfter(-1),o=sf(i.contentMatchAt(t));if(!o||!i.canReplaceWith(t,t,o))return!1;if(a){let n=r.after(),i=e.tr.replaceWith(n,n,o.createAndFill());i.setSelection(om.near(i.doc.resolve(n),1)),a(i.scrollIntoView())}return!0})(e,a),extendMarkRange:(e,a={})=>({tr:r,state:n,dispatch:i})=>{const t=Yf(e,n.schema),{doc:o,selection:s}=r,{$from:l,from:c,to:d}=s;if(i){const e=Jf(l,t,a);if(e&&e.from<=c&&e.to>=d){const a=dm.create(o,e.from,e.to);r.setSelection(a)}}return!0},first:e=>a=>{const r="function"==typeof e?e(a):e;for(let e=0;e<r.length;e+=1)if(r[e](a))return!0;return!1},focus:(e=null,a={})=>({editor:r,view:n,tr:i,dispatch:t})=>{a={scrollIntoView:!0,...a};const o=()=>{n.dom.focus(),requestAnimationFrame((()=>{r.isDestroyed||(n.focus(),(null==a?void 0:a.scrollIntoView)&&r.commands.scrollIntoView())}))};if(n.hasFocus()&&null===e||!1===e)return!0;if(t&&null===e&&!Xf(r.state.selection))return o(),!0;const s=ek(i.doc,e)||r.state.selection,l=r.state.selection.eq(s);return t&&(l||i.setSelection(s),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},forEach:(e,a)=>r=>e.every(((e,n)=>a(e,{...r,index:n}))),insertContent:(e,a)=>({tr:r,commands:n})=>n.insertContentAt({from:r.selection.from,to:r.selection.to},e,a),insertContentAt:(e,a,r)=>({tr:n,dispatch:i,editor:t})=>{var o;if(i){let i;r={parseOptions:t.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...r};try{i=nk(a,t.schema,{parseOptions:{preserveWhitespace:"full",...r.parseOptions},errorOnInvalidContent:null!==(o=r.errorOnInvalidContent)&&void 0!==o?o:t.options.enableContentCheck})}catch(e){return t.emit("contentError",{editor:t,error:e,disableCollaboration:()=>{t.storage.collaboration&&(t.storage.collaboration.isDisabled=!0)}}),!1}let{from:s,to:l}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},c=!0,d=!0;if(("type"in i?[i]:i).forEach((e=>{e.check(),c=!!c&&(e.isText&&0===e.marks.length),d=!!d&&e.isBlock})),s===l&&d){const{parent:e}=n.doc.resolve(s);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(s-=1,l+=1)}let u;if(c){if(Array.isArray(a))u=a.map((e=>e.text||"")).join("");else if(a instanceof cu){let e="";a.forEach((a=>{a.text&&(e+=a.text)})),u=e}else u="object"==typeof a&&a&&a.text?a.text:a;n.insertText(u,s,l)}else u=i,n.replaceWith(s,l,u);r.updateSelection&&function(e,a,r){const n=e.steps.length-1;if(n<a)return;const i=e.steps[n];if(!(i instanceof Eh||i instanceof Mh))return;const t=e.mapping.maps[n];let o=0;t.forEach(((e,a,r,n)=>{0===o&&(o=n)})),e.setSelection(om.near(e.doc.resolve(o),r))}(n,n.steps.length-1,-1),r.applyInputRules&&n.setMeta("applyInputRules",{from:s,text:u}),r.applyPasteRules&&n.setMeta("applyPasteRules",{from:s,text:u})}return!0},joinBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=ef(e,r);if(!n)return!1;let i=nf(n);if(!i){let r=n.blockRange(),i=r&&Nh(r);return null!=i&&(a&&a(e.tr.lift(r,i).scrollIntoView()),!0)}let t=i.nodeBefore;if(lf(e,i,a,-1))return!0;if(0==n.parent.content.size&&(rf(t,"end")||hm.isSelectable(t)))for(let r=n.depth;;r--){let o=Wh(e.doc,n.before(r),n.after(r),pu.empty);if(o&&o.slice.size<o.to-o.from){if(a){let r=e.tr.step(o);r.setSelection(rf(t,"end")?om.findFrom(r.doc.resolve(r.mapping.map(i.pos,-1)),-1):hm.create(r.doc,i.pos-t.nodeSize)),a(r.scrollIntoView())}return!0}if(1==r||n.node(r-1).childCount>1)break}return!(!t.isAtom||i.depth!=n.depth-1||(a&&a(e.tr.delete(i.pos-t.nodeSize,i.pos).scrollIntoView()),0))})(e,a),joinDown:()=>({state:e,dispatch:a})=>((e,a)=>{let r,n=e.selection;if(n instanceof hm){if(n.node.isTextblock||!Lh(e.doc,n.to))return!1;r=n.to}else if(r=Vh(e.doc,n.to,1),null==r)return!1;return a&&a(e.tr.join(r).scrollIntoView()),!0})(e,a),joinForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=tf(e,r);if(!n)return!1;let i=of(n);if(!i)return!1;let t=i.nodeAfter;if(lf(e,i,a,1))return!0;if(0==n.parent.content.size&&(rf(t,"start")||hm.isSelectable(t))){let r=Wh(e.doc,n.before(),n.after(),pu.empty);if(r&&r.slice.size<r.to-r.from){if(a){let n=e.tr.step(r);n.setSelection(rf(t,"start")?om.findFrom(n.doc.resolve(n.mapping.map(i.pos)),1):hm.create(n.doc,n.mapping.map(i.pos))),a(n.scrollIntoView())}return!0}}return!(!t.isAtom||i.depth!=n.depth-1||(a&&a(e.tr.delete(i.pos,i.pos+t.nodeSize).scrollIntoView()),0))})(e,a),joinItemBackward:()=>({state:e,dispatch:a,tr:r})=>{try{const n=Vh(e.doc,e.selection.$from.pos,-1);return null!=n&&(r.join(n,2),a&&a(r),!0)}catch{return!1}},joinItemForward:()=>({state:e,dispatch:a,tr:r})=>{try{const n=Vh(e.doc,e.selection.$from.pos,1);return null!=n&&(r.join(n,2),a&&a(r),!0)}catch{return!1}},joinTextblockBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=ef(e,r);if(!n)return!1;let i=nf(n);return!!i&&af(e,i,a)})(e,a),joinTextblockForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let n=tf(e,r);if(!n)return!1;let i=of(n);return!!i&&af(e,i,a)})(e,a),joinUp:()=>({state:e,dispatch:a})=>((e,a)=>{let r,n=e.selection,i=n instanceof hm;if(i){if(n.node.isTextblock||!Lh(e.doc,n.from))return!1;r=n.from}else if(r=Vh(e.doc,n.from,-1),null==r)return!1;if(a){let n=e.tr.join(r);i&&n.setSelection(hm.create(n.doc,r-e.doc.resolve(r).nodeBefore.nodeSize)),a(n.scrollIntoView())}return!0})(e,a),keyboardShortcut:e=>({editor:a,view:r,tr:n,dispatch:i})=>{const t=function(e){const a=e.split(/-(?!$)/);let r,n,i,t,o=a[a.length-1];"Space"===o&&(o=" ");for(let e=0;e<a.length-1;e+=1){const o=a[e];if(/^(cmd|meta|m)$/i.test(o))t=!0;else if(/^a(lt)?$/i.test(o))r=!0;else if(/^(c|ctrl|control)$/i.test(o))n=!0;else if(/^s(hift)?$/i.test(o))i=!0;else{if(!/^mod$/i.test(o))throw new Error(`Unrecognized modifier name: ${o}`);ik()||tk()?t=!0:n=!0}}return r&&(o=`Alt-${o}`),n&&(o=`Ctrl-${o}`),t&&(o=`Meta-${o}`),i&&(o=`Shift-${o}`),o}(e).split(/-(?!$)/),o=t.find((e=>!["Alt","Ctrl","Meta","Shift"].includes(e))),s=new KeyboardEvent("keydown",{key:"Space"===o?" ":o,altKey:t.includes("Alt"),ctrlKey:t.includes("Ctrl"),metaKey:t.includes("Meta"),shiftKey:t.includes("Shift"),bubbles:!0,cancelable:!0}),l=a.captureTransaction((()=>{r.someProp("handleKeyDown",(e=>e(r,s)))}));return null==l||l.steps.forEach((e=>{const a=e.map(n.mapping);a&&i&&n.maybeStep(a)})),!0},lift:(e,a={})=>({state:r,dispatch:n})=>!!ok(r,wf(e,r.schema),a)&&((e,a)=>{let{$from:r,$to:n}=e.selection,i=r.blockRange(n),t=i&&Nh(i);return null!=t&&(a&&a(e.tr.lift(i,t).scrollIntoView()),!0)})(r,n),liftEmptyBlock:()=>({state:e,dispatch:a})=>((e,a)=>{let{$cursor:r}=e.selection;if(!r||r.parent.content.size)return!1;if(r.depth>1&&r.after()!=r.end(-1)){let n=r.before();if(Rh(e.doc,n))return a&&a(e.tr.split(n).scrollIntoView()),!0}let n=r.blockRange(),i=n&&Nh(n);return null!=i&&(a&&a(e.tr.lift(n,i).scrollIntoView()),!0)})(e,a),liftListItem:e=>({state:a,dispatch:r})=>gf(wf(e,a.schema))(a,r),newlineInCode:()=>({state:e,dispatch:a})=>((e,a)=>{let{$head:r,$anchor:n}=e.selection;return!(!r.parent.type.spec.code||!r.sameParent(n)||(a&&a(e.tr.insertText("\n").scrollIntoView()),0))})(e,a),resetAttributes:(e,a)=>({tr:r,state:n,dispatch:i})=>{let t=null,o=null;const s=sk("string"==typeof e?e:e.name,n.schema);return!!s&&("node"===s&&(t=wf(e,n.schema)),"mark"===s&&(o=Yf(e,n.schema)),i&&r.selection.ranges.forEach((e=>{n.doc.nodesBetween(e.$from.pos,e.$to.pos,((e,n)=>{t&&t===e.type&&r.setNodeMarkup(n,void 0,lk(e.attrs,a)),o&&e.marks.length&&e.marks.forEach((i=>{o===i.type&&r.addMark(n,n+e.nodeSize,o.create(lk(i.attrs,a)))}))}))})),!0)},scrollIntoView:()=>({tr:e,dispatch:a})=>(a&&e.scrollIntoView(),!0),selectAll:()=>({tr:e,dispatch:a})=>{if(a){const a=new gm(e.doc);e.setSelection(a)}return!0},selectNodeBackward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let{$head:n,empty:i}=e.selection,t=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("backward",e):n.parentOffset>0)return!1;t=nf(n)}let o=t&&t.nodeBefore;return!(!o||!hm.isSelectable(o)||(a&&a(e.tr.setSelection(hm.create(e.doc,t.pos-o.nodeSize)).scrollIntoView()),0))})(e,a),selectNodeForward:()=>({state:e,dispatch:a})=>((e,a,r)=>{let{$head:n,empty:i}=e.selection,t=n;if(!i)return!1;if(n.parent.isTextblock){if(r?!r.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)return!1;t=of(n)}let o=t&&t.nodeAfter;return!(!o||!hm.isSelectable(o)||(a&&a(e.tr.setSelection(hm.create(e.doc,t.pos)).scrollIntoView()),0))})(e,a),selectParentNode:()=>({state:e,dispatch:a})=>((e,a)=>{let r,{$from:n,to:i}=e.selection,t=n.sharedDepth(i);return 0!=t&&(r=n.before(t),a&&a(e.tr.setSelection(hm.create(e.doc,r))),!0)})(e,a),selectTextblockEnd:()=>({state:e,dispatch:a})=>uf(e,a),selectTextblockStart:()=>({state:e,dispatch:a})=>df(e,a),setContent:(e,a=!1,r={},n={})=>({editor:i,tr:t,dispatch:o,commands:s})=>{var l,c;const{doc:d}=t;if("full"!==r.preserveWhitespace){const s=ck(e,i.schema,r,{errorOnInvalidContent:null!==(l=n.errorOnInvalidContent)&&void 0!==l?l:i.options.enableContentCheck});return o&&t.replaceWith(0,d.content.size,s).setMeta("preventUpdate",!a),!0}return o&&t.setMeta("preventUpdate",!a),s.insertContentAt({from:0,to:d.content.size},e,{parseOptions:r,errorOnInvalidContent:null!==(c=n.errorOnInvalidContent)&&void 0!==c?c:i.options.enableContentCheck})},setMark:(e,a={})=>({tr:r,state:n,dispatch:i})=>{const{selection:t}=r,{empty:o,ranges:s}=t,l=Yf(e,n.schema);if(i)if(o){const e=dk(n,l);r.addStoredMark(l.create({...e,...a}))}else s.forEach((e=>{const i=e.$from.pos,t=e.$to.pos;n.doc.nodesBetween(i,t,((e,n)=>{const o=Math.max(n,i),s=Math.min(n+e.nodeSize,t);e.marks.find((e=>e.type===l))?e.marks.forEach((e=>{l===e.type&&r.addMark(o,s,l.create({...e.attrs,...a}))})):r.addMark(o,s,l.create(a))}))}));return function(e,a,r){var n;const{selection:i}=a;let t=null;if(Xf(i)&&(t=i.$cursor),t){const a=null!==(n=e.storedMarks)&&void 0!==n?n:t.marks();return!!r.isInSet(a)||!a.some((e=>e.type.excludes(r)))}const{ranges:o}=i;return o.some((({$from:a,$to:n})=>{let i=0===a.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(r);return e.doc.nodesBetween(a.pos,n.pos,((e,a,n)=>{if(i)return!1;if(e.isInline){const a=!n||n.type.allowsMarkType(r),t=!!r.isInSet(e.marks)||!e.marks.some((e=>e.type.excludes(r)));i=a&&t}return!i})),i}))}(n,r,l)},setMeta:(e,a)=>({tr:r})=>(r.setMeta(e,a),!0),setNode:(e,a={})=>({state:r,dispatch:n,chain:i})=>{const t=wf(e,r.schema);let o;return r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),t.isTextblock?i().command((({commands:e})=>!!hf(t,{...o,...a})(r)||e.clearNodes())).command((({state:e})=>hf(t,{...o,...a})(e,n))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:e=>({tr:a,dispatch:r})=>{if(r){const{doc:r}=a,n=Qf(e,0,r.content.size),i=hm.create(r,n);a.setSelection(i)}return!0},setTextSelection:e=>({tr:a,dispatch:r})=>{if(r){const{doc:r}=a,{from:n,to:i}="number"==typeof e?{from:e,to:e}:e,t=dm.atStart(r).from,o=dm.atEnd(r).to,s=Qf(n,t,o),l=Qf(i,t,o),c=dm.create(r,s,l);a.setSelection(c)}return!0},sinkListItem:e=>({state:a,dispatch:r})=>{const n=wf(e,a.schema);return(i=n,function(e,a){let{$from:r,$to:n}=e.selection,t=r.blockRange(n,(e=>e.childCount>0&&e.firstChild.type==i));if(!t)return!1;let o=t.startIndex;if(0==o)return!1;let s=t.parent,l=s.child(o-1);if(l.type!=i)return!1;if(a){let r=l.lastChild&&l.lastChild.type==s.type,n=cu.from(r?i.create():null),o=new pu(cu.from(i.create(null,cu.from(s.type.create(null,n)))),r?3:1,0),c=t.start,d=t.end;a(e.tr.step(new Mh(c-(r?3:1),d,c,d,o,1,!0)).scrollIntoView())}return!0})(a,r);var i},splitBlock:({keepMarks:e=!0}={})=>({tr:a,state:r,dispatch:n,editor:i})=>{const{selection:t,doc:o}=a,{$from:s,$to:l}=t,c=gk(i.extensionManager.attributes,s.node().type.name,s.node().attrs);if(t instanceof hm&&t.node.isBlock)return!(!s.parentOffset||!Rh(o,s.pos))&&(n&&(e&&kk(r,i.extensionManager.splittableMarks),a.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,u=0===s.depth?void 0:function(e){for(let a=0;a<e.edgeCount;a+=1){const{type:r}=e.edge(a);if(r.isTextblock&&!r.hasRequiredAttrs())return r}return null}(s.node(-1).contentMatchAt(s.indexAfter(-1)));let h=d&&u?[{type:u,attrs:c}]:void 0,m=Rh(a.doc,a.mapping.map(s.pos),1,h);if(h||m||!Rh(a.doc,a.mapping.map(s.pos),1,u?[{type:u}]:void 0)||(m=!0,h=u?[{type:u,attrs:c}]:void 0),n){if(m&&(t instanceof dm&&a.deleteSelection(),a.split(a.mapping.map(s.pos),1,h),u&&!d&&!s.parentOffset&&s.parent.type!==u)){const e=a.mapping.map(s.before()),r=a.doc.resolve(e);s.node(-1).canReplaceWith(r.index(),r.index()+1,u)&&a.setNodeMarkup(a.mapping.map(s.before()),u)}e&&kk(r,i.extensionManager.splittableMarks),a.scrollIntoView()}return m},splitListItem:(e,a={})=>({tr:r,state:n,dispatch:i,editor:t})=>{var o;const s=wf(e,n.schema),{$from:l,$to:c}=n.selection,d=n.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==s)return!1;const h=t.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let e=cu.empty;const n=l.index(-1)?1:l.index(-2)?2:3;for(let a=l.depth-n;a>=l.depth-3;a-=1)e=cu.from(l.node(a).copy(e));const i=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,t={...gk(h,l.node().type.name,l.node().attrs),...a},c=(null===(o=s.contentMatch.defaultType)||void 0===o?void 0:o.createAndFill(t))||void 0;e=e.append(cu.from(s.createAndFill(null,c)||void 0));const d=l.before(l.depth-(n-1));r.replace(d,l.after(-i),new pu(e,4-n,0));let u=-1;r.doc.nodesBetween(d,r.doc.content.size,((e,a)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=a+1)})),u>-1&&r.setSelection(dm.near(r.doc.resolve(u))),r.scrollIntoView()}return!0}const m=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,g={...gk(h,u.type.name,u.attrs),...a},p={...gk(h,l.node().type.name,l.node().attrs),...a};r.delete(l.pos,c.pos);const b=m?[{type:s,attrs:g},{type:m,attrs:p}]:[{type:s,attrs:g}];if(!Rh(r.doc,l.pos,2))return!1;if(i){const{selection:e,storedMarks:a}=n,{splittableMarks:o}=t.extensionManager,s=a||e.$to.parentOffset&&e.$from.marks();if(r.split(l.pos,2,b).scrollIntoView(),!s||!i)return!0;const c=s.filter((e=>o.includes(e.type.name)));r.ensureMarks(c)}return!0},toggleList:(e,a,r,n={})=>({editor:i,tr:t,state:o,dispatch:s,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,m=wf(e,o.schema),g=wf(a,o.schema),{selection:p,storedMarks:b}=o,{$from:f,$to:k}=p,y=f.blockRange(k),v=b||p.$to.parentOffset&&p.$from.marks();if(!y)return!1;const w=uk((e=>bk(e.type.name,u)))(p);if(y.depth>=1&&w&&y.depth-w.depth<=1){if(w.node.type===m)return c.liftListItem(g);if(bk(w.node.type.name,u)&&m.validContent(w.node.content)&&s)return l().command((()=>(t.setNodeMarkup(w.pos,m),!0))).command((()=>yk(t,m))).command((()=>vk(t,m))).run()}return r&&v&&s?l().command((()=>{const e=d().wrapInList(m,n),a=v.filter((e=>h.includes(e.type.name)));return t.ensureMarks(a),!!e||c.clearNodes()})).wrapInList(m,n).command((()=>yk(t,m))).command((()=>vk(t,m))).run():l().command((()=>!!d().wrapInList(m,n)||c.clearNodes())).wrapInList(m,n).command((()=>yk(t,m))).command((()=>vk(t,m))).run()},toggleMark:(e,a={},r={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:t=!1}=r,o=Yf(e,n.schema);return pk(n,o,a)?i.unsetMark(o,{extendEmptyMarkRange:t}):i.setMark(o,a)},toggleNode:(e,a,r={})=>({state:n,commands:i})=>{const t=wf(e,n.schema),o=wf(a,n.schema),s=ok(n,t,r);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),s?i.setNode(o,l):i.setNode(t,{...l,...r})},toggleWrap:(e,a={})=>({state:r,commands:n})=>{const i=wf(e,r.schema);return ok(r,i,a)?n.lift(i):n.wrapIn(i,a)},undoInputRule:()=>({state:e,dispatch:a})=>{const r=e.plugins;for(let n=0;n<r.length;n+=1){const i=r[n];let t;if(i.spec.isInputRules&&(t=i.getState(e))){if(a){const a=e.tr,r=t.transform;for(let e=r.steps.length-1;e>=0;e-=1)a.step(r.steps[e].invert(r.docs[e]));if(t.text){const r=a.doc.resolve(t.from).marks();a.replaceWith(t.from,t.to,e.schema.text(t.text,r))}else a.delete(t.from,t.to)}return!0}}return!1},unsetAllMarks:()=>({tr:e,dispatch:a})=>{const{selection:r}=e,{empty:n,ranges:i}=r;return n||a&&i.forEach((a=>{e.removeMark(a.$from.pos,a.$to.pos)})),!0},unsetMark:(e,a={})=>({tr:r,state:n,dispatch:i})=>{var t;const{extendEmptyMarkRange:o=!1}=a,{selection:s}=r,l=Yf(e,n.schema),{$from:c,empty:d,ranges:u}=s;if(!i)return!0;if(d&&o){let{from:e,to:a}=s;const n=null===(t=c.marks().find((e=>e.type===l)))||void 0===t?void 0:t.attrs,i=Jf(c,l,n);i&&(e=i.from,a=i.to),r.removeMark(e,a,l)}else u.forEach((e=>{r.removeMark(e.$from.pos,e.$to.pos,l)}));return r.removeStoredMark(l),!0},updateAttributes:(e,a={})=>({tr:r,state:n,dispatch:i})=>{let t=null,o=null;const s=sk("string"==typeof e?e:e.name,n.schema);return!!s&&("node"===s&&(t=wf(e,n.schema)),"mark"===s&&(o=Yf(e,n.schema)),i&&r.selection.ranges.forEach((e=>{const i=e.$from.pos,s=e.$to.pos;let l,c,d,u;r.selection.empty?n.doc.nodesBetween(i,s,((e,a)=>{t&&t===e.type&&(d=Math.max(a,i),u=Math.min(a+e.nodeSize,s),l=a,c=e)})):n.doc.nodesBetween(i,s,((e,n)=>{n<i&&t&&t===e.type&&(d=Math.max(n,i),u=Math.min(n+e.nodeSize,s),l=n,c=e),n>=i&&n<=s&&(t&&t===e.type&&r.setNodeMarkup(n,void 0,{...e.attrs,...a}),o&&e.marks.length&&e.marks.forEach((t=>{if(o===t.type){const l=Math.max(n,i),c=Math.min(n+e.nodeSize,s);r.addMark(l,c,o.create({...t.attrs,...a}))}})))})),c&&(void 0!==l&&r.setNodeMarkup(l,void 0,{...c.attrs,...a}),o&&c.marks.length&&c.marks.forEach((e=>{o===e.type&&r.addMark(d,u,o.create({...e.attrs,...a}))})))})),!0)},wrapIn:(e,a={})=>({state:r,dispatch:n})=>function(e,a=null){return function(r,n){let{$from:i,$to:t}=r.selection,o=i.blockRange(t),s=o&&Th(o,e,a);return!!s&&(n&&n(r.tr.wrap(o,s).scrollIntoView()),!0)}}(wf(e,r.schema),a)(r,n),wrapInList:(e,a={})=>({state:r,dispatch:n})=>mf(wf(e,r.schema),a)(r,n)});const zk=Vf.create({name:"commands",addCommands:()=>({...wk})}),jk=Vf.create({name:"drop",addProseMirrorPlugins(){return[new $m({key:new Sm("tiptapDrop"),props:{handleDrop:(e,a,r,n)=>{this.editor.emit("drop",{editor:this.editor,event:a,slice:r,moved:n})}}})]}}),xk=Vf.create({name:"editable",addProseMirrorPlugins(){return[new $m({key:new Sm("editable"),props:{editable:()=>this.editor.options.editable}})]}}),$k=Vf.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new $m({key:new Sm("focusEvents"),props:{handleDOMEvents:{focus:(a,r)=>{e.isFocused=!0;const n=e.state.tr.setMeta("focus",{event:r}).setMeta("addToHistory",!1);return a.dispatch(n),!1},blur:(a,r)=>{e.isFocused=!1;const n=e.state.tr.setMeta("blur",{event:r}).setMeta("addToHistory",!1);return a.dispatch(n),!1}}}})]}}),qk=Vf.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first((({commands:e})=>[()=>e.undoInputRule(),()=>e.command((({tr:a})=>{const{selection:r,doc:n}=a,{empty:i,$anchor:t}=r,{pos:o,parent:s}=t,l=t.parent.isTextblock&&o>0?a.doc.resolve(o-1):t,c=l.parent.type.spec.isolating,d=t.pos-t.parentOffset,u=c&&1===l.parent.childCount?d===t.pos:om.atStart(n).from===o;return!(!i||!s.type.isTextblock||s.textContent.length||!u||u&&"paragraph"===t.parent.type.name)&&e.clearNodes()})),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()])),a=()=>this.editor.commands.first((({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()])),r={Enter:()=>this.editor.commands.first((({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:a,"Mod-Delete":a,"Mod-a":()=>this.editor.commands.selectAll()},n={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":a,"Ctrl-Alt-Backspace":a,"Alt-Delete":a,"Alt-d":a,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ik()||tk()?i:n},addProseMirrorPlugins(){return[new $m({key:new Sm("clearDocument"),appendTransaction:(e,a,r)=>{const n=e.some((e=>e.docChanged))&&!a.doc.eq(r.doc),i=e.some((e=>e.getMeta("preventClearDocument")));if(!n||i)return;const{empty:t,from:o,to:s}=a.selection,l=om.atStart(a.doc).from,c=om.atEnd(a.doc).to;if(t||!(o===l&&s===c))return;if(!fk(r.doc))return;const d=r.tr,u=pf({state:r,transaction:d}),{commands:h}=new bf({editor:this.editor,state:u});return h.clearNodes(),d.steps.length?d:void 0}})]}}),Ck=Vf.create({name:"paste",addProseMirrorPlugins(){return[new $m({key:new Sm("tiptapPaste"),props:{handlePaste:(e,a,r)=>{this.editor.emit("paste",{editor:this.editor,event:a,slice:r})}}})]}}),Sk=Vf.create({name:"tabindex",addProseMirrorPlugins(){return[new $m({key:new Sm("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Ok=Object.freeze({__proto__:null,ClipboardTextSerializer:Uf,Commands:zk,Drop:jk,Editable:xk,FocusEvents:$k,Keymap:qk,Paste:Ck,Tabindex:Sk});class Ek{get name(){return this.node.type.name}constructor(e,a,r=!1,n=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=a,this.currentNode=n}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!==(e=this.actualDepth)&&void 0!==e?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let a=this.from,r=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);a=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:a,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),a=this.resolvedPos.doc.resolve(e);return new Ek(a,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Ek(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Ek(e,this.editor)}get children(){const e=[];return this.node.content.forEach(((a,r)=>{const n=a.isBlock&&!a.isTextblock,i=a.isAtom&&!a.isText,t=this.pos+r+(i?0:1),o=this.resolvedPos.doc.resolve(t);if(!n&&o.depth<=this.depth)return;const s=new Ek(o,this.editor,n,n?a:null);n&&(s.actualDepth=this.depth+1),e.push(new Ek(o,this.editor,n,n?a:null))})),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,a={}){let r=null,n=this.parent;for(;n&&!r;){if(n.node.type.name===e)if(Object.keys(a).length>0){const e=n.node.attrs,r=Object.keys(a);for(let n=0;n<r.length;n+=1){const i=r[n];if(e[i]!==a[i])break}}else r=n;n=n.parent}return r}querySelector(e,a={}){return this.querySelectorAll(e,a,!0)[0]||null}querySelectorAll(e,a={},r=!1){let n=[];if(!this.children||0===this.children.length)return n;const i=Object.keys(a);return this.children.forEach((t=>{if(!(r&&n.length>0)){if(t.node.type.name===e){i.every((e=>a[e]===t.node.attrs[e]))&&n.push(t)}r&&n.length>0||(n=n.concat(t.querySelectorAll(e,a,r)))}})),n}setAttribute(e){const{tr:a}=this.editor.state;a.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(a)}}class Mk extends ff{constructor(e={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",(({event:e,slice:a,moved:r})=>this.options.onDrop(e,a,r))),this.on("paste",(({event:e,slice:a})=>this.options.onPaste(e,a))),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=function(e,a){const r=document.querySelector("style[data-tiptap-style]");if(null!==r)return r;const n=document.createElement("style");return a&&n.setAttribute("nonce",a),n.setAttribute("data-tiptap-style",""),n.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(n),n}('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,a=!0){this.setOptions({editable:e}),a&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,a){const r=xf(a)?a(e,[...this.state.plugins]):[...this.state.plugins,e],n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}unregisterPlugin(e){if(this.isDestroyed)return;const a=this.state.plugins;let r=a;if([].concat(e).forEach((e=>{const n="string"==typeof e?`${e}$`:e.key;r=a.filter((e=>!e.key.startsWith(n)))})),a.length===r.length)return;const n=this.state.reconfigure({plugins:r});return this.view.updateState(n),n}createExtensionManager(){var e,a;const r=[...this.options.enableCoreExtensions?[xk,Uf.configure({blockSeparator:null===(a=null===(e=this.options.coreExtensionOptions)||void 0===e?void 0:e.clipboardTextSerializer)||void 0===a?void 0:a.blockSeparator}),zk,$k,qk,Sk,jk,Ck].filter((e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name])):[],...this.options.extensions].filter((e=>["extension","node","mark"].includes(null==e?void 0:e.type)));this.extensionManager=new Bf(r,this)}createCommandManager(){this.commandManager=new bf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let a;try{a=ck(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter((e=>"collaboration"!==e.name)),this.createExtensionManager()}}),a=ck(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const r=ek(a,this.options.autofocus);this.view=new Fb(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...null===(e=this.options.editorProps)||void 0===e?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:jm.create({doc:a,selection:r||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass();this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const a=this.capturedTransaction;return this.capturedTransaction=null,a}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach((e=>{var a;return null===(a=this.capturedTransaction)||void 0===a?void 0:a.step(e)})):void(this.capturedTransaction=e);const a=this.state.apply(e),r=!this.state.selection.eq(a.selection);this.emit("beforeTransaction",{editor:this,transaction:e,nextState:a}),this.view.updateState(a),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const n=e.getMeta("focus"),i=e.getMeta("blur");n&&this.emit("focus",{editor:this,event:n.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),e.docChanged&&!e.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return hk(this.state,e)}isActive(e,a){const r="string"==typeof e?e:null,n="string"==typeof e?a:e;return function(e,a,r={}){if(!a)return ok(e,null,r)||pk(e,null,r);const n=sk(a,e.schema);return"node"===n?ok(e,a,r):"mark"===n&&pk(e,a,r)}(this.state,r,n)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ef(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:a="\n\n",textSerializers:r={}}=e||{};return function(e,a){return Hf(e,{from:0,to:e.content.size},a)}(this.state.doc,{blockSeparator:a,textSerializers:{...Wf(this.schema),...r}})}get isEmpty(){return fk(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(null===(e=this.view)||void 0===e?void 0:e.docView)}$node(e,a){var r;return(null===(r=this.$doc)||void 0===r?void 0:r.querySelector(e,a))||null}$nodes(e,a){var r;return(null===(r=this.$doc)||void 0===r?void 0:r.querySelectorAll(e,a))||null}$pos(e){const a=this.state.doc.resolve(e);return new Ek(a,this)}get $doc(){return this.$pos(0)}}function _k(e){return new _f({find:e.find,handler:({state:a,range:r,match:n})=>{const i=$f(e.getAttributes,void 0,n);if(!1===i||null===i)return null;const{tr:t}=a,o=n[n.length-1],s=n[0];if(o){const n=s.search(/\S/),l=r.from+s.indexOf(o),c=l+o.length;if(mk(r.from,r.to,a.doc).filter((a=>a.mark.type.excluded.find((r=>r===e.type&&r!==a.mark.type)))).filter((e=>e.to>l)).length)return null;c<r.to&&t.delete(c,r.to),l>r.from&&t.delete(r.from+n,l);const d=r.from+n+o.length;t.addMark(r.from+n,d,e.type.create(i||{})),t.removeStoredMark(e.type)}}})}function Ak(e){return new _f({find:e.find,handler:({state:a,range:r,match:n})=>{const i=$f(e.getAttributes,void 0,n)||{},{tr:t}=a,o=r.from;let s=r.to;const l=e.type.create(i);if(n[1]){let e=o+n[0].lastIndexOf(n[1]);e>s?e=s:s=e+n[1].length;const a=n[0][n[0].length-1];t.insertText(a,o+n[0].length-1),t.replaceWith(e,s,l)}else if(n[0]){const a=e.type.isInline?o:o-1;t.insert(a,e.type.create(i)).delete(t.mapping.map(o),t.mapping.map(s))}t.scrollIntoView()}})}function Dk(e){return new _f({find:e.find,handler:({state:a,range:r,match:n})=>{const i=a.doc.resolve(r.from),t=$f(e.getAttributes,void 0,n)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;a.tr.delete(r.from,r.to).setBlockType(r.from,r.from,e.type,t)}})}function Nk(e){return new _f({find:e.find,handler:({state:a,range:r,match:n,chain:i})=>{const t=$f(e.getAttributes,void 0,n)||{},o=a.tr.delete(r.from,r.to),s=o.doc.resolve(r.from).blockRange(),l=s&&Th(s,e.type,t);if(!l)return null;if(o.wrap(s,l),e.keepMarks&&e.editor){const{selection:r,storedMarks:n}=a,{splittableMarks:i}=e.editor.extensionManager,t=n||r.$to.parentOffset&&r.$from.marks();if(t){const e=t.filter((e=>i.includes(e.type.name)));o.ensureMarks(e)}}if(e.keepAttributes){const a="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";i().updateAttributes(a,t).run()}const c=o.doc.resolve(r.from-1).nodeBefore;c&&c.type===e.type&&Lh(o.doc,r.from-1)&&(!e.joinPredicate||e.joinPredicate(n,c))&&o.join(r.from-1)}})}let Tk=class e{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=$f(kf(this,"addOptions",{name:this.name}))),this.storage=$f(kf(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(a={}){return new e(a)}configure(e={}){const a=this.extend({...this.config,addOptions:()=>Tf(this.options,e)});return a.name=this.name,a.parent=this.parent,a}extend(a={}){const r=new e(a);return r.parent=this,this.child=r,r.name=a.name?a.name:r.parent.name,a.defaultOptions&&Object.keys(a.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${r.name}".`),r.options=$f(kf(r,"addOptions",{name:r.name})),r.storage=$f(kf(r,"addStorage",{name:r.name,options:r.options})),r}};function Ik(e){return new Ff({find:e.find,handler:({state:a,range:r,match:n,pasteEvent:i})=>{const t=$f(e.getAttributes,void 0,n,i);if(!1===t||null===t)return null;const{tr:o}=a,s=n[n.length-1],l=n[0];let c=r.to;if(s){const n=l.search(/\S/),i=r.from+l.indexOf(s),d=i+s.length;if(mk(r.from,r.to,a.doc).filter((a=>a.mark.type.excluded.find((r=>r===e.type&&r!==a.mark.type)))).filter((e=>e.to>i)).length)return null;d<r.to&&o.delete(d,r.to),i>r.from&&o.delete(r.from+n,i),c=r.from+n+s.length,o.addMark(r.from+n,c,e.type.create(t||{})),o.removeStoredMark(e.type)}}})}const Fk=Vf.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new $m({key:new Sm("placeholder"),props:{decorations:({doc:e,selection:a})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:n}=a,i=[];if(!r)return null;const t=this.editor.isEmpty;return e.descendants(((e,a)=>{const r=n>=a&&n<=a+e.nodeSize,o=!e.isLeaf&&fk(e);if((r||!this.options.showOnlyCurrent)&&o){const n=[this.options.emptyNodeClass];t&&n.push(this.options.emptyEditorClass);const o=db.node(a,a+e.nodeSize,{class:n.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:e,pos:a,hasAnchor:r}):this.options.placeholder});i.push(o)}return this.options.includeChildren})),mb.create(e,i)}}})]}}),Pk=If.create({name:"underline",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}],renderHTML({HTMLAttributes:e}){return["u",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Rk=/^\s*>\s$/,Lk=Tk.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:e}){return["blockquote",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Nk({find:Rk,type:this.type})]}}),Bk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Vk=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Hk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Wk=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Uk=If.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[_k({find:Bk,type:this.type}),_k({find:Hk,type:this.type})]},addPasteRules(){return[Ik({find:Vk,type:this.type}),Ik({find:Wk,type:this.type})]}}),Gk="textStyle",Kk=/^\s*([-+*])\s$/,Zk=Tk.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:e}){return["ul",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:a})=>this.options.keepAttributes?a().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Gk)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Nk({find:Kk,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Nk({find:Kk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Gk),editor:this.editor})),[e]}}),Jk=/(^|[^`])`([^`]+)`(?!`)/,Yk=/(^|[^`])`([^`]+)`(?!`)/g,Xk=If.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:e}){return["code",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[_k({find:Jk,type:this.type})]},addPasteRules(){return[Ik({find:Yk,type:this.type})]}}),Qk=/^```([a-z]+)?[\s\n]$/,ey=/^~~~([a-z]+)?[\s\n]$/,ay=Tk.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var a;const{languageClassPrefix:r}=this.options,n=[...(null===(a=e.firstElementChild)||void 0===a?void 0:a.classList)||[]].filter((e=>e.startsWith(r))).map((e=>e.replace(r,"")))[0];return n||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:e,HTMLAttributes:a}){return["pre",zf(this.options.HTMLAttributes,a),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:a})=>a.setNode(this.name,e),toggleCodeBlock:e=>({commands:a})=>a.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:a}=this.editor.state.selection,r=1===a.pos;return!(!e||a.parent.type.name!==this.name)&&(!(!r&&a.parent.textContent.length)&&this.editor.commands.clearNodes())},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:a}=e,{selection:r}=a,{$from:n,empty:i}=r;if(!i||n.parent.type!==this.type)return!1;const t=n.parentOffset===n.parent.nodeSize-2,o=n.parent.textContent.endsWith("\n\n");return!(!t||!o)&&e.chain().command((({tr:e})=>(e.delete(n.pos-2,n.pos),!0))).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:a}=e,{selection:r,doc:n}=a,{$from:i,empty:t}=r;if(!t||i.parent.type!==this.type)return!1;if(!(i.parentOffset===i.parent.nodeSize-2))return!1;const o=i.after();if(void 0===o)return!1;return n.nodeAt(o)?e.commands.command((({tr:e})=>(e.setSelection(om.near(n.resolve(o))),!0))):e.commands.exitCode()}}},addInputRules(){return[Dk({find:Qk,type:this.type,getAttributes:e=>({language:e[1]})}),Dk({find:ey,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new $m({key:new Sm("codeBlockVSCodeHandler"),props:{handlePaste:(e,a)=>{if(!a.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const r=a.clipboardData.getData("text/plain"),n=a.clipboardData.getData("vscode-editor-data"),i=n?JSON.parse(n):void 0,t=null==i?void 0:i.mode;if(!r||!t)return!1;const{tr:o,schema:s}=e.state,l=s.text(r.replace(/\r\n?/g,"\n"));return o.replaceSelectionWith(this.type.create({language:t},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(dm.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),ry=Tk.create({name:"doc",topNode:!0,content:"block+"});function ny(e={}){return new $m({view:a=>new iy(a,e)})}class iy{constructor(e,a){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(r=a.width)&&void 0!==r?r:1,this.color=!1===a.color?void 0:a.color||"black",this.class=a.class,this.handlers=["dragover","dragend","drop","dragleave"].map((a=>{let r=e=>{this[a](e)};return e.dom.addEventListener(a,r),{name:a,handler:r}}))}destroy(){this.handlers.forEach((({name:e,handler:a})=>this.editorView.dom.removeEventListener(e,a)))}update(e,a){null!=this.cursorPos&&a.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,a=this.editorView.state.doc.resolve(this.cursorPos),r=!a.parent.inlineContent;if(r){let r=a.nodeBefore,n=a.nodeAfter;if(r||n){let a=this.editorView.nodeDOM(this.cursorPos-(r?r.nodeSize:0));if(a){let i=a.getBoundingClientRect(),t=r?i.bottom:i.top;r&&n&&(t=(t+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),e={left:i.left,right:i.right,top:t-this.width/2,bottom:t+this.width/2}}}}if(!e){let a=this.editorView.coordsAtPos(this.cursorPos);e={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let n,i,t=this.editorView.dom.offsetParent;if(this.element||(this.element=t.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),!t||t==document.body&&"static"==getComputedStyle(t).position)n=-pageXOffset,i=-pageYOffset;else{let e=t.getBoundingClientRect();n=e.left-t.scrollLeft,i=e.top-t.scrollTop}this.element.style.left=e.left-n+"px",this.element.style.top=e.top-i+"px",this.element.style.width=e.right-e.left+"px",this.element.style.height=e.bottom-e.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),e)}dragover(e){if(!this.editorView.editable)return;let a=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=a&&a.inside>=0&&this.editorView.state.doc.nodeAt(a.inside),n=r&&r.type.spec.disableDropCursor,i="function"==typeof n?n(this.editorView,a,e):n;if(a&&!i){let e=a.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Hh(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=a&&(e=a)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){e.target!=this.editorView.dom&&this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}const ty=Vf.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[ny(this.options)]}});class oy extends om{constructor(e){super(e,e)}map(e,a){let r=e.resolve(a.map(this.head));return oy.valid(r)?new oy(r):om.near(r)}content(){return pu.empty}eq(e){return e instanceof oy&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,a){if("number"!=typeof a.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new oy(e.resolve(a.pos))}getBookmark(){return new sy(this.anchor)}static valid(e){let a=e.parent;if(a.isTextblock||!function(e){for(let a=e.depth;a>=0;a--){let r=e.index(a),n=e.node(a);if(0!=r)for(let e=n.child(r-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(n.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let a=e.depth;a>=0;a--){let r=e.indexAfter(a),n=e.node(a);if(r!=n.childCount)for(let e=n.child(r);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||e.isAtom||e.type.spec.isolating)return!0;if(e.inlineContent)return!1}else if(n.type.spec.isolating)return!0}return!0}(e))return!1;let r=a.type.spec.allowGapCursor;if(null!=r)return r;let n=a.contentMatchAt(e.index()).defaultType;return n&&n.isTextblock}static findGapCursorFrom(e,a,r=!1){e:for(;;){if(!r&&oy.valid(e))return e;let n=e.pos,i=null;for(let r=e.depth;;r--){let t=e.node(r);if(a>0?e.indexAfter(r)<t.childCount:e.index(r)>0){i=t.child(a>0?e.indexAfter(r):e.index(r)-1);break}if(0==r)return null;n+=a;let o=e.doc.resolve(n);if(oy.valid(o))return o}for(;;){let t=a>0?i.firstChild:i.lastChild;if(!t){if(i.isAtom&&!i.isText&&!hm.isSelectable(i)){e=e.doc.resolve(n+i.nodeSize*a),r=!1;continue e}break}i=t,n+=a;let o=e.doc.resolve(n);if(oy.valid(o))return o}return null}}}oy.prototype.visible=!1,oy.findFrom=oy.findGapCursorFrom,om.jsonID("gapcursor",oy);class sy{constructor(e){this.pos=e}map(e){return new sy(e.map(this.pos))}resolve(e){let a=e.resolve(this.pos);return oy.valid(a)?new oy(a):om.near(a)}}const ly=Qb({ArrowLeft:cy("horiz",-1),ArrowRight:cy("horiz",1),ArrowUp:cy("vert",-1),ArrowDown:cy("vert",1)});function cy(e,a){const r="vert"==e?a>0?"down":"up":a>0?"right":"left";return function(e,n,i){let t=e.selection,o=a>0?t.$to:t.$from,s=t.empty;if(t instanceof dm){if(!i.endOfTextblock(r)||0==o.depth)return!1;s=!1,o=e.doc.resolve(a>0?o.after():o.before())}let l=oy.findGapCursorFrom(o,a,s);return!!l&&(n&&n(e.tr.setSelection(new oy(l))),!0)}}function dy(e,a,r){if(!e||!e.editable)return!1;let n=e.state.doc.resolve(a);if(!oy.valid(n))return!1;let i=e.posAtCoords({left:r.clientX,top:r.clientY});return!(i&&i.inside>-1&&hm.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new oy(n))),!0)}function uy(e,a){if("insertCompositionText"!=a.inputType||!(e.state.selection instanceof oy))return!1;let{$from:r}=e.state.selection,n=r.parent.contentMatchAt(r.index()).findWrapping(e.state.schema.nodes.text);if(!n)return!1;let i=cu.empty;for(let e=n.length-1;e>=0;e--)i=cu.from(n[e].createAndFill(null,i));let t=e.state.tr.replace(r.pos,r.pos,new pu(i,0,0));return t.setSelection(dm.near(t.doc.resolve(r.pos+1))),e.dispatch(t),!1}function hy(e){if(!(e.selection instanceof oy))return null;let a=document.createElement("div");return a.className="ProseMirror-gapcursor",mb.create(e.doc,[db.widget(e.selection.head,a,{key:"gapcursor"})])}const my=Vf.create({name:"gapCursor",addProseMirrorPlugins:()=>[new $m({props:{decorations:hy,createSelectionBetween:(e,a,r)=>a.pos==r.pos&&oy.valid(r)?new oy(r):null,handleClick:dy,handleKeyDown:ly,handleDOMEvents:{beforeinput:uy}}})],extendNodeSchema(e){var a;return{allowGapCursor:null!==(a=$f(kf(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))&&void 0!==a?a:null}}}),gy=Tk.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",zf(this.options.HTMLAttributes,e)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:e,chain:a,state:r,editor:n})=>e.first([()=>e.exitCode(),()=>e.command((()=>{const{selection:e,storedMarks:i}=r;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:t}=this.options,{splittableMarks:o}=n.extensionManager,s=i||e.$to.parentOffset&&e.$from.marks();return a().insertContent({type:this.name}).command((({tr:e,dispatch:a})=>{if(a&&s&&t){const a=s.filter((e=>o.includes(e.type.name)));e.ensureMarks(a)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),py=Tk.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((e=>({tag:`h${e}`,attrs:{level:e}})))},renderHTML({node:e,HTMLAttributes:a}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,zf(this.options.HTMLAttributes,a),0]},addCommands(){return{setHeading:e=>({commands:a})=>!!this.options.levels.includes(e.level)&&a.setNode(this.name,e),toggleHeading:e=>({commands:a})=>!!this.options.levels.includes(e.level)&&a.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce(((e,a)=>({...e,[`Mod-Alt-${a}`]:()=>this.editor.commands.toggleHeading({level:a})})),{})},addInputRules(){return this.options.levels.map((e=>Dk({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}})))}});var by=200,fy=function(){};fy.prototype.append=function(e){return e.length?(e=fy.from(e),!this.length&&e||e.length<by&&this.leafAppend(e)||this.length<by&&e.leafPrepend(this)||this.appendInner(e)):this},fy.prototype.prepend=function(e){return e.length?fy.from(e).append(this):this},fy.prototype.appendInner=function(e){return new yy(this,e)},fy.prototype.slice=function(e,a){return void 0===e&&(e=0),void 0===a&&(a=this.length),e>=a?fy.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,a))},fy.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},fy.prototype.forEach=function(e,a,r){void 0===a&&(a=0),void 0===r&&(r=this.length),a<=r?this.forEachInner(e,a,r,0):this.forEachInvertedInner(e,a,r,0)},fy.prototype.map=function(e,a,r){void 0===a&&(a=0),void 0===r&&(r=this.length);var n=[];return this.forEach((function(a,r){return n.push(e(a,r))}),a,r),n},fy.from=function(e){return e instanceof fy?e:e&&e.length?new ky(e):fy.empty};var ky=function(e){function a(a){e.call(this),this.values=a}e&&(a.__proto__=e),a.prototype=Object.create(e&&e.prototype),a.prototype.constructor=a;var r={length:{configurable:!0},depth:{configurable:!0}};return a.prototype.flatten=function(){return this.values},a.prototype.sliceInner=function(e,r){return 0==e&&r==this.length?this:new a(this.values.slice(e,r))},a.prototype.getInner=function(e){return this.values[e]},a.prototype.forEachInner=function(e,a,r,n){for(var i=a;i<r;i++)if(!1===e(this.values[i],n+i))return!1},a.prototype.forEachInvertedInner=function(e,a,r,n){for(var i=a-1;i>=r;i--)if(!1===e(this.values[i],n+i))return!1},a.prototype.leafAppend=function(e){if(this.length+e.length<=by)return new a(this.values.concat(e.flatten()))},a.prototype.leafPrepend=function(e){if(this.length+e.length<=by)return new a(e.flatten().concat(this.values))},r.length.get=function(){return this.values.length},r.depth.get=function(){return 0},Object.defineProperties(a.prototype,r),a}(fy);fy.empty=new ky([]);var yy=function(e){function a(a,r){e.call(this),this.left=a,this.right=r,this.length=a.length+r.length,this.depth=Math.max(a.depth,r.depth)+1}return e&&(a.__proto__=e),a.prototype=Object.create(e&&e.prototype),a.prototype.constructor=a,a.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},a.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},a.prototype.forEachInner=function(e,a,r,n){var i=this.left.length;return!(a<i&&!1===this.left.forEachInner(e,a,Math.min(r,i),n))&&(!(r>i&&!1===this.right.forEachInner(e,Math.max(a-i,0),Math.min(this.length,r)-i,n+i))&&void 0)},a.prototype.forEachInvertedInner=function(e,a,r,n){var i=this.left.length;return!(a>i&&!1===this.right.forEachInvertedInner(e,a-i,Math.max(r,i)-i,n+i))&&(!(r<i&&!1===this.left.forEachInvertedInner(e,Math.min(a,i),r,n))&&void 0)},a.prototype.sliceInner=function(e,a){if(0==e&&a==this.length)return this;var r=this.left.length;return a<=r?this.left.slice(e,a):e>=r?this.right.slice(e-r,a-r):this.left.slice(e,r).append(this.right.slice(0,a-r))},a.prototype.leafAppend=function(e){var r=this.right.leafAppend(e);if(r)return new a(this.left,r)},a.prototype.leafPrepend=function(e){var r=this.left.leafPrepend(e);if(r)return new a(r,this.right)},a.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new a(this.left,new a(this.right,e)):new a(this,e)},a}(fy);class vy{constructor(e,a){this.items=e,this.eventCount=a}popEvent(e,a){if(0==this.eventCount)return null;let r,n,i=this.items.length;for(;;i--){if(this.items.get(i-1).selection){--i;break}}a&&(r=this.remapping(i,this.items.length),n=r.maps.length);let t,o,s=e.tr,l=[],c=[];return this.items.forEach(((e,a)=>{if(!e.step)return r||(r=this.remapping(i,a+1),n=r.maps.length),n--,void c.push(e);if(r){c.push(new wy(e.map));let a,i=e.step.map(r.slice(n));i&&s.maybeStep(i).doc&&(a=s.mapping.maps[s.mapping.maps.length-1],l.push(new wy(a,void 0,void 0,l.length+c.length))),n--,a&&r.appendMap(a,n)}else s.maybeStep(e.step);return e.selection?(t=r?e.selection.map(r.slice(n)):e.selection,o=new vy(this.items.slice(0,i).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:o,transform:s,selection:t}}addTransform(e,a,r,n){let i=[],t=this.eventCount,o=this.items,s=!n&&o.length?o.get(o.length-1):null;for(let r=0;r<e.steps.length;r++){let l,c=e.steps[r].invert(e.docs[r]),d=new wy(e.mapping.maps[r],c,a);(l=s&&s.merge(d))&&(d=l,r?i.pop():o=o.slice(0,o.length-1)),i.push(d),a&&(t++,a=void 0),n||(s=d)}let l=t-r.depth;return l>jy&&(o=function(e,a){let r;return e.forEach(((e,n)=>{if(e.selection&&0==a--)return r=n,!1})),e.slice(r)}(o,l),t-=l),new vy(o.append(i),t)}remapping(e,a){let r=new wh;return this.items.forEach(((a,n)=>{let i=null!=a.mirrorOffset&&n-a.mirrorOffset>=e?r.maps.length-a.mirrorOffset:void 0;r.appendMap(a.map,i)}),e,a),r}addMaps(e){return 0==this.eventCount?this:new vy(this.items.append(e.map((e=>new wy(e)))),this.eventCount)}rebased(e,a){if(!this.eventCount)return this;let r=[],n=Math.max(0,this.items.length-a),i=e.mapping,t=e.steps.length,o=this.eventCount;this.items.forEach((e=>{e.selection&&o--}),n);let s=a;this.items.forEach((a=>{let n=i.getMirror(--s);if(null==n)return;t=Math.min(t,n);let l=i.maps[n];if(a.step){let t=e.steps[n].invert(e.docs[n]),c=a.selection&&a.selection.map(i.slice(s+1,n));c&&o++,r.push(new wy(l,t,c))}else r.push(new wy(l))}),n);let l=[];for(let e=a;e<t;e++)l.push(new wy(i.maps[e]));let c=this.items.slice(0,n).append(l).append(r),d=new vy(c,o);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach((a=>{a.step||e++})),e}compress(e=this.items.length){let a=this.remapping(0,e),r=a.maps.length,n=[],i=0;return this.items.forEach(((t,o)=>{if(o>=e)n.push(t),t.selection&&i++;else if(t.step){let e=t.step.map(a.slice(r)),o=e&&e.getMap();if(r--,o&&a.appendMap(o,r),e){let s=t.selection&&t.selection.map(a.slice(r));s&&i++;let l,c=new wy(o.invert(),e,s),d=n.length-1;(l=n.length&&n[d].merge(c))?n[d]=l:n.push(c)}}else t.map&&r--}),this.items.length,0),new vy(fy.from(n.reverse()),i)}}vy.empty=new vy(fy.empty,0);class wy{constructor(e,a,r,n){this.map=e,this.step=a,this.selection=r,this.mirrorOffset=n}merge(e){if(this.step&&e.step&&!e.selection){let a=e.step.merge(this.step);if(a)return new wy(a.getMap().invert(),a,this.selection)}}}class zy{constructor(e,a,r,n,i){this.done=e,this.undone=a,this.prevRanges=r,this.prevTime=n,this.prevComposition=i}}const jy=20;function xy(e){let a=[];for(let r=e.length-1;r>=0&&0==a.length;r--)e[r].forEach(((e,r,n,i)=>a.push(n,i)));return a}function $y(e,a){if(!e)return null;let r=[];for(let n=0;n<e.length;n+=2){let i=a.map(e[n],1),t=a.map(e[n+1],-1);i<=t&&r.push(i,t)}return r}let qy=!1,Cy=null;function Sy(e){let a=e.plugins;if(Cy!=a){qy=!1,Cy=a;for(let e=0;e<a.length;e++)if(a[e].spec.historyPreserveItems){qy=!0;break}}return qy}const Oy=new Sm("history"),Ey=new Sm("closeHistory");function My(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new $m({key:Oy,state:{init:()=>new zy(vy.empty,vy.empty,null,0,-1),apply:(a,r,n)=>function(e,a,r,n){let i,t=r.getMeta(Oy);if(t)return t.historyState;r.getMeta(Ey)&&(e=new zy(e.done,e.undone,null,0,-1));let o=r.getMeta("appendedTransaction");if(0==r.steps.length)return e;if(o&&o.getMeta(Oy))return o.getMeta(Oy).redo?new zy(e.done.addTransform(r,void 0,n,Sy(a)),e.undone,xy(r.mapping.maps),e.prevTime,e.prevComposition):new zy(e.done,e.undone.addTransform(r,void 0,n,Sy(a)),null,e.prevTime,e.prevComposition);if(!1===r.getMeta("addToHistory")||o&&!1===o.getMeta("addToHistory"))return(i=r.getMeta("rebased"))?new zy(e.done.rebased(r,i),e.undone.rebased(r,i),$y(e.prevRanges,r.mapping),e.prevTime,e.prevComposition):new zy(e.done.addMaps(r.mapping.maps),e.undone.addMaps(r.mapping.maps),$y(e.prevRanges,r.mapping),e.prevTime,e.prevComposition);{let i=r.getMeta("composition"),t=0==e.prevTime||!o&&e.prevComposition!=i&&(e.prevTime<(r.time||0)-n.newGroupDelay||!function(e,a){if(!a)return!1;if(!e.docChanged)return!0;let r=!1;return e.mapping.maps[0].forEach(((e,n)=>{for(let i=0;i<a.length;i+=2)e<=a[i+1]&&n>=a[i]&&(r=!0)})),r}(r,e.prevRanges)),s=o?$y(e.prevRanges,r.mapping):xy(r.mapping.maps);return new zy(e.done.addTransform(r,t?a.selection.getBookmark():void 0,n,Sy(a)),vy.empty,s,r.time,null==i?e.prevComposition:i)}}(r,n,a,e)},config:e,props:{handleDOMEvents:{beforeinput(e,a){let r=a.inputType,n="historyUndo"==r?Ay:"historyRedo"==r?Dy:null;return!!n&&(a.preventDefault(),n(e.state,e.dispatch))}}}})}function _y(e,a){return(r,n)=>{let i=Oy.getState(r);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(n){let t=function(e,a,r){let n=Sy(a),i=Oy.get(a).spec.config,t=(r?e.undone:e.done).popEvent(a,n);if(!t)return null;let o=t.selection.resolve(t.transform.doc),s=(r?e.done:e.undone).addTransform(t.transform,a.selection.getBookmark(),i,n),l=new zy(r?s:t.remaining,r?t.remaining:s,null,0,-1);return t.transform.setSelection(o).setMeta(Oy,{redo:r,historyState:l})}(i,r,e);t&&n(a?t.scrollIntoView():t)}return!0}}const Ay=_y(!1,!0),Dy=_y(!0,!0),Ny=Vf.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:a})=>Ay(e,a),redo:()=>({state:e,dispatch:a})=>Dy(e,a)}),addProseMirrorPlugins(){return[My(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),Ty=Tk.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:e}){return["hr",zf(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:a})=>{const{selection:r}=a,{$from:n,$to:i}=r,t=e();return 0===n.parentOffset?t.insertContentAt({from:Math.max(n.pos-1,0),to:i.pos},{type:this.name}):r instanceof hm?t.insertContentAt(i.pos,{type:this.name}):t.insertContent({type:this.name}),t.command((({tr:e,dispatch:a})=>{var r;if(a){const{$to:a}=e.selection,n=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?e.setSelection(dm.create(e.doc,a.pos+1)):a.nodeAfter.isBlock?e.setSelection(hm.create(e.doc,a.pos)):e.setSelection(dm.create(e.doc,a.pos));else{const i=null===(r=a.parent.type.contentMatch.defaultType)||void 0===r?void 0:r.create();i&&(e.insert(n,i),e.setSelection(dm.create(e.doc,n+1)))}e.scrollIntoView()}return!0})).run()}}},addInputRules(){return[Ak({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Iy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Fy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Py=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ry=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Ly=If.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[_k({find:Iy,type:this.type}),_k({find:Py,type:this.type})]},addPasteRules(){return[Ik({find:Fy,type:this.type}),Ik({find:Ry,type:this.type})]}}),By=Tk.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:e}){return["li",zf(this.options.HTMLAttributes,e),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Vy="textStyle",Hy=/^(\d+)\.\s$/,Wy=Tk.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:e=>e.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:e}){const{start:a,...r}=e;return 1===a?["ol",zf(this.options.HTMLAttributes,r),0]:["ol",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:a})=>this.options.keepAttributes?a().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Vy)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Nk({find:Hy,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,a)=>a.childCount+a.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Nk({find:Hy,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Vy)}),joinPredicate:(e,a)=>a.childCount+a.attrs.start===+e[1],editor:this.editor})),[e]}}),Uy=Tk.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Gy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ky=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Zy=If.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}],renderHTML({HTMLAttributes:e}){return["s",zf(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[_k({find:Gy,type:this.type})]},addPasteRules(){return[Ik({find:Ky,type:this.type})]}}),Jy=Tk.create({name:"text",group:"inline"}),Yy=Vf.create({name:"starterKit",addExtensions(){var e,a,r,n,i,t,o,s,l,c,d,u,h,m,g,p,b,f;const k=[];return!1!==this.options.bold&&k.push(Uk.configure(null===(e=this.options)||void 0===e?void 0:e.bold)),!1!==this.options.blockquote&&k.push(Lk.configure(null===(a=this.options)||void 0===a?void 0:a.blockquote)),!1!==this.options.bulletList&&k.push(Zk.configure(null===(r=this.options)||void 0===r?void 0:r.bulletList)),!1!==this.options.code&&k.push(Xk.configure(null===(n=this.options)||void 0===n?void 0:n.code)),!1!==this.options.codeBlock&&k.push(ay.configure(null===(i=this.options)||void 0===i?void 0:i.codeBlock)),!1!==this.options.document&&k.push(ry.configure(null===(t=this.options)||void 0===t?void 0:t.document)),!1!==this.options.dropcursor&&k.push(ty.configure(null===(o=this.options)||void 0===o?void 0:o.dropcursor)),!1!==this.options.gapcursor&&k.push(my.configure(null===(s=this.options)||void 0===s?void 0:s.gapcursor)),!1!==this.options.hardBreak&&k.push(gy.configure(null===(l=this.options)||void 0===l?void 0:l.hardBreak)),!1!==this.options.heading&&k.push(py.configure(null===(c=this.options)||void 0===c?void 0:c.heading)),!1!==this.options.history&&k.push(Ny.configure(null===(d=this.options)||void 0===d?void 0:d.history)),!1!==this.options.horizontalRule&&k.push(Ty.configure(null===(u=this.options)||void 0===u?void 0:u.horizontalRule)),!1!==this.options.italic&&k.push(Ly.configure(null===(h=this.options)||void 0===h?void 0:h.italic)),!1!==this.options.listItem&&k.push(By.configure(null===(m=this.options)||void 0===m?void 0:m.listItem)),!1!==this.options.orderedList&&k.push(Wy.configure(null===(g=this.options)||void 0===g?void 0:g.orderedList)),!1!==this.options.paragraph&&k.push(Uy.configure(null===(p=this.options)||void 0===p?void 0:p.paragraph)),!1!==this.options.strike&&k.push(Zy.configure(null===(b=this.options)||void 0===b?void 0:b.strike)),!1!==this.options.text&&k.push(Jy.configure(null===(f=this.options)||void 0===f?void 0:f.text)),k}}),Xy=Object.fromEntries?Object.fromEntries:e=>{if(!e||!e[Symbol.iterator])throw new Error("Object.fromEntries() requires a single iterable argument");const a={};return Object.keys(e).forEach((r=>{const[n,i]=e[r];a[n]=i})),a};function Qy(e){return Object.keys(e)}function ev(e,a){if(!e)throw new Error(a)}function av(e,a){return a}const rv=e=>{const a=e.length;let r=0,n="";for(;r<a;r++){const a=e[r];if(null==a)continue;let i;switch(typeof a){case"boolean":break;case"object":if(Array.isArray(a))i=rv(a);else{ev(!av(0,!1)),"production"!==process.env.NODE_ENV&&void 0!==a.styles&&void 0!==a.name&&console.error("You have passed styles created with `css` from `@emotion/react` package to the `cx`.\n`cx` is meant to compose class names (strings) so you should convert those styles to a class name by passing them to the `css` received from <ClassNames/> component."),i="";for(const e in a)a[e]&&e&&(i&&(i+=" "),i+=e)}break;default:i=a}i&&(n&&(n+=" "),n+=i)}return n};var nv={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},iv=/[A-Z]|^ms/g,tv=/_EMO_([^_]+?)_([^]*?)_EMO_/g,ov=function(e){return 45===e.charCodeAt(1)},sv=function(e){return null!=e&&"boolean"!=typeof e},lv=Ri((function(e){return ov(e)?e:e.replace(iv,"-$&").toLowerCase()})),cv=function(e,a){switch(e){case"animation":case"animationName":if("string"==typeof a)return a.replace(tv,(function(e,a,r){return uv={name:a,styles:r,next:uv},a}))}return 1===nv[e]||ov(e)||"number"!=typeof a||0===a?a:a+"px"};function dv(e,a,r){if(null==r)return"";var n=r;if(void 0!==n.__emotion_styles)return n;switch(typeof r){case"boolean":return"";case"object":var i=r;if(1===i.anim)return uv={name:i.name,styles:i.styles,next:uv},i.name;var t=r;if(void 0!==t.styles){var o=t.next;if(void 0!==o)for(;void 0!==o;)uv={name:o.name,styles:o.styles,next:uv},o=o.next;return t.styles+";"}return function(e,a,r){var n="";if(Array.isArray(r))for(var i=0;i<r.length;i++)n+=dv(e,a,r[i])+";";else for(var t in r){var o=r[t];if("object"!=typeof o){var s=o;null!=a&&void 0!==a[s]?n+=t+"{"+a[s]+"}":sv(s)&&(n+=lv(t)+":"+cv(t,s)+";")}else if(!Array.isArray(o)||"string"!=typeof o[0]||null!=a&&void 0!==a[o[0]]){var l=dv(e,a,o);switch(t){case"animation":case"animationName":n+=lv(t)+":"+l+";";break;default:n+=t+"{"+l+"}"}}else for(var c=0;c<o.length;c++)sv(o[c])&&(n+=lv(t)+":"+cv(t,o[c])+";")}return n}(e,a,r)}var s=r;if(null==a)return s;var l=a[s];return void 0!==l?l:s}var uv,hv=/label:\s*([^\s;{]+)\s*(;|$)/g;var mv="undefined"!=typeof document;const{createCssAndCx:gv}={createCssAndCx:function(e){const{cache:a}=e,r=(...e)=>{const r=function(e,a,r){if(1===e.length&&"object"==typeof e[0]&&null!==e[0]&&void 0!==e[0].styles)return e[0];var n=!0,i="";uv=void 0;var t=e[0];null==t||void 0===t.raw?(n=!1,i+=dv(r,a,t)):i+=t[0];for(var o=1;o<e.length;o++)i+=dv(r,a,e[o]),n&&(i+=t[o]);hv.lastIndex=0;for(var s,l="";null!==(s=hv.exec(i));)l+="-"+s[1];var c=function(e){for(var a,r=0,n=0,i=e.length;i>=4;++n,i-=4)a=1540483477*(65535&(a=255&e.charCodeAt(n)|(255&e.charCodeAt(++n))<<8|(255&e.charCodeAt(++n))<<16|(255&e.charCodeAt(++n))<<24))+(59797*(a>>>16)<<16),r=1540483477*(65535&(a^=a>>>24))+(59797*(a>>>16)<<16)^1540483477*(65535&r)+(59797*(r>>>16)<<16);switch(i){case 3:r^=(255&e.charCodeAt(n+2))<<16;case 2:r^=(255&e.charCodeAt(n+1))<<8;case 1:r=1540483477*(65535&(r^=255&e.charCodeAt(n)))+(59797*(r>>>16)<<16)}return(((r=1540483477*(65535&(r^=r>>>13))+(59797*(r>>>16)<<16))^r>>>15)>>>0).toString(36)}(i)+l;return{name:c,styles:i,next:uv}}(e,a.registered);!function(e,a){!function(e,a){var r=e.key+"-"+a.name;void 0===e.registered[r]&&(e.registered[r]=a.styles)}(e,a);var r=e.key+"-"+a.name;if(void 0===e.inserted[a.name]){var n="",i=a;do{var t=e.insert(a===i?"."+r:"",i,e.sheet,!0);mv||void 0===t||(n+=t),i=i.next}while(void 0!==i);!mv&&n.length}}(a,r);const n=`${a.key}-${r.name}`;{const r=e[0];(function(e){return e instanceof Object&&!("styles"in e)&&!("length"in e)&&!("__emotion_styles"in e)})(r)&&bv.saveClassNameCSSObjectMapping(a,n,r)}return n};return{css:r,cx:(...e)=>{const n=rv(e),i=bv.fixClassName(a,n,r);return function(e,a,r){const n=[],i=function(e,a,r){var n="";return r.split(" ").forEach((function(r){void 0!==e[r]?a.push(e[r]+";"):r&&(n+=r+" ")})),n}(e,n,r);return n.length<2?r:i+a(n)}(a.registered,r,i)}}}};function pv(e){const{useCache:a}=e;return{useCssAndCx:function(){const e=a(),{css:n,cx:i}=function(e,a){var n;const i=r();return(!i.current||a.length!==(null===(n=i.current.prevDeps)||void 0===n?void 0:n.length)||i.current.prevDeps.map(((e,r)=>e===a[r])).indexOf(!1)>=0)&&(i.current={v:e(),prevDeps:[...a]}),i.current.v}((()=>gv({cache:e})),[e]);return{css:n,cx:i}}}}const bv=(()=>{const e=new WeakMap;return{saveClassNameCSSObjectMapping:(a,r,n)=>{let i=e.get(a);void 0===i&&(i=new Map,e.set(a,i)),i.set(r,n)},fixClassName:(a,r,n)=>{const i=e.get(a);return rv(function(e){let a=!1;return e.map((([e,r])=>{if(void 0===r)return e;let n;if(a)n={"&&":r};else{n=e;for(const e in r)if(e.startsWith("@media")){a=!0;break}}return n}))}(r.split(" ").map((e=>[e,null==i?void 0:i.get(e)]))).map((e=>"string"==typeof e?e:n(e))))}}})();function fv(e){if(!(e instanceof Object)||"function"==typeof e)return e;const a=[];for(const r in e){const n=e[r],i=typeof n;if("string"!==i&&("number"!==i||isNaN(n))&&"boolean"!==i&&null!=n)return e;a.push(`${r}:${i}_${n}`)}return"xSqLiJdLMd9s"+a.join("|")}function kv(e,a,r){if(!(a instanceof Object))return e;const n={};return Qy(e).forEach((i=>n[i]=r(e[i],a[i]))),Qy(a).forEach((r=>{if(r in e)return;const i=a[r];"string"==typeof i&&(n[r]=i)})),n}const yv=({classes:e,theme:a,muiStyleOverridesParams:r,css:n,cx:i,name:o})=>{var s,l;if("makeStyle no name"!==o){if(void 0!==r&&void 0===o)throw new Error("To use muiStyleOverridesParams, you must specify a name using .withName('MyComponent')")}else o=void 0;let c;try{c=void 0===o?void 0:(null===(l=null===(s=a.components)||void 0===s?void 0:s[o])||void 0===l?void 0:l.styleOverrides)||void 0}catch(e){}const d=t((()=>{if(void 0===c)return;const e={};for(const i in c){const t=c[i];t instanceof Object&&(e[i]=n("function"==typeof t?t({theme:a,ownerState:null==r?void 0:r.ownerState,...null==r?void 0:r.props}):t))}return e}),[c,fv(null==r?void 0:r.props),fv(null==r?void 0:r.ownerState),n]);return{classes:e=t((()=>kv(e,d,i)),[e,d,i])}};let vv=0;function wv(e){const{useTheme:a,cache:r}=e,{useCache:n}=jv({cacheProvidedAtInception:r}),{useCssAndCx:i}=pv({useCache:n});return{makeStyles:function(e){const{name:r,uniqId:o=""+vv++}=null!=e?e:{},s="object"!=typeof r?r:Object.keys(r)[0];return function(e){const r="function"==typeof e?e:()=>e;return function(e,l){const c=a();let{css:d,cx:u}=i();const h=n();let m=t((()=>{const a={},n="undefined"!=typeof Proxy&&new Proxy({},{get:(e,r)=>("symbol"==typeof r&&ev(!1),a[r]=`${h.key}-${o}${void 0!==s?`-${s}`:""}-${r}-ref`)}),i=r(c,e,n||{}),t=Xy(Qy(i).map((e=>{const r=i[e];return r.label||(r.label=`${void 0!==s?`${s}-`:""}${e}`),[e,`${d(r)}${av(0,e in a)?` ${a[e]}`:""}`]})));return Qy(a).forEach((e=>{e in t||(t[e]=a[e])})),t}),[h,d,u,c,fv(e)]);{const e=null==l?void 0:l.props.classes;m=t((()=>kv(m,e,u)),[m,fv(e),u])}{const e=yv({classes:m,css:d,cx:u,name:null!=s?s:"makeStyle no name",idOfUseStyles:o,muiStyleOverridesParams:l,theme:c});void 0!==e.classes&&(m=e.classes),void 0!==e.css&&(d=e.css),void 0!==e.cx&&(u=e.cx)}return{classes:m,theme:c,css:d,cx:u}}}},useStyles:function(){const e=a(),{css:r,cx:n}=i();return{theme:e,css:r,cx:n}}}}const zv=c(void 0),{createUseCache:jv}={createUseCache:function(e){const{cacheProvidedAtInception:a}=e;return{useCache:function(){var e;const r=Le(),n=d(zv),i=null!==(e=null!=a?a:n)&&void 0!==e?e:r;if(null===i)throw new Error(["In order to get SSR working with tss-react you need to explicitly provide an Emotion cache.","MUI users be aware: This is not an error strictly related to tss-react, with or without tss-react,","MUI needs an Emotion cache to be provided for SSR to work.","Here is the MUI documentation related to SSR setup: https://mui.com/material-ui/guides/server-rendering/","TSS provides helper that makes the process of setting up SSR easier: https://docs.tss-react.dev/ssr"].join("\n"));return i}}}};function xv(e){return e.charAt(0).toUpperCase()+e.slice(1)}function $v(e){const{useTheme:r,cache:n}=e,{makeStyles:i}=wv({useTheme:r,cache:n});function t(e,r,n){const t="string"==typeof e?(()=>{const a=e,r=function({children:e,...r}){return h(a,r,e)};return Object.defineProperty(r,"name",{value:xv(a)}),r})():e,o=(()=>{{const{name:e}=null!=n?n:{};if(void 0!==e)return"object"!=typeof e?e:Object.keys(e)[0]}let e;{const a=t.displayName;"string"==typeof a&&""!==a&&(e=a)}e:{if(void 0!==e)break e;const a=t.name;"string"==typeof a&&""!==a&&(e=a)}if(void 0!==e)return e=e.replace(/\$/g,"usd"),e=e.replace(/\(/g,"_").replace(/\)/g,"_"),e=e.replace(/[^a-zA-Z0-9-_]/g,"_"),e})(),l=i({...n,name:o})("function"==typeof r?(e,a,n)=>Ov(r(e,a,n)):Ov(r));function c(e){for(const a in e)if("root"!==a)return!0;return!1}const d=s((function(r,n){const{className:i,classes:o,...s}=r,{classes:d,cx:u}=l(r,{props:r}),h=u(d.root,i);return qv.set(d,{...d,root:h}),a.createElement(t,{ref:n,className:c(d)?i:h,..."string"==typeof e?{}:{classes:d},...s})}));return void 0!==o&&(d.displayName=`${xv(o)}WithStyles`,Object.defineProperty(d,"name",{value:d.displayName})),d}return t.getClasses=Sv,{withStyles:t}}const qv=new WeakMap,Cv="getClasses should only be used in conjunction with withStyles";function Sv(e){const a=e.classes;if(void 0===a)throw new Error(Cv);const r=qv.get(a);if(void 0===r)throw new Error(Cv);return r}function Ov(e){const a={},r={};return Object.keys(e).forEach((n=>(n.startsWith("@media")?r:a)[n]=e[n])),Object.keys(r).forEach((e=>{const n=r[e];Object.keys(n).forEach((r=>{var i;return a[r]={...null!==(i=a[r])&&void 0!==i?i:{},[e]:n[r]}}))})),a}const Ev=(()=>{const e="object"==typeof document&&"function"==typeof(null===document||void 0===document?void 0:document.getElementById),a="undefined"!=typeof jest,r="undefined"!=typeof mocha,n="undefined"!=typeof __vitest_worker__;return!(e||a||r||n)})();function Mv(e){_v=0,Av.splice(0,Av.length);const{useContext:a,usePlugin:r,cache:n}=e,{useCache:i}=jv({cacheProvidedAtInception:n}),{useCssAndCx:t}=pv({useCache:i}),o=Dv({useContext:a,useCache:i,useCssAndCx:t,usePlugin:null!=r?r:({classes:e,cx:a,css:r})=>({classes:e,cx:a,css:r}),name:void 0,doesUseNestedSelectors:!1});return{tss:o}}let _v=0;const Av=[];function Dv(e){const{useContext:a,useCache:r,useCssAndCx:n,usePlugin:i,name:t,doesUseNestedSelectors:o}=e;return{withParams:()=>Dv({...e}),withName:a=>Dv({...e,name:"object"!=typeof a?a:Object.keys(a)[0]}),withNestedSelectors:()=>Dv({...e,doesUseNestedSelectors:!0}),create:e=>{const s="x"+_v++;if(void 0!==t)for(;;){const e=Av.find((e=>e.name===t));if(void 0===e)break;Av.splice(Av.indexOf(e),1)}const l="function"==typeof e?e:()=>e;return function(c){var d,u,h;const{classesOverrides:m,...g}=null!=c?c:{},p=a(),{css:b,cx:f}=n(),k=r(),y=function(e){const{cache:a,cssObjectByRuleNameOrGetCssObjectByRuleName:r,classesOverridesRef:n,paramsAndPluginParamsRef:i,idOfUseStyles:t,context:o,getClasses:s}=e;e:{const e=Nv.get(a);if(void 0===e)break e;const s=e.get(r);if(void 0===s)break e;const l=s.get(n);if(void 0===l)break e;const c=l.get(i);if(void 0===c)break e;const d=c.find((({context:e})=>{if(e===o)return!0;if(Qy(e).length!==Qy(o).length)return!1;for(const a in e)if(fv(e[a])!==fv(o[a]))return!1;return!0}));if(void 0!==d){if((null==d?void 0:d.idOfUseStyles)===t)return d.result;c.splice(c.indexOf(d),1)}}const l=s();{Nv.has(a)||Nv.set(a,new WeakMap);const e=Nv.get(a);ev(void 0!==e),e.has(r)||e.set(r,new Map);const s=e.get(r);ev(void 0!==s),s.has(n)||(s.size>200&&s.clear(),s.set(n,new Map));const c=s.get(n);if(ev(void 0!==c),!c.has(i)){{const e="string"==typeof i?257:5;c.size<e||c.clear()}c.set(i,[])}let d=c.get(i);ev(void 0!==d),d.length>5&&(d=[]),d.push({idOfUseStyles:t,context:o,result:l})}return l}({cache:k,cssObjectByRuleNameOrGetCssObjectByRuleName:e,classesOverridesRef:fv(m),paramsAndPluginParamsRef:fv(g),idOfUseStyles:s,context:p,getClasses:()=>{const e={},a=l({...c,...p,...o?{classes:"undefined"==typeof Proxy?{}:new Proxy({},{get:(a,r)=>{if("symbol"==typeof r&&ev(!1),Ev&&void 0===t)throw new Error(["tss-react: In SSR setups, in order to use nested selectors, you must also give a unique name to the useStyle function.",'Solution: Use tss.withName("ComponentName").withNestedSelectors<...>()... to set a name.'].join("\n"));e:{if(void 0===t)break e;let e=Av.find((e=>e.name===t&&e.idOfUseStyles===s));void 0===e&&(e={name:t,idOfUseStyles:s,nestedSelectorRuleNames:new Set},Av.push(e)),e.nestedSelectorRuleNames.add(r)}e:{if(void 0===t)break e;const e=void 0!==Av.find((e=>e.name===t&&e.idOfUseStyles!==s&&e.nestedSelectorRuleNames.has(r)));if(e)throw new Error([`tss-react: There are in your codebase two different useStyles named "${t}" that`,`both use use the nested selector ${r}.\n`,"This may lead to CSS class name collisions, causing nested selectors to target elements outside of the intended scope.\n","Solution: Ensure each useStyles using nested selectors has a unique name.\n",'Use: tss.withName("UniqueName").withNestedSelectors<...>()...'].join(" "))}return e[r]=`${k.key}-${void 0!==t?t:s}-${r}-ref`}})}:{}});let r=Xy(Qy(a).map((r=>{const n=a[r];return n.label||(n.label=`${void 0!==t?`${t}-`:""}${r}`),[r,`${b(n)}${av(0,r in e)?` ${e[r]}`:""}`]})));return Qy(e).forEach((a=>{a in r||(r[a]=e[a])})),r=kv(r,m,f),r}}),v=i({classes:y,css:b,cx:f,idOfUseStyles:s,name:t,...p,...g});return{classes:null!==(d=v.classes)&&void 0!==d?d:y,css:null!==(u=v.css)&&void 0!==u?u:b,cx:null!==(h=v.cx)&&void 0!==h?h:f,...p}}}}}const Nv=new WeakMap;const{tss:Tv}=Mv({useContext:()=>({})});Tv.create({});const{makeStyles:Iv,withStyles:Fv}={...wv(Pv={useTheme:El}),...$v(Pv)};var Pv;const{tss:Rv}=Mv({useContext:function(){return{theme:El()}},usePlugin:yv});Rv.create({});var Lv=function(e,a){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=a(e[r],r,e);return i};var Bv=function(){this.__data__=[],this.size=0};var Vv=function(e,a){return e===a||e!=e&&a!=a},Hv=Vv;var Wv=function(e,a){for(var r=e.length;r--;)if(Hv(e[r][0],a))return r;return-1},Uv=Wv,Gv=Array.prototype.splice;var Kv=function(e){var a=this.__data__,r=Uv(a,e);return!(r<0)&&(r==a.length-1?a.pop():Gv.call(a,r,1),--this.size,!0)},Zv=Wv;var Jv=function(e){var a=this.__data__,r=Zv(a,e);return r<0?void 0:a[r][1]},Yv=Wv;var Xv=Wv;var Qv=function(e,a){var r=this.__data__,n=Xv(r,e);return n<0?(++this.size,r.push([e,a])):r[n][1]=a,this},ew=Bv,aw=Kv,rw=Jv,nw=function(e){return Yv(this.__data__,e)>-1},iw=Qv;function tw(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}tw.prototype.clear=ew,tw.prototype.delete=aw,tw.prototype.get=rw,tw.prototype.has=nw,tw.prototype.set=iw;var ow=tw,sw=ow;var lw=function(){this.__data__=new sw,this.size=0};var cw=function(e){var a=this.__data__,r=a.delete(e);return this.size=a.size,r};var dw=function(e){return this.__data__.get(e)};var uw=function(e){return this.__data__.has(e)},hw="object"==typeof global&&global&&global.Object===Object&&global,mw=hw,gw="object"==typeof self&&self&&self.Object===Object&&self,pw=mw||gw||Function("return this")(),bw=pw.Symbol,fw=bw,kw=Object.prototype,yw=kw.hasOwnProperty,vw=kw.toString,ww=fw?fw.toStringTag:void 0;var zw=function(e){var a=yw.call(e,ww),r=e[ww];try{e[ww]=void 0;var n=!0}catch(e){}var i=vw.call(e);return n&&(a?e[ww]=r:delete e[ww]),i},jw=Object.prototype.toString;var xw=zw,$w=function(e){return jw.call(e)},qw=bw?bw.toStringTag:void 0;var Cw=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":qw&&qw in Object(e)?xw(e):$w(e)};var Sw=function(e){var a=typeof e;return null!=e&&("object"==a||"function"==a)},Ow=Cw,Ew=Sw;var Mw,_w=function(e){if(!Ew(e))return!1;var a=Ow(e);return"[object Function]"==a||"[object GeneratorFunction]"==a||"[object AsyncFunction]"==a||"[object Proxy]"==a},Aw=pw["__core-js_shared__"],Dw=(Mw=/[^.]+$/.exec(Aw&&Aw.keys&&Aw.keys.IE_PROTO||""))?"Symbol(src)_1."+Mw:"";var Nw=function(e){return!!Dw&&Dw in e},Tw=Function.prototype.toString;var Iw=function(e){if(null!=e){try{return Tw.call(e)}catch(e){}try{return e+""}catch(e){}}return""},Fw=_w,Pw=Nw,Rw=Sw,Lw=Iw,Bw=/^\[object .+?Constructor\]$/,Vw=Function.prototype,Hw=Object.prototype,Ww=Vw.toString,Uw=Hw.hasOwnProperty,Gw=RegExp("^"+Ww.call(Uw).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var Kw=function(e){return!(!Rw(e)||Pw(e))&&(Fw(e)?Gw:Bw).test(Lw(e))},Zw=function(e,a){return null==e?void 0:e[a]};var Jw=function(e,a){var r=Zw(e,a);return Kw(r)?r:void 0},Yw=Jw(pw,"Map"),Xw=Jw(Object,"create"),Qw=Xw;var ez=function(){this.__data__=Qw?Qw(null):{},this.size=0};var az=function(e){var a=this.has(e)&&delete this.__data__[e];return this.size-=a?1:0,a},rz=Xw,nz=Object.prototype.hasOwnProperty;var iz=function(e){var a=this.__data__;if(rz){var r=a[e];return"__lodash_hash_undefined__"===r?void 0:r}return nz.call(a,e)?a[e]:void 0},tz=Xw,oz=Object.prototype.hasOwnProperty;var sz=Xw;var lz=ez,cz=az,dz=iz,uz=function(e){var a=this.__data__;return tz?void 0!==a[e]:oz.call(a,e)},hz=function(e,a){var r=this.__data__;return this.size+=this.has(e)?0:1,r[e]=sz&&void 0===a?"__lodash_hash_undefined__":a,this};function mz(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}mz.prototype.clear=lz,mz.prototype.delete=cz,mz.prototype.get=dz,mz.prototype.has=uz,mz.prototype.set=hz;var gz=mz,pz=ow,bz=Yw;var fz=function(e){var a=typeof e;return"string"==a||"number"==a||"symbol"==a||"boolean"==a?"__proto__"!==e:null===e};var kz=function(e,a){var r=e.__data__;return fz(a)?r["string"==typeof a?"string":"hash"]:r.map},yz=kz;var vz=function(e){var a=yz(this,e).delete(e);return this.size-=a?1:0,a},wz=kz;var zz=kz;var jz=kz;var xz=function(){this.size=0,this.__data__={hash:new gz,map:new(bz||pz),string:new gz}},$z=vz,qz=function(e){return wz(this,e).get(e)},Cz=function(e){return zz(this,e).has(e)},Sz=function(e,a){var r=jz(this,e),n=r.size;return r.set(e,a),this.size+=r.size==n?0:1,this};function Oz(e){var a=-1,r=null==e?0:e.length;for(this.clear();++a<r;){var n=e[a];this.set(n[0],n[1])}}Oz.prototype.clear=xz,Oz.prototype.delete=$z,Oz.prototype.get=qz,Oz.prototype.has=Cz,Oz.prototype.set=Sz;var Ez=Oz,Mz=ow,_z=Yw,Az=Ez;var Dz=ow,Nz=lw,Tz=cw,Iz=dw,Fz=uw,Pz=function(e,a){var r=this.__data__;if(r instanceof Mz){var n=r.__data__;if(!_z||n.length<199)return n.push([e,a]),this.size=++r.size,this;r=this.__data__=new Az(n)}return r.set(e,a),this.size=r.size,this};function Rz(e){var a=this.__data__=new Dz(e);this.size=a.size}Rz.prototype.clear=Nz,Rz.prototype.delete=Tz,Rz.prototype.get=Iz,Rz.prototype.has=Fz,Rz.prototype.set=Pz;var Lz=Rz;var Bz=function(e,a){for(var r=-1,n=null==e?0:e.length;++r<n&&!1!==a(e[r],r,e););return e},Vz=Jw,Hz=function(){try{var e=Vz(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),Wz=Hz;var Uz=function(e,a,r){"__proto__"==a&&Wz?Wz(e,a,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[a]=r},Gz=Uz,Kz=Vv,Zz=Object.prototype.hasOwnProperty;var Jz=function(e,a,r){var n=e[a];Zz.call(e,a)&&Kz(n,r)&&(void 0!==r||a in e)||Gz(e,a,r)},Yz=Jz,Xz=Uz;var Qz=function(e,a,r,n){var i=!r;r||(r={});for(var t=-1,o=a.length;++t<o;){var s=a[t],l=n?n(r[s],e[s],s,r,e):void 0;void 0===l&&(l=e[s]),i?Xz(r,s,l):Yz(r,s,l)}return r};var ej=function(e,a){for(var r=-1,n=Array(e);++r<e;)n[r]=a(r);return n};var aj=function(e){return null!=e&&"object"==typeof e},rj=Cw,nj=aj;var ij=function(e){return nj(e)&&"[object Arguments]"==rj(e)},tj=aj,oj=Object.prototype,sj=oj.hasOwnProperty,lj=oj.propertyIsEnumerable,cj=ij(function(){return arguments}())?ij:function(e){return tj(e)&&sj.call(e,"callee")&&!lj.call(e,"callee")},dj=Array.isArray,uj={exports:{}};var hj=function(){return!1};!function(e,a){var r=pw,n=hj,i=a&&!a.nodeType&&a,t=i&&e&&!e.nodeType&&e,o=t&&t.exports===i?r.Buffer:void 0,s=(o?o.isBuffer:void 0)||n;e.exports=s}(uj,uj.exports);var mj=uj.exports,gj=/^(?:0|[1-9]\d*)$/;var pj=function(e,a){var r=typeof e;return!!(a=null==a?9007199254740991:a)&&("number"==r||"symbol"!=r&&gj.test(e))&&e>-1&&e%1==0&&e<a};var bj=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991},fj=Cw,kj=bj,yj=aj,vj={};vj["[object Float32Array]"]=vj["[object Float64Array]"]=vj["[object Int8Array]"]=vj["[object Int16Array]"]=vj["[object Int32Array]"]=vj["[object Uint8Array]"]=vj["[object Uint8ClampedArray]"]=vj["[object Uint16Array]"]=vj["[object Uint32Array]"]=!0,vj["[object Arguments]"]=vj["[object Array]"]=vj["[object ArrayBuffer]"]=vj["[object Boolean]"]=vj["[object DataView]"]=vj["[object Date]"]=vj["[object Error]"]=vj["[object Function]"]=vj["[object Map]"]=vj["[object Number]"]=vj["[object Object]"]=vj["[object RegExp]"]=vj["[object Set]"]=vj["[object String]"]=vj["[object WeakMap]"]=!1;var wj=function(e){return yj(e)&&kj(e.length)&&!!vj[fj(e)]};var zj=function(e){return function(a){return e(a)}},jj={exports:{}};!function(e,a){var r=hw,n=a&&!a.nodeType&&a,i=n&&e&&!e.nodeType&&e,t=i&&i.exports===n&&r.process,o=function(){try{var e=i&&i.require&&i.require("util").types;return e||t&&t.binding&&t.binding("util")}catch(e){}}();e.exports=o}(jj,jj.exports);var xj=jj.exports,$j=wj,qj=zj,Cj=xj&&xj.isTypedArray,Sj=Cj?qj(Cj):$j,Oj=ej,Ej=cj,Mj=dj,_j=mj,Aj=pj,Dj=Sj,Nj=Object.prototype.hasOwnProperty;var Tj=function(e,a){var r=Mj(e),n=!r&&Ej(e),i=!r&&!n&&_j(e),t=!r&&!n&&!i&&Dj(e),o=r||n||i||t,s=o?Oj(e.length,String):[],l=s.length;for(var c in e)!a&&!Nj.call(e,c)||o&&("length"==c||i&&("offset"==c||"parent"==c)||t&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Aj(c,l))||s.push(c);return s},Ij=Object.prototype;var Fj=function(e){var a=e&&e.constructor;return e===("function"==typeof a&&a.prototype||Ij)};var Pj=function(e,a){return function(r){return e(a(r))}},Rj=Pj(Object.keys,Object),Lj=Fj,Bj=Rj,Vj=Object.prototype.hasOwnProperty;var Hj=function(e){if(!Lj(e))return Bj(e);var a=[];for(var r in Object(e))Vj.call(e,r)&&"constructor"!=r&&a.push(r);return a},Wj=_w,Uj=bj;var Gj=function(e){return null!=e&&Uj(e.length)&&!Wj(e)},Kj=Tj,Zj=Hj,Jj=Gj;var Yj=function(e){return Jj(e)?Kj(e):Zj(e)},Xj=Qz,Qj=Yj;var ex=function(e,a){return e&&Xj(a,Qj(a),e)};var ax=function(e){var a=[];if(null!=e)for(var r in Object(e))a.push(r);return a},rx=Sw,nx=Fj,ix=ax,tx=Object.prototype.hasOwnProperty;var ox=function(e){if(!rx(e))return ix(e);var a=nx(e),r=[];for(var n in e)("constructor"!=n||!a&&tx.call(e,n))&&r.push(n);return r},sx=Tj,lx=ox,cx=Gj;var dx=function(e){return cx(e)?sx(e,!0):lx(e)},ux=Qz,hx=dx;var mx=function(e,a){return e&&ux(a,hx(a),e)},gx={exports:{}};!function(e,a){var r=pw,n=a&&!a.nodeType&&a,i=n&&e&&!e.nodeType&&e,t=i&&i.exports===n?r.Buffer:void 0,o=t?t.allocUnsafe:void 0;e.exports=function(e,a){if(a)return e.slice();var r=e.length,n=o?o(r):new e.constructor(r);return e.copy(n),n}}(gx,gx.exports);var px=gx.exports;var bx=function(e,a){var r=-1,n=e.length;for(a||(a=Array(n));++r<n;)a[r]=e[r];return a};var fx=function(e,a){for(var r=-1,n=null==e?0:e.length,i=0,t=[];++r<n;){var o=e[r];a(o,r,e)&&(t[i++]=o)}return t};var kx=function(){return[]},yx=fx,vx=kx,wx=Object.prototype.propertyIsEnumerable,zx=Object.getOwnPropertySymbols,jx=zx?function(e){return null==e?[]:(e=Object(e),yx(zx(e),(function(a){return wx.call(e,a)})))}:vx,xx=Qz,$x=jx;var qx=function(e,a){return xx(e,$x(e),a)};var Cx=function(e,a){for(var r=-1,n=a.length,i=e.length;++r<n;)e[i+r]=a[r];return e},Sx=Pj(Object.getPrototypeOf,Object),Ox=Cx,Ex=Sx,Mx=jx,_x=kx,Ax=Object.getOwnPropertySymbols?function(e){for(var a=[];e;)Ox(a,Mx(e)),e=Ex(e);return a}:_x,Dx=Qz,Nx=Ax;var Tx=function(e,a){return Dx(e,Nx(e),a)},Ix=Cx,Fx=dj;var Px=function(e,a,r){var n=a(e);return Fx(e)?n:Ix(n,r(e))},Rx=Px,Lx=jx,Bx=Yj;var Vx=function(e){return Rx(e,Bx,Lx)},Hx=Px,Wx=Ax,Ux=dx;var Gx=function(e){return Hx(e,Ux,Wx)},Kx=Jw(pw,"DataView"),Zx=Yw,Jx=Jw(pw,"Promise"),Yx=Jw(pw,"Set"),Xx=Jw(pw,"WeakMap"),Qx=Cw,e$=Iw,a$="[object Map]",r$="[object Promise]",n$="[object Set]",i$="[object WeakMap]",t$="[object DataView]",o$=e$(Kx),s$=e$(Zx),l$=e$(Jx),c$=e$(Yx),d$=e$(Xx),u$=Qx;(Kx&&u$(new Kx(new ArrayBuffer(1)))!=t$||Zx&&u$(new Zx)!=a$||Jx&&u$(Jx.resolve())!=r$||Yx&&u$(new Yx)!=n$||Xx&&u$(new Xx)!=i$)&&(u$=function(e){var a=Qx(e),r="[object Object]"==a?e.constructor:void 0,n=r?e$(r):"";if(n)switch(n){case o$:return t$;case s$:return a$;case l$:return r$;case c$:return n$;case d$:return i$}return a});var h$=u$,m$=Object.prototype.hasOwnProperty;var g$=function(e){var a=e.length,r=new e.constructor(a);return a&&"string"==typeof e[0]&&m$.call(e,"index")&&(r.index=e.index,r.input=e.input),r},p$=pw.Uint8Array;var b$=function(e){var a=new e.constructor(e.byteLength);return new p$(a).set(new p$(e)),a},f$=b$;var k$=function(e,a){var r=a?f$(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)},y$=/\w*$/;var v$=function(e){var a=new e.constructor(e.source,y$.exec(e));return a.lastIndex=e.lastIndex,a},w$=bw?bw.prototype:void 0,z$=w$?w$.valueOf:void 0;var j$=b$;var x$=b$,$$=k$,q$=v$,C$=function(e){return z$?Object(z$.call(e)):{}},S$=function(e,a){var r=a?j$(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)};var O$=function(e,a,r){var n=e.constructor;switch(a){case"[object ArrayBuffer]":return x$(e);case"[object Boolean]":case"[object Date]":return new n(+e);case"[object DataView]":return $$(e,r);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return S$(e,r);case"[object Map]":case"[object Set]":return new n;case"[object Number]":case"[object String]":return new n(e);case"[object RegExp]":return q$(e);case"[object Symbol]":return C$(e)}},E$=Sw,M$=Object.create,_$=function(){function e(){}return function(a){if(!E$(a))return{};if(M$)return M$(a);e.prototype=a;var r=new e;return e.prototype=void 0,r}}(),A$=_$,D$=Sx,N$=Fj;var T$=function(e){return"function"!=typeof e.constructor||N$(e)?{}:A$(D$(e))},I$=h$,F$=aj;var P$=function(e){return F$(e)&&"[object Map]"==I$(e)},R$=zj,L$=xj&&xj.isMap,B$=L$?R$(L$):P$,V$=h$,H$=aj;var W$=function(e){return H$(e)&&"[object Set]"==V$(e)},U$=zj,G$=xj&&xj.isSet,K$=G$?U$(G$):W$,Z$=Lz,J$=Bz,Y$=Jz,X$=ex,Q$=mx,eq=px,aq=bx,rq=qx,nq=Tx,iq=Vx,tq=Gx,oq=h$,sq=g$,lq=O$,cq=T$,dq=dj,uq=mj,hq=B$,mq=Sw,gq=K$,pq=Yj,bq=dx,fq="[object Arguments]",kq="[object Function]",yq="[object Object]",vq={};vq[fq]=vq["[object Array]"]=vq["[object ArrayBuffer]"]=vq["[object DataView]"]=vq["[object Boolean]"]=vq["[object Date]"]=vq["[object Float32Array]"]=vq["[object Float64Array]"]=vq["[object Int8Array]"]=vq["[object Int16Array]"]=vq["[object Int32Array]"]=vq["[object Map]"]=vq["[object Number]"]=vq[yq]=vq["[object RegExp]"]=vq["[object Set]"]=vq["[object String]"]=vq["[object Symbol]"]=vq["[object Uint8Array]"]=vq["[object Uint8ClampedArray]"]=vq["[object Uint16Array]"]=vq["[object Uint32Array]"]=!0,vq["[object Error]"]=vq[kq]=vq["[object WeakMap]"]=!1;var wq=function e(a,r,n,i,t,o){var s,l=1&r,c=2&r,d=4&r;if(n&&(s=t?n(a,i,t,o):n(a)),void 0!==s)return s;if(!mq(a))return a;var u=dq(a);if(u){if(s=sq(a),!l)return aq(a,s)}else{var h=oq(a),m=h==kq||"[object GeneratorFunction]"==h;if(uq(a))return eq(a,l);if(h==yq||h==fq||m&&!t){if(s=c||m?{}:cq(a),!l)return c?nq(a,Q$(s,a)):rq(a,X$(s,a))}else{if(!vq[h])return t?a:{};s=lq(a,h,l)}}o||(o=new Z$);var g=o.get(a);if(g)return g;o.set(a,s),gq(a)?a.forEach((function(i){s.add(e(i,r,n,i,a,o))})):hq(a)&&a.forEach((function(i,t){s.set(t,e(i,r,n,t,a,o))}));var p=u?void 0:(d?c?tq:iq:c?bq:pq)(a);return J$(p||a,(function(i,t){p&&(i=a[t=i]),Y$(s,t,e(i,r,n,t,a,o))})),s},zq=Cw,jq=aj;var xq=function(e){return"symbol"==typeof e||jq(e)&&"[object Symbol]"==zq(e)},$q=dj,qq=xq,Cq=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Sq=/^\w*$/;var Oq=function(e,a){if($q(e))return!1;var r=typeof e;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=e&&!qq(e))||(Sq.test(e)||!Cq.test(e)||null!=a&&e in Object(a))},Eq=Ez;function Mq(e,a){if("function"!=typeof e||null!=a&&"function"!=typeof a)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=a?a.apply(this,n):n[0],t=r.cache;if(t.has(i))return t.get(i);var o=e.apply(this,n);return r.cache=t.set(i,o)||t,o};return r.cache=new(Mq.Cache||Eq),r}Mq.Cache=Eq;var _q=Mq;var Aq=function(e){var a=_q(e,(function(e){return 500===r.size&&r.clear(),e})),r=a.cache;return a},Dq=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Nq=/\\(\\)?/g,Tq=Aq((function(e){var a=[];return 46===e.charCodeAt(0)&&a.push(""),e.replace(Dq,(function(e,r,n,i){a.push(n?i.replace(Nq,"$1"):r||e)})),a})),Iq=Tq,Fq=Lv,Pq=dj,Rq=xq,Lq=bw?bw.prototype:void 0,Bq=Lq?Lq.toString:void 0;var Vq=function e(a){if("string"==typeof a)return a;if(Pq(a))return Fq(a,e)+"";if(Rq(a))return Bq?Bq.call(a):"";var r=a+"";return"0"==r&&1/a==-1/0?"-0":r},Hq=Vq;var Wq=dj,Uq=Oq,Gq=Iq,Kq=function(e){return null==e?"":Hq(e)};var Zq=function(e,a){return Wq(e)?e:Uq(e,a)?[e]:Gq(Kq(e))};var Jq=function(e){var a=null==e?0:e.length;return a?e[a-1]:void 0},Yq=xq;var Xq=function(e){if("string"==typeof e||Yq(e))return e;var a=e+"";return"0"==a&&1/e==-1/0?"-0":a},Qq=Zq,eC=Xq;var aC=function(e,a){for(var r=0,n=(a=Qq(a,e)).length;null!=e&&r<n;)e=e[eC(a[r++])];return r&&r==n?e:void 0};var rC=function(e,a,r){var n=-1,i=e.length;a<0&&(a=-a>i?0:i+a),(r=r>i?i:r)<0&&(r+=i),i=a>r?0:r-a>>>0,a>>>=0;for(var t=Array(i);++n<i;)t[n]=e[n+a];return t},nC=aC,iC=rC;var tC=Zq,oC=Jq,sC=function(e,a){return a.length<2?e:nC(e,iC(a,0,-1))},lC=Xq;var cC=function(e,a){return a=tC(a,e),null==(e=sC(e,a))||delete e[lC(oC(a))]},dC=Cw,uC=Sx,hC=aj,mC=Function.prototype,gC=Object.prototype,pC=mC.toString,bC=gC.hasOwnProperty,fC=pC.call(Object);var kC=function(e){if(!hC(e)||"[object Object]"!=dC(e))return!1;var a=uC(e);if(null===a)return!0;var r=bC.call(a,"constructor")&&a.constructor;return"function"==typeof r&&r instanceof r&&pC.call(r)==fC};var yC=function(e){return kC(e)?void 0:e},vC=cj,wC=dj,zC=bw?bw.isConcatSpreadable:void 0;var jC=Cx,xC=function(e){return wC(e)||vC(e)||!!(zC&&e&&e[zC])};var $C=function e(a,r,n,i,t){var o=-1,s=a.length;for(n||(n=xC),t||(t=[]);++o<s;){var l=a[o];r>0&&n(l)?r>1?e(l,r-1,n,i,t):jC(t,l):i||(t[t.length]=l)}return t},qC=$C;var CC=function(e){return(null==e?0:e.length)?qC(e,1):[]};var SC=function(e,a,r){switch(r.length){case 0:return e.call(a);case 1:return e.call(a,r[0]);case 2:return e.call(a,r[0],r[1]);case 3:return e.call(a,r[0],r[1],r[2])}return e.apply(a,r)},OC=Math.max;var EC=function(e,a,r){return a=OC(void 0===a?e.length-1:a,0),function(){for(var n=arguments,i=-1,t=OC(n.length-a,0),o=Array(t);++i<t;)o[i]=n[a+i];i=-1;for(var s=Array(a+1);++i<a;)s[i]=n[i];return s[a]=r(o),SC(e,this,s)}};var MC=function(e){return function(){return e}},_C=Hz,AC=_C?function(e,a){return _C(e,"toString",{configurable:!0,enumerable:!1,value:MC(a),writable:!0})}:function(e){return e},DC=Date.now;var NC=function(e){var a=0,r=0;return function(){var n=DC(),i=16-(n-r);if(r=n,i>0){if(++a>=800)return arguments[0]}else a=0;return e.apply(void 0,arguments)}}(AC),TC=CC,IC=EC,FC=NC;var PC=Lv,RC=wq,LC=cC,BC=Zq,VC=Qz,HC=yC,WC=Gx,UC=function(e){return FC(IC(e,void 0,TC),e+"")}((function(e,a){var r={};if(null==e)return r;var n=!1;a=PC(a,(function(a){return a=BC(a,e),n||(n=a.length>1),a})),VC(e,WC(e),r),n&&(r=RC(r,7,HC));for(var i=a.length;i--;)LC(r,a[i]);return r})),GC=la(UC);const KC=1,ZC=2,JC=2;function YC(e){const a=Object.keys(e.typography.h1).some((e=>e.includes("@media"))),r=Re`
|
|
41
41
|
0%, 95% {
|
|
42
42
|
opacity: 1;
|
|
43
43
|
}
|