ocean-brain 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +5 -3
  2. package/dist/index.js +12 -4
  3. package/package.json +10 -8
  4. package/server/client/dist/assets/{Calendar-CaeK7gTz.js → Calendar-DH3eSSRs.js} +1 -1
  5. package/server/client/dist/assets/{Note-CGI-Y1__.js → Note-CpzLtGVM.js} +1 -1
  6. package/server/client/dist/assets/{Search-DAYHxAml.js → Search-D9detGWk.js} +1 -1
  7. package/server/client/dist/assets/{Tag-CG8b0l1j.js → Tag-Bquqtx23.js} +1 -1
  8. package/server/client/dist/assets/{TagNotes-COyaVsdn.js → TagNotes-CbjfxqAN.js} +1 -1
  9. package/server/client/dist/assets/{Views-BPxlw3vk.js → Views-L4eC96Lx.js} +1 -1
  10. package/server/client/dist/assets/{app-BezcjTfd.js → app-BFM2V_Rx.js} +2 -2
  11. package/server/client/dist/assets/{index-CzZFedXj.js → index-CJPl3MJE.js} +1 -1
  12. package/server/client/dist/assets/{manage-image-detail-9hRTiAsR.js → manage-image-detail-BIDHUR5-.js} +1 -1
  13. package/server/client/dist/assets/mcp-D8footel.js +5 -0
  14. package/server/client/dist/assets/{note-core-DUTqUh5N.js → note-core-YhYEmI_R.js} +1 -1
  15. package/server/client/dist/assets/note-runtime-B3ats-dC.js +153 -0
  16. package/server/client/dist/assets/{note-ui-BaqzP-YU.js → note-ui-BtzPk8gA.js} +1 -1
  17. package/server/client/dist/assets/{placeholder-CZoqs4S3.js → placeholder-DKgxoe_f.js} +1 -1
  18. package/server/client/dist/assets/route-preload.js +2 -2
  19. package/server/client/dist/index.html +1 -1
  20. package/server/dist/app.js +91 -8
  21. package/server/dist/features/auth/http/api.js +9 -8
  22. package/server/dist/features/auth/http/pages.js +27 -28
  23. package/server/dist/features/auth/service.js +7 -27
  24. package/server/dist/features/cache/graphql/cache.type-defs.js +1 -1
  25. package/server/dist/features/image/http/upload.js +2 -2
  26. package/server/dist/features/mcp-admin/http/handlers.js +9 -9
  27. package/server/dist/features/note/http/mcp.js +17 -17
  28. package/server/dist/features/search/http/handlers.js +10 -10
  29. package/server/dist/features/search/search-manager.js +34 -6
  30. package/server/dist/features/tag/http/mcp.js +2 -2
  31. package/server/dist/modules/auth-guard.js +36 -53
  32. package/server/dist/modules/blocknote.js +16 -9
  33. package/server/dist/modules/error-handler.js +17 -20
  34. package/server/dist/modules/mcp-auth.js +50 -56
  35. package/server/dist/modules/rate-limit.js +23 -23
  36. package/server/dist/modules/server-events-handler.js +15 -13
  37. package/server/dist/modules/session-store.js +6 -8
  38. package/server/dist/paths.js +2 -1
  39. package/server/dist/routes/api.js +105 -71
  40. package/server/dist/routes/auth-pages.js +21 -11
  41. package/server/dist/routes/client.js +60 -72
  42. package/server/dist/routes/graphql.js +31 -26
  43. package/server/dist/routes/mcp.js +25 -35
  44. package/server/dist/server.js +14 -16
  45. package/server/client/dist/assets/mcp-ugdCKa6H.js +0 -4
  46. package/server/client/dist/assets/note-runtime-zN5ddTba.js +0 -168
  47. package/server/dist/modules/logger.js +0 -53
  48. package/server/dist/modules/use-async.js +0 -10
@@ -0,0 +1,153 @@
1
+ import{g as Sp,r as C,R as Cc,a as Ka,j as M,w as QA,b as wt,c as ZA,d as BE,e as Br,u as JA,f as tu,h as nh,o as FE,i as e3,k as xu,s as wp,l as Y0,m as Zo,n as HE,p as t3}from"./floating-ui.react-dom-BWTnA00G.js";const ks=new WeakMap,nu=new WeakMap,Su={current:[]};let _d=!1;const xl=new Set,K0=new Map;function UE(t){const e=Array.from(t).sort((n,r)=>n instanceof As&&n.options.deps.includes(r)?1:r instanceof As&&r.options.deps.includes(n)?-1:0);for(const n of e){if(Su.current.includes(n))continue;Su.current.push(n),n.recompute();const r=nu.get(n);if(r)for(const i of r){const s=ks.get(i);s&&UE(s)}}}function n3(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function r3(t){const e={prevVal:t.prevState,currentVal:t.state};for(const n of t.listeners)n(e)}function i3(t){if(xl.add(t),!_d)try{for(_d=!0;xl.size>0;){const e=Array.from(xl);xl.clear();for(const n of e){const r=K0.get(n)??n.prevState;n.prevState=r,n3(n)}for(const n of e){const r=ks.get(n);r&&(Su.current.push(n),UE(r))}for(const n of e){const r=ks.get(n);if(r)for(const i of r)r3(i)}}}finally{_d=!1,Su.current=[],K0.clear()}}function s3(t){return typeof t=="function"}class G0{constructor(e,n){this.listeners=new Set,this.subscribe=r=>{var i,s;this.listeners.add(r);const o=(s=(i=this.options)==null?void 0:i.onSubscribe)==null?void 0:s.call(i,r,this);return()=>{this.listeners.delete(r),o?.()}},this.prevState=e,this.state=e,this.options=n}setState(e){var n,r,i;this.prevState=this.state,(n=this.options)!=null&&n.updateFn?this.state=this.options.updateFn(this.prevState)(e):s3(e)?this.state=e(this.prevState):this.state=e,(i=(r=this.options)==null?void 0:r.onUpdate)==null||i.call(r),i3(this)}}class As{constructor(e){this.listeners=new Set,this._subscriptions=[],this.lastSeenDepValues=[],this.getDepVals=()=>{const n=this.options.deps.length,r=new Array(n),i=new Array(n);for(let s=0;s<n;s++){const o=this.options.deps[s];r[s]=o.prevState,i[s]=o.state}return this.lastSeenDepValues=i,{prevDepVals:r,currDepVals:i,prevVal:this.prevState??void 0}},this.recompute=()=>{var n,r;this.prevState=this.state;const i=this.getDepVals();this.state=this.options.fn(i),(r=(n=this.options).onUpdate)==null||r.call(n)},this.checkIfRecalculationNeededDeeply=()=>{for(const s of this.options.deps)s instanceof As&&s.checkIfRecalculationNeededDeeply();let n=!1;const r=this.lastSeenDepValues,{currDepVals:i}=this.getDepVals();for(let s=0;s<i.length;s++)if(i[s]!==r[s]){n=!0;break}n&&this.recompute()},this.mount=()=>(this.registerOnGraph(),this.checkIfRecalculationNeededDeeply(),()=>{this.unregisterFromGraph();for(const n of this._subscriptions)n()}),this.subscribe=n=>{var r,i;this.listeners.add(n);const s=(i=(r=this.options).onSubscribe)==null?void 0:i.call(r,n,this);return()=>{this.listeners.delete(n),s?.()}},this.options=e,this.state=e.fn({prevDepVals:void 0,prevVal:void 0,currDepVals:this.getDepVals().currDepVals})}registerOnGraph(e=this.options.deps){for(const n of e)if(n instanceof As)n.registerOnGraph(),this.registerOnGraph(n.options.deps);else if(n instanceof G0){let r=ks.get(n);r||(r=new Set,ks.set(n,r)),r.add(this);let i=nu.get(this);i||(i=new Set,nu.set(this,i)),i.add(n)}}unregisterFromGraph(e=this.options.deps){for(const n of e)if(n instanceof As)this.unregisterFromGraph(n.options.deps);else if(n instanceof G0){const r=ks.get(n);r&&r.delete(this);const i=nu.get(this);i&&i.delete(n)}}}function Tt(t){this.content=t}Tt.prototype={constructor:Tt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),s=r.content.slice();return i==-1?s.push(n||t,e):(s[i+1]=e,n&&(s[i]=n)),new Tt(s)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Tt(n)},addToStart:function(t,e){return new Tt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Tt(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),s=r.find(t);return i.splice(s==-1?i.length:s,0,e,n),new Tt(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Tt.from(t),t.size?new Tt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Tt.from(t),t.size?new Tt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Tt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Tt.from=function(t){if(t instanceof Tt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Tt(e)};function $E(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),s=e.child(r);if(i==s){n+=i.nodeSize;continue}if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){let o=i.text,a=s.text,l=0;for(;o[l]==a[l];l++)n++;return l&&l<o.length&&l<a.length&&jE(o.charCodeAt(l-1))&&zE(o.charCodeAt(l))&&n--,n}if(i.content.size||s.content.size){let o=$E(i.content,s.content,n+1);if(o!=null)return o}n+=i.nodeSize}}function VE(t,e,n,r){for(let i=t.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:n,b:r};let o=t.child(--i),a=e.child(--s),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let u=o.text,c=a.text,d=u.length,f=c.length;for(;d>0&&f>0&&u[d-1]==c[f-1];)d--,f--,n--,r--;return d&&f&&d<u.length&&jE(u.charCodeAt(d-1))&&zE(u.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(o.content.size||a.content.size){let u=VE(o.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}function zE(t){return t>=56320&&t<57344}function jE(t){return t>=55296&&t<56320}class q{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,s){for(let o=0,a=0;a<n;o++){let l=this.content[o],u=a+l.nodeSize;if(u>e&&r(l,i+a,s||null,o)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let s="",o=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(o?o=!1:s+=r),s+=u},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),s=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new q(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let s=0,o=0;o<n;s++){let a=this.content[s],l=o+a.nodeSize;l>e&&((o<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,e-o-1),Math.min(a.content.size,n-o-1))),r.push(a),i+=a.nodeSize),o=l}return new q(r,i)}cutByIndex(e,n){return e==n?q.empty:e==0&&n==this.content.length?this:new q(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),s=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new q(i,s)}addToStart(e){return new q([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new q(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))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 n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return $E(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return VE(this,e,n,r)}findIndex(e){if(e==0)return Sl(0,e);if(e==this.size)return Sl(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),s=r+i.nodeSize;if(s>=e)return s==e?Sl(n+1,s):Sl(n,r);r=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return q.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return q.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return q.empty;let n,r=0;for(let i=0;i<e.length;i++){let s=e[i];r+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(n||(n=e.slice(0,i)),n[n.length-1]=s.withText(n[n.length-1].text+s.text)):n&&n.push(s)}return new q(n||e,r)}static from(e){if(!e)return q.empty;if(e instanceof q)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new q([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}q.empty=new q([],0);const Id={index:0,offset:0};function Sl(t,e){return Id.index=t,Id.offset=e,Id}function wu(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!wu(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!wu(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let $e=class rh{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))n||(n=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(s)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&wu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return rh.none;if(e instanceof rh)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};$e.none=[];class ba extends Error{}class ee{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=qE(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new ee(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ee(WE(this.content,e+this.openStart,n+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,n){if(!n)return ee.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ee(q.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)i++;return new ee(e,r,i)}}ee.empty=new ee(q.empty,0,0);function WE(t,e,n){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r),{index:o,offset:a}=t.findIndex(n);if(i==e||s.isText){if(a!=n&&!t.child(o).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return t.replaceChild(r,s.copy(WE(s.content,e-i-1,n-i-1)))}function qE(t,e,n,r,i,s){let{index:o,offset:a}=t.findIndex(e),l=t.maybeChild(o);if(a==e||l.isText)return s&&r<=0&&i<=0&&!s.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let u=qE(l.content,e-a-1,n,o==0?r-1:0,o==t.childCount-1?i-1:0,l);return u&&t.replaceChild(o,l.copy(u))}function o3(t,e,n){if(n.openStart>t.depth)throw new ba("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ba("Inconsistent open depths");return YE(t,e,n,0)}function YE(t,e,n,r){let i=t.index(r),s=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let o=YE(t,e,n,r+1);return s.copy(s.content.replaceChild(i,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let o=t.parent,a=o.content;return Mi(o,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:o,end:a}=a3(n,t);return Mi(s,GE(t,o,a,e,r))}else return Mi(s,ku(t,e,r))}function KE(t,e){if(!e.type.compatibleContent(t.type))throw new ba("Cannot join "+e.type.name+" onto "+t.type.name)}function ih(t,e,n){let r=t.node(n);return KE(r,e.node(n)),r}function Ri(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Jo(t,e,n,r){let i=(e||t).node(n),s=0,o=e?e.index(n):i.childCount;t&&(s=t.index(n),t.depth>n?s++:t.textOffset&&(Ri(t.nodeAfter,r),s++));for(let a=s;a<o;a++)Ri(i.child(a),r);e&&e.depth==n&&e.textOffset&&Ri(e.nodeBefore,r)}function Mi(t,e){if(!t.type.validContent(e))throw new ba("Invalid content for node "+t.type.name);return t.copy(e)}function GE(t,e,n,r,i){let s=t.depth>i&&ih(t,e,i+1),o=r.depth>i&&ih(n,r,i+1),a=[];return Jo(null,t,i,a),s&&o&&e.index(i)==n.index(i)?(KE(s,o),Ri(Mi(s,GE(t,e,n,r,i+1)),a)):(s&&Ri(Mi(s,ku(t,e,i+1)),a),Jo(e,n,i,a),o&&Ri(Mi(o,ku(n,r,i+1)),a)),Jo(r,null,i,a),new q(a)}function ku(t,e,n){let r=[];if(Jo(null,t,n,r),t.depth>n){let i=ih(t,e,n+1);Ri(Mi(i,ku(t,e,n+1)),r)}return Jo(e,null,n,r),new q(r)}function a3(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let s=n-1;s>=0;s--)i=e.node(s).copy(q.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class ya{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let s=0;s<e;s++)i+=r.child(s).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return $e.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let s=r.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!i||!r[s].isInSet(i.marks))&&(r=r[s--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){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)&&(!n||n(this.node(r))))return new Au(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 n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,s=n;for(let o=e;;){let{index:a,offset:l}=o.content.findIndex(s),u=s-l;if(r.push(o,a,i+l),!u||(o=o.child(a),o.isText))break;s=u-1,i+=l+1}return new ya(n,r,s)}static resolveCached(e,n){let r=X0.get(e);if(r)for(let s=0;s<r.elts.length;s++){let o=r.elts[s];if(o.pos==n)return o}else X0.set(e,r=new l3);let i=r.elts[r.i]=ya.resolve(e,n);return r.i=(r.i+1)%u3,i}}class l3{constructor(){this.elts=[],this.i=0}}const u3=12,X0=new WeakMap;class Au{constructor(e,n,r){this.$from=e,this.$to=n,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 c3=Object.create(null);let Oi=class sh{constructor(e,n,r,i=$e.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||q.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,n,r,i=0){this.content.nodesBetween(e,n,r,i,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,n,r,i){return this.content.textBetween(e,n,r,i)}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,n,r){return this.type==e&&wu(this.attrs,n||e.defaultAttrs||c3)&&$e.sameSet(this.marks,r||$e.none)}copy(e=null){return e==this.content?this:new sh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new sh(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ee.empty;let i=this.resolve(e),s=this.resolve(n),o=r?0:i.sharedDepth(n),a=i.start(o),u=i.node(o).content.cut(i.pos-a,s.pos-a);return new ee(u,i.depth-o,s.depth-o)}replace(e,n,r){return o3(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ya.resolveCached(this,e)}resolveNoCache(e){return ya.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,s=>(r.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),XE(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=q.empty,i=0,s=r.childCount){let o=this.contentMatchAt(e).matchFragment(r,i,s),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<s;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(r),o=s&&s.matchFragment(this.content,n);return o?o.validEnd:!1}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=$e.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!$e.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n 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(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=q.fromJSON(e,n.content),s=e.nodeType(n.type).create(n.attrs,i,r);return s.type.checkAttrs(s.attrs),s}};Oi.prototype.text=void 0;class vu extends Oi{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):XE(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new vu(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new vu(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function XE(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Hi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new d3(e,n);if(r.next==null)return Hi.empty;let i=QE(r);r.next&&r.err("Unexpected trailing text");let s=y3(b3(i));return E3(s,r),s}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let s=n;i&&s<r;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function s(o,a){let l=o.matchFragment(e,r);if(l&&(!n||l.validEnd))return q.from(a.map(u=>u.createAndFill()));for(let u=0;u<o.next.length;u++){let{type:c,next:d}=o.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let f=s(d,a.concat(c));if(f)return f}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let a=i;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:a,next:l}=s.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.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=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let s=i+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)s+=(o?", ":"")+r.next[o].type.name+"->"+e.indexOf(r.next[o].next);return s}).join(`
2
+ `)}}Hi.empty=new Hi(!0);class d3{constructor(e,n){this.string=e,this.nodeTypes=n,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 QE(t){let e=[];do e.push(f3(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function f3(t){let e=[];do e.push(h3(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function h3(t){let e=g3(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=p3(t,e);else break;return e}function Q0(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function p3(t,e){let n=Q0(t),r=n;return t.eat(",")&&(t.next!="}"?r=Q0(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function m3(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let s in n){let o=n[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function g3(t){if(t.eat("(")){let e=QE(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=m3(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function b3(t){let e=[[]];return i(s(t,0),n()),e;function n(){return e.push([])-1}function r(o,a,l){let u={term:l,to:a};return e[o].push(u),u}function i(o,a){o.forEach(l=>l.to=a)}function s(o,a){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(s(u,a)),[]);if(o.type=="seq")for(let l=0;;l++){let u=s(o.exprs[l],a);if(l==o.exprs.length-1)return u;i(u,a=n())}else if(o.type=="star"){let l=n();return r(a,l),i(s(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(s(o.expr,a),l),i(s(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(s(o.expr,a));if(o.type=="range"){let l=a;for(let u=0;u<o.min;u++){let c=n();i(s(o.expr,l),c),l=c}if(o.max==-1)i(s(o.expr,l),l);else for(let u=o.min;u<o.max;u++){let c=n();r(l,c),i(s(o.expr,l),c),l=c}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function ZE(t,e){return e-t}function Z0(t,e){let n=[];return r(e),n.sort(ZE);function r(i){let s=t[i];if(s.length==1&&!s[0].term)return r(s[0].to);n.push(i);for(let o=0;o<s.length;o++){let{term:a,to:l}=s[o];!a&&n.indexOf(l)==-1&&r(l)}}}function y3(t){let e=Object.create(null);return n(Z0(t,0));function n(r){let i=[];r.forEach(o=>{t[o].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);Z0(t,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let s=e[r.join(",")]=new Hi(r.indexOf(t.length-1)>-1);for(let o=0;o<i.length;o++){let a=i[o][1].sort(ZE);s.next.push({type:i[o][0],next:e[a.join(",")]||n(a)})}return s}}function E3(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],s=!i.validEnd,o=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];o.push(l.name),s&&!(l.isText||l.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function JE(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function e2(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let s=t[r];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function t2(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let i in t)t[i].validate&&t[i].validate(e[i])}function n2(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new C3(t,r,e[r]);return n}let J0=class r2{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=n2(e,r.attrs),this.defaultAttrs=JE(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Hi.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:e2(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Oi(this,this.computeAttrs(e),q.from(n),$e.setFrom(r))}createChecked(e=null,n,r){return n=q.from(n),this.checkContent(n),new Oi(this,this.computeAttrs(e),n,$e.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=q.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),s=i&&i.fillBefore(q.empty,!0);return s?new Oi(this,e,n.append(s),$e.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).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){t2(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:$e.none:e}static compile(e,n){let r=Object.create(null);e.forEach((s,o)=>r[s]=new r2(s,n,o));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function T3(t,e,n){let r=n.split("|");return i=>{let s=i===null?"null":typeof i;if(r.indexOf(s)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${s}`)}}class C3{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?T3(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class xc{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=n2(e,i.attrs),this.excluded=null;let s=JE(this.attrs);this.instance=s?new $e(this,s):null}create(e=null){return!e&&this.instance?this.instance:new $e(this,e2(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((s,o)=>r[s]=new xc(s,i++,n,o)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){t2(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let i2=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Tt.from(e.nodes),n.marks=Tt.from(e.marks||{}),this.nodes=J0.compile(this.spec.nodes,this),this.marks=xc.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",a=s.spec.marks;if(s.contentMatch=r[o]||(r[o]=Hi.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=a=="_"?null:a?eg(this,a.split(" ")):a==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:eg(this,o.split(" "))}this.nodeFromJSON=i=>Oi.fromJSON(this,i),this.markFromJSON=i=>$e.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof J0){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new vu(r,r.defaultAttrs,e,$e.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function eg(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],s=t.marks[i],o=s;if(s)n.push(s);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function x3(t){return t.tag!=null}function S3(t){return t.style!=null}let ea=class oh{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(x3(i))this.tags.push(i);else if(S3(i)){let s=/[^=]*/.exec(i.style)[0];r.indexOf(s)<0&&r.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,n={}){let r=new ng(this,n,!1);return r.addAll(e,$e.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new ng(this,n,!0);return r.addAll(e,$e.none,n.from,n.to),ee.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(A3(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||n.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,n,r,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],a=o.style;if(!(a.indexOf(e)!=0||o.context&&!r.matchesContext(o.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(e){let n=[];function r(i){let s=i.priority==null?50:i.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<s)break}n.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{r(o=rg(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{r(o=rg(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new oh(e,oh.schemaRules(e)))}};const s2={address:!0,article:!0,aside:!0,blockquote:!0,body:!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},w3={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},o2={ol:!0,ul:!0},Ea=1,ah=2,ta=4;function tg(t,e,n){return e!=null?(e?Ea:0)|(e==="full"?ah:0):t&&t.whitespace=="pre"?Ea|ah:n&~ta}class wl{constructor(e,n,r,i,s,o){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=$e.none,this.match=s||(o&ta?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(q.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ea)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let n=q.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(q.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!s2.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ng{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,s,o=tg(null,n.preserveWhitespace,0)|(r?ta:0);i?s=new wl(i.type,i.attrs,$e.none,!0,n.topMatch||i.type.contentMatch,o):r?s=new wl(null,null,$e.none,!0,null,o):s=new wl(e.schema.topNodeType,null,$e.none,!0,null,o),this.nodes=[s],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,s=i.options&ah?"full":this.localPreserveWS||(i.options&Ea)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(s)if(s==="full")r=r.replace(/\r\n?/g,`
3
+ `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=i.content[i.content.length-1],l=e.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),a;o2.hasOwnProperty(o)&&this.parser.normalizeLists&&k3(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:w3.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(s2.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),u=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(s),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=r.getPropertyValue(s);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(s,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let s,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(s=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}s&&this.sync(a)&&this.open--}addAll(e,n,r,i){let s=r||0;for(let o=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];o!=a;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,n);this.findAtPoint(e,s)}findPlace(e,n,r){let i,s;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(e);if(u&&(!i||i.length>u.length+a)&&(i=u,s=l,!u.length))break;if(l.solid){if(r)break;a+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)n=this.enterInner(i[o],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(n=this.enterInner(s,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=$e.none;for(let a of i.concat(e.marks))(s.type?s.type.allowsMarkType(a.type):ig(a.type,e.type))&&(o=a.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let s=this.findPlace(e.create(n),r,!1);return s&&(s=this.enterInner(e,n,r,!0,i)),s}enterInner(e,n,r,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let a=tg(e,s,o.options);o.options&ta&&o.content.length==0&&(a|=ta);let l=$e.none;return r=r.filter(u=>(o.type?o.type.allowsMarkType(u.type):ig(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new wl(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].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 n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Ea)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(i?0:1),o=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=s;l--)if(o(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=s?r.node(l-s).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function k3(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&o2.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function A3(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function rg(t){let e={};for(let n in t)e[n]=t[n];return e}function ig(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let s=[],o=a=>{s.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||s.indexOf(c)<0&&o(c))return!0}};if(o(i.contentMatch))return!0}}class Xi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=kl(n).createDocumentFragment());let i=r,s=[];return e.forEach(o=>{if(s.length||o.marks.length){let a=0,l=0;for(;a<s.length&&l<o.marks.length;){let u=o.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(s[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<s.length;)i=s.pop()[1];for(;l<o.marks.length;){let u=o.marks[l++],c=this.serializeMark(u,o.isInline,n);c&&(s.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(e,n){if(e.isText)return kl(n).createTextNode(e.text);let{dom:r,contentDOM:i}=ru(kl(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let s=this.serializeMark(e.marks[i],e.isInline,n);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&ru(kl(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return typeof n=="string"?{dom:e.createTextNode(n)}:ru(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Xi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=sg(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return sg(e.marks)}}function sg(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function kl(t){return t.document||window.document}const og=new WeakMap;function v3(t){let e=og.get(t);return e===void 0&&og.set(t,e=N3(t)),e}function N3(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function ru(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let i=e[0],s;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(s=v3(r))&&s.indexOf(e)>-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=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),u[d]):d=="style"&&l.style?l.style.cssText=u[d]:l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof f=="string")l.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=ru(t,f,n,r);if(l.appendChild(h),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}const a2=65535,l2=Math.pow(2,16);function _3(t,e){return t+e*l2}function ag(t){return t&a2}function I3(t){return(t-(t&a2))/l2}const u2=1,c2=2,iu=4,d2=8;class lh{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&d2)>0}get deletedBefore(){return(this.delInfo&(u2|iu))>0}get deletedAfter(){return(this.delInfo&(c2|iu))>0}get deletedAcross(){return(this.delInfo&iu)>0}}class pn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&pn.empty)return pn.empty}recover(e){let n=0,r=ag(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+I3(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+s],c=this.ranges[a+o],d=l+u;if(e<=d){let f=u?e==l?-1:e==d?1:n:n,h=l+i+(f<0?0:c);if(r)return h;let p=e==(n<0?l:d)?null:_3(a/3,e-l),g=e==l?c2:e==d?u2:iu;return(n<0?e!=l:e!=d)&&(g|=d2),new lh(h,g,p)}i+=c-u}return r?e+i:new lh(e+i,0,null)}touches(e,n){let r=0,i=ag(n),s=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+s],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+o]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],a=o-(this.inverted?s:0),l=o+(this.inverted?0:s),u=this.ranges[i+n],c=this.ranges[i+r];e(a,a+u,l,l+c),s+=c-u}}invert(){return new pn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?pn.empty:new pn(e<0?[0,-e,0]:[0,0,e])}}pn.empty=new pn([]);class Ta{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Ta(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Ta;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],a=o.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(s);if(l!=null&&l>s&&l<this.to){s=l,e=this._maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new lh(e,i,null)}}const Rd=Object.create(null);class Mt{getMap(){return pn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Rd[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Rd)throw new RangeError("Duplicate use of step JSON ID "+e);return Rd[e]=n,n.prototype.jsonID=e,n}}class st{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new st(e,null)}static fail(e){return new st(null,e)}static fromReplace(e,n,r,i){try{return st.ok(e.replace(n,r,i))}catch(s){if(s instanceof ba)return st.fail(s.message);throw s}}}function kp(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let s=t.child(i);s.content.size&&(s=s.copy(kp(s.content,e,s))),s.isInline&&(s=e(s,n,i)),r.push(s)}return q.fromArray(r)}class Qr extends Mt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),s=new ee(kp(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,s)}invert(){return new Bn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Qr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Qr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Qr(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Qr(n.from,n.to,e.markFromJSON(n.mark))}}Mt.jsonID("addMark",Qr);class Bn extends Mt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ee(kp(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return st.fromReplace(e,this.from,this.to,r)}invert(){return new Qr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Bn(n.pos,r.pos,this.mark)}merge(e){return e instanceof Bn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Bn(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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Bn(n.from,n.to,e.markFromJSON(n.mark))}}Mt.jsonID("removeMark",Bn);class Zr extends Mt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return st.fromReplace(e,this.pos,this.pos+1,new ee(q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Zr(this.pos,n.marks[i]);return new Zr(this.pos,this.mark)}}return new Ui(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Zr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Zr(n.pos,e.markFromJSON(n.mark))}}Mt.jsonID("addNodeMark",Zr);class Ui extends Mt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return st.fromReplace(e,this.pos,this.pos+1,new ee(q.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Zr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ui(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ui(n.pos,e.markFromJSON(n.mark))}}Mt.jsonID("removeNodeMark",Ui);class et extends Mt{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&uh(e,this.from,this.to)?st.fail("Structure replace would overwrite content"):st.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new pn([this.from,this.to-this.from,this.slice.size])}invert(e){return new et(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.to,-1),r=this.from==this.to&&et.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new et(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof et)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new et(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ee.empty:new ee(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new et(e.from,this.to,n,this.structure)}else return null}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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new et(n.from,n.to,ee.fromJSON(e,n.slice),!!n.structure)}}et.MAP_BIAS=1;Mt.jsonID("replace",et);class pt extends Mt{constructor(e,n,r,i,s,o,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=s,this.insert=o,this.structure=a}apply(e){if(this.structure&&(uh(e,this.from,this.gapFrom)||uh(e,this.gapTo,this.to)))return st.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return st.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?st.fromReplace(e,this.from,this.to,r):st.fail("Content does not fit in gap")}getMap(){return new pn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new pt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||s>r.pos?null:new pt(n.pos,r.pos,i,s,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,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new pt(n.from,n.to,n.gapFrom,n.gapTo,ee.fromJSON(e,n.slice),n.insert,!!n.structure)}}Mt.jsonID("replaceAround",pt);function uh(t,e,n){let r=t.resolve(e),i=n-e,s=r.depth;for(;i>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,i--;if(i>0){let o=r.node(s).maybeChild(r.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function R3(t,e,n,r){let i=[],s=[],o,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let f=Math.max(u,e),h=Math.min(u+l.nodeSize,n),p=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(p)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=h:i.push(o=new Bn(f,h,d[g])));a&&a.to==f?a.to=h:s.push(a=new Qr(f,h,r))}}),i.forEach(l=>t.step(l)),s.forEach(l=>t.step(l))}function M3(t,e,n,r){let i=[],s=0;t.doc.nodesBetween(e,n,(o,a)=>{if(!o.isInline)return;s++;let l=null;if(r instanceof xc){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(a+o.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],f;for(let h=0;h<i.length;h++){let p=i[h];p.step==s-1&&d.eq(i[h].style)&&(f=p)}f?(f.to=u,f.step=s):i.push({style:d,from:Math.max(a,e),to:u,step:s})}}}),i.forEach(o=>t.step(new Bn(o.from,o.to,o.style)))}function Ap(t,e,n,r=n.contentMatch,i=!0){let s=t.doc.nodeAt(e),o=[],a=e+1;for(let l=0;l<s.childCount;l++){let u=s.child(l),c=a+u.nodeSize,d=r.matchType(u.type);if(!d)o.push(new et(a,c,ee.empty));else{r=d;for(let f=0;f<u.marks.length;f++)n.allowsMarkType(u.marks[f].type)||t.step(new Bn(a,c,u.marks[f]));if(i&&u.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(u.text);)p||(p=new ee(q.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),o.push(new et(a+f.index,a+f.index+f[0].length,p))}}a=c}if(!r.validEnd){let l=r.fillBefore(q.empty,!0);t.replace(a,a,new ee(l,0,0))}for(let l=o.length-1;l>=0;l--)t.step(o[l])}function O3(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function co(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,s=0;;--r){let o=t.$from.node(r),a=t.$from.index(r)+i,l=t.$to.indexAfter(r)-s;if(r<t.depth&&o.canReplace(a,l,n))return r;if(r==0||o.type.spec.isolating||!O3(o,a,l))break;a&&(i=1),l<o.childCount&&(s=1)}return null}function D3(t,e,n){let{$from:r,$to:i,depth:s}=e,o=r.before(s+1),a=i.after(s+1),l=o,u=a,c=q.empty,d=0;for(let p=s,g=!1;p>n;p--)g||r.index(p)>0?(g=!0,c=q.from(r.node(p).copy(c)),d++):l--;let f=q.empty,h=0;for(let p=s,g=!1;p>n;p--)g||i.after(p+1)<i.end(p)?(g=!0,f=q.from(i.node(p).copy(f)),h++):u++;t.step(new pt(l,u,o,a,new ee(c.append(f),d,h),c.size-d,!0))}function f2(t,e,n=null,r=t){let i=L3(t,e),s=i&&P3(r,e);return s?i.map(lg).concat({type:e,attrs:n}).concat(s.map(lg)):null}function lg(t){return{type:t,attrs:null}}function L3(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.contentMatchAt(r).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return n.canReplaceWith(r,i,o)?s:null}function P3(t,e){let{parent:n,startIndex:r,endIndex:i}=t,s=n.child(r),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let l=(o.length?o[o.length-1]:e).contentMatch;for(let u=r;l&&u<i;u++)l=l.matchType(n.child(u).type);return!l||!l.validEnd?null:o}function B3(t,e,n){let r=q.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=q.from(n[o].type.create(n[o].attrs,r))}let i=e.start,s=e.end;t.step(new pt(i,s,i,s,new ee(r,0,0),n.length,!0))}function F3(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,(o,a)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&H3(t.doc,t.mapping.slice(s).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?u=!1:!h&&p&&(u=!0)}u===!1&&p2(t,o,a,s),Ap(t,t.mapping.slice(s).map(a,1),r,void 0,u===null);let c=t.mapping.slice(s),d=c.map(a,1),f=c.map(a+o.nodeSize,1);return t.step(new pt(d,f,d+1,f-1,new ee(q.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&h2(t,o,a,s),!1}})}function h2(t,e,n,r){e.forEach((i,s)=>{if(i.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+s+o.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function p2(t,e,n,r){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=t.mapping.slice(r).map(n+1+s);t.replaceWith(o,o+1,e.type.schema.text(`
5
+ `))}})}function H3(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function U3(t,e,n,r,i){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let o=n.create(r,null,i||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,o);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new pt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new ee(q.from(o),0,0),1,!0))}function Ir(t,e,n=1,r){let i=t.resolve(e),s=i.depth-n,o=r&&r[r.length-1]||i.parent;if(s<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 u=i.depth-1,c=n-2;u>s;u--,c--){let d=i.node(u),f=i.index(u);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[c+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let g=r&&r[c]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(h))return!1}let a=i.indexAfter(s),l=r&&r[0];return i.node(s).canReplaceWith(a,a,l?l.type:i.node(s+1).type)}function $3(t,e,n=1,r){let i=t.doc.resolve(e),s=q.empty,o=q.empty;for(let a=i.depth,l=i.depth-n,u=n-1;a>l;a--,u--){s=q.from(i.node(a).copy(s));let c=r&&r[u];o=q.from(c?c.type.create(c.attrs,o):i.node(a).copy(o))}t.step(new et(e,e,new ee(s.append(o),n,n),!0))}function Qi(t,e){let n=t.resolve(e),r=n.index();return m2(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function V3(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==r?t.type.schema.nodes.text:s.type;if(n=n.matchType(o),!n||!t.type.allowsMarks(s.marks))return!1}return n.validEnd}function m2(t,e){return!!(t&&e&&!t.isLeaf&&V3(t,e))}function Sc(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let s,o,a=r.index(i);if(i==r.depth?(s=r.nodeBefore,o=r.nodeAfter):n>0?(s=r.node(i+1),a++,o=r.node(i).maybeChild(a)):(s=r.node(i).maybeChild(a-1),o=r.node(i+1)),s&&!s.isTextblock&&m2(s,o)&&r.node(i).canReplace(a,a+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function z3(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,s=t.doc.resolve(e-n),o=s.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",d=!!o.contentMatch.matchType(i);c&&!d?r=!1:!c&&d&&(r=!0)}let a=t.steps.length;if(r===!1){let c=t.doc.resolve(e+n);p2(t,c.node(),c.before(),a)}o.inlineContent&&Ap(t,e+n-1,o,s.node().contentMatchAt(s.index()),r==null);let l=t.mapping.slice(a),u=l.map(e-n);if(t.step(new et(u,l.map(e+n,-1),ee.empty,!0)),r===!0){let c=t.doc.resolve(u);h2(t,c.node(),c.before(),t.steps.length)}return t}function j3(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let s=r.index(i);if(r.node(i).canReplaceWith(s,s,n))return r.before(i+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let s=r.indexAfter(i);if(r.node(i).canReplaceWith(s,s,n))return r.after(i+1);if(s<r.node(i).childCount)return null}return null}function W3(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let s=0;s<n.openStart;s++)i=i.firstChild.content;for(let s=1;s<=(n.openStart==0&&n.size?2:1);s++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),u=r.node(o),c=!1;if(s==1)c=u.canReplace(l,l,i);else{let d=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=d&&u.canReplaceWith(l,l,d[0])}if(c)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function wc(t,e,n=e,r=ee.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),s=t.resolve(n);return g2(i,s,r)?new et(e,n,r):new q3(i,s,r).fit()}function g2(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class q3{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=q.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=q.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let s=this.placed,o=r.depth,a=i.depth;for(;o&&a&&s.childCount==1;)s=s.firstChild.content,o--,a--;let l=new ee(s,o,a);return e>-1?new pt(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new et(r.pos,i.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let s=n.firstChild;if(n.childCount>1&&(i=0),s.type.spec.isolating&&i<=r){e=r;break}n=s.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,s=null;r?(s=ug(this.unplaced.content,r-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,d=null;if(n==1&&(o?u.matchType(o.type)||(d=u.fillBefore(q.from(o),!1)):s&&l.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:a,parent:s,inject:d};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:s,wrap:c};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return cg(e,-1)<=n?!1:(this.unplaced.size>1&&cg(e,1)>r&&r++,this.unplaced=new ee(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=ug(e,n);if(i.childCount<=1&&n>0){let s=e.size-n<=n+i.size;this.unplaced=new ee(Yo(e,n-1,1),n-1,s?n-1:r)}else this.unplaced=new ee(Yo(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:s}){for(;this.depth>n;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-e,u=0,c=[],{match:d,type:f}=this.frontier[n];if(i){for(let g=0;g<i.childCount;g++)c.push(i.child(g));d=d.matchFragment(i)}let h=a.size+e-(o.content.size-o.openEnd);for(;u<a.childCount;){let g=a.child(u),b=d.matchType(g.type);if(!b)break;u++,(u>1||l==0||g.content.size)&&(d=b,c.push(b2(g.mark(f.allowedMarks(g.marks)),u==1?l:0,u==a.childCount?h:-1)))}let p=u==a.childCount;p||(h=-1),this.placed=Ko(this.placed,n,q.from(c)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=a;g<h;g++){let y=b.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),b=y.content}this.unplaced=p?e==0?ee.empty:new ee(Yo(o.content,e-1,1),e-1,h<0?o.openEnd:e-1):new ee(Yo(o.content,e,u),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Md(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],s=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),o=Md(e,n,i,r,s);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:u}=this.frontier[a],c=Md(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:s?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Ko(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Ko(this.placed,this.depth,q.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(q.empty,!0);n.childCount&&(this.placed=Ko(this.placed,this.frontier.length,n))}}function Yo(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Yo(t.firstChild.content,e-1,n)))}function Ko(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Ko(t.lastChild.content,e-1,n)))}function ug(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function b2(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,b2(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(q.empty,!0)))),t.copy(r)}function Md(t,e,n,r,i){let s=t.node(e),o=i?t.indexAfter(e):t.index(e);if(o==s.childCount&&!n.compatibleContent(s.type))return null;let a=r.fillBefore(s.content,!0,o);return a&&!Y3(n,s.content,o)?a:null}function Y3(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function K3(t){return t.spec.defining||t.spec.definingForContent}function cg(t,e){for(let n=0;;n++){let r=e<0?t.firstChild:t.lastChild;if(!r||r.isAtom)return n;t=r.content}}function G3(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),s=t.doc.resolve(n);if(g2(i,s,r))return t.step(new et(e,n,r));let o=E2(i,s);o[o.length-1]==0&&o.pop();let a=-(i.depth+1);o.unshift(a);for(let f=i.depth,h=i.pos-1;f>0;f--,h--){let p=i.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(f)>-1?a=f:i.before(f)==h&&o.splice(1,0,-f)}let l=o.indexOf(a),u=[],c=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(u.push(p),h==r.openStart)break;f=p.content}for(let f=c-1;f>=0;f--){let h=u[f],p=K3(h.type);if(p&&!h.sameMarkup(i.node(Math.abs(a)-1)))c=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+c+1)%(r.openStart+1),p=u[h];if(p)for(let g=0;g<o.length;g++){let b=o[(g+l)%o.length],y=!0;b<0&&(y=!1,b=-b);let E=i.node(b-1),T=i.index(b-1);if(E.canReplaceWith(T,T,p.type,p.marks))return t.replace(i.before(b),y?s.after(b):n,new ee(y2(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=o.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=o[f];h<0||(e=i.before(h),n=s.after(h))}}function y2(t,e,n,r,i){if(e<n){let s=t.firstChild;t=t.replaceChild(0,s.copy(y2(s.content,e+1,n,r,s)))}if(e>r){let s=i.contentMatchAt(0),o=s.fillBefore(t).append(t);t=o.append(s.matchFragment(o).fillBefore(q.empty,!0))}return t}function X3(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=j3(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new ee(q.from(r),0,0))}function Q3(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),a=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(a=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(a=!0);if(!a){for(let l=r.depth;l>0&&e==r.start(l);l--)e=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=t.doc.resolve(e),i=t.doc.resolve(n)}}let s=E2(r,i);for(let o=0;o<s.length;o++){let a=s[o],l=o==s.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return t.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return t.delete(r.before(a),i.after(a))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(e-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return t.delete(r.before(o),n);t.delete(e,n)}function E2(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let s=t.start(i);if(s<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&n.push(i)}return n}class vs extends Mt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return st.fail("No node at attribute step's position");let r=Object.create(null);for(let s in n.attrs)r[s]=n.attrs[s];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return st.fromReplace(e,this.pos,this.pos+1,new ee(q.from(i),0,n.isLeaf?0:1))}getMap(){return pn.empty}invert(e){return new vs(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new vs(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new vs(n.pos,n.attr,n.value)}}Mt.jsonID("attr",vs);class Ca extends Mt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return st.ok(r)}getMap(){return pn.empty}invert(e){return new Ca(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Ca(n.attr,n.value)}}Mt.jsonID("docAttr",Ca);let $s=class extends Error{};$s=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};$s.prototype=Object.create(Error.prototype);$s.prototype.constructor=$s;$s.prototype.name="TransformError";class vp{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ta}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new $s(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,n=-1e9;for(let r=0;r<this.mapping.maps.length;r++){let i=this.mapping.maps[r];r&&(e=i.map(e,1),n=i.map(n,-1)),i.forEach((s,o,a,l)=>{e=Math.min(e,a),n=Math.max(n,l)})}return e==1e9?null:{from:e,to:n}}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ee.empty){let i=wc(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new ee(q.from(r),0,0))}delete(e,n){return this.replace(e,n,ee.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return G3(this,e,n,r),this}replaceRangeWith(e,n,r){return X3(this,e,n,r),this}deleteRange(e,n){return Q3(this,e,n),this}lift(e,n){return D3(this,e,n),this}join(e,n=1){return z3(this,e,n),this}wrap(e,n){return B3(this,e,n),this}setBlockType(e,n=e,r,i=null){return F3(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return U3(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new vs(e,n,r)),this}setDocAttribute(e,n){return this.step(new Ca(e,n)),this}addNodeMark(e,n){return this.step(new Zr(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof $e)n.isInSet(r.marks)&&this.step(new Ui(e,n));else{let i=r.marks,s,o=[];for(;s=n.isInSet(i);)o.push(new Ui(e,s)),i=s.removeFromSet(i);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(e,n=1,r){return $3(this,e,n,r),this}addMark(e,n,r){return R3(this,e,n,r),this}removeMark(e,n,r){return M3(this,e,n,r),this}clearIncompatible(e,n,r){return Ap(this,e,n,r),this}}var dg=Object.defineProperty,T2=(t,e)=>{let n={};for(var r in t)dg(n,r,{get:t[r],enumerable:!0});return dg(n,Symbol.toStringTag,{value:"Module"}),n};const Od=Object.create(null);class he{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new C2(e.min(n),e.max(n))]}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 n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ee.empty){let r=n.content.lastChild,i=null;for(let a=0;a<n.openEnd;a++)i=r,r=r.lastChild;let s=e.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:u}=o[a],c=e.mapping.slice(s);e.replaceRange(c.map(l.pos),c.map(u.pos),a?ee.empty:n),a==0&&pg(e,s,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:a}=i[s],l=e.mapping.slice(r),u=l.map(o.pos),c=l.map(a.pos);s?e.deleteRange(u,c):(e.replaceRangeWith(u,c,n),pg(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new ue(e):bs(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=n<0?bs(e.node(0),e.node(s),e.before(s+1),e.index(s),n,r):bs(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,n,r);if(o)return o}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new tn(e.node(0))}static atStart(e){return bs(e,e,0,0,1)||new tn(e)}static atEnd(e){return bs(e,e,e.content.size,e.childCount,-1)||new tn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Od[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Od)throw new RangeError("Duplicate use of selection JSON ID "+e);return Od[e]=n,n.prototype.jsonID=e,n}getBookmark(){return ue.between(this.$anchor,this.$head).getBookmark()}}he.prototype.visible=!0;class C2{constructor(e,n){this.$from=e,this.$to=n}}let fg=!1;function hg(t){!fg&&!t.parent.inlineContent&&(fg=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class ue extends he{constructor(e,n=e){hg(e),hg(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return he.near(r);let i=e.resolve(n.map(this.anchor));return new ue(i.parent.inlineContent?i:r,r)}replace(e,n=ee.empty){if(super.replace(e,n),n==ee.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ue&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new kc(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ue(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let s=he.findFrom(n,r,!0)||he.findFrom(n,-r,!0);if(s)n=s.$head;else return he.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(he.findFrom(e,-r,!0)||he.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new ue(e,n)}}he.jsonID("text",ue);class kc{constructor(e,n){this.anchor=e,this.head=n}map(e){return new kc(e.map(this.anchor),e.map(this.head))}resolve(e){return ue.between(e.resolve(this.anchor),e.resolve(this.head))}}class ae extends he{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),s=e.resolve(i);return r?he.near(s):new ae(s)}content(){return new ee(q.from(this.node),0,0)}eq(e){return e instanceof ae&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Np(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ae(e.resolve(n.anchor))}static create(e,n){return new ae(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ae.prototype.visible=!1;he.jsonID("node",ae);class Np{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new kc(r,r):new Np(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&ae.isSelectable(r)?new ae(n):he.near(n)}}class tn extends he{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ee.empty){if(n==ee.empty){e.delete(0,e.doc.content.size);let r=he.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new tn(e)}map(e){return new tn(e)}eq(e){return e instanceof tn}getBookmark(){return Z3}}he.jsonID("all",tn);const Z3={map(){return this},resolve(t){return new tn(t)}};function bs(t,e,n,r,i,s=!1){if(e.inlineContent)return ue.create(t,n);for(let o=r-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let a=e.child(o);if(a.isAtom){if(!s&&ae.isSelectable(a))return ae.create(t,n-(i<0?a.nodeSize:0))}else{let l=bs(t,a,n+i,i<0?a.childCount:0,i,s);if(l)return l}n+=a.nodeSize*i}return null}function pg(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof et||i instanceof pt))return;let s=t.mapping.maps[r],o;s.forEach((a,l,u,c)=>{o==null&&(o=c)}),t.setSelection(he.near(t.doc.resolve(o),n))}const mg=1,Al=2,gg=4;let J3=class extends vp{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=(this.updated|mg)&~Al,this.storedMarks=null,this}get selectionSet(){return(this.updated&mg)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Al,this}ensureMarks(e){return $e.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(this.updated&Al)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Al,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||$e.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let s=this.storedMarks;if(!s){let o=this.doc.resolve(n);s=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,s)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(he.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=gg,this}get scrolledIntoView(){return(this.updated&gg)>0}};function bg(t,e){return!e||!t?t:t.bind(e)}class Go{constructor(e,n,r){this.name=e,this.init=bg(n.init,r),this.apply=bg(n.apply,r)}}const ev=[new Go("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Go("selection",{init(t,e){return t.selection||he.atStart(e.doc)},apply(t){return t.selection}}),new Go("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Go("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class Dd{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=ev.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Go(r.key,r.spec.state,r))})}}class vi{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,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let s=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=i?i[o].n:0,u=i?i[o].state:this,c=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,u,r);if(c&&r.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!i){i=[];for(let d=0;d<this.config.plugins.length;d++)i.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(c),r=r.applyInner(c),s=!0}i&&(i[o]={state:r,n:n.length})}}if(!s)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new vi(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let s=r[i];n[s.name]=s.apply(e,this[s.name],this,n)}return n}get tr(){return new J3(this)}static create(e){let n=new Dd(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new vi(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new Dd(this.schema,e.plugins),r=n.fields,i=new vi(n);for(let s=0;s<r.length;s++){let o=r[s].name;i[o]=this.hasOwnProperty(o)?this[o]:r[s].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],s=i.spec.state;s&&s.toJSON&&(n[r]=s.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new Dd(e.schema,e.plugins),s=new vi(i);return i.fields.forEach(o=>{if(o.name=="doc")s.doc=Oi.fromJSON(e.schema,n.doc);else if(o.name=="selection")s.selection=he.fromJSON(s.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(s.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){s[o.name]=u.fromJSON.call(l,e,n[a],s);return}}s[o.name]=o.init(e,s)}}),s}}function x2(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=x2(i,e,{})),n[r]=i}return n}class nt{constructor(e){this.spec=e,this.props={},e.props&&x2(e.props,this,this.props),this.key=e.key?e.key.key:S2("plugin")}getState(e){return e[this.key]}}const Ld=Object.create(null);function S2(t){return t in Ld?t+"$"+ ++Ld[t]:(Ld[t]=0,t+"$")}class yt{constructor(e="key"){this.key=S2(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const w2=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function k2(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const A2=(t,e,n)=>{let r=k2(t,n);if(!r)return!1;let i=_p(r);if(!i){let o=r.blockRange(),a=o&&co(o);return a==null?!1:(e&&e(t.tr.lift(o,a).scrollIntoView()),!0)}let s=i.nodeBefore;if(L2(t,i,e,-1))return!0;if(r.parent.content.size==0&&(Vs(s,"end")||ae.isSelectable(s)))for(let o=r.depth;;o--){let a=wc(t.doc,r.before(o),r.after(o),ee.empty);if(a&&a.slice.size<a.to-a.from){if(e){let l=t.tr.step(a);l.setSelection(Vs(s,"end")?he.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):ae.create(l.doc,i.pos-s.nodeSize)),e(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},tv=(t,e,n)=>{let r=k2(t,n);if(!r)return!1;let i=_p(r);return i?v2(t,i,e):!1},nv=(t,e,n)=>{let r=_2(t,n);if(!r)return!1;let i=Ip(r);return i?v2(t,i,e):!1};function v2(t,e,n){let r=e.nodeBefore,i=r,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=e.nodeAfter,a=o,l=e.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let c=a.firstChild;if(!c)return!1;a=c}let u=wc(t.doc,s,l,ee.empty);if(!u||u.from!=s||u instanceof et&&u.slice.size>=l-s)return!1;if(n){let c=t.tr.step(u);c.setSelection(ue.create(c.doc,s)),n(c.scrollIntoView())}return!0}function Vs(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const N2=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;s=_p(r)}let o=s&&s.nodeBefore;return!o||!ae.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ae.create(t.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function _p(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function _2(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const I2=(t,e,n)=>{let r=_2(t,n);if(!r)return!1;let i=Ip(r);if(!i)return!1;let s=i.nodeAfter;if(L2(t,i,e,1))return!0;if(r.parent.content.size==0&&(Vs(s,"start")||ae.isSelectable(s))){let o=wc(t.doc,r.before(),r.after(),ee.empty);if(o&&o.slice.size<o.to-o.from){if(e){let a=t.tr.step(o);a.setSelection(Vs(s,"start")?he.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):ae.create(a.doc,a.mapping.map(i.pos))),e(a.scrollIntoView())}return!0}}return s.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},R2=(t,e,n)=>{let{$head:r,empty:i}=t.selection,s=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;s=Ip(r)}let o=s&&s.nodeAfter;return!o||!ae.isSelectable(o)?!1:(e&&e(t.tr.setSelection(ae.create(t.doc,s.pos)).scrollIntoView()),!0)};function Ip(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const rv=(t,e)=>{let n=t.selection,r=n instanceof ae,i;if(r){if(n.node.isTextblock||!Qi(t.doc,n.from))return!1;i=n.from}else if(i=Sc(t.doc,n.from,-1),i==null)return!1;if(e){let s=t.tr.join(i);r&&s.setSelection(ae.create(s.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},iv=(t,e)=>{let n=t.selection,r;if(n instanceof ae){if(n.node.isTextblock||!Qi(t.doc,n.to))return!1;r=n.to}else if(r=Sc(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},sv=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),s=i&&co(i);return s==null?!1:(e&&e(t.tr.lift(i,s).scrollIntoView()),!0)},M2=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
6
+ `).scrollIntoView()),!0)};function Rp(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const ov=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),s=n.indexAfter(-1),o=Rp(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,o.createAndFill());l.setSelection(he.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},O2=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof tn||r.parent.inlineContent||i.parent.inlineContent)return!1;let s=Rp(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=t.tr.insert(o,s.createAndFill());a.setSelection(ue.create(a.doc,o+1)),e(a.scrollIntoView())}return!0},D2=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let s=n.before();if(Ir(t.doc,s))return e&&e(t.tr.split(s).scrollIntoView()),!0}let r=n.blockRange(),i=r&&co(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function av(t){return(e,n)=>{if(e.selection instanceof ae&&e.selection.node.isBlock){let{$from:h}=e.selection;return!h.parentOffset||!Ir(e.doc,h.pos)?!1:(n&&n(e.tr.split(h.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let r=e.tr;!e.selection.empty&&(e.selection instanceof ue||e.selection instanceof tn)&&r.deleteSelection();let{$from:i}=r.selection,s=r.steps.length,o=[],a,l,u=!1,c=!1;for(let h=i.depth;;h--)if(i.node(h).isBlock){u=i.end(h)==i.pos+(i.depth-h),c=i.start(h)==i.pos-(i.depth-h),l=Rp(i.node(h-1).contentMatchAt(i.indexAfter(h-1))),o.unshift(u&&l?{type:l}:null),a=h;break}else{if(h==1)return!1;o.unshift(null)}let d=i.pos,f=Ir(r.doc,d,o.length,o);if(f||(o[0]=l?{type:l}:null,f=Ir(r.doc,d,o.length,o)),!f)return!1;if(r.split(d,o.length,o),!u&&c&&i.node(a).type!=l){let h=r.mapping.slice(s),p=h.map(i.before(a)),g=r.doc.resolve(p);l&&i.node(a-1).canReplaceWith(g.index(),g.index()+1,l)&&r.setNodeMarkup(h.map(i.before(a)),l)}return n&&n(r.scrollIntoView()),!0}}const lv=av(),uv=(t,e)=>{let{$from:n,to:r}=t.selection,i,s=n.sharedDepth(r);return s==0?!1:(i=n.before(s),e&&e(t.tr.setSelection(ae.create(t.doc,i))),!0)};function cv(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,s=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(s-1,s)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||Qi(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function L2(t,e,n,r){let i=e.nodeBefore,s=e.nodeAfter,o,a,l=i.type.spec.isolating||s.type.spec.isolating;if(!l&&cv(t,e,n))return!0;let u=!l&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(o=(a=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&a.matchType(o[0]||s.type).validEnd){if(n){let h=e.pos+s.nodeSize,p=q.empty;for(let y=o.length-1;y>=0;y--)p=q.from(o[y].create(null,p));p=q.from(i.copy(p));let g=t.tr.step(new pt(e.pos-1,h,e.pos,h,new ee(p,1,0),o.length,!0)),b=g.doc.resolve(h+2*o.length);b.nodeAfter&&b.nodeAfter.type==i.type&&Qi(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let c=s.type.spec.isolating||r>0&&l?null:he.findFrom(e,1),d=c&&c.$from.blockRange(c.$to),f=d&&co(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(u&&Vs(s,"start",!0)&&Vs(i,"end")){let h=i,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let g=s,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(n){let y=q.empty;for(let T=p.length-1;T>=0;T--)y=q.from(p[T].copy(y));let E=t.tr.step(new pt(e.pos-p.length,e.pos+s.nodeSize,e.pos+b,e.pos+s.nodeSize-b,new ee(y,p.length,0),0,!0));n(E.scrollIntoView())}return!0}}return!1}function P2(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(n&&n(e.tr.setSelection(ue.create(e.doc,t<0?i.start(s):i.end(s)))),!0):!1}}const dv=P2(-1),fv=P2(1);function hv(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s),a=o&&f2(o,t,e);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function yg(t,e=null){return function(n,r){let i=!1;for(let s=0;s<n.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[s];n.doc.nodesBetween(o,a,(l,u)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)i=!0;else{let c=n.doc.resolve(u),d=c.index();i=c.parent.canReplaceWith(d,d+1,t)}})}if(!i)return!1;if(r){let s=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];s.setBlockType(a,l,t,e)}r(s.scrollIntoView())}return!0}}function Mp(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}Mp(w2,A2,N2);Mp(w2,I2,R2);Mp(M2,O2,D2,lv);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function pv(t,e=null){return function(n,r){let{$from:i,$to:s}=n.selection,o=i.blockRange(s);if(!o)return!1;let a=r?n.tr:null;return mv(a,o,t,e)?(r&&r(a.scrollIntoView()),!0):!1}}function mv(t,e,n,r=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let l=o.resolve(e.start-2);s=new Au(l,l,e.depth),e.endIndex<e.parent.childCount&&(e=new Au(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let a=f2(s,n,r,e);return a?(t&&gv(t,e,a,i,n),!0):!1}function gv(t,e,n,r,i){let s=q.empty;for(let c=n.length-1;c>=0;c--)s=q.from(n[c].type.create(n[c].attrs,s));t.step(new pt(e.start-(r?2:0),e.end,e.start,e.end,new ee(s,0,0),n.length,!0));let o=0;for(let c=0;c<n.length;c++)n[c].type==i&&(o=c+1);let a=n.length-o,l=e.start+n.length-(r?2:0),u=e.parent;for(let c=e.startIndex,d=e.endIndex,f=!0;c<d;c++,f=!1)!f&&Ir(t.doc,l,a)&&(t.split(l,a),l+=2*a),l+=u.child(c).nodeSize;return t}function bv(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,o=>o.childCount>0&&o.firstChild.type==t);return s?n?r.node(s.depth-1).type==t?yv(e,n,t,s):Ev(e,n,s):!0:!1}}function yv(t,e,n,r){let i=t.tr,s=r.end,o=r.$to.end(r.depth);s<o&&(i.step(new pt(s-1,o,s,o,new ee(q.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Au(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));const a=co(r);if(a==null)return!1;i.lift(r,a);let l=i.doc.resolve(i.mapping.map(s,-1)-1);return Qi(i.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&i.join(l.pos),e(i.scrollIntoView()),!0}function Ev(t,e,n){let r=t.tr,i=n.parent;for(let h=n.end,p=n.endIndex-1,g=n.startIndex;p>g;p--)h-=i.child(p).nodeSize,r.delete(h-1,h+1);let s=r.doc.resolve(n.start),o=s.nodeAfter;if(r.mapping.map(n.end)!=n.start+s.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==i.childCount,u=s.node(-1),c=s.index(-1);if(!u.canReplace(c+(a?0:1),c+1,o.content.append(l?q.empty:q.from(i))))return!1;let d=s.pos,f=d+o.nodeSize;return r.step(new pt(d-(a?1:0),f+(l?1:0),d+1,f-1,new ee((a?q.empty:q.from(i.copy(q.empty))).append(l?q.empty:q.from(i.copy(q.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function Tv(t){return function(e,n){let{$from:r,$to:i}=e.selection,s=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==t);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let a=s.parent,l=a.child(o-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=q.from(u?t.create():null),d=new ee(q.from(t.create(null,q.from(a.type.create(null,c)))),u?3:1,0),f=s.start,h=s.end;n(e.tr.step(new pt(f-(u?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}const Ct=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},zs=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ch=null;const wr=function(t,e,n){let r=ch||(ch=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Cv=function(){ch=null},$i=function(t,e,n,r){return n&&(Eg(t,e,n,r,-1)||Eg(t,e,n,r,1))},xv=/^(img|br|input|textarea|hr)$/i;function Eg(t,e,n,r,i){for(var s;;){if(t==n&&e==r)return!0;if(e==(i<0?0:vn(t))){let o=t.parentNode;if(!o||o.nodeType!=1||Ga(t)||xv.test(t.nodeName)||t.contentEditable=="false")return!1;e=Ct(t)+(i<0?0:1),t=o}else if(t.nodeType==1){let o=t.childNodes[e+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((s=o.pmViewDesc)===null||s===void 0)&&s.ignoreForSelection)e+=i;else return!1;else t=o,e=i<0?vn(t):0}else return!1}}function vn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Sv(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=vn(t)}else if(t.parentNode&&!Ga(t))e=Ct(t),t=t.parentNode;else return null}}function wv(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Ga(t))e=Ct(t)+1,t=t.parentNode;else return null}}function kv(t,e,n){for(let r=e==0,i=e==vn(t);r||i;){if(t==n)return!0;let s=Ct(t);if(t=t.parentNode,!t)return!1;r=r&&s==0,i=i&&s==vn(t)}}function Ga(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Ac=function(t){return t.focusNode&&$i(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ki(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Av(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function vv(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(vn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(vn(r.startContainer),r.startOffset)}}}const cr=typeof navigator<"u"?navigator:null,Tg=typeof document<"u"?document:null,pi=cr&&cr.userAgent||"",dh=/Edge\/(\d+)/.exec(pi),B2=/MSIE \d/.exec(pi),fh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pi),nn=!!(B2||fh||dh),ni=B2?document.documentMode:fh?+fh[1]:dh?+dh[1]:0,In=!nn&&/gecko\/(\d+)/i.test(pi);In&&+(/Firefox\/(\d+)/.exec(pi)||[0,0])[1];const hh=!nn&&/Chrome\/(\d+)/.exec(pi),St=!!hh,F2=hh?+hh[1]:0,It=!nn&&!!cr&&/Apple Computer/.test(cr.vendor),js=It&&(/Mobile\/\w+/.test(pi)||!!cr&&cr.maxTouchPoints>2),wn=js||(cr?/Mac/.test(cr.platform):!1),H2=cr?/Win/.test(cr.platform):!1,Ar=/Android \d/.test(pi),Xa=!!Tg&&"webkitFontSmoothing"in Tg.documentElement.style,Nv=Xa?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function _v(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function Cr(t,e){return typeof t=="number"?t:t[e]}function Iv(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function Cg(t,e,n){if(!ph(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,s=t.dom.ownerDocument;for(let o=n||t.dom;o;){if(o.nodeType!=1){o=zs(o);continue}let a=o,l=a==s.body,u=l?_v(s):Iv(a),c=0,d=0;if(e.top<u.top+Cr(r,"top")?d=-(u.top-e.top+Cr(i,"top")):e.bottom>u.bottom-Cr(r,"bottom")&&(d=e.bottom-e.top>u.bottom-u.top?e.top+Cr(i,"top")-u.top:e.bottom-u.bottom+Cr(i,"bottom")),e.left<u.left+Cr(r,"left")?c=-(u.left-e.left+Cr(i,"left")):e.right>u.right-Cr(r,"right")&&(c=e.right-u.right+Cr(i,"right")),c||d)if(l)s.defaultView.scrollBy(c,d);else{let h=a.scrollLeft,p=a.scrollTop;d&&(a.scrollTop+=d),c&&(a.scrollLeft+=c);let g=a.scrollLeft-h,b=a.scrollTop-p;e={left:e.left-g,top:e.top-b,right:e.right-g,bottom:e.bottom-b}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:zs(o)}}function Rv(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let s=(e.left+e.right)/2,o=n+1;o<Math.min(innerHeight,e.bottom);o+=5){let a=t.root.elementFromPoint(s,o);if(!a||a==t.dom||!t.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:U2(t.dom)}}function U2(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=zs(r));return e}function Mv({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;$2(n,r==0?0:r-e)}function $2(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:s}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let ss=null;function Ov(t){if(t.setActive)return t.setActive();if(ss)return t.focus(ss);let e=U2(t);t.focus(ss==null?{get preventScroll(){return ss={preventScroll:!0},!0}}:void 0),ss||(ss=!1,$2(e,0))}function V2(t,e){let n,r=2e8,i,s=0,o=e.top,a=e.top,l,u;for(let c=t.firstChild,d=0;c;c=c.nextSibling,d++){let f;if(c.nodeType==1)f=c.getClientRects();else if(c.nodeType==3)f=wr(c).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=o&&p.bottom>=a){o=Math.max(p.bottom,o),a=Math.min(p.top,a);let g=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(g<r){n=c,r=g,i=g&&n.nodeType==3?{left:p.right<e.left?p.right:p.left,top:e.top}:e,c.nodeType==1&&g&&(s=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!l&&p.left<=e.left&&p.right>=e.left&&(l=c,u={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(s=d+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?Dv(n,i):!n||r&&n.nodeType==1?{node:t,offset:s}:V2(n,i)}function Dv(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let s=0;s<n;s++){r.setEnd(t,s+1),r.setStart(t,s);let o=Vr(r,1);if(o.top!=o.bottom&&Op(e,o)){i={node:t,offset:s+(e.left>=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function Op(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Lv(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Pv(t,e,n){let{node:r,offset:i}=V2(e,n),s=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();s=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return t.docView.posFromDOM(r,i,s)}function Bv(t,e,n,r){let i=-1;for(let s=e,o=!1;s!=t.dom;){let a=t.docView.nearestDesc(s,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(i=a.posAfter),o=!0),!a.contentDOM&&i<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;s=a.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function z2(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),s=i;;){let o=t.childNodes[s];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let u=a[l];if(Op(e,u))return z2(o,e,u)}}if((s=(s+1)%r)==i)break}return t}function Fv(t,e){let n=t.dom.ownerDocument,r,i=0,s=vv(n,e.left,e.top);s&&({node:r,offset:i}=s);let o=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),a;if(!o||!t.dom.contains(o.nodeType!=1?o.parentNode:o)){let u=t.dom.getBoundingClientRect();if(!Op(e,u)||(o=z2(t.dom,e,u),!o))return null}if(It)for(let u=o;r&&u;u=zs(u))u.draggable&&(r=void 0);if(o=Lv(o,e),r){if(In&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let c=r.childNodes[i],d;c.nodeName=="IMG"&&(d=c.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&i++}let u;Xa&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(a=Bv(t,r,i,e))}a==null&&(a=Pv(t,o,e));let l=t.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function ph(t){return t.top<t.bottom||t.left<t.right}function Vr(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(ph(r))return r}return Array.prototype.find.call(n,ph)||t.getBoundingClientRect()}const Hv=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function j2(t,e,n){let{node:r,offset:i,atom:s}=t.docView.domFromPos(e,n<0?-1:1),o=Xa||In;if(r.nodeType==3)if(o&&(Hv.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let l=Vr(wr(r,i,i),n);if(In&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let u=Vr(wr(r,i-1,i-1),-1);if(u.top==l.top){let c=Vr(wr(r,i,i+1),-1);if(c.top!=l.top)return Bo(c,c.left<u.left)}}return l}else{let l=i,u=i,c=n<0?1:-1;return n<0&&!i?(u++,c=-1):n>=0&&i==r.nodeValue.length?(l--,c=1):n<0?l--:u++,Bo(Vr(wr(r,l,u),c),c<0)}if(!t.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&i&&(n<0||i==vn(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return Pd(l.getBoundingClientRect(),!1)}if(s==null&&i<vn(r)){let l=r.childNodes[i];if(l.nodeType==1)return Pd(l.getBoundingClientRect(),!0)}return Pd(r.getBoundingClientRect(),n>=0)}if(s==null&&i&&(n<0||i==vn(r))){let l=r.childNodes[i-1],u=l.nodeType==3?wr(l,vn(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return Bo(Vr(u,1),!1)}if(s==null&&i<vn(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let u=l?l.nodeType==3?wr(l,0,o?0:1):l.nodeType==1?l:null:null;if(u)return Bo(Vr(u,-1),!0)}return Bo(Vr(r.nodeType==3?wr(r):r,-n),n>=0)}function Bo(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Pd(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function W2(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function Uv(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return W2(t,e,()=>{let{node:s}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(s,!0);if(!a)break;if(a.node.isBlock){s=a.contentDOM||a.dom;break}s=a.dom.parentNode}let o=j2(t,i.pos,1);for(let a=s.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=wr(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;u<l.length;u++){let c=l[u];if(c.bottom>c.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}const $v=/[\u0590-\u08ac]/;function Vv(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,s=!i,o=i==r.parent.content.size,a=t.domSelection();return a?!$v.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?s:o:W2(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:d}=t.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:g}=t.domSelectionRange(),b=p&&!h.contains(p.nodeType==1?p:p.parentNode)||l==p&&u==g;try{a.collapse(c,d),l&&(l!=c||u!=d)&&a.extend&&a.extend(l,u)}catch{}return f!=null&&(a.caretBidiLevel=f),b}):r.pos==r.start()||r.pos==r.end()}let xg=null,Sg=null,wg=!1;function zv(t,e,n){return xg==e&&Sg==n?wg:(xg=e,Sg=n,wg=n=="up"||n=="down"?Uv(t,e,n):Vv(t,e,n))}const Rn=0,kg=1,Ni=2,$n=3;class Qa{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=Rn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].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 n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.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,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,o;if(e==this.contentDOM)s=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(o)+o.size:this.posAtStart}else{let s,o;if(e==this.contentDOM)s=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((o=s.pmViewDesc)&&o.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(o):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>Ct(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!1;break}if(s.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){i=!0;break}if(s.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let s=this.getDesc(i),o;if(s&&(!n||s.node))if(r&&(o=s.nodeDOM)&&!(o.nodeType==1?o.contains(e.nodeType==1?e:e.parentNode):o==e))r=!1;else return s}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let s=this.getDesc(i);if(s)return s.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],s=r+i.size;if(r==e&&s!=r){for(;!i.border&&i.children.length;)for(let o=0;o<i.children.length;o++){let a=i.children[o];if(a.size){i=a;break}}return i}if(e<s)return i.descAt(e-r-i.border);r=s}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let s=0;r<this.children.length;r++){let o=this.children[r],a=s+o.size;if(a>e||o instanceof Y2){i=e-s;break}s=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof q2&&s.side>=0;r--);if(n<=0){let s,o=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,o=!1);return s&&n&&o&&!s.border&&!s.domAtom?s.domFromPos(s.size,n):{node:this.contentDOM,offset:s?Ct(s.dom)+1:0}}else{let s,o=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,o=!1);return s&&o&&!s.border&&!s.domAtom?s.domFromPos(0,n):{node:this.contentDOM,offset:s?Ct(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,s=-1;for(let o=r,a=0;;a++){let l=this.children[a],u=o+l.size;if(i==-1&&e<=u){let c=o+l.border;if(e>=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){i=Ct(f.dom)+1;break}e-=f.size}i==-1&&(i=0)}if(i>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;c<this.children.length;c++){let d=this.children[c];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){s=Ct(d.dom);break}n+=d.size}s==-1&&(s=this.contentDOM.childNodes.length);break}o=u}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let s=Math.min(e,n),o=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let g=this.children[h],b=p+g.size;if(s>p&&o<b)return g.setSelection(e-p-g.border,n-p-g.border,r,i);p=b}let a=this.domFromPos(e,e?-1:1),l=n==e?a:this.domFromPos(n,n?-1:1),u=r.root.getSelection(),c=r.domSelectionRange(),d=!1;if((In||It)&&e==n){let{node:h,offset:p}=a;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
7
+ `),d&&p==h.nodeValue.length)for(let g=h,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:Ct(b)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=h.childNodes[p-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(In&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&&It)&&$i(a.node,a.offset,c.anchorNode,c.anchorOffset)&&$i(l.node,l.offset,c.focusNode,c.focusOffset))return;let f=!1;if((u.extend||e==n)&&!(d&&In)){u.collapse(a.node,a.offset);try{e!=n&&u.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(e>n){let p=a;a=l,l=p}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let s=this.children[i],o=r+s.size;if(r==o?e<=o&&n>=r:e<o&&n>r){let a=r+s.border,l=o-s.border;if(e>=a&&n<=l){this.dirty=e==r||n==o?Ni:kg,e==a&&n==l&&(s.contentLost||s.dom.parentNode!=this.contentDOM)?s.dirty=$n:s.markDirty(e-a,n-a);return}else s.dirty=s.dom==s.contentDOM&&s.dom.parentNode==this.contentDOM&&!s.children.length?Ni:$n}r=o}this.dirty=Ni}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?Ni:kg;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class q2 extends Qa{constructor(e,n,r,i){let s,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!s)return i;if(s.parent)return s.parent.posBeforeChild(s)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.hasAttribute("contenteditable")||(o.contentEditable="false"),o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=n,this.widget=n,s=this}matchesWidget(e){return this.dirty==Rn&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class jv extends Qa{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class ri extends Qa{constructor(e,n,r,i,s){super(e,[],r,i),this.mark=n,this.spec=s}static create(e,n,r,i){let s=i.nodeViews[n.type.name],o=s&&s(n,i,r);return(!o||!o.dom)&&(o=Xi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new ri(e,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&$n||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=$n&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Rn){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Rn}}slice(e,n,r){let i=ri.create(this.parent,this.mark,!0,r),s=this.children,o=this.size;n<o&&(s=gh(s,n,o,r)),e>0&&(s=gh(s,0,e,r));for(let a=0;a<s.length;a++)s[a].parent=i;return i.children=s,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ii extends Qa{constructor(e,n,r,i,s,o,a){super(e,[],s,o),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a}static create(e,n,r,i,s,o){let a=s.nodeViews[n.type.name],l,u=a&&a(n,s,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,d=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:d}=Xi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let f=c;return c=X2(c,r,n),u?l=new Wv(e,n,r,i,c,d||null,f,u):n.isText?new vc(e,n,r,i,c,f):new ii(e,n,r,i,c,d||null,f)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let n={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(n.preserveWhitespace="full"),!this.contentDOM)n.getContent=()=>this.node.content;else if(!this.contentLost)n.contentElement=this.contentDOM;else{for(let r=this.children.length-1;r>=0;r--){let i=this.children[r];if(this.dom.contains(i.dom.parentNode)){n.contentElement=i.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(i=>i.nodeType==1&&e.indexOf(i.parentNode)<0&&this.dom.contains(i));r?n.contentElement=r:n.getContent=()=>q.empty}}return n}matchesNode(e,n,r){return this.dirty==Rn&&e.eq(this.node)&&Nu(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,s=e.composing?this.localCompositionInfo(e,n):null,o=s&&s.pos>-1?s:null,a=s&&s.pos<0,l=new Yv(this,o&&o.node,e);Xv(this.node,this.innerDeco,(u,c,d)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e,c):u.type.side>=0&&!d&&l.syncToMarks(c==this.node.childCount?$e.none:this.node.child(c).marks,r,e,c),l.placeWidget(u,e,i)},(u,c,d,f)=>{l.syncToMarks(u.marks,r,e,f);let h;l.findNodeMatch(u,c,d,f)||a&&e.state.selection.from>i&&e.state.selection.to<i+u.nodeSize&&(h=l.findIndexWithChild(s.node))>-1&&l.updateNodeAt(u,c,d,h,e)||l.updateNextNode(u,c,d,e,f,i)||l.addNode(u,c,d,e,i),i+=u.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==Ni)&&(o&&this.protectLocalComposition(e,o),K2(this.contentDOM,this.children,e),js&&Qv(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof ue)||r<n||i>n+this.node.content.size)return null;let s=e.input.compositionNode;if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let o=s.nodeValue,a=Zv(this.node.content,o,r-n,i-n);return a<0?null:{node:s,pos:a,text:o}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let s=n;for(;s.parentNode!=this.contentDOM;s=s.parentNode){for(;s.previousSibling;)s.parentNode.removeChild(s.previousSibling);for(;s.nextSibling;)s.parentNode.removeChild(s.nextSibling);s.pmViewDesc&&(s.pmViewDesc=void 0)}let o=new jv(this,s,n,i);e.input.compositionNodes.push(o),this.children=gh(this.children,r,r+i.length,e,o)}update(e,n,r,i){return this.dirty==$n||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Rn}updateOuterDeco(e){if(Nu(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=G2(this.dom,this.nodeDOM,mh(this.outerDeco,this.node,n),mh(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ag(t,e,n,r,i){X2(r,e,t);let s=new ii(void 0,t,e,n,r,r,r);return s.contentDOM&&s.updateChildren(i,0),s}class vc extends ii{constructor(e,n,r,i,s,o){super(e,n,r,i,s,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==$n||this.dirty!=Rn&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Rn||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=Rn,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),s=document.createTextNode(i.text);return new vc(this.parent,i,this.outerDeco,this.innerDeco,s,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=$n)}get domAtom(){return!1}isText(e){return this.node.text==e}}class Y2 extends Qa{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Rn&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Wv extends ii{constructor(e,n,r,i,s,o,a,l){super(e,n,r,i,s,o,a),this.spec=l}update(e,n,r,i){if(this.dirty==$n)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let s=this.spec.update(e,n,r);return s&&this.updateInner(e,n,r,i),s}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function K2(t,e,n){let r=t.firstChild,i=!1;for(let s=0;s<e.length;s++){let o=e[s],a=o.dom;if(a.parentNode==t){for(;a!=r;)r=vg(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(a,r);if(o instanceof ri){let l=r?r.previousSibling:t.lastChild;K2(o.contentDOM,o.children,n),r=l?l.nextSibling:t.firstChild}}for(;r;)r=vg(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const na=function(t){t&&(this.nodeName=t)};na.prototype=Object.create(null);const _i=[new na];function mh(t,e,n){if(t.length==0)return _i;let r=n?_i[0]:new na,i=[r];for(let s=0;s<t.length;s++){let o=t[s].type.attrs;if(o){o.nodeName&&i.push(r=new na(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&i.length==1&&i.push(r=new na(e.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function G2(t,e,n,r){if(n==_i&&r==_i)return e;let i=e;for(let s=0;s<r.length;s++){let o=r[s],a=n[s];if(s){let l;a&&a.nodeName==o.nodeName&&i!=t&&(l=i.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=_i[0]),i=l}qv(i,a||_i[0],o)}return i}function qv(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let s=0;s<r.length;s++)i.indexOf(r[s])==-1&&t.classList.remove(r[s]);for(let s=0;s<i.length;s++)r.indexOf(i[s])==-1&&t.classList.add(i[s]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function X2(t,e,n){return G2(t,t,_i,mh(e,n,t.nodeType!=1))}function Nu(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function vg(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Yv{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Kv(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r,i){let s=0,o=this.stack.length>>1,a=Math.min(o,e.length);for(;s<a&&(s==o-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<o;)this.destroyRest(),this.top.dirty=Rn,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let l=-1,u=this.top.children.length;i<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let c=this.index;c<u;c++){let d=this.top.children[c];if(d.matchesMark(e[o])&&!this.isLocked(d.dom)){l=c;break}}if(l<0&&this.index<this.top.children.length){let c=this.top.children[this.index];c instanceof ri&&c.dirty!=$n&&c.mark.type==e[o].type&&c.spec.update&&!this.isLocked(c.dom)&&c.spec.update(e[o])&&(c.mark=e[o],l=this.index,this.changed=!0)}if(l>-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=ri.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let s=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(e,n,r))s=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let u=this.top.children[a];if(u.matchesNode(e,n,r)&&!this.preMatch.matched.has(u)){s=a;break}}return s<0?!1:(this.destroyBetween(this.index,s),this.index++,!0)}updateNodeAt(e,n,r,i,s){let o=this.top.children[i];return o.dirty==$n&&o.dom==o.contentDOM&&(o.dirty=Ni),o.update(e,n,r,s)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,s,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof ii){let u=this.preMatch.matched.get(l);if(u!=null&&u!=s)return!1;let c=l.dom,d,f=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&l.dirty!=$n&&Nu(n,l.outerDeco));if(!f&&l.update(e,n,r,i))return this.destroyBetween(this.index,a),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,e,n,r,i,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=Ni,d.updateChildren(i,o+1),d.dirty=Rn),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,s,o){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Nu(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let a=ii.create(this.top,n,r,i,s,o);if(a.contentDOM){a.children=e.children,e.children=[];for(let l of a.children)l.parent=a}return e.destroy(),a}addNode(e,n,r,i,s){let o=ii.create(this.top,e,n,r,i,s);o.contentDOM&&o.updateChildren(i,s+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let s=new q2(this.top,e,n,r);this.top.children.splice(this.index++,0,s),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ri;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof vc)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((It||St)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Y2(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Kv(t,e){let n=e,r=n.children.length,i=t.childCount,s=new Map,o=[];e:for(;i>0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof ri)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,s.set(a,i),o.push(a)}}return{index:i,matched:s,matches:o.reverse()}}function Gv(t,e){return t.type.side-e.type.side}function Xv(t,e,n,r){let i=e.locals(t),s=0;if(i.length==0){for(let u=0;u<t.childCount;u++){let c=t.child(u);r(c,i,e.forChild(s,c),u),s+=c.nodeSize}return}let o=0,a=[],l=null;for(let u=0;;){let c,d;for(;o<i.length&&i[o].to==s;){let b=i[o++];b.widget&&(c?(d||(d=[c])).push(b):c=b)}if(c)if(d){d.sort(Gv);for(let b=0;b<d.length;b++)n(d[b],u,!!l)}else n(c,u,!!l);let f,h;if(l)h=-1,f=l,l=null;else if(u<t.childCount)h=u,f=t.child(u++);else break;for(let b=0;b<a.length;b++)a[b].to<=s&&a.splice(b--,1);for(;o<i.length&&i[o].from<=s&&i[o].to>s;)a.push(i[o++]);let p=s+f.nodeSize;if(f.isText){let b=p;o<i.length&&i[o].from<b&&(b=i[o].from);for(let y=0;y<a.length;y++)a[y].to<b&&(b=a[y].to);b<p&&(l=f.cut(b-s),f=f.cut(0,b-s),p=b,h=-1)}else for(;o<i.length&&i[o].to<p;)o++;let g=f.isInline&&!f.isLeaf?a.filter(b=>!b.inline):a.slice();r(f,g,e.forChild(s,f),h),s=p}}function Qv(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Zv(t,e,n,r){for(let i=0,s=0;i<t.childCount&&s<=r;){let o=t.child(i++),a=s;if(s+=o.nodeSize,!o.isText)continue;let l=o.text;for(;i<t.childCount;){let u=t.child(i++);if(s+=u.nodeSize,!u.isText)break;l+=u.text}if(s>=n){if(s>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a<r?l.lastIndexOf(e,r-a-1):-1;if(u>=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function gh(t,e,n,r,i){let s=[];for(let o=0,a=0;o<t.length;o++){let l=t[o],u=a,c=a+=l.size;u>=n||c<=e?s.push(l):(u<e&&s.push(l.slice(0,e-u,r)),i&&(s.push(i),i=void 0),c>n&&s.push(l.slice(n-u,l.size,r)))}return s}function Dp(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),s=i&&i.size==0,o=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,u;if(Ac(n)){for(l=o;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&ae.isSelectable(d)&&i.parent&&!(d.isInline&&kv(n.focusNode,n.focusOffset,i.dom))){let f=i.posBefore;u=new ae(o==f?a:r.resolve(f))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let h=0;h<n.rangeCount;h++){let p=n.getRangeAt(h);d=Math.min(d,t.docView.posFromDOM(p.startContainer,p.startOffset,1)),f=Math.max(f,t.docView.posFromDOM(p.endContainer,p.endOffset,-1))}if(d<0)return null;[l,o]=f==t.state.selection.anchor?[f,d]:[d,f],a=r.resolve(o)}else l=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let c=r.resolve(l);if(!u){let d=e=="pointer"||t.state.selection.head<a.pos&&!s?1:-1;u=Lp(t,c,a,d)}return u}function Q2(t){return t.editable?t.hasFocus():J2(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function Rr(t,e=!1){let n=t.state.selection;if(Z2(t,n),!Q2(t))return;let r=t.input.mouseDown;if(!e&&St&&r){let i=t.domSelectionRange(),s=t.domObserver.currentSelection;if(i.anchorNode&&s.anchorNode&&$i(i.anchorNode,i.anchorOffset,s.anchorNode,s.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)eN(t);else{let{anchor:i,head:s}=n,o,a;Ng&&!(n instanceof ue)&&(n.$from.parent.inlineContent||(o=_g(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(a=_g(t,n.to))),t.docView.setSelection(i,s,t,e),Ng&&(o&&Ig(o),a&&Ig(a)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Jv(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}const Ng=It||St&&F2<63;function _g(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,s=r?n.childNodes[r-1]:null;if(It&&i&&i.contentEditable=="false")return Bd(i);if((!i||i.contentEditable=="false")&&(!s||s.contentEditable=="false")){if(i)return Bd(i);if(s)return Bd(s)}}function Bd(t){return t.contentEditable="true",It&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function Ig(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function Jv(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Q2(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function eN(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,Ct(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&nn&&ni<=11&&(n.disabled=!0,n.disabled=!1)}function Z2(t,e){if(e instanceof ae){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Rg(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Rg(t)}function Rg(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Lp(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||ue.between(e,n,r)}function Mg(t){return t.editable&&!t.hasFocus()?!1:J2(t)}function J2(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function tN(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return $i(e.node,e.offset,n.anchorNode,n.anchorOffset)}function bh(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),s=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return s&&he.findFrom(s,e)}function Wr(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Og(t,e,n){let r=t.state.selection;if(r instanceof ue)if(n.indexOf("s")>-1){let{$head:i}=r,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;let o=t.state.doc.resolve(i.pos+s.nodeSize*(e<0?-1:1));return Wr(t,new ue(r.$anchor,o))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=bh(t.state,e);return i&&i instanceof ae?Wr(t,i):!1}else if(!(wn&&n.indexOf("m")>-1)){let i=r.$head,s=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,o;if(!s||s.isText)return!1;let a=e<0?i.pos-s.nodeSize:i.pos;return s.isAtom||(o=t.docView.descAt(a))&&!o.contentDOM?ae.isSelectable(s)?Wr(t,new ae(e<0?t.state.doc.resolve(i.pos-s.nodeSize):i)):Xa?Wr(t,new ue(t.state.doc.resolve(e<0?a:a+s.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ae&&r.node.isInline)return Wr(t,new ue(e>0?r.$to:r.$from));{let i=bh(t.state,e);return i?Wr(t,i):!1}}}function _u(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ra(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function as(t,e){return e<0?nN(t):rN(t)}function nN(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,s,o=!1;for(In&&n.nodeType==1&&r<_u(n)&&ra(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(ra(a,-1))i=n,s=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(eT(n))break;{let a=n.previousSibling;for(;a&&ra(a,-1);)i=n.parentNode,s=Ct(a),a=a.previousSibling;if(a)n=a,r=_u(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}o?yh(t,n,r):i&&yh(t,i,s)}function rN(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=_u(n),s,o;for(;;)if(r<i){if(n.nodeType!=1)break;let a=n.childNodes[r];if(ra(a,1))s=n,o=++r;else break}else{if(eT(n))break;{let a=n.nextSibling;for(;a&&ra(a,1);)s=a.parentNode,o=Ct(a)+1,a=a.nextSibling;if(a)n=a,r=0,i=_u(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}s&&yh(t,s,o)}function eT(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function iN(t,e){for(;t&&e==t.childNodes.length&&!Ga(t);)e=Ct(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function sN(t,e){for(;t&&!e&&!Ga(t);)e=Ct(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function yh(t,e,n){if(e.nodeType!=3){let s,o;(o=iN(e,n))?(e=o,n=0):(s=sN(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Ac(r)){let s=document.createRange();s.setEnd(e,n),s.setStart(e,n),r.removeAllRanges(),r.addRange(s)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&Rr(t)},50)}function Dg(t,e){let n=t.state.doc.resolve(e);if(!(St||H2)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left<i.left?"ltr":"rtl"}if(e<n.end()){let s=t.coordsAtPos(e+1),o=(s.top+s.bottom)/2;if(o>i.top&&o<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function Lg(t,e,n){let r=t.state.selection;if(r instanceof ue&&!r.empty||n.indexOf("s")>-1||wn&&n.indexOf("m")>-1)return!1;let{$from:i,$to:s}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let o=bh(t.state,e);if(o&&o instanceof ae)return Wr(t,o)}if(!i.parent.inlineContent){let o=e<0?i:s,a=r instanceof tn?he.near(o,e):he.findFrom(o,e);return a?Wr(t,a):!1}return!1}function Pg(t,e){if(!(t.state.selection instanceof ue))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Bg(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function oN(t){if(!It||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Bg(t,r,"true"),setTimeout(()=>Bg(t,r,"false"),20)}return!1}function aN(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function lN(t,e){let n=e.keyCode,r=aN(e);if(n==8||wn&&n==72&&r=="c")return Pg(t,-1)||as(t,-1);if(n==46&&!e.shiftKey||wn&&n==68&&r=="c")return Pg(t,1)||as(t,1);if(n==13||n==27)return!0;if(n==37||wn&&n==66&&r=="c"){let i=n==37?Dg(t,t.state.selection.from)=="ltr"?-1:1:-1;return Og(t,i,r)||as(t,i)}else if(n==39||wn&&n==70&&r=="c"){let i=n==39?Dg(t,t.state.selection.from)=="ltr"?1:-1:1;return Og(t,i,r)||as(t,i)}else{if(n==38||wn&&n==80&&r=="c")return Lg(t,-1,r)||as(t,-1);if(n==40||wn&&n==78&&r=="c")return oN(t)||Lg(t,1,r)||as(t,1);if(r==(wn?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Pp(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:i,openEnd:s}=e;for(;i>1&&s>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,s--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=t.someProp("clipboardSerializer")||Xi.fromSchema(t.state.schema),a=oT(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let u=l.firstChild,c,d=0;for(;u&&u.nodeType==1&&(c=sT[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let p=a.createElement(c[h]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),d++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${s}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
8
+
9
+ `);return{dom:l,text:f,slice:e}}function tT(t,e,n,r,i){let s=i.parent.type.spec.code,o,a;if(!n&&!e)return null;let l=!!e&&(r||s||!n);if(l){if(t.someProp("transformPastedText",f=>{e=f(e,s||r,t)}),s)return a=new ee(q.from(t.state.schema.text(e.replace(/\r\n?/g,`
10
+ `))),0,0),t.someProp("transformPasted",f=>{a=f(a,t,!0)}),a;let d=t.someProp("clipboardTextParser",f=>f(e,i,r,t));if(d)a=d;else{let f=i.marks(),{schema:h}=t.state,p=Xi.fromSchema(h);o=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=o.appendChild(document.createElement("p"));g&&b.appendChild(p.serializeNode(h.text(g,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),o=fN(n),Xa&&hN(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let d=+c[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||ea.fromSchema(t.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!uN.test(f.parentNode.nodeName)?{ignore:!0}:null}})),c)a=pN(Fg(a,+c[1],+c[2]),c[4]);else if(a=ee.maxOpen(cN(a.content,i),!0),a.openStart||a.openEnd){let d=0,f=0;for(let h=a.content.firstChild;d<a.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=a.content.lastChild;f<a.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);a=Fg(a,d,f)}return t.someProp("transformPasted",d=>{a=d(a,t,l)}),a}const uN=/^(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 cN(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),s,o=[];if(t.forEach(a=>{if(!o)return;let l=i.findWrapping(a.type),u;if(!l)return o=null;if(u=o.length&&s.length&&rT(l,s,a,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=iT(o[o.length-1],s.length));let c=nT(a,l);o.push(c),i=i.matchType(c.type),s=l}}),o)return q.from(o)}return t}function nT(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,q.from(t));return t}function rT(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let s=rT(t,e,n,r.lastChild,i+1);if(s)return r.copy(r.content.replaceChild(r.childCount-1,s));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(q.from(nT(n,t,i+1))))}}function iT(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,iT(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(q.empty,!0);return t.copy(n.append(r))}function Eh(t,e,n,r,i,s){let o=e<0?t.firstChild:t.lastChild,a=o.content;return t.childCount>1&&(s=0),i<r-1&&(a=Eh(a,e,n,r,i+1,s)),i>=n&&(a=e<0?o.contentMatchAt(0).fillBefore(a,s<=i).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(q.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,o.copy(a))}function Fg(t,e,n){return e<t.openStart&&(t=new ee(Eh(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ee(Eh(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const sT={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function oT(){return document.implementation.createHTMLDocument("title")}let Fo=null;function dN(t){let e=window.trustedTypes;if(!e)return t;if(!Fo){if(Fo=e.defaultPolicy)try{return Fo.createHTML(t)}catch{}Fo=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Fo.createHTML(t)}function fN(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=oT(),r=n.body,i=/<([a-z][^>\s]+)/i.exec(t),s;if((s=i&&sT[i[1].toLowerCase()])&&(t=s.map(o=>"<"+o+">").join("")+t+s.map(o=>"</"+o+">").reverse().join("")),r.innerHTML=dN(t),s)for(let o=0;o<s.length;o++)r=r.querySelector(s[o])||r;for(let o=0;o<n.styleSheets.length;o++){let a=n.styleSheets[o];for(let l=0;l<a.rules.length;l++){let u=a.rules[l];if(u instanceof CSSStyleRule){let c=r.querySelectorAll(u.selectorText);for(let d=0;d<c.length;d++)c[d].style.cssText+=u.style.cssText}}}return r}function hN(t){let e=t.querySelectorAll(St?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function pN(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:s,openEnd:o}=t;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;try{l.checkAttrs(r[a+1])}catch{break}i=q.from(l.create(r[a+1],i)),s++,o++}return new ee(i,s,o)}const $t={},Vt={},mN={touchstart:!0,touchmove:!0};class gN{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function bN(t){for(let e in $t){let n=$t[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{EN(t,r)&&!Bp(t,r)&&(t.editable||!(r.type in Vt))&&n(t,r)},mN[e]?{passive:!0}:void 0)}It&&t.dom.addEventListener("input",()=>null),Th(t)}function vr(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function yN(t){t.input.mouseDown&&t.input.mouseDown.done(),t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Th(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Bp(t,r))})}function Bp(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function EN(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function TN(t,e){!Bp(t,e)&&$t[e.type]&&(t.editable||!(e.type in Vt))&&$t[e.type](t,e)}Vt.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!cT(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Ar&&St&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),js&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,ki(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||lN(t,n)?n.preventDefault():vr(t,"key")};Vt.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Vt.keypress=(t,e)=>{let n=e;if(cT(t)||!n.charCode||n.ctrlKey&&!n.altKey||wn&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof ue)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),s=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",o=>o(t,r.$from.pos,r.$to.pos,i,s))&&t.dispatch(s()),n.preventDefault()}};function Za(t){return{left:t.clientX,top:t.clientY}}function CN(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Fp(t,e,n,r,i){if(r==-1)return!1;let s=t.state.doc.resolve(r);for(let o=s.depth+1;o>0;o--)if(t.someProp(e,a=>o>s.depth?a(t,n,s.nodeAfter,s.before(o),i,!0):a(t,n,s.node(o),s.before(o),i,!1)))return!0;return!1}function Ja(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function xN(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ae.isSelectable(r)?(Ja(t,new ae(n)),!0):!1}function SN(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof ae&&(r=n.node);let s=t.state.doc.resolve(e);for(let o=s.depth+1;o>0;o--){let a=o>s.depth?s.nodeAfter:s.node(o);if(ae.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&s.before(n.$from.depth+1)==n.$from.pos?i=s.before(n.$from.depth):i=s.before(o);break}}return i!=null?(Ja(t,ae.create(t.state.doc,i)),!0):!1}function wN(t,e,n,r,i){return Fp(t,"handleClickOn",e,n,r)||t.someProp("handleClick",s=>s(t,e,r))||(i?SN(t,n):xN(t,n))}function kN(t,e,n,r){return Fp(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function AN(t,e,n,r){return Fp(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||vN(t,n,r)}function vN(t,e,n){if(n.button!=0)return!1;let r=aT(t,e,!0),i=t.state.doc;return r?(Ja(t,r),r instanceof ue&&i.eq(t.state.doc)&&(t.input.mouseDown=new _N(t,r)),!0):!1}function aT(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?ue.create(r,0,r.content.size):null;let i=r.resolve(e);for(let s=i.depth+1;s>0;s--){let o=s>i.depth?i.nodeAfter:i.node(s),a=i.before(s);if(o.inlineContent)return ue.create(r,a+1,a+1+o.content.size);if(n&&ae.isSelectable(o))return ae.create(r,a)}return null}function Hp(t){return Iu(t)}const lT=wn?"metaKey":"ctrlKey";$t.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Hp(t),i=Date.now(),s="singleClick";i-t.input.lastClick.time<500&&CN(n,t.input.lastClick)&&!n[lT]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?s="doubleClick":t.input.lastClick.type=="doubleClick"&&(s="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:s,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let o=t.posAtCoords(Za(n));o&&(s=="singleClick"?t.input.mouseDown=new NN(t,o,n,!!r):(s=="doubleClick"?kN:AN)(t,o.pos,o.inside,n)?n.preventDefault():vr(t,"pointer"))};class uT{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){e.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class NN extends uT{constructor(e,n,r,i){super(e),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[lT],this.allowDefault=r.shiftKey;let s,o;if(n.inside>-1)s=e.state.doc.nodeAt(n.inside),o=n.inside;else{let c=e.state.doc.resolve(n.pos);s=c.parent,o=c.depth?c.before():0}const a=i?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=e.state;r.button==0&&(s.type.spec.draggable&&s.type.spec.selectable!==!1||u instanceof ae&&u.from<=o&&u.to>o)&&(this.mightDrag={node:s,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&In&&!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()),vr(e,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||Rr(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Za(e))),this.updateAllowDefault(e),this.allowDefault||!n?vr(this.view,"pointer"):wN(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||It&&this.mightDrag&&!this.mightDrag.node.isAtom||St&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ja(this.view,he.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):vr(this.view,"pointer")}move(e){this.updateAllowDefault(e),vr(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}}class _N extends uT{constructor(e,n){super(e),this.startSelection=n,this.startDoc=e.state.doc}move(e){if(e.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}e.preventDefault(),vr(this.view,"pointer");let n=this.view.posAtCoords(Za(e)),r=n&&aT(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,s=this.startSelection,[o,a]=r.from<s.from?[s.to,r.from]:[s.from,r.to];Ja(this.view,ue.create(i,o,a))}}$t.touchstart=t=>{t.input.lastTouch=Date.now(),Hp(t),vr(t,"pointer")};$t.touchmove=t=>{t.input.lastTouch=Date.now(),vr(t,"pointer")};$t.contextmenu=t=>Hp(t);function cT(t,e){return t.composing?!0:It&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const IN=Ar?5e3:-1;Vt.compositionstart=Vt.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof ue&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||St&&H2&&RN(t)))t.markCursor=t.state.storedMarks||n.marks(),Iu(t,!0),t.markCursor=null;else if(Iu(t,!e.selection.empty),In&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,s=r.focusOffset;i&&i.nodeType==1&&s!=0;){let o=s<0?i.lastChild:i.childNodes[s-1];if(!o)break;if(o.nodeType==3){let a=t.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else i=o,s=-1}}t.input.composing=!0}dT(t,IN)};function RN(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}Vt.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now(),t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,dT(t,20))};function dT(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Iu(t),e))}function fT(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function MN(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Sv(e.focusNode,e.focusOffset),r=wv(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,s=t.domObserver.lastChangedTextNode;if(n==s||r==s)return s;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Iu(t,e=!1){if(!(Ar&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),fT(t),e||t.docView&&t.docView.dirty){let n=Dp(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function ON(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const xa=nn&&ni<15||js&&Nv<604;$t.copy=Vt.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let s=xa?null:n.clipboardData,o=r.content(),{dom:a,text:l}=Pp(t,o);s?(n.preventDefault(),s.clearData(),s.setData("text/html",a.innerHTML),s.setData("text/plain",l)):ON(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function DN(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function LN(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Sa(t,r.value,null,i,e):Sa(t,r.textContent,r.innerHTML,i,e)},50)}function Sa(t,e,n,r,i){let s=tT(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,i,s||ee.empty)))return!0;if(!s)return!1;let o=DN(s),a=o?t.state.tr.replaceSelectionWith(o,r):t.state.tr.replaceSelection(s);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function hT(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Vt.paste=(t,e)=>{let n=e;if(t.composing&&!Ar)return;let r=xa?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&Sa(t,hT(r),r.getData("text/html"),i,n)?n.preventDefault():LN(t,n)};class pT{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const PN=wn?"altKey":"ctrlKey";function mT(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[PN]}$t.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,s=i.empty?null:t.posAtCoords(Za(n)),o;if(!(s&&s.pos>=i.from&&s.pos<=(i instanceof ae?i.to-1:i.to))){if(r&&r.mightDrag)o=ae.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(o=ae.create(t.state.doc,d.posBefore))}}let a=(o||t.state.selection).content(),{dom:l,text:u,slice:c}=Pp(t,a);(!n.dataTransfer.files.length||!St||F2>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(xa?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",xa||n.dataTransfer.setData("text/plain",u),t.dragging=new pT(c,mT(t,n),o)};$t.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Vt.dragover=Vt.dragenter=(t,e)=>e.preventDefault();Vt.drop=(t,e)=>{try{BN(t,e,t.dragging)}finally{t.dragging=null}};function BN(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(Za(e));if(!r)return;let i=t.state.doc.resolve(r.pos),s=n&&n.slice;s?t.someProp("transformPasted",h=>{s=h(s,t,!1)}):s=tT(t,hT(e.dataTransfer),xa?null:e.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&mT(t,e));if(t.someProp("handleDrop",h=>h(t,e,s||ee.empty,o))){e.preventDefault();return}if(!s)return;e.preventDefault();let a=s?W3(t.state.doc,i.pos,s):i.pos;a==null&&(a=i.pos);let l=t.state.tr;if(o){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let u=l.mapping.map(a),c=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=l.doc;if(c?l.replaceRangeWith(u,u,s.content.firstChild):l.replaceRange(u,u,s),l.doc.eq(d))return;let f=l.doc.resolve(u);if(c&&ae.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))l.setSelection(new ae(f));else{let h=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((p,g,b,y)=>h=y),l.setSelection(Lp(t,f,l.doc.resolve(h)))}t.focus(),t.dispatch(l.setMeta("uiEvent","drop"))}$t.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Rr(t)},20))};$t.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};$t.beforeinput=(t,e)=>{if(Ar&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",s=>s(t,ki(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in Vt)$t[t]=Vt[t];function wa(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ru{constructor(e,n){this.toDOM=e,this.spec=n||Di,this.side=this.spec.side||0}map(e,n,r,i){let{pos:s,deleted:o}=e.mapResult(n.from+i,this.side<0?-1:1);return o?null:new ut(s-r,s-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Ru&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&wa(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class si{constructor(e,n){this.attrs=e,this.spec=n||Di}map(e,n,r,i){let s=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return s>=o?null:new ut(s,o,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof si&&wa(this.attrs,e.attrs)&&wa(this.spec,e.spec)}static is(e){return e.type instanceof si}destroy(){}}class Up{constructor(e,n){this.attrs=e,this.spec=n||Di}map(e,n,r,i){let s=e.mapResult(n.from+i,1);if(s.deleted)return null;let o=e.mapResult(n.to+i,-1);return o.deleted||o.pos<=s.pos?null:new ut(s.pos-r,o.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),s;return i==n.from&&!(s=e.child(r)).isText&&i+s.nodeSize==n.to}eq(e){return this==e||e instanceof Up&&wa(this.attrs,e.attrs)&&wa(this.spec,e.spec)}destroy(){}}class ut{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new ut(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new ut(e,e,new Ru(n,r))}static inline(e,n,r,i){return new ut(e,n,new si(r,i))}static node(e,n,r,i){return new ut(e,n,new Up(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof si}get widget(){return this.type instanceof Ru}}const ys=[],Di={};class Le{constructor(e,n){this.local=e.length?e:ys,this.children=n.length?n:ys}static create(e,n){return n.length?Mu(n,e,0,Di):kt}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,s){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=e&&(!s||s(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>e){let a=this.children[o]+1;this.children[o+2].findInner(e-a,n-a,r,i+a,s)}}map(e,n,r){return this==kt||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Di)}mapInner(e,n,r,i,s){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(e,r,i);l&&l.type.valid(n,l)?(o||(o=[])).push(l):s.onRemove&&s.onRemove(this.local[a].spec)}return this.children.length?FN(this.children,o||[],e,n,r,i,s):o?new Le(o.sort(Li),ys):kt}add(e,n){return n.length?this==kt?Le.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,s=0;e.forEach((a,l)=>{let u=l+r,c;if(c=bT(n,a,u)){for(i||(i=this.children.slice());s<i.length&&i[s]<l;)s+=3;i[s]==l?i[s+2]=i[s+2].addInner(a,c,u+1):i.splice(s,0,l,l+a.nodeSize,Mu(c,a,u+1,Di)),s+=3}});let o=gT(s?yT(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||o.splice(a--,1);return new Le(o.length?this.local.concat(o).sort(Li):this.local,i||this.children)}remove(e){return e.length==0||this==kt?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let s=0;s<r.length;s+=3){let o,a=r[s]+n,l=r[s+1]+n;for(let c=0,d;c<e.length;c++)(d=e[c])&&d.from>a&&d.to<l&&(e[c]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let u=r[s+2].removeInner(o,a+1);u!=kt?r[s+2]=u:(r.splice(s,3),s-=3)}if(i.length){for(let s=0,o;s<e.length;s++)if(o=e[s])for(let a=0;a<i.length;a++)i[a].eq(o,n)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new Le(i,r):kt}forChild(e,n){if(this==kt)return this;if(n.isLeaf)return Le.empty;let r,i;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 s=e+1,o=s+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>s&&l.type instanceof si){let u=Math.max(s,l.from)-s,c=Math.min(o,l.to)-s;u<c&&(i||(i=[])).push(l.copy(u,c))}}if(i){let a=new Le(i.sort(Li),ys);return r?new Yr([a,r]):a}return r||kt}eq(e){if(this==e)return!0;if(!(e instanceof Le)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return $p(this.localsInner(e))}localsInner(e){if(this==kt)return ys;if(e.inlineContent||!this.local.some(si.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof si||n.push(this.local[r]);return n}forEachSet(e){e(this)}}Le.empty=new Le([],[]);Le.removeOverlap=$p;const kt=Le.empty;class Yr{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Di));return Yr.from(r)}forChild(e,n){if(n.isLeaf)return Le.empty;let r=[];for(let i=0;i<this.members.length;i++){let s=this.members[i].forChild(e,n);s!=kt&&(s instanceof Yr?r=r.concat(s.members):r.push(s))}return Yr.from(r)}eq(e){if(!(e instanceof Yr)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let s=this.members[i].localsInner(e);if(s.length)if(!n)n=s;else{r&&(n=n.slice(),r=!1);for(let o=0;o<s.length;o++)n.push(s[o])}}return n?$p(r?n:n.sort(Li)):ys}static from(e){switch(e.length){case 0:return kt;case 1:return e[0];default:return new Yr(e.every(n=>n instanceof Le)?e:e.reduce((n,r)=>n.concat(r instanceof Le?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function FN(t,e,n,r,i,s,o){let a=t.slice();for(let u=0,c=s;u<n.maps.length;u++){let d=0;n.maps[u].forEach((f,h,p,g)=>{let b=g-p-(h-f);for(let y=0;y<a.length;y+=3){let E=a[y+1];if(E<0||f>E+c-d)continue;let T=a[y]+c-d;h>=T?a[y+1]=f<=T?-2:-1:f>=c&&b&&(a[y]+=b,a[y+1]+=b)}d+=b}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u<a.length;u+=3)if(a[u+1]<0){if(a[u+1]==-2){l=!0,a[u+1]=-1;continue}let c=n.map(t[u]+s),d=c-i;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(t[u+1]+s,-1),h=f-i,{index:p,offset:g}=r.content.findIndex(d),b=r.maybeChild(p);if(b&&g==d&&g+b.nodeSize==h){let y=a[u+2].mapInner(n,b,c+1,t[u]+s+1,o);y!=kt?(a[u]=d,a[u+1]=h,a[u+2]=y):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=HN(a,t,e,n,i,s,o),c=Mu(u,r,0,o);e=c.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<c.children.length;d+=3){let h=c.children[d];for(;f<a.length&&a[f]<h;)f+=3;a.splice(f,0,c.children[d],c.children[d+1],c.children[d+2])}}return new Le(e.sort(Li),a)}function gT(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new ut(i.from+e,i.to+e,i.type))}return n}function HN(t,e,n,r,i,s,o){function a(l,u){for(let c=0;c<l.local.length;c++){let d=l.local[c].map(r,i,u);d?n.push(d):o.onRemove&&o.onRemove(l.local[c].spec)}for(let c=0;c<l.children.length;c+=3)a(l.children[c+2],l.children[c]+u+1)}for(let l=0;l<t.length;l+=3)t[l+1]==-1&&a(t[l+2],e[l]+s+1);return n}function bT(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let s=0,o;s<t.length;s++)(o=t[s])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),t[s]=null);return i}function yT(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Mu(t,e,n,r){let i=[],s=!1;e.forEach((a,l)=>{let u=bT(t,a,l+n);if(u){s=!0;let c=Mu(u,a,n+l+1,r);c!=kt&&i.push(l,l+a.nodeSize,c)}});let o=gT(s?yT(t):t,-n).sort(Li);for(let a=0;a<o.length;a++)o[a].type.valid(e,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||i.length?new Le(o,i):kt}function Li(t,e){return t.from-e.from||t.to-e.to}function $p(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let s=e[i];if(s.from==r.from){s.to!=r.to&&(e==t&&(e=t.slice()),e[i]=s.copy(s.from,r.to),Hg(e,i+1,s.copy(r.to,s.to)));continue}else{s.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,s.from),Hg(e,i,r.copy(s.from,r.to)));break}}}return e}function Hg(t,e,n){for(;e<t.length&&Li(n,t[e])>0;)e++;t.splice(e,0,n)}function Fd(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=kt&&e.push(r)}),t.cursorWrapper&&e.push(Le.create(t.state.doc,[t.cursorWrapper.deco])),Yr.from(e)}const UN={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},$N=nn&&ni<=11;class VN{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 zN{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new VN,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);nn&&ni<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():It&&e.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),$N&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.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,UN)),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 n=0;n<e.length;n++)this.queue.push(e[n]);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(Mg(this.view)){if(this.suppressingSelectionUpdates)return Rr(this.view);if(nn&&ni<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&$i(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 n=new Set,r;for(let s=e.focusNode;s;s=zs(s))n.add(s);for(let s=e.anchorNode;s;s=zs(s))if(n.has(s)){r=s;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!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 n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Mg(e)&&!this.ignoreSelectionChange(r),s=-1,o=-1,a=!1,l=[];if(e.editable)for(let c=0;c<n.length;c++){let d=this.registerMutation(n[c],l);d&&(s=s<0?d.from:Math.min(d.from,s),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(l.some(c=>c.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||St&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(c=>c.type=="childList"&&c.removedNodes.length))){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let d=c.nextSibling;for(;d&&d.nodeType==1;){if(d.contentEditable=="false"){c.parentNode.removeChild(c);break}d=d.firstChild}}}else if(In&&l.length){let c=l.filter(d=>d.nodeName=="BR");if(c.length==2){let[d,f]=c;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of c){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||qN(e,d)!=h)&&f.remove()}}}let u=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ac(r)&&(u=Dp(e))&&u.eq(he.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Rr(e),this.currentSelection.set(r),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,o),jN(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,YN(e,l)),this.handleDOMChange(s,o,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Rr(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;c<e.addedNodes.length;c++){let d=e.addedNodes[c];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,s=e.nextSibling;if(nn&&ni<=11&&e.addedNodes.length)for(let c=0;c<e.addedNodes.length;c++){let{previousSibling:d,nextSibling:f}=e.addedNodes[c];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(i=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(s=f)}let o=i&&i.parentNode==e.target?Ct(i)+1:0,a=r.localPosFromDOM(e.target,o,-1),l=s&&s.parentNode==e.target?Ct(s):e.target.childNodes.length,u=r.localPosFromDOM(e.target,l,1);return{from:a,to:u}}else return e.type=="attributes"?{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 Ug=new WeakMap,$g=!1;function jN(t){if(!Ug.has(t)&&(Ug.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=In,$g)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."),$g=!0}}function Vg(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,s=e.endOffset,o=t.domAtPos(t.state.selection.anchor);return $i(o.node,o.offset,i,s)&&([n,r,i,s]=[i,s,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:s}}function WN(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return Vg(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?Vg(t,n):null}function qN(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function YN(t,e){var n;let{focusNode:r,focusOffset:i}=t.domSelectionRange();for(let s of e)if(((n=s.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let o=s.nextSibling;for(;o&&o.nodeName!="TD"&&o.nodeName!="TH";)o=o.nextSibling;if(o){let a=o;for(;;){let l=a.firstChild;if(!l||l.nodeType!=1||l.contentEditable=="false"||/^(BR|IMG)$/.test(l.nodeName))break;a=l}a.insertBefore(s,a.firstChild),r==s&&t.domSelection().collapse(s,i)}else s.parentNode.removeChild(s)}}function KN(t,e,n,r){let{node:i,fromOffset:s,toOffset:o,from:a,to:l}=t.docView.parseRange(e,n),u=t.domSelectionRange(),c,d=u.anchorNode;if(d&&t.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:u.anchorOffset}],Ac(u)||c.push({node:u.focusNode,offset:u.focusOffset})),St&&t.input.lastKeyCode===8)for(let y=o;y>s;y--){let E=i.childNodes[y-1],T=E.pmViewDesc;if(E.nodeName=="BR"&&!T){o=y;break}if(!T||T.size)break}let f=t.state.doc,h=t.someProp("domParser")||ea.fromSchema(t.state.schema),p=f.resolve(a),g=null,b=h.parse(i,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:o,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:GN(r),context:p});if(c&&c[0].pos!=null){let y=c[0].pos,E=c[1]&&c[1].pos;E==null&&(E=y),g={anchor:y+a,head:E+a}}return{doc:b,sel:g,from:a,to:l}}const GN=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(It&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let r=document.createElement("div");return r.appendChild(document.createElement("li")),{skip:r}}else if(e.parentNode.lastChild==e||It&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},XN=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function QN(t,e,n,r,i){let s=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let O=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,P=Dp(t,O);if(P&&!t.state.selection.eq(P)){if(St&&Ar&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",N=>N(t,ki(13,"Enter"))))return;let F=t.state.tr.setSelection(P);O=="pointer"?F.setMeta("pointer",!0):O=="key"&&F.scrollIntoView(),s&&F.setMeta("composition",s),t.dispatch(F)}return}let o=t.state.doc.resolve(e),a=o.sharedDepth(n);e=o.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=KN(t,e,n,i),c=t.state.doc,d=c.slice(u.from,u.to),f,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(f=t.state.selection.to,h="end"):(f=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let p=e_(d.content,u.doc.content,u.from,f,h);if(p&&t.input.domChangeCount++,(js&&t.input.lastIOSEnter>Date.now()-225||Ar)&&i.some(O=>O.nodeType==1&&!XN.test(O.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",O=>O(t,ki(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&l instanceof ue&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))p={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let O=zg(t,t.state.doc,u.sel);if(O&&!O.eq(t.state.selection)){let P=t.state.tr.setSelection(O);s&&P.setMeta("composition",s),t.dispatch(P)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof ue&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=u.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),nn&&ni<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>u.from&&u.doc.textBetween(p.start-u.from-1,p.start-u.from+1)=="  "&&(p.start--,p.endA--,p.endB--);let g=u.doc.resolveNoCache(p.start-u.from),b=u.doc.resolveNoCache(p.endB-u.from),y=c.resolve(p.start),E=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=p.endA;if((js&&t.input.lastIOSEnter>Date.now()-225&&(!E||i.some(O=>O.nodeName=="DIV"||O.nodeName=="P"))||!E&&g.pos<u.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(u.doc.textBetween(g.pos,b.pos,"","")))&&t.someProp("handleKeyDown",O=>O(t,ki(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&JN(c,p.start,p.endA,g,b)&&t.someProp("handleKeyDown",O=>O(t,ki(8,"Backspace")))){Ar&&St&&t.domObserver.suppressSelectionUpdates();return}St&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Ar&&!E&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==p.endA&&(p.endB-=2,b=u.doc.resolveNoCache(p.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(O){return O(t,ki(13,"Enter"))})},20));let T=p.start,v=p.endA,R=O=>{let P=O||t.state.tr.replace(T,v,u.doc.slice(p.start-u.from,p.endB-u.from));if(u.sel){let F=zg(t,P.doc,u.sel);F&&!(St&&t.composing&&F.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(F.head==T||F.head==P.mapping.map(v)-1)||nn&&F.empty&&F.head==T)&&P.setSelection(F)}return s&&P.setMeta("composition",s),P.scrollIntoView()},A;if(E)if(g.pos==b.pos){nn&&ni<=11&&g.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>Rr(t),20));let O=R(t.state.tr.delete(T,v)),P=c.resolve(p.start).marksAcross(c.resolve(p.endA));P&&O.ensureMarks(P),t.dispatch(O)}else if(p.endA==p.endB&&(A=ZN(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,p.endA-y.start())))){let O=R(t.state.tr);A.type=="add"?O.addMark(T,v,A.mark):O.removeMark(T,v,A.mark),t.dispatch(O)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let O=g.parent.textBetween(g.parentOffset,b.parentOffset),P=()=>R(t.state.tr.insertText(O,T,v));t.someProp("handleTextInput",F=>F(t,T,v,O,P))||t.dispatch(P())}else t.dispatch(R());else t.dispatch(R())}function zg(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Lp(t,e.resolve(n.anchor),e.resolve(n.head))}function ZN(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,s=r,o,a,l;for(let c=0;c<r.length;c++)i=r[c].removeFromSet(i);for(let c=0;c<n.length;c++)s=n[c].removeFromSet(s);if(i.length==1&&s.length==0)a=i[0],o="add",l=c=>c.mark(a.addToSet(c.marks));else if(i.length==0&&s.length==1)a=s[0],o="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;c<e.childCount;c++)u.push(l(e.child(c)));if(q.from(u).eq(t))return{mark:a,type:o}}function JN(t,e,n,r,i){if(n-e<=i.pos-r.pos||Hd(r,!0,!1)<i.pos)return!1;let s=t.resolve(e);if(!r.parent.isTextblock){let a=s.nodeAfter;return a!=null&&n==e+a.nodeSize}if(s.parentOffset<s.parent.content.size||!s.parent.isTextblock)return!1;let o=t.resolve(Hd(s,!0,!0));return!o.parent.isTextblock||o.pos>n||Hd(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Hd(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let s=t.node(r).maybeChild(t.indexAfter(r));for(;s&&!s.isLeaf;)s=s.firstChild,i++}return i}function e_(t,e,n,r,i){let s=t.findDiffStart(e,n),o=n+t.size,a=n+e.size;if(s==null)return null;let{a:l,b:u}=t.findDiffEnd(e,o,a);if(i=="end"){let c=Math.max(0,s-Math.min(l,u));r-=l+c-s}if(l<s&&o<a){let c=r<=s&&r>=l?s-r:0;s-=c,u=s+(u-l),l=s}else if(u<s){let c=r<=s&&r>=u?s-r:0;s-=c,l=s+(l-u),u=s}return{start:s,endA:l,endB:u}}class ET{constructor(e,n){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 gN,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Kg),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=qg(this),Wg(this),this.nodeViews=Yg(this),this.docView=Ag(this.state.doc,jg(this),Fd(this),this.dom,this),this.domObserver=new zN(this,(r,i,s,o)=>QN(this,r,i,s,o)),this.domObserver.start(),bN(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 n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Th(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(Kg),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,s=!1,o=!1;e.storedMarks&&this.composing&&(fT(this),o=!0),this.state=e;let a=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=Yg(this);n_(h,this.nodeViews)&&(this.nodeViews=h,s=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&Th(this),this.editable=qg(this),Wg(this);let l=Fd(this),u=jg(this),c=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",d=s||!this.docView.matchesNode(e.doc,u,l);(d||!e.selection.eq(i.selection))&&(o=!0);let f=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&Rv(this);if(o){this.domObserver.stop();let h=d&&(nn||St)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&t_(i.selection,e.selection);if(d){let g=St?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=MN(this)),(s||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Ag(e.doc,u,l,this.dom,this)),g&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&tN(this)&&p.delaySelUpdate())?Rr(this,h):(Z2(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():f&&Mv(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ae){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Cg(this,n.getBoundingClientRect(),e)}else Cg(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){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let s=r.from+(this.state.doc.content.size-n.doc.content.size);(s>0&&s<this.state.doc.content.size&&this.state.doc.nodeAt(s))==r.node&&(i=s)}this.dragging=new pT(e.slice,e.move,i<0?void 0:ae.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[e];if(a!=null&&(i=n?n(a):a))return i}let s=this.state.plugins;if(s)for(let o=0;o<s.length;o++){let a=s[o].props[e];if(a!=null&&(i=n?n(a):a))return i}}hasFocus(){if(nn){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(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&Ov(this.dom),Rr(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Fv(this,e)}coordsAtPos(e,n=1){return j2(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return zv(this,n||this.state,e)}pasteHTML(e,n){return Sa(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Sa(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Pp(this,e)}destroy(){this.docView&&(yN(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Fd(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,Cv())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return TN(this,e)}domSelectionRange(){let e=this.domSelection();return e?It&&this.root.nodeType===11&&Av(this.dom.ownerDocument)==this.dom&&WN(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}ET.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function jg(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[ut.node(0,t.state.doc.content.size,e)]}function Wg(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ut.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function qg(t){return!t.someProp("editable",e=>e(t.state)===!1)}function t_(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function Yg(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function n_(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function Kg(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var li={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:"'"},Ou={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},r_=typeof navigator<"u"&&/Mac/.test(navigator.platform),i_=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var xt=0;xt<10;xt++)li[48+xt]=li[96+xt]=String(xt);for(var xt=1;xt<=24;xt++)li[xt+111]="F"+xt;for(var xt=65;xt<=90;xt++)li[xt]=String.fromCharCode(xt+32),Ou[xt]=String.fromCharCode(xt);for(var Ud in li)Ou.hasOwnProperty(Ud)||(Ou[Ud]=li[Ud]);function s_(t){var e=r_&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||i_&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ou:li)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const o_=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),a_=typeof navigator<"u"&&/Win/.test(navigator.platform);function l_(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a++){let l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))o_?o=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),o&&(n="Meta-"+n),s&&(n="Shift-"+n),n}function u_(t){let e=Object.create(null);for(let n in t)e[l_(n)]=t[n];return e}function $d(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function c_(t){return new nt({props:{handleKeyDown:Vp(t)}})}function Vp(t){let e=u_(t);return function(n,r){let i=s_(r),s,o=e[$d(i,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=e[$d(i,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(a_&&r.ctrlKey&&r.altKey)&&(s=li[r.keyCode])&&s!=i){let a=e[$d(s,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}function Nc(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,s=n.storedMarks,n}}}var Ns=class TT{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:n,state:r}=this,{view:i}=n,{tr:s}=r,o=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>{const d=l(...c)(o);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a=[],l=!!e,u=e||s.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(u),a.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...g)=>{const b=this.buildProps(u,n),y=h(...g)(b);return a.push(y),d}])),run:c};return d}static createFakeChain(){const e=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){const{rawCommands:n,state:r}=this,i=!1,s=e||r.tr,o=this.buildProps(s,i);return{...Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...u)=>l(...u)({...o,dispatch:void 0})])),chain:()=>this.createChain(s,i)}}static createFallbackCan(){const e=TT.createFakeChain();return new Proxy({chain:()=>e},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(e,n=!0){const{rawCommands:r,editor:i,state:s}=this,{view:o}=i,a={tr:e,editor:i,view:o,state:Nc({state:s,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}};const d_=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{if(!t.isDestroyed){var n;e.dom.blur(),(n=window)===null||n===void 0||(n=n.getSelection())===null||n===void 0||n.removeAllRanges()}}),!0),f_=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),h_=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:s,$to:o})=>{t.doc.nodesBetween(s.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:u,mapping:c}=e,d=u.resolve(c.map(l)),f=u.resolve(c.map(l+a.nodeSize)),h=d.blockRange(f);if(!h)return;const p=co(h);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,g)}(p||p===0)&&e.lift(h,p)})}),!0},p_=t=>e=>t(e),m_=()=>({state:t,dispatch:e})=>O2(t,e),g_=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,s=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const o=r.mapping.map(e);return r.insert(o,s.content),r.setSelection(new ue(r.doc.resolve(Math.max(o-1,0)))),!0},b_=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r.type){if(e){const o=i.before(s),a=i.after(s);t.delete(o,a).scrollIntoView()}return!0}return!1};function bt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}const y_=t=>({tr:e,state:n,dispatch:r})=>{const i=bt(t,n.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(r){const a=s.before(o),l=s.after(o);e.delete(a,l).scrollIntoView()}return!0}return!1},E_=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},T_=t=>t.content?/^text(\*|\+)/.test(t.content):!1,Gg=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;const r=e.nodes[t.parent.type.name].spec;return T_(r)?n==="left"?t.start()-1:t.end()+1:t.pos},C_=(t,e,n)=>({from:Gg(t,n,"left"),to:Gg(e,n,"right")}),x_=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){const n=t.tr,{ranges:r}=t.selection,i=n.steps.length;r.forEach(s=>{const o=n.mapping.slice(i),a=n.doc.resolve(o.map(s.$from.pos)),l=n.doc.resolve(o.map(s.$to.pos)),{from:u,to:c}=C_(a,l,t.schema);n.deleteRange(u,c)}),n.selection.empty||n.setSelection(ue.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),e(n)}return!0},S_=()=>({commands:t})=>t.keyboardShortcut("Enter"),w_=()=>({state:t,dispatch:e})=>ov(t,e);function zp(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Du(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:zp(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function CT(t,e,n={}){return t.find(r=>r.type===e&&Du(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Xg(t,e,n={}){return!!CT(t,e,n)}function jp(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(l=>l.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(l=>l.type===e))return;if(!n){const l=r.node.marks.find(u=>u.type===e);l&&(n=l.attrs)}if(!CT([...r.node.marks],e,n))return;let i=r.index,s=t.start()+r.offset,o=i+1,a=s+r.node.nodeSize;for(;i>0&&Xg([...t.parent.child(i-1).marks],e,n);)i-=1,s-=t.parent.child(i).nodeSize;for(;o<t.parent.childCount&&Xg([...t.parent.child(o).marks],e,n);)a+=t.parent.child(o).nodeSize,o+=1;return{from:s,to:a}}function Fr(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}const k_=(t,e)=>({tr:n,state:r,dispatch:i})=>{const s=Fr(t,r.schema),{doc:o,selection:a}=n,{$from:l,from:u,to:c}=a;if(i){const d=jp(l,s,e);if(d&&d.from<=u&&d.to>=c){const f=ue.create(o,d.from,d.to);n.setSelection(f)}}return!0},A_=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function Wp(t){return t instanceof ue}function Nr(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function Ch(t,e=null){if(!e)return null;const n=he.atStart(t),r=he.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,s=r.to;return e==="all"?ue.create(t,Nr(0,i,s),Nr(t.content.size,i,s)):ue.create(t,Nr(e,i,s),Nr(e,i,s))}function xh(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function ka(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function v_(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}const N_=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(ka()||xh())&&r.dom.focus(),v_()&&!ka()&&!xh()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(s&&t===null&&!Wp(n.state.selection))return o(),!0;const a=Ch(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return s&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},__=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),I_=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),xT=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&xT(r)}return t};function vl(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return xT(n)}function ST(t){return typeof t?.nodesBetween=="function"}function Ws(t,e,n){if(ST(t))return t;const r=typeof t=="object"&&t!==null;n={slice:!0,parseOptions:{},...n};const i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return q.fromArray(t.map(o=>e.nodeFromJSON(o)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(s){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",s),Ws("",e,n)}if(i){if(n.errorOnInvalidContent){let o=!1,a="";const l=new i2({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,a=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?ea.fromSchema(l).parseSlice(vl(t),n.parseOptions):ea.fromSchema(l).parse(vl(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const s=ea.fromSchema(e);return n.slice?s.parseSlice(vl(t),n.parseOptions).content:s.parse(vl(t),n.parseOptions)}return Ws("",e,n)}function wT(t){return!("type"in t)}function kT(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof et||i instanceof pt))return;const s=t.mapping.maps[r];let o=0;s.forEach((a,l,u,c)=>{o===0&&(o=c)}),t.setSelection(he.near(t.doc.resolve(o),n))}const R_=(t,e,n)=>({tr:r,dispatch:i,editor:s})=>{if(i){n={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=b=>{s.emit("contentError",{editor:s,error:b,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{Ws(e,s.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(b){l(b)}try{var o;a=Ws(e,s.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!==null&&o!==void 0?o:s.options.enableContentCheck})}catch(b){return l(b),!1}let{from:c,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0;const p=wT(a)?a.content:[a];if(p.forEach(b=>{b.check(),f=f?b.isText&&b.marks.length===0:!1,h=h?b.isBlock:!1}),c===d&&h){const{parent:b}=r.doc.resolve(c);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(c-=1,d+=1)}let g;if(f)Array.isArray(e)?g=e.map(b=>b.text||"").join(""):ST(e)?g=p.map(b=>{var y;return(y=b.text)!==null&&y!==void 0?y:""}).join(""):typeof e=="object"&&e&&e.text?g=e.text:g=e,r.insertText(g,c,d);else{g=q.from(p);const b=r.doc.resolve(c),y=b.node(),E=b.parentOffset===0,T=y.isText||y.isTextblock,v=y.content.size>0;E&&T&&v&&h&&(c=Math.max(0,c-1)),r.replaceWith(c,d,p)}n.updateSelection&&kT(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:g})}return!0};function AT(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const M_=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{pos:i,attrs:s,content:o,updateSelection:a=!0}=t;let l;typeof i=="number"?l=e.doc.resolve(i):i?l=i:l=e.selection.$from;const u=AT(l.parent.contentMatchAt(l.index()));if(!u)return!1;const c=Object.keys(u.spec.attrs||{}),d=s?Object.fromEntries(Object.entries(s).filter(([h])=>c.includes(h))):{};let f;if(o){const h=Ws(o,r.schema);f=u.createAndFill(d,h)}else f=u.createAndFill(d);return f?(n&&(e.insert(l.pos,f),a&&kT(e,e.steps.length-1,-1)),!0):!1},O_=()=>({state:t,dispatch:e})=>rv(t,e),D_=()=>({state:t,dispatch:e})=>iv(t,e),L_=()=>({state:t,dispatch:e})=>A2(t,e),P_=()=>({state:t,dispatch:e})=>I2(t,e),B_=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Sc(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},F_=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Sc(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},H_=()=>({state:t,dispatch:e})=>tv(t,e),U_=()=>({state:t,dispatch:e})=>nv(t,e);function vT(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function $_(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,s,o;for(let a=0;a<e.length-1;a+=1){const l=e[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))s=!0;else if(/^mod$/i.test(l))ka()||vT()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),s&&(n=`Shift-${n}`),n}const V_=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const s=$_(t).split(/-(?!$)/),o=s.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l?.steps.forEach(u=>{const c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function Aa(t,e,n={}){const{from:r,to:i,empty:s}=t.selection,o=e?bt(e,t.schema):null,a=[];t.doc.nodesBetween(r,i,(c,d)=>{if(c.isText)return;const f=Math.max(r,d),h=Math.min(i,d+c.nodeSize);a.push({node:c,from:f,to:h})});const l=i-r,u=a.filter(c=>o?o.name===c.node.type.name:!0).filter(c=>Du(c.node.attrs,n,{strict:!1}));return s?!!u.length:u.reduce((c,d)=>c+d.to-d.from,0)>=l}const z_=(t,e={})=>({state:n,dispatch:r})=>Aa(n,bt(t,n.schema),e)?sv(n,r):!1,j_=()=>({state:t,dispatch:e})=>D2(t,e),W_=t=>({state:e,dispatch:n})=>{const r=bt(t,e.schema);return bv(r)(e,n)},q_=()=>({state:t,dispatch:e})=>M2(t,e);function _c(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Qg(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}const Y_=(t,e)=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=_c(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=bt(t,r.schema)),a==="mark"&&(o=Fr(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,d)=>{s&&s===c.type&&(l=!0,i&&n.setNodeMarkup(d,void 0,Qg(c.attrs,e))),o&&c.marks.length&&c.marks.forEach(f=>{o===f.type&&(l=!0,i&&n.addMark(d,d+c.nodeSize,o.create(Qg(f.attrs,e))))})})}),l},K_=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),G_=()=>({tr:t,dispatch:e})=>{if(e){const n=new tn(t.doc);t.setSelection(n)}return!0},X_=()=>({state:t,dispatch:e})=>N2(t,e),Q_=()=>({state:t,dispatch:e})=>R2(t,e),Z_=()=>({state:t,dispatch:e})=>uv(t,e),J_=()=>({state:t,dispatch:e})=>fv(t,e),eI=()=>({state:t,dispatch:e})=>dv(t,e);function Sh(t,e,n={},r={}){return Ws(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}const tI=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:s,dispatch:o,commands:a})=>{const{doc:l}=s;if(r.preserveWhitespace!=="full"){const u=Sh(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});if(o){const c=wT(u)?u.content:[u];s.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n)}return!0}return o&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function NT(t,e){const n=Fr(e,t.schema),{from:r,to:i,empty:s}=t.selection,o=[];s?(t.storedMarks&&o.push(...t.storedMarks),o.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function nI(t,e){const n=new vp(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function JK(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,s)=>{n(i)&&r.push({node:i,pos:s})}),r}function rI(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function qp(t){return e=>rI(e.$from,t)}function se(t,e,n){return t.config[e]===void 0&&t.parent?se(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?se(t.parent,e,n):null}):t.config[e]}function Yp(t){return t.map(e=>{const n=se(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return n?[e,...Yp(n())]:e}).flat(10)}function Kp(t,e){const n=Xi.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function _T(t){return typeof t=="function"}function He(t,e=void 0,...n){return _T(t)?e?t.bind(e)(...n):t(...n):t}function iI(t={}){return Object.keys(t).length===0&&t.constructor===Object}function qs(t){return{baseExtensions:t.filter(e=>e.type==="extension"),nodeExtensions:t.filter(e=>e.type==="node"),markExtensions:t.filter(e=>e.type==="mark")}}function IT(t){const e=[],{nodeExtensions:n,markExtensions:r}=qs(t),i=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(u=>u.name!=="text").map(u=>u.name),a=r.map(u=>u.name),l=[...o,...a];return t.forEach(u=>{const c=se(u,"addGlobalAttributes",{name:u.name,options:u.options,storage:u.storage,extensions:i});c&&c().forEach(d=>{let f;Array.isArray(d.types)?f=d.types:d.types==="*"?f=l:d.types==="nodes"?f=o:d.types==="marks"?f=a:f=[],f.forEach(h=>{Object.entries(d.attributes).forEach(([p,g])=>{e.push({type:h,name:p,attribute:{...s,...g}})})})})}),i.forEach(u=>{const c=se(u,"addAttributes",{name:u.name,options:u.options,storage:u.storage});if(!c)return;const d=c();Object.entries(d).forEach(([f,h])=>{const p={...s,...h};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:u.name,name:f,attribute:p})})}),e}function sI(t){const e=[];let n="",r=!1,i=!1,s=0;const o=t.length;for(let a=0;a<o;a+=1){const l=t[a];if(l==="'"&&!i){r=!r,n+=l;continue}if(l==='"'&&!r){i=!i,n+=l;continue}if(!r&&!i){if(l==="("){s+=1,n+=l;continue}if(l===")"&&s>0){s-=1,n+=l;continue}if(l===";"&&s===0){e.push(n),n="";continue}}n+=l}return n&&e.push(n),e}function Zg(t){const e=[],n=sI(t||""),r=n.length;for(let i=0;i<r;i+=1){const s=n[i],o=s.indexOf(":");if(o===-1)continue;const a=s.slice(0,o).trim(),l=s.slice(o+1).trim();a&&l&&e.push([a,l])}return e}function fo(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,s])=>{if(i==="__proto__"){Object.defineProperty(r,i,{configurable:!0,enumerable:!0,value:s,writable:!0});return}if(!r[i]){r[i]=s;return}if(i==="class"){const o=s?String(s).split(" "):[],a=r[i]?r[i].split(" "):[],l=o.filter(u=>!a.includes(u));r[i]=[...a,...l].join(" ")}else if(i==="style"){const o=new Map([...Zg(r[i]),...Zg(s)]);r[i]=Array.from(o.entries()).map(([a,l])=>`${a}: ${l}`).join("; ")}else r[i]=s}),r},{})}function va(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>fo(n,r),{})}function oI(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function Jg(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((s,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):oI(n.getAttribute(o.name));return a==null?s:{...s,[o.name]:a}},{});return{...r,...i}}}}function e1(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&iI(n)?!1:n!=null))}function t1(t){var e,n;const r={};return!(!(t==null||(e=t.attribute)===null||e===void 0)&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),(t==null||(n=t.attribute)===null||n===void 0?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function RT(t,e){var n;const r=IT(t),{nodeExtensions:i,markExtensions:s}=qs(t),o=(n=i.find(u=>se(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(i.map(u=>{const c=r.filter(b=>b.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=e1({...t.reduce((b,y)=>{const E=se(y,"extendNodeSchema",d);return{...b,...E?E(u):{}}},{}),content:He(se(u,"content",d)),marks:He(se(u,"marks",d)),group:He(se(u,"group",d)),inline:He(se(u,"inline",d)),atom:He(se(u,"atom",d)),selectable:He(se(u,"selectable",d)),draggable:He(se(u,"draggable",d)),code:He(se(u,"code",d)),whitespace:He(se(u,"whitespace",d)),linebreakReplacement:He(se(u,"linebreakReplacement",d)),defining:He(se(u,"defining",d)),isolating:He(se(u,"isolating",d)),attrs:Object.fromEntries(c.map(t1))}),h=He(se(u,"parseHTML",d));h&&(f.parseDOM=h.map(b=>Jg(b,c)));const p=se(u,"renderHTML",d);p&&(f.toDOM=b=>p({node:b,HTMLAttributes:va(b,c)}));const g=se(u,"renderText",d);return g&&(f.toText=g),[u.name,f]})),l=Object.fromEntries(s.map(u=>{const c=r.filter(g=>g.type===u.name),d={name:u.name,options:u.options,storage:u.storage,editor:e},f=e1({...t.reduce((g,b)=>{const y=se(b,"extendMarkSchema",d);return{...g,...y?y(u):{}}},{}),inclusive:He(se(u,"inclusive",d)),excludes:He(se(u,"excludes",d)),group:He(se(u,"group",d)),spanning:He(se(u,"spanning",d)),code:He(se(u,"code",d)),attrs:Object.fromEntries(c.map(t1))}),h=He(se(u,"parseHTML",d));h&&(f.parseDOM=h.map(g=>Jg(g,c)));const p=se(u,"renderHTML",d);return p&&(f.toDOM=g=>p({mark:g,HTMLAttributes:va(g,c)})),[u.name,f]}));return new i2({topNode:o,nodes:a,marks:l})}function aI(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function ia(t){return t.sort((n,r)=>{const i=se(n,"priority")||100,s=se(r,"priority")||100;return i>s?-1:i<s?1:0})}function Gp(t){const e=ia(Yp(t)),n=aI(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function eG(t,e){return RT(Gp(t),e)}function MT(t,e,n){const{from:r,to:i}=e,{blockSeparator:s=`
11
+
12
+ `,textSerializers:o={}}=n||{};let a="";return t.nodesBetween(r,i,(l,u,c,d)=>{l.isBlock&&u>r&&(a+=s);const f=o?.[l.type.name];if(f)return c&&(a+=f({node:l,pos:u,parent:c,index:d,range:e})),!1;if(l.isText){var h;a+=l==null||(h=l.text)===null||h===void 0?void 0:h.slice(Math.max(r,u)-u,i-u)}}),a}function lI(t,e){return MT(t,{from:0,to:t.content.size},e)}function OT(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function uI(t,e){const n=bt(e,t.schema),{from:r,to:i}=t.selection,s=[];t.doc.nodesBetween(r,i,a=>{s.push(a)});const o=s.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function cI(t,e){const n=_c(typeof e=="string"?e:e.name,t.schema);return n==="node"?uI(t,e):n==="mark"?NT(t,e):{}}function dI(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function fI(t){const e=dI(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function DT(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[s];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const u=e.slice(s).map(a,-1),c=e.slice(s).map(l),d=e.invert().map(u,-1),f=e.invert().map(c);r.push({oldRange:{from:d,to:f},newRange:{from:u,to:c}})})}),fI(r)}function LT(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const s=jp(n.resolve(t),i.type);s&&r.push({mark:i,...s})}):n.nodesBetween(t,e,(i,s)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(o=>({from:s,to:s+i.nodeSize,mark:o})))}),r}function ls(t,e){return e.nodes[t]||e.marks[t]||null}function su(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const hI=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,s,o,a)=>{var l,u;const c=((l=(u=i.type.spec).toText)===null||l===void 0?void 0:l.call(u,{node:i,pos:s,parent:o,index:a}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-s))}),n};function wh(t,e,n={}){const{empty:r,ranges:i}=t.selection,s=e?Fr(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(c=>s?s.name===c.type.name:!0).find(c=>Du(c.attrs,n,{strict:!1}));let o=0;const a=[];if(i.forEach(({$from:c,$to:d})=>{const f=c.pos,h=d.pos;t.doc.nodesBetween(f,h,(p,g)=>{if(s&&p.inlineContent&&!p.type.allowsMarkType(s))return!1;if(!p.isText&&!p.marks.length)return;const b=Math.max(f,g),y=Math.min(h,g+p.nodeSize),E=y-b;o+=E,a.push(...p.marks.map(T=>({mark:T,from:b,to:y})))})}),o===0)return!1;const l=a.filter(c=>s?s.name===c.mark.type.name:!0).filter(c=>Du(c.mark.attrs,n,{strict:!1})).reduce((c,d)=>c+d.to-d.from,0),u=a.filter(c=>s?c.mark.type!==s&&c.mark.type.excludes(s):!0).reduce((c,d)=>c+d.to-d.from,0);return(l>0?l+u:l)>=o}function pI(t,e,n={}){if(!e)return Aa(t,null,n)||wh(t,null,n);const r=_c(e,t.schema);return r==="node"?Aa(t,e,n):r==="mark"?wh(t,e,n):!1}function n1(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Vd(t,e){const{nodeExtensions:n}=qs(e),r=n.find(s=>s.name===t);if(!r)return!1;const i=He(se(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof i!="string"?!1:i.split(" ").includes("list")}function Xp(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){if(n){if(t.type.name==="hardBreak")return!0;if(t.isText){var r;return!/\S/.test((r=t.text)!==null&&r!==void 0?r:"")}}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(s=>{i!==!1&&(Xp(s,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function tG(t){return t instanceof ae}var PT=class BT{constructor(e){this.position=e}static fromJSON(e){return new BT(e.position)}toJSON(){return{position:this.position}}};function mI(t,e){const n=e.mapping.mapResult(t.position);return{position:new PT(n.pos),mapResult:n}}function gI(t){return new PT(t)}function nG(t,e,n){const i=t.state.doc.content.size,s=Nr(e,0,i),o=Nr(n,0,i),a=t.coordsAtPos(s),l=t.coordsAtPos(o,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),d=Math.min(a.left,l.left),f=Math.max(a.right,l.right),h={top:u,bottom:c,left:d,right:f,width:f-d,height:c-u,x:d,y:u};return{...h,toJSON:()=>h}}function bI(t,e,n){const{selection:r}=e;let i=null;if(Wp(r)&&(i=r.$cursor),i){var s;const a=(s=t.storedMarks)!==null&&s!==void 0?s:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(l=>l.type.excludes(n)))}const{ranges:o}=r;return o.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,d,f)=>{if(u)return!1;if(c.isInline){const h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(c.marks)||!c.marks.some(g=>g.type.excludes(n));u=h&&p}return!u}),u})}const yI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=n,{empty:o,ranges:a}=s,l=Fr(t,r.schema);if(i)if(o){const u=NT(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;r.doc.nodesBetween(c,d,(f,h)=>{const p=Math.max(h,c),g=Math.min(h+f.nodeSize,d);f.marks.find(b=>b.type===l)?f.marks.forEach(b=>{l===b.type&&n.addMark(p,g,l.create({...b.attrs,...e}))}):n.addMark(p,g,l.create(e))})});return bI(r,n,l)},EI=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),TI=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const s=bt(t,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:a})=>yg(s,{...o,...e})(n)?!0:a.clearNodes()).command(({state:a})=>yg(s,{...o,...e})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},CI=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=Nr(t,0,r.content.size),s=ae.create(r,i);e.setSelection(s)}return!0},xI=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;let o,a;return typeof e=="number"?(o=e,a=e):e&&"from"in e&&"to"in e?(o=e.from,a=e.to):(o=s.from,a=s.to),i&&n.doc.nodesBetween(o,a,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:t})}),!0},SI=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:s}=typeof t=="number"?{from:t,to:t}:t,o=ue.atStart(r).from,a=ue.atEnd(r).to,l=Nr(i,o,a),u=Nr(s,o,a),c=ue.create(r,l,u);e.setSelection(c)}return!0},wI=t=>({state:e,dispatch:n})=>{const r=bt(t,e.schema);return Tv(r)(e,n)};function r1(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}const kI=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:o}=e,{$from:a,$to:l}=s,u=i.extensionManager.attributes,c=su(u,a.node().type.name,a.node().attrs);if(s instanceof ae&&s.node.isBlock)return!a.parentOffset||!Ir(o,a.pos)?!1:(r&&(t&&r1(n,i.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:AT(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&f?[{type:f,attrs:c}]:void 0,p=Ir(e.doc,e.mapping.map(a.pos),1,h);if(!h&&!p&&Ir(e.doc,e.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(p=!0,h=f?[{type:f,attrs:c}]:void 0),r){if(p&&(s instanceof ue&&e.deleteSelection(),e.split(e.mapping.map(a.pos),1,h),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=e.mapping.map(a.before()),b=e.doc.resolve(g);a.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&e.setNodeMarkup(e.mapping.map(a.before()),f)}t&&r1(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},AI=(t,e={})=>({tr:n,state:r,dispatch:i,editor:s})=>{const o=bt(t,r.schema),{$from:a,$to:l}=r.selection,u=r.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;const c=a.node(-1);if(c.type!==o)return!1;const d=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==o||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){var f;let y=q.empty;const E=a.index(-1)?1:a.index(-2)?2:3;for(let P=a.depth-E;P>=a.depth-3;P-=1)y=q.from(a.node(P).copy(y));const T=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,v={...su(d,a.node().type.name,a.node().attrs),...e},R=((f=o.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(v))||void 0;y=y.append(q.from(o.createAndFill(null,R)||void 0));const A=a.before(a.depth-(E-1));n.replace(A,a.after(-T),new ee(y,4-E,0));let O=-1;n.doc.nodesBetween(A,n.doc.content.size,(P,F)=>{if(O>-1)return!1;P.isTextblock&&P.content.size===0&&(O=F+1)}),O>-1&&n.setSelection(ue.near(n.doc.resolve(O))),n.scrollIntoView()}return!0}const h=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,p={...su(d,c.type.name,c.attrs),...e},g={...su(d,a.node().type.name,a.node().attrs),...e};n.delete(a.pos,l.pos);const b=h?[{type:o,attrs:p},{type:h,attrs:g}]:[{type:o,attrs:p}];if(!Ir(n.doc,a.pos,2))return!1;if(i){const{selection:y,storedMarks:E}=r,{splittableMarks:T}=s.extensionManager,v=E||y.$to.parentOffset&&y.$from.marks();if(n.split(a.pos,2,b).scrollIntoView(),!v||!i)return!0;const R=v.filter(A=>T.includes(A.type.name));n.ensureMarks(R)}return!0};function i1(t){return!t||t==="1"?null:t}function FT(t,e){return i1(t)===i1(e)}const zd=(t,e)=>{const n=qp(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Qi(t.doc,n.pos))||!FT(n.node.attrs.type,i?.attrs.type)||t.join(n.pos),!0},jd=(t,e)=>{const n=qp(s=>s.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return!(n.node.type===i?.type&&Qi(t.doc,r))||!FT(n.node.attrs.type,i?.attrs.type)||t.join(r),!0};function vI(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),i=e.resolve(n.nodeSize-1);return ue.between(r,i)}const NI=(t,e,n,r={})=>({editor:i,tr:s,state:o,dispatch:a,chain:l,commands:u,can:c})=>{const{extensions:d,splittableMarks:f}=i.extensionManager,h=bt(t,o.schema),p=bt(e,o.schema),{selection:g,storedMarks:b}=o,{$from:y,$to:E}=g,T=y.blockRange(E),v=b||g.$to.parentOffset&&g.$from.marks();if(!T)return!1;const R=qp(z=>Vd(z.type.name,d))(g),A=g.from===0&&g.to===o.doc.content.size,O=o.doc.content.content,P=O.length===1?O[0]:null,F=A&&P&&Vd(P.type.name,d)?{node:P,pos:0}:null,N=R??F,U=!!R&&T.depth>=1&&T.depth-R.depth<=1,j=!!F;if((U||j)&&N){if(N.node.type===h)return A&&j?l().command(({tr:z,dispatch:I})=>{const B=vI(z);return B?(z.setSelection(B),I&&I(z),!0):!1}).liftListItem(p).run():u.liftListItem(p);if(Vd(N.node.type.name,d)&&h.validContent(N.node.content))return l().command(()=>(s.setNodeMarkup(N.pos,h),!0)).command(()=>zd(s,h)).command(()=>jd(s,h)).run()}return!n||!v||!a?l().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>zd(s,h)).command(()=>jd(s,h)).run():l().command(()=>{const z=c().wrapInList(h,r),I=v.filter(B=>f.includes(B.type.name));return s.ensureMarks(I),z?!0:u.clearNodes()}).wrapInList(h,r).command(()=>zd(s,h)).command(()=>jd(s,h)).run()},_I=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:s=!1}=n,o=Fr(t,r.schema);return wh(r,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},II=(t,e,n={})=>({state:r,commands:i})=>{const s=bt(t,r.schema),o=bt(e,r.schema),a=Aa(r,s,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(o,l):i.setNode(s,{...l,...n})},RI=(t,e={})=>({state:n,commands:r})=>{const i=bt(t,n.schema);return Aa(n,i,e)?r.lift(i):r.wrapIn(i,e)},MI=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let s;if(i.spec.isInputRules&&(s=i.getState(t))){if(e){const o=t.tr,a=s.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(s.text){const l=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,t.schema.text(s.text,l))}else o.delete(s.from,s.to)}return!0}}return!1},OI=(t={})=>({tr:e,dispatch:n,editor:r})=>{const{ignoreClearable:i=!1}=t,{selection:s}=e,{empty:o,ranges:a}=s;if(o)return!0;const{nonClearableMarks:l}=r.extensionManager;if(n){const u=Object.values(r.schema.marks).filter(c=>i||!l.includes(c.name));a.forEach(c=>{for(const d of u)e.removeMark(c.$from.pos,c.$to.pos,d)})}return!0},DI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{extendEmptyMarkRange:s=!1}=e,{selection:o}=n,a=Fr(t,r.schema),{$from:l,empty:u,ranges:c}=o;if(!i)return!0;if(u&&s){var d;let{from:f,to:h}=o;const p=jp(l,a,(d=l.marks().find(g=>g.type===a))===null||d===void 0?void 0:d.attrs);p&&(f=p.from,h=p.to),n.removeMark(f,h,a)}else c.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,a)});return n.removeStoredMark(a),!0},LI=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let s,o;return typeof t=="number"?(s=t,o=t):t&&"from"in t&&"to"in t?(s=t.from,o=t.to):(s=i.from,o=i.to),r&&e.doc.nodesBetween(s,o,(a,l)=>{if(a.isText)return;const u={...a.attrs};delete u.dir,e.setNodeMarkup(l,void 0,u)}),!0},PI=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let s=null,o=null;const a=_c(typeof t=="string"?t:t.name,r.schema);if(!a)return!1;a==="node"&&(s=bt(t,r.schema)),a==="mark"&&(o=Fr(t,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{const c=u.$from.pos,d=u.$to.pos;let f,h,p,g;n.selection.empty?r.doc.nodesBetween(c,d,(b,y)=>{s&&s===b.type&&(l=!0,p=Math.max(y,c),g=Math.min(y+b.nodeSize,d),f=y,h=b)}):r.doc.nodesBetween(c,d,(b,y)=>{y<c&&s&&s===b.type&&(l=!0,p=Math.max(y,c),g=Math.min(y+b.nodeSize,d),f=y,h=b),y>=c&&y<=d&&(s&&s===b.type&&(l=!0,i&&n.setNodeMarkup(y,void 0,{...b.attrs,...e})),o&&b.marks.length&&b.marks.forEach(E=>{if(o===E.type&&(l=!0,i)){const T=Math.max(y,c),v=Math.min(y+b.nodeSize,d);n.addMark(T,v,o.create({...E.attrs,...e}))}}))}),h&&(f!==void 0&&i&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),o&&h.marks.length&&h.marks.forEach(b=>{o===b.type&&i&&n.addMark(p,g,o.create({...b.attrs,...e}))}))}),l},Es=new yt("__tiptap_decorations__"),BI=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(Es,{type:"force",name:t}),!0),FI=(t,e={})=>({state:n,dispatch:r})=>{const i=bt(t,n.schema);return hv(i,e)(n,r)},HI=(t,e={})=>({state:n,dispatch:r})=>{const i=bt(t,n.schema);return pv(i,e)(n,r)};var UI=T2({blur:()=>d_,clearContent:()=>f_,clearNodes:()=>h_,command:()=>p_,createParagraphNear:()=>m_,cut:()=>g_,deleteCurrentNode:()=>b_,deleteNode:()=>y_,deleteRange:()=>E_,deleteSelection:()=>x_,enter:()=>S_,exitCode:()=>w_,extendMarkRange:()=>k_,first:()=>A_,focus:()=>N_,forEach:()=>__,insertContent:()=>I_,insertContentAt:()=>R_,insertDefaultBlock:()=>M_,joinBackward:()=>L_,joinDown:()=>D_,joinForward:()=>P_,joinItemBackward:()=>B_,joinItemForward:()=>F_,joinTextblockBackward:()=>H_,joinTextblockForward:()=>U_,joinUp:()=>O_,keyboardShortcut:()=>V_,lift:()=>z_,liftEmptyBlock:()=>j_,liftListItem:()=>W_,newlineInCode:()=>q_,resetAttributes:()=>Y_,scrollIntoView:()=>K_,selectAll:()=>G_,selectNodeBackward:()=>X_,selectNodeForward:()=>Q_,selectParentNode:()=>Z_,selectTextblockEnd:()=>J_,selectTextblockStart:()=>eI,setContent:()=>tI,setMark:()=>yI,setMeta:()=>EI,setNode:()=>TI,setNodeSelection:()=>CI,setTextDirection:()=>xI,setTextSelection:()=>SI,sinkListItem:()=>wI,splitBlock:()=>kI,splitListItem:()=>AI,toggleList:()=>NI,toggleMark:()=>_I,toggleNode:()=>II,toggleWrap:()=>RI,undoInputRule:()=>MI,unsetAllMarks:()=>OI,unsetMark:()=>DI,unsetTextDirection:()=>LI,updateAttributes:()=>PI,updateDecorations:()=>BI,wrapIn:()=>FI,wrapInList:()=>HI});const Ho=new WeakMap;function $I(t,e){var n;Ho.set(t,((n=Ho.get(t))!==null&&n!==void 0?n:0)+1);try{return e()}finally{var r;const i=((r=Ho.get(t))!==null&&r!==void 0?r:1)-1;i>0?Ho.set(t,i):Ho.delete(t)}}var VI=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}};function zI(t){return t.kind==="widget"}function HT(t,e){const n=[],r=new Set;for(const i of t)i.kind==="widget"&&zI(i)&&r.add(i.key),n.push(i.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function jI(t,e,n){const{decorations:r,widgetKeys:i}=HT(e,n);return{set:Le.create(t,r),widgetKeys:i}}function UT({position:t,from:e,to:n,docSize:r}){return t<e?!1:t<n?!0:t===n&&n===r}function WI({decorations:t,from:e,to:n,docSize:r,extensionName:i,warnedExtensions:s}){return t.filter(o=>UT({position:o.anchor,from:e,to:n,docSize:r})?!0:(o.anchor===n||s.has(i)||(s.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function qI(t){var e;const n=(e=t.spec)===null||e===void 0?void 0:e.key;return typeof n=="string"?n:void 0}function $T(t){return t.jsonID==="attr"}function YI(t){let e=!1;if(t.getMap().forEach(()=>{e=!0}),e||$T(t))return!0;const n=t;return typeof n.from=="number"&&typeof n.to=="number"}function KI(t,e){let n=null,r=0,i=0;for(let s=0;s<t.childCount&&!(i>e.to);s+=1){const o=i+t.child(s).nodeSize;o>=e.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function GI(t,e){if(t.steps.some(s=>!YI(s)))return{type:"full"};const n=DT(t).map(({newRange:s})=>s);t.steps.forEach((s,o)=>{if(!$T(s))return;const a=t.mapping.slice(o);n.push({from:a.map(s.pos,-1),to:a.map(s.pos+1)})});const r=[];for(const s of n){const o=KI(e,s);o&&r.push(o)}r.sort((s,o)=>s.from-o.from);const i=[];for(const s of r){const o=i[i.length-1];o&&s.from<=o.to?o.to=Math.max(o.to,s.to):i.push({...s})}return{type:"ranges",ranges:i}}function VT(t,e,n,r){return t.map(e,n,{onRemove:i=>{const s=i?.key;typeof s=="string"&&r.delete(s)}})}function XI(t,e,n){var r,i;const s=(r=e.decorationSetsByExtension[t])!==null&&r!==void 0?r:Le.empty,o=new Set((i=e.widgetKeysByExtension[t])!==null&&i!==void 0?i:[]);return{set:VT(s,n.mapping,n.doc,o),widgetKeys:o}}function s1(t,e){const n=Object.values(e).flatMap(r=>r.find());return Le.create(t,n)}function o1(t){const e=new Set;for(const n of Object.values(t))for(const r of n)e.add(r);return e}function QI(t,e){var n;switch((n=e.update)!==null&&n!==void 0?n:"document"){case"document":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case"changedRanges":if(!e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case"manual":if(e.createInRange)throw new Error(`[tiptap error]: Extension "${t}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(e.shouldUpdate)throw new Error(`[tiptap error]: Extension "${t}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw new Error(`[tiptap error]: Extension "${t}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function ZI(t,e,n){return n?!0:t.update==="manual"?!1:t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged}const JI=new Set;var eR=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{const n=Es.getState(e);n&&this.warnDuplicateWidgetKeys(n)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:e,spec:n})=>QI(e,n)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on("beforeTransaction",this.handleBeforeTransaction)}destroy(){this.editor.off("beforeTransaction",this.handleBeforeTransaction)}liveWidgetKeys(){var t,e;return(t=(e=Es.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&t!==void 0?t:JI}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){const e=[];for(const{name:n,addDecorations:r}of t){const i=r();i&&e.push({name:n,spec:i})}return e}createPlugin(){const{editor:t,entries:e}=this;return new nt({key:Es,state:{init:(n,r)=>{const i={},s={};for(const{name:a,spec:l}of e){const{set:u,widgetKeys:c}=this.buildFullSet(a,l,r);i[a]=u,s[a]=c}const o={decorationSetsByExtension:i,widgetKeysByExtension:s,mergedDecorationSet:this.buildMergedSet(r.doc,i),widgetKeys:o1(s)};return this.warnDuplicateWidgetKeys(o),o},apply:(n,r,i,s)=>{const o=n.getMeta(Es),a=o?.type==="force"&&!o.name,l=o?.type==="force"?o.name:void 0,u={},c={},d=new Set;return $I(t,()=>{for(const{name:f,spec:h}of e){const p=a||l===f;if(ZI(h,{editor:t,tr:n,oldState:i,newState:s},p))if(h.update==="changedRanges"&&n.docChanged&&!p){const g=this.applyChangedRangesRecompute(f,h,r,n,s);u[f]=g.set,c[f]=g.widgetKeys,d.add(f)}else{const{set:g,widgetKeys:b}=this.buildFullSet(f,h,s);u[f]=g,c[f]=b,d.add(f)}else{const g=XI(f,r,n);u[f]=g.set,c[f]=g.widgetKeys}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:u,widgetKeysByExtension:c,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:u,recomputedNames:d}),widgetKeys:o1(c)}}},props:{decorations(n){var r,i;return(r=(i=Es.getState(n))===null||i===void 0?void 0:i.mergedDecorationSet)!==null&&r!==void 0?r:Le.empty}}})}applyChangedRangesRecompute(t,e,n,r,i){const s=GI(r,i.doc);return s.type==="full"?this.buildFullSet(t,e,i):this.rebuildRanges(t,e,n,r,i,s.ranges)}rebuildRanges(t,e,n,r,i,s){var o,a;const l=(o=n.decorationSetsByExtension[t])!==null&&o!==void 0?o:Le.empty,u=new Set((a=n.widgetKeysByExtension[t])!==null&&a!==void 0?a:[]);let c=VT(l,r.mapping,r.doc,u);const d=i.doc.content.size;for(const{from:f,to:h}of s){const p=c.find(f,h).filter(y=>UT({position:y.from,from:f,to:h,docSize:d}));for(const y of p){const E=qI(y);E&&u.delete(E)}c=c.remove(p);const{decorations:g,widgetKeys:b}=HT(WI({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:i,view:this.mountedView,from:f,to:h})),from:f,to:h,docSize:d,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);c=c.add(i.doc,g);for(const y of b)u.add(y)}return{set:c,widgetKeys:u}}buildFullSet(t,e,n){const r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));return jI(n.doc,r,t)}runCreate(t,e,n){try{return n()}catch(r){return console.error(`[tiptap error]: Extension "${t}" threw in \`addDecorations().${e}()\`. Its decorations were dropped for this update.`,r),[]}}warnDuplicateWidgetKeys(t){}buildMergedSet(t,e){const n=Object.keys(e);return n.length===1?e[n[0]]:s1(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return t.length===1?r[t[0].name]:i.size===0?e.mergedDecorationSet.map(n.mapping,n.doc):s1(n.doc,r)}};function tR(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}function nR(t){return typeof t=="number"}function rR(t){return Object.prototype.toString.call(t).slice(8,-1)}function Nl(t){return rR(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function zT(t,e){const n={...t};return Nl(t)&&Nl(e)&&Object.keys(e).forEach(r=>{Nl(e[r])&&Nl(t[r])?n[r]=zT(t[r],e[r]):n[r]=e[r]}),n}function iR(t,e,n={}){const{state:r}=e,{doc:i,tr:s}=r,o=t;i.descendants((a,l)=>{const u=s.mapping.map(l),c=s.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(h=>{if(h!==o)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){const h=t.type.create({...t.attrs,...n});s.removeMark(u,c,t.type),s.addMark(u,c,h)}}),s.docChanged&&e.view.dispatch(s)}var sR=class{constructor(e){var n;this.find=e.find,this.handler=e.handler,this.undoable=(n=e.undoable)!==null&&n!==void 0?n:!0}};const oR=(t,e)=>{if(zp(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function _l(t){var e;const{editor:n,from:r,to:i,text:s,rules:o,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(f=>f.type.spec.code))return!1;let c=!1;const d=hI(u)+s;return o.forEach(f=>{if(c)return;const h=oR(d,f.find);if(!h)return;const p=h[0].length-s.length;if(p>0){const R=u.parentOffset-p;if(R<0||u.parent.textBetween(R,u.parentOffset)!==h[0].slice(0,p))return}const g=l.state.tr,b=Nc({state:l.state,transaction:g}),y={from:r-(h[0].length-s.length),to:i},{commands:E,chain:T,can:v}=new Ns({editor:n,state:b});f.handler({state:b,range:y,match:h,commands:E,chain:T,can:v})===null||!g.steps.length||(f.undoable&&g.setMeta(a,{transform:g,from:r,to:i,text:s}),l.dispatch(g),c=!0)}),c}function aR(t){const{editor:e,rules:n}=t,r=new nt({state:{init(){return null},apply(i,s,o){const a=i.getMeta(r);if(a)return a;const l=i.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Kp(q.from(u),o.schema);const{from:c}=l,d=c+u.length;_l({editor:e,from:c,to:d,text:u,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:s}},props:{handleTextInput(i,s,o,a){return _l({editor:e,from:s,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:s}=i.state.selection;s&&_l({editor:e,from:s.pos,to:s.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,s){if(s.key!=="Enter")return!1;const{$cursor:o}=i.state.selection;return o?_l({editor:e,from:o.pos,to:o.pos,text:`
13
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Qp=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...He(se(this,"addOptions",{name:this.name}))}}get storage(){return{...He(se(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>zT(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},ho=class jT extends Qp{constructor(...e){super(...e),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new jT(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const s=i.marks();if(!s.find(a=>a?.type.name===n.name))return!1;const o=s.find(a=>a?.type.name===n.name);return o&&r.removeStoredMark(o),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},lR=class{constructor(t){this.find=t.find,this.handler=t.handler}};const uR=(t,e,n)=>{if(zp(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const s=[i.text];return s.index=i.index,s.input=t,s.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),s.push(i.replaceWith)),s}):[]};function cR(t){const{editor:e,state:n,from:r,to:i,rule:s,pasteEvent:o,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Ns({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,i,(f,h)=>{var p,g,b,y;if(!((p=f.type)===null||p===void 0||(p=p.spec)===null||p===void 0)&&p.code||!(f.isText||f.isTextblock||f.isInline))return;const E=(g=(b=(y=f.content)===null||y===void 0?void 0:y.size)!==null&&b!==void 0?b:f.nodeSize)!==null&&g!==void 0?g:0,T=Math.max(r,h),v=Math.min(i,h+E);if(T>=v)return;const R=f.isText?f.text||"":f.textBetween(T-h,v-h,void 0,"");uR(R,s.find,o).forEach(A=>{if(A.index===void 0)return;const O=T+A.index+1,P=O+A[0].length,F={from:n.tr.mapping.map(O),to:n.tr.mapping.map(P)},N=s.handler({state:n,range:F,match:A,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:a});d.push(N)})}),d.every(f=>f!==null)}let Il=null;const dR=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function fR(t){const{editor:e,rules:n}=t;let r=null,i=!1,s=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:c,to:d,rule:f,pasteEvt:h})=>{const p=u.tr,g=Nc({state:u,transaction:p});if(!(!cR({editor:e,state:g,from:Math.max(c-1,0),to:d.b-1,rule:f,pasteEvent:h,dropEvent:a})||!p.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return n.map(u=>new nt({view(c){const d=h=>{var p;r=!((p=c.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?c.dom.parentElement:null,r&&(Il=e)},f=()=>{Il&&(Il=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(c,d)=>{if(s=r===c.dom.parentElement,a=d,!s){const f=Il;f?.isEditable&&setTimeout(()=>{const h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(c,d)=>{var f;const h=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return o=d,i=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(c,d,f)=>{const h=c[0],p=h.getMeta("uiEvent")==="paste"&&!i,g=h.getMeta("uiEvent")==="drop"&&!s,b=h.getMeta("applyPasteRules"),y=!!b;if(!p&&!g&&!y)return;if(y){let{text:v}=b;typeof v=="string"?v=v:v=Kp(q.from(v),f.schema);const{from:R}=b,A=R+v.length,O=dR(v);return l({rule:u,state:f,from:R,to:{b:A},pasteEvt:O})}const E=d.doc.content.findDiffStart(f.doc.content),T=d.doc.content.findDiffEnd(f.doc.content);if(!(!nR(E)||!T||E===T.b))return l({rule:u,state:f,from:E,to:T,pasteEvt:o})}}))}var Ic=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=Gp(t),this.schema=RT(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n=se(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ls(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this,e=ia([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:ls(r.name,this.schema)},s=[],o=se(r,"addKeyboardShortcuts",i);let a={};if(r.type==="mark"&&se(r,"exitable",i)&&(a.ArrowRight=()=>ho.handleExit({editor:t,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([h,p])=>[h,()=>p({editor:t})]));a={...a,...f}}const l=c_(a);s.push(l);const u=se(r,"addInputRules",i);if(n1(r,t.options.enableInputRules)&&u){const f=u();if(f&&f.length){const h=aR({editor:t,rules:f}),p=Array.isArray(h)?h:[h];s.push(...p)}}const c=se(r,"addPasteRules",i);if(n1(r,t.options.enablePasteRules)&&c){const f=c();if(f&&f.length){const h=fR({editor:t,rules:f});s.push(...h)}}const d=se(r,"addProseMirrorPlugins",i);if(d){const f=d();s.push(...f)}return s}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;const{editor:e}=this;(t=this.decorationManager)===null||t===void 0||t.destroy();const n=[];return this.extensions.forEach(r=>{const i=se(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ls(r.name,this.schema)});i&&n.push({name:r.name,addDecorations:i})}),this.decorationManager=new eR({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){return IT(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=qs(this.extensions);return Object.fromEntries(e.filter(n=>!!se(n,"addNodeView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),i=se(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:bt(n.name,this.schema)});if(!i)return[];const s=i();if(!s)return[];const o=(a,l,u,c,d)=>{const f=va(a,r);return s({node:a,view:l,getPos:u,decorations:c,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,o]}))}dispatchTransaction(t){const{editor:e}=this;return ia([...this.extensions].reverse()).reduceRight((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ls(r.name,this.schema)},s=se(r,"dispatchTransaction",i);return s?o=>{s.call(i,{transaction:o,next:n})}:n},t)}transformPastedHTML(t){const{editor:e}=this;return ia([...this.extensions]).reduce((n,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ls(r.name,this.schema)},s=se(r,"transformPastedHTML",i);return s?(o,a)=>{const l=n(o,a);return s.call(i,l)}:n},t||(n=>n))}get markViews(){const{editor:t}=this,{markExtensions:e}=qs(this.extensions);return Object.fromEntries(e.filter(n=>!!se(n,"addMarkView")).map(n=>{const r=this.attributes.filter(o=>o.type===n.name),i=se(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Fr(n.name,this.schema)});if(!i)return[];const s=(o,a,l)=>{const u=va(o,r);return i()({mark:o,view:a,inline:l,editor:t,extension:n,HTMLAttributes:u,updateAttributes:c=>{iR(o,t,c)}})};return[n.name,s]}))}destroy(){var t;(t=this.decorationManager)===null||t===void 0||t.destroy(),this.extensions.forEach(e=>{let n=e;for(;n.parent;){const r=n.parent;r.child===n&&(r.child=null),n=r}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ls(e.name,this.schema)};if(e.type==="mark"){var r,i;(!((r=He(se(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((i=He(se(e,"clearable",n)))!==null&&i!==void 0)||i||this.nonClearableMarks.push(e.name)}const s=se(e,"onBeforeCreate",n),o=se(e,"onCreate",n),a=se(e,"onUpdate",n),l=se(e,"onSelectionUpdate",n),u=se(e,"onTransaction",n),c=se(e,"onFocus",n),d=se(e,"onBlur",n),f=se(e,"onDestroy",n);s&&this.editor.on("beforeCreate",s),o&&this.editor.on("create",o),a&&this.editor.on("update",a),l&&this.editor.on("selectionUpdate",l),u&&this.editor.on("transaction",u),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Ic.resolve=Gp;Ic.sort=ia;Ic.flatten=Yp;var Kn=class WT extends Qp{constructor(...e){super(...e),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new WT(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};const qT=Kn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new nt({key:new yt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,s=OT(n),{blockSeparator:o}=this.options,a={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((l,u)=>l.$from.pos-u.$from.pos).map(({$from:l,$to:u})=>MT(r,{from:l.pos,to:u.pos},a)).join(o??`
14
+
15
+ `)}}})]}}),YT=Kn.create({name:"commands",addCommands(){return{...UI}}}),KT=Kn.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;const i=()=>{var s,o,a;if((s=(o=this.editor.options.coreExtensionOptions)===null||o===void 0||(o=o.delete)===null||o===void 0||(a=o.filterTransaction)===null||a===void 0?void 0:a.call(o,t))!==null&&s!==void 0?s:t.getMeta("y-sync$"))return;const l=nI(t.before,[t,...e]);DT(l).forEach(c=>{l.mapping.mapResult(c.oldRange.from).deletedAfter&&l.mapping.mapResult(c.oldRange.to).deletedBefore&&l.before.nodesBetween(c.oldRange.from,c.oldRange.to,(d,f)=>{const h=f+d.nodeSize-2,p=c.oldRange.from<=f&&h<=c.oldRange.to;this.editor.emit("delete",{type:"node",node:d,from:f,to:h,newFrom:l.mapping.map(f),newTo:l.mapping.map(h),deletedRange:c.oldRange,newRange:c.newRange,partial:!p,editor:this.editor,transaction:t,combinedTransform:l})})});const u=l.mapping;l.steps.forEach((c,d)=>{if(c instanceof Bn){var f,h;const p=u.slice(d).map(c.from,-1),g=u.slice(d).map(c.to),b=u.invert().map(p,-1),y=u.invert().map(g),E=p>0?(f=l.doc.nodeAt(p-1))===null||f===void 0?void 0:f.marks.some(v=>v.eq(c.mark)):!1,T=(h=l.doc.nodeAt(g))===null||h===void 0?void 0:h.marks.some(v=>v.eq(c.mark));this.editor.emit("delete",{type:"mark",mark:c.mark,from:c.from,to:c.to,deletedRange:{from:b,to:y},newRange:{from:p,to:g},partial:!!(T||E),editor:this.editor,transaction:t,combinedTransform:l})}})};!((n=(r=this.editor.options.coreExtensionOptions)===null||r===void 0||(r=r.delete)===null||r===void 0?void 0:r.async)!==null&&n!==void 0)||n?setTimeout(i,0):i()}}),GT=Kn.create({name:"drop",addProseMirrorPlugins(){return[new nt({key:new yt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),XT=Kn.create({name:"editable",addProseMirrorPlugins(){return[new nt({key:new yt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),QT=new yt("focusEvents"),ZT=Kn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new nt({key:QT,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),JT=Kn.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:u}=a,{empty:c,$anchor:d}=l,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=p.parent.type.spec.isolating,b=d.pos-d.parentOffset,y=g&&p.parent.childCount===1?b===d.pos:he.atStart(u).from===f;return!c||!h.type.isTextblock||h.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},s={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ka()||vT()?s:i},addProseMirrorPlugins(){return[new nt({key:new yt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;const r=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),i=t.some(h=>h.getMeta("preventClearDocument"));if(!r||i)return;const{empty:s,from:o,to:a}=e.selection,l=he.atStart(e.doc).from,u=he.atEnd(e.doc).to;if(s||!(o===l&&a===u)||!Xp(n.doc))return;const c=n.tr,d=Nc({state:n,transaction:c}),{commands:f}=new Ns({editor:this.editor,state:d});if(f.clearNodes(),!!c.steps.length)return c}})]}}),eC=Kn.create({name:"paste",addProseMirrorPlugins(){return[new nt({key:new yt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),tC=Kn.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new nt({key:new yt("tabindex"),props:{attributes:()=>{var t;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(t=this.options.value)!==null&&t!==void 0?t:"0"}}}})]}}),nC=Kn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=qs(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new nt({key:new yt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}});var iG=T2({ClipboardTextSerializer:()=>qT,Commands:()=>YT,Delete:()=>KT,Drop:()=>GT,Editable:()=>XT,FocusEvents:()=>ZT,Keymap:()=>JT,Paste:()=>eC,Tabindex:()=>tC,TextDirection:()=>nC,focusEventsPluginKey:()=>QT});let a1=!1;function hR(t){if(a1)return;a1=!0;let e;try{e=et.fromJSON(t,{from:0,to:0}).slice.content}catch{return}e instanceof q||console.warn("[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.")}var pR=class Xo{get name(){return this.node.type.name}constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!==null&&e!==void 0?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,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(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Xo(n,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 Xo(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 Xo(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,s=n.isAtom&&!n.isText,o=n.isInline,a=this.pos+r+(s?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!i&&!o&&l.depth<=this.depth)return;const u=new Xo(l,this.editor,i,i||o?n:null);i&&(u.actualDepth=this.depth+1),e.push(u)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const s=i.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(s[l]!==n[l])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const s=Object.keys(n);return this.children.forEach(o=>{r&&i.length>0||(o.node.type.name===e&&s.every(a=>n[a]===o.node.attrs[a])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}};const mR=`.ProseMirror {
16
+ position: relative;
17
+ }
18
+
19
+ .ProseMirror {
20
+ word-wrap: break-word;
21
+ white-space: pre-wrap;
22
+ white-space: break-spaces;
23
+ -webkit-font-variant-ligatures: none;
24
+ font-variant-ligatures: none;
25
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
26
+ }
27
+
28
+ .ProseMirror [contenteditable="false"] {
29
+ white-space: normal;
30
+ }
31
+
32
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
33
+ white-space: pre-wrap;
34
+ }
35
+
36
+ .ProseMirror pre {
37
+ white-space: pre-wrap;
38
+ }
39
+
40
+ img.ProseMirror-separator {
41
+ display: inline !important;
42
+ border: none !important;
43
+ margin: 0 !important;
44
+ width: 0 !important;
45
+ height: 0 !important;
46
+ }
47
+
48
+ .ProseMirror-gapcursor {
49
+ display: none;
50
+ pointer-events: none;
51
+ position: absolute;
52
+ margin: 0;
53
+ }
54
+
55
+ .ProseMirror-gapcursor:after {
56
+ content: "";
57
+ display: block;
58
+ position: absolute;
59
+ top: -2px;
60
+ width: 20px;
61
+ border-top: 1px solid black;
62
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
63
+ }
64
+
65
+ @keyframes ProseMirror-cursor-blink {
66
+ to {
67
+ visibility: hidden;
68
+ }
69
+ }
70
+
71
+ .ProseMirror-hideselection *::selection {
72
+ background: transparent;
73
+ }
74
+
75
+ .ProseMirror-hideselection *::-moz-selection {
76
+ background: transparent;
77
+ }
78
+
79
+ .ProseMirror-hideselection * {
80
+ caret-color: transparent;
81
+ }
82
+
83
+ .ProseMirror-focused .ProseMirror-gapcursor {
84
+ display: block;
85
+ }`;var sG=class extends VI{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:n})=>{throw n},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:mI,createMappablePosition:gI},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),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:n,slice:r,moved:i})=>this.options.onDrop(n,r,i)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);const e=this.createDoc();if(!this.editorState){const n=Ch(e,this.options.autofocus);this.editorState=vi.create({doc:e,schema:this.schema,selection:n||void 0})}hR(this.schema),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():Ns.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Ns.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=tR(mR,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=_T(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(s))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[XT,qT.configure({blockSeparator:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),YT,ZT,JT,tC.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),GT,eC,KT,nC.configure({direction:this.options.textDirection})].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new Ic(n,this)}createCommandManager(){this.commandManager=new Ns({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=Sh(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;const n=Sh(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=vi.create({doc:n,schema:this.schema,selection:Ch(n,this.options.autofocus)||void 0}),this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(r=>r.name!=="collaboration"),this.createExtensionManager()}}),this.editorState.doc}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,s=e.transformPastedHTML,o=this.extensionManager.transformPastedHTML(s);this.editorView=new ET(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS();const l=this.view.dom;l.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(u=>{var c;return(c=this.capturedTransaction)===null||c===void 0?void 0:c.step(u)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(t.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||s.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return cI(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return pI(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Kp(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
86
+
87
+ `,textSerializers:n={}}=t||{};return lI(this.state.doc,{blockSeparator:e,textSerializers:{...OT(this.schema),...n}})}get isEmpty(){return Xp(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var t,e;return(t=(e=this.editorView)===null||e===void 0?void 0:e.isDestroyed)!==null&&t!==void 0?t:!0}$node(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)===null||n===void 0?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new pR(e,this,!1,n)}get $doc(){return this.$pos(0)}};function Ys(t){return new sR({find:t.find,handler:({state:e,range:n,match:r})=>{const i=He(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:s}=e,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),u=n.from+a.indexOf(o),c=u+o.length;if(LT(n.from,n.to,e.doc).filter(f=>f.mark.type.excluded.find(h=>h===t.type&&h!==f.mark.type)).filter(f=>f.to>u).length)return null;c<n.to&&s.delete(c,n.to),u>n.from&&s.delete(n.from+l,u);const d=n.from+l+o.length;s.addMark(n.from+l,d,t.type.create(i||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}var gR=class rC extends Qp{constructor(...e){super(...e),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new rC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},bR=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=()=>{try{return e.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n;const{view:r}=this.editor,i=t.target,s=i.nodeType===3?(e=i.parentElement)===null||e===void 0?void 0:e.closest("[data-drag-handle]"):i.closest("[data-drag-handle]");if(!this.dom||!((n=this.contentDOM)===null||n===void 0)&&n.contains(i)||!s)return;let o=0,a=0;if(this.dom!==s){var l,u,c,d;const E=this.dom.getBoundingClientRect(),T=s.getBoundingClientRect(),v=(l=t.offsetX)!==null&&l!==void 0?l:(u=t.nativeEvent)===null||u===void 0?void 0:u.offsetX,R=(c=t.offsetY)!==null&&c!==void 0?c:(d=t.nativeEvent)===null||d===void 0?void 0:d.offsetY;o=T.x-E.x+v,a=T.y-E.y+R}const f=this.dom.cloneNode(!0);try{const E=this.dom.getBoundingClientRect();f.style.width=`${Math.round(E.width)}px`,f.style.height=`${Math.round(E.height)}px`,f.style.boxSizing="border-box",f.style.pointerEvents="none"}catch{}let h=null;try{var p;h=document.createElement("div"),h.style.position="absolute",h.style.top="-9999px",h.style.left="-9999px",h.style.pointerEvents="none",h.appendChild(f),document.body.appendChild(h),(p=t.dataTransfer)===null||p===void 0||p.setDragImage(f,o,a)}finally{h&&setTimeout(()=>{try{h?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=ae.create(r.state.doc,g),y=r.state.tr.setSelection(b);r.dispatch(y)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!(!((e=this.contentDOM)===null||e===void 0)&&e.contains(n))))return!1;const r=t.type.startsWith("drag"),i=t.type==="dragover"||t.type==="dragenter",s=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!s&&!r)return!0;const{isEditable:o}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,u=ae.isSelectable(this.node),c=t.type==="copy",d=t.type==="paste",f=t.type==="cut",h=t.type==="mousedown";if(!l&&u&&r&&t.target===this.dom&&t.preventDefault(),l&&r&&!a&&t.target===this.dom)return t.preventDefault(),!1;if(l&&o&&!a&&h){const p=n.closest("[data-drag-handle]");p&&(this.dom===p||this.dom.contains(p))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(a||i||s||c||d||f||h&&u)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.contentDOM.contains(t.target)&&t.type==="childList"&&(ka()||xh())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function Ks(t){return new lR({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const s=He(t.getAttributes,void 0,r,i);if(s===!1||s===null)return null;const{tr:o}=e,a=r[r.length-1],l=r[0];let u=n.to;if(a){const c=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(LT(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(p=>p===t.type&&p!==h.mark.type)).filter(h=>h.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+c,d),u=n.from+c+a.length,o.addMark(n.from+c,u,t.type.create(s||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(t.type)}}})}const zn=Math.floor,ou=Math.abs,Mr=(t,e)=>t<e?t:e,jn=(t,e)=>t>e?t:e,iC=t=>t!==0?t<0:1/t<0,l1=1,u1=2,Wd=4,qd=8,Na=32,Or=64,Ut=128,yR=1<<29,Rc=31,kh=63,Pi=127,ER=2147483647,TR=crypto.getRandomValues.bind(crypto),CR=Math.random,sC=()=>TR(new Uint32Array(1))[0],xR=t=>t[zn(CR()*t.length)],SR="10000000-1000-4000-8000"+-1e11,wR=()=>SR.replace(/[018]/g,t=>(t^sC()&15>>t/4).toString(16));let Ah,vh;if(typeof WeakMap<"u"){let t=new WeakMap;Ah=e=>t.get(e),vh=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Ah=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},vh=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var Je=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,o=i+1;for(let a=1;s<this.width&&this.map[e+a]==n;a++)s++;for(let a=1;o<this.height&&this.map[e+this.width*a]==n;a++)o++;return{left:r,top:i,right:s,bottom:o}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:o}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:o==this.height)?null:this.map[r+this.width*(n<0?s-1:o)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:o,right:a,top:l,bottom:u}=this.findCell(e);return{left:Math.min(n,o),top:Math.min(i,l),right:Math.max(r,a),bottom:Math.max(s,u)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,o=this.map[s];n[o]||(n[o]=!0,!(i==t.left&&i&&this.map[s-1]==o||r==t.top&&r&&this.map[s-this.width]==o)&&e.push(o))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let o=e+t*this.width;const a=(t+1)*this.width;for(;o<a&&this.map[o]<i;)o++;return o==a?s-1:this.map[o]}i=s}}static get(t){return Ah(t)||vh(t,kR(t))}};function kR(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=AR(t),n=t.childCount,r=[];let i=0,s=null;const o=[];for(let u=0,c=e*n;u<c;u++)r[u]=0;for(let u=0,c=0;u<n;u++){const d=t.child(u);c++;for(let p=0;;p++){for(;i<r.length&&r[i]!=0;)i++;if(p==d.childCount)break;const g=d.child(p),{colspan:b,rowspan:y,colwidth:E}=g.attrs;for(let T=0;T<y;T++){if(T+u>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:c,n:y-T});break}const v=i+T*e;for(let R=0;R<b;R++){r[v+R]==0?r[v+R]=c:(s||(s=[])).push({type:"collision",row:u,pos:c,n:b-R});const A=E&&E[R];if(A){const O=(v+R)%e*2,P=o[O];P==null||P!=A&&o[O+1]==1?(o[O]=A,o[O+1]=1):P==A&&o[O+1]++}}}i+=b,c+=g.nodeSize}const f=(u+1)*e;let h=0;for(;i<f;)r[i++]==0&&h++;h&&(s||(s=[])).push({type:"missing",row:u,n:h}),c++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const a=new Je(e,n,r,s);let l=!1;for(let u=0;!l&&u<o.length;u+=2)o[u]!=null&&o[u+1]<n&&(l=!0);return l&&vR(a,o,t),a}function AR(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let o=0;o<r;o++){const a=t.child(o);for(let l=0;l<a.childCount;l++){const u=a.child(l);o+u.attrs.rowspan>r&&(s+=u.attrs.colspan)}}for(let o=0;o<i.childCount;o++){const a=i.child(o);s+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function vR(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const o=n.nodeAt(s);if(!o)throw new RangeError(`No cell with offset ${s} found`);let a=null;const l=o.attrs;for(let u=0;u<l.colspan;u++){const c=e[(i+u)%t.width*2];c!=null&&(!l.colwidth||l.colwidth[u]!=c)&&((a||(a=NR(l)))[u]=c)}a&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:a})}}function NR(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Rt(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}const Kr=new yt("selectingCells");function Vi(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function _R(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function hr(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Zp(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Vi(e.$head)||IR(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function IR(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Nh(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function RR(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Jp(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function oC(t,e,n){const r=t.node(-1),i=Je.get(r),s=t.start(-1),o=i.nextCell(t.pos-s,e,n);return o==null?null:t.node(0).resolve(s+o)}function zi(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function aC(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function MR(t,e,n){const r=Rt(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var Xe=class Sr extends he{constructor(e,n=e){const r=e.node(-1),i=Je.get(r),s=e.start(-1),o=i.rectBetween(e.pos-s,n.pos-s),a=e.node(0),l=i.cellsInRect(o).filter(c=>c!=n.pos-s);l.unshift(n.pos-s);const u=l.map(c=>{const d=r.nodeAt(c);if(!d)throw new RangeError(`No cell with offset ${c} found`);const f=s+c+1;return new C2(a.resolve(f),a.resolve(f+d.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Nh(r)&&Nh(i)&&Jp(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Sr.rowSelection(r,i):s&&this.isColSelection()?Sr.colSelection(r,i):new Sr(r,i)}return ue.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=Je.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},o=[];for(let l=i.top;l<i.bottom;l++){const u=[];for(let c=l*n.width+i.left,d=i.left;d<i.right;d++,c++){const f=n.map[c];if(s[f])continue;s[f]=!0;const h=n.findCell(f);let p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);const g=i.left-h.left,b=h.right-i.right;if(g>0||b>0){let y=p.attrs;if(g>0&&(y=zi(y,0,g)),b>0&&(y=zi(y,y.colspan-b,b)),h.left<i.left){if(p=p.type.createAndFill(y),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else p=p.type.create(y,p.content)}if(h.top<i.top||h.bottom>i.bottom){const y={...p.attrs,rowspan:Math.min(h.bottom,i.bottom)-Math.max(h.top,i.top)};h.top<i.top?p=p.type.createAndFill(y):p=p.type.create(y,p.content)}u.push(p)}o.push(e.child(l).copy(q.from(u)))}const a=this.isColSelection()&&this.isRowSelection()?e:o;return new ee(q.from(a),1,1)}replace(e,n=ee.empty){const r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){const{$from:a,$to:l}=i[o],u=e.mapping.slice(r);e.replace(u.map(a.pos),u.map(l.pos),o?ee.empty:n)}const s=he.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new ee(q.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=Je.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let o=0;o<s.length;o++)e(n.nodeAt(s[o]),i+s[o])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=Je.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),l=e.node(0);return o.top<=a.top?(o.top>0&&(e=l.resolve(s+i.map[o.left])),a.bottom<i.height&&(n=l.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(s+i.map[a.left])),o.bottom<i.height&&(e=l.resolve(s+i.map[i.width*(i.height-1)+o.right-1]))),new Sr(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=Je.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const o=i+this.$anchorCell.nodeAfter.attrs.colspan,a=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(e){return e instanceof Sr&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=Je.get(r),s=e.start(-1),o=i.findCell(e.pos-s),a=i.findCell(n.pos-s),l=e.node(0);return o.left<=a.left?(o.left>0&&(e=l.resolve(s+i.map[o.top*i.width])),a.right<i.width&&(n=l.resolve(s+i.map[i.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(s+i.map[a.top*i.width])),o.right<i.width&&(e=l.resolve(s+i.map[i.width*(o.top+1)-1]))),new Sr(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Sr(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Sr(e.resolve(n),e.resolve(r))}getBookmark(){return new OR(this.$anchorCell.pos,this.$headCell.pos)}};Xe.prototype.visible=!1;he.jsonID("cell",Xe);var OR=class lC{constructor(e,n){this.anchor=e,this.head=n}map(e){return new lC(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Jp(n,r)?new Xe(n,r):he.near(r,1)}};function DR(t){if(!(t.selection instanceof Xe))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(ut.node(r,r+n.nodeSize,{class:"selectedCell"}))}),Le.create(t.doc,e)}function LR({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function PR({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function BR(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,o;if(r instanceof ae&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")s=Xe.create(i,r.from);else if(o=="row"){const a=i.resolve(r.from+1);s=Xe.rowSelection(a,a)}else if(!n){const a=Je.get(r.node),l=r.from+1,u=l+a.map[a.width*a.height-1];s=Xe.create(i,l+1,u)}}else r instanceof ue&&LR(r)?s=ue.create(i,r.from):r instanceof ue&&PR(r)&&(s=ue.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}const FR=new yt("fix-tables");function uC(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let o=0,a=0;o<s;o++){const l=e.child(o);for(let u=a,c=Math.min(i,o+3);u<c;u++)if(t.child(u)==l){a=u+1,n+=l.nodeSize;continue e}r(l,n),a<i&&t.child(a).sameMarkup(l)?uC(t.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function HR(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=UR(t,i,s,n))};return e?e.doc!=t.doc&&uC(e.doc,t.doc,0,r):t.doc.descendants(r),n}function UR(t,e,n,r){const i=Je.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let l=0;l<i.height;l++)s.push(0);for(let l=0;l<i.problems.length;l++){const u=i.problems[l];if(u.type=="collision"){const c=e.nodeAt(u.pos);if(!c)continue;const d=c.attrs;for(let f=0;f<d.rowspan;f++)s[u.row+f]+=u.n;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,zi(d,d.colspan-u.n,u.n))}else if(u.type=="missing")s[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...c.attrs,rowspan:c.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const c=e.nodeAt(u.pos);if(!c)continue;r.setNodeMarkup(r.mapping.map(n+1+u.pos),null,{...c.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const c=r.mapping.map(n);r.delete(c,c+e.nodeSize)}}let o,a;for(let l=0;l<s.length;l++)s[l]&&(o==null&&(o=l),a=l);for(let l=0,u=n+1;l<i.height;l++){const c=e.child(l),d=u+c.nodeSize,f=s[l];if(f>0){let h="cell";c.firstChild&&(h=c.firstChild.type.spec.tableRole);const p=[];for(let b=0;b<f;b++){const y=Rt(t.schema)[h].createAndFill();y&&p.push(y)}const g=(l==0||o==l-1)&&a==l?u+1:d-1;r.insert(r.mapping.map(g),p)}u=d}return r.setMeta(FR,{fixTables:!0})}function pr(t){const e=t.selection,n=Zp(t),r=n.node(-1),i=n.start(-1),s=Je.get(r);return{...e instanceof Xe?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function cC(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;MR(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let o=0;o<e.height;o++){const a=o*e.width+i;if(i>0&&i<e.width&&e.map[a-1]==e.map[a]){const l=e.map[a],u=r.nodeAt(l);t.setNodeMarkup(t.mapping.map(n+l),null,aC(u.attrs,i-e.colCount(l))),o+=u.attrs.rowspan-1}else{const l=s==null?Rt(r.type.schema).cell:r.nodeAt(e.map[a+s]).type,u=e.positionAt(o,i,r);t.insert(t.mapping.map(n+u),l.createAndFill())}}return t}function oG(t,e){if(!hr(t))return!1;if(e){const n=pr(t);e(cC(t.tr,n,n.left))}return!0}function aG(t,e){if(!hr(t))return!1;if(e){const n=pr(t);e(cC(t.tr,n,n.right))}return!0}function $R(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let o=0;o<e.height;){const a=o*e.width+i,l=e.map[a],u=n.nodeAt(l),c=u.attrs;if(i>0&&e.map[a-1]==l||i<e.width-1&&e.map[a+1]==l)t.setNodeMarkup(t.mapping.slice(s).map(r+l),null,zi(c,i-e.colCount(l)));else{const d=t.mapping.slice(s).map(r+l);t.delete(d,d+u.nodeSize)}o+=c.rowspan}}function lG(t,e){if(!hr(t))return!1;if(e){const n=pr(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;$R(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Je.get(s)}e(r)}return!0}function VR(t,e,n){var r;const i=Rt(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))===null||r===void 0?void 0:r.type)!=i)return!1;return!0}function dC(t,{map:e,tableStart:n,table:r},i){let s=n;for(let u=0;u<i;u++)s+=r.child(u).nodeSize;const o=[];let a=i>0?-1:0;VR(e,r,i+a)&&(a=i==0||i==e.height?null:0);for(let u=0,c=e.width*i;u<e.width;u++,c++)if(i>0&&i<e.height&&e.map[c]==e.map[c-e.width]){const d=e.map[c],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),u+=f.colspan-1}else{var l;const d=a==null?Rt(r.type.schema).cell:(l=r.nodeAt(e.map[c+a*e.width]))===null||l===void 0?void 0:l.type,f=d?.createAndFill();f&&o.push(f)}return t.insert(s,Rt(r.type.schema).row.create(null,o)),t}function uG(t,e){if(!hr(t))return!1;if(e){const n=pr(t);e(dC(t.tr,n,n.top))}return!0}function cG(t,e){if(!hr(t))return!1;if(e){const n=pr(t);e(dC(t.tr,n,n.bottom))}return!0}function zR(t,{map:e,table:n,tableStart:r},i){let s=0;for(let u=0;u<i;u++)s+=n.child(u).nodeSize;const o=s+n.child(i).nodeSize,a=t.mapping.maps.length;t.delete(s+r,o+r);const l=new Set;for(let u=0,c=i*e.width;u<e.width;u++,c++){const d=e.map[c];if(!l.has(d)){if(l.add(d),i>0&&d==e.map[c-e.width]){const f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...f,rowspan:f.rowspan-1}),u+=f.colspan-1}else if(i<e.height&&d==e.map[c+e.width]){const f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),g=e.positionAt(i+1,u,n);t.insert(t.mapping.slice(a).map(r+g),p),u+=h.colspan-1}}}}function dG(t,e){if(!hr(t))return!1;if(e){const n=pr(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;zR(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw new RangeError("No table found");n.table=s,n.map=Je.get(n.table)}e(r)}return!0}function c1(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function jR({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,o=(r.bottom-1)*t+r.left,a=i+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[a]==n[a+1])return!0;s+=t,a+=t}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[o]==n[o+t])return!0;i++,o++}return!1}function fG(t,e){const n=t.selection;if(!(n instanceof Xe)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=pr(t),{map:i}=r;if(jR(i,r))return!1;if(e){const s=t.tr,o={};let a=q.empty,l,u;for(let c=r.top;c<r.bottom;c++)for(let d=r.left;d<r.right;d++){const f=i.map[c*i.width+d],h=r.table.nodeAt(f);if(!(o[f]||!h))if(o[f]=!0,l==null)l=f,u=h;else{c1(h)||(a=a.append(h.content));const p=s.mapping.map(f+r.tableStart);s.delete(p,p+h.nodeSize)}}if(l==null||u==null)return!0;if(s.setNodeMarkup(l+r.tableStart,null,{...aC(u.attrs,u.attrs.colspan,r.right-r.left-u.attrs.colspan),rowspan:r.bottom-r.top}),a.size>0){const c=l+1+u.content.size,d=c1(u)?l+1:c;s.replaceWith(d+r.tableStart,c+r.tableStart,a)}s.setSelection(new Xe(s.doc.resolve(l+r.tableStart))),e(s)}return!0}function hG(t,e){const n=Rt(t.schema);return WR(({node:r})=>n[r.type.spec.tableRole])(t,e)}function WR(t){return(e,n)=>{const r=e.selection;let i,s;if(r instanceof Xe){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;i=r.$anchorCell.nodeAfter,s=r.$anchorCell.pos}else{var o;if(i=_R(r.$from),!i)return!1;s=(o=Vi(r.$from))===null||o===void 0?void 0:o.pos}if(i==null||s==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const l=[],u=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const c=pr(e),d=e.tr;for(let h=0;h<c.right-c.left;h++)l.push(u?{...a,colwidth:u&&u[h]?[u[h]]:null}:a);let f;for(let h=c.top;h<c.bottom;h++){let p=c.map.positionAt(h,c.left,c.table);h==c.top&&(p+=i.nodeSize);for(let g=c.left,b=0;g<c.right;g++,b++)g==c.left&&h==c.top||d.insert(f=d.mapping.map(p+c.tableStart,1),t({node:i,row:h,col:g}).createAndFill(l[b]))}d.setNodeMarkup(s,t({node:i,row:c.top,col:c.left}),l[0]),r instanceof Xe&&d.setSelection(new Xe(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function qR(t){return function(e,n){if(!hr(e))return!1;if(n){const r=Rt(e.schema),i=pr(e),s=e.tr,o=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),a=o.map(l=>i.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&s.setNodeMarkup(i.tableStart+o[l],r.cell,a[l].attrs);if(s.steps.length===0)for(let l=0;l<o.length;l++)s.setNodeMarkup(i.tableStart+o[l],r.header_cell,a[l].attrs);n(s)}return!0}}function d1(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function em(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?qR(t):function(n,r){if(!hr(n))return!1;if(r){const i=Rt(n.schema),s=pr(n),o=n.tr,a=d1("row",s,i),l=d1("column",s,i),u=(t==="column"?a:t==="row"&&l)?1:0,c=t=="column"?{left:0,top:u,right:1,bottom:s.map.height}:t=="row"?{left:u,top:0,right:s.map.width,bottom:1}:s,d=t=="column"?l?i.cell:i.header_cell:t=="row"?a?i.cell:i.header_cell:i.cell;s.map.cellsInRect(c).forEach(f=>{const h=f+s.tableStart,p=o.doc.nodeAt(h);p&&o.setNodeMarkup(h,d,p.attrs)}),r(o)}return!0}}em("row",{useDeprecatedLogic:!0});em("column",{useDeprecatedLogic:!0});em("cell",{useDeprecatedLogic:!0});function YR(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),o=s.lastChild;if(o)return i-1-o.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function pG(t){return function(e,n){if(!hr(e))return!1;const r=YR(Zp(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(ue.between(i,RR(i))).scrollIntoView())}return!0}}function Rl(t,e){const n=t.selection;if(!(n instanceof Xe))return!1;if(e){const r=t.tr,i=Rt(t.schema).cell.createAndFill().content;n.forEachCell((s,o)=>{s.content.eq(i)||r.replace(r.mapping.map(o+1),r.mapping.map(o+s.nodeSize-1),new ee(i,0,0))}),r.docChanged&&e(r)}return!0}function KR(t){if(t.size===0)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,o=i.type.schema,a=[];if(s=="row")for(let l=0;l<e.childCount;l++){let u=e.child(l).content;const c=l?0:Math.max(0,n-1),d=l<e.childCount-1?0:Math.max(0,r-1);(c||d)&&(u=_h(Rt(o).row,new ee(u,c,d)).content),a.push(u)}else if(s=="cell"||s=="header_cell")a.push(n||r?_h(Rt(o).row,new ee(e,n,r)).content:e);else return null;return GR(o,a)}function GR(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let o=s.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=s.child(o).attrs;for(let u=i;u<i+a;u++)n[u]=(n[u]||0)+l}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(q.empty),n[i]<r){const s=Rt(t).cell.createAndFill(),o=[];for(let a=n[i];a<r;a++)o.push(s);e[i]=e[i].append(q.from(o))}return{height:e.length,width:r,rows:e}}function _h(t,e){const n=t.createAndFill();return new vp(n).replace(0,n.content.size,e).doc}function XR({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],o=[];for(let a=0;a<n.length;a++){const l=n[a],u=[];for(let c=s[a]||0,d=0;c<r;d++){let f=l.child(d%l.childCount);c+f.attrs.colspan>r&&(f=f.type.createChecked(zi(f.attrs,f.attrs.colspan,c+f.attrs.colspan-r),f.content)),u.push(f),c+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)s[a+h]=(s[a+h]||0)+f.attrs.colspan}o.push(q.from(u))}n=o,t=r}if(e!=i){const s=[];for(let o=0,a=0;o<i;o++,a++){const l=[],u=n[a%e];for(let c=0;c<u.childCount;c++){let d=u.child(c);o+d.attrs.rowspan>i&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,i-d.attrs.rowspan)},d.content)),l.push(d)}s.push(q.from(l))}n=s,e=i}return{width:t,height:e,rows:n}}function QR(t,e,n,r,i,s,o){const a=t.doc.type.schema,l=Rt(a);let u,c;if(i>e.width)for(let d=0,f=0;d<e.height;d++){const h=n.child(d);f+=h.nodeSize;const p=[];let g;h.lastChild==null||h.lastChild.type==l.cell?g=u||(u=l.cell.createAndFill()):g=c||(c=l.header_cell.createAndFill());for(let b=e.width;b<i;b++)p.push(g);t.insert(t.mapping.slice(o).map(f-1+r),p)}if(s>e.height){const d=[];for(let p=0,g=(e.height-1)*e.width;p<Math.max(e.width,i);p++){const b=p>=e.width?!1:n.nodeAt(e.map[g+p]).type==l.header_cell;d.push(b?c||(c=l.header_cell.createAndFill()):u||(u=l.cell.createAndFill()))}const f=l.row.create(null,q.from(d)),h=[];for(let p=e.height;p<s;p++)h.push(f);t.insert(t.mapping.slice(o).map(r+n.nodeSize-2),h)}return!!(u||c)}function f1(t,e,n,r,i,s,o,a){if(o==0||o==e.height)return!1;let l=!1;for(let u=i;u<s;u++){const c=o*e.width+u,d=e.map[c];if(e.map[c-e.width]==d){l=!0;const f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(a).map(d+r),null,{...f.attrs,rowspan:o-h}),t.insert(t.mapping.slice(a).map(e.positionAt(o,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-o})),u+=f.attrs.colspan-1}}return l}function h1(t,e,n,r,i,s,o,a){if(o==0||o==e.width)return!1;let l=!1;for(let u=i;u<s;u++){const c=u*e.width+o,d=e.map[c];if(e.map[c-1]==d){l=!0;const f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(a).map(d+r);t.setNodeMarkup(p,null,zi(f.attrs,o-h,f.attrs.colspan-(o-h))),t.insert(p+f.nodeSize,f.type.createAndFill(zi(f.attrs,0,o-h))),u+=f.attrs.rowspan-1}}return l}function p1(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let o=Je.get(s);const{top:a,left:l}=r,u=l+i.width,c=a+i.height,d=t.tr;let f=0;function h(){if(s=n?d.doc.nodeAt(n-1):d.doc,!s)throw new Error("No table found");o=Je.get(s),f=d.mapping.maps.length}QR(d,o,s,n,u,c,f)&&h(),f1(d,o,s,n,l,u,a,f)&&h(),f1(d,o,s,n,l,u,c,f)&&h(),h1(d,o,s,n,a,c,l,f)&&h(),h1(d,o,s,n,a,c,u,f)&&h();for(let p=a;p<c;p++){const g=o.positionAt(p,l,s),b=o.positionAt(p,u,s);d.replace(d.mapping.slice(f).map(g+n),d.mapping.slice(f).map(b+n),new ee(i.rows[p-a],0,0))}h(),d.setSelection(new Xe(d.doc.resolve(n+o.positionAt(a,l,s)),d.doc.resolve(n+o.positionAt(c-1,u-1,s)))),e(d)}const ZR=Vp({ArrowLeft:Ml("horiz",-1),ArrowRight:Ml("horiz",1),ArrowUp:Ml("vert",-1),ArrowDown:Ml("vert",1),"Shift-ArrowLeft":Ol("horiz",-1),"Shift-ArrowRight":Ol("horiz",1),"Shift-ArrowUp":Ol("vert",-1),"Shift-ArrowDown":Ol("vert",1),Backspace:Rl,"Mod-Backspace":Rl,Delete:Rl,"Mod-Delete":Rl});function au(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Ml(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Xe)return au(n,r,he.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const o=fC(i,t,e);if(o==null)return!1;if(t=="horiz")return au(n,r,he.near(n.doc.resolve(s.head+e),e));{const a=n.doc.resolve(o),l=oC(a,t,e);let u;return l?u=he.near(l,1):e<0?u=he.near(n.doc.resolve(a.before(-1)),-1):u=he.near(n.doc.resolve(a.after(-1)),1),au(n,r,u)}}}function Ol(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let o;if(s instanceof Xe)o=s;else{const l=fC(i,t,e);if(l==null)return!1;o=new Xe(n.doc.resolve(l))}const a=oC(o.$headCell,t,e);return a?au(n,r,new Xe(o.$anchorCell,a)):!1}}function JR(t,e){const n=t.state.doc,r=Vi(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Xe(r))),!0):!1}function e4(t,e,n){if(!hr(t.state))return!1;let r=KR(n);const i=t.state.selection;if(i instanceof Xe){r||(r={width:1,height:1,rows:[q.from(_h(Rt(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),o=i.$anchorCell.start(-1),a=Je.get(s).rectBetween(i.$anchorCell.pos-o,i.$headCell.pos-o);return r=XR(r,a.right-a.left,a.bottom-a.top),p1(t.state,t.dispatch,o,a,r),!0}else if(r){const s=Zp(t.state),o=s.start(-1);return p1(t.state,t.dispatch,o,Je.get(s.node(-1)).findCell(s.pos-o),r),!0}else return!1}function t4(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;const r=m1(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Xe)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Vi(t.state.selection.$anchor))!=null&&((n=Yd(t,e))===null||n===void 0?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(l,u){let c=Yd(t,u);const d=Kr.getState(t.state)==null;if(!c||!Jp(l,c))if(d)c=l;else return;const f=new Xe(l,c);if(d||!t.state.selection.eq(f)){const h=t.state.tr.setSelection(f);d&&h.setMeta(Kr,l.pos),t.dispatch(h)}}function o(){t.root.removeEventListener("mouseup",o),t.root.removeEventListener("dragstart",o),t.root.removeEventListener("mousemove",a),Kr.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(Kr,-1))}function a(l){const u=l,c=Kr.getState(t.state);let d;if(c!=null)d=t.state.doc.resolve(c);else if(m1(t,u.target)!=r&&(d=Yd(t,e),!d))return o();d&&s(d,u)}t.root.addEventListener("mouseup",o),t.root.addEventListener("dragstart",o),t.root.addEventListener("mousemove",a)}function fC(t,e,n){if(!(t.state.selection instanceof ue))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const o=r.before(i),a=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(a)?o:null}}return null}function m1(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Yd(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:i}=n;return r>=0&&Vi(t.state.doc.resolve(r))||Vi(t.state.doc.resolve(i))}var n4=class{constructor(t,e){this.node=t,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Ih(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,Ih(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Ih(t,e,n,r,i,s){let o=0,a=!0,l=e.firstChild;const u=t.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:h,colwidth:p}=u.child(d).attrs;for(let g=0;g<h;g++,f++){const b=i==f?s:p&&p[g],y=b?b+"px":"";if(o+=b||r,b||(a=!1),l)l.style.width!=y&&(l.style.width=y),l=l.nextSibling;else{const E=document.createElement("col");E.style.width=y,e.appendChild(E)}}}for(;l;){var c;const d=l.nextSibling;(c=l.parentNode)===null||c===void 0||c.removeChild(l),l=d}a?(n.style.width=o+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=o+"px")}}const mn=new yt("tableColumnResizing");function mG({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=n4,lastColumnResizable:i=!0}={}){const s=new nt({key:mn,state:{init(o,a){var l;const u=(l=s.spec)===null||l===void 0||(l=l.props)===null||l===void 0?void 0:l.nodeViews,c=Rt(a.schema).table.name;return r&&u&&(u[c]=(d,f)=>new r(d,n,f)),new r4(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=mn.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{i4(o,a,t,i)},mouseleave:o=>{s4(o)},mousedown:(o,a)=>{o4(o,a,e,n)}},decorations:o=>{const a=mn.getState(o);if(a&&a.activeHandle>-1)return d4(o,a.activeHandle)},nodeViews:{}}});return s}var r4=class lu{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(mn);if(r&&r.setHandle!=null)return new lu(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new lu(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Nh(e.doc.resolve(i))||(i=-1),new lu(i,n.dragging)}return n}};function i4(t,e,n,r){if(!t.editable)return;const i=mn.getState(t.state);if(i&&!i.dragging){const s=l4(e.target);let o=-1;if(s){const{left:a,right:l}=s.getBoundingClientRect();e.clientX-a<=n?o=g1(t,e,"left",n):l-e.clientX<=n&&(o=g1(t,e,"right",n))}if(o!=i.activeHandle){if(!r&&o!==-1){const a=t.state.doc.resolve(o),l=a.node(-1),u=Je.get(l),c=a.start(-1);if(u.colCount(a.pos-c)+a.nodeAfter.attrs.colspan-1==u.width-1)return}hC(t,o)}}}function s4(t){if(!t.editable)return;const e=mn.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&hC(t,-1)}function o4(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!==null&&i!==void 0?i:window,o=mn.getState(t.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=t.state.doc.nodeAt(o.activeHandle),l=a4(t,o.activeHandle,a.attrs);t.dispatch(t.state.tr.setMeta(mn,{setDragging:{startX:e.clientX,startWidth:l}}));function u(d){s.removeEventListener("mouseup",u),s.removeEventListener("mousemove",c);const f=mn.getState(t.state);f?.dragging&&(u4(t,f.activeHandle,b1(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(mn,{setDragging:null})))}function c(d){if(!d.which)return u(d);const f=mn.getState(t.state);if(f&&f.dragging){const h=b1(f.dragging,d,n);y1(t,f.activeHandle,h,r)}}return y1(t,o.activeHandle,l,r),s.addEventListener("mouseup",u),s.addEventListener("mousemove",c),e.preventDefault(),!0}function a4(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let o=s.node.childNodes[s.offset].offsetWidth,a=n;if(r)for(let l=0;l<n;l++)r[l]&&(o-=r[l],a--);return o/a}function l4(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function g1(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:o}=s,a=Vi(t.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const l=Je.get(a.node(-1)),u=a.start(-1),c=l.map.indexOf(a.pos-u);return c%l.width==0?-1:u+l.map[c-1]}function b1(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function hC(t,e){t.dispatch(t.state.tr.setMeta(mn,{setHandle:e}))}function u4(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=Je.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=t.state.tr;for(let u=0;u<s.height;u++){const c=u*s.width+a;if(u&&s.map[c]==s.map[c-s.width])continue;const d=s.map[c],f=i.nodeAt(d).attrs,h=f.colspan==1?0:a-s.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;const p=f.colwidth?f.colwidth.slice():c4(f.colspan);p[h]=n,l.setNodeMarkup(o+d,null,{...f,colwidth:p})}l.docChanged&&t.dispatch(l)}function y1(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),o=i.start(-1),a=Je.get(s).colCount(i.pos-o)+i.nodeAfter.attrs.colspan-1;let l=t.domAtPos(i.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Ih(s,l.firstChild,l,r,a,n)}function c4(t){return Array(t).fill(0)}function d4(t,e){const n=[],r=t.doc.resolve(e),i=r.node(-1);if(!i)return Le.empty;const s=Je.get(i),o=r.start(-1),a=s.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1;for(let u=0;u<s.height;u++){const c=a+u*s.width;if((a==s.width-1||s.map[c]!=s.map[c+1])&&(u==0||s.map[c]!=s.map[c-s.width])){var l;const d=s.map[c],f=o+d+i.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((l=mn.getState(t))===null||l===void 0)&&l.dragging&&n.push(ut.node(o+d,o+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(ut.widget(f,h))}}return Le.create(t.doc,n)}function gG({allowTableNodeSelection:t=!1}={}){return new nt({key:Kr,state:{init(){return null},apply(e,n){const r=e.getMeta(Kr);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:DR,handleDOMEvents:{mousedown:t4},createSelectionBetween(e){return Kr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:JR,handleKeyDown:ZR,handlePaste:e4},appendTransaction(e,n,r){return BR(r,HR(r,n),t)}})}var f4=class pC{constructor(e){this.cache=new Map(e)}get(e){return this.cache.get(e)}set(e,n,r){e<0||this.cache.set(e,[n,r])}replace(e,n,r,i){this.remove(e),this.set(n,r,i)}remove(e){this.cache.delete(e)}invalidate(e){const n=new pC(this.cache),r=e.mapping;return this.cache.forEach(([i,s],o)=>{if(o<0)return;const a=r.mapResult(o),l=e.doc.nodeAt(a.pos);if(a.deleted||!l?.eq(i))n.remove(o);else if(o!==a.pos){const u=s.map(c=>c.map(r,0,0)).filter(c=>c!=null);n.replace(o,a.pos,l,u)}}),n}};function bG({parser:t,nodeTypes:e=["code_block","codeBlock"],languageExtractor:n=r=>r.attrs.language}){const r=new yt("prosemirror-highlight");return new nt({key:r,state:{init(i,s){const o=new f4,[a,l]=E1(s.doc,t,e,n,o);return{cache:o,decorations:a,promises:l}},apply:(i,s)=>{const o=s.cache.invalidate(i),a=!!i.getMeta("prosemirror-highlight-refresh");if(!i.docChanged&&!a)return{cache:o,decorations:s.decorations?.map(i.mapping,i.doc),promises:s.promises};const[l,u]=E1(i.doc,t,e,n,o);return{cache:o,decorations:l,promises:u}}},view:i=>{const s=new Set,o=()=>{if(s.size>0||i.isDestroyed)return;const l=i.state.tr.setMeta("prosemirror-highlight-refresh",!0);i.dispatch(l)},a=()=>{const l=r.getState(i.state);for(const u of l?.promises??[])s.add(u),u.then(()=>{s.delete(u),o()}).catch(c=>{console.error("[prosemirror-highlight] Error resolving parser:",c),s.delete(u)})};return a(),{update:()=>{a()}}},props:{decorations(i){return this.getState(i)?.decorations}}})}function E1(t,e,n,r,i){const s=[],o=[],a=h4(t,n);try{for(const[l,u]of a){const c=r(l),d=i.get(u);if(d){const[f,h]=d;h.length>0&&s.push(h)}else{const f=e({content:l.textContent,language:c||void 0,pos:u,size:l.nodeSize});f&&Array.isArray(f)?(i.set(u,l,f),f.length>0&&s.push(f)):f instanceof Promise?(i.remove(u),o.push(f)):console.error("[prosemirror-highlight] Invalid parser result:",f)}}}catch(l){console.error("[prosemirror-highlight] Error parsing code blocks:",l)}return[s.length>0?Le.create(t,s.flat()):void 0,o]}function h4(t,e){const n=[];return t.descendants((r,i)=>{if(r.type.inlineContent&&e.includes(r.type.name))return n.push([r,i]),!1}),n}function yG(t,e){return function({content:r,language:i,pos:s,size:o}){const a=[],{tokens:l,fg:u,bg:c,rootStyle:d}=t.codeToTokens(r,{lang:i,theme:t.getLoadedThemes()[0]}),f=d||(u&&c?`--prosemirror-highlight:${u};--prosemirror-highlight-bg:${c}`:"");if(f){const p=ut.node(s,s+o,{style:f});a.push(p)}let h=s+1;for(const p of l){for(const g of p){const b=h+g.content.length,y=ut.inline(h,b,{style:p4(g.htmlStyle??`color: ${g.color}`),class:"shiki"});a.push(y),h=b}h+=1}return a}}function p4(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}const Mn=()=>new Map,Rh=t=>{const e=Mn();return t.forEach((n,r)=>{e.set(r,n)}),e},mr=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},m4=(t,e)=>{const n=[];for(const[r,i]of t)n.push(e(i,r));return n},g4=(t,e)=>{for(const[n,r]of t)if(e(r,n))return!0;return!1},ji=()=>new Set,Kd=t=>t[t.length-1],b4=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},ui=Array.from,tm=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},nm=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1},y4=(t,e)=>{const n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n},Gs=Array.isArray;class mC{constructor(){this._observers=Mn()}on(e,n){return mr(this._observers,e,ji).add(n),n}once(e,n){const r=(...i)=>{this.off(e,r),n(...i)};this.on(e,r)}off(e,n){const r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return ui((this._observers.get(e)||Mn()).values()).forEach(r=>r(...n))}destroy(){this._observers=Mn()}}const Lu=Number.MAX_SAFE_INTEGER,T1=Number.MIN_SAFE_INTEGER,E4=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&zn(t)===t),gC=String.fromCharCode,T4=t=>t.toLowerCase(),C4=/^\s*/g,x4=t=>t.replace(C4,""),S4=/([A-Z])/g,C1=(t,e)=>x4(t.replace(S4,n=>`${e}${T4(n)}`)),w4=t=>{const e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let i=0;i<n;i++)r[i]=e.codePointAt(i);return r},_a=typeof TextEncoder<"u"?new TextEncoder:null,k4=t=>_a.encode(t),A4=_a?k4:w4;let sa=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});sa&&sa.decode(new Uint8Array).length===1&&(sa=null);const v4=(t,e)=>y4(e,()=>t).join("");class el{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const tl=()=>new el,N4=t=>{const e=tl();return t(e),Fn(e)},_4=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e},Fn=t=>{const e=new Uint8Array(_4(t));let n=0;for(let r=0;r<t.bufs.length;r++){const i=t.bufs[r];e.set(i,n),n+=i.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},I4=(t,e)=>{const n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(jn(n,e)*2),t.cpos=0)},ft=(t,e)=>{const n=t.cbuf.length;t.cpos===n&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(n*2),t.cpos=0),t.cbuf[t.cpos++]=e},Mh=ft,ve=(t,e)=>{for(;e>Pi;)ft(t,Ut|Pi&e),e=zn(e/128);ft(t,Pi&e)},rm=(t,e)=>{const n=iC(e);for(n&&(e=-e),ft(t,(e>kh?Ut:0)|(n?Or:0)|kh&e),e=zn(e/64);e>0;)ft(t,(e>Pi?Ut:0)|Pi&e),e=zn(e/128)},Oh=new Uint8Array(3e4),R4=Oh.length/3,M4=(t,e)=>{if(e.length<R4){const n=_a.encodeInto(e,Oh).written||0;ve(t,n);for(let r=0;r<n;r++)ft(t,Oh[r])}else dn(t,A4(e))},O4=(t,e)=>{const n=unescape(encodeURIComponent(e)),r=n.length;ve(t,r);for(let i=0;i<r;i++)ft(t,n.codePointAt(i))},_s=_a&&_a.encodeInto?M4:O4,Mc=(t,e)=>{const n=t.cbuf.length,r=t.cpos,i=Mr(n-r,e.length),s=e.length-i;t.cbuf.set(e.subarray(0,i),r),t.cpos+=i,s>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(jn(n*2,s)),t.cbuf.set(e.subarray(i)),t.cpos=s)},dn=(t,e)=>{ve(t,e.byteLength),Mc(t,e)},im=(t,e)=>{I4(t,e);const n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},D4=(t,e)=>im(t,4).setFloat32(0,e,!1),L4=(t,e)=>im(t,8).setFloat64(0,e,!1),P4=(t,e)=>im(t,8).setBigInt64(0,e,!1),x1=new DataView(new ArrayBuffer(4)),B4=t=>(x1.setFloat32(0,t),x1.getFloat32(0)===t),Xs=(t,e)=>{switch(typeof e){case"string":ft(t,119),_s(t,e);break;case"number":E4(e)&&ou(e)<=ER?(ft(t,125),rm(t,e)):B4(e)?(ft(t,124),D4(t,e)):(ft(t,123),L4(t,e));break;case"bigint":ft(t,122),P4(t,e);break;case"object":if(e===null)ft(t,126);else if(Gs(e)){ft(t,117),ve(t,e.length);for(let n=0;n<e.length;n++)Xs(t,e[n])}else if(e instanceof Uint8Array)ft(t,116),dn(t,e);else{ft(t,118);const n=Object.keys(e);ve(t,n.length);for(let r=0;r<n.length;r++){const i=n[r];_s(t,i),Xs(t,e[i])}}break;case"boolean":ft(t,e?120:121);break;default:ft(t,127)}};class S1 extends el{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&ve(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}}const w1=t=>{t.count>0&&(rm(t.encoder,t.count===1?t.s:-t.s),t.count>1&&ve(t.encoder,t.count-2))};class uu{constructor(){this.encoder=new el,this.s=0,this.count=0}write(e){this.s===e?this.count++:(w1(this),this.count=1,this.s=e)}toUint8Array(){return w1(this),Fn(this.encoder)}}const k1=t=>{if(t.count>0){const e=t.diff*2+(t.count===1?0:1);rm(t.encoder,e),t.count>1&&ve(t.encoder,t.count-2)}};class Gd{constructor(){this.encoder=new el,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(k1(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return k1(this),Fn(this.encoder)}}class F4{constructor(){this.sarr=[],this.s="",this.lensE=new uu}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){const e=new el;return this.sarr.push(this.s),this.s="",_s(e,this.sarr.join("")),Mc(e,this.lensE.toUint8Array()),Fn(e)}}const dr=t=>new Error(t),On=()=>{throw dr("Method unimplemented")},zt=()=>{throw dr("Unexpected case")},bC=dr("Unexpected end of array"),yC=dr("Integer out of Range");class Oc{constructor(e){this.arr=e,this.pos=0}}const po=t=>new Oc(t),H4=t=>t.pos!==t.arr.length,U4=(t,e)=>{const n=new Uint8Array(t.arr.buffer,t.pos+t.arr.byteOffset,e);return t.pos+=e,n},fn=t=>U4(t,we(t)),Qs=t=>t.arr[t.pos++],we=t=>{let e=0,n=1;const r=t.arr.length;for(;t.pos<r;){const i=t.arr[t.pos++];if(e=e+(i&Pi)*n,n*=128,i<Ut)return e;if(e>Lu)throw yC}throw bC},sm=t=>{let e=t.arr[t.pos++],n=e&kh,r=64;const i=(e&Or)>0?-1:1;if((e&Ut)===0)return i*n;const s=t.arr.length;for(;t.pos<s;){if(e=t.arr[t.pos++],n=n+(e&Pi)*r,r*=128,e<Ut)return i*n;if(n>Lu)throw yC}throw bC},$4=t=>{let e=we(t);if(e===0)return"";{let n=String.fromCodePoint(Qs(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Qs(t));else for(;e>0;){const r=e<1e4?e:1e4,i=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,i),e-=r}return decodeURIComponent(escape(n))}},V4=t=>sa.decode(fn(t)),Is=sa?V4:$4,om=(t,e)=>{const n=new DataView(t.arr.buffer,t.arr.byteOffset+t.pos,e);return t.pos+=e,n},z4=t=>om(t,4).getFloat32(0,!1),j4=t=>om(t,8).getFloat64(0,!1),W4=t=>om(t,8).getBigInt64(0,!1),q4=[t=>{},t=>null,sm,z4,j4,W4,t=>!1,t=>!0,Is,t=>{const e=we(t),n={};for(let r=0;r<e;r++){const i=Is(t);n[i]=Ia(t)}return n},t=>{const e=we(t),n=[];for(let r=0;r<e;r++)n.push(Ia(t));return n},fn],Ia=t=>q4[127-Qs(t)](t);class A1 extends Oc{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),H4(this)?this.count=we(this)+1:this.count=-1),this.count--,this.s}}class cu extends Oc{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=sm(this);const e=iC(this.s);this.count=1,e&&(this.s=-this.s,this.count=we(this)+2)}return this.count--,this.s}}class Xd extends Oc{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){const e=sm(this),n=e&1;this.diff=zn(e/2),this.count=1,n&&(this.count=we(this)+2)}return this.s+=this.diff,this.count--,this.s}}class Y4{constructor(e){this.decoder=new cu(e),this.str=Is(this.decoder),this.spos=0}read(){const e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}}const K4=Date.now,v1=t=>new Promise(t);Promise.all.bind(Promise);const N1=t=>t===void 0?null:t;class G4{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}}let EC=new G4,X4=!0;try{typeof localStorage<"u"&&localStorage&&(EC=localStorage,X4=!1)}catch{}const Q4=EC,Ra=Symbol("Equality"),TC=(t,e)=>t===e||!!t?.[Ra]?.(e)||!1,Z4=t=>typeof t=="object",J4=Object.assign,CC=Object.keys,e6=(t,e)=>{for(const n in t)e(t[n],n)},Pu=t=>CC(t).length,t6=t=>{for(const e in t)return!1;return!0},mo=(t,e)=>{for(const n in t)if(!e(t[n],n))return!1;return!0},am=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n6=(t,e)=>t===e||Pu(t)===Pu(e)&&mo(t,(n,r)=>(n!==void 0||am(e,r))&&TC(e[r],n)),r6=Object.freeze,xC=t=>{for(const e in t){const n=t[e];(typeof n=="object"||typeof n=="function")&&xC(t[e])}return r6(t)},lm=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&lm(t,e,n+1)}},i6=t=>t,du=(t,e)=>{if(t===e)return!0;if(t==null||e==null||t.constructor!==e.constructor&&(t.constructor||Object)!==(e.constructor||Object))return!1;if(t[Ra]!=null)return t[Ra](e);switch(t.constructor){case ArrayBuffer:t=new Uint8Array(t),e=new Uint8Array(e);case Uint8Array:{if(t.byteLength!==e.byteLength)return!1;for(let n=0;n<t.length;n++)if(t[n]!==e[n])return!1;break}case Set:{if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(const n of t.keys())if(!e.has(n)||!du(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Pu(t)!==Pu(e))return!1;for(const n in t)if(!am(t,n)||!du(t[n],e[n]))return!1;break;case Array:if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!du(t[n],e[n]))return!1;break;default:return!1}return!0},s6=(t,e)=>e.includes(t);var SC={};const Zs=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",wC=typeof window<"u"&&typeof document<"u"&&!Zs;let Jn;const o6=()=>{if(Jn===void 0)if(Zs){Jn=Mn();const t=process.argv;let e=null;for(let n=0;n<t.length;n++){const r=t[n];r[0]==="-"?(e!==null&&Jn.set(e,""),e=r):e!==null&&(Jn.set(e,r),e=null)}e!==null&&Jn.set(e,"")}else typeof location=="object"?(Jn=Mn(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){const[e,n]=t.split("=");Jn.set(`--${C1(e,"-")}`,n),Jn.set(`-${C1(e,"-")}`,n)}})):Jn=Mn();return Jn},Dh=t=>o6().has(t),Bu=t=>N1(Zs?SC[t.toUpperCase().replaceAll("-","_")]:Q4.getItem(t)),kC=t=>Dh("--"+t)||Bu(t)!==null,a6=kC("production"),l6=Zs&&s6(SC.FORCE_COLOR,["true","1","2"]),u6=l6||!Dh("--no-colors")&&!kC("no-color")&&(!Zs||process.stdout.isTTY)&&(!Zs||Dh("--color")||Bu("COLORTERM")!==null||(Bu("TERM")||"").includes("color")),c6=t=>new Uint8Array(t),d6=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=gC(t[n]);return btoa(e)},f6=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64"),h6=wC?d6:f6,p6=t=>{const e=c6(t.byteLength);return e.set(t),e},m6=t=>N4(e=>Xs(e,t));class g6{constructor(e,n){this.left=e,this.right=n}}const xr=(t,e)=>new g6(t,e),_1=t=>t.next()>=.5,Qd=(t,e,n)=>zn(t.next()*(n+1-e)+e),AC=(t,e,n)=>zn(t.next()*(n+1-e)+e),um=(t,e,n)=>AC(t,e,n),b6=t=>gC(um(t,97,122)),y6=(t,e=0,n=20)=>{const r=um(t,e,n);let i="";for(let s=0;s<r;s++)i+=b6(t);return i},Zd=(t,e)=>e[um(t,0,e.length-1)],E6=Symbol("0schema");class T6{constructor(){this._rerrs=[]}extend(e,n,r,i=null){this._rerrs.push({path:e,expected:n,has:r,message:i})}toString(){const e=[];for(let n=this._rerrs.length-1;n>0;n--){const r=this._rerrs[n];e.push(v4(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
88
+ `)}}const Lh=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Ra]?TC(t,e):Gs(t)?tm(t,n=>nm(e,r=>Lh(n,r))):Z4(t)?mo(t,(n,r)=>Lh(n,e[r])):!1;let jt=class{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),Lh(n,r)}equals(e){return this.constructor===e.constructor&&du(this.shape,e.shape)}[E6](){return!0}[Ra](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){On()}get nullable(){return go(this,Fc)}get optional(){return new _C(this)}cast(e){return I1(e,this),e}expect(e){return I1(e,this),e}};class cm extends jt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){const r=e?.constructor===this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name,e?.constructor!==this.shape?"Constructor match failed":"Check failed"),r}}const at=(t,e=null)=>new cm(t,e);at(cm);class dm extends jt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}}const Et=t=>new dm(t);at(dm);class Dc extends jt{constructor(e){super(),this.shape=e}check(e,n){const r=this.shape.some(i=>i===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}}const Lc=(...t)=>new Dc(t),vC=at(Dc),C6=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),NC=t=>{if(Js.check(t))return[C6(t)];if(vC.check(t))return t.shape.map(e=>e+"");if(FC.check(t))return["[+-]?\\d+.?\\d*"];if(HC.check(t))return[".*"];if(Fu.check(t))return t.shape.map(NC).flat(1);zt()};class x6 extends jt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(NC).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){const r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}}at(x6);const S6=Symbol("optional");class _C extends jt{constructor(e){super(),this.shape=e}check(e,n){const r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[S6](){return!0}}const w6=at(_C);class k6 extends jt{check(e,n){return n?.extend(null,"never",typeof e),!1}}at(k6);class Pc extends jt{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new Pc(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):mo(this.shape,(r,i)=>{const s=this._isPartial&&!am(e,i)||r.check(e[i],n);return!s&&n?.extend(i.toString(),r.toString(),typeof e[i],"Object property does not match"),s})}}const A6=t=>new Pc(t),v6=at(Pc),N6=Et(t=>t!=null&&(t.constructor===Object||t.constructor==null));class IC extends jt{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&mo(e,(r,i)=>{const s=this.shape.keys.check(i,n);return!s&&n?.extend(i+"","Record",typeof e,s?"Key doesn't match schema":"Value doesn't match value"),s&&this.shape.values.check(r,n)})}}const RC=(t,e)=>new IC(t,e),_6=at(IC);class MC extends jt{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&mo(this.shape,(r,i)=>{const s=r.check(e[i],n);return!s&&n?.extend(i.toString(),"Tuple",typeof r),s})}}const I6=(...t)=>new MC(t);at(MC);class OC extends jt{constructor(e){super(),this.shape=e.length===1?e[0]:new fm(e)}check(e,n){const r=Gs(e)&&tm(e,i=>this.shape.check(i));return!r&&n?.extend(null,"Array",""),r}}const DC=(...t)=>new OC(t),R6=at(OC),M6=Et(t=>Gs(t));class LC extends jt{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){const r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}}const O6=(t,e=null)=>new LC(t,e);at(LC);const D6=O6(jt);class L6 extends jt{constructor(e){super(),this.len=e.length-1,this.args=I6(...e.slice(-1)),this.res=e[this.len]}check(e,n){const r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}}const P6=at(L6),B6=Et(t=>typeof t=="function");class F6 extends jt{constructor(e){super(),this.shape=e}check(e,n){const r=tm(this.shape,i=>i.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}}at(F6,t=>t.shape.length>0);class fm extends jt{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){const r=nm(this.shape,i=>i.check(e,n));return n?.extend(null,"Union",typeof e),r}}const go=(...t)=>t.findIndex(e=>Fu.check(e))>=0?go(...t.map(e=>Ma(e)).map(e=>Fu.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new fm(t),Fu=at(fm),PC=()=>!0,Hu=Et(PC),H6=at(dm,t=>t.shape===PC),hm=Et(t=>typeof t=="bigint"),U6=Et(t=>t===hm),BC=Et(t=>typeof t=="symbol");Et(t=>t===BC);const Rs=Et(t=>typeof t=="number"),FC=Et(t=>t===Rs),Js=Et(t=>typeof t=="string"),HC=Et(t=>t===Js),Bc=Et(t=>typeof t=="boolean"),$6=Et(t=>t===Bc),UC=Lc(void 0);at(Dc,t=>t.shape.length===1&&t.shape[0]===void 0);Lc(void 0);const Fc=Lc(null),V6=at(Dc,t=>t.shape.length===1&&t.shape[0]===null);at(Uint8Array);at(cm,t=>t.shape===Uint8Array);const z6=go(Rs,Js,Fc,UC,hm,Bc,BC);(()=>{const t=DC(Hu),e=RC(Js,Hu),n=go(Rs,Js,Fc,Bc,t,e);return t.shape=n,e.shape.values=n,n})();const Ma=t=>{if(D6.check(t))return t;if(N6.check(t)){const e={};for(const n in t)e[n]=Ma(t[n]);return A6(e)}else{if(M6.check(t))return go(...t.map(Ma));if(z6.check(t))return Lc(t);if(B6.check(t))return at(t)}zt()},I1=a6?()=>{}:(t,e)=>{const n=new T6;if(!e.check(t,n))throw dr(`Expected value to be of type ${e.constructor.name}.
89
+ ${n.toString()}`)};class j6{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:Ma(e),h:n}),this}else(e){return this.if(Hu,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){const i=this.patterns[r];if(i.if.check(e))return i.h(e,n)}throw dr("Unhandled pattern")}}}const W6=t=>new j6(t),$C=W6(Hu).if(FC,(t,e)=>Qd(e,T1,Lu)).if(HC,(t,e)=>y6(e)).if($6,(t,e)=>_1(e)).if(U6,(t,e)=>BigInt(Qd(e,T1,Lu))).if(Fu,(t,e)=>us(e,Zd(e,t.shape))).if(v6,(t,e)=>{const n={};for(const r in t.shape){let i=t.shape[r];if(w6.check(i)){if(_1(e))continue;i=i.shape}n[r]=$C(i,e)}return n}).if(R6,(t,e)=>{const n=[],r=AC(e,0,42);for(let i=0;i<r;i++)n.push(us(e,t.shape));return n}).if(vC,(t,e)=>Zd(e,t.shape)).if(V6,(t,e)=>null).if(P6,(t,e)=>{const n=us(e,t.res);return()=>n}).if(H6,(t,e)=>us(e,Zd(e,[Rs,Js,Fc,UC,hm,Bc,DC(Rs),RC(go("a","b","c"),Rs)]))).if(_6,(t,e)=>{const n={},r=Qd(e,0,3);for(let i=0;i<r;i++){const s=us(e,t.shape.keys),o=us(e,t.shape.values);n[s]=o}return n}).done(),us=(t,e)=>$C(Ma(e),t),nl=typeof document<"u"?document:{};Et(t=>t.nodeType===X6);typeof DOMParser<"u"&&new DOMParser;Et(t=>t.nodeType===Y6);Et(t=>t.nodeType===K6);const q6=t=>m4(t,(e,n)=>`${n}:${e};`).join(""),Y6=nl.ELEMENT_NODE,K6=nl.TEXT_NODE,G6=nl.DOCUMENT_NODE,X6=nl.DOCUMENT_FRAGMENT_NODE;Et(t=>t.nodeType===G6);const Q6=t=>class{constructor(n){this._=n}destroy(){t(this._)}},Z6=Q6(clearTimeout),pm=(t,e)=>new Z6(setTimeout(e,t)),Hr=Symbol,VC=Hr(),zC=Hr(),J6=Hr(),eM=Hr(),tM=Hr(),jC=Hr(),nM=Hr(),mm=Hr(),rM=Hr(),iM=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[];let r=0;for(;r<t.length;r++){const i=t[r];if(i===void 0)break;if(i.constructor===String||i.constructor===Number)e.push(i);else if(i.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){const i=t[r];i instanceof Symbol||n.push(i)}return n},sM={[VC]:xr("font-weight","bold"),[zC]:xr("font-weight","normal"),[J6]:xr("color","blue"),[tM]:xr("color","green"),[eM]:xr("color","grey"),[jC]:xr("color","red"),[nM]:xr("color","purple"),[mm]:xr("color","orange"),[rM]:xr("color","black")},oM=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());const e=[],n=[],r=Mn();let i=[],s=0;for(;s<t.length;s++){const o=t[s],a=sM[o];if(a!==void 0)r.set(a.left,a.right);else{if(o===void 0)break;if(o.constructor===String||o.constructor===Number){const l=q6(r);s>0||l.length>0?(e.push("%c"+o),n.push(l)):e.push(o)}else break}}for(s>0&&(i=n,i.unshift(e.join("")));s<t.length;s++){const o=t[s];o instanceof Symbol||i.push(o)}return i},WC=u6?oM:iM,aM=(...t)=>{console.log(...WC(t)),YC.forEach(e=>e.print(t))},qC=(...t)=>{console.warn(...WC(t)),t.unshift(mm),YC.forEach(e=>e.print(t))},YC=ji(),KC=t=>({[Symbol.iterator](){return this},next:t}),lM=(t,e)=>KC(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),Jd=(t,e)=>KC(()=>{const{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});class Hc{constructor(e,n){this.clock=e,this.len=n}}class bo{constructor(){this.clients=new Map}}const ci=(t,e,n)=>e.clients.forEach((r,i)=>{const s=t.doc.store.clients.get(i);if(s!=null){const o=s[s.length-1],a=o.id.clock+o.length;for(let l=0,u=r[l];l<r.length&&u.clock<a;u=r[++l])lx(t,s,u.clock,u.len,n)}}),uM=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){const i=zn((n+r)/2),s=t[i],o=s.clock;if(o<=e){if(e<o+s.len)return i;n=i+1}else r=i-1}return null},yo=(t,e)=>{const n=t.clients.get(e.client);return n!==void 0&&uM(n,e.clock)!==null},gm=t=>{t.clients.forEach(e=>{e.sort((i,s)=>i.clock-s.clock);let n,r;for(n=1,r=1;n<e.length;n++){const i=e[r-1],s=e[n];i.clock+i.len>=s.clock?e[r-1]=new Hc(i.clock,jn(i.len,s.clock+s.len-i.clock)):(r<n&&(e[r]=s),r++)}e.length=r})},Ph=t=>{const e=new bo;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,i)=>{if(!e.clients.has(i)){const s=r.slice();for(let o=n+1;o<t.length;o++)b4(s,t[o].clients.get(i)||[]);e.clients.set(i,s)}});return gm(e),e},Oa=(t,e,n,r)=>{mr(t.clients,e,()=>[]).push(new Hc(n,r))},GC=()=>new bo,XC=t=>{const e=GC();return t.clients.forEach((n,r)=>{const i=[];for(let s=0;s<n.length;s++){const o=n[s];if(o.deleted){const a=o.id.clock;let l=o.length;if(s+1<n.length)for(let u=n[s+1];s+1<n.length&&u.deleted;u=n[++s+1])l+=u.length;i.push(new Hc(a,l))}}i.length>0&&e.clients.set(r,i)}),e},Eo=(t,e)=>{ve(t.restEncoder,e.clients.size),ui(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),ve(t.restEncoder,n);const i=r.length;ve(t.restEncoder,i);for(let s=0;s<i;s++){const o=r[s];t.writeDsClock(o.clock),t.writeDsLen(o.len)}})},bm=t=>{const e=new bo,n=we(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();const i=we(t.restDecoder),s=we(t.restDecoder);if(s>0){const o=mr(e.clients,i,()=>[]);for(let a=0;a<s;a++)o.push(new Hc(t.readDsClock(),t.readDsLen()))}}return e},R1=(t,e,n)=>{const r=new bo,i=we(t.restDecoder);for(let s=0;s<i;s++){t.resetDsCurVal();const o=we(t.restDecoder),a=we(t.restDecoder),l=n.clients.get(o)||[],u=tt(n,o);for(let c=0;c<a;c++){const d=t.readDsClock(),f=d+t.readDsLen();if(d<u){u<f&&Oa(r,o,u,f-u);let h=Wn(l,d),p=l[h];for(!p.deleted&&p.id.clock<d&&(l.splice(h+1,0,qu(e,p,d-p.id.clock)),h++);h<l.length&&(p=l[h++],p.id.clock<f);)p.deleted||(f<p.id.clock+p.length&&l.splice(h,0,qu(e,p,f-p.id.clock)),p.delete(e))}else Oa(r,o,d,f-d)}}if(r.clients.size>0){const s=new Wi;return ve(s.restEncoder,0),Eo(s,r),s.toUint8Array()}return null},QC=sC;class Zi extends mC{constructor({guid:e=wR(),collectionid:n=null,gc:r=!0,gcFilter:i=()=>!0,meta:s=null,autoLoad:o=!1,shouldLoad:a=!0}={}){super(),this.gc=r,this.gcFilter=i,this.clientID=QC(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new ox,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=a,this.autoLoad=o,this.meta=s,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=v1(u=>{this.on("load",()=>{this.isLoaded=!0,u(this)})});const l=()=>v1(u=>{const c=d=>{(d===void 0||d===!0)&&(this.off("sync",c),u())};this.on("sync",c)});this.on("sync",u=>{u===!1&&this.isSynced&&(this.whenSynced=l()),this.isSynced=u===void 0||u===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=l()}load(){const e=this._item;e!==null&&!this.shouldLoad&&Ue(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(ui(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Ue(this,e,n)}get(e,n=mt){const r=mr(this.share,e,()=>{const s=new n;return s._integrate(this,null),s}),i=r.constructor;if(n!==mt&&i!==n)if(i===mt){const s=new n;s._map=r._map,r._map.forEach(o=>{for(;o!==null;o=o.left)o.parent=s}),s._start=r._start;for(let o=s._start;o!==null;o=o.right)o.parent=s;return s._length=r._length,this.share.set(e,s),s._integrate(this,null),s}else throw new Error(`Type with the name ${e} has already been defined with a different constructor`);return r}getArray(e=""){return this.get(e,Ds)}getText(e=""){return this.get(e,di)}getMap(e=""){return this.get(e,to)}getXmlElement(e=""){return this.get(e,Ht)}getXmlFragment(e=""){return this.get(e,qi)}toJSON(){const e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,ui(this.subdocs).forEach(n=>n.destroy());const e=this._item;if(e!==null){this._item=null;const n=e.content;n.doc=new Zi({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Ue(e.parent.doc,r=>{const i=n.doc;e.deleted||r.subdocsAdded.add(i),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}}class ZC{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return we(this.restDecoder)}readDsLen(){return we(this.restDecoder)}}class JC extends ZC{readLeftID(){return Ee(we(this.restDecoder),we(this.restDecoder))}readRightID(){return Ee(we(this.restDecoder),we(this.restDecoder))}readClient(){return we(this.restDecoder)}readInfo(){return Qs(this.restDecoder)}readString(){return Is(this.restDecoder)}readParentInfo(){return we(this.restDecoder)===1}readTypeRef(){return we(this.restDecoder)}readLen(){return we(this.restDecoder)}readAny(){return Ia(this.restDecoder)}readBuf(){return p6(fn(this.restDecoder))}readJSON(){return JSON.parse(Is(this.restDecoder))}readKey(){return Is(this.restDecoder)}}class cM{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=we(this.restDecoder),this.dsCurrVal}readDsLen(){const e=we(this.restDecoder)+1;return this.dsCurrVal+=e,e}}class eo extends cM{constructor(e){super(e),this.keys=[],we(e),this.keyClockDecoder=new Xd(fn(e)),this.clientDecoder=new cu(fn(e)),this.leftClockDecoder=new Xd(fn(e)),this.rightClockDecoder=new Xd(fn(e)),this.infoDecoder=new A1(fn(e),Qs),this.stringDecoder=new Y4(fn(e)),this.parentInfoDecoder=new A1(fn(e),Qs),this.typeRefDecoder=new cu(fn(e)),this.lenDecoder=new cu(fn(e))}readLeftID(){return new Ms(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new Ms(this.clientDecoder.read(),this.rightClockDecoder.read())}readClient(){return this.clientDecoder.read()}readInfo(){return this.infoDecoder.read()}readString(){return this.stringDecoder.read()}readParentInfo(){return this.parentInfoDecoder.read()===1}readTypeRef(){return this.typeRefDecoder.read()}readLen(){return this.lenDecoder.read()}readAny(){return Ia(this.restDecoder)}readBuf(){return fn(this.restDecoder)}readJSON(){return Ia(this.restDecoder)}readKey(){const e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{const n=this.stringDecoder.read();return this.keys.push(n),n}}}class ex{constructor(){this.restEncoder=tl()}toUint8Array(){return Fn(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){ve(this.restEncoder,e)}writeDsLen(e){ve(this.restEncoder,e)}}class rl extends ex{writeLeftID(e){ve(this.restEncoder,e.client),ve(this.restEncoder,e.clock)}writeRightID(e){ve(this.restEncoder,e.client),ve(this.restEncoder,e.clock)}writeClient(e){ve(this.restEncoder,e)}writeInfo(e){Mh(this.restEncoder,e)}writeString(e){_s(this.restEncoder,e)}writeParentInfo(e){ve(this.restEncoder,e?1:0)}writeTypeRef(e){ve(this.restEncoder,e)}writeLen(e){ve(this.restEncoder,e)}writeAny(e){Xs(this.restEncoder,e)}writeBuf(e){dn(this.restEncoder,e)}writeJSON(e){_s(this.restEncoder,JSON.stringify(e))}writeKey(e){_s(this.restEncoder,e)}}class tx{constructor(){this.restEncoder=tl(),this.dsCurrVal=0}toUint8Array(){return Fn(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){const n=e-this.dsCurrVal;this.dsCurrVal=e,ve(this.restEncoder,n)}writeDsLen(e){e===0&&zt(),ve(this.restEncoder,e-1),this.dsCurrVal+=e}}class Wi extends tx{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Gd,this.clientEncoder=new uu,this.leftClockEncoder=new Gd,this.rightClockEncoder=new Gd,this.infoEncoder=new S1(Mh),this.stringEncoder=new F4,this.parentInfoEncoder=new S1(Mh),this.typeRefEncoder=new uu,this.lenEncoder=new uu}toUint8Array(){const e=tl();return ve(e,0),dn(e,this.keyClockEncoder.toUint8Array()),dn(e,this.clientEncoder.toUint8Array()),dn(e,this.leftClockEncoder.toUint8Array()),dn(e,this.rightClockEncoder.toUint8Array()),dn(e,Fn(this.infoEncoder)),dn(e,this.stringEncoder.toUint8Array()),dn(e,Fn(this.parentInfoEncoder)),dn(e,this.typeRefEncoder.toUint8Array()),dn(e,this.lenEncoder.toUint8Array()),Mc(e,Fn(this.restEncoder)),Fn(e)}writeLeftID(e){this.clientEncoder.write(e.client),this.leftClockEncoder.write(e.clock)}writeRightID(e){this.clientEncoder.write(e.client),this.rightClockEncoder.write(e.clock)}writeClient(e){this.clientEncoder.write(e)}writeInfo(e){this.infoEncoder.write(e)}writeString(e){this.stringEncoder.write(e)}writeParentInfo(e){this.parentInfoEncoder.write(e?1:0)}writeTypeRef(e){this.typeRefEncoder.write(e)}writeLen(e){this.lenEncoder.write(e)}writeAny(e){Xs(this.restEncoder,e)}writeBuf(e){dn(this.restEncoder,e)}writeJSON(e){Xs(this.restEncoder,e)}writeKey(e){const n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}}const dM=(t,e,n,r)=>{r=jn(r,e[0].id.clock);const i=Wn(e,r);ve(t.restEncoder,e.length-i),t.writeClient(n),ve(t.restEncoder,r);const s=e[i];s.write(t,r-s.id.clock);for(let o=i+1;o<e.length;o++)e[o].write(t,0)},ym=(t,e,n)=>{const r=new Map;n.forEach((i,s)=>{tt(e,s)>i&&r.set(s,i)}),il(e).forEach((i,s)=>{n.has(s)||r.set(s,0)}),ve(t.restEncoder,r.size),ui(r.entries()).sort((i,s)=>s[0]-i[0]).forEach(([i,s])=>{dM(t,e.clients.get(i),i,s)})},fM=(t,e)=>{const n=Mn(),r=we(t.restDecoder);for(let i=0;i<r;i++){const s=we(t.restDecoder),o=new Array(s),a=t.readClient();let l=we(t.restDecoder);n.set(a,{i:0,refs:o});for(let u=0;u<s;u++){const c=t.readInfo();switch(Rc&c){case 0:{const d=t.readLen();o[u]=new Nn(Ee(a,l),d),l+=d;break}case 10:{const d=we(t.restDecoder);o[u]=new _n(Ee(a,l),d),l+=d;break}default:{const d=(c&(Or|Ut))===0,f=new We(Ee(a,l),null,(c&Ut)===Ut?t.readLeftID():null,null,(c&Or)===Or?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(c&Na)===Na?t.readString():null,Ix(t,c));o[u]=f,l+=f.length}}}}return n},hM=(t,e,n)=>{const r=[];let i=ui(n.keys()).sort((h,p)=>h-p);if(i.length===0)return null;const s=()=>{if(i.length===0)return null;let h=n.get(i[i.length-1]);for(;h.refs.length===h.i;)if(i.pop(),i.length>0)h=n.get(i[i.length-1]);else return null;return h};let o=s();if(o===null)return null;const a=new ox,l=new Map,u=(h,p)=>{const g=l.get(h);(g==null||g>p)&&l.set(h,p)};let c=o.refs[o.i++];const d=new Map,f=()=>{for(const h of r){const p=h.id.client,g=n.get(p);g?(g.i--,a.clients.set(p,g.refs.slice(g.i)),n.delete(p),g.i=0,g.refs=[]):a.clients.set(p,[h]),i=i.filter(b=>b!==p)}r.length=0};for(;;){if(c.constructor!==_n){const p=mr(d,c.id.client,()=>tt(e,c.id.client))-c.id.clock;if(p<0)r.push(c),u(c.id.client,c.id.clock-1),f();else{const g=c.getMissing(t,e);if(g!==null){r.push(c);const b=n.get(g)||{refs:[],i:0};if(b.refs.length===b.i)u(g,tt(e,g)),f();else{c=b.refs[b.i++];continue}}else(p===0||p<c.length)&&(c.integrate(t,p),d.set(c.id.client,c.id.clock+c.length))}}if(r.length>0)c=r.pop();else if(o!==null&&o.i<o.refs.length)c=o.refs[o.i++];else{if(o=s(),o===null)break;c=o.refs[o.i++]}}if(a.clients.size>0){const h=new Wi;return ym(h,a,new Map),ve(h.restEncoder,0),{missing:l,update:h.toUint8Array()}}return null},pM=(t,e)=>ym(t,e.doc.store,e.beforeState),mM=(t,e,n,r=new eo(t))=>Ue(e,i=>{i.local=!1;let s=!1;const o=i.doc,a=o.store,l=fM(r,o),u=hM(i,a,l),c=a.pendingStructs;if(c){for(const[f,h]of c.missing)if(h<tt(a,f)){s=!0;break}if(u){for(const[f,h]of u.missing){const p=c.missing.get(f);(p==null||p>h)&&c.missing.set(f,h)}c.update=$u([c.update,u.update])}}else a.pendingStructs=u;const d=R1(r,i,a);if(a.pendingDs){const f=new eo(po(a.pendingDs));we(f.restDecoder);const h=R1(f,i,a);d&&h?a.pendingDs=$u([d,h]):a.pendingDs=d||h}else a.pendingDs=d;if(s){const f=a.pendingStructs.update;a.pendingStructs=null,Uu(i.doc,f)}},n,!1),Uu=(t,e,n,r=eo)=>{const i=po(e);mM(i,t,n,new r(i))},CG=(t,e,n)=>Uu(t,e,n,JC),gM=(t,e,n=new Map)=>{ym(t,e.store,n),Eo(t,XC(e.store))},bM=(t,e=new Uint8Array([0]),n=new Wi)=>{const r=nx(e);gM(n,t,r);const i=[n.toUint8Array()];if(t.store.pendingDs&&i.push(t.store.pendingDs),t.store.pendingStructs&&i.push(LM(t.store.pendingStructs.update,e)),i.length>1){if(n.constructor===rl)return OM(i.map((s,o)=>o===0?s:BM(s)));if(n.constructor===Wi)return $u(i)}return i[0]},xG=(t,e)=>bM(t,e,new rl),yM=t=>{const e=new Map,n=we(t.restDecoder);for(let r=0;r<n;r++){const i=we(t.restDecoder),s=we(t.restDecoder);e.set(i,s)}return e},nx=t=>yM(new ZC(po(t))),rx=(t,e)=>(ve(t.restEncoder,e.size),ui(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{ve(t.restEncoder,n),ve(t.restEncoder,r)}),t),EM=(t,e)=>rx(t,il(e.store)),TM=(t,e=new tx)=>(t instanceof Map?rx(e,t):EM(e,t),e.toUint8Array()),SG=t=>TM(t,new ex);class CM{constructor(){this.l=[]}}const M1=()=>new CM,O1=(t,e)=>t.l.push(e),D1=(t,e)=>{const n=t.l,r=n.length;t.l=n.filter(i=>e!==i),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},ix=(t,e,n)=>lm(t.l,[e,n]);class Ms{constructor(e,n){this.client=e,this.clock=n}}const Ss=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,Ee=(t,e)=>new Ms(t,e),Da=t=>{for(const[e,n]of t.doc.share.entries())if(n===t)return e;throw zt()},La=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};class Pa{constructor(e,n,r,i=0){this.type=e,this.tname=n,this.item=r,this.assoc=i}}const oa=t=>new Pa(t.type==null?null:Ee(t.type.client,t.type.clock),t.tname??null,t.item==null?null:Ee(t.item.client,t.item.clock),t.assoc==null?0:t.assoc);class xM{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}}const SM=(t,e,n=0)=>new xM(t,e,n),Dl=(t,e,n)=>{let r=null,i=null;return t._item===null?i=Da(t):r=Ee(t._item.id.client,t._item.id.clock),new Pa(r,i,e,n)},ef=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return Dl(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return Dl(t,Ee(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return Dl(t,r.lastId,n);r=r.right}return Dl(t,null,n)},wM=(t,e)=>{const n=Os(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},kM=(t,e,n=!0)=>{const r=e.store,i=t.item,s=t.type,o=t.tname,a=t.assoc;let l=null,u=0;if(i!==null){if(tt(r,i.client)<=i.clock)return null;const c=n?Uh(r,i):wM(r,i),d=c.item;if(!(d instanceof We))return null;if(l=d.parent,l._item===null||!l._item.deleted){u=d.deleted||!d.countable?0:c.diff+(a>=0?0:1);let f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(u+=f.length),f=f.left}}else{if(o!==null)l=e.get(o);else if(s!==null){if(tt(r,s.client)<=s.clock)return null;const{item:c}=n?Uh(r,s):{item:Os(r,s)};if(c instanceof We&&c.content instanceof Gn)l=c.content.type;else return null}else throw zt();a>=0?u=l._length:u=0}return SM(l,u,t.assoc)},L1=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&Ss(t.item,e.item)&&Ss(t.type,e.type)&&t.assoc===e.assoc;class Em{constructor(e,n){this.ds=e,this.sv=n}}const sx=(t,e)=>new Em(t,e),tf=t=>sx(XC(t.store),il(t.store)),Ai=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!yo(e.ds,t.id),Bh=(t,e)=>{const n=mr(t.meta,Bh,ji),r=t.doc.store;n.has(e)||(e.sv.forEach((i,s)=>{i<tt(r,s)&&Qt(t,Ee(s,i))}),ci(t,e.ds,i=>{}),n.add(e))};class ox{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}}const il=t=>{const e=new Map;return t.clients.forEach((n,r)=>{const i=n[n.length-1];e.set(r,i.id.clock+i.length)}),e},tt=(t,e)=>{const n=t.clients.get(e);if(n===void 0)return 0;const r=n[n.length-1];return r.id.clock+r.length},ax=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{const r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw zt()}n.push(e)},Wn=(t,e)=>{let n=0,r=t.length-1,i=t[r],s=i.id.clock;if(s===e)return r;let o=zn(e/(s+i.length-1)*r);for(;n<=r;){if(i=t[o],s=i.id.clock,s<=e){if(e<s+i.length)return o;n=o+1}else r=o-1;o=zn((n+r)/2)}throw zt()},AM=(t,e)=>{const n=t.clients.get(e.client);return n[Wn(n,e.clock)]},Os=AM,Fh=(t,e,n)=>{const r=Wn(e,n),i=e[r];return i.id.clock<n&&i instanceof We?(e.splice(r+1,0,qu(t,i,n-i.id.clock)),r+1):r},Qt=(t,e)=>{const n=t.doc.store.clients.get(e.client);return n[Fh(t,n,e.clock)]},P1=(t,e,n)=>{const r=e.clients.get(n.client),i=Wn(r,n.clock),s=r[i];return n.clock!==s.id.clock+s.length-1&&s.constructor!==Nn&&r.splice(i+1,0,qu(t,s,n.clock-s.id.clock+1)),s},vM=(t,e,n)=>{const r=t.clients.get(e.id.client);r[Wn(r,e.id.clock)]=n},lx=(t,e,n,r,i)=>{if(r===0)return;const s=n+r;let o=Fh(t,e,n),a;do a=e[o++],s<a.id.clock+a.length&&Fh(t,e,s),i(a);while(o<e.length&&e[o].id.clock<s)};class NM{constructor(e,n,r){this.doc=e,this.deleteSet=new bo,this.beforeState=il(e.store),this.afterState=new Map,this.changed=new Map,this.changedParentTypes=new Map,this._mergeStructs=[],this.origin=n,this.meta=new Map,this.local=r,this.subdocsAdded=new Set,this.subdocsRemoved=new Set,this.subdocsLoaded=new Set,this._needFormattingCleanup=!1}}const B1=(t,e)=>e.deleteSet.clients.size===0&&!g4(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(gm(e.deleteSet),pM(t,e),Eo(t,e.deleteSet),!0),F1=(t,e,n)=>{const r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&mr(t.changed,e,ji).add(n)},fu=(t,e)=>{let n=t[e],r=t[e-1],i=e;for(;i>0;n=r,r=t[--i-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof We&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}const s=e-i;return s&&t.splice(e+1-s,s),s},_M=(t,e,n)=>{for(const[r,i]of t.clients.entries()){const s=e.clients.get(r);for(let o=i.length-1;o>=0;o--){const a=i[o],l=a.clock+a.len;for(let u=Wn(s,a.clock),c=s[u];u<s.length&&c.id.clock<l;c=s[++u]){const d=s[u];if(a.clock+a.len<=d.id.clock)break;d instanceof We&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},IM=(t,e)=>{t.clients.forEach((n,r)=>{const i=e.clients.get(r);for(let s=n.length-1;s>=0;s--){const o=n[s],a=Mr(i.length-1,1+Wn(i,o.clock+o.len-1));for(let l=a,u=i[l];l>0&&u.id.clock>=o.clock;u=i[l])l-=1+fu(i,l)}})},ux=(t,e)=>{if(e<t.length){const n=t[e],r=n.doc,i=r.store,s=n.deleteSet,o=n._mergeStructs;try{gm(s),n.afterState=il(n.doc.store),r.emit("beforeObserverCalls",[n,r]);const a=[];n.changed.forEach((l,u)=>a.push(()=>{(u._item===null||!u._item.deleted)&&u._callObserver(n,l)})),a.push(()=>{n.changedParentTypes.forEach((l,u)=>{u._dEH.l.length>0&&(u._item===null||!u._item.deleted)&&(l=l.filter(c=>c.target._item===null||!c.target._item.deleted),l.forEach(c=>{c.currentTarget=u,c._path=null}),l.sort((c,d)=>c.path.length-d.path.length),a.push(()=>{ix(u._dEH,l,n)}))}),a.push(()=>r.emit("afterTransaction",[n,r])),a.push(()=>{n._needFormattingCleanup&&QM(n)})}),lm(a,[])}finally{r.gc&&_M(s,i,r.gcFilter),IM(s,i),n.afterState.forEach((c,d)=>{const f=n.beforeState.get(d)||0;if(f!==c){const h=i.clients.get(d),p=jn(Wn(h,f),1);for(let g=h.length-1;g>=p;)g-=1+fu(h,g)}});for(let c=o.length-1;c>=0;c--){const{client:d,clock:f}=o[c].id,h=i.clients.get(d),p=Wn(h,f);p+1<h.length&&fu(h,p+1)>1||p>0&&fu(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(aM(mm,VC,"[yjs] ",zC,jC,"Changed the client-id because another client seems to be using it."),r.clientID=QC()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){const c=new rl;B1(c,n)&&r.emit("update",[c.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){const c=new Wi;B1(c,n)&&r.emit("updateV2",[c.toUint8Array(),n.origin,r,n])}const{subdocsAdded:a,subdocsLoaded:l,subdocsRemoved:u}=n;(a.size>0||u.size>0||l.size>0)&&(a.forEach(c=>{c.clientID=r.clientID,c.collectionid==null&&(c.collectionid=r.collectionid),r.subdocs.add(c)}),u.forEach(c=>r.subdocs.delete(c)),r.emit("subdocs",[{loaded:l,added:a,removed:u},r,n]),u.forEach(c=>c.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):ux(t,e+1)}}},Ue=(t,e,n=null,r=!0)=>{const i=t._transactionCleanups;let s=!1,o=null;t._transaction===null&&(s=!0,t._transaction=new NM(t,n,r),i.push(t._transaction),i.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{o=e(t._transaction)}finally{if(s){const a=t._transaction===i[0];t._transaction=null,a&&ux(i,0)}}return o};class RM{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}}const H1=(t,e,n)=>{ci(t,n.deletions,r=>{r instanceof We&&e.scope.some(i=>i===t.doc||La(i,r))&&vm(r,!1)})},U1=(t,e,n)=>{let r=null;const i=t.doc,s=t.scope;Ue(i,a=>{for(;e.length>0&&t.currStackItem===null;){const l=i.store,u=e.pop(),c=new Set,d=[];let f=!1;ci(a,u.insertions,h=>{if(h instanceof We){if(h.redone!==null){let{item:p,diff:g}=Uh(l,h.id);g>0&&(p=Qt(a,Ee(p.id.client,p.id.clock+g))),h=p}!h.deleted&&s.some(p=>p===a.doc||La(p,h))&&d.push(h)}}),ci(a,u.deletions,h=>{h instanceof We&&s.some(p=>p===a.doc||La(p,h))&&!yo(u.insertions,h.id)&&c.add(h)}),c.forEach(h=>{f=_x(a,h,c,u.insertions,t.ignoreRemoteMapChanges,t)!==null||f});for(let h=d.length-1;h>=0;h--){const p=d[h];t.deleteFilter(p)&&(p.delete(a),f=!0)}t.currStackItem=f?u:null}a.changed.forEach((l,u)=>{l.has(null)&&u._searchMarker&&(u._searchMarker.length=0)}),r=a},t);const o=t.currStackItem;if(o!=null){const a=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:o,type:n,changedParentTypes:a,origin:t},t]),t.currStackItem=null}return o};class cx extends mC{constructor(e,{captureTimeout:n=500,captureTransaction:r=l=>!0,deleteFilter:i=()=>!0,trackedOrigins:s=new Set([null]),ignoreRemoteMapChanges:o=!1,doc:a=Gs(e)?e[0].doc:e instanceof Zi?e:e.doc}={}){super(),this.scope=[],this.doc=a,this.addToScope(e),this.deleteFilter=i,s.add(this),this.trackedOrigins=s,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=o,this.captureTimeout=n,this.afterTransactionHandler=l=>{if(!this.captureTransaction(l)||!this.scope.some(b=>l.changedParentTypes.has(b)||b===this.doc)||!this.trackedOrigins.has(l.origin)&&(!l.origin||!this.trackedOrigins.has(l.origin.constructor)))return;const u=this.undoing,c=this.redoing,d=u?this.redoStack:this.undoStack;u?this.stopCapturing():c||this.clear(!1,!0);const f=new bo;l.afterState.forEach((b,y)=>{const E=l.beforeState.get(y)||0,T=b-E;T>0&&Oa(f,y,E,T)});const h=K4();let p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&d.length>0&&!u&&!c){const b=d[d.length-1];b.deletions=Ph([b.deletions,l.deleteSet]),b.insertions=Ph([b.insertions,f])}else d.push(new RM(l.deleteSet,f)),p=!0;!u&&!c&&(this.lastChange=h),ci(l,l.deleteSet,b=>{b instanceof We&&this.scope.some(y=>y===l.doc||La(y,b))&&vm(b,!0)});const g=[{stackItem:d[d.length-1],origin:l.origin,type:u?"redo":"undo",changedParentTypes:l.changedParentTypes},this];p?this.emit("stack-item-added",g):this.emit("stack-item-updated",g)},this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",()=>{this.destroy()})}addToScope(e){const n=new Set(this.scope);e=Gs(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof mt?r.doc!==this.doc:r!==this.doc)&&qC("[yjs#509] Not same Y.Doc"),this.scope.push(r))})}addTrackedOrigin(e){this.trackedOrigins.add(e)}removeTrackedOrigin(e){this.trackedOrigins.delete(e)}clear(e=!0,n=!0){(e&&this.canUndo()||n&&this.canRedo())&&this.doc.transact(r=>{e&&(this.undoStack.forEach(i=>H1(r,this,i)),this.undoStack=[]),n&&(this.redoStack.forEach(i=>H1(r,this,i)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=U1(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=U1(this,this.redoStack,"redo")}finally{this.redoing=!1}return e}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}destroy(){this.trackedOrigins.delete(this),this.doc.off("afterTransaction",this.afterTransactionHandler),super.destroy()}}function*MM(t){const e=we(t.restDecoder);for(let n=0;n<e;n++){const r=we(t.restDecoder),i=t.readClient();let s=we(t.restDecoder);for(let o=0;o<r;o++){const a=t.readInfo();if(a===10){const l=we(t.restDecoder);yield new _n(Ee(i,s),l),s+=l}else if((Rc&a)!==0){const l=(a&(Or|Ut))===0,u=new We(Ee(i,s),null,(a&Ut)===Ut?t.readLeftID():null,null,(a&Or)===Or?t.readRightID():null,l?t.readParentInfo()?t.readString():t.readLeftID():null,l&&(a&Na)===Na?t.readString():null,Ix(t,a));yield u,s+=u.length}else{const l=t.readLen();yield new Nn(Ee(i,s),l),s+=l}}}}class Tm{constructor(e,n){this.gen=MM(e),this.curr=null,this.done=!1,this.filterSkips=n,this.next()}next(){do this.curr=this.gen.next().value||null;while(this.filterSkips&&this.curr!==null&&this.curr.constructor===_n);return this.curr}}class Cm{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}}const OM=t=>$u(t,JC,rl),DM=(t,e)=>{if(t.constructor===Nn){const{client:n,clock:r}=t.id;return new Nn(Ee(n,r+e),t.length-e)}else if(t.constructor===_n){const{client:n,clock:r}=t.id;return new _n(Ee(n,r+e),t.length-e)}else{const n=t,{client:r,clock:i}=n.id;return new We(Ee(r,i+e),null,Ee(r,i+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},$u=(t,e=eo,n=Wi)=>{if(t.length===1)return t[0];const r=t.map(c=>new e(po(c)));let i=r.map(c=>new Tm(c,!0)),s=null;const o=new n,a=new Cm(o);for(;i=i.filter(f=>f.curr!==null),i.sort((f,h)=>{if(f.curr.id.client===h.curr.id.client){const p=f.curr.id.clock-h.curr.id.clock;return p===0?f.curr.constructor===h.curr.constructor?0:f.curr.constructor===_n?1:-1:p}else return h.curr.id.client-f.curr.id.client}),i.length!==0;){const c=i[0],d=c.curr.id.client;if(s!==null){let f=c.curr,h=!1;for(;f!==null&&f.id.clock+f.length<=s.struct.id.clock+s.struct.length&&f.id.client>=s.struct.id.client;)f=c.next(),h=!0;if(f===null||f.id.client!==d||h&&f.id.clock>s.struct.id.clock+s.struct.length)continue;if(d!==s.struct.id.client)Gr(a,s.struct,s.offset),s={struct:f,offset:0},c.next();else if(s.struct.id.clock+s.struct.length<f.id.clock)if(s.struct.constructor===_n)s.struct.length=f.id.clock+f.length-s.struct.id.clock;else{Gr(a,s.struct,s.offset);const p=f.id.clock-s.struct.id.clock-s.struct.length;s={struct:new _n(Ee(d,s.struct.id.clock+s.struct.length),p),offset:0}}else{const p=s.struct.id.clock+s.struct.length-f.id.clock;p>0&&(s.struct.constructor===_n?s.struct.length-=p:f=DM(f,p)),s.struct.mergeWith(f)||(Gr(a,s.struct,s.offset),s={struct:f,offset:0},c.next())}}else s={struct:c.curr,offset:0},c.next();for(let f=c.curr;f!==null&&f.id.client===d&&f.id.clock===s.struct.id.clock+s.struct.length&&f.constructor!==_n;f=c.next())Gr(a,s.struct,s.offset),s={struct:f,offset:0}}s!==null&&(Gr(a,s.struct,s.offset),s=null),xm(a);const l=r.map(c=>bm(c)),u=Ph(l);return Eo(o,u),o.toUint8Array()},LM=(t,e,n=eo,r=Wi)=>{const i=nx(e),s=new r,o=new Cm(s),a=new n(po(t)),l=new Tm(a,!1);for(;l.curr;){const c=l.curr,d=c.id.client,f=i.get(d)||0;if(l.curr.constructor===_n){l.next();continue}if(c.id.clock+c.length>f)for(Gr(o,c,jn(f-c.id.clock,0)),l.next();l.curr&&l.curr.id.client===d;)Gr(o,l.curr,0),l.next();else for(;l.curr&&l.curr.id.client===d&&l.curr.id.clock+l.curr.length<=f;)l.next()}xm(o);const u=bm(a);return Eo(s,u),s.toUint8Array()},dx=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:Fn(t.encoder.restEncoder)}),t.encoder.restEncoder=tl(),t.written=0)},Gr=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&dx(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),ve(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},xm=t=>{dx(t);const e=t.encoder.restEncoder;ve(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){const r=t.clientStructs[n];ve(e,r.written),Mc(e,r.restEncoder)}},PM=(t,e,n,r)=>{const i=new n(po(t)),s=new Tm(i,!1),o=new r,a=new Cm(o);for(let u=s.curr;u!==null;u=s.next())Gr(a,e(u),0);xm(a);const l=bm(i);return Eo(o,l),o.toUint8Array()},BM=t=>PM(t,i6,eo,rl),$1="You must not compute changes after the event-handler fired.";class Uc{constructor(e,n){this.target=e,this.currentTarget=e,this.transaction=n,this._changes=null,this._keys=null,this._delta=null,this._path=null}get path(){return this._path||(this._path=FM(this.currentTarget,this.target))}deletes(e){return yo(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw dr($1);const e=new Map,n=this.target;this.transaction.changed.get(n).forEach(i=>{if(i!==null){const s=n._map.get(i);let o,a;if(this.adds(s)){let l=s.left;for(;l!==null&&this.adds(l);)l=l.left;if(this.deletes(s))if(l!==null&&this.deletes(l))o="delete",a=Kd(l.content.getContent());else return;else l!==null&&this.deletes(l)?(o="update",a=Kd(l.content.getContent())):(o="add",a=void 0)}else if(this.deletes(s))o="delete",a=Kd(s.content.getContent());else return;e.set(i,{action:o,oldValue:a})}}),this._keys=e}return this._keys}get delta(){return this.changes.delta}adds(e){return e.id.clock>=(this.transaction.beforeState.get(e.id.client)||0)}get changes(){let e=this._changes;if(e===null){if(this.transaction.doc._transactionCleanups.length===0)throw dr($1);const n=this.target,r=ji(),i=ji(),s=[];if(e={added:r,deleted:i,delta:s,keys:this.keys},this.transaction.changed.get(n).has(null)){let a=null;const l=()=>{a&&s.push(a)};for(let u=n._start;u!==null;u=u.right)u.deleted?this.deletes(u)&&!this.adds(u)&&((a===null||a.delete===void 0)&&(l(),a={delete:0}),a.delete+=u.length,i.add(u)):this.adds(u)?((a===null||a.insert===void 0)&&(l(),a={insert:[]}),a.insert=a.insert.concat(u.content.getContent()),r.add(u)):((a===null||a.retain===void 0)&&(l(),a={retain:0}),a.retain+=u.length);a!==null&&a.retain===void 0&&l()}this._changes=e}return e}}const FM=(t,e)=>{const n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,i=e._item.parent._start;for(;i!==e._item&&i!==null;)!i.deleted&&i.countable&&(r+=i.length),i=i.right;n.unshift(r)}e=e._item.parent}return n},_t=()=>{qC("Invalid access: Add Yjs type to a document before reading data.")},fx=80;let Sm=0;class HM{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=Sm++}}const UM=t=>{t.timestamp=Sm++},hx=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=Sm++},$M=(t,e,n)=>{if(t.length>=fx){const r=t.reduce((i,s)=>i.timestamp<s.timestamp?i:s);return hx(r,e,n),r}else{const r=new HM(e,n);return t.push(r),r}},$c=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;const n=t._searchMarker.length===0?null:t._searchMarker.reduce((s,o)=>ou(e-s.index)<ou(e-o.index)?s:o);let r=t._start,i=0;for(n!==null&&(r=n.p,i=n.index,UM(n));r.right!==null&&i<e;){if(!r.deleted&&r.countable){if(e<i+r.length)break;i+=r.length}r=r.right}for(;r.left!==null&&i>e;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);for(;r.left!==null&&r.left.id.client===r.id.client&&r.left.id.clock+r.left.length===r.id.clock;)r=r.left,!r.deleted&&r.countable&&(i-=r.length);return n!==null&&ou(n.index-i)<r.parent.length/fx?(hx(n,r,i),n):$M(t._searchMarker,r,i)},Ba=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){const i=t[r];if(n>0){let s=i.p;for(s.marker=!1;s&&(s.deleted||!s.countable);)s=s.left,s&&!s.deleted&&s.countable&&(i.index-=s.length);if(s===null||s.marker===!0){t.splice(r,1);continue}i.p=s,s.marker=!0}(e<i.index||n>0&&e===i.index)&&(i.index=jn(e,i.index+n))}},Vc=(t,e,n)=>{const r=t,i=e.changedParentTypes;for(;mr(i,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;ix(r._eH,n,e)};class mt{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=M1(),this._dEH=M1(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw On()}clone(){throw On()}_write(e){}get _first(){let e=this._start;for(;e!==null&&e.deleted;)e=e.right;return e}_callObserver(e,n){!e.local&&this._searchMarker&&(this._searchMarker.length=0)}observe(e){O1(this._eH,e)}observeDeep(e){O1(this._dEH,e)}unobserve(e){D1(this._eH,e)}unobserveDeep(e){D1(this._dEH,e)}toJSON(){}}const px=(t,e,n)=>{t.doc??_t(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e;const i=[];let s=t._start;for(;s!==null&&r>0;){if(s.countable&&!s.deleted){const o=s.content.getContent();if(o.length<=e)e-=o.length;else{for(let a=e;a<o.length&&r>0;a++)i.push(o[a]),r--;e=0}}s=s.right}return i},mx=t=>{t.doc??_t();const e=[];let n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){const r=n.content.getContent();for(let i=0;i<r.length;i++)e.push(r[i])}n=n.right}return e},gx=(t,e)=>{const n=[];let r=t._start;for(;r!==null;){if(r.countable&&Ai(r,e)){const i=r.content.getContent();for(let s=0;s<i.length;s++)n.push(i[s])}r=r.right}return n},Fa=(t,e)=>{let n=0,r=t._start;for(t.doc??_t();r!==null;){if(r.countable&&!r.deleted){const i=r.content.getContent();for(let s=0;s<i.length;s++)e(i[s],n++,t)}r=r.right}},bx=(t,e)=>{const n=[];return Fa(t,(r,i)=>{n.push(e(r,i,t))}),n},VM=t=>{let e=t._start,n=null,r=0;return{[Symbol.iterator](){return this},next:()=>{if(n===null){for(;e!==null&&e.deleted;)e=e.right;if(e===null)return{done:!0,value:void 0};n=e.content.getContent(),r=0,e=e.right}const i=n[r++];return n.length<=r&&(n=null),{done:!1,value:i}}}},yx=(t,e)=>{t.doc??_t();const n=$c(t,e);let r=t._start;for(n!==null&&(r=n.p,e-=n.index);r!==null;r=r.right)if(!r.deleted&&r.countable){if(e<r.length)return r.content.getContent()[e];e-=r.length}},Vu=(t,e,n,r)=>{let i=n;const s=t.doc,o=s.clientID,a=s.store,l=n===null?e._start:n.right;let u=[];const c=()=>{u.length>0&&(i=new We(Ee(o,tt(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Yi(u)),i.integrate(t,0),u=[])};r.forEach(d=>{if(d===null)u.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:u.push(d);break;default:switch(c(),d.constructor){case Uint8Array:case ArrayBuffer:i=new We(Ee(o,tt(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new sl(new Uint8Array(d))),i.integrate(t,0);break;case Zi:i=new We(Ee(o,tt(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new ol(d)),i.integrate(t,0);break;default:if(d instanceof mt)i=new We(Ee(o,tt(a,o)),i,i&&i.lastId,l,l&&l.id,e,null,new Gn(d)),i.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),c()},Ex=()=>dr("Length exceeded!"),Tx=(t,e,n,r)=>{if(n>e._length)throw Ex();if(n===0)return e._searchMarker&&Ba(e._searchMarker,n,r.length),Vu(t,e,null,r);const i=n,s=$c(e,n);let o=e._start;for(s!==null&&(o=s.p,n-=s.index,n===0&&(o=o.prev,n+=o&&o.countable&&!o.deleted?o.length:0));o!==null;o=o.right)if(!o.deleted&&o.countable){if(n<=o.length){n<o.length&&Qt(t,Ee(o.id.client,o.id.clock+n));break}n-=o.length}return e._searchMarker&&Ba(e._searchMarker,i,r.length),Vu(t,e,o,r)},zM=(t,e,n)=>{let i=(e._searchMarker||[]).reduce((s,o)=>o.index>s.index?o:s,{index:0,p:e._start}).p;if(i)for(;i.right;)i=i.right;return Vu(t,e,i,n)},Cx=(t,e,n,r)=>{if(r===0)return;const i=n,s=r,o=$c(e,n);let a=e._start;for(o!==null&&(a=o.p,n-=o.index);a!==null&&n>0;a=a.right)!a.deleted&&a.countable&&(n<a.length&&Qt(t,Ee(a.id.client,a.id.clock+n)),n-=a.length);for(;r>0&&a!==null;)a.deleted||(r<a.length&&Qt(t,Ee(a.id.client,a.id.clock+r)),a.delete(t),r-=a.length),a=a.right;if(r>0)throw Ex();e._searchMarker&&Ba(e._searchMarker,i,-s+r)},zu=(t,e,n)=>{const r=e._map.get(n);r!==void 0&&r.delete(t)},wm=(t,e,n,r)=>{const i=e._map.get(n)||null,s=t.doc,o=s.clientID;let a;if(r==null)a=new Yi([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:a=new Yi([r]);break;case Uint8Array:a=new sl(r);break;case Zi:a=new ol(r);break;default:if(r instanceof mt)a=new Gn(r);else throw new Error("Unexpected content type")}new We(Ee(o,tt(s.store,o)),i,i&&i.lastId,null,null,e,n,a).integrate(t,0)},km=(t,e)=>{t.doc??_t();const n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},xx=t=>{const e={};return t.doc??_t(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},Sx=(t,e)=>{t.doc??_t();const n=t._map.get(e);return n!==void 0&&!n.deleted},jM=(t,e)=>{const n={};return t._map.forEach((r,i)=>{let s=r;for(;s!==null&&(!e.sv.has(s.id.client)||s.id.clock>=(e.sv.get(s.id.client)||0));)s=s.left;s!==null&&Ai(s,e)&&(n[i]=s.content.getContent()[s.length-1])}),n},Ll=t=>(t.doc??_t(),lM(t._map.entries(),e=>!e[1].deleted));class WM extends Uc{}class Ds extends mt{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){const n=new Ds;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new Ds}clone(){const e=new Ds;return e.insert(0,this.toArray().map(n=>n instanceof mt?n.clone():n)),e}get length(){return this.doc??_t(),this._length}_callObserver(e,n){super._callObserver(e,n),Vc(this,e,new WM(this,e))}insert(e,n){this.doc!==null?Ue(this.doc,r=>{Tx(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Ue(this.doc,n=>{zM(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Ue(this.doc,r=>{Cx(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return yx(this,e)}toArray(){return mx(this)}slice(e=0,n=this.length){return px(this,e,n)}toJSON(){return this.map(e=>e instanceof mt?e.toJSON():e)}map(e){return bx(this,e)}forEach(e){Fa(this,e)}[Symbol.iterator](){return VM(this)}_write(e){e.writeTypeRef(gO)}}const qM=t=>new Ds;class YM extends Uc{constructor(e,n,r){super(e,n),this.keysChanged=r}}class to extends mt{constructor(e){super(),this._prelimContent=null,e===void 0?this._prelimContent=new Map:this._prelimContent=new Map(e)}_integrate(e,n){super._integrate(e,n),this._prelimContent.forEach((r,i)=>{this.set(i,r)}),this._prelimContent=null}_copy(){return new to}clone(){const e=new to;return this.forEach((n,r)=>{e.set(r,n instanceof mt?n.clone():n)}),e}_callObserver(e,n){Vc(this,e,new YM(this,e,n))}toJSON(){this.doc??_t();const e={};return this._map.forEach((n,r)=>{if(!n.deleted){const i=n.content.getContent()[n.length-1];e[r]=i instanceof mt?i.toJSON():i}}),e}get size(){return[...Ll(this)].length}keys(){return Jd(Ll(this),e=>e[0])}values(){return Jd(Ll(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return Jd(Ll(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??_t(),this._map.forEach((n,r)=>{n.deleted||e(n.content.getContent()[n.length-1],r,this)})}[Symbol.iterator](){return this.entries()}delete(e){this.doc!==null?Ue(this.doc,n=>{zu(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Ue(this.doc,r=>{wm(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return km(this,e)}has(e){return Sx(this,e)}clear(){this.doc!==null?Ue(this.doc,e=>{this.forEach(function(n,r,i){zu(e,i,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(bO)}}const KM=t=>new to,Jr=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&n6(t,e);class Hh{constructor(e,n,r,i){this.left=e,this.right=n,this.index=r,this.currentAttributes=i}forward(){this.right===null&&zt(),this.right.content.constructor===ot?this.right.deleted||To(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}}const V1=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===ot?e.right.deleted||To(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&Qt(t,Ee(e.right.id.client,e.right.id.clock+n)),e.index+=e.right.length,n-=e.right.length),e.left=e.right,e.right=e.right.right;return e},Pl=(t,e,n,r)=>{const i=new Map,s=r?$c(e,n):null;if(s){const o=new Hh(s.p.left,s.p,s.index,i);return V1(t,o,n-s.index)}else{const o=new Hh(null,e._start,0,i);return V1(t,o,n)}},wx=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===ot&&Jr(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();const i=t.doc,s=i.clientID;r.forEach((o,a)=>{const l=n.left,u=n.right,c=new We(Ee(s,tt(i.store,s)),l,l&&l.lastId,u,u&&u.id,e,null,new ot(a,o));c.integrate(t,0),n.right=c,n.forward()})},To=(t,e)=>{const{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},kx=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===ot&&Jr(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},Ax=(t,e,n,r)=>{const i=t.doc,s=i.clientID,o=new Map;for(const a in r){const l=r[a],u=n.currentAttributes.get(a)??null;if(!Jr(u,l)){o.set(a,u);const{left:c,right:d}=n;n.right=new We(Ee(s,tt(i.store,s)),c,c&&c.lastId,d,d&&d.id,e,null,new ot(a,l)),n.right.integrate(t,0),n.forward()}}return o},nf=(t,e,n,r,i)=>{n.currentAttributes.forEach((f,h)=>{i[h]===void 0&&(i[h]=null)});const s=t.doc,o=s.clientID;kx(n,i);const a=Ax(t,e,n,i),l=r.constructor===String?new qn(r):r instanceof mt?new Gn(r):new Ji(r);let{left:u,right:c,index:d}=n;e._searchMarker&&Ba(e._searchMarker,n.index,l.getLength()),c=new We(Ee(o,tt(s.store,o)),u,u&&u.lastId,c,c&&c.id,e,null,l),c.integrate(t,0),n.right=c,n.index=d,n.forward(),wx(t,e,n,a)},z1=(t,e,n,r,i)=>{const s=t.doc,o=s.clientID;kx(n,i);const a=Ax(t,e,n,i);e:for(;n.right!==null&&(r>0||a.size>0&&(n.right.deleted||n.right.content.constructor===ot));){if(!n.right.deleted)switch(n.right.content.constructor){case ot:{const{key:l,value:u}=n.right.content,c=i[l];if(c!==void 0){if(Jr(c,u))a.delete(l);else{if(r===0)break e;a.set(l,u)}n.right.delete(t)}else n.currentAttributes.set(l,u);break}default:r<n.right.length&&Qt(t,Ee(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let l="";for(;r>0;r--)l+=`
90
+ `;n.right=new We(Ee(o,tt(s.store,o)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new qn(l)),n.right.integrate(t,0),n.forward()}wx(t,e,n,a)},vx=(t,e,n,r,i)=>{let s=e;const o=Mn();for(;s&&(!s.countable||s.deleted);){if(!s.deleted&&s.content.constructor===ot){const u=s.content;o.set(u.key,u)}s=s.right}let a=0,l=!1;for(;e!==s;){if(n===e&&(l=!0),!e.deleted){const u=e.content;if(u.constructor===ot){const{key:c,value:d}=u,f=r.get(c)??null;(o.get(c)!==u||f===d)&&(e.delete(t),a++,!l&&(i.get(c)??null)===d&&f!==d&&(f===null?i.delete(c):i.set(c,f))),!l&&!e.deleted&&To(i,u)}}e=e.right}return a},GM=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;const n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===ot){const r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},XM=t=>{let e=0;return Ue(t.doc,n=>{let r=t._start,i=t._start,s=Mn();const o=Rh(s);for(;i;)i.deleted===!1&&(i.content.constructor===ot?To(o,i.content):(e+=vx(n,r,i,s,o),s=Rh(o),r=i)),i=i.right}),e},QM=t=>{const e=new Set,n=t.doc;for(const[r,i]of t.afterState.entries()){const s=t.beforeState.get(r)||0;i!==s&&lx(t,n.store.clients.get(r),s,i,o=>{!o.deleted&&o.content.constructor===ot&&o.constructor!==Nn&&e.add(o.parent)})}Ue(n,r=>{ci(t,t.deleteSet,i=>{if(i instanceof Nn||!i.parent._hasFormatting||e.has(i.parent))return;const s=i.parent;i.content.constructor===ot?e.add(s):GM(r,i)});for(const i of e)XM(i)})},j1=(t,e,n)=>{const r=n,i=Rh(e.currentAttributes),s=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case Gn:case Ji:case qn:n<e.right.length&&Qt(t,Ee(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}s&&vx(t,s,e.right,i,e.currentAttributes);const o=(e.left||e.right).parent;return o._searchMarker&&Ba(o._searchMarker,e.index,-r+n),e};class ZM extends Uc{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(i=>{i===null?this.childListChanged=!0:this.keysChanged.add(i)})}get changes(){if(this._changes===null){const e={keys:this.keys,delta:this.delta,added:new Set,deleted:new Set};this._changes=e}return this._changes}get delta(){if(this._delta===null){const e=this.target.doc,n=[];Ue(e,r=>{const i=new Map,s=new Map;let o=this.target._start,a=null;const l={};let u="",c=0,d=0;const f=()=>{if(a!==null){let h=null;switch(a){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof u=="object"||u.length>0)&&(h={insert:u},i.size>0&&(h.attributes={},i.forEach((p,g)=>{p!==null&&(h.attributes[g]=p)}))),u="";break;case"retain":c>0&&(h={retain:c},t6(l)||(h.attributes=J4({},l))),c=0;break}h&&n.push(h),a=null}};for(;o!==null;){switch(o.content.constructor){case Gn:case Ji:this.adds(o)?this.deletes(o)||(f(),a="insert",u=o.content.getContent()[0],f()):this.deletes(o)?(a!=="delete"&&(f(),a="delete"),d+=1):o.deleted||(a!=="retain"&&(f(),a="retain"),c+=1);break;case qn:this.adds(o)?this.deletes(o)||(a!=="insert"&&(f(),a="insert"),u+=o.content.str):this.deletes(o)?(a!=="delete"&&(f(),a="delete"),d+=o.length):o.deleted||(a!=="retain"&&(f(),a="retain"),c+=o.length);break;case ot:{const{key:h,value:p}=o.content;if(this.adds(o)){if(!this.deletes(o)){const g=i.get(h)??null;Jr(g,p)?p!==null&&o.delete(r):(a==="retain"&&f(),Jr(p,s.get(h)??null)?delete l[h]:l[h]=p)}}else if(this.deletes(o)){s.set(h,p);const g=i.get(h)??null;Jr(g,p)||(a==="retain"&&f(),l[h]=g)}else if(!o.deleted){s.set(h,p);const g=l[h];g!==void 0&&(Jr(g,p)?g!==null&&o.delete(r):(a==="retain"&&f(),p===null?delete l[h]:l[h]=p))}o.deleted||(a==="insert"&&f(),To(i,o.content));break}}o=o.right}for(f();n.length>0;){const h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}}class di extends mt{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??_t(),this._length}_integrate(e,n){super._integrate(e,n);try{this._pending.forEach(r=>r())}catch(r){console.error(r)}this._pending=null}_copy(){return new di}clone(){const e=new di;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);const r=new ZM(this,e,n);Vc(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??_t();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===qn&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Ue(this.doc,r=>{const i=new Hh(null,this._start,0,new Map);for(let s=0;s<e.length;s++){const o=e[s];if(o.insert!==void 0){const a=!n&&typeof o.insert=="string"&&s===e.length-1&&i.right===null&&o.insert.slice(-1)===`
91
+ `?o.insert.slice(0,-1):o.insert;(typeof a!="string"||a.length>0)&&nf(r,this,i,a,o.attributes||{})}else o.retain!==void 0?z1(r,this,i,o.retain,o.attributes||{}):o.delete!==void 0&&j1(r,i,o.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??_t();const i=[],s=new Map,o=this.doc;let a="",l=this._start;function u(){if(a.length>0){const d={};let f=!1;s.forEach((p,g)=>{f=!0,d[g]=p});const h={insert:a};f&&(h.attributes=d),i.push(h),a=""}}const c=()=>{for(;l!==null;){if(Ai(l,e)||n!==void 0&&Ai(l,n))switch(l.content.constructor){case qn:{const d=s.get("ychange");e!==void 0&&!Ai(l,e)?(d===void 0||d.user!==l.id.client||d.type!=="removed")&&(u(),s.set("ychange",r?r("removed",l.id):{type:"removed"})):n!==void 0&&!Ai(l,n)?(d===void 0||d.user!==l.id.client||d.type!=="added")&&(u(),s.set("ychange",r?r("added",l.id):{type:"added"})):d!==void 0&&(u(),s.delete("ychange")),a+=l.content.str;break}case Gn:case Ji:{u();const d={insert:l.content.getContent()[0]};if(s.size>0){const f={};d.attributes=f,s.forEach((h,p)=>{f[p]=h})}i.push(d);break}case ot:Ai(l,e)&&(u(),To(s,l.content));break}l=l.right}u()};return e||n?Ue(o,d=>{e&&Bh(d,e),n&&Bh(d,n),c()},"cleanup"):c(),i}insert(e,n,r){if(n.length<=0)return;const i=this.doc;i!==null?Ue(i,s=>{const o=Pl(s,this,e,!r);r||(r={},o.currentAttributes.forEach((a,l)=>{r[l]=a})),nf(s,this,o,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){const i=this.doc;i!==null?Ue(i,s=>{const o=Pl(s,this,e,!r);nf(s,this,o,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;const r=this.doc;r!==null?Ue(r,i=>{j1(i,Pl(i,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;const i=this.doc;i!==null?Ue(i,s=>{const o=Pl(s,this,e,!1);o.right!==null&&z1(s,this,o,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Ue(this.doc,n=>{zu(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Ue(this.doc,r=>{wm(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return km(this,e)}getAttributes(){return xx(this)}_write(e){e.writeTypeRef(yO)}}const JM=t=>new di;class rf{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??_t()}[Symbol.iterator](){return this}next(){let e=this._currentNode,n=e&&e.content&&e.content.type;if(e!==null&&(!this._firstCall||e.deleted||!this._filter(n)))do if(n=e.content.type,!e.deleted&&(n.constructor===Ht||n.constructor===qi)&&n._start!==null)e=n._start;else for(;e!==null;){const r=e.next;if(r!==null){e=r;break}else e.parent===this._root?e=null:e=e.parent._item}while(e!==null&&(e.deleted||!this._filter(e.content.type)));return this._firstCall=!1,e===null?{value:void 0,done:!0}:(this._currentNode=e,{value:e.content.type,done:!1})}}class qi extends mt{constructor(){super(),this._prelimContent=[]}get firstChild(){const e=this._first;return e?e.content.getContent()[0]:null}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new qi}clone(){const e=new qi;return e.insert(0,this.toArray().map(n=>n instanceof mt?n.clone():n)),e}get length(){return this.doc??_t(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new rf(this,e)}querySelector(e){e=e.toUpperCase();const r=new rf(this,i=>i.nodeName&&i.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),ui(new rf(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){Vc(this,e,new nO(this,n,e))}toString(){return bx(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){const i=e.createDocumentFragment();return r!==void 0&&r._createAssociation(i,this),Fa(this,s=>{i.insertBefore(s.toDOM(e,n,r),null)}),i}insert(e,n){this.doc!==null?Ue(this.doc,r=>{Tx(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Ue(this.doc,r=>{const i=e&&e instanceof mt?e._item:e;Vu(r,this,i,n)});else{const r=this._prelimContent,i=e===null?0:r.findIndex(s=>s===e)+1;if(i===0&&e!==null)throw dr("Reference item not found");r.splice(i,0,...n)}}delete(e,n=1){this.doc!==null?Ue(this.doc,r=>{Cx(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return mx(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return yx(this,e)}slice(e=0,n=this.length){return px(this,e,n)}forEach(e){Fa(this,e)}_write(e){e.writeTypeRef(TO)}}const eO=t=>new qi;class Ht extends qi{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,i)=>{this.setAttribute(i,r)}),this._prelimAttrs=null}_copy(){return new Ht(this.nodeName)}clone(){const e=new Ht(this.nodeName),n=this.getAttributes();return e6(n,(r,i)=>{e.setAttribute(i,r)}),e.insert(0,this.toArray().map(r=>r instanceof mt?r.clone():r)),e}toString(){const e=this.getAttributes(),n=[],r=[];for(const a in e)r.push(a);r.sort();const i=r.length;for(let a=0;a<i;a++){const l=r[a];n.push(l+'="'+e[l]+'"')}const s=this.nodeName.toLocaleLowerCase(),o=n.length>0?" "+n.join(" "):"";return`<${s}${o}>${super.toString()}</${s}>`}removeAttribute(e){this.doc!==null?Ue(this.doc,n=>{zu(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Ue(this.doc,r=>{wm(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return km(this,e)}hasAttribute(e){return Sx(this,e)}getAttributes(e){return e?jM(this,e):xx(this)}toDOM(e=document,n={},r){const i=e.createElement(this.nodeName),s=this.getAttributes();for(const o in s){const a=s[o];typeof a=="string"&&i.setAttribute(o,a)}return Fa(this,o=>{i.appendChild(o.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(EO),e.writeKey(this.nodeName)}}const tO=t=>new Ht(t.readKey());class nO extends Uc{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(i=>{i===null?this.childListChanged=!0:this.attributesChanged.add(i)})}}class ju extends to{constructor(e){super(),this.hookName=e}_copy(){return new ju(this.hookName)}clone(){const e=new ju(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){const i=n[this.hookName];let s;return i!==void 0?s=i.createDom(this):s=document.createElement(this.hookName),s.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(s,this),s}_write(e){e.writeTypeRef(CO),e.writeKey(this.hookName)}}const rO=t=>new ju(t.readKey());class gn extends di{get nextSibling(){const e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){const e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new gn}clone(){const e=new gn;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){const i=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(i,this),i}toString(){return this.toDelta().map(e=>{const n=[];for(const i in e.attributes){const s=[];for(const o in e.attributes[i])s.push({key:o,value:e.attributes[i][o]});s.sort((o,a)=>o.key<a.key?-1:1),n.push({nodeName:i,attrs:s})}n.sort((i,s)=>i.nodeName<s.nodeName?-1:1);let r="";for(let i=0;i<n.length;i++){const s=n[i];r+=`<${s.nodeName}`;for(let o=0;o<s.attrs.length;o++){const a=s.attrs[o];r+=` ${a.key}="${a.value}"`}r+=">"}r+=e.insert;for(let i=n.length-1;i>=0;i--)r+=`</${n[i].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(xO)}}const iO=t=>new gn;class Am{constructor(e,n){this.id=e,this.length=n}get deleted(){throw On()}mergeWith(e){return!1}write(e,n,r){throw On()}integrate(e,n){throw On()}}const sO=0;class Nn extends Am{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){n>0&&(this.id.clock+=n,this.length-=n),ax(e.doc.store,this)}write(e,n){e.writeInfo(sO),e.writeLen(this.length-n)}getMissing(e,n){return null}}class sl{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new sl(this.content)}splice(e){throw On()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}}const oO=t=>new sl(t.readBuf());class Ha{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new Ha(this.len)}splice(e){const n=new Ha(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Oa(e.deleteSet,n.id.client,n.id.clock,this.len),n.markDeleted()}delete(e){}gc(e){}write(e,n){e.writeLen(this.len-n)}getRef(){return 1}}const aO=t=>new Ha(t.readLen()),Nx=(t,e)=>new Zi({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1});class ol{constructor(e){e._item&&console.error("This document was already integrated as a sub-document. You should create a second instance instead with the same guid."),this.doc=e;const n={};this.opts=n,e.gc||(n.gc=!1),e.autoLoad&&(n.autoLoad=!0),e.meta!==null&&(n.meta=e.meta)}getLength(){return 1}getContent(){return[this.doc]}isCountable(){return!0}copy(){return new ol(Nx(this.doc.guid,this.opts))}splice(e){throw On()}mergeWith(e){return!1}integrate(e,n){this.doc._item=n,e.subdocsAdded.add(this.doc),this.doc.shouldLoad&&e.subdocsLoaded.add(this.doc)}delete(e){e.subdocsAdded.has(this.doc)?e.subdocsAdded.delete(this.doc):e.subdocsRemoved.add(this.doc)}gc(e){}write(e,n){e.writeString(this.doc.guid),e.writeAny(this.opts)}getRef(){return 9}}const lO=t=>new ol(Nx(t.readString(),t.readAny()));class Ji{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new Ji(this.embed)}splice(e){throw On()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}}const uO=t=>new Ji(t.readJSON());class ot{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new ot(this.key,this.value)}splice(e){throw On()}mergeWith(e){return!1}integrate(e,n){const r=n.parent;r._searchMarker=null,r._hasFormatting=!0}delete(e){}gc(e){}write(e,n){e.writeKey(this.key),e.writeJSON(this.value)}getRef(){return 6}}const cO=t=>new ot(t.readKey(),t.readJSON());class Wu{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Wu(this.arr)}splice(e){const n=new Wu(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeString(s===void 0?"undefined":JSON.stringify(s))}}getRef(){return 2}}const dO=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++){const i=t.readString();i==="undefined"?n.push(void 0):n.push(JSON.parse(i))}return new Wu(n)},fO=Bu("node_env")==="development";class Yi{constructor(e){this.arr=e,fO&&xC(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new Yi(this.arr)}splice(e){const n=new Yi(this.arr.slice(e));return this.arr=this.arr.slice(0,e),n}mergeWith(e){return this.arr=this.arr.concat(e.arr),!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){const r=this.arr.length;e.writeLen(r-n);for(let i=n;i<r;i++){const s=this.arr[i];e.writeAny(s)}}getRef(){return 8}}const hO=t=>{const e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new Yi(n)};class qn{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new qn(this.str)}splice(e){const n=new qn(this.str.slice(e));this.str=this.str.slice(0,e);const r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"�",n.str="�"+n.str.slice(1)),n}mergeWith(e){return this.str+=e.str,!0}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeString(n===0?this.str:this.str.slice(n))}getRef(){return 4}}const pO=t=>new qn(t.readString()),mO=[qM,KM,JM,tO,eO,rO,iO],gO=0,bO=1,yO=2,EO=3,TO=4,CO=5,xO=6;class Gn{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new Gn(this.type._copy())}splice(e){throw On()}mergeWith(e){return!1}integrate(e,n){this.type._integrate(e.doc,n)}delete(e){let n=this.type._start;for(;n!==null;)n.deleted?n.id.clock<(e.beforeState.get(n.id.client)||0)&&e._mergeStructs.push(n):n.delete(e),n=n.right;this.type._map.forEach(r=>{r.deleted?r.id.clock<(e.beforeState.get(r.id.client)||0)&&e._mergeStructs.push(r):r.delete(e)}),e.changed.delete(this.type)}gc(e){let n=this.type._start;for(;n!==null;)n.gc(e,!0),n=n.right;this.type._start=null,this.type._map.forEach(r=>{for(;r!==null;)r.gc(e,!0),r=r.left}),this.type._map=new Map}write(e,n){this.type._write(e)}getRef(){return 7}}const SO=t=>new Gn(mO[t.readTypeRef()](t)),Uh=(t,e)=>{let n=e,r=0,i;do r>0&&(n=Ee(n.client,n.clock+r)),i=Os(t,n),r=n.clock-i.id.clock,n=i.redone;while(n!==null&&i instanceof We);return{item:i,diff:r}},vm=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},qu=(t,e,n)=>{const{client:r,clock:i}=e.id,s=new We(Ee(r,i+n),e,Ee(r,i+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&s.markDeleted(),e.keep&&(s.keep=!0),e.redone!==null&&(s.redone=Ee(e.redone.client,e.redone.clock+n)),e.right=s,s.right!==null&&(s.right.left=s),t._mergeStructs.push(s),s.parentSub!==null&&s.right===null&&s.parent._map.set(s.parentSub,s),e.length=n,s},W1=(t,e)=>nm(t,n=>yo(n.deletions,e)),_x=(t,e,n,r,i,s)=>{const o=t.doc,a=o.store,l=o.clientID,u=e.redone;if(u!==null)return Qt(t,u);let c=e.parent._item,d=null,f;if(c!==null&&c.deleted===!0){if(c.redone===null&&(!n.has(c)||_x(t,c,n,r,i,s)===null))return null;for(;c.redone!==null;)c=Qt(t,c.redone)}const h=c===null?e.parent:c.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let y=d;for(;y!==null&&y.parent._item!==c;)y=y.redone===null?null:Qt(t,y.redone);if(y!==null&&y.parent._item===c){d=y;break}d=d.left}for(;f!==null;){let y=f;for(;y!==null&&y.parent._item!==c;)y=y.redone===null?null:Qt(t,y.redone);if(y!==null&&y.parent._item===c){f=y;break}f=f.right}}else if(f=null,e.right&&!i){for(d=e;d!==null&&d.right!==null&&(d.right.redone||yo(r,d.right.id)||W1(s.undoStack,d.right.id)||W1(s.redoStack,d.right.id));)for(d=d.right;d.redone;)d=Qt(t,d.redone);if(d&&d.right!==null)return null}else d=h._map.get(e.parentSub)||null;const p=tt(a,l),g=Ee(l,p),b=new We(g,d,d&&d.lastId,f,f&&f.id,h,e.parentSub,e.content.copy());return e.redone=g,vm(b,!0),b.integrate(t,0),b};let We=class $h extends Am{constructor(e,n,r,i,s,o,a,l){super(e,l.getLength()),this.origin=r,this.left=n,this.right=i,this.rightOrigin=s,this.parent=o,this.parentSub=a,this.redone=null,this.content=l,this.info=this.content.isCountable()?u1:0}set marker(e){(this.info&qd)>0!==e&&(this.info^=qd)}get marker(){return(this.info&qd)>0}get keep(){return(this.info&l1)>0}set keep(e){this.keep!==e&&(this.info^=l1)}get countable(){return(this.info&u1)>0}get deleted(){return(this.info&Wd)>0}set deleted(e){this.deleted!==e&&(this.info^=Wd)}markDeleted(){this.info|=Wd}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=tt(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=tt(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===Ms&&this.id.client!==this.parent.client&&this.parent.clock>=tt(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=P1(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=Qt(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===Nn||this.right&&this.right.constructor===Nn)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===$h?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===$h&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===Ms){const r=Os(n,this.parent);r.constructor===Nn?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=P1(e,e.doc.store,Ee(this.id.client,this.id.clock-1)),this.origin=this.left.lastId,this.content=this.content.splice(n),this.length-=n),this.parent){if(!this.left&&(!this.right||this.right.left!==null)||this.left&&this.left.right!==this.right){let r=this.left,i;if(r!==null)i=r.right;else if(this.parentSub!==null)for(i=this.parent._map.get(this.parentSub)||null;i!==null&&i.left!==null;)i=i.left;else i=this.parent._start;const s=new Set,o=new Set;for(;i!==null&&i!==this.right;){if(o.add(i),s.add(i),Ss(this.origin,i.origin)){if(i.id.client<this.id.client)r=i,s.clear();else if(Ss(this.rightOrigin,i.rightOrigin))break}else if(i.origin!==null&&o.has(Os(e.doc.store,i.origin)))s.has(Os(e.doc.store,i.origin))||(r=i,s.clear());else break;i=i.right}this.left=r}if(this.left!==null){const r=this.left.right;this.right=r,this.left.right=this}else{let r;if(this.parentSub!==null)for(r=this.parent._map.get(this.parentSub)||null;r!==null&&r.left!==null;)r=r.left;else r=this.parent._start,this.parent._start=this;this.right=r}this.right!==null?this.right.left=this:this.parentSub!==null&&(this.parent._map.set(this.parentSub,this),this.left!==null&&this.left.delete(e)),this.parentSub===null&&this.countable&&!this.deleted&&(this.parent._length+=this.length),ax(e.doc.store,this),this.content.integrate(e,this),F1(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new Nn(this.id,this.length).integrate(e,0)}get next(){let e=this.right;for(;e!==null&&e.deleted;)e=e.right;return e}get prev(){let e=this.left;for(;e!==null&&e.deleted;)e=e.left;return e}get lastId(){return this.length===1?this.id:Ee(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&Ss(e.origin,this.lastId)&&this.right===e&&Ss(this.rightOrigin,e.rightOrigin)&&this.id.client===e.id.client&&this.id.clock+this.length===e.id.clock&&this.deleted===e.deleted&&this.redone===null&&e.redone===null&&this.content.constructor===e.content.constructor&&this.content.mergeWith(e.content)){const n=this.parent._searchMarker;return n&&n.forEach(r=>{r.p===e&&(r.p=this,!this.deleted&&this.countable&&(r.index-=this.length))}),e.keep&&(this.keep=!0),this.right=e.right,this.right!==null&&(this.right.left=this),this.length+=e.length,!0}return!1}delete(e){if(!this.deleted){const n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Oa(e.deleteSet,this.id.client,this.id.clock,this.length),F1(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw zt();this.content.gc(e),n?vM(e,this,new Nn(this.id,this.length)):this.content=new Ha(this.length)}write(e,n){const r=n>0?Ee(this.id.client,this.id.clock+n-1):this.origin,i=this.rightOrigin,s=this.parentSub,o=this.content.getRef()&Rc|(r===null?0:Ut)|(i===null?0:Or)|(s===null?0:Na);if(e.writeInfo(o),r!==null&&e.writeLeftID(r),i!==null&&e.writeRightID(i),r===null&&i===null){const a=this.parent;if(a._item!==void 0){const l=a._item;if(l===null){const u=Da(a);e.writeParentInfo(!0),e.writeString(u)}else e.writeParentInfo(!1),e.writeLeftID(l.id)}else a.constructor===String?(e.writeParentInfo(!0),e.writeString(a)):a.constructor===Ms?(e.writeParentInfo(!1),e.writeLeftID(a)):zt();s!==null&&e.writeString(s)}this.content.write(e,n)}};const Ix=(t,e)=>wO[e&Rc](t),wO=[()=>{zt()},aO,dO,oO,pO,uO,cO,SO,hO,lO,()=>{zt()}],kO=10;class _n extends Am{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){zt()}write(e,n){e.writeInfo(kO),ve(e.restEncoder,this.length-n)}getMissing(e,n){return null}}const Rx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},Mx="__ $YJS$ __";Rx[Mx]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");Rx[Mx]=!0;const AO=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}},vO=/[\uD800-\uDBFF]/,NO=/[\uDC00-\uDFFF]/,_O=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&vO.test(t[n-1])&&n--;r+n<t.length&&r+n<e.length&&t[t.length-r-1]===e[e.length-r-1];)r++;return r>0&&NO.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},IO=_O,Ge=new yt("y-sync"),oi=new yt("y-undo"),Bl=new yt("yjs-cursor"),sr=(t,e)=>t>>>e|t<<32-e,RO=t=>sr(t,2)^sr(t,13)^sr(t,22),MO=t=>sr(t,6)^sr(t,11)^sr(t,25),OO=t=>sr(t,7)^sr(t,18)^t>>>3,DO=t=>sr(t,17)^sr(t,19)^t>>>10,LO=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),PO=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class BO{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(PO),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=DO(n[d-2])+n[d-7]+OO(n[d-15])+n[d-16];let r=e[0],i=e[1],s=e[2],o=e[3],a=e[4],l=e[5],u=e[6],c=e[7];for(let d=0,f,h;d<64;d++)f=c+MO(a)+(a&l^~a&u)+LO[d]+n[d]>>>0,h=RO(r)+(r&i^r&s^i&s)>>>0,c=u,u=l,l=a,a=o+f>>>0,o=s,s=i,i=r,r=f+h>>>0;e[0]+=r,e[1]+=i,e[2]+=s,e[3]+=o,e[4]+=a,e[5]+=l,e[6]+=u,e[7]+=c}digest(e){let n=0;for(;n+56<=e.length;){let o=0;for(;o<16&&n+3<e.length;o++)this._W[o]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,o,16);n<e.length;)this._W[o]|=e[n]<<(3-n%4)*8,n++;this._W[o]|=Ut<<(3-n%4)*8}this._updateHash()}const r=n%64!==0;this._W.fill(0,0,16);let i=0;for(;n<e.length;i++)for(let o=3;o>=0&&n<e.length;o--)this._W[i]|=e[n++]<<o*8;r||(this._W[i-(n%4===0?0:1)]|=Ut<<(3-n%4)*8),this._W[14]=e.byteLength/yR,this._W[15]=e.byteLength*8,this._updateHash();const s=new Uint8Array(32);for(let o=0;o<this._H.length;o++)for(let a=0;a<4;a++)s[o*4+a]=this._H[o]>>>(3-a)*8;return s}}const FO=t=>new BO().digest(t),HO=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},UO=t=>h6(HO(FO(m6(t)))),Yu=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&e.sv.get(t.id.client)>t.id.clock&&!yo(e.ds,t.id),$O=[{light:"#ecd44433",dark:"#ecd444"}],VO=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){const r=ji();t.forEach(i=>r.add(i)),e=e.filter(i=>!r.has(i))}t.set(n,xR(e))}return t.get(n)},wG=(t,{colors:e=$O,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:i=()=>{},mapping:s}={})=>{let o=!1;const a=new jO(t,s),l=new nt({props:{editable:u=>{const c=Ge.getState(u);return c.snapshot==null&&c.prevSnapshot==null}},key:Ge,state:{init:(u,c)=>({type:t,doc:t.doc,binding:a,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r}),apply:(u,c)=>{const d=u.getMeta(Ge);if(d!==void 0){c=Object.assign({},c);for(const f in d)c[f]=d[f]}return c.addToHistory=u.getMeta("addToHistory")!==!1,c.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,c.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,a.prosemirrorView!==null&&d!==void 0&&(d.snapshot!=null||d.prevSnapshot!=null)&&pm(0,()=>{a.prosemirrorView!=null&&(d.restore==null?a._renderSnapshot(d.snapshot,d.prevSnapshot,c):(a._renderSnapshot(d.snapshot,d.snapshot,c),delete c.restore,delete c.snapshot,delete c.prevSnapshot,a.mux(()=>{a._prosemirrorChanged(a.prosemirrorView.state.doc)})))}),c}},view:u=>(a.initView(u),s==null&&a._forceRerender(),i(),{update:()=>{const c=l.getState(u.state);if(c.snapshot==null&&c.prevSnapshot==null&&(o||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(o=!0,c.addToHistory===!1&&!c.isChangeOrigin){const d=oi.getState(u.state),f=d&&d.undoManager;f&&f.stopCapturing()}a.mux(()=>{c.doc.transact(d=>{d.meta.set("addToHistory",c.addToHistory),a._prosemirrorChanged(u.state.doc)},Ge)})}},destroy:()=>{a.destroy()}})});return l},zO=(t,e,n)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new tn(t.doc));else if(e.type==="node"){const r=Ls(n.doc,n.type,e.anchor,n.mapping);t.setSelection(ae.create(t.doc,r))}else{const r=Ls(n.doc,n.type,e.anchor,n.mapping),i=Ls(n.doc,n.type,e.head,n.mapping);if(r!==null&&i!==null){const s=ue.between(t.doc.resolve(r),t.doc.resolve(i));t.setSelection(s)}}},Vh=(t,e)=>({type:e.selection.jsonID,anchor:Gu(e.selection.anchor,t.type,t.mapping),head:Gu(e.selection.head,t.type,t.mapping)});class jO{constructor(e,n=new Map){this.type=e,this.prosemirrorView=null,this.mux=AO(),this.mapping=n,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=Vh(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(wC&&this._domSelectionInView===null&&(pm(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const n=this.prosemirrorView._root.createRange();n.setStart(e.anchorNode,e.anchorOffset),n.setEnd(e.focusNode,e.focusOffset),n.getClientRects().length===0&&n.startContainer&&n.collapsed&&n.selectNodeContents(n.startContainer);const i=n.getBoundingClientRect(),s=nl.documentElement;return i.bottom>=0&&i.right>=0&&i.left<=(window.innerWidth||s.clientWidth||0)&&i.top<=(window.innerHeight||s.clientHeight||0)}renderSnapshot(e,n){n||(n=sx(GC(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Ge,{snapshot:e,prevSnapshot:n}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(r=>hu(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),n=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ee(q.from(e),0,0));n.setMeta(Ge,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(n)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,n=this.type.toArray().map(i=>hu(i,this.prosemirrorView.state.schema,this)).filter(i=>i!==null),r=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ee(q.from(n),0,0));if(e){const i=Mr(jn(e.anchor,0),r.doc.content.size),s=Mr(jn(e.head,0),r.doc.content.size);r.setSelection(ue.create(r.doc,i,s))}this.prosemirrorView.dispatch(r.setMeta(Ge,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,n,r){let i=this.doc,s=this.type;if(e||(e=tf(this.doc)),e instanceof Uint8Array||n instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(n instanceof Uint8Array))&&zt(),i=new Zi({gc:!1}),Uu(i,n),n=tf(i),Uu(i,e),e=tf(i),s._item===null){const o=Array.from(this.doc.share.keys()).find(a=>this.doc.share.get(a)===this.type);s=i.getXmlFragment(o)}else{const o=i.store.clients.get(s._item.id.client)??[],a=Wn(o,s._item.id.clock);s=o[a].content.type}this.mapping.clear(),this.mux(()=>{i.transact(o=>{const a=r.permanentUserData;a&&a.dss.forEach(d=>{ci(o,d,f=>{})});const l=(d,f)=>{const h=d==="added"?a.getUserByClientId(f.client):a.getUserByDeletedId(f);return{user:h,type:d,color:VO(r.colorMapping,r.colors,h)}},u=gx(s,new Em(n.ds,e.sv)).map(d=>!d._item.deleted||Yu(d._item,e)||Yu(d._item,n)?hu(d,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,n,l):null).filter(d=>d!==null),c=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ee(q.from(u),0,0));this.prosemirrorView.dispatch(c.setMeta(Ge,{isChangeOrigin:!0}))},Ge)})}_typeChanged(e,n){if(this.prosemirrorView==null)return;const r=Ge.getState(this.prosemirrorView.state);if(e.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}this.mux(()=>{const i=(a,l)=>this.mapping.delete(l);ci(n,n.deleteSet,a=>{if(a.constructor===We){const l=a.content.type;l&&this.mapping.delete(l)}}),n.changed.forEach(i),n.changedParentTypes.forEach(i);const s=this.type.toArray().map(a=>Ox(a,this.prosemirrorView.state.schema,this)).filter(a=>a!==null);let o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new ee(q.from(s),0,0));zO(o,this.beforeTransactionSelection,this),o=o.setMeta(Ge,{isChangeOrigin:!0,isUndoRedoOperation:n.origin instanceof cx}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&o.scrollIntoView(),this.prosemirrorView.dispatch(o)})}_prosemirrorChanged(e){this.doc.transact(()=>{jh(this.doc,this.type,e,this),this.beforeTransactionSelection=Vh(this,this.prosemirrorView.state)},Ge)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const Ox=(t,e,n,r,i,s)=>{const o=n.mapping.get(t);if(o===void 0){if(t instanceof Ht)return hu(t,e,n,r,i,s);throw On()}return o},hu=(t,e,n,r,i,s)=>{const o=[],a=l=>{if(l instanceof Ht){const u=Ox(l,e,n,r,i,s);u!==null&&o.push(u)}else{const u=l._item.right?.content?.type;u instanceof di&&!u._item.deleted&&u._item.id.client===u.doc.clientID&&(l.applyDelta([{retain:l.length},...u.toDelta()]),u.doc.transact(d=>{u._item.delete(d)}));const c=WO(l,e,n,r,i,s);c!==null&&c.forEach(d=>{d!==null&&o.push(d)})}};r===void 0||i===void 0?t.toArray().forEach(a):gx(t,new Em(i.ds,r.sv)).forEach(a);try{const l=t.getAttributes(r);r!==void 0&&(Yu(t._item,r)?Yu(t._item,i)||(l.ychange=s?s("added",t._item.id):{type:"added"}):l.ychange=s?s("removed",t._item.id):{type:"removed"});const u=e.node(t.nodeName,l,o);return n.mapping.set(t,u),u}catch{return t.doc.transact(u=>{t._item.delete(u)},Ge),n.mapping.delete(t),null}},WO=(t,e,n,r,i,s)=>{const o=[],a=t.toDelta(r,i,s);try{for(let l=0;l<a.length;l++){const u=a[l];o.push(e.text(u.insert,QO(u.attributes,e)))}}catch{return t.doc.transact(u=>{t._item.delete(u)},Ge),null}return o},qO=(t,e)=>{const n=new gn,r=t.map(i=>({insert:i.text,attributes:Px(i.marks,e)}));return n.applyDelta(r),e.mapping.set(n,t),n},YO=(t,e)=>{const n=new Ht(t.type.name);for(const r in t.attrs){const i=t.attrs[r];i!==null&&r!=="ychange"&&n.setAttribute(r,i)}return n.insert(0,zc(t).map(r=>zh(r,e))),e.mapping.set(n,t),n},zh=(t,e)=>t instanceof Array?qO(t,e):YO(t,e),q1=t=>typeof t=="object"&&t!==null,Nm=(t,e)=>{const n=Object.keys(t).filter(i=>t[i]!==null);let r=n.length===(e==null?0:Object.keys(e).filter(i=>e[i]!==null).length);for(let i=0;i<n.length&&r;i++){const s=n[i],o=t[s],a=e[s];r=s==="ychange"||o===a||q1(o)&&q1(a)&&Nm(o,a)}return r},zc=t=>{const e=t.content.content,n=[];for(let r=0;r<e.length;r++){const i=e[r];if(i.isText){const s=[];for(let o=e[r];r<e.length&&o.isText;o=e[++r])s.push(o);r--,n.push(s)}else n.push(i)}return n},Dx=(t,e)=>{const n=t.toDelta();return n.length===e.length&&n.every((r,i)=>r.insert===e[i].text&&CC(r.attributes||{}).length===e[i].marks.length&&mo(r.attributes,(s,o)=>{const a=Lx(o),l=e[i].marks;return Nm(s,l.find(u=>u.type.name===a)?.attrs)}))},Ua=(t,e)=>{if(t instanceof Ht&&!(e instanceof Array)&&Wh(t,e)){const n=zc(e);return t._length===n.length&&Nm(t.getAttributes(),e.attrs)&&t.toArray().every((r,i)=>Ua(r,n[i]))}return t instanceof gn&&e instanceof Array&&Dx(t,e)},Ku=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),Y1=(t,e,n)=>{const r=t.toArray(),i=zc(e),s=i.length,o=r.length,a=Mr(o,s);let l=0,u=0,c=!1;for(;l<a;l++){const d=r[l],f=i[l];if(Ku(n.mapping.get(d),f))c=!0;else if(!Ua(d,f))break}for(;l+u<a;u++){const d=r[o-u-1],f=i[s-u-1];if(Ku(n.mapping.get(d),f))c=!0;else if(!Ua(d,f))break}return{equalityFactor:l+u,foundMappedChild:c}},KO=t=>{let e="",n=t._start;const r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof qn?e+=n.content.str:n.content instanceof ot&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},GO=(t,e,n)=>{n.mapping.set(t,e);const{nAttrs:r,str:i}=KO(t),s=e.map(u=>({insert:u.text,attributes:Object.assign({},r,Px(u.marks,n))})),{insert:o,remove:a,index:l}=IO(i,s.map(u=>u.insert).join(""));t.delete(l,a),t.insert(l,o),t.applyDelta(s.map(u=>({retain:u.insert.length,attributes:u.attributes})))},XO=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Lx=t=>XO.exec(t)?.[1]??t,QO=(t,e)=>{const n=[];for(const r in t)n.push(e.mark(Lx(r),t[r]));return n},Px=(t,e)=>{const n={};return t.forEach(r=>{if(r.type.name!=="ychange"){const i=mr(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[i?`${r.type.name}--${UO(r.toJSON())}`:r.type.name]=r.attrs}}),n},jh=(t,e,n,r)=>{if(e instanceof Ht&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Ht){const d=e.getAttributes(),f=n.attrs;for(const h in f)f[h]!==null?d[h]!==f[h]&&h!=="ychange"&&e.setAttribute(h,f[h]):e.removeAttribute(h);for(const h in d)f[h]===void 0&&e.removeAttribute(h)}const i=zc(n),s=i.length,o=e.toArray(),a=o.length,l=Mr(s,a);let u=0,c=0;for(;u<l;u++){const d=o[u],f=i[u];if(!Ku(r.mapping.get(d),f))if(Ua(d,f))r.mapping.set(d,f);else break}for(;c+u<l;c++){const d=o[a-c-1],f=i[s-c-1];if(!Ku(r.mapping.get(d),f))if(Ua(d,f))r.mapping.set(d,f);else break}t.transact(()=>{for(;a-u-c>0&&s-u-c>0;){const f=o[u],h=i[u],p=o[a-c-1],g=i[s-c-1];if(f instanceof gn&&h instanceof Array)Dx(f,h)||GO(f,h,r),u+=1;else{let b=f instanceof Ht&&Wh(f,h),y=p instanceof Ht&&Wh(p,g);if(b&&y){const E=Y1(f,h,r),T=Y1(p,g,r);E.foundMappedChild&&!T.foundMappedChild?y=!1:!E.foundMappedChild&&T.foundMappedChild||E.equalityFactor<T.equalityFactor?b=!1:y=!1}b?(jh(t,f,h,r),u+=1):y?(jh(t,p,g,r),c+=1):(r.mapping.delete(e.get(u)),e.delete(u,1),e.insert(u,[zh(h,r)]),u+=1)}}const d=a-u-c;if(a===1&&s===0&&o[0]instanceof gn?(r.mapping.delete(o[0]),o[0].delete(0,o[0].length)):d>0&&(e.slice(u,u+d).forEach(f=>r.mapping.delete(f)),e.delete(u,d)),u+c<s){const f=[];for(let h=u;h<s-c;h++)f.push(zh(i[h],r));e.insert(u,f)}},Ge)},Wh=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name;let aa=null;const ZO=()=>{const t=aa;aa=null,t.forEach((e,n)=>{const r=n.state.tr,i=Ge.getState(n.state);i&&i.binding&&!i.binding.isDestroyed&&(e.forEach((s,o)=>{r.setMeta(o,s)}),n.dispatch(r))})},JO=(t,e,n)=>{aa||(aa=new Map,pm(0,ZO)),mr(aa,t,Mn).set(e,n)},Gu=(t,e,n)=>{if(t===0)return ef(e,0,e.length===0?-1:0);let r=e._first===null?null:e._first.content.type;for(;r!==null&&e!==r;){if(r instanceof gn){if(r._length>=t)return ef(r,t,e.length===0?-1:0);if(t-=r._length,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{do r=r._item===null?null:r._item.parent,t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:r._item.next.content.type)}}else{const i=(n.get(r)||{nodeSize:0}).nodeSize;if(r._first!==null&&t<i)r=r._first.content.type,t--;else{if(t===1&&r._length===0&&i>1)return new Pa(r._item===null?null:r._item.id,r._item===null?Da(r):null,null);if(t-=i,r._item!==null&&r._item.next!==null)r=r._item.next.content.type;else{if(t===0)return r=r._item===null?r:r._item.parent,new Pa(r._item===null?null:r._item.id,r._item===null?Da(r):null,null);do r=r._item.parent,t--;while(r!==e&&r._item.next===null);r!==e&&(r=r._item.next.content.type)}}}if(r===null)throw zt();if(t===0&&r.constructor!==gn&&r!==e)return eD(r._item.parent,r._item)}return ef(e,e._length,e.length===0?-1:0)},eD=(t,e)=>{let n=null,r=null;return t._item===null?r=Da(t):n=Ee(t._item.id.client,t._item.id.clock),new Pa(n,r,e.id)},Ls=(t,e,n,r)=>{const i=kM(n,t);if(i===null||i.type!==e&&!La(e,i.type._item))return null;let s=i.type,o=0;if(s.constructor===gn)o=i.index;else if(s._item===null||!s._item.deleted){let a=s._first,l=0;for(;l<s._length&&l<i.index&&a!==null;){if(!a.deleted){const u=a.content.type;l++,u instanceof gn?o+=u._length:o+=r.get(u).nodeSize}a=a.right}o+=1}for(;s!==e&&s._item!==null;){const a=s._item.parent;if(a._item===null||!a._item.deleted){o+=1;let l=a._first;for(;l!==null;){const u=l.content.type;if(u===s)break;l.deleted||(u instanceof gn?o+=u._length:o+=r.get(u).nodeSize),l=l.right}}s=a}return o-1},tD=(t,e,n)=>t!==e,nD=t=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);const n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);const r=document.createTextNode("⁠"),i=document.createTextNode("⁠");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(i,null),e},rD=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),iD=/^#[0-9a-fA-F]{6}$/,K1=(t,e,n,r,i)=>{const s=Ge.getState(t),o=s.doc,a=[];return s.snapshot!=null||s.prevSnapshot!=null||s.binding.mapping.size===0?Le.create(t.doc,[]):(e.getStates().forEach((l,u)=>{if(n(o.clientID,u,l)&&l.cursor!=null){const c=l.user||{};c.color==null?c.color="#ffa500":iD.test(c.color)||console.warn("A user uses an unsupported color format",c),c.name==null&&(c.name=`User: ${u}`);let d=Ls(o,s.type,oa(l.cursor.anchor),s.binding.mapping),f=Ls(o,s.type,oa(l.cursor.head),s.binding.mapping);if(d!==null&&f!==null){const h=jn(t.doc.content.size-1,0);d=Mr(d,h),f=Mr(f,h),a.push(ut.widget(f,()=>r(c,u),{key:u+"",side:10}));const p=Mr(d,f),g=jn(d,f);a.push(ut.inline(p,g,i(c,u),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Le.create(t.doc,a))},kG=(t,{awarenessStateFilter:e=tD,cursorBuilder:n=nD,selectionBuilder:r=rD,getSelection:i=o=>o.selection}={},s="cursor")=>new nt({key:Bl,state:{init(o,a){return K1(a,t,e,n,r)},apply(o,a,l,u){const c=Ge.getState(u),d=o.getMeta(Bl);return c&&c.isChangeOrigin||d&&d.awarenessUpdated?K1(u,t,e,n,r):a.map(o.mapping,o.doc)}},props:{decorations:o=>Bl.getState(o)},view:o=>{const a=()=>{o.docView&&JO(o,Bl,{awarenessUpdated:!0})},l=()=>{const u=Ge.getState(o.state),c=t.getLocalState()||{};if(o.hasFocus()){const d=i(o.state),f=Gu(d.anchor,u.type,u.binding.mapping),h=Gu(d.head,u.type,u.binding.mapping);(c.cursor==null||!L1(oa(c.cursor.anchor),f)||!L1(oa(c.cursor.head),h))&&t.setLocalStateField(s,{anchor:f,head:h})}else c.cursor!=null&&Ls(u.doc,u.type,oa(c.cursor.anchor),u.binding.mapping)!==null&&t.setLocalStateField(s,null)};return t.on("change",a),o.dom.addEventListener("focusin",l),o.dom.addEventListener("focusout",l),{update:l,destroy:()=>{o.dom.removeEventListener("focusin",l),o.dom.removeEventListener("focusout",l),t.off("change",a),t.setLocalStateField(s,null)}}}}),sD=t=>oi.getState(t)?.undoManager?.undo()!=null,oD=t=>oi.getState(t)?.undoManager?.redo()!=null,AG=(t,e)=>e==null?oi.getState(t)?.undoManager?.canUndo():sD(t),vG=(t,e)=>e==null?oi.getState(t)?.undoManager?.canRedo():oD(t),aD=new Set(["paragraph"]),lD=(t,e)=>!(t instanceof We)||!(t.content instanceof Gn)||!(t.content.type instanceof di||t.content.type instanceof Ht&&e.has(t.content.type.nodeName))||t.content.type._length===0,NG=({protectedNodes:t=aD,trackedOrigins:e=[],undoManager:n=null}={})=>new nt({key:oi,state:{init:(r,i)=>{const s=Ge.getState(i),o=n||new cx(s.type,{trackedOrigins:new Set([Ge].concat(e)),deleteFilter:a=>lD(a,t),captureTransaction:a=>a.meta.get("addToHistory")!==!1});return{undoManager:o,prevSel:null,hasUndoOps:o.undoStack.length>0,hasRedoOps:o.redoStack.length>0}},apply:(r,i,s,o)=>{const a=Ge.getState(o).binding,l=i.undoManager,u=l.undoStack.length>0,c=l.redoStack.length>0;return a?{undoManager:l,prevSel:Vh(a,s),hasUndoOps:u,hasRedoOps:c}:u!==i.hasUndoOps||c!==i.hasRedoOps?Object.assign({},i,{hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0}):i}},view:r=>{const i=Ge.getState(r.state),s=oi.getState(r.state).undoManager;return s.on("stack-item-added",({stackItem:o})=>{const a=i.binding;a&&o.meta.set(a,oi.getState(r.state).prevSel)}),s.on("stack-item-popped",({stackItem:o})=>{const a=i.binding;a&&(a.beforeTransactionSelection=o.meta.get(a)||a.beforeTransactionSelection)}),{destroy:()=>{s.destroy()}}}}),Bx=new WeakSet,Fx=new WeakSet;function Ci(t){const e=t;return Bx.add(e),e}function qh(t){return Array.isArray(t)&&Bx.has(t)}function Hx(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&Fx.has(e)&&!qh(e)?Hx(e):[e])}function uD(t,e){if(t==="slot")return 0;if(t instanceof Function){const i=t(e);return Array.isArray(i)&&!qh(i)&&!Fx.has(i)?Ci(i):i}const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");if(Array.isArray(n)){if(qh(n))return Ci([t,r,n]);if(n.length===0)return Ci([t,r]);const i=Hx(n);return i.length===0?Ci([t,r]):Ci([t,r,...i])}return n!=null?Ci([t,r,n]):Ci([t,r])}const G1=(t,e)=>uD(t,e),cD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,dD=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,fD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,hD=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,pD=ho.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return G1("strong",{...fo(this.options.HTMLAttributes,t),children:G1("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<strong>",close:"</strong>"}},renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ys({find:cD,type:this.type}),Ys({find:fD,type:this.type})]},addPasteRules(){return[Ks({find:dD,type:this.type}),Ks({find:hD,type:this.type})]}});var _G=pD;const mD=t=>{const e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},gD=t=>{const e=/`([^`]+)`(?!`)/g,n=[];let r;for(;(r=e.exec(t))!==null;)r.index>0&&t[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n},bD=ho.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",fo(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ys({find:mD,type:this.type})]},addPasteRules(){return[Ks({find:gD,type:this.type})]}});var IG=bD;const yD=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,ED=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,TD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,CD=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,xD=ho.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",fo(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),markdownOptions:{htmlReopen:{open:"<em>",close:"</em>"}},renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ys({find:yD,type:this.type}),Ys({find:TD,type:this.type})]},addPasteRules(){return[Ks({find:ED,type:this.type}),Ks({find:CD,type:this.type})]}});var RG=xD;const SD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wD=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,kD=ho.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",fo(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ys({find:SD,type:this.type})]},addPasteRules(){return[Ks({find:wD,type:this.type})]}});var MG=kD;const AD=ho.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",fo(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});var OG=AD,sf,X1;function vD(){return X1||(X1=1,sf=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),sf}var ND=vD();const DG=Sp(ND);var Xu=200,gt=function(){};gt.prototype.append=function(e){return e.length?(e=gt.from(e),!this.length&&e||e.length<Xu&&this.leafAppend(e)||this.length<Xu&&e.leafPrepend(this)||this.appendInner(e)):this};gt.prototype.prepend=function(e){return e.length?gt.from(e).append(this):this};gt.prototype.appendInner=function(e){return new _D(this,e)};gt.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?gt.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};gt.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};gt.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};gt.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(s,o){return i.push(e(s,o))},n,r),i};gt.from=function(e){return e instanceof gt?e:e&&e.length?new Ux(e):gt.empty};var Ux=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,s){return i==0&&s==this.length?this:new e(this.values.slice(i,s))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,s,o,a){for(var l=s;l<o;l++)if(i(this.values[l],a+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,s,o,a){for(var l=s-1;l>=o;l--)if(i(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Xu)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Xu)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(gt);gt.empty=new Ux([]);var _D=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,s,o){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(s,a),o)===!1||s>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,s)-a,o+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,o){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(s,a)-a,o+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(i,a),s,o)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var s=this.left.length;return i<=s?this.left.slice(r,i):r>=s?this.right.slice(r-s,i-s):this.left.slice(r,s).append(this.right.slice(0,i-s))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(gt);const ID=500;class Pn{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,s;n&&(i=this.remapping(r,this.items.length),s=i.maps.length);let o=e.tr,a,l,u=[],c=[];return this.items.forEach((d,f)=>{if(!d.step){i||(i=this.remapping(r,f+1),s=i.maps.length),s--,c.push(d);return}if(i){c.push(new er(d.map));let h=d.step.map(i.slice(s)),p;h&&o.maybeStep(h).doc&&(p=o.mapping.maps[o.mapping.maps.length-1],u.push(new er(p,void 0,void 0,u.length+c.length))),s--,p&&i.appendMap(p,s)}else o.maybeStep(d.step);if(d.selection)return a=i?d.selection.map(i.slice(s)):d.selection,l=new Pn(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(e,n,r,i){let s=[],o=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let c=0;c<e.steps.length;c++){let d=e.steps[c].invert(e.docs[c]),f=new er(e.mapping.maps[c],d,n),h;(h=l&&l.merge(f))&&(f=h,c?s.pop():a=a.slice(0,a.length-1)),s.push(f),n&&(o++,n=void 0),i||(l=f)}let u=o-r.depth;return u>MD&&(a=RD(a,u),o-=u),new Pn(a.append(s),o)}remapping(e,n){let r=new Ta;return this.items.forEach((i,s)=>{let o=i.mirrorOffset!=null&&s-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},e,n),r}addMaps(e){return this.eventCount==0?this:new Pn(this.items.append(e.map(n=>new er(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),s=e.mapping,o=e.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},i);let l=n;this.items.forEach(f=>{let h=s.getMirror(--l);if(h==null)return;o=Math.min(o,h);let p=s.maps[h];if(f.step){let g=e.steps[h].invert(e.docs[h]),b=f.selection&&f.selection.map(s.slice(l+1,h));b&&a++,r.push(new er(p,g,b))}else r.push(new er(p))},i);let u=[];for(let f=n;f<o;f++)u.push(new er(s.maps[f]));let c=this.items.slice(0,i).append(u).append(r),d=new Pn(c,a);return d.emptyItemCount()>ID&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],s=0;return this.items.forEach((o,a)=>{if(a>=e)i.push(o),o.selection&&s++;else if(o.step){let l=o.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=o.selection&&o.selection.map(n.slice(r));c&&s++;let d=new er(u.invert(),l,c),f,h=i.length-1;(f=i.length&&i[h].merge(d))?i[h]=f:i.push(d)}}else o.map&&r--},this.items.length,0),new Pn(gt.from(i.reverse()),s)}}Pn.empty=new Pn(gt.empty,0);function RD(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}class er{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new er(n.getMap().invert(),n,this.selection)}}}class qr{constructor(e,n,r,i,s){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=s}}const MD=20;function OD(t,e,n,r){let i=n.getMeta(Bi),s;if(i)return i.historyState;n.getMeta($x)&&(t=new qr(t.done,t.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(o&&o.getMeta(Bi))return o.getMeta(Bi).redo?new qr(t.done.addTransform(n,void 0,r,pu(e)),t.undone,Q1(n.mapping.maps),t.prevTime,t.prevComposition):new qr(t.done,t.undone.addTransform(n,void 0,r,pu(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!o&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!DD(n,t.prevRanges)),u=o?of(t.prevRanges,n.mapping):Q1(n.mapping.maps);return new qr(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,pu(e)),Pn.empty,u,n.time,a??t.prevComposition)}else return(s=n.getMeta("rebased"))?new qr(t.done.rebased(n,s),t.undone.rebased(n,s),of(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new qr(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),of(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function DD(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&i>=e[s]&&(n=!0)}),n}function Q1(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,s,o)=>e.push(s,o));return e}function of(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),s=e.map(t[r+1],-1);i<=s&&n.push(i,s)}return n}function LD(t,e,n){let r=pu(e),i=Bi.get(e).spec.config,s=(n?t.undone:t.done).popEvent(e,r);if(!s)return null;let o=s.selection.resolve(s.transform.doc),a=(n?t.done:t.undone).addTransform(s.transform,e.selection.getBookmark(),i,r),l=new qr(n?a:s.remaining,n?s.remaining:a,null,0,-1);return s.transform.setSelection(o).setMeta(Bi,{redo:n,historyState:l})}let af=!1,Z1=null;function pu(t){let e=t.plugins;if(Z1!=e){af=!1,Z1=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){af=!0;break}}return af}function PD(t){return t.setMeta($x,!0)}const Bi=new yt("history"),$x=new yt("closeHistory");function LG(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new nt({key:Bi,state:{init(){return new qr(Pn.empty,Pn.empty,null,0,-1)},apply(e,n,r){return OD(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?BD:r=="historyRedo"?FD:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function Vx(t,e){return(n,r)=>{let i=Bi.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let s=LD(i,n,t);s&&r(e?s.scrollIntoView():s)}return!0}}const BD=Vx(!1,!0),FD=Vx(!0,!0);class al{constructor(e,n,r){this.normal=n,this.property=e,r&&(this.space=r)}}al.prototype.normal={};al.prototype.property={};al.prototype.space=void 0;function zx(t,e){const n={},r={};for(const i of t)Object.assign(n,i.property),Object.assign(r,i.normal);return new al(n,r,e)}function $a(t){return t.toLowerCase()}class sn{constructor(e,n){this.attribute=n,this.property=e}}sn.prototype.attribute="";sn.prototype.booleanish=!1;sn.prototype.boolean=!1;sn.prototype.commaOrSpaceSeparated=!1;sn.prototype.commaSeparated=!1;sn.prototype.defined=!1;sn.prototype.mustUseProperty=!1;sn.prototype.number=!1;sn.prototype.overloadedBoolean=!1;sn.prototype.property="";sn.prototype.spaceSeparated=!1;sn.prototype.space=void 0;let HD=0;const Te=es(),it=es(),Yh=es(),J=es(),ze=es(),Ps=es(),cn=es();function es(){return 2**++HD}const Kh=Object.freeze(Object.defineProperty({__proto__:null,boolean:Te,booleanish:it,commaOrSpaceSeparated:cn,commaSeparated:Ps,number:J,overloadedBoolean:Yh,spaceSeparated:ze},Symbol.toStringTag,{value:"Module"})),lf=Object.keys(Kh);class _m extends sn{constructor(e,n,r,i){let s=-1;if(super(e,n),J1(this,"space",i),typeof r=="number")for(;++s<lf.length;){const o=lf[s];J1(this,lf[s],(r&Kh[o])===Kh[o])}}}_m.prototype.defined=!0;function J1(t,e,n){n&&(t[e]=n)}function Co(t){const e={},n={};for(const[r,i]of Object.entries(t.properties)){const s=new _m(r,t.transform(t.attributes||{},r),i,t.space);t.mustUseProperty&&t.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),e[r]=s,n[$a(r)]=r,n[$a(s.attribute)]=r}return new al(e,n,t.space)}const jx=Co({properties:{ariaActiveDescendant:null,ariaAtomic:it,ariaAutoComplete:null,ariaBusy:it,ariaChecked:it,ariaColCount:J,ariaColIndex:J,ariaColSpan:J,ariaControls:ze,ariaCurrent:null,ariaDescribedBy:ze,ariaDetails:null,ariaDisabled:it,ariaDropEffect:ze,ariaErrorMessage:null,ariaExpanded:it,ariaFlowTo:ze,ariaGrabbed:it,ariaHasPopup:null,ariaHidden:it,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:ze,ariaLevel:J,ariaLive:null,ariaModal:it,ariaMultiLine:it,ariaMultiSelectable:it,ariaOrientation:null,ariaOwns:ze,ariaPlaceholder:null,ariaPosInSet:J,ariaPressed:it,ariaReadOnly:it,ariaRelevant:null,ariaRequired:it,ariaRoleDescription:ze,ariaRowCount:J,ariaRowIndex:J,ariaRowSpan:J,ariaSelected:it,ariaSetSize:J,ariaSort:null,ariaValueMax:J,ariaValueMin:J,ariaValueNow:J,ariaValueText:null,role:null},transform(t,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function Wx(t,e){return e in t?t[e]:e}function qx(t,e){return Wx(t,e.toLowerCase())}const UD=Co({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Ps,acceptCharset:ze,accessKey:ze,action:null,allow:null,allowFullScreen:Te,allowPaymentRequest:Te,allowUserMedia:Te,alt:null,as:null,async:Te,autoCapitalize:null,autoComplete:ze,autoFocus:Te,autoPlay:Te,blocking:ze,capture:null,charSet:null,checked:Te,cite:null,className:ze,cols:J,colSpan:null,content:null,contentEditable:it,controls:Te,controlsList:ze,coords:J|Ps,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Te,defer:Te,dir:null,dirName:null,disabled:Te,download:Yh,draggable:it,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Te,formTarget:null,headers:ze,height:J,hidden:Yh,high:J,href:null,hrefLang:null,htmlFor:ze,httpEquiv:ze,id:null,imageSizes:null,imageSrcSet:null,inert:Te,inputMode:null,integrity:null,is:null,isMap:Te,itemId:null,itemProp:ze,itemRef:ze,itemScope:Te,itemType:ze,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Te,low:J,manifest:null,max:null,maxLength:J,media:null,method:null,min:null,minLength:J,multiple:Te,muted:Te,name:null,nonce:null,noModule:Te,noValidate:Te,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Te,optimum:J,pattern:null,ping:ze,placeholder:null,playsInline:Te,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Te,referrerPolicy:null,rel:ze,required:Te,reversed:Te,rows:J,rowSpan:J,sandbox:ze,scope:null,scoped:Te,seamless:Te,selected:Te,shadowRootClonable:Te,shadowRootDelegatesFocus:Te,shadowRootMode:null,shape:null,size:J,sizes:null,slot:null,span:J,spellCheck:it,src:null,srcDoc:null,srcLang:null,srcSet:null,start:J,step:null,style:null,tabIndex:J,target:null,title:null,translate:null,type:null,typeMustMatch:Te,useMap:null,value:it,width:J,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:ze,axis:null,background:null,bgColor:null,border:J,borderColor:null,bottomMargin:J,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Te,declare:Te,event:null,face:null,frame:null,frameBorder:null,hSpace:J,leftMargin:J,link:null,longDesc:null,lowSrc:null,marginHeight:J,marginWidth:J,noResize:Te,noHref:Te,noShade:Te,noWrap:Te,object:null,profile:null,prompt:null,rev:null,rightMargin:J,rules:null,scheme:null,scrolling:it,standby:null,summary:null,text:null,topMargin:J,valueType:null,version:null,vAlign:null,vLink:null,vSpace:J,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Te,disableRemotePlayback:Te,prefix:null,property:null,results:J,security:null,unselectable:null},space:"html",transform:qx}),$D=Co({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:cn,accentHeight:J,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:J,amplitude:J,arabicForm:null,ascent:J,attributeName:null,attributeType:null,azimuth:J,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:J,by:null,calcMode:null,capHeight:J,className:ze,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:J,diffuseConstant:J,direction:null,display:null,dur:null,divisor:J,dominantBaseline:null,download:Te,dx:null,dy:null,edgeMode:null,editable:null,elevation:J,enableBackground:null,end:null,event:null,exponent:J,externalResourcesRequired:null,fill:null,fillOpacity:J,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Ps,g2:Ps,glyphName:Ps,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:J,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:J,horizOriginX:J,horizOriginY:J,id:null,ideographic:J,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:J,k:J,k1:J,k2:J,k3:J,k4:J,kernelMatrix:cn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:J,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:J,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:J,overlineThickness:J,paintOrder:null,panose1:null,path:null,pathLength:J,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:ze,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:J,pointsAtY:J,pointsAtZ:J,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:cn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:cn,rev:cn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:cn,requiredFeatures:cn,requiredFonts:cn,requiredFormats:cn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:J,specularExponent:J,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:J,strikethroughThickness:J,string:null,stroke:null,strokeDashArray:cn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:J,strokeOpacity:J,strokeWidth:null,style:null,surfaceScale:J,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:cn,tabIndex:J,tableValues:null,target:null,targetX:J,targetY:J,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:cn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:J,underlineThickness:J,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:J,values:null,vAlphabetic:J,vMathematical:J,vectorEffect:null,vHanging:J,vIdeographic:J,version:null,vertAdvY:J,vertOriginX:J,vertOriginY:J,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:J,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Wx}),Yx=Co({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(t,e){return"xlink:"+e.slice(5).toLowerCase()}}),Kx=Co({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:qx}),Gx=Co({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(t,e){return"xml:"+e.slice(3).toLowerCase()}}),VD=/[A-Z]/g,eb=/-[a-z]/g,zD=/^data[-\w.:]+$/i;function Im(t,e){const n=$a(e);let r=e,i=sn;if(n in t.normal)return t.property[t.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&zD.test(e)){if(e.charAt(4)==="-"){const s=e.slice(5).replace(eb,WD);r="data"+s.charAt(0).toUpperCase()+s.slice(1)}else{const s=e.slice(4);if(!eb.test(s)){let o=s.replace(VD,jD);o.charAt(0)!=="-"&&(o="-"+o),e="data"+o}}i=_m}return new i(r,e)}function jD(t){return"-"+t.toLowerCase()}function WD(t){return t.charAt(1).toUpperCase()}const jc=zx([jx,UD,Yx,Kx,Gx],"html"),ll=zx([jx,$D,Yx,Kx,Gx],"svg");function tb(t){const e=[],n=String(t||"");let r=n.indexOf(","),i=0,s=!1;for(;!s;){r===-1&&(r=n.length,s=!0);const o=n.slice(i,r).trim();(o||!s)&&e.push(o),i=r+1,r=n.indexOf(",",i)}return e}function qD(t,e){const n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}const nb=/[#.]/g;function YD(t,e){const n=t||"",r={};let i=0,s,o;for(;i<n.length;){nb.lastIndex=i;const a=nb.exec(n),l=n.slice(i,a?a.index:n.length);l&&(s?s==="#"?r.id=l:Array.isArray(r.className)?r.className.push(l):r.className=[l]:o=l,i+=l.length),a&&(s=a[0],i++)}return{type:"element",tagName:o||e||"div",properties:r,children:[]}}function rb(t){const e=String(t||"").trim();return e?e.split(/[ \t\n\r\f]+/g):[]}function KD(t){return t.join(" ").trim()}function Xx(t,e,n){const r=n?ZD(n):void 0;function i(s,o,...a){let l;if(s==null){l={type:"root",children:[]};const u=o;a.unshift(u)}else{l=YD(s,e);const u=l.tagName.toLowerCase(),c=r?r.get(u):void 0;if(l.tagName=c||u,GD(o))a.unshift(o);else for(const[d,f]of Object.entries(o))XD(t,l.properties,d,f)}for(const u of a)Gh(l.children,u);return l.type==="element"&&l.tagName==="template"&&(l.content={type:"root",children:l.children},l.children=[]),l}return i}function GD(t){if(t===null||typeof t!="object"||Array.isArray(t))return!0;if(typeof t.type!="string")return!1;const e=t,n=Object.keys(t);for(const r of n){const i=e[r];if(i&&typeof i=="object"){if(!Array.isArray(i))return!0;const s=i;for(const o of s)if(typeof o!="number"&&typeof o!="string")return!0}}return!!("children"in t&&Array.isArray(t.children))}function XD(t,e,n,r){const i=Im(t,n);let s;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;s=r}else typeof r=="boolean"?s=r:typeof r=="string"?i.spaceSeparated?s=rb(r):i.commaSeparated?s=tb(r):i.commaOrSpaceSeparated?s=rb(tb(r).join(" ")):s=ib(i,i.property,r):Array.isArray(r)?s=[...r]:s=i.property==="style"?QD(r):String(r);if(Array.isArray(s)){const o=[];for(const a of s)o.push(ib(i,i.property,a));s=o}i.property==="className"&&Array.isArray(e.className)&&(s=e.className.concat(s)),e[i.property]=s}}function Gh(t,e){if(e!=null)if(typeof e=="number"||typeof e=="string")t.push({type:"text",value:String(e)});else if(Array.isArray(e))for(const n of e)Gh(t,n);else if(typeof e=="object"&&"type"in e)e.type==="root"?Gh(t,e.children):t.push(e);else throw new Error("Expected node, nodes, or string, got `"+e+"`")}function ib(t,e,n){if(typeof n=="string"){if(t.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((t.boolean||t.overloadedBoolean)&&(n===""||$a(n)===$a(e)))return!0}return n}function QD(t){const e=[];for(const[n,r]of Object.entries(t))e.push([n,r].join(": "));return e.join("; ")}function ZD(t){const e=new Map;for(const n of t)e.set(n.toLowerCase(),n);return e}const JD=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],Qx=Xx(jc,"div"),Zx=Xx(ll,"g",JD);function e5(t){const e=String(t),n=[];return{toOffset:i,toPoint:r};function r(s){if(typeof s=="number"&&s>-1&&s<=e.length){let o=0;for(;;){let a=n[o];if(a===void 0){const l=sb(e,n[o-1]);a=l===-1?e.length+1:l+1,n[o]=a}if(a>s)return{line:o+1,column:s-(o>0?n[o-1]:0)+1,offset:s};o++}}}function i(s){if(s&&typeof s.line=="number"&&typeof s.column=="number"&&!Number.isNaN(s.line)&&!Number.isNaN(s.column)){for(;n.length<s.line;){const a=n[n.length-1],l=sb(e,a),u=l===-1?e.length+1:l+1;if(a===u)break;n.push(u)}const o=(s.line>1?n[s.line-2]:0)+s.column-1;if(o<n[s.line-1])return o}}}function sb(t,e){const n=t.indexOf("\r",e),r=t.indexOf(`
92
+ `,e);return r===-1?n:n===-1||n+1===r?r:n<r?n:r}const mu={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"},Jx={}.hasOwnProperty,t5=Object.prototype;function n5(t,e){const n=e||{};return Rm({file:n.file||void 0,location:!1,schema:n.space==="svg"?ll:jc,verbose:n.verbose||!1},t)}function Rm(t,e){let n;switch(e.nodeName){case"#comment":{const r=e;return n={type:"comment",value:r.data},gu(t,r,n),n}case"#document":case"#document-fragment":{const r=e,i="mode"in r?r.mode==="quirks"||r.mode==="limited-quirks":!1;if(n={type:"root",children:eS(t,e.childNodes),data:{quirksMode:i}},t.file&&t.location){const s=String(t.file),o=e5(s),a=o.toPoint(0),l=o.toPoint(s.length);n.position={start:a,end:l}}return n}case"#documentType":{const r=e;return n={type:"doctype"},gu(t,r,n),n}case"#text":{const r=e;return n={type:"text",value:r.value},gu(t,r,n),n}default:return n=r5(t,e),n}}function eS(t,e){let n=-1;const r=[];for(;++n<e.length;){const i=Rm(t,e[n]);r.push(i)}return r}function r5(t,e){const n=t.schema;t.schema=e.namespaceURI===mu.svg?ll:jc;let r=-1;const i={};for(;++r<e.attrs.length;){const a=e.attrs[r],l=(a.prefix?a.prefix+":":"")+a.name;Jx.call(t5,l)||(i[l]=a.value)}const o=(t.schema.space==="svg"?Zx:Qx)(e.tagName,i,eS(t,e.childNodes));if(gu(t,e,o),o.tagName==="template"){const a=e,l=a.sourceCodeLocation,u=l&&l.startTag&&ws(l.startTag),c=l&&l.endTag&&ws(l.endTag),d=Rm(t,a.content);u&&c&&t.file&&(d.position={start:u.end,end:c.start}),o.content=d}return t.schema=n,o}function gu(t,e,n){if("sourceCodeLocation"in e&&e.sourceCodeLocation&&t.file){const r=i5(t,n,e.sourceCodeLocation);r&&(t.location=!0,n.position=r)}}function i5(t,e,n){const r=ws(n);if(e.type==="element"){const i=e.children[e.children.length-1];if(r&&!n.endTag&&i&&i.position&&i.position.end&&(r.end=Object.assign({},i.position.end)),t.verbose){const s={};let o;if(n.attrs)for(o in n.attrs)Jx.call(n.attrs,o)&&(s[Im(t.schema,o).property]=ws(n.attrs[o]));n.startTag;const a=ws(n.startTag),l=n.endTag?ws(n.endTag):void 0,u={opening:a};l&&(u.closing=l),u.properties=s,e.data={position:u}}}return r}function ws(t){const e=ob({line:t.startLine,column:t.startCol,offset:t.startOffset}),n=ob({line:t.endLine,column:t.endCol,offset:t.endOffset});return e||n?{start:e,end:n}:void 0}function ob(t){return t.line&&t.column?t:void 0}const s5=new Set([65534,65535,131070,131071,196606,196607,262142,262143,327678,327679,393214,393215,458750,458751,524286,524287,589822,589823,655358,655359,720894,720895,786430,786431,851966,851967,917502,917503,983038,983039,1048574,1048575,1114110,1114111]),Ye="�";var S;(function(t){t[t.EOF=-1]="EOF",t[t.NULL=0]="NULL",t[t.TABULATION=9]="TABULATION",t[t.CARRIAGE_RETURN=13]="CARRIAGE_RETURN",t[t.LINE_FEED=10]="LINE_FEED",t[t.FORM_FEED=12]="FORM_FEED",t[t.SPACE=32]="SPACE",t[t.EXCLAMATION_MARK=33]="EXCLAMATION_MARK",t[t.QUOTATION_MARK=34]="QUOTATION_MARK",t[t.AMPERSAND=38]="AMPERSAND",t[t.APOSTROPHE=39]="APOSTROPHE",t[t.HYPHEN_MINUS=45]="HYPHEN_MINUS",t[t.SOLIDUS=47]="SOLIDUS",t[t.DIGIT_0=48]="DIGIT_0",t[t.DIGIT_9=57]="DIGIT_9",t[t.SEMICOLON=59]="SEMICOLON",t[t.LESS_THAN_SIGN=60]="LESS_THAN_SIGN",t[t.EQUALS_SIGN=61]="EQUALS_SIGN",t[t.GREATER_THAN_SIGN=62]="GREATER_THAN_SIGN",t[t.QUESTION_MARK=63]="QUESTION_MARK",t[t.LATIN_CAPITAL_A=65]="LATIN_CAPITAL_A",t[t.LATIN_CAPITAL_Z=90]="LATIN_CAPITAL_Z",t[t.RIGHT_SQUARE_BRACKET=93]="RIGHT_SQUARE_BRACKET",t[t.GRAVE_ACCENT=96]="GRAVE_ACCENT",t[t.LATIN_SMALL_A=97]="LATIN_SMALL_A",t[t.LATIN_SMALL_Z=122]="LATIN_SMALL_Z"})(S||(S={}));const qt={DASH_DASH:"--",CDATA_START:"[CDATA[",DOCTYPE:"doctype",SCRIPT:"script",PUBLIC:"public",SYSTEM:"system"};function tS(t){return t>=55296&&t<=57343}function o5(t){return t>=56320&&t<=57343}function a5(t,e){return(t-55296)*1024+9216+e}function nS(t){return t!==32&&t!==10&&t!==13&&t!==9&&t!==12&&t>=1&&t<=31||t>=127&&t<=159}function rS(t){return t>=64976&&t<=65007||s5.has(t)}var $;(function(t){t.controlCharacterInInputStream="control-character-in-input-stream",t.noncharacterInInputStream="noncharacter-in-input-stream",t.surrogateInInputStream="surrogate-in-input-stream",t.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",t.endTagWithAttributes="end-tag-with-attributes",t.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",t.unexpectedSolidusInTag="unexpected-solidus-in-tag",t.unexpectedNullCharacter="unexpected-null-character",t.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",t.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",t.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",t.missingEndTagName="missing-end-tag-name",t.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",t.unknownNamedCharacterReference="unknown-named-character-reference",t.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",t.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",t.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",t.eofBeforeTagName="eof-before-tag-name",t.eofInTag="eof-in-tag",t.missingAttributeValue="missing-attribute-value",t.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",t.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",t.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",t.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",t.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",t.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",t.missingDoctypePublicIdentifier="missing-doctype-public-identifier",t.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",t.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",t.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",t.cdataInHtmlContent="cdata-in-html-content",t.incorrectlyOpenedComment="incorrectly-opened-comment",t.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",t.eofInDoctype="eof-in-doctype",t.nestedComment="nested-comment",t.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",t.eofInComment="eof-in-comment",t.incorrectlyClosedComment="incorrectly-closed-comment",t.eofInCdata="eof-in-cdata",t.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",t.nullCharacterReference="null-character-reference",t.surrogateCharacterReference="surrogate-character-reference",t.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",t.controlCharacterReference="control-character-reference",t.noncharacterCharacterReference="noncharacter-character-reference",t.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",t.missingDoctypeName="missing-doctype-name",t.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",t.duplicateAttribute="duplicate-attribute",t.nonConformingDoctype="non-conforming-doctype",t.missingDoctype="missing-doctype",t.misplacedDoctype="misplaced-doctype",t.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",t.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",t.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",t.openElementsLeftAfterEof="open-elements-left-after-eof",t.abandonedHeadElementChild="abandoned-head-element-child",t.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",t.nestedNoscriptInHead="nested-noscript-in-head",t.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})($||($={}));const l5=65536;class u5{constructor(e){this.handler=e,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=l5,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(e,n){const{line:r,col:i,offset:s}=this,o=i+n,a=s+n;return{code:e,startLine:r,endLine:r,startCol:o,endCol:o,startOffset:a,endOffset:a}}_err(e){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(e,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(e){if(this.pos!==this.html.length-1){const n=this.html.charCodeAt(this.pos+1);if(o5(n))return this.pos++,this._addGap(),a5(e,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,S.EOF;return this._err($.surrogateInInputStream),e}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(e,n){this.html.length>0?this.html+=e:this.html=e,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(e){this.html=this.html.substring(0,this.pos+1)+e+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(e,n){if(this.pos+e.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(e,this.pos);for(let r=0;r<e.length;r++)if((this.html.charCodeAt(this.pos+r)|32)!==e.charCodeAt(r))return!1;return!0}peek(e){const n=this.pos+e;if(n>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,S.EOF;const r=this.html.charCodeAt(n);return r===S.CARRIAGE_RETURN?S.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,S.EOF;let e=this.html.charCodeAt(this.pos);return e===S.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,S.LINE_FEED):e===S.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,tS(e)&&(e=this._processSurrogate(e)),this.handler.onParseError===null||e>31&&e<127||e===S.LINE_FEED||e===S.CARRIAGE_RETURN||e>159&&e<64976||this._checkForProblematicCharacters(e),e)}_checkForProblematicCharacters(e){nS(e)?this._err($.controlCharacterInInputStream):rS(e)&&this._err($.noncharacterInInputStream)}retreat(e){for(this.pos-=e;this.pos<this.lastGapPos;)this.lastGapPos=this.gapStack.pop(),this.pos--;this.isEol=!1}}var Oe;(function(t){t[t.CHARACTER=0]="CHARACTER",t[t.NULL_CHARACTER=1]="NULL_CHARACTER",t[t.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",t[t.START_TAG=3]="START_TAG",t[t.END_TAG=4]="END_TAG",t[t.COMMENT=5]="COMMENT",t[t.DOCTYPE=6]="DOCTYPE",t[t.EOF=7]="EOF",t[t.HIBERNATION=8]="HIBERNATION"})(Oe||(Oe={}));function iS(t,e){for(let n=t.attrs.length-1;n>=0;n--)if(t.attrs[n].name===e)return t.attrs[n].value;return null}const c5=new Uint16Array('ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻 ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌'.split("").map(t=>t.charCodeAt(0))),d5=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]);function f5(t){var e;return t>=55296&&t<=57343||t>1114111?65533:(e=d5.get(t))!==null&&e!==void 0?e:t}var ht;(function(t){t[t.NUM=35]="NUM",t[t.SEMI=59]="SEMI",t[t.EQUALS=61]="EQUALS",t[t.ZERO=48]="ZERO",t[t.NINE=57]="NINE",t[t.LOWER_A=97]="LOWER_A",t[t.LOWER_F=102]="LOWER_F",t[t.LOWER_X=120]="LOWER_X",t[t.LOWER_Z=122]="LOWER_Z",t[t.UPPER_A=65]="UPPER_A",t[t.UPPER_F=70]="UPPER_F",t[t.UPPER_Z=90]="UPPER_Z"})(ht||(ht={}));const h5=32;var ei;(function(t){t[t.VALUE_LENGTH=49152]="VALUE_LENGTH",t[t.BRANCH_LENGTH=16256]="BRANCH_LENGTH",t[t.JUMP_TABLE=127]="JUMP_TABLE"})(ei||(ei={}));function Xh(t){return t>=ht.ZERO&&t<=ht.NINE}function p5(t){return t>=ht.UPPER_A&&t<=ht.UPPER_F||t>=ht.LOWER_A&&t<=ht.LOWER_F}function m5(t){return t>=ht.UPPER_A&&t<=ht.UPPER_Z||t>=ht.LOWER_A&&t<=ht.LOWER_Z||Xh(t)}function g5(t){return t===ht.EQUALS||m5(t)}var dt;(function(t){t[t.EntityStart=0]="EntityStart",t[t.NumericStart=1]="NumericStart",t[t.NumericDecimal=2]="NumericDecimal",t[t.NumericHex=3]="NumericHex",t[t.NamedEntity=4]="NamedEntity"})(dt||(dt={}));var kr;(function(t){t[t.Legacy=0]="Legacy",t[t.Strict=1]="Strict",t[t.Attribute=2]="Attribute"})(kr||(kr={}));class b5{constructor(e,n,r){this.decodeTree=e,this.emitCodePoint=n,this.errors=r,this.state=dt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=kr.Strict}startEntity(e){this.decodeMode=e,this.state=dt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,n){switch(this.state){case dt.EntityStart:return e.charCodeAt(n)===ht.NUM?(this.state=dt.NumericStart,this.consumed+=1,this.stateNumericStart(e,n+1)):(this.state=dt.NamedEntity,this.stateNamedEntity(e,n));case dt.NumericStart:return this.stateNumericStart(e,n);case dt.NumericDecimal:return this.stateNumericDecimal(e,n);case dt.NumericHex:return this.stateNumericHex(e,n);case dt.NamedEntity:return this.stateNamedEntity(e,n)}}stateNumericStart(e,n){return n>=e.length?-1:(e.charCodeAt(n)|h5)===ht.LOWER_X?(this.state=dt.NumericHex,this.consumed+=1,this.stateNumericHex(e,n+1)):(this.state=dt.NumericDecimal,this.stateNumericDecimal(e,n))}addToNumericResult(e,n,r,i){if(n!==r){const s=r-n;this.result=this.result*Math.pow(i,s)+Number.parseInt(e.substr(n,s),i),this.consumed+=s}}stateNumericHex(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Xh(i)||p5(i))n+=1;else return this.addToNumericResult(e,r,n,16),this.emitNumericEntity(i,3)}return this.addToNumericResult(e,r,n,16),-1}stateNumericDecimal(e,n){const r=n;for(;n<e.length;){const i=e.charCodeAt(n);if(Xh(i))n+=1;else return this.addToNumericResult(e,r,n,10),this.emitNumericEntity(i,2)}return this.addToNumericResult(e,r,n,10),-1}emitNumericEntity(e,n){var r;if(this.consumed<=n)return(r=this.errors)===null||r===void 0||r.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===ht.SEMI)this.consumed+=1;else if(this.decodeMode===kr.Strict)return 0;return this.emitCodePoint(f5(this.result),this.consumed),this.errors&&(e!==ht.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,n){const{decodeTree:r}=this;let i=r[this.treeIndex],s=(i&ei.VALUE_LENGTH)>>14;for(;n<e.length;n++,this.excess++){const o=e.charCodeAt(n);if(this.treeIndex=y5(r,i,this.treeIndex+Math.max(1,s),o),this.treeIndex<0)return this.result===0||this.decodeMode===kr.Attribute&&(s===0||g5(o))?0:this.emitNotTerminatedNamedEntity();if(i=r[this.treeIndex],s=(i&ei.VALUE_LENGTH)>>14,s!==0){if(o===ht.SEMI)return this.emitNamedEntityData(this.treeIndex,s,this.consumed+this.excess);this.decodeMode!==kr.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;const{result:n,decodeTree:r}=this,i=(r[n]&ei.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(e=this.errors)===null||e===void 0||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,n,r){const{decodeTree:i}=this;return this.emitCodePoint(n===1?i[e]&~ei.VALUE_LENGTH:i[e+1],r),n===3&&this.emitCodePoint(i[e+2],r),r}end(){var e;switch(this.state){case dt.NamedEntity:return this.result!==0&&(this.decodeMode!==kr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case dt.NumericDecimal:return this.emitNumericEntity(0,2);case dt.NumericHex:return this.emitNumericEntity(0,3);case dt.NumericStart:return(e=this.errors)===null||e===void 0||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case dt.EntityStart:return 0}}}function y5(t,e,n,r){const i=(e&ei.BRANCH_LENGTH)>>7,s=e&ei.JUMP_TABLE;if(i===0)return s!==0&&r===s?n:-1;if(s){const l=r-s;return l<0||l>=i?-1:t[n+l]-1}let o=n,a=o+i-1;for(;o<=a;){const l=o+a>>>1,u=t[l];if(u<r)o=l+1;else if(u>r)a=l-1;else return t[l+i]}return-1}var K;(function(t){t.HTML="http://www.w3.org/1999/xhtml",t.MATHML="http://www.w3.org/1998/Math/MathML",t.SVG="http://www.w3.org/2000/svg",t.XLINK="http://www.w3.org/1999/xlink",t.XML="http://www.w3.org/XML/1998/namespace",t.XMLNS="http://www.w3.org/2000/xmlns/"})(K||(K={}));var Fi;(function(t){t.TYPE="type",t.ACTION="action",t.ENCODING="encoding",t.PROMPT="prompt",t.NAME="name",t.COLOR="color",t.FACE="face",t.SIZE="size"})(Fi||(Fi={}));var kn;(function(t){t.NO_QUIRKS="no-quirks",t.QUIRKS="quirks",t.LIMITED_QUIRKS="limited-quirks"})(kn||(kn={}));var L;(function(t){t.A="a",t.ADDRESS="address",t.ANNOTATION_XML="annotation-xml",t.APPLET="applet",t.AREA="area",t.ARTICLE="article",t.ASIDE="aside",t.B="b",t.BASE="base",t.BASEFONT="basefont",t.BGSOUND="bgsound",t.BIG="big",t.BLOCKQUOTE="blockquote",t.BODY="body",t.BR="br",t.BUTTON="button",t.CAPTION="caption",t.CENTER="center",t.CODE="code",t.COL="col",t.COLGROUP="colgroup",t.DD="dd",t.DESC="desc",t.DETAILS="details",t.DIALOG="dialog",t.DIR="dir",t.DIV="div",t.DL="dl",t.DT="dt",t.EM="em",t.EMBED="embed",t.FIELDSET="fieldset",t.FIGCAPTION="figcaption",t.FIGURE="figure",t.FONT="font",t.FOOTER="footer",t.FOREIGN_OBJECT="foreignObject",t.FORM="form",t.FRAME="frame",t.FRAMESET="frameset",t.H1="h1",t.H2="h2",t.H3="h3",t.H4="h4",t.H5="h5",t.H6="h6",t.HEAD="head",t.HEADER="header",t.HGROUP="hgroup",t.HR="hr",t.HTML="html",t.I="i",t.IMG="img",t.IMAGE="image",t.INPUT="input",t.IFRAME="iframe",t.KEYGEN="keygen",t.LABEL="label",t.LI="li",t.LINK="link",t.LISTING="listing",t.MAIN="main",t.MALIGNMARK="malignmark",t.MARQUEE="marquee",t.MATH="math",t.MENU="menu",t.META="meta",t.MGLYPH="mglyph",t.MI="mi",t.MO="mo",t.MN="mn",t.MS="ms",t.MTEXT="mtext",t.NAV="nav",t.NOBR="nobr",t.NOFRAMES="noframes",t.NOEMBED="noembed",t.NOSCRIPT="noscript",t.OBJECT="object",t.OL="ol",t.OPTGROUP="optgroup",t.OPTION="option",t.P="p",t.PARAM="param",t.PLAINTEXT="plaintext",t.PRE="pre",t.RB="rb",t.RP="rp",t.RT="rt",t.RTC="rtc",t.RUBY="ruby",t.S="s",t.SCRIPT="script",t.SEARCH="search",t.SECTION="section",t.SELECT="select",t.SOURCE="source",t.SMALL="small",t.SPAN="span",t.STRIKE="strike",t.STRONG="strong",t.STYLE="style",t.SUB="sub",t.SUMMARY="summary",t.SUP="sup",t.TABLE="table",t.TBODY="tbody",t.TEMPLATE="template",t.TEXTAREA="textarea",t.TFOOT="tfoot",t.TD="td",t.TH="th",t.THEAD="thead",t.TITLE="title",t.TR="tr",t.TRACK="track",t.TT="tt",t.U="u",t.UL="ul",t.SVG="svg",t.VAR="var",t.WBR="wbr",t.XMP="xmp"})(L||(L={}));var m;(function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.A=1]="A",t[t.ADDRESS=2]="ADDRESS",t[t.ANNOTATION_XML=3]="ANNOTATION_XML",t[t.APPLET=4]="APPLET",t[t.AREA=5]="AREA",t[t.ARTICLE=6]="ARTICLE",t[t.ASIDE=7]="ASIDE",t[t.B=8]="B",t[t.BASE=9]="BASE",t[t.BASEFONT=10]="BASEFONT",t[t.BGSOUND=11]="BGSOUND",t[t.BIG=12]="BIG",t[t.BLOCKQUOTE=13]="BLOCKQUOTE",t[t.BODY=14]="BODY",t[t.BR=15]="BR",t[t.BUTTON=16]="BUTTON",t[t.CAPTION=17]="CAPTION",t[t.CENTER=18]="CENTER",t[t.CODE=19]="CODE",t[t.COL=20]="COL",t[t.COLGROUP=21]="COLGROUP",t[t.DD=22]="DD",t[t.DESC=23]="DESC",t[t.DETAILS=24]="DETAILS",t[t.DIALOG=25]="DIALOG",t[t.DIR=26]="DIR",t[t.DIV=27]="DIV",t[t.DL=28]="DL",t[t.DT=29]="DT",t[t.EM=30]="EM",t[t.EMBED=31]="EMBED",t[t.FIELDSET=32]="FIELDSET",t[t.FIGCAPTION=33]="FIGCAPTION",t[t.FIGURE=34]="FIGURE",t[t.FONT=35]="FONT",t[t.FOOTER=36]="FOOTER",t[t.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",t[t.FORM=38]="FORM",t[t.FRAME=39]="FRAME",t[t.FRAMESET=40]="FRAMESET",t[t.H1=41]="H1",t[t.H2=42]="H2",t[t.H3=43]="H3",t[t.H4=44]="H4",t[t.H5=45]="H5",t[t.H6=46]="H6",t[t.HEAD=47]="HEAD",t[t.HEADER=48]="HEADER",t[t.HGROUP=49]="HGROUP",t[t.HR=50]="HR",t[t.HTML=51]="HTML",t[t.I=52]="I",t[t.IMG=53]="IMG",t[t.IMAGE=54]="IMAGE",t[t.INPUT=55]="INPUT",t[t.IFRAME=56]="IFRAME",t[t.KEYGEN=57]="KEYGEN",t[t.LABEL=58]="LABEL",t[t.LI=59]="LI",t[t.LINK=60]="LINK",t[t.LISTING=61]="LISTING",t[t.MAIN=62]="MAIN",t[t.MALIGNMARK=63]="MALIGNMARK",t[t.MARQUEE=64]="MARQUEE",t[t.MATH=65]="MATH",t[t.MENU=66]="MENU",t[t.META=67]="META",t[t.MGLYPH=68]="MGLYPH",t[t.MI=69]="MI",t[t.MO=70]="MO",t[t.MN=71]="MN",t[t.MS=72]="MS",t[t.MTEXT=73]="MTEXT",t[t.NAV=74]="NAV",t[t.NOBR=75]="NOBR",t[t.NOFRAMES=76]="NOFRAMES",t[t.NOEMBED=77]="NOEMBED",t[t.NOSCRIPT=78]="NOSCRIPT",t[t.OBJECT=79]="OBJECT",t[t.OL=80]="OL",t[t.OPTGROUP=81]="OPTGROUP",t[t.OPTION=82]="OPTION",t[t.P=83]="P",t[t.PARAM=84]="PARAM",t[t.PLAINTEXT=85]="PLAINTEXT",t[t.PRE=86]="PRE",t[t.RB=87]="RB",t[t.RP=88]="RP",t[t.RT=89]="RT",t[t.RTC=90]="RTC",t[t.RUBY=91]="RUBY",t[t.S=92]="S",t[t.SCRIPT=93]="SCRIPT",t[t.SEARCH=94]="SEARCH",t[t.SECTION=95]="SECTION",t[t.SELECT=96]="SELECT",t[t.SOURCE=97]="SOURCE",t[t.SMALL=98]="SMALL",t[t.SPAN=99]="SPAN",t[t.STRIKE=100]="STRIKE",t[t.STRONG=101]="STRONG",t[t.STYLE=102]="STYLE",t[t.SUB=103]="SUB",t[t.SUMMARY=104]="SUMMARY",t[t.SUP=105]="SUP",t[t.TABLE=106]="TABLE",t[t.TBODY=107]="TBODY",t[t.TEMPLATE=108]="TEMPLATE",t[t.TEXTAREA=109]="TEXTAREA",t[t.TFOOT=110]="TFOOT",t[t.TD=111]="TD",t[t.TH=112]="TH",t[t.THEAD=113]="THEAD",t[t.TITLE=114]="TITLE",t[t.TR=115]="TR",t[t.TRACK=116]="TRACK",t[t.TT=117]="TT",t[t.U=118]="U",t[t.UL=119]="UL",t[t.SVG=120]="SVG",t[t.VAR=121]="VAR",t[t.WBR=122]="WBR",t[t.XMP=123]="XMP"})(m||(m={}));const E5=new Map([[L.A,m.A],[L.ADDRESS,m.ADDRESS],[L.ANNOTATION_XML,m.ANNOTATION_XML],[L.APPLET,m.APPLET],[L.AREA,m.AREA],[L.ARTICLE,m.ARTICLE],[L.ASIDE,m.ASIDE],[L.B,m.B],[L.BASE,m.BASE],[L.BASEFONT,m.BASEFONT],[L.BGSOUND,m.BGSOUND],[L.BIG,m.BIG],[L.BLOCKQUOTE,m.BLOCKQUOTE],[L.BODY,m.BODY],[L.BR,m.BR],[L.BUTTON,m.BUTTON],[L.CAPTION,m.CAPTION],[L.CENTER,m.CENTER],[L.CODE,m.CODE],[L.COL,m.COL],[L.COLGROUP,m.COLGROUP],[L.DD,m.DD],[L.DESC,m.DESC],[L.DETAILS,m.DETAILS],[L.DIALOG,m.DIALOG],[L.DIR,m.DIR],[L.DIV,m.DIV],[L.DL,m.DL],[L.DT,m.DT],[L.EM,m.EM],[L.EMBED,m.EMBED],[L.FIELDSET,m.FIELDSET],[L.FIGCAPTION,m.FIGCAPTION],[L.FIGURE,m.FIGURE],[L.FONT,m.FONT],[L.FOOTER,m.FOOTER],[L.FOREIGN_OBJECT,m.FOREIGN_OBJECT],[L.FORM,m.FORM],[L.FRAME,m.FRAME],[L.FRAMESET,m.FRAMESET],[L.H1,m.H1],[L.H2,m.H2],[L.H3,m.H3],[L.H4,m.H4],[L.H5,m.H5],[L.H6,m.H6],[L.HEAD,m.HEAD],[L.HEADER,m.HEADER],[L.HGROUP,m.HGROUP],[L.HR,m.HR],[L.HTML,m.HTML],[L.I,m.I],[L.IMG,m.IMG],[L.IMAGE,m.IMAGE],[L.INPUT,m.INPUT],[L.IFRAME,m.IFRAME],[L.KEYGEN,m.KEYGEN],[L.LABEL,m.LABEL],[L.LI,m.LI],[L.LINK,m.LINK],[L.LISTING,m.LISTING],[L.MAIN,m.MAIN],[L.MALIGNMARK,m.MALIGNMARK],[L.MARQUEE,m.MARQUEE],[L.MATH,m.MATH],[L.MENU,m.MENU],[L.META,m.META],[L.MGLYPH,m.MGLYPH],[L.MI,m.MI],[L.MO,m.MO],[L.MN,m.MN],[L.MS,m.MS],[L.MTEXT,m.MTEXT],[L.NAV,m.NAV],[L.NOBR,m.NOBR],[L.NOFRAMES,m.NOFRAMES],[L.NOEMBED,m.NOEMBED],[L.NOSCRIPT,m.NOSCRIPT],[L.OBJECT,m.OBJECT],[L.OL,m.OL],[L.OPTGROUP,m.OPTGROUP],[L.OPTION,m.OPTION],[L.P,m.P],[L.PARAM,m.PARAM],[L.PLAINTEXT,m.PLAINTEXT],[L.PRE,m.PRE],[L.RB,m.RB],[L.RP,m.RP],[L.RT,m.RT],[L.RTC,m.RTC],[L.RUBY,m.RUBY],[L.S,m.S],[L.SCRIPT,m.SCRIPT],[L.SEARCH,m.SEARCH],[L.SECTION,m.SECTION],[L.SELECT,m.SELECT],[L.SOURCE,m.SOURCE],[L.SMALL,m.SMALL],[L.SPAN,m.SPAN],[L.STRIKE,m.STRIKE],[L.STRONG,m.STRONG],[L.STYLE,m.STYLE],[L.SUB,m.SUB],[L.SUMMARY,m.SUMMARY],[L.SUP,m.SUP],[L.TABLE,m.TABLE],[L.TBODY,m.TBODY],[L.TEMPLATE,m.TEMPLATE],[L.TEXTAREA,m.TEXTAREA],[L.TFOOT,m.TFOOT],[L.TD,m.TD],[L.TH,m.TH],[L.THEAD,m.THEAD],[L.TITLE,m.TITLE],[L.TR,m.TR],[L.TRACK,m.TRACK],[L.TT,m.TT],[L.U,m.U],[L.UL,m.UL],[L.SVG,m.SVG],[L.VAR,m.VAR],[L.WBR,m.WBR],[L.XMP,m.XMP]]);function Wc(t){var e;return(e=E5.get(t))!==null&&e!==void 0?e:m.UNKNOWN}const Q=m,T5={[K.HTML]:new Set([Q.ADDRESS,Q.APPLET,Q.AREA,Q.ARTICLE,Q.ASIDE,Q.BASE,Q.BASEFONT,Q.BGSOUND,Q.BLOCKQUOTE,Q.BODY,Q.BR,Q.BUTTON,Q.CAPTION,Q.CENTER,Q.COL,Q.COLGROUP,Q.DD,Q.DETAILS,Q.DIR,Q.DIV,Q.DL,Q.DT,Q.EMBED,Q.FIELDSET,Q.FIGCAPTION,Q.FIGURE,Q.FOOTER,Q.FORM,Q.FRAME,Q.FRAMESET,Q.H1,Q.H2,Q.H3,Q.H4,Q.H5,Q.H6,Q.HEAD,Q.HEADER,Q.HGROUP,Q.HR,Q.HTML,Q.IFRAME,Q.IMG,Q.INPUT,Q.LI,Q.LINK,Q.LISTING,Q.MAIN,Q.MARQUEE,Q.MENU,Q.META,Q.NAV,Q.NOEMBED,Q.NOFRAMES,Q.NOSCRIPT,Q.OBJECT,Q.OL,Q.P,Q.PARAM,Q.PLAINTEXT,Q.PRE,Q.SCRIPT,Q.SECTION,Q.SELECT,Q.SOURCE,Q.STYLE,Q.SUMMARY,Q.TABLE,Q.TBODY,Q.TD,Q.TEMPLATE,Q.TEXTAREA,Q.TFOOT,Q.TH,Q.THEAD,Q.TITLE,Q.TR,Q.TRACK,Q.UL,Q.WBR,Q.XMP]),[K.MATHML]:new Set([Q.MI,Q.MO,Q.MN,Q.MS,Q.MTEXT,Q.ANNOTATION_XML]),[K.SVG]:new Set([Q.TITLE,Q.FOREIGN_OBJECT,Q.DESC]),[K.XLINK]:new Set,[K.XML]:new Set,[K.XMLNS]:new Set},Qh=new Set([Q.H1,Q.H2,Q.H3,Q.H4,Q.H5,Q.H6]);L.STYLE,L.SCRIPT,L.XMP,L.IFRAME,L.NOEMBED,L.NOFRAMES,L.PLAINTEXT;var k;(function(t){t[t.DATA=0]="DATA",t[t.RCDATA=1]="RCDATA",t[t.RAWTEXT=2]="RAWTEXT",t[t.SCRIPT_DATA=3]="SCRIPT_DATA",t[t.PLAINTEXT=4]="PLAINTEXT",t[t.TAG_OPEN=5]="TAG_OPEN",t[t.END_TAG_OPEN=6]="END_TAG_OPEN",t[t.TAG_NAME=7]="TAG_NAME",t[t.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",t[t.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",t[t.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",t[t.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",t[t.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",t[t.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",t[t.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",t[t.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",t[t.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",t[t.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",t[t.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",t[t.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",t[t.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",t[t.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",t[t.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",t[t.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",t[t.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",t[t.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",t[t.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",t[t.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",t[t.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",t[t.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",t[t.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",t[t.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",t[t.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",t[t.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",t[t.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",t[t.BOGUS_COMMENT=40]="BOGUS_COMMENT",t[t.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",t[t.COMMENT_START=42]="COMMENT_START",t[t.COMMENT_START_DASH=43]="COMMENT_START_DASH",t[t.COMMENT=44]="COMMENT",t[t.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",t[t.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",t[t.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",t[t.COMMENT_END_DASH=49]="COMMENT_END_DASH",t[t.COMMENT_END=50]="COMMENT_END",t[t.COMMENT_END_BANG=51]="COMMENT_END_BANG",t[t.DOCTYPE=52]="DOCTYPE",t[t.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",t[t.DOCTYPE_NAME=54]="DOCTYPE_NAME",t[t.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",t[t.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",t[t.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",t[t.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",t[t.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",t[t.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",t[t.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",t[t.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",t[t.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",t[t.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",t[t.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",t[t.CDATA_SECTION=68]="CDATA_SECTION",t[t.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",t[t.CDATA_SECTION_END=70]="CDATA_SECTION_END",t[t.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",t[t.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(k||(k={}));const Zt={DATA:k.DATA,RCDATA:k.RCDATA,RAWTEXT:k.RAWTEXT,SCRIPT_DATA:k.SCRIPT_DATA,PLAINTEXT:k.PLAINTEXT,CDATA_SECTION:k.CDATA_SECTION};function C5(t){return t>=S.DIGIT_0&&t<=S.DIGIT_9}function Qo(t){return t>=S.LATIN_CAPITAL_A&&t<=S.LATIN_CAPITAL_Z}function x5(t){return t>=S.LATIN_SMALL_A&&t<=S.LATIN_SMALL_Z}function zr(t){return x5(t)||Qo(t)}function ab(t){return zr(t)||C5(t)}function Fl(t){return t+32}function sS(t){return t===S.SPACE||t===S.LINE_FEED||t===S.TABULATION||t===S.FORM_FEED}function lb(t){return sS(t)||t===S.SOLIDUS||t===S.GREATER_THAN_SIGN}function S5(t){return t===S.NULL?$.nullCharacterReference:t>1114111?$.characterReferenceOutsideUnicodeRange:tS(t)?$.surrogateCharacterReference:rS(t)?$.noncharacterCharacterReference:nS(t)||t===S.CARRIAGE_RETURN?$.controlCharacterReference:null}class w5{constructor(e,n){this.options=e,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=k.DATA,this.returnState=k.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new u5(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new b5(c5,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err($.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err($.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{const i=S5(r);i&&this._err(i,1)}}:void 0)}_err(e,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(e,n))}getCurrentLocation(e){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-e,startOffset:this.preprocessor.offset-e,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;const e=this._consume();this._ensureHibernation()||this._callState(e)}this.inLoop=!1}}pause(){this.paused=!0}resume(e){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||e?.())}write(e,n,r){this.active=!0,this.preprocessor.write(e,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(e){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(e),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(e){this.consumedAfterSnapshot+=e;for(let n=0;n<e;n++)this.preprocessor.advance()}_consumeSequenceIfMatch(e,n){return this.preprocessor.startsWith(e,n)?(this._advanceBy(e.length-1),!0):!1}_createStartTagToken(){this.currentToken={type:Oe.START_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(1)}}_createEndTagToken(){this.currentToken={type:Oe.END_TAG,tagName:"",tagID:m.UNKNOWN,selfClosing:!1,ackSelfClosing:!1,attrs:[],location:this.getCurrentLocation(2)}}_createCommentToken(e){this.currentToken={type:Oe.COMMENT,data:"",location:this.getCurrentLocation(e)}}_createDoctypeToken(e){this.currentToken={type:Oe.DOCTYPE,name:e,forceQuirks:!1,publicId:null,systemId:null,location:this.currentLocation}}_createCharacterToken(e,n){this.currentCharacterToken={type:e,chars:n,location:this.currentLocation}}_createAttr(e){this.currentAttr={name:e,value:""},this.currentLocation=this.getCurrentLocation(0)}_leaveAttrName(){var e,n;const r=this.currentToken;if(iS(r,this.currentAttr.name)===null){if(r.attrs.push(this.currentAttr),r.location&&this.currentLocation){const i=(e=(n=r.location).attrs)!==null&&e!==void 0?e:n.attrs=Object.create(null);i[this.currentAttr.name]=this.currentLocation,this._leaveAttrValue()}}else this._err($.duplicateAttribute)}_leaveAttrValue(){this.currentLocation&&(this.currentLocation.endLine=this.preprocessor.line,this.currentLocation.endCol=this.preprocessor.col,this.currentLocation.endOffset=this.preprocessor.offset)}prepareToken(e){this._emitCurrentCharacterToken(e.location),this.currentToken=null,e.location&&(e.location.endLine=this.preprocessor.line,e.location.endCol=this.preprocessor.col+1,e.location.endOffset=this.preprocessor.offset+1),this.currentLocation=this.getCurrentLocation(-1)}emitCurrentTagToken(){const e=this.currentToken;this.prepareToken(e),e.tagID=Wc(e.tagName),e.type===Oe.START_TAG?(this.lastStartTagName=e.tagName,this.handler.onStartTag(e)):(e.attrs.length>0&&this._err($.endTagWithAttributes),e.selfClosing&&this._err($.endTagWithTrailingSolidus),this.handler.onEndTag(e)),this.preprocessor.dropParsedChunk()}emitCurrentComment(e){this.prepareToken(e),this.handler.onComment(e),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(e){this.prepareToken(e),this.handler.onDoctype(e),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(e){if(this.currentCharacterToken){switch(e&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=e.startLine,this.currentCharacterToken.location.endCol=e.startCol,this.currentCharacterToken.location.endOffset=e.startOffset),this.currentCharacterToken.type){case Oe.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Oe.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Oe.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){const e=this.getCurrentLocation(0);e&&(e.endLine=e.startLine,e.endCol=e.startCol,e.endOffset=e.startOffset),this._emitCurrentCharacterToken(e),this.handler.onEof({type:Oe.EOF,location:e}),this.active=!1}_appendCharToCurrentCharacterToken(e,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===e){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(e,n)}_emitCodePoint(e){const n=sS(e)?Oe.WHITESPACE_CHARACTER:e===S.NULL?Oe.NULL_CHARACTER:Oe.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(e))}_emitChars(e){this._appendCharToCurrentCharacterToken(Oe.CHARACTER,e)}_startCharacterReference(){this.returnState=this.state,this.state=k.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?kr.Attribute:kr.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===k.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===k.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===k.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(e){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(e):this._emitCodePoint(e)}_callState(e){switch(this.state){case k.DATA:{this._stateData(e);break}case k.RCDATA:{this._stateRcdata(e);break}case k.RAWTEXT:{this._stateRawtext(e);break}case k.SCRIPT_DATA:{this._stateScriptData(e);break}case k.PLAINTEXT:{this._statePlaintext(e);break}case k.TAG_OPEN:{this._stateTagOpen(e);break}case k.END_TAG_OPEN:{this._stateEndTagOpen(e);break}case k.TAG_NAME:{this._stateTagName(e);break}case k.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(e);break}case k.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(e);break}case k.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(e);break}case k.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(e);break}case k.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(e);break}case k.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(e);break}case k.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(e);break}case k.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(e);break}case k.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(e);break}case k.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(e);break}case k.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(e);break}case k.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(e);break}case k.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(e);break}case k.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(e);break}case k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(e);break}case k.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(e);break}case k.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(e);break}case k.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(e);break}case k.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(e);break}case k.ATTRIBUTE_NAME:{this._stateAttributeName(e);break}case k.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(e);break}case k.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(e);break}case k.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(e);break}case k.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(e);break}case k.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(e);break}case k.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(e);break}case k.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(e);break}case k.BOGUS_COMMENT:{this._stateBogusComment(e);break}case k.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(e);break}case k.COMMENT_START:{this._stateCommentStart(e);break}case k.COMMENT_START_DASH:{this._stateCommentStartDash(e);break}case k.COMMENT:{this._stateComment(e);break}case k.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(e);break}case k.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(e);break}case k.COMMENT_END_DASH:{this._stateCommentEndDash(e);break}case k.COMMENT_END:{this._stateCommentEnd(e);break}case k.COMMENT_END_BANG:{this._stateCommentEndBang(e);break}case k.DOCTYPE:{this._stateDoctype(e);break}case k.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(e);break}case k.DOCTYPE_NAME:{this._stateDoctypeName(e);break}case k.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(e);break}case k.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(e);break}case k.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(e);break}case k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(e);break}case k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(e);break}case k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(e);break}case k.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(e);break}case k.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(e);break}case k.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(e);break}case k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(e);break}case k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(e);break}case k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(e);break}case k.BOGUS_DOCTYPE:{this._stateBogusDoctype(e);break}case k.CDATA_SECTION:{this._stateCdataSection(e);break}case k.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(e);break}case k.CDATA_SECTION_END:{this._stateCdataSectionEnd(e);break}case k.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case k.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(e);break}default:throw new Error("Unknown state")}}_stateData(e){switch(e){case S.LESS_THAN_SIGN:{this.state=k.TAG_OPEN;break}case S.AMPERSAND:{this._startCharacterReference();break}case S.NULL:{this._err($.unexpectedNullCharacter),this._emitCodePoint(e);break}case S.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRcdata(e){switch(e){case S.AMPERSAND:{this._startCharacterReference();break}case S.LESS_THAN_SIGN:{this.state=k.RCDATA_LESS_THAN_SIGN;break}case S.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(Ye);break}case S.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateRawtext(e){switch(e){case S.LESS_THAN_SIGN:{this.state=k.RAWTEXT_LESS_THAN_SIGN;break}case S.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(Ye);break}case S.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptData(e){switch(e){case S.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_LESS_THAN_SIGN;break}case S.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(Ye);break}case S.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_statePlaintext(e){switch(e){case S.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(Ye);break}case S.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateTagOpen(e){if(zr(e))this._createStartTagToken(),this.state=k.TAG_NAME,this._stateTagName(e);else switch(e){case S.EXCLAMATION_MARK:{this.state=k.MARKUP_DECLARATION_OPEN;break}case S.SOLIDUS:{this.state=k.END_TAG_OPEN;break}case S.QUESTION_MARK:{this._err($.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e);break}case S.EOF:{this._err($.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err($.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=k.DATA,this._stateData(e)}}_stateEndTagOpen(e){if(zr(e))this._createEndTagToken(),this.state=k.TAG_NAME,this._stateTagName(e);else switch(e){case S.GREATER_THAN_SIGN:{this._err($.missingEndTagName),this.state=k.DATA;break}case S.EOF:{this._err($.eofBeforeTagName),this._emitChars("</"),this._emitEOFToken();break}default:this._err($.invalidFirstCharacterOfTagName),this._createCommentToken(2),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e)}}_stateTagName(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:{this.state=k.BEFORE_ATTRIBUTE_NAME;break}case S.SOLIDUS:{this.state=k.SELF_CLOSING_START_TAG;break}case S.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentTagToken();break}case S.NULL:{this._err($.unexpectedNullCharacter),n.tagName+=Ye;break}case S.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:n.tagName+=String.fromCodePoint(Qo(e)?Fl(e):e)}}_stateRcdataLessThanSign(e){e===S.SOLIDUS?this.state=k.RCDATA_END_TAG_OPEN:(this._emitChars("<"),this.state=k.RCDATA,this._stateRcdata(e))}_stateRcdataEndTagOpen(e){zr(e)?(this.state=k.RCDATA_END_TAG_NAME,this._stateRcdataEndTagName(e)):(this._emitChars("</"),this.state=k.RCDATA,this._stateRcdata(e))}handleSpecialEndTag(e){if(!this.preprocessor.startsWith(this.lastStartTagName,!1))return!this._ensureHibernation();this._createEndTagToken();const n=this.currentToken;switch(n.tagName=this.lastStartTagName,this.preprocessor.peek(this.lastStartTagName.length)){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:return this._advanceBy(this.lastStartTagName.length),this.state=k.BEFORE_ATTRIBUTE_NAME,!1;case S.SOLIDUS:return this._advanceBy(this.lastStartTagName.length),this.state=k.SELF_CLOSING_START_TAG,!1;case S.GREATER_THAN_SIGN:return this._advanceBy(this.lastStartTagName.length),this.emitCurrentTagToken(),this.state=k.DATA,!1;default:return!this._ensureHibernation()}}_stateRcdataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.RCDATA,this._stateRcdata(e))}_stateRawtextLessThanSign(e){e===S.SOLIDUS?this.state=k.RAWTEXT_END_TAG_OPEN:(this._emitChars("<"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagOpen(e){zr(e)?(this.state=k.RAWTEXT_END_TAG_NAME,this._stateRawtextEndTagName(e)):(this._emitChars("</"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateRawtextEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.RAWTEXT,this._stateRawtext(e))}_stateScriptDataLessThanSign(e){switch(e){case S.SOLIDUS:{this.state=k.SCRIPT_DATA_END_TAG_OPEN;break}case S.EXCLAMATION_MARK:{this.state=k.SCRIPT_DATA_ESCAPE_START,this._emitChars("<!");break}default:this._emitChars("<"),this.state=k.SCRIPT_DATA,this._stateScriptData(e)}}_stateScriptDataEndTagOpen(e){zr(e)?(this.state=k.SCRIPT_DATA_END_TAG_NAME,this._stateScriptDataEndTagName(e)):(this._emitChars("</"),this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStart(e){e===S.HYPHEN_MINUS?(this.state=k.SCRIPT_DATA_ESCAPE_START_DASH,this._emitChars("-")):(this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscapeStartDash(e){e===S.HYPHEN_MINUS?(this.state=k.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-")):(this.state=k.SCRIPT_DATA,this._stateScriptData(e))}_stateScriptDataEscaped(e){switch(e){case S.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_ESCAPED_DASH,this._emitChars("-");break}case S.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case S.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(Ye);break}case S.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataEscapedDash(e){switch(e){case S.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_ESCAPED_DASH_DASH,this._emitChars("-");break}case S.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case S.NULL:{this._err($.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_ESCAPED,this._emitChars(Ye);break}case S.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedDashDash(e){switch(e){case S.HYPHEN_MINUS:{this._emitChars("-");break}case S.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;break}case S.GREATER_THAN_SIGN:{this.state=k.SCRIPT_DATA,this._emitChars(">");break}case S.NULL:{this._err($.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_ESCAPED,this._emitChars(Ye);break}case S.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataEscapedLessThanSign(e){e===S.SOLIDUS?this.state=k.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:zr(e)?(this._emitChars("<"),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(e)):(this._emitChars("<"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagOpen(e){zr(e)?(this.state=k.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(e)):(this._emitChars("</"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataEscapedEndTagName(e){this.handleSpecialEndTag(e)&&(this._emitChars("</"),this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscapeStart(e){if(this.preprocessor.startsWith(qt.SCRIPT,!1)&&lb(this.preprocessor.peek(qt.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<qt.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED}else this._ensureHibernation()||(this.state=k.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(e))}_stateScriptDataDoubleEscaped(e){switch(e){case S.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH,this._emitChars("-");break}case S.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case S.NULL:{this._err($.unexpectedNullCharacter),this._emitChars(Ye);break}case S.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDash(e){switch(e){case S.HYPHEN_MINUS:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH,this._emitChars("-");break}case S.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case S.NULL:{this._err($.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ye);break}case S.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedDashDash(e){switch(e){case S.HYPHEN_MINUS:{this._emitChars("-");break}case S.LESS_THAN_SIGN:{this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN,this._emitChars("<");break}case S.GREATER_THAN_SIGN:{this.state=k.SCRIPT_DATA,this._emitChars(">");break}case S.NULL:{this._err($.unexpectedNullCharacter),this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Ye);break}case S.EOF:{this._err($.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(e)}}_stateScriptDataDoubleEscapedLessThanSign(e){e===S.SOLIDUS?(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateScriptDataDoubleEscapeEnd(e){if(this.preprocessor.startsWith(qt.SCRIPT,!1)&&lb(this.preprocessor.peek(qt.SCRIPT.length))){this._emitCodePoint(e);for(let n=0;n<qt.SCRIPT.length;n++)this._emitCodePoint(this._consume());this.state=k.SCRIPT_DATA_ESCAPED}else this._ensureHibernation()||(this.state=k.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(e))}_stateBeforeAttributeName(e){switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.SOLIDUS:case S.GREATER_THAN_SIGN:case S.EOF:{this.state=k.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case S.EQUALS_SIGN:{this._err($.unexpectedEqualsSignBeforeAttributeName),this._createAttr("="),this.state=k.ATTRIBUTE_NAME;break}default:this._createAttr(""),this.state=k.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateAttributeName(e){switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:case S.SOLIDUS:case S.GREATER_THAN_SIGN:case S.EOF:{this._leaveAttrName(),this.state=k.AFTER_ATTRIBUTE_NAME,this._stateAfterAttributeName(e);break}case S.EQUALS_SIGN:{this._leaveAttrName(),this.state=k.BEFORE_ATTRIBUTE_VALUE;break}case S.QUOTATION_MARK:case S.APOSTROPHE:case S.LESS_THAN_SIGN:{this._err($.unexpectedCharacterInAttributeName),this.currentAttr.name+=String.fromCodePoint(e);break}case S.NULL:{this._err($.unexpectedNullCharacter),this.currentAttr.name+=Ye;break}default:this.currentAttr.name+=String.fromCodePoint(Qo(e)?Fl(e):e)}}_stateAfterAttributeName(e){switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.SOLIDUS:{this.state=k.SELF_CLOSING_START_TAG;break}case S.EQUALS_SIGN:{this.state=k.BEFORE_ATTRIBUTE_VALUE;break}case S.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentTagToken();break}case S.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this._createAttr(""),this.state=k.ATTRIBUTE_NAME,this._stateAttributeName(e)}}_stateBeforeAttributeValue(e){switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.QUOTATION_MARK:{this.state=k.ATTRIBUTE_VALUE_DOUBLE_QUOTED;break}case S.APOSTROPHE:{this.state=k.ATTRIBUTE_VALUE_SINGLE_QUOTED;break}case S.GREATER_THAN_SIGN:{this._err($.missingAttributeValue),this.state=k.DATA,this.emitCurrentTagToken();break}default:this.state=k.ATTRIBUTE_VALUE_UNQUOTED,this._stateAttributeValueUnquoted(e)}}_stateAttributeValueDoubleQuoted(e){switch(e){case S.QUOTATION_MARK:{this.state=k.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case S.AMPERSAND:{this._startCharacterReference();break}case S.NULL:{this._err($.unexpectedNullCharacter),this.currentAttr.value+=Ye;break}case S.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueSingleQuoted(e){switch(e){case S.APOSTROPHE:{this.state=k.AFTER_ATTRIBUTE_VALUE_QUOTED;break}case S.AMPERSAND:{this._startCharacterReference();break}case S.NULL:{this._err($.unexpectedNullCharacter),this.currentAttr.value+=Ye;break}case S.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAttributeValueUnquoted(e){switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:{this._leaveAttrValue(),this.state=k.BEFORE_ATTRIBUTE_NAME;break}case S.AMPERSAND:{this._startCharacterReference();break}case S.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=k.DATA,this.emitCurrentTagToken();break}case S.NULL:{this._err($.unexpectedNullCharacter),this.currentAttr.value+=Ye;break}case S.QUOTATION_MARK:case S.APOSTROPHE:case S.LESS_THAN_SIGN:case S.EQUALS_SIGN:case S.GRAVE_ACCENT:{this._err($.unexpectedCharacterInUnquotedAttributeValue),this.currentAttr.value+=String.fromCodePoint(e);break}case S.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this.currentAttr.value+=String.fromCodePoint(e)}}_stateAfterAttributeValueQuoted(e){switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:{this._leaveAttrValue(),this.state=k.BEFORE_ATTRIBUTE_NAME;break}case S.SOLIDUS:{this._leaveAttrValue(),this.state=k.SELF_CLOSING_START_TAG;break}case S.GREATER_THAN_SIGN:{this._leaveAttrValue(),this.state=k.DATA,this.emitCurrentTagToken();break}case S.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this._err($.missingWhitespaceBetweenAttributes),this.state=k.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateSelfClosingStartTag(e){switch(e){case S.GREATER_THAN_SIGN:{const n=this.currentToken;n.selfClosing=!0,this.state=k.DATA,this.emitCurrentTagToken();break}case S.EOF:{this._err($.eofInTag),this._emitEOFToken();break}default:this._err($.unexpectedSolidusInTag),this.state=k.BEFORE_ATTRIBUTE_NAME,this._stateBeforeAttributeName(e)}}_stateBogusComment(e){const n=this.currentToken;switch(e){case S.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentComment(n);break}case S.EOF:{this.emitCurrentComment(n),this._emitEOFToken();break}case S.NULL:{this._err($.unexpectedNullCharacter),n.data+=Ye;break}default:n.data+=String.fromCodePoint(e)}}_stateMarkupDeclarationOpen(e){this._consumeSequenceIfMatch(qt.DASH_DASH,!0)?(this._createCommentToken(qt.DASH_DASH.length+1),this.state=k.COMMENT_START):this._consumeSequenceIfMatch(qt.DOCTYPE,!1)?(this.currentLocation=this.getCurrentLocation(qt.DOCTYPE.length+1),this.state=k.DOCTYPE):this._consumeSequenceIfMatch(qt.CDATA_START,!0)?this.inForeignNode?this.state=k.CDATA_SECTION:(this._err($.cdataInHtmlContent),this._createCommentToken(qt.CDATA_START.length+1),this.currentToken.data="[CDATA[",this.state=k.BOGUS_COMMENT):this._ensureHibernation()||(this._err($.incorrectlyOpenedComment),this._createCommentToken(2),this.state=k.BOGUS_COMMENT,this._stateBogusComment(e))}_stateCommentStart(e){switch(e){case S.HYPHEN_MINUS:{this.state=k.COMMENT_START_DASH;break}case S.GREATER_THAN_SIGN:{this._err($.abruptClosingOfEmptyComment),this.state=k.DATA;const n=this.currentToken;this.emitCurrentComment(n);break}default:this.state=k.COMMENT,this._stateComment(e)}}_stateCommentStartDash(e){const n=this.currentToken;switch(e){case S.HYPHEN_MINUS:{this.state=k.COMMENT_END;break}case S.GREATER_THAN_SIGN:{this._err($.abruptClosingOfEmptyComment),this.state=k.DATA,this.emitCurrentComment(n);break}case S.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=k.COMMENT,this._stateComment(e)}}_stateComment(e){const n=this.currentToken;switch(e){case S.HYPHEN_MINUS:{this.state=k.COMMENT_END_DASH;break}case S.LESS_THAN_SIGN:{n.data+="<",this.state=k.COMMENT_LESS_THAN_SIGN;break}case S.NULL:{this._err($.unexpectedNullCharacter),n.data+=Ye;break}case S.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+=String.fromCodePoint(e)}}_stateCommentLessThanSign(e){const n=this.currentToken;switch(e){case S.EXCLAMATION_MARK:{n.data+="!",this.state=k.COMMENT_LESS_THAN_SIGN_BANG;break}case S.LESS_THAN_SIGN:{n.data+="<";break}default:this.state=k.COMMENT,this._stateComment(e)}}_stateCommentLessThanSignBang(e){e===S.HYPHEN_MINUS?this.state=k.COMMENT_LESS_THAN_SIGN_BANG_DASH:(this.state=k.COMMENT,this._stateComment(e))}_stateCommentLessThanSignBangDash(e){e===S.HYPHEN_MINUS?this.state=k.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:(this.state=k.COMMENT_END_DASH,this._stateCommentEndDash(e))}_stateCommentLessThanSignBangDashDash(e){e!==S.GREATER_THAN_SIGN&&e!==S.EOF&&this._err($.nestedComment),this.state=k.COMMENT_END,this._stateCommentEnd(e)}_stateCommentEndDash(e){const n=this.currentToken;switch(e){case S.HYPHEN_MINUS:{this.state=k.COMMENT_END;break}case S.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="-",this.state=k.COMMENT,this._stateComment(e)}}_stateCommentEnd(e){const n=this.currentToken;switch(e){case S.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentComment(n);break}case S.EXCLAMATION_MARK:{this.state=k.COMMENT_END_BANG;break}case S.HYPHEN_MINUS:{n.data+="-";break}case S.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--",this.state=k.COMMENT,this._stateComment(e)}}_stateCommentEndBang(e){const n=this.currentToken;switch(e){case S.HYPHEN_MINUS:{n.data+="--!",this.state=k.COMMENT_END_DASH;break}case S.GREATER_THAN_SIGN:{this._err($.incorrectlyClosedComment),this.state=k.DATA,this.emitCurrentComment(n);break}case S.EOF:{this._err($.eofInComment),this.emitCurrentComment(n),this._emitEOFToken();break}default:n.data+="--!",this.state=k.COMMENT,this._stateComment(e)}}_stateDoctype(e){switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_NAME;break}case S.GREATER_THAN_SIGN:{this.state=k.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e);break}case S.EOF:{this._err($.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingWhitespaceBeforeDoctypeName),this.state=k.BEFORE_DOCTYPE_NAME,this._stateBeforeDoctypeName(e)}}_stateBeforeDoctypeName(e){if(Qo(e))this._createDoctypeToken(String.fromCharCode(Fl(e))),this.state=k.DOCTYPE_NAME;else switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.NULL:{this._err($.unexpectedNullCharacter),this._createDoctypeToken(Ye),this.state=k.DOCTYPE_NAME;break}case S.GREATER_THAN_SIGN:{this._err($.missingDoctypeName),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case S.EOF:{this._err($.eofInDoctype),this._createDoctypeToken(null);const n=this.currentToken;n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._createDoctypeToken(String.fromCodePoint(e)),this.state=k.DOCTYPE_NAME}}_stateDoctypeName(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:{this.state=k.AFTER_DOCTYPE_NAME;break}case S.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case S.NULL:{this._err($.unexpectedNullCharacter),n.name+=Ye;break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.name+=String.fromCodePoint(Qo(e)?Fl(e):e)}}_stateAfterDoctypeName(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._consumeSequenceIfMatch(qt.PUBLIC,!1)?this.state=k.AFTER_DOCTYPE_PUBLIC_KEYWORD:this._consumeSequenceIfMatch(qt.SYSTEM,!1)?this.state=k.AFTER_DOCTYPE_SYSTEM_KEYWORD:this._ensureHibernation()||(this._err($.invalidCharacterSequenceAfterDoctypeName),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e))}}_stateAfterDoctypePublicKeyword(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER;break}case S.QUOTATION_MARK:{this._err($.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case S.APOSTROPHE:{this._err($.missingWhitespaceAfterDoctypePublicKeyword),n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case S.GREATER_THAN_SIGN:{this._err($.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.QUOTATION_MARK:{n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED;break}case S.APOSTROPHE:{n.publicId="",this.state=k.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED;break}case S.GREATER_THAN_SIGN:{this._err($.missingDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypePublicIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypePublicIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case S.QUOTATION_MARK:{this.state=k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case S.NULL:{this._err($.unexpectedNullCharacter),n.publicId+=Ye;break}case S.GREATER_THAN_SIGN:{this._err($.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateDoctypePublicIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case S.APOSTROPHE:{this.state=k.AFTER_DOCTYPE_PUBLIC_IDENTIFIER;break}case S.NULL:{this._err($.unexpectedNullCharacter),n.publicId+=Ye;break}case S.GREATER_THAN_SIGN:{this._err($.abruptDoctypePublicIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.publicId+=String.fromCodePoint(e)}}_stateAfterDoctypePublicIdentifier(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:{this.state=k.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS;break}case S.GREATER_THAN_SIGN:{this.state=k.DATA,this.emitCurrentDoctype(n);break}case S.QUOTATION_MARK:{this._err($.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case S.APOSTROPHE:{this._err($.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBetweenDoctypePublicAndSystemIdentifiers(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case S.QUOTATION_MARK:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case S.APOSTROPHE:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateAfterDoctypeSystemKeyword(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:{this.state=k.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER;break}case S.QUOTATION_MARK:{this._err($.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case S.APOSTROPHE:{this._err($.missingWhitespaceAfterDoctypeSystemKeyword),n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case S.GREATER_THAN_SIGN:{this._err($.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBeforeDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.QUOTATION_MARK:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED;break}case S.APOSTROPHE:{n.systemId="",this.state=k.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED;break}case S.GREATER_THAN_SIGN:{this._err($.missingDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.DATA,this.emitCurrentDoctype(n);break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.missingQuoteBeforeDoctypeSystemIdentifier),n.forceQuirks=!0,this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateDoctypeSystemIdentifierDoubleQuoted(e){const n=this.currentToken;switch(e){case S.QUOTATION_MARK:{this.state=k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case S.NULL:{this._err($.unexpectedNullCharacter),n.systemId+=Ye;break}case S.GREATER_THAN_SIGN:{this._err($.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateDoctypeSystemIdentifierSingleQuoted(e){const n=this.currentToken;switch(e){case S.APOSTROPHE:{this.state=k.AFTER_DOCTYPE_SYSTEM_IDENTIFIER;break}case S.NULL:{this._err($.unexpectedNullCharacter),n.systemId+=Ye;break}case S.GREATER_THAN_SIGN:{this._err($.abruptDoctypeSystemIdentifier),n.forceQuirks=!0,this.emitCurrentDoctype(n),this.state=k.DATA;break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:n.systemId+=String.fromCodePoint(e)}}_stateAfterDoctypeSystemIdentifier(e){const n=this.currentToken;switch(e){case S.SPACE:case S.LINE_FEED:case S.TABULATION:case S.FORM_FEED:break;case S.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case S.EOF:{this._err($.eofInDoctype),n.forceQuirks=!0,this.emitCurrentDoctype(n),this._emitEOFToken();break}default:this._err($.unexpectedCharacterAfterDoctypeSystemIdentifier),this.state=k.BOGUS_DOCTYPE,this._stateBogusDoctype(e)}}_stateBogusDoctype(e){const n=this.currentToken;switch(e){case S.GREATER_THAN_SIGN:{this.emitCurrentDoctype(n),this.state=k.DATA;break}case S.NULL:{this._err($.unexpectedNullCharacter);break}case S.EOF:{this.emitCurrentDoctype(n),this._emitEOFToken();break}}}_stateCdataSection(e){switch(e){case S.RIGHT_SQUARE_BRACKET:{this.state=k.CDATA_SECTION_BRACKET;break}case S.EOF:{this._err($.eofInCdata),this._emitEOFToken();break}default:this._emitCodePoint(e)}}_stateCdataSectionBracket(e){e===S.RIGHT_SQUARE_BRACKET?this.state=k.CDATA_SECTION_END:(this._emitChars("]"),this.state=k.CDATA_SECTION,this._stateCdataSection(e))}_stateCdataSectionEnd(e){switch(e){case S.GREATER_THAN_SIGN:{this.state=k.DATA;break}case S.RIGHT_SQUARE_BRACKET:{this._emitChars("]");break}default:this._emitChars("]]"),this.state=k.CDATA_SECTION,this._stateCdataSection(e)}}_stateCharacterReference(){let e=this.entityDecoder.write(this.preprocessor.html,this.preprocessor.pos);if(e<0)if(this.preprocessor.lastChunkWritten)e=this.entityDecoder.end();else{this.active=!1,this.preprocessor.pos=this.preprocessor.html.length-1,this.consumedAfterSnapshot=0,this.preprocessor.endOfChunkHit=!0;return}e===0?(this.preprocessor.pos=this.entityStartPos,this._flushCodePointConsumedAsCharacterReference(S.AMPERSAND),this.state=!this._isCharacterReferenceInAttribute()&&ab(this.preprocessor.peek(1))?k.AMBIGUOUS_AMPERSAND:this.returnState):this.state=this.returnState}_stateAmbiguousAmpersand(e){ab(e)?this._flushCodePointConsumedAsCharacterReference(e):(e===S.SEMICOLON&&this._err($.unknownNamedCharacterReference),this.state=this.returnState,this._callState(e))}}const oS=new Set([m.DD,m.DT,m.LI,m.OPTGROUP,m.OPTION,m.P,m.RB,m.RP,m.RT,m.RTC]),ub=new Set([...oS,m.CAPTION,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]),Qu=new Set([m.APPLET,m.CAPTION,m.HTML,m.MARQUEE,m.OBJECT,m.TABLE,m.TD,m.TEMPLATE,m.TH]),k5=new Set([...Qu,m.OL,m.UL]),A5=new Set([...Qu,m.BUTTON]),cb=new Set([m.ANNOTATION_XML,m.MI,m.MN,m.MO,m.MS,m.MTEXT]),db=new Set([m.DESC,m.FOREIGN_OBJECT,m.TITLE]),v5=new Set([m.TR,m.TEMPLATE,m.HTML]),N5=new Set([m.TBODY,m.TFOOT,m.THEAD,m.TEMPLATE,m.HTML]),_5=new Set([m.TABLE,m.TEMPLATE,m.HTML]),I5=new Set([m.TD,m.TH]);class R5{get currentTmplContentOrNode(){return this._isInTemplate()?this.treeAdapter.getTemplateContent(this.current):this.current}constructor(e,n,r){this.treeAdapter=n,this.handler=r,this.items=[],this.tagIDs=[],this.stackTop=-1,this.tmplCount=0,this.currentTagId=m.UNKNOWN,this.current=e}_indexOf(e){return this.items.lastIndexOf(e,this.stackTop)}_isInTemplate(){return this.currentTagId===m.TEMPLATE&&this.treeAdapter.getNamespaceURI(this.current)===K.HTML}_updateCurrentElement(){this.current=this.items[this.stackTop],this.currentTagId=this.tagIDs[this.stackTop]}push(e,n){this.stackTop++,this.items[this.stackTop]=e,this.current=e,this.tagIDs[this.stackTop]=n,this.currentTagId=n,this._isInTemplate()&&this.tmplCount++,this.handler.onItemPush(e,n,!0)}pop(){const e=this.current;this.tmplCount>0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!0)}replace(e,n){const r=this._indexOf(e);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(e,n,r){const i=this._indexOf(e)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(e){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(e,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==K.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(e){for(;this.stackTop>=e;){const n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop<e)}}popUntilElementPopped(e){const n=this._indexOf(e);this.shortenToLength(Math.max(n,0))}popUntilPopped(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(Math.max(r,0))}popUntilNumberedHeaderPopped(){this.popUntilPopped(Qh,K.HTML)}popUntilTableCellPopped(){this.popUntilPopped(I5,K.HTML)}popAllUpToHtmlElement(){this.tmplCount=0,this.shortenToLength(1)}_indexOfTagNames(e,n){for(let r=this.stackTop;r>=0;r--)if(e.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(e,n){const r=this._indexOfTagNames(e,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(_5,K.HTML)}clearBackToTableBodyContext(){this.clearBackTo(N5,K.HTML)}clearBackToTableRowContext(){this.clearBackTo(v5,K.HTML)}remove(e){const n=this._indexOf(e);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(e,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===m.BODY?this.items[1]:null}contains(e){return this._indexOf(e)>-1}getCommonAncestor(e){const n=this._indexOf(e)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===m.HTML}hasInDynamicScope(e,n){for(let r=this.stackTop;r>=0;r--){const i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case K.HTML:{if(i===e)return!0;if(n.has(i))return!1;break}case K.SVG:{if(db.has(i))return!1;break}case K.MATHML:{if(cb.has(i))return!1;break}}}return!0}hasInScope(e){return this.hasInDynamicScope(e,Qu)}hasInListItemScope(e){return this.hasInDynamicScope(e,k5)}hasInButtonScope(e){return this.hasInDynamicScope(e,A5)}hasNumberedHeaderInScope(){for(let e=this.stackTop;e>=0;e--){const n=this.tagIDs[e];switch(this.treeAdapter.getNamespaceURI(this.items[e])){case K.HTML:{if(Qh.has(n))return!0;if(Qu.has(n))return!1;break}case K.SVG:{if(db.has(n))return!1;break}case K.MATHML:{if(cb.has(n))return!1;break}}}return!0}hasInTableScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===K.HTML)switch(this.tagIDs[n]){case e:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let e=this.stackTop;e>=0;e--)if(this.treeAdapter.getNamespaceURI(this.items[e])===K.HTML)switch(this.tagIDs[e]){case m.TBODY:case m.THEAD:case m.TFOOT:return!0;case m.TABLE:case m.HTML:return!1}return!0}hasInSelectScope(e){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===K.HTML)switch(this.tagIDs[n]){case e:return!0;case m.OPTION:case m.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&oS.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&ub.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(e){for(;this.currentTagId!==void 0&&this.currentTagId!==e&&ub.has(this.currentTagId);)this.pop()}}const uf=3;var rr;(function(t){t[t.Marker=0]="Marker",t[t.Element=1]="Element"})(rr||(rr={}));const fb={type:rr.Marker};class M5{constructor(e){this.treeAdapter=e,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(e,n){const r=[],i=n.length,s=this.treeAdapter.getTagName(e),o=this.treeAdapter.getNamespaceURI(e);for(let a=0;a<this.entries.length;a++){const l=this.entries[a];if(l.type===rr.Marker)break;const{element:u}=l;if(this.treeAdapter.getTagName(u)===s&&this.treeAdapter.getNamespaceURI(u)===o){const c=this.treeAdapter.getAttrList(u);c.length===i&&r.push({idx:a,attrs:c})}}return r}_ensureNoahArkCondition(e){if(this.entries.length<uf)return;const n=this.treeAdapter.getAttrList(e),r=this._getNoahArkConditionCandidates(e,n);if(r.length<uf)return;const i=new Map(n.map(o=>[o.name,o.value]));let s=0;for(let o=0;o<r.length;o++){const a=r[o];a.attrs.every(l=>i.get(l.name)===l.value)&&(s+=1,s>=uf&&this.entries.splice(a.idx,1))}}insertMarker(){this.entries.unshift(fb)}pushElement(e,n){this._ensureNoahArkCondition(e),this.entries.unshift({type:rr.Element,element:e,token:n})}insertElementAfterBookmark(e,n){const r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:rr.Element,element:e,token:n})}removeEntry(e){const n=this.entries.indexOf(e);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){const e=this.entries.indexOf(fb);e===-1?this.entries.length=0:this.entries.splice(0,e+1)}getElementEntryInScopeWithTagName(e){const n=this.entries.find(r=>r.type===rr.Marker||this.treeAdapter.getTagName(r.element)===e);return n&&n.type===rr.Element?n:null}getElementEntry(e){return this.entries.find(n=>n.type===rr.Element&&n.element===e)}}const jr={createDocument(){return{nodeName:"#document",mode:kn.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(t,e,n){return{nodeName:t,tagName:t,attrs:n,namespaceURI:e,childNodes:[],parentNode:null}},createCommentNode(t){return{nodeName:"#comment",data:t,parentNode:null}},createTextNode(t){return{nodeName:"#text",value:t,parentNode:null}},appendChild(t,e){t.childNodes.push(e),e.parentNode=t},insertBefore(t,e,n){const r=t.childNodes.indexOf(n);t.childNodes.splice(r,0,e),e.parentNode=t},setTemplateContent(t,e){t.content=e},getTemplateContent(t){return t.content},setDocumentType(t,e,n,r){const i=t.childNodes.find(s=>s.nodeName==="#documentType");if(i)i.name=e,i.publicId=n,i.systemId=r;else{const s={nodeName:"#documentType",name:e,publicId:n,systemId:r,parentNode:null};jr.appendChild(t,s)}},setDocumentMode(t,e){t.mode=e},getDocumentMode(t){return t.mode},detachNode(t){if(t.parentNode){const e=t.parentNode.childNodes.indexOf(t);t.parentNode.childNodes.splice(e,1),t.parentNode=null}},insertText(t,e){if(t.childNodes.length>0){const n=t.childNodes[t.childNodes.length-1];if(jr.isTextNode(n)){n.value+=e;return}}jr.appendChild(t,jr.createTextNode(e))},insertTextBefore(t,e,n){const r=t.childNodes[t.childNodes.indexOf(n)-1];r&&jr.isTextNode(r)?r.value+=e:jr.insertBefore(t,jr.createTextNode(e),n)},adoptAttributes(t,e){const n=new Set(t.attrs.map(r=>r.name));for(let r=0;r<e.length;r++)n.has(e[r].name)||t.attrs.push(e[r])},getFirstChild(t){return t.childNodes[0]},getChildNodes(t){return t.childNodes},getParentNode(t){return t.parentNode},getAttrList(t){return t.attrs},getTagName(t){return t.tagName},getNamespaceURI(t){return t.namespaceURI},getTextNodeContent(t){return t.value},getCommentNodeContent(t){return t.data},getDocumentTypeNodeName(t){return t.name},getDocumentTypeNodePublicId(t){return t.publicId},getDocumentTypeNodeSystemId(t){return t.systemId},isTextNode(t){return t.nodeName==="#text"},isCommentNode(t){return t.nodeName==="#comment"},isDocumentTypeNode(t){return t.nodeName==="#documentType"},isElementNode(t){return Object.prototype.hasOwnProperty.call(t,"tagName")},setNodeSourceCodeLocation(t,e){t.sourceCodeLocation=e},getNodeSourceCodeLocation(t){return t.sourceCodeLocation},updateNodeSourceCodeLocation(t,e){t.sourceCodeLocation={...t.sourceCodeLocation,...e}}},aS="html",O5="about:legacy-compat",D5="http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd",lS=["+//silmaril//dtd html pro v0r11 19970101//","-//as//dtd html 3.0 aswedit + extensions//","-//advasoft ltd//dtd html 3.0 aswedit + extensions//","-//ietf//dtd html 2.0 level 1//","-//ietf//dtd html 2.0 level 2//","-//ietf//dtd html 2.0 strict level 1//","-//ietf//dtd html 2.0 strict level 2//","-//ietf//dtd html 2.0 strict//","-//ietf//dtd html 2.0//","-//ietf//dtd html 2.1e//","-//ietf//dtd html 3.0//","-//ietf//dtd html 3.2 final//","-//ietf//dtd html 3.2//","-//ietf//dtd html 3//","-//ietf//dtd html level 0//","-//ietf//dtd html level 1//","-//ietf//dtd html level 2//","-//ietf//dtd html level 3//","-//ietf//dtd html strict level 0//","-//ietf//dtd html strict level 1//","-//ietf//dtd html strict level 2//","-//ietf//dtd html strict level 3//","-//ietf//dtd html strict//","-//ietf//dtd html//","-//metrius//dtd metrius presentational//","-//microsoft//dtd internet explorer 2.0 html strict//","-//microsoft//dtd internet explorer 2.0 html//","-//microsoft//dtd internet explorer 2.0 tables//","-//microsoft//dtd internet explorer 3.0 html strict//","-//microsoft//dtd internet explorer 3.0 html//","-//microsoft//dtd internet explorer 3.0 tables//","-//netscape comm. corp.//dtd html//","-//netscape comm. corp.//dtd strict html//","-//o'reilly and associates//dtd html 2.0//","-//o'reilly and associates//dtd html extended 1.0//","-//o'reilly and associates//dtd html extended relaxed 1.0//","-//sq//dtd html 2.0 hotmetal + extensions//","-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//","-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//","-//spyglass//dtd html 2.0 extended//","-//sun microsystems corp.//dtd hotjava html//","-//sun microsystems corp.//dtd hotjava strict html//","-//w3c//dtd html 3 1995-03-24//","-//w3c//dtd html 3.2 draft//","-//w3c//dtd html 3.2 final//","-//w3c//dtd html 3.2//","-//w3c//dtd html 3.2s draft//","-//w3c//dtd html 4.0 frameset//","-//w3c//dtd html 4.0 transitional//","-//w3c//dtd html experimental 19960712//","-//w3c//dtd html experimental 970421//","-//w3c//dtd w3 html//","-//w3o//dtd w3 html 3.0//","-//webtechs//dtd mozilla html 2.0//","-//webtechs//dtd mozilla html//"],L5=[...lS,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"],P5=new Set(["-//w3o//dtd w3 html strict 3.0//en//","-/w3c/dtd html 4.0 transitional/en","html"]),uS=["-//w3c//dtd xhtml 1.0 frameset//","-//w3c//dtd xhtml 1.0 transitional//"],B5=[...uS,"-//w3c//dtd html 4.01 frameset//","-//w3c//dtd html 4.01 transitional//"];function hb(t,e){return e.some(n=>t.startsWith(n))}function F5(t){return t.name===aS&&t.publicId===null&&(t.systemId===null||t.systemId===O5)}function H5(t){if(t.name!==aS)return kn.QUIRKS;const{systemId:e}=t;if(e&&e.toLowerCase()===D5)return kn.QUIRKS;let{publicId:n}=t;if(n!==null){if(n=n.toLowerCase(),P5.has(n))return kn.QUIRKS;let r=e===null?L5:lS;if(hb(n,r))return kn.QUIRKS;if(r=e===null?uS:B5,hb(n,r))return kn.LIMITED_QUIRKS}return kn.NO_QUIRKS}const pb={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},U5="definitionurl",$5="definitionURL",V5=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(t=>[t.toLowerCase(),t])),z5=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:K.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:K.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:K.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:K.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:K.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:K.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:K.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:K.XML}],["xml:space",{prefix:"xml",name:"space",namespace:K.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:K.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:K.XMLNS}]]),j5=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(t=>[t.toLowerCase(),t])),W5=new Set([m.B,m.BIG,m.BLOCKQUOTE,m.BODY,m.BR,m.CENTER,m.CODE,m.DD,m.DIV,m.DL,m.DT,m.EM,m.EMBED,m.H1,m.H2,m.H3,m.H4,m.H5,m.H6,m.HEAD,m.HR,m.I,m.IMG,m.LI,m.LISTING,m.MENU,m.META,m.NOBR,m.OL,m.P,m.PRE,m.RUBY,m.S,m.SMALL,m.SPAN,m.STRONG,m.STRIKE,m.SUB,m.SUP,m.TABLE,m.TT,m.U,m.UL,m.VAR]);function q5(t){const e=t.tagID;return e===m.FONT&&t.attrs.some(({name:r})=>r===Fi.COLOR||r===Fi.SIZE||r===Fi.FACE)||W5.has(e)}function cS(t){for(let e=0;e<t.attrs.length;e++)if(t.attrs[e].name===U5){t.attrs[e].name=$5;break}}function dS(t){for(let e=0;e<t.attrs.length;e++){const n=V5.get(t.attrs[e].name);n!=null&&(t.attrs[e].name=n)}}function Mm(t){for(let e=0;e<t.attrs.length;e++){const n=z5.get(t.attrs[e].name);n&&(t.attrs[e].prefix=n.prefix,t.attrs[e].name=n.name,t.attrs[e].namespace=n.namespace)}}function Y5(t){const e=j5.get(t.tagName);e!=null&&(t.tagName=e,t.tagID=Wc(t.tagName))}function K5(t,e){return e===K.MATHML&&(t===m.MI||t===m.MO||t===m.MN||t===m.MS||t===m.MTEXT)}function G5(t,e,n){if(e===K.MATHML&&t===m.ANNOTATION_XML){for(let r=0;r<n.length;r++)if(n[r].name===Fi.ENCODING){const i=n[r].value.toLowerCase();return i===pb.TEXT_HTML||i===pb.APPLICATION_XML}}return e===K.SVG&&(t===m.FOREIGN_OBJECT||t===m.DESC||t===m.TITLE)}function X5(t,e,n,r){return(!r||r===K.HTML)&&G5(t,e,n)||(!r||r===K.MATHML)&&K5(t,e)}const Q5="hidden",Z5=8,J5=3;var _;(function(t){t[t.INITIAL=0]="INITIAL",t[t.BEFORE_HTML=1]="BEFORE_HTML",t[t.BEFORE_HEAD=2]="BEFORE_HEAD",t[t.IN_HEAD=3]="IN_HEAD",t[t.IN_HEAD_NO_SCRIPT=4]="IN_HEAD_NO_SCRIPT",t[t.AFTER_HEAD=5]="AFTER_HEAD",t[t.IN_BODY=6]="IN_BODY",t[t.TEXT=7]="TEXT",t[t.IN_TABLE=8]="IN_TABLE",t[t.IN_TABLE_TEXT=9]="IN_TABLE_TEXT",t[t.IN_CAPTION=10]="IN_CAPTION",t[t.IN_COLUMN_GROUP=11]="IN_COLUMN_GROUP",t[t.IN_TABLE_BODY=12]="IN_TABLE_BODY",t[t.IN_ROW=13]="IN_ROW",t[t.IN_CELL=14]="IN_CELL",t[t.IN_SELECT=15]="IN_SELECT",t[t.IN_SELECT_IN_TABLE=16]="IN_SELECT_IN_TABLE",t[t.IN_TEMPLATE=17]="IN_TEMPLATE",t[t.AFTER_BODY=18]="AFTER_BODY",t[t.IN_FRAMESET=19]="IN_FRAMESET",t[t.AFTER_FRAMESET=20]="AFTER_FRAMESET",t[t.AFTER_AFTER_BODY=21]="AFTER_AFTER_BODY",t[t.AFTER_AFTER_FRAMESET=22]="AFTER_AFTER_FRAMESET"})(_||(_={}));const e8={startLine:-1,startCol:-1,startOffset:-1,endLine:-1,endCol:-1,endOffset:-1},fS=new Set([m.TABLE,m.TBODY,m.TFOOT,m.THEAD,m.TR]),mb={scriptingEnabled:!0,sourceCodeLocationInfo:!1,treeAdapter:jr,onParseError:null};class hS{constructor(e,n,r=null,i=null){this.fragmentContext=r,this.scriptHandler=i,this.currentToken=null,this.stopped=!1,this.insertionMode=_.INITIAL,this.originalInsertionMode=_.INITIAL,this.headElement=null,this.formElement=null,this.currentNotInHTML=!1,this.tmplInsertionModeStack=[],this.pendingCharacterTokens=[],this.hasNonWhitespacePendingCharacterToken=!1,this.framesetOk=!0,this.skipNextNewLine=!1,this.fosterParentingEnabled=!1,this.options={...mb,...e},this.treeAdapter=this.options.treeAdapter,this.onParseError=this.options.onParseError,this.onParseError&&(this.options.sourceCodeLocationInfo=!0),this.document=n??this.treeAdapter.createDocument(),this.tokenizer=new w5(this.options,this),this.activeFormattingElements=new M5(this.treeAdapter),this.fragmentContextID=r?Wc(this.treeAdapter.getTagName(r)):m.UNKNOWN,this._setContextModes(r??this.document,this.fragmentContextID),this.openElements=new R5(this.document,this.treeAdapter,this)}static parse(e,n){const r=new this(n);return r.tokenizer.write(e,!0),r.document}static getFragmentParser(e,n){const r={...mb,...n};e??(e=r.treeAdapter.createElement(L.TEMPLATE,K.HTML,[]));const i=r.treeAdapter.createElement("documentmock",K.HTML,[]),s=new this(r,i,e);return s.fragmentContextID===m.TEMPLATE&&s.tmplInsertionModeStack.unshift(_.IN_TEMPLATE),s._initTokenizerForFragmentParsing(),s._insertFakeRootElement(),s._resetInsertionMode(),s._findFormInFragmentContext(),s}getFragment(){const e=this.treeAdapter.getFirstChild(this.document),n=this.treeAdapter.createDocumentFragment();return this._adoptNodes(e,n),n}_err(e,n,r){var i;if(!this.onParseError)return;const s=(i=e.location)!==null&&i!==void 0?i:e8,o={code:n,startLine:s.startLine,startCol:s.startCol,startOffset:s.startOffset,endLine:r?s.startLine:s.endLine,endCol:r?s.startCol:s.endCol,endOffset:r?s.startOffset:s.endOffset};this.onParseError(o)}onItemPush(e,n,r){var i,s;(s=(i=this.treeAdapter).onItemPush)===null||s===void 0||s.call(i,e),r&&this.openElements.stackTop>0&&this._setContextModes(e,n)}onItemPop(e,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(e,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,e,this.openElements.current),n){let s,o;this.openElements.stackTop===0&&this.fragmentContext?(s=this.fragmentContext,o=this.fragmentContextID):{current:s,currentTagId:o}=this.openElements,this._setContextModes(s,o)}}_setContextModes(e,n){const r=e===this.document||e&&this.treeAdapter.getNamespaceURI(e)===K.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&e!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,e)}_switchToTextParsing(e,n){this._insertElement(e,K.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=_.TEXT}switchToPlaintextParsing(){this.insertionMode=_.TEXT,this.originalInsertionMode=_.IN_BODY,this.tokenizer.state=Zt.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let e=this.fragmentContext;for(;e;){if(this.treeAdapter.getTagName(e)===L.FORM){this.formElement=e;break}e=this.treeAdapter.getParentNode(e)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==K.HTML))switch(this.fragmentContextID){case m.TITLE:case m.TEXTAREA:{this.tokenizer.state=Zt.RCDATA;break}case m.STYLE:case m.XMP:case m.IFRAME:case m.NOEMBED:case m.NOFRAMES:case m.NOSCRIPT:{this.tokenizer.state=Zt.RAWTEXT;break}case m.SCRIPT:{this.tokenizer.state=Zt.SCRIPT_DATA;break}case m.PLAINTEXT:{this.tokenizer.state=Zt.PLAINTEXT;break}}}_setDocumentType(e){const n=e.name||"",r=e.publicId||"",i=e.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),e.location){const o=this.treeAdapter.getChildNodes(this.document).find(a=>this.treeAdapter.isDocumentTypeNode(a));o&&this.treeAdapter.setNodeSourceCodeLocation(o,e.location)}}_attachElementToTree(e,n){if(this.options.sourceCodeLocationInfo){const r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(e,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(e);else{const r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,e)}}_appendElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location)}_insertElement(e,n){const r=this.treeAdapter.createElement(e.tagName,n,e.attrs);this._attachElementToTree(r,e.location),this.openElements.push(r,e.tagID)}_insertFakeElement(e,n){const r=this.treeAdapter.createElement(e,K.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(e){const n=this.treeAdapter.createElement(e.tagName,K.HTML,e.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,e.location),this.openElements.push(n,e.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){const e=this.treeAdapter.createElement(L.HTML,K.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(e,null),this.treeAdapter.appendChild(this.openElements.current,e),this.openElements.push(e,m.HTML)}_appendCommentNode(e,n){const r=this.treeAdapter.createCommentNode(e.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,e.location)}_insertCharacters(e){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,e.chars,r):this.treeAdapter.insertText(n,e.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,e.chars)),!e.location)return;const i=this.treeAdapter.getChildNodes(n),s=r?i.lastIndexOf(r):i.length,o=i[s-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){const{endLine:l,endCol:u,endOffset:c}=e.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:l,endCol:u,endOffset:c})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,e.location)}_adoptNodes(e,n){for(let r=this.treeAdapter.getFirstChild(e);r;r=this.treeAdapter.getFirstChild(e))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(e,n){if(this.treeAdapter.getNodeSourceCodeLocation(e)&&n.location){const r=n.location,i=this.treeAdapter.getTagName(e),s=n.type===Oe.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(e,s)}}shouldProcessStartTagTokenInForeignContent(e){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,e.tagID===m.SVG&&this.treeAdapter.getTagName(n)===L.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===K.MATHML?!1:this.tokenizer.inForeignNode||(e.tagID===m.MGLYPH||e.tagID===m.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,K.HTML)}_processToken(e){switch(e.type){case Oe.CHARACTER:{this.onCharacter(e);break}case Oe.NULL_CHARACTER:{this.onNullCharacter(e);break}case Oe.COMMENT:{this.onComment(e);break}case Oe.DOCTYPE:{this.onDoctype(e);break}case Oe.START_TAG:{this._processStartTag(e);break}case Oe.END_TAG:{this.onEndTag(e);break}case Oe.EOF:{this.onEof(e);break}case Oe.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(e);break}}}_isIntegrationPoint(e,n,r){const i=this.treeAdapter.getNamespaceURI(n),s=this.treeAdapter.getAttrList(n);return X5(e,i,s,r)}_reconstructActiveFormattingElements(){const e=this.activeFormattingElements.entries.length;if(e){const n=this.activeFormattingElements.entries.findIndex(i=>i.type===rr.Marker||this.openElements.contains(i.element)),r=n===-1?e-1:n-1;for(let i=r;i>=0;i--){const s=this.activeFormattingElements.entries[i];this._insertElement(s.token,this.treeAdapter.getNamespaceURI(s.element)),s.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=_.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(m.P),this.openElements.popUntilTagNamePopped(m.P)}_resetInsertionMode(){for(let e=this.openElements.stackTop;e>=0;e--)switch(e===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[e]){case m.TR:{this.insertionMode=_.IN_ROW;return}case m.TBODY:case m.THEAD:case m.TFOOT:{this.insertionMode=_.IN_TABLE_BODY;return}case m.CAPTION:{this.insertionMode=_.IN_CAPTION;return}case m.COLGROUP:{this.insertionMode=_.IN_COLUMN_GROUP;return}case m.TABLE:{this.insertionMode=_.IN_TABLE;return}case m.BODY:{this.insertionMode=_.IN_BODY;return}case m.FRAMESET:{this.insertionMode=_.IN_FRAMESET;return}case m.SELECT:{this._resetInsertionModeForSelect(e);return}case m.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case m.HTML:{this.insertionMode=this.headElement?_.AFTER_HEAD:_.BEFORE_HEAD;return}case m.TD:case m.TH:{if(e>0){this.insertionMode=_.IN_CELL;return}break}case m.HEAD:{if(e>0){this.insertionMode=_.IN_HEAD;return}break}}this.insertionMode=_.IN_BODY}_resetInsertionModeForSelect(e){if(e>0)for(let n=e-1;n>0;n--){const r=this.openElements.tagIDs[n];if(r===m.TEMPLATE)break;if(r===m.TABLE){this.insertionMode=_.IN_SELECT_IN_TABLE;return}}this.insertionMode=_.IN_SELECT}_isElementCausesFosterParenting(e){return fS.has(e)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let e=this.openElements.stackTop;e>=0;e--){const n=this.openElements.items[e];switch(this.openElements.tagIDs[e]){case m.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===K.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case m.TABLE:{const r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[e-1],beforeElement:null}}}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(e){const n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,e,n.beforeElement):this.treeAdapter.appendChild(n.parent,e)}_isSpecialElement(e,n){const r=this.treeAdapter.getNamespaceURI(e);return T5[r].has(n)}onCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){IL(this,e);return}switch(this.insertionMode){case _.INITIAL:{Uo(this,e);break}case _.BEFORE_HTML:{la(this,e);break}case _.BEFORE_HEAD:{ua(this,e);break}case _.IN_HEAD:{ca(this,e);break}case _.IN_HEAD_NO_SCRIPT:{da(this,e);break}case _.AFTER_HEAD:{fa(this,e);break}case _.IN_BODY:case _.IN_CAPTION:case _.IN_CELL:case _.IN_TEMPLATE:{mS(this,e);break}case _.TEXT:case _.IN_SELECT:case _.IN_SELECT_IN_TABLE:{this._insertCharacters(e);break}case _.IN_TABLE:case _.IN_TABLE_BODY:case _.IN_ROW:{cf(this,e);break}case _.IN_TABLE_TEXT:{CS(this,e);break}case _.IN_COLUMN_GROUP:{Zu(this,e);break}case _.AFTER_BODY:{Ju(this,e);break}case _.AFTER_AFTER_BODY:{bu(this,e);break}}}onNullCharacter(e){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){_L(this,e);return}switch(this.insertionMode){case _.INITIAL:{Uo(this,e);break}case _.BEFORE_HTML:{la(this,e);break}case _.BEFORE_HEAD:{ua(this,e);break}case _.IN_HEAD:{ca(this,e);break}case _.IN_HEAD_NO_SCRIPT:{da(this,e);break}case _.AFTER_HEAD:{fa(this,e);break}case _.TEXT:{this._insertCharacters(e);break}case _.IN_TABLE:case _.IN_TABLE_BODY:case _.IN_ROW:{cf(this,e);break}case _.IN_COLUMN_GROUP:{Zu(this,e);break}case _.AFTER_BODY:{Ju(this,e);break}case _.AFTER_AFTER_BODY:{bu(this,e);break}}}onComment(e){if(this.skipNextNewLine=!1,this.currentNotInHTML){Zh(this,e);return}switch(this.insertionMode){case _.INITIAL:case _.BEFORE_HTML:case _.BEFORE_HEAD:case _.IN_HEAD:case _.IN_HEAD_NO_SCRIPT:case _.AFTER_HEAD:case _.IN_BODY:case _.IN_TABLE:case _.IN_CAPTION:case _.IN_COLUMN_GROUP:case _.IN_TABLE_BODY:case _.IN_ROW:case _.IN_CELL:case _.IN_SELECT:case _.IN_SELECT_IN_TABLE:case _.IN_TEMPLATE:case _.IN_FRAMESET:case _.AFTER_FRAMESET:{Zh(this,e);break}case _.IN_TABLE_TEXT:{$o(this,e);break}case _.AFTER_BODY:{a8(this,e);break}case _.AFTER_AFTER_BODY:case _.AFTER_AFTER_FRAMESET:{l8(this,e);break}}}onDoctype(e){switch(this.skipNextNewLine=!1,this.insertionMode){case _.INITIAL:{u8(this,e);break}case _.BEFORE_HEAD:case _.IN_HEAD:case _.IN_HEAD_NO_SCRIPT:case _.AFTER_HEAD:{this._err(e,$.misplacedDoctype);break}case _.IN_TABLE_TEXT:{$o(this,e);break}}}onStartTag(e){this.skipNextNewLine=!1,this.currentToken=e,this._processStartTag(e),e.selfClosing&&!e.ackSelfClosing&&this._err(e,$.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(e){this.shouldProcessStartTagTokenInForeignContent(e)?RL(this,e):this._startTagOutsideForeignContent(e)}_startTagOutsideForeignContent(e){switch(this.insertionMode){case _.INITIAL:{Uo(this,e);break}case _.BEFORE_HTML:{c8(this,e);break}case _.BEFORE_HEAD:{f8(this,e);break}case _.IN_HEAD:{Xn(this,e);break}case _.IN_HEAD_NO_SCRIPT:{m8(this,e);break}case _.AFTER_HEAD:{b8(this,e);break}case _.IN_BODY:{Ot(this,e);break}case _.IN_TABLE:{no(this,e);break}case _.IN_TABLE_TEXT:{$o(this,e);break}case _.IN_CAPTION:{hL(this,e);break}case _.IN_COLUMN_GROUP:{Lm(this,e);break}case _.IN_TABLE_BODY:{Kc(this,e);break}case _.IN_ROW:{Gc(this,e);break}case _.IN_CELL:{gL(this,e);break}case _.IN_SELECT:{wS(this,e);break}case _.IN_SELECT_IN_TABLE:{yL(this,e);break}case _.IN_TEMPLATE:{TL(this,e);break}case _.AFTER_BODY:{xL(this,e);break}case _.IN_FRAMESET:{SL(this,e);break}case _.AFTER_FRAMESET:{kL(this,e);break}case _.AFTER_AFTER_BODY:{vL(this,e);break}case _.AFTER_AFTER_FRAMESET:{NL(this,e);break}}}onEndTag(e){this.skipNextNewLine=!1,this.currentToken=e,this.currentNotInHTML?ML(this,e):this._endTagOutsideForeignContent(e)}_endTagOutsideForeignContent(e){switch(this.insertionMode){case _.INITIAL:{Uo(this,e);break}case _.BEFORE_HTML:{d8(this,e);break}case _.BEFORE_HEAD:{h8(this,e);break}case _.IN_HEAD:{p8(this,e);break}case _.IN_HEAD_NO_SCRIPT:{g8(this,e);break}case _.AFTER_HEAD:{y8(this,e);break}case _.IN_BODY:{Yc(this,e);break}case _.TEXT:{rL(this,e);break}case _.IN_TABLE:{Va(this,e);break}case _.IN_TABLE_TEXT:{$o(this,e);break}case _.IN_CAPTION:{pL(this,e);break}case _.IN_COLUMN_GROUP:{mL(this,e);break}case _.IN_TABLE_BODY:{Jh(this,e);break}case _.IN_ROW:{SS(this,e);break}case _.IN_CELL:{bL(this,e);break}case _.IN_SELECT:{kS(this,e);break}case _.IN_SELECT_IN_TABLE:{EL(this,e);break}case _.IN_TEMPLATE:{CL(this,e);break}case _.AFTER_BODY:{vS(this,e);break}case _.IN_FRAMESET:{wL(this,e);break}case _.AFTER_FRAMESET:{AL(this,e);break}case _.AFTER_AFTER_BODY:{bu(this,e);break}}}onEof(e){switch(this.insertionMode){case _.INITIAL:{Uo(this,e);break}case _.BEFORE_HTML:{la(this,e);break}case _.BEFORE_HEAD:{ua(this,e);break}case _.IN_HEAD:{ca(this,e);break}case _.IN_HEAD_NO_SCRIPT:{da(this,e);break}case _.AFTER_HEAD:{fa(this,e);break}case _.IN_BODY:case _.IN_TABLE:case _.IN_CAPTION:case _.IN_COLUMN_GROUP:case _.IN_TABLE_BODY:case _.IN_ROW:case _.IN_CELL:case _.IN_SELECT:case _.IN_SELECT_IN_TABLE:{ES(this,e);break}case _.TEXT:{iL(this,e);break}case _.IN_TABLE_TEXT:{$o(this,e);break}case _.IN_TEMPLATE:{AS(this,e);break}case _.AFTER_BODY:case _.IN_FRAMESET:case _.AFTER_FRAMESET:case _.AFTER_AFTER_BODY:case _.AFTER_AFTER_FRAMESET:{Dm(this,e);break}}}onWhitespaceCharacter(e){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,e.chars.charCodeAt(0)===S.LINE_FEED)){if(e.chars.length===1)return;e.chars=e.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(e);return}switch(this.insertionMode){case _.IN_HEAD:case _.IN_HEAD_NO_SCRIPT:case _.AFTER_HEAD:case _.TEXT:case _.IN_COLUMN_GROUP:case _.IN_SELECT:case _.IN_SELECT_IN_TABLE:case _.IN_FRAMESET:case _.AFTER_FRAMESET:{this._insertCharacters(e);break}case _.IN_BODY:case _.IN_CAPTION:case _.IN_CELL:case _.IN_TEMPLATE:case _.AFTER_BODY:case _.AFTER_AFTER_BODY:case _.AFTER_AFTER_FRAMESET:{pS(this,e);break}case _.IN_TABLE:case _.IN_TABLE_BODY:case _.IN_ROW:{cf(this,e);break}case _.IN_TABLE_TEXT:{TS(this,e);break}}}}function t8(t,e){let n=t.activeFormattingElements.getElementEntryInScopeWithTagName(e.tagName);return n?t.openElements.contains(n.element)?t.openElements.hasInScope(e.tagID)||(n=null):(t.activeFormattingElements.removeEntry(n),n=null):yS(t,e),n}function n8(t,e){let n=null,r=t.openElements.stackTop;for(;r>=0;r--){const i=t.openElements.items[r];if(i===e.element)break;t._isSpecialElement(i,t.openElements.tagIDs[r])&&(n=i)}return n||(t.openElements.shortenToLength(Math.max(r,0)),t.activeFormattingElements.removeEntry(e)),n}function r8(t,e,n){let r=e,i=t.openElements.getCommonAncestor(e);for(let s=0,o=i;o!==n;s++,o=i){i=t.openElements.getCommonAncestor(o);const a=t.activeFormattingElements.getElementEntry(o),l=a&&s>=J5;!a||l?(l&&t.activeFormattingElements.removeEntry(a),t.openElements.remove(o)):(o=i8(t,a),r===e&&(t.activeFormattingElements.bookmark=a),t.treeAdapter.detachNode(r),t.treeAdapter.appendChild(o,r),r=o)}return r}function i8(t,e){const n=t.treeAdapter.getNamespaceURI(e.element),r=t.treeAdapter.createElement(e.token.tagName,n,e.token.attrs);return t.openElements.replace(e.element,r),e.element=r,r}function s8(t,e,n){const r=t.treeAdapter.getTagName(e),i=Wc(r);if(t._isElementCausesFosterParenting(i))t._fosterParentElement(n);else{const s=t.treeAdapter.getNamespaceURI(e);i===m.TEMPLATE&&s===K.HTML&&(e=t.treeAdapter.getTemplateContent(e)),t.treeAdapter.appendChild(e,n)}}function o8(t,e,n){const r=t.treeAdapter.getNamespaceURI(n.element),{token:i}=n,s=t.treeAdapter.createElement(i.tagName,r,i.attrs);t._adoptNodes(e,s),t.treeAdapter.appendChild(e,s),t.activeFormattingElements.insertElementAfterBookmark(s,i),t.activeFormattingElements.removeEntry(n),t.openElements.remove(n.element),t.openElements.insertAfter(e,s,i.tagID)}function Om(t,e){for(let n=0;n<Z5;n++){const r=t8(t,e);if(!r)break;const i=n8(t,r);if(!i)break;t.activeFormattingElements.bookmark=r;const s=r8(t,i,r.element),o=t.openElements.getCommonAncestor(r.element);t.treeAdapter.detachNode(s),o&&s8(t,o,s),o8(t,i,r)}}function Zh(t,e){t._appendCommentNode(e,t.openElements.currentTmplContentOrNode)}function a8(t,e){t._appendCommentNode(e,t.openElements.items[0])}function l8(t,e){t._appendCommentNode(e,t.document)}function Dm(t,e){if(t.stopped=!0,e.location){const n=t.fragmentContext?0:2;for(let r=t.openElements.stackTop;r>=n;r--)t._setEndLocation(t.openElements.items[r],e);if(!t.fragmentContext&&t.openElements.stackTop>=0){const r=t.openElements.items[0],i=t.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(t._setEndLocation(r,e),t.openElements.stackTop>=1)){const s=t.openElements.items[1],o=t.treeAdapter.getNodeSourceCodeLocation(s);o&&!o.endTag&&t._setEndLocation(s,e)}}}}function u8(t,e){t._setDocumentType(e);const n=e.forceQuirks?kn.QUIRKS:H5(e);F5(e)||t._err(e,$.nonConformingDoctype),t.treeAdapter.setDocumentMode(t.document,n),t.insertionMode=_.BEFORE_HTML}function Uo(t,e){t._err(e,$.missingDoctype,!0),t.treeAdapter.setDocumentMode(t.document,kn.QUIRKS),t.insertionMode=_.BEFORE_HTML,t._processToken(e)}function c8(t,e){e.tagID===m.HTML?(t._insertElement(e,K.HTML),t.insertionMode=_.BEFORE_HEAD):la(t,e)}function d8(t,e){const n=e.tagID;(n===m.HTML||n===m.HEAD||n===m.BODY||n===m.BR)&&la(t,e)}function la(t,e){t._insertFakeRootElement(),t.insertionMode=_.BEFORE_HEAD,t._processToken(e)}function f8(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.HEAD:{t._insertElement(e,K.HTML),t.headElement=t.openElements.current,t.insertionMode=_.IN_HEAD;break}default:ua(t,e)}}function h8(t,e){const n=e.tagID;n===m.HEAD||n===m.BODY||n===m.HTML||n===m.BR?ua(t,e):t._err(e,$.endTagWithoutMatchingOpenElement)}function ua(t,e){t._insertFakeElement(L.HEAD,m.HEAD),t.headElement=t.openElements.current,t.insertionMode=_.IN_HEAD,t._processToken(e)}function Xn(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:{t._appendElement(e,K.HTML),e.ackSelfClosing=!0;break}case m.TITLE:{t._switchToTextParsing(e,Zt.RCDATA);break}case m.NOSCRIPT:{t.options.scriptingEnabled?t._switchToTextParsing(e,Zt.RAWTEXT):(t._insertElement(e,K.HTML),t.insertionMode=_.IN_HEAD_NO_SCRIPT);break}case m.NOFRAMES:case m.STYLE:{t._switchToTextParsing(e,Zt.RAWTEXT);break}case m.SCRIPT:{t._switchToTextParsing(e,Zt.SCRIPT_DATA);break}case m.TEMPLATE:{t._insertTemplate(e),t.activeFormattingElements.insertMarker(),t.framesetOk=!1,t.insertionMode=_.IN_TEMPLATE,t.tmplInsertionModeStack.unshift(_.IN_TEMPLATE);break}case m.HEAD:{t._err(e,$.misplacedStartTagForHeadElement);break}default:ca(t,e)}}function p8(t,e){switch(e.tagID){case m.HEAD:{t.openElements.pop(),t.insertionMode=_.AFTER_HEAD;break}case m.BODY:case m.BR:case m.HTML:{ca(t,e);break}case m.TEMPLATE:{ts(t,e);break}default:t._err(e,$.endTagWithoutMatchingOpenElement)}}function ts(t,e){t.openElements.tmplCount>0?(t.openElements.generateImpliedEndTagsThoroughly(),t.openElements.currentTagId!==m.TEMPLATE&&t._err(e,$.closingOfElementWithOpenChildElements),t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode()):t._err(e,$.endTagWithoutMatchingOpenElement)}function ca(t,e){t.openElements.pop(),t.insertionMode=_.AFTER_HEAD,t._processToken(e)}function m8(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.BASEFONT:case m.BGSOUND:case m.HEAD:case m.LINK:case m.META:case m.NOFRAMES:case m.STYLE:{Xn(t,e);break}case m.NOSCRIPT:{t._err(e,$.nestedNoscriptInHead);break}default:da(t,e)}}function g8(t,e){switch(e.tagID){case m.NOSCRIPT:{t.openElements.pop(),t.insertionMode=_.IN_HEAD;break}case m.BR:{da(t,e);break}default:t._err(e,$.endTagWithoutMatchingOpenElement)}}function da(t,e){const n=e.type===Oe.EOF?$.openElementsLeftAfterEof:$.disallowedContentInNoscriptInHead;t._err(e,n),t.openElements.pop(),t.insertionMode=_.IN_HEAD,t._processToken(e)}function b8(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.BODY:{t._insertElement(e,K.HTML),t.framesetOk=!1,t.insertionMode=_.IN_BODY;break}case m.FRAMESET:{t._insertElement(e,K.HTML),t.insertionMode=_.IN_FRAMESET;break}case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{t._err(e,$.abandonedHeadElementChild),t.openElements.push(t.headElement,m.HEAD),Xn(t,e),t.openElements.remove(t.headElement);break}case m.HEAD:{t._err(e,$.misplacedStartTagForHeadElement);break}default:fa(t,e)}}function y8(t,e){switch(e.tagID){case m.BODY:case m.HTML:case m.BR:{fa(t,e);break}case m.TEMPLATE:{ts(t,e);break}default:t._err(e,$.endTagWithoutMatchingOpenElement)}}function fa(t,e){t._insertFakeElement(L.BODY,m.BODY),t.insertionMode=_.IN_BODY,qc(t,e)}function qc(t,e){switch(e.type){case Oe.CHARACTER:{mS(t,e);break}case Oe.WHITESPACE_CHARACTER:{pS(t,e);break}case Oe.COMMENT:{Zh(t,e);break}case Oe.START_TAG:{Ot(t,e);break}case Oe.END_TAG:{Yc(t,e);break}case Oe.EOF:{ES(t,e);break}}}function pS(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e)}function mS(t,e){t._reconstructActiveFormattingElements(),t._insertCharacters(e),t.framesetOk=!1}function E8(t,e){t.openElements.tmplCount===0&&t.treeAdapter.adoptAttributes(t.openElements.items[0],e.attrs)}function T8(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t.openElements.tmplCount===0&&(t.framesetOk=!1,t.treeAdapter.adoptAttributes(n,e.attrs))}function C8(t,e){const n=t.openElements.tryPeekProperlyNestedBodyElement();t.framesetOk&&n&&(t.treeAdapter.detachNode(n),t.openElements.popAllUpToHtmlElement(),t._insertElement(e,K.HTML),t.insertionMode=_.IN_FRAMESET)}function x8(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,K.HTML)}function S8(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t.openElements.currentTagId!==void 0&&Qh.has(t.openElements.currentTagId)&&t.openElements.pop(),t._insertElement(e,K.HTML)}function w8(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,K.HTML),t.skipNextNewLine=!0,t.framesetOk=!1}function k8(t,e){const n=t.openElements.tmplCount>0;(!t.formElement||n)&&(t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,K.HTML),n||(t.formElement=t.openElements.current))}function A8(t,e){t.framesetOk=!1;const n=e.tagID;for(let r=t.openElements.stackTop;r>=0;r--){const i=t.openElements.tagIDs[r];if(n===m.LI&&i===m.LI||(n===m.DD||n===m.DT)&&(i===m.DD||i===m.DT)){t.openElements.generateImpliedEndTagsWithExclusion(i),t.openElements.popUntilTagNamePopped(i);break}if(i!==m.ADDRESS&&i!==m.DIV&&i!==m.P&&t._isSpecialElement(t.openElements.items[r],i))break}t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,K.HTML)}function v8(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,K.HTML),t.tokenizer.state=Zt.PLAINTEXT}function N8(t,e){t.openElements.hasInScope(m.BUTTON)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.BUTTON)),t._reconstructActiveFormattingElements(),t._insertElement(e,K.HTML),t.framesetOk=!1}function _8(t,e){const n=t.activeFormattingElements.getElementEntryInScopeWithTagName(L.A);n&&(Om(t,e),t.openElements.remove(n.element),t.activeFormattingElements.removeEntry(n)),t._reconstructActiveFormattingElements(),t._insertElement(e,K.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function I8(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,K.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function R8(t,e){t._reconstructActiveFormattingElements(),t.openElements.hasInScope(m.NOBR)&&(Om(t,e),t._reconstructActiveFormattingElements()),t._insertElement(e,K.HTML),t.activeFormattingElements.pushElement(t.openElements.current,e)}function M8(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,K.HTML),t.activeFormattingElements.insertMarker(),t.framesetOk=!1}function O8(t,e){t.treeAdapter.getDocumentMode(t.document)!==kn.QUIRKS&&t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._insertElement(e,K.HTML),t.framesetOk=!1,t.insertionMode=_.IN_TABLE}function gS(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,K.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function bS(t){const e=iS(t,Fi.TYPE);return e!=null&&e.toLowerCase()===Q5}function D8(t,e){t._reconstructActiveFormattingElements(),t._appendElement(e,K.HTML),bS(e)||(t.framesetOk=!1),e.ackSelfClosing=!0}function L8(t,e){t._appendElement(e,K.HTML),e.ackSelfClosing=!0}function P8(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._appendElement(e,K.HTML),t.framesetOk=!1,e.ackSelfClosing=!0}function B8(t,e){e.tagName=L.IMG,e.tagID=m.IMG,gS(t,e)}function F8(t,e){t._insertElement(e,K.HTML),t.skipNextNewLine=!0,t.tokenizer.state=Zt.RCDATA,t.originalInsertionMode=t.insertionMode,t.framesetOk=!1,t.insertionMode=_.TEXT}function H8(t,e){t.openElements.hasInButtonScope(m.P)&&t._closePElement(),t._reconstructActiveFormattingElements(),t.framesetOk=!1,t._switchToTextParsing(e,Zt.RAWTEXT)}function U8(t,e){t.framesetOk=!1,t._switchToTextParsing(e,Zt.RAWTEXT)}function gb(t,e){t._switchToTextParsing(e,Zt.RAWTEXT)}function $8(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,K.HTML),t.framesetOk=!1,t.insertionMode=t.insertionMode===_.IN_TABLE||t.insertionMode===_.IN_CAPTION||t.insertionMode===_.IN_TABLE_BODY||t.insertionMode===_.IN_ROW||t.insertionMode===_.IN_CELL?_.IN_SELECT_IN_TABLE:_.IN_SELECT}function V8(t,e){t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._reconstructActiveFormattingElements(),t._insertElement(e,K.HTML)}function z8(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTags(),t._insertElement(e,K.HTML)}function j8(t,e){t.openElements.hasInScope(m.RUBY)&&t.openElements.generateImpliedEndTagsWithExclusion(m.RTC),t._insertElement(e,K.HTML)}function W8(t,e){t._reconstructActiveFormattingElements(),cS(e),Mm(e),e.selfClosing?t._appendElement(e,K.MATHML):t._insertElement(e,K.MATHML),e.ackSelfClosing=!0}function q8(t,e){t._reconstructActiveFormattingElements(),dS(e),Mm(e),e.selfClosing?t._appendElement(e,K.SVG):t._insertElement(e,K.SVG),e.ackSelfClosing=!0}function bb(t,e){t._reconstructActiveFormattingElements(),t._insertElement(e,K.HTML)}function Ot(t,e){switch(e.tagID){case m.I:case m.S:case m.B:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.SMALL:case m.STRIKE:case m.STRONG:{I8(t,e);break}case m.A:{_8(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{S8(t,e);break}case m.P:case m.DL:case m.OL:case m.UL:case m.DIV:case m.DIR:case m.NAV:case m.MAIN:case m.MENU:case m.ASIDE:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.DETAILS:case m.ADDRESS:case m.ARTICLE:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{x8(t,e);break}case m.LI:case m.DD:case m.DT:{A8(t,e);break}case m.BR:case m.IMG:case m.WBR:case m.AREA:case m.EMBED:case m.KEYGEN:{gS(t,e);break}case m.HR:{P8(t,e);break}case m.RB:case m.RTC:{z8(t,e);break}case m.RT:case m.RP:{j8(t,e);break}case m.PRE:case m.LISTING:{w8(t,e);break}case m.XMP:{H8(t,e);break}case m.SVG:{q8(t,e);break}case m.HTML:{E8(t,e);break}case m.BASE:case m.LINK:case m.META:case m.STYLE:case m.TITLE:case m.SCRIPT:case m.BGSOUND:case m.BASEFONT:case m.TEMPLATE:{Xn(t,e);break}case m.BODY:{T8(t,e);break}case m.FORM:{k8(t,e);break}case m.NOBR:{R8(t,e);break}case m.MATH:{W8(t,e);break}case m.TABLE:{O8(t,e);break}case m.INPUT:{D8(t,e);break}case m.PARAM:case m.TRACK:case m.SOURCE:{L8(t,e);break}case m.IMAGE:{B8(t,e);break}case m.BUTTON:{N8(t,e);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{M8(t,e);break}case m.IFRAME:{U8(t,e);break}case m.SELECT:{$8(t,e);break}case m.OPTION:case m.OPTGROUP:{V8(t,e);break}case m.NOEMBED:case m.NOFRAMES:{gb(t,e);break}case m.FRAMESET:{C8(t,e);break}case m.TEXTAREA:{F8(t,e);break}case m.NOSCRIPT:{t.options.scriptingEnabled?gb(t,e):bb(t,e);break}case m.PLAINTEXT:{v8(t,e);break}case m.COL:case m.TH:case m.TD:case m.TR:case m.HEAD:case m.FRAME:case m.TBODY:case m.TFOOT:case m.THEAD:case m.CAPTION:case m.COLGROUP:break;default:bb(t,e)}}function Y8(t,e){if(t.openElements.hasInScope(m.BODY)&&(t.insertionMode=_.AFTER_BODY,t.options.sourceCodeLocationInfo)){const n=t.openElements.tryPeekProperlyNestedBodyElement();n&&t._setEndLocation(n,e)}}function K8(t,e){t.openElements.hasInScope(m.BODY)&&(t.insertionMode=_.AFTER_BODY,vS(t,e))}function G8(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n))}function X8(t){const e=t.openElements.tmplCount>0,{formElement:n}=t;e||(t.formElement=null),(n||e)&&t.openElements.hasInScope(m.FORM)&&(t.openElements.generateImpliedEndTags(),e?t.openElements.popUntilTagNamePopped(m.FORM):n&&t.openElements.remove(n))}function Q8(t){t.openElements.hasInButtonScope(m.P)||t._insertFakeElement(L.P,m.P),t._closePElement()}function Z8(t){t.openElements.hasInListItemScope(m.LI)&&(t.openElements.generateImpliedEndTagsWithExclusion(m.LI),t.openElements.popUntilTagNamePopped(m.LI))}function J8(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTagsWithExclusion(n),t.openElements.popUntilTagNamePopped(n))}function eL(t){t.openElements.hasNumberedHeaderInScope()&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilNumberedHeaderPopped())}function tL(t,e){const n=e.tagID;t.openElements.hasInScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker())}function nL(t){t._reconstructActiveFormattingElements(),t._insertFakeElement(L.BR,m.BR),t.openElements.pop(),t.framesetOk=!1}function yS(t,e){const n=e.tagName,r=e.tagID;for(let i=t.openElements.stackTop;i>0;i--){const s=t.openElements.items[i],o=t.openElements.tagIDs[i];if(r===o&&(r!==m.UNKNOWN||t.treeAdapter.getTagName(s)===n)){t.openElements.generateImpliedEndTagsWithExclusion(r),t.openElements.stackTop>=i&&t.openElements.shortenToLength(i);break}if(t._isSpecialElement(s,o))break}}function Yc(t,e){switch(e.tagID){case m.A:case m.B:case m.I:case m.S:case m.U:case m.EM:case m.TT:case m.BIG:case m.CODE:case m.FONT:case m.NOBR:case m.SMALL:case m.STRIKE:case m.STRONG:{Om(t,e);break}case m.P:{Q8(t);break}case m.DL:case m.UL:case m.OL:case m.DIR:case m.DIV:case m.NAV:case m.PRE:case m.MAIN:case m.MENU:case m.ASIDE:case m.BUTTON:case m.CENTER:case m.FIGURE:case m.FOOTER:case m.HEADER:case m.HGROUP:case m.DIALOG:case m.ADDRESS:case m.ARTICLE:case m.DETAILS:case m.SEARCH:case m.SECTION:case m.SUMMARY:case m.LISTING:case m.FIELDSET:case m.BLOCKQUOTE:case m.FIGCAPTION:{G8(t,e);break}case m.LI:{Z8(t);break}case m.DD:case m.DT:{J8(t,e);break}case m.H1:case m.H2:case m.H3:case m.H4:case m.H5:case m.H6:{eL(t);break}case m.BR:{nL(t);break}case m.BODY:{Y8(t,e);break}case m.HTML:{K8(t,e);break}case m.FORM:{X8(t);break}case m.APPLET:case m.OBJECT:case m.MARQUEE:{tL(t,e);break}case m.TEMPLATE:{ts(t,e);break}default:yS(t,e)}}function ES(t,e){t.tmplInsertionModeStack.length>0?AS(t,e):Dm(t,e)}function rL(t,e){var n;e.tagID===m.SCRIPT&&((n=t.scriptHandler)===null||n===void 0||n.call(t,t.openElements.current)),t.openElements.pop(),t.insertionMode=t.originalInsertionMode}function iL(t,e){t._err(e,$.eofInElementThatCanContainOnlyText),t.openElements.pop(),t.insertionMode=t.originalInsertionMode,t.onEof(e)}function cf(t,e){if(t.openElements.currentTagId!==void 0&&fS.has(t.openElements.currentTagId))switch(t.pendingCharacterTokens.length=0,t.hasNonWhitespacePendingCharacterToken=!1,t.originalInsertionMode=t.insertionMode,t.insertionMode=_.IN_TABLE_TEXT,e.type){case Oe.CHARACTER:{CS(t,e);break}case Oe.WHITESPACE_CHARACTER:{TS(t,e);break}}else ul(t,e)}function sL(t,e){t.openElements.clearBackToTableContext(),t.activeFormattingElements.insertMarker(),t._insertElement(e,K.HTML),t.insertionMode=_.IN_CAPTION}function oL(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,K.HTML),t.insertionMode=_.IN_COLUMN_GROUP}function aL(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(L.COLGROUP,m.COLGROUP),t.insertionMode=_.IN_COLUMN_GROUP,Lm(t,e)}function lL(t,e){t.openElements.clearBackToTableContext(),t._insertElement(e,K.HTML),t.insertionMode=_.IN_TABLE_BODY}function uL(t,e){t.openElements.clearBackToTableContext(),t._insertFakeElement(L.TBODY,m.TBODY),t.insertionMode=_.IN_TABLE_BODY,Kc(t,e)}function cL(t,e){t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode(),t._processStartTag(e))}function dL(t,e){bS(e)?t._appendElement(e,K.HTML):ul(t,e),e.ackSelfClosing=!0}function fL(t,e){!t.formElement&&t.openElements.tmplCount===0&&(t._insertElement(e,K.HTML),t.formElement=t.openElements.current,t.openElements.pop())}function no(t,e){switch(e.tagID){case m.TD:case m.TH:case m.TR:{uL(t,e);break}case m.STYLE:case m.SCRIPT:case m.TEMPLATE:{Xn(t,e);break}case m.COL:{aL(t,e);break}case m.FORM:{fL(t,e);break}case m.TABLE:{cL(t,e);break}case m.TBODY:case m.TFOOT:case m.THEAD:{lL(t,e);break}case m.INPUT:{dL(t,e);break}case m.CAPTION:{sL(t,e);break}case m.COLGROUP:{oL(t,e);break}default:ul(t,e)}}function Va(t,e){switch(e.tagID){case m.TABLE:{t.openElements.hasInTableScope(m.TABLE)&&(t.openElements.popUntilTagNamePopped(m.TABLE),t._resetInsertionMode());break}case m.TEMPLATE:{ts(t,e);break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:ul(t,e)}}function ul(t,e){const n=t.fosterParentingEnabled;t.fosterParentingEnabled=!0,qc(t,e),t.fosterParentingEnabled=n}function TS(t,e){t.pendingCharacterTokens.push(e)}function CS(t,e){t.pendingCharacterTokens.push(e),t.hasNonWhitespacePendingCharacterToken=!0}function $o(t,e){let n=0;if(t.hasNonWhitespacePendingCharacterToken)for(;n<t.pendingCharacterTokens.length;n++)ul(t,t.pendingCharacterTokens[n]);else for(;n<t.pendingCharacterTokens.length;n++)t._insertCharacters(t.pendingCharacterTokens[n]);t.insertionMode=t.originalInsertionMode,t._processToken(e)}const xS=new Set([m.CAPTION,m.COL,m.COLGROUP,m.TBODY,m.TD,m.TFOOT,m.TH,m.THEAD,m.TR]);function hL(t,e){const n=e.tagID;xS.has(n)?t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=_.IN_TABLE,no(t,e)):Ot(t,e)}function pL(t,e){const n=e.tagID;switch(n){case m.CAPTION:case m.TABLE:{t.openElements.hasInTableScope(m.CAPTION)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(m.CAPTION),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=_.IN_TABLE,n===m.TABLE&&Va(t,e));break}case m.BODY:case m.COL:case m.COLGROUP:case m.HTML:case m.TBODY:case m.TD:case m.TFOOT:case m.TH:case m.THEAD:case m.TR:break;default:Yc(t,e)}}function Lm(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.COL:{t._appendElement(e,K.HTML),e.ackSelfClosing=!0;break}case m.TEMPLATE:{Xn(t,e);break}default:Zu(t,e)}}function mL(t,e){switch(e.tagID){case m.COLGROUP:{t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=_.IN_TABLE);break}case m.TEMPLATE:{ts(t,e);break}case m.COL:break;default:Zu(t,e)}}function Zu(t,e){t.openElements.currentTagId===m.COLGROUP&&(t.openElements.pop(),t.insertionMode=_.IN_TABLE,t._processToken(e))}function Kc(t,e){switch(e.tagID){case m.TR:{t.openElements.clearBackToTableBodyContext(),t._insertElement(e,K.HTML),t.insertionMode=_.IN_ROW;break}case m.TH:case m.TD:{t.openElements.clearBackToTableBodyContext(),t._insertFakeElement(L.TR,m.TR),t.insertionMode=_.IN_ROW,Gc(t,e);break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=_.IN_TABLE,no(t,e));break}default:no(t,e)}}function Jh(t,e){const n=e.tagID;switch(e.tagID){case m.TBODY:case m.TFOOT:case m.THEAD:{t.openElements.hasInTableScope(n)&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=_.IN_TABLE);break}case m.TABLE:{t.openElements.hasTableBodyContextInTableScope()&&(t.openElements.clearBackToTableBodyContext(),t.openElements.pop(),t.insertionMode=_.IN_TABLE,Va(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:case m.TR:break;default:Va(t,e)}}function Gc(t,e){switch(e.tagID){case m.TH:case m.TD:{t.openElements.clearBackToTableRowContext(),t._insertElement(e,K.HTML),t.insertionMode=_.IN_CELL,t.activeFormattingElements.insertMarker();break}case m.CAPTION:case m.COL:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=_.IN_TABLE_BODY,Kc(t,e));break}default:no(t,e)}}function SS(t,e){switch(e.tagID){case m.TR:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=_.IN_TABLE_BODY);break}case m.TABLE:{t.openElements.hasInTableScope(m.TR)&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=_.IN_TABLE_BODY,Jh(t,e));break}case m.TBODY:case m.TFOOT:case m.THEAD:{(t.openElements.hasInTableScope(e.tagID)||t.openElements.hasInTableScope(m.TR))&&(t.openElements.clearBackToTableRowContext(),t.openElements.pop(),t.insertionMode=_.IN_TABLE_BODY,Jh(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:case m.TD:case m.TH:break;default:Va(t,e)}}function gL(t,e){const n=e.tagID;xS.has(n)?(t.openElements.hasInTableScope(m.TD)||t.openElements.hasInTableScope(m.TH))&&(t._closeTableCell(),Gc(t,e)):Ot(t,e)}function bL(t,e){const n=e.tagID;switch(n){case m.TD:case m.TH:{t.openElements.hasInTableScope(n)&&(t.openElements.generateImpliedEndTags(),t.openElements.popUntilTagNamePopped(n),t.activeFormattingElements.clearToLastMarker(),t.insertionMode=_.IN_ROW);break}case m.TABLE:case m.TBODY:case m.TFOOT:case m.THEAD:case m.TR:{t.openElements.hasInTableScope(n)&&(t._closeTableCell(),SS(t,e));break}case m.BODY:case m.CAPTION:case m.COL:case m.COLGROUP:case m.HTML:break;default:Yc(t,e)}}function wS(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t._insertElement(e,K.HTML);break}case m.OPTGROUP:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._insertElement(e,K.HTML);break}case m.HR:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop(),t._appendElement(e,K.HTML),e.ackSelfClosing=!0;break}case m.INPUT:case m.KEYGEN:case m.TEXTAREA:case m.SELECT:{t.openElements.hasInSelectScope(m.SELECT)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),e.tagID!==m.SELECT&&t._processStartTag(e));break}case m.SCRIPT:case m.TEMPLATE:{Xn(t,e);break}}}function kS(t,e){switch(e.tagID){case m.OPTGROUP:{t.openElements.stackTop>0&&t.openElements.currentTagId===m.OPTION&&t.openElements.tagIDs[t.openElements.stackTop-1]===m.OPTGROUP&&t.openElements.pop(),t.openElements.currentTagId===m.OPTGROUP&&t.openElements.pop();break}case m.OPTION:{t.openElements.currentTagId===m.OPTION&&t.openElements.pop();break}case m.SELECT:{t.openElements.hasInSelectScope(m.SELECT)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode());break}case m.TEMPLATE:{ts(t,e);break}}}function yL(t,e){const n=e.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),t._processStartTag(e)):wS(t,e)}function EL(t,e){const n=e.tagID;n===m.CAPTION||n===m.TABLE||n===m.TBODY||n===m.TFOOT||n===m.THEAD||n===m.TR||n===m.TD||n===m.TH?t.openElements.hasInTableScope(n)&&(t.openElements.popUntilTagNamePopped(m.SELECT),t._resetInsertionMode(),t.onEndTag(e)):kS(t,e)}function TL(t,e){switch(e.tagID){case m.BASE:case m.BASEFONT:case m.BGSOUND:case m.LINK:case m.META:case m.NOFRAMES:case m.SCRIPT:case m.STYLE:case m.TEMPLATE:case m.TITLE:{Xn(t,e);break}case m.CAPTION:case m.COLGROUP:case m.TBODY:case m.TFOOT:case m.THEAD:{t.tmplInsertionModeStack[0]=_.IN_TABLE,t.insertionMode=_.IN_TABLE,no(t,e);break}case m.COL:{t.tmplInsertionModeStack[0]=_.IN_COLUMN_GROUP,t.insertionMode=_.IN_COLUMN_GROUP,Lm(t,e);break}case m.TR:{t.tmplInsertionModeStack[0]=_.IN_TABLE_BODY,t.insertionMode=_.IN_TABLE_BODY,Kc(t,e);break}case m.TD:case m.TH:{t.tmplInsertionModeStack[0]=_.IN_ROW,t.insertionMode=_.IN_ROW,Gc(t,e);break}default:t.tmplInsertionModeStack[0]=_.IN_BODY,t.insertionMode=_.IN_BODY,Ot(t,e)}}function CL(t,e){e.tagID===m.TEMPLATE&&ts(t,e)}function AS(t,e){t.openElements.tmplCount>0?(t.openElements.popUntilTagNamePopped(m.TEMPLATE),t.activeFormattingElements.clearToLastMarker(),t.tmplInsertionModeStack.shift(),t._resetInsertionMode(),t.onEof(e)):Dm(t,e)}function xL(t,e){e.tagID===m.HTML?Ot(t,e):Ju(t,e)}function vS(t,e){var n;if(e.tagID===m.HTML){if(t.fragmentContext||(t.insertionMode=_.AFTER_AFTER_BODY),t.options.sourceCodeLocationInfo&&t.openElements.tagIDs[0]===m.HTML){t._setEndLocation(t.openElements.items[0],e);const r=t.openElements.items[1];r&&!(!((n=t.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&t._setEndLocation(r,e)}}else Ju(t,e)}function Ju(t,e){t.insertionMode=_.IN_BODY,qc(t,e)}function SL(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.FRAMESET:{t._insertElement(e,K.HTML);break}case m.FRAME:{t._appendElement(e,K.HTML),e.ackSelfClosing=!0;break}case m.NOFRAMES:{Xn(t,e);break}}}function wL(t,e){e.tagID===m.FRAMESET&&!t.openElements.isRootHtmlElementCurrent()&&(t.openElements.pop(),!t.fragmentContext&&t.openElements.currentTagId!==m.FRAMESET&&(t.insertionMode=_.AFTER_FRAMESET))}function kL(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.NOFRAMES:{Xn(t,e);break}}}function AL(t,e){e.tagID===m.HTML&&(t.insertionMode=_.AFTER_AFTER_FRAMESET)}function vL(t,e){e.tagID===m.HTML?Ot(t,e):bu(t,e)}function bu(t,e){t.insertionMode=_.IN_BODY,qc(t,e)}function NL(t,e){switch(e.tagID){case m.HTML:{Ot(t,e);break}case m.NOFRAMES:{Xn(t,e);break}}}function _L(t,e){e.chars=Ye,t._insertCharacters(e)}function IL(t,e){t._insertCharacters(e),t.framesetOk=!1}function NS(t){for(;t.treeAdapter.getNamespaceURI(t.openElements.current)!==K.HTML&&t.openElements.currentTagId!==void 0&&!t._isIntegrationPoint(t.openElements.currentTagId,t.openElements.current);)t.openElements.pop()}function RL(t,e){if(q5(e))NS(t),t._startTagOutsideForeignContent(e);else{const n=t._getAdjustedCurrentElement(),r=t.treeAdapter.getNamespaceURI(n);r===K.MATHML?cS(e):r===K.SVG&&(Y5(e),dS(e)),Mm(e),e.selfClosing?t._appendElement(e,r):t._insertElement(e,r),e.ackSelfClosing=!0}}function ML(t,e){if(e.tagID===m.P||e.tagID===m.BR){NS(t),t._endTagOutsideForeignContent(e);return}for(let n=t.openElements.stackTop;n>0;n--){const r=t.openElements.items[n];if(t.treeAdapter.getNamespaceURI(r)===K.HTML){t._endTagOutsideForeignContent(e);break}const i=t.treeAdapter.getTagName(r);if(i.toLowerCase()===e.tagName){e.tagName=i,t.openElements.shortenToLength(n);break}}}L.AREA,L.BASE,L.BASEFONT,L.BGSOUND,L.BR,L.COL,L.EMBED,L.FRAME,L.HR,L.IMG,L.INPUT,L.KEYGEN,L.LINK,L.META,L.PARAM,L.SOURCE,L.TRACK,L.WBR;function OL(t,e){return hS.parse(t,e)}function DL(t,e,n){typeof t=="string"&&(n=e,e=t,t=null);const r=hS.getFragmentParser(t,n);return r.tokenizer.write(e,!0),r.getFragment()}function ha(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?yb(t.position):"start"in t||"end"in t?yb(t):"line"in t||"column"in t?ep(t):""}function ep(t){return Eb(t&&t.line)+":"+Eb(t&&t.column)}function yb(t){return ep(t&&t.start)+"-"+ep(t&&t.end)}function Eb(t){return t&&typeof t=="number"?t:1}class Wt extends Error{constructor(e,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",s={},o=!1;if(n&&("line"in n&&"column"in n?s={place:n}:"start"in n&&"end"in n?s={place:n}:"type"in n?s={ancestors:[n],place:n.position}:s={...n}),typeof e=="string"?i=e:!s.cause&&e&&(o=!0,i=e.message,s.cause=e),!s.ruleId&&!s.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?s.ruleId=r:(s.source=r.slice(0,l),s.ruleId=r.slice(l+1))}if(!s.place&&s.ancestors&&s.ancestors){const l=s.ancestors[s.ancestors.length-1];l&&(s.place=l.position)}const a=s.place&&"start"in s.place?s.place.start:s.place;this.ancestors=s.ancestors||void 0,this.cause=s.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=a?a.line:void 0,this.name=ha(s.place)||"1:1",this.place=s.place||void 0,this.reason=this.message,this.ruleId=s.ruleId||void 0,this.source=s.source||void 0,this.stack=o&&s.cause&&typeof s.cause.stack=="string"?s.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Wt.prototype.file="";Wt.prototype.name="";Wt.prototype.reason="";Wt.prototype.message="";Wt.prototype.stack="";Wt.prototype.column=void 0;Wt.prototype.line=void 0;Wt.prototype.ancestors=void 0;Wt.prototype.cause=void 0;Wt.prototype.fatal=void 0;Wt.prototype.place=void 0;Wt.prototype.ruleId=void 0;Wt.prototype.source=void 0;const tr={basename:LL,dirname:PL,extname:BL,join:FL,sep:"/"};function LL(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');cl(t);let n=0,r=-1,i=t.length,s;if(e===void 0||e.length===0||e.length>t.length){for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else r<0&&(s=!0,r=i+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let o=-1,a=e.length-1;for(;i--;)if(t.codePointAt(i)===47){if(s){n=i+1;break}}else o<0&&(s=!0,o=i+1),a>-1&&(t.codePointAt(i)===e.codePointAt(a--)?a<0&&(r=i):(a=-1,r=o));return n===r?r=o:r<0&&(r=t.length),t.slice(n,r)}function PL(t){if(cl(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.codePointAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.codePointAt(0)===47?"/":".":e===1&&t.codePointAt(0)===47?"//":t.slice(0,e)}function BL(t){cl(t);let e=t.length,n=-1,r=0,i=-1,s=0,o;for(;e--;){const a=t.codePointAt(e);if(a===47){if(o){r=e+1;break}continue}n<0&&(o=!0,n=e+1),a===46?i<0?i=e:s!==1&&(s=1):i>-1&&(s=-1)}return i<0||n<0||s===0||s===1&&i===n-1&&i===r+1?"":t.slice(i,n)}function FL(...t){let e=-1,n;for(;++e<t.length;)cl(t[e]),t[e]&&(n=n===void 0?t[e]:n+"/"+t[e]);return n===void 0?".":HL(n)}function HL(t){cl(t);const e=t.codePointAt(0)===47;let n=UL(t,!e);return n.length===0&&!e&&(n="."),n.length>0&&t.codePointAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function UL(t,e){let n="",r=0,i=-1,s=0,o=-1,a,l;for(;++o<=t.length;){if(o<t.length)a=t.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||s===1))if(i!==o-1&&s===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,s=0;continue}}else if(n.length>0){n="",r=0,i=o,s=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(i+1,o):n=t.slice(i+1,o),r=o-i-1;i=o,s=0}else a===46&&s>-1?s++:s=-1}return n}function cl(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}const $L={cwd:VL};function VL(){return"/"}function tp(t){return!!(t!==null&&typeof t=="object"&&"href"in t&&t.href&&"protocol"in t&&t.protocol&&t.auth===void 0)}function zL(t){if(typeof t=="string")t=new URL(t);else if(!tp(t)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return jL(t)}function jL(t){if(t.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const e=t.pathname;let n=-1;for(;++n<e.length;)if(e.codePointAt(n)===37&&e.codePointAt(n+1)===50){const r=e.codePointAt(n+2);if(r===70||r===102){const i=new TypeError("File URL path must not include encoded / characters");throw i.code="ERR_INVALID_FILE_URL_PATH",i}}return decodeURIComponent(e)}const df=["history","path","basename","stem","extname","dirname"];class np{constructor(e){let n;e?tp(e)?n={path:e}:typeof e=="string"||WL(e)?n={value:e}:n=e:n={},this.cwd="cwd"in n?"":$L.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<df.length;){const s=df[r];s in n&&n[s]!==void 0&&n[s]!==null&&(this[s]=s==="history"?[...n[s]]:n[s])}let i;for(i in n)df.includes(i)||(this[i]=n[i])}get basename(){return typeof this.path=="string"?tr.basename(this.path):void 0}set basename(e){hf(e,"basename"),ff(e,"basename"),this.path=tr.join(this.dirname||"",e)}get dirname(){return typeof this.path=="string"?tr.dirname(this.path):void 0}set dirname(e){Tb(this.basename,"dirname"),this.path=tr.join(e||"",this.basename)}get extname(){return typeof this.path=="string"?tr.extname(this.path):void 0}set extname(e){if(ff(e,"extname"),Tb(this.dirname,"extname"),e){if(e.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(e.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=tr.join(this.dirname,this.stem+(e||""))}get path(){return this.history[this.history.length-1]}set path(e){tp(e)&&(e=zL(e)),hf(e,"path"),this.path!==e&&this.history.push(e)}get stem(){return typeof this.path=="string"?tr.basename(this.path,this.extname):void 0}set stem(e){hf(e,"stem"),ff(e,"stem"),this.path=tr.join(this.dirname||"",e+(this.extname||""))}fail(e,n,r){const i=this.message(e,n,r);throw i.fatal=!0,i}info(e,n,r){const i=this.message(e,n,r);return i.fatal=void 0,i}message(e,n,r){const i=new Wt(e,n,r);return this.path&&(i.name=this.path+":"+i.name,i.file=this.path),i.fatal=!1,this.messages.push(i),i}toString(e){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(e||void 0).decode(this.value)}}function ff(t,e){if(t&&t.includes(tr.sep))throw new Error("`"+e+"` cannot be a path: did not expect `"+tr.sep+"`")}function hf(t,e){if(!t)throw new Error("`"+e+"` cannot be empty")}function Tb(t,e){if(!t)throw new Error("Setting `"+e+"` requires `path` to be set too")}function WL(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}const qL={abandonedHeadElementChild:{reason:"Unexpected metadata element after head",description:"Unexpected element after head. Expected the element before `</head>`",url:!1},abruptClosingOfEmptyComment:{reason:"Unexpected abruptly closed empty comment",description:"Unexpected `>` or `->`. Expected `-->` to close comments"},abruptDoctypePublicIdentifier:{reason:"Unexpected abruptly closed public identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the public identifier"},abruptDoctypeSystemIdentifier:{reason:"Unexpected abruptly closed system identifier",description:"Unexpected `>`. Expected a closing `\"` or `'` after the identifier identifier"},absenceOfDigitsInNumericCharacterReference:{reason:"Unexpected non-digit at start of numeric character reference",description:"Unexpected `%c`. Expected `[0-9]` for decimal references or `[0-9a-fA-F]` for hexadecimal references"},cdataInHtmlContent:{reason:"Unexpected CDATA section in HTML",description:"Unexpected `<![CDATA[` in HTML. Remove it, use a comment, or encode special characters instead"},characterReferenceOutsideUnicodeRange:{reason:"Unexpected too big numeric character reference",description:"Unexpectedly high character reference. Expected character references to be at most hexadecimal 10ffff (or decimal 1114111)"},closingOfElementWithOpenChildElements:{reason:"Unexpected closing tag with open child elements",description:"Unexpectedly closing tag. Expected other tags to be closed first",url:!1},controlCharacterInInputStream:{reason:"Unexpected control character",description:"Unexpected control character `%x`. Expected a non-control code point, 0x00, or ASCII whitespace"},controlCharacterReference:{reason:"Unexpected control character reference",description:"Unexpectedly control character in reference. Expected a non-control code point, 0x00, or ASCII whitespace"},disallowedContentInNoscriptInHead:{reason:"Disallowed content inside `<noscript>` in `<head>`",description:"Unexpected text character `%c`. Only use text in `<noscript>`s in `<body>`",url:!1},duplicateAttribute:{reason:"Unexpected duplicate attribute",description:"Unexpectedly double attribute. Expected attributes to occur only once"},endTagWithAttributes:{reason:"Unexpected attribute on closing tag",description:"Unexpected attribute. Expected `>` instead"},endTagWithTrailingSolidus:{reason:"Unexpected slash at end of closing tag",description:"Unexpected `%c-1`. Expected `>` instead"},endTagWithoutMatchingOpenElement:{reason:"Unexpected unopened end tag",description:"Unexpected end tag. Expected no end tag or another end tag",url:!1},eofBeforeTagName:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected tag name instead"},eofInCdata:{reason:"Unexpected end of file in CDATA",description:"Unexpected end of file. Expected `]]>` to close the CDATA"},eofInComment:{reason:"Unexpected end of file in comment",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInDoctype:{reason:"Unexpected end of file in doctype",description:"Unexpected end of file. Expected a valid doctype (such as `<!doctype html>`)"},eofInElementThatCanContainOnlyText:{reason:"Unexpected end of file in element that can only contain text",description:"Unexpected end of file. Expected text or a closing tag",url:!1},eofInScriptHtmlCommentLikeText:{reason:"Unexpected end of file in comment inside script",description:"Unexpected end of file. Expected `-->` to close the comment"},eofInTag:{reason:"Unexpected end of file in tag",description:"Unexpected end of file. Expected `>` to close the tag"},incorrectlyClosedComment:{reason:"Incorrectly closed comment",description:"Unexpected `%c-1`. Expected `-->` to close the comment"},incorrectlyOpenedComment:{reason:"Incorrectly opened comment",description:"Unexpected `%c`. Expected `<!--` to open the comment"},invalidCharacterSequenceAfterDoctypeName:{reason:"Invalid sequence after doctype name",description:"Unexpected sequence at `%c`. Expected `public` or `system`"},invalidFirstCharacterOfTagName:{reason:"Invalid first character in tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},misplacedDoctype:{reason:"Misplaced doctype",description:"Unexpected doctype. Expected doctype before head",url:!1},misplacedStartTagForHeadElement:{reason:"Misplaced `<head>` start tag",description:"Unexpected start tag `<head>`. Expected `<head>` directly after doctype",url:!1},missingAttributeValue:{reason:"Missing attribute value",description:"Unexpected `%c-1`. Expected an attribute value or no `%c-1` instead"},missingDoctype:{reason:"Missing doctype before other content",description:"Expected a `<!doctype html>` before anything else",url:!1},missingDoctypeName:{reason:"Missing doctype name",description:"Unexpected doctype end at `%c`. Expected `html` instead"},missingDoctypePublicIdentifier:{reason:"Missing public identifier in doctype",description:"Unexpected `%c`. Expected identifier for `public` instead"},missingDoctypeSystemIdentifier:{reason:"Missing system identifier in doctype",description:'Unexpected `%c`. Expected identifier for `system` instead (suggested: `"about:legacy-compat"`)'},missingEndTagName:{reason:"Missing name in end tag",description:"Unexpected `%c`. Expected an ASCII letter instead"},missingQuoteBeforeDoctypePublicIdentifier:{reason:"Missing quote before public identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingQuoteBeforeDoctypeSystemIdentifier:{reason:"Missing quote before system identifier in doctype",description:"Unexpected `%c`. Expected `\"` or `'` instead"},missingSemicolonAfterCharacterReference:{reason:"Missing semicolon after character reference",description:"Unexpected `%c`. Expected `;` instead"},missingWhitespaceAfterDoctypePublicKeyword:{reason:"Missing whitespace after public identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceAfterDoctypeSystemKeyword:{reason:"Missing whitespace after system identifier in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBeforeDoctypeName:{reason:"Missing whitespace before doctype name",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenAttributes:{reason:"Missing whitespace between attributes",description:"Unexpected `%c`. Expected ASCII whitespace instead"},missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers:{reason:"Missing whitespace between public and system identifiers in doctype",description:"Unexpected `%c`. Expected ASCII whitespace instead"},nestedComment:{reason:"Unexpected nested comment",description:"Unexpected `<!--`. Expected `-->`"},nestedNoscriptInHead:{reason:"Unexpected nested `<noscript>` in `<head>`",description:"Unexpected `<noscript>`. Expected a closing tag or a meta element",url:!1},nonConformingDoctype:{reason:"Unexpected non-conforming doctype declaration",description:'Expected `<!doctype html>` or `<!doctype html system "about:legacy-compat">`',url:!1},nonVoidHtmlElementStartTagWithTrailingSolidus:{reason:"Unexpected trailing slash on start tag of non-void element",description:"Unexpected `/`. Expected `>` instead"},noncharacterCharacterReference:{reason:"Unexpected noncharacter code point referenced by character reference",description:"Unexpected code point. Do not use noncharacters in HTML"},noncharacterInInputStream:{reason:"Unexpected noncharacter character",description:"Unexpected code point `%x`. Do not use noncharacters in HTML"},nullCharacterReference:{reason:"Unexpected NULL character referenced by character reference",description:"Unexpected code point. Do not use NULL characters in HTML"},openElementsLeftAfterEof:{reason:"Unexpected end of file",description:"Unexpected end of file. Expected closing tag instead",url:!1},surrogateCharacterReference:{reason:"Unexpected surrogate character referenced by character reference",description:"Unexpected code point. Do not use lone surrogate characters in HTML"},surrogateInInputStream:{reason:"Unexpected surrogate character",description:"Unexpected code point `%x`. Do not use lone surrogate characters in HTML"},unexpectedCharacterAfterDoctypeSystemIdentifier:{reason:"Invalid character after system identifier in doctype",description:"Unexpected character at `%c`. Expected `>`"},unexpectedCharacterInAttributeName:{reason:"Unexpected character in attribute name",description:"Unexpected `%c`. Expected whitespace, `/`, `>`, `=`, or probably an ASCII letter"},unexpectedCharacterInUnquotedAttributeValue:{reason:"Unexpected character in unquoted attribute value",description:"Unexpected `%c`. Quote the attribute value to include it"},unexpectedEqualsSignBeforeAttributeName:{reason:"Unexpected equals sign before attribute name",description:"Unexpected `%c`. Add an attribute name before it"},unexpectedNullCharacter:{reason:"Unexpected NULL character",description:"Unexpected code point `%x`. Do not use NULL characters in HTML"},unexpectedQuestionMarkInsteadOfTagName:{reason:"Unexpected question mark instead of tag name",description:"Unexpected `%c`. Expected an ASCII letter instead"},unexpectedSolidusInTag:{reason:"Unexpected slash in tag",description:"Unexpected `%c-1`. Expected it followed by `>` or in a quoted attribute value"},unknownNamedCharacterReference:{reason:"Unexpected unknown named character reference",description:"Unexpected character reference. Expected known named character references"}},YL="https://html.spec.whatwg.org/multipage/parsing.html#parse-error-",KL=/-[a-z]/g,GL=/%c(?:([-+])(\d+))?/g,XL=/%x/g,QL={2:!0,1:!1,0:null},ZL={};function JL(t,e){const n=e||ZL,r=n.onerror,i=t instanceof np?t:new np(t),s=n.fragment?DL:OL,o=String(i),a=s(o,{sourceCodeLocationInfo:!0,onParseError:n.onerror?l:null,scriptingEnabled:!1});return n5(a,{file:i,space:n.space,verbose:n.verbose});function l(u){const c=u.code,d=eP(c),f=n[d],h=f??!0,p=typeof h=="number"?h:h?1:0;if(p){const b=qL[d],y=new Wt(g(b.reason),{place:{start:{line:u.startLine,column:u.startCol,offset:u.startOffset},end:{line:u.endLine,column:u.endCol,offset:u.endOffset}},ruleId:c,source:"hast-util-from-html"});i.path&&(y.file=i.path,y.name=i.path+":"+y.name),y.fatal=QL[p],y.note=g(b.description),y.url=b.url===!1?void 0:YL+c,r(y)}function g(b){return b.replace(GL,y).replace(XL,E);function y(T,v,R){const A=(R?Number.parseInt(R,10):0)*(v==="-"?-1:1),O=o.charAt(u.startOffset+A);return nP(O)}function E(){return rP(o.charCodeAt(u.startOffset))}}}}function eP(t){return t.replace(KL,tP)}function tP(t){return t.charAt(1).toUpperCase()}function nP(t){return t==="`"?"` ` `":t}function rP(t){return"0x"+t.toString(16).toUpperCase()}function PG(t){const e=this,{emitParseErrors:n,...r}={...e.data("settings"),...t};e.parser=i;function i(s,o){return JL(s,{...r,onerror:n?function(a){o.path&&(a.name=o.path+":"+a.name,a.file=o.path),o.messages.push(a)}:void 0})}}const _S=-1,Xc=0,pa=1,ec=2,Pm=3,Bm=4,Fm=5,Hm=6,IS=7,RS=8,iP=typeof self=="object"?self:globalThis,Cb=(t,e)=>{switch(t){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+t)}return new iP[t](e)},sP=(t,e)=>{const n=(i,s)=>(t.set(s,i),i),r=i=>{if(t.has(i))return t.get(i);const[s,o]=e[i];switch(s){case Xc:case _S:return n(o,i);case pa:{const a=n([],i);for(const l of o)a.push(r(l));return a}case ec:{const a=n({},i);for(const[l,u]of o)a[r(l)]=r(u);return a}case Pm:return n(new Date(o),i);case Bm:{const{source:a,flags:l}=o;return n(new RegExp(a,l),i)}case Fm:{const a=n(new Map,i);for(const[l,u]of o)a.set(r(l),r(u));return a}case Hm:{const a=n(new Set,i);for(const l of o)a.add(r(l));return a}case IS:{const{name:a,message:l}=o;return n(Cb(a,l),i)}case RS:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(Cb(s,o),i)};return r},xb=t=>sP(new Map,t)(0),cs="",{toString:oP}={},{keys:aP}=Object,Vo=t=>{const e=typeof t;if(e!=="object"||!t)return[Xc,e];const n=oP.call(t).slice(8,-1);switch(n){case"Array":return[pa,cs];case"Object":return[ec,cs];case"Date":return[Pm,cs];case"RegExp":return[Bm,cs];case"Map":return[Fm,cs];case"Set":return[Hm,cs];case"DataView":return[pa,n]}return n.includes("Array")?[pa,n]:n.includes("Error")?[IS,n]:[ec,n]},Hl=([t,e])=>t===Xc&&(e==="function"||e==="symbol"),lP=(t,e,n,r)=>{const i=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},s=o=>{if(n.has(o))return n.get(o);let[a,l]=Vo(o);switch(a){case Xc:{let c=o;switch(l){case"bigint":a=RS,c=o.toString();break;case"function":case"symbol":if(t)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([_S],o)}return i([a,c],o)}case pa:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),i([l,[...f]],o)}const c=[],d=i([a,c],o);for(const f of o)c.push(s(f));return d}case ec:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(e&&"toJSON"in o)return s(o.toJSON());const c=[],d=i([a,c],o);for(const f of aP(o))(t||!Hl(Vo(o[f])))&&c.push([s(f),s(o[f])]);return d}case Pm:return i([a,o.toISOString()],o);case Bm:{const{source:c,flags:d}=o;return i([a,{source:c,flags:d}],o)}case Fm:{const c=[],d=i([a,c],o);for(const[f,h]of o)(t||!(Hl(Vo(f))||Hl(Vo(h))))&&c.push([s(f),s(h)]);return d}case Hm:{const c=[],d=i([a,c],o);for(const f of o)(t||!Hl(Vo(f)))&&c.push(s(f));return d}}const{message:u}=o;return i([a,{name:l,message:u}],o)};return s},Sb=(t,{json:e,lossy:n}={})=>{const r=[];return lP(!(e||n),!!e,new Map,r)(t),r},ro=typeof structuredClone=="function"?(t,e)=>e&&("json"in e||"lossy"in e)?xb(Sb(t,e)):structuredClone(t):(t,e)=>xb(Sb(t,e)),Um=(function(t,e,n,r,i){const s=Qn(e);return MS(t)?s.call(i,t,n,r):!1}),Qn=(function(t){if(t==null)return dP;if(typeof t=="string")return cP(t);if(typeof t=="object")return uP(t);if(typeof t=="function")return $m(t);throw new Error("Expected function, string, or array as `test`")});function uP(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=Qn(t[n]);return $m(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function cP(t){return $m(e);function e(n){return n.tagName===t}}function $m(t){return e;function e(n,r,i){return!!(MS(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function dP(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="element"&&"tagName"in t&&typeof t.tagName=="string")}function MS(t){return t!==null&&typeof t=="object"&&"type"in t&&"tagName"in t}const OS=Qn(function(t){return t.tagName==="audio"||t.tagName==="canvas"||t.tagName==="embed"||t.tagName==="iframe"||t.tagName==="img"||t.tagName==="math"||t.tagName==="object"||t.tagName==="picture"||t.tagName==="svg"||t.tagName==="video"}),fP=/[ \t\n\f\r]/g;function dl(t){return typeof t=="object"?t.type==="text"?wb(t.value):!1:wb(t)}function wb(t){return t.replace(fP,"")===""}const xo=(function(t){if(t==null)return gP;if(typeof t=="function")return Qc(t);if(typeof t=="object")return Array.isArray(t)?hP(t):pP(t);if(typeof t=="string")return mP(t);throw new Error("Expected function, string, or object as test")});function hP(t){const e=[];let n=-1;for(;++n<t.length;)e[n]=xo(t[n]);return Qc(r);function r(...i){let s=-1;for(;++s<e.length;)if(e[s].apply(this,i))return!0;return!1}}function pP(t){const e=t;return Qc(n);function n(r){const i=r;let s;for(s in t)if(i[s]!==e[s])return!1;return!0}}function mP(t){return Qc(e);function e(n){return n&&n.type===t}}function Qc(t){return e;function e(n,r,i){return!!(bP(n)&&t.call(this,n,typeof r=="number"?r:void 0,i||void 0))}}function gP(){return!0}function bP(t){return t!==null&&typeof t=="object"&&"type"in t}const yP=["address","article","aside","blockquote","body","br","caption","center","col","colgroup","dd","dialog","dir","div","dl","dt","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","legend","li","li","listing","main","menu","nav","ol","optgroup","option","p","plaintext","pre","section","summary","table","tbody","td","td","tfoot","th","th","thead","tr","ul","wbr","xmp"],EP=["button","input","select","textarea"],TP=["area","base","basefont","dialog","datalist","head","link","meta","noembed","noframes","param","rp","script","source","style","template","track","title"],CP={},Vm=xo(["comment","doctype"]);function xP(t,e){DS(t,{collapse:_P((e||CP).newlines?vP:NP),whitespace:"normal"})}function DS(t,e){if("children"in t){const n={...e};return(t.type==="root"||BS(t))&&(n.before=!0,n.after=!0),n.whitespace=IP(t,e),wP(t,n)}if(t.type==="text"){if(e.whitespace==="normal")return SP(t,e);e.whitespace==="nowrap"&&(t.value=e.collapse(t.value))}return{ignore:Vm(t),stripAtStart:!1,remove:!1}}function SP(t,e){const n=e.collapse(t.value),r={ignore:!1,stripAtStart:!1,remove:!1};let i=0,s=n.length;return e.before&&kb(n.charAt(0))&&i++,i!==s&&kb(n.charAt(s-1))&&(e.after?s--:r.stripAtStart=!0),i===s?r.remove=!0:t.value=n.slice(i,s),r}function wP(t,e){let n=e.before;const r=e.after,i=t.children;let s=i.length,o=-1;for(;++o<s;){const a=DS(i[o],{...e,after:LS(i,o,r),before:n});a.remove?(i.splice(o,1),o--,s--):a.ignore||(n=a.stripAtStart),PS(i[o])&&(n=!1)}return{ignore:!1,stripAtStart:!!(n||r),remove:!1}}function LS(t,e,n){for(;++e<t.length;){const r=t[e];let i=kP(r);if(i===void 0&&"children"in r&&!AP(r)&&(i=LS(r.children,-1)),typeof i=="boolean")return i}return n}function kP(t){if(t.type==="element"){if(PS(t))return!1;if(BS(t))return!0}else if(t.type==="text"){if(!dl(t))return!1}else if(!Vm(t))return!1}function PS(t){return OS(t)||Um(t,EP)}function BS(t){return Um(t,yP)}function AP(t){return!!(t.type==="element"&&t.properties.hidden)||Vm(t)||Um(t,TP)}function kb(t){return t===" "||t===`
93
+ `}function vP(t){const e=/\r?\n|\r/.exec(t);return e?e[0]:" "}function NP(){return" "}function _P(t){return e;function e(n){return String(n).replace(/[\t\n\v\f\r ]+/g,t)}}function IP(t,e){if("tagName"in t&&t.properties)switch(t.tagName){case"listing":case"plaintext":case"script":case"style":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return t.properties.wrap?"pre-wrap":"pre";case"td":case"th":return t.properties.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}return e.whitespace}function RP(t){return function(e){xP(e,t)}}const FS=[],MP=!0,tc=!1,HS="skip";function US(t,e,n,r){let i;typeof e=="function"&&typeof n!="function"?(r=n,n=e):i=e;const s=xo(i),o=r?-1:1;a(t,void 0,[])();function a(l,u,c){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const h=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(h?"<"+h+">":""))+")"})}return f;function f(){let h=FS,p,g,b;if((!e||s(l,u,c[c.length-1]||void 0))&&(h=OP(n(l,c)),h[0]===tc))return h;if("children"in l&&l.children){const y=l;if(y.children&&h[0]!==HS)for(g=(r?y.children.length:-1)+o,b=c.concat(y);g>-1&&g<y.children.length;){const E=y.children[g];if(p=a(E,g,b)(),p[0]===tc)return p;g=typeof p[1]=="number"?p[1]:g+o}}return h}}}function OP(t){return Array.isArray(t)?t:typeof t=="number"?[MP,t]:t==null?FS:[t]}function io(t,e,n,r){let i,s,o;typeof e=="function"&&typeof n!="function"?(s=void 0,o=e,i=n):(s=e,o=n,i=r),US(t,s,a,i);function a(l,u){const c=u[u.length-1],d=c?c.children.indexOf(l):void 0;return o(l,d,c)}}const $S=zS("end"),VS=zS("start");function zS(t){return e;function e(n){const r=n&&n.position&&n.position[t]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function jS(t){const e=VS(t),n=$S(t);if(e&&n)return{start:e,end:n}}function DP(t,e){const n=e.properties||{},r=t.all(e),i={type:"link",url:t.resolve(String(n.href||"")||null),title:n.title?String(n.title):null,children:r};return t.patch(e,i),i}function LP(t,e){t.baseFound||(t.frozenBaseUrl=String(e.properties&&e.properties.href||"")||void 0,t.baseFound=!0)}function PP(t,e){const n={type:"blockquote",children:t.toFlow(t.all(e))};return t.patch(e,n),n}function BP(t,e){const n={type:"break"};return t.patch(e,n),n}const Ab=(function(t,e,n){const r=xo(n);if(!t||!t.type||!t.children)throw new Error("Expected parent node");if(typeof e=="number"){if(e<0||e===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(e=t.children.indexOf(e),e<0)throw new Error("Expected child node or index");for(;++e<t.children.length;)if(r(t.children[e],e,t))return t.children[e]}),vb=/\n/g,Nb=/[\t ]+/g,rp=Qn("br"),_b=Qn(jP),FP=Qn("p"),Ib=Qn("tr"),HP=Qn(["datalist","head","noembed","noframes","noscript","rp","script","style","template","title",zP,WP]),WS=Qn(["address","article","aside","blockquote","body","caption","center","dd","dialog","dir","dl","dt","div","figure","figcaption","footer","form,","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","legend","li","listing","main","menu","nav","ol","p","plaintext","pre","section","ul","xmp"]);function fl(t,e){const n={},r="children"in t?t.children:[],i=WS(t),s=KS(t,{whitespace:n.whitespace||"normal"}),o=[];(t.type==="text"||t.type==="comment")&&o.push(...YS(t,{breakBefore:!0,breakAfter:!0}));let a=-1;for(;++a<r.length;)o.push(...qS(r[a],t,{whitespace:s,breakBefore:a?void 0:i,breakAfter:a<r.length-1?rp(r[a+1]):i}));const l=[];let u;for(a=-1;++a<o.length;){const c=o[a];typeof c=="number"?u!==void 0&&c>u&&(u=c):c&&(u!==void 0&&u>-1&&l.push(`
94
+ `.repeat(u)||" "),u=-1,l.push(c))}return l.join("")}function qS(t,e,n){return t.type==="element"?UP(t,e,n):t.type==="text"?n.whitespace==="normal"?YS(t,n):$P(t):[]}function UP(t,e,n){const r=KS(t,n),i=t.children||[];let s=-1,o=[];if(HP(t))return o;let a,l;for(rp(t)||Ib(t)&&Ab(e,t,Ib)?l=`
95
+ `:FP(t)?(a=2,l=2):WS(t)&&(a=1,l=1);++s<i.length;)o=o.concat(qS(i[s],t,{whitespace:r,breakBefore:s?void 0:a,breakAfter:s<i.length-1?rp(i[s+1]):l}));return _b(t)&&Ab(e,t,_b)&&o.push(" "),a&&o.unshift(a),l&&o.push(l),o}function YS(t,e){const n=String(t.value),r=[],i=[];let s=0;for(;s<=n.length;){vb.lastIndex=s;const l=vb.exec(n),u=l&&"index"in l?l.index:n.length;r.push(VP(n.slice(s,u).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),s===0?e.breakBefore:!0,u===n.length?e.breakAfter:!0)),s=u+1}let o=-1,a;for(;++o<r.length;)r[o].charCodeAt(r[o].length-1)===8203||o<r.length-1&&r[o+1].charCodeAt(0)===8203?(i.push(r[o]),a=void 0):r[o]?(typeof a=="number"&&i.push(a),i.push(r[o]),a=0):(o===0||o===r.length-1)&&i.push(0);return i}function $P(t){return[String(t.value)]}function VP(t,e,n){const r=[];let i=0,s;for(;i<t.length;){Nb.lastIndex=i;const o=Nb.exec(t);s=o?o.index:t.length,!i&&!s&&o&&!e&&r.push(""),i!==s&&r.push(t.slice(i,s)),i=o?s+o[0].length:s}return i!==s&&!n&&r.push(""),r.join(" ")}function KS(t,e){if(t.type==="element"){const n=t.properties||{};switch(t.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":e.whitespace;case"textarea":return"pre-wrap"}}return e.whitespace}function zP(t){return!!(t.properties||{}).hidden}function jP(t){return t.tagName==="td"||t.tagName==="th"}function WP(t){return t.tagName==="dialog"&&!(t.properties||{}).open}function qP(t){const e=String(t);let n=e.length;for(;n>0;){const r=e.codePointAt(n-1);if(r!==void 0&&(r===10||r===13))n--;else break}return e.slice(0,n)}const pf="language-";function Ul(t,e){const n=e.children;let r=-1,i,s;if(e.tagName==="pre")for(;++r<n.length;){const a=n[r];if(a.type==="element"&&a.tagName==="code"&&a.properties&&a.properties.className&&Array.isArray(a.properties.className)){i=a.properties.className;break}}if(i){for(r=-1;++r<i.length;)if(String(i[r]).slice(0,pf.length)===pf){s=String(i[r]).slice(pf.length);break}}const o={type:"code",lang:s||null,meta:null,value:qP(fl(e))};return t.patch(e,o),o}function YP(t,e){const n={type:"html",value:"<!--"+e.value+"-->"};return t.patch(e,n),n}function mf(t,e){const r={type:"delete",children:t.all(e)};return t.patch(e,r),r}function zm(t){let e=-1;if(t.length>1){for(;++e<t.length;)if(t[e].spread)return!0}return!1}function KP(t,e){const n=[],r=[];let i=-1;for(;++i<e.children.length;){const a=e.children[i];a.type==="element"&&a.tagName==="div"?n.push(...a.children):n.push(a)}let s={definitions:[],titles:[]};for(i=-1;++i<n.length;){const a=n[i];if(a.type==="element"&&a.tagName==="dt"){const l=n[i-1];l&&l.type==="element"&&l.tagName==="dd"&&(r.push(s),s={definitions:[],titles:[]}),s.titles.push(a)}else s.definitions.push(a)}r.push(s),i=-1;const o=[];for(;++i<r.length;){const a=[...Rb(t,r[i].titles),...Rb(t,r[i].definitions)];a.length>0&&o.push({type:"listItem",spread:a.length>1,checked:null,children:a})}if(o.length>0){const a={type:"list",ordered:!1,start:null,spread:zm(o),children:o};return t.patch(e,a),a}}function Rb(t,e){const n=t.all({type:"root",children:e}),r=t.toSpecificContent(n,GP);return r.length===0?[]:r.length===1?r[0].children:[{type:"list",ordered:!1,start:null,spread:zm(r),children:r}]}function GP(){return{type:"listItem",spread:!1,checked:null,children:[]}}function $l(t,e){const r={type:"emphasis",children:t.all(e)};return t.patch(e,r),r}function jm(t){let e=0,n=t.length;for(;e<n&&t[e].type==="break";)e++;for(;n>e&&t[n-1].type==="break";)n--;return e===0&&n===t.length?t:t.slice(e,n)}function ds(t,e){const n=Number(e.tagName.charAt(1))||1,r=jm(t.all(e)),i={type:"heading",depth:n,children:r};return t.patch(e,i),i}function XP(t,e){const n={type:"thematicBreak"};return t.patch(e,n),n}function QP(t,e){const n=e.properties||{},r=String(n.src||""),i=String(n.title||"");if(r&&i){const s={type:"link",title:null,url:t.resolve(r),children:[{type:"text",value:i}]};return t.patch(e,s),s}}function Mb(t,e){const n=e.properties||{},r={type:"image",url:t.resolve(String(n.src||"")||null),title:n.title?String(n.title):null,alt:n.alt?String(n.alt):""};return t.patch(e,r),r}function zo(t,e){const n={type:"inlineCode",value:fl(e)};return t.patch(e,n),n}function GS(t,e){const n=[],r=[],i=e||t.properties||{},s=XS(t),o=Math.min(Number.parseInt(String(i.size),10),0)||(i.multiple?4:1);let a=-1;for(;++a<s.length;){const c=s[a];c&&c.properties&&c.properties.selected&&n.push(c)}const l=n.length>0?n:s,u=Math.min(l.length,o);for(a=-1;++a<u;){const c=l[a],d=c.properties||{},f=fl(c),h=f||String(d.label||""),p=String(d.value||"")||f;r.push([p,h===p?void 0:h])}return r}function XS(t){const e=[];let n=-1;for(;++n<t.children.length;){const r=t.children[n];"children"in r&&Array.isArray(r.children)&&e.push(...XS(r)),r.type==="element"&&r.tagName==="option"&&(!r.properties||!r.properties.disabled)&&e.push(r)}return e}const ZP="[x]",JP="[ ]";function e9(t,e){const n=e.properties||{},r=String(n.value||n.placeholder||"");if(n.disabled||n.type==="hidden"||n.type==="file")return;if(n.type==="checkbox"||n.type==="radio"){const l={type:"text",value:n.checked?t.options.checked||ZP:t.options.unchecked||JP};return t.patch(e,l),l}if(n.type==="image"){const l=n.alt||r;if(l){const u={type:"image",url:t.resolve(String(n.src||"")||null),title:String(n.title||"")||null,alt:String(l)};return t.patch(e,u),u}return}let i=[];if(r)i=[[r,void 0]];else if(n.type!=="button"&&n.type!=="file"&&n.type!=="password"&&n.type!=="reset"&&n.type!=="submit"&&n.list){const l=String(n.list),u=t.elementById.get(l);u&&u.tagName==="datalist"&&(i=GS(u,n))}if(i.length===0)return;if(n.type==="password"&&(i[0]=["•".repeat(i[0][0].length),void 0]),n.type==="email"||n.type==="url"){const l=[];let u=-1;for(;++u<i.length;){const c=t.resolve(i[u][0]),d={type:"link",title:null,url:n.type==="email"?"mailto:"+c:c,children:[{type:"text",value:i[u][1]||c}]};l.push(d),u!==i.length-1&&l.push({type:"text",value:", "})}return l}const s=[];let o=-1;for(;++o<i.length;)s.push(i[o][1]?i[o][1]+" ("+i[o][0]+")":i[o][0]);const a={type:"text",value:s.join(", ")};return t.patch(e,a),a}const t9={}.hasOwnProperty;function n9(t,e){const n=t.type==="element"&&t9.call(t.properties,e)&&t.properties[e];return n!=null&&n!==!1}const r9=new Set(["pingback","prefetch","stylesheet"]);function i9(t){if(t.type!=="element"||t.tagName!=="link")return!1;if(t.properties.itemProp)return!0;const e=t.properties.rel;let n=-1;if(!Array.isArray(e)||e.length===0)return!1;for(;++n<e.length;)if(!r9.has(String(e[n])))return!1;return!0}const s9=Qn(["a","abbr","area","b","bdi","bdo","br","button","cite","code","data","datalist","del","dfn","em","i","input","ins","kbd","keygen","label","map","mark","meter","noscript","output","progress","q","ruby","s","samp","script","select","small","span","strong","sub","sup","template","textarea","time","u","var","wbr"]),o9=Qn("meta");function QS(t){return!!(t.type==="text"||s9(t)||OS(t)||i9(t)||o9(t)&&n9(t,"itemProp"))}function gf(t,e){const{rest:n,checkbox:r}=JS(e),i=r?!!r.properties.checked:null,s=ZS(n),o=t.toFlow(t.all(n)),a={type:"listItem",spread:s,checked:i,children:o};return t.patch(e,a),a}function ZS(t){let e=-1,n=!1;for(;++e<t.children.length;){const r=t.children[e];if(r.type==="element"){if(QS(r))continue;if(r.tagName==="p"||n||ZS(r))return!0;n=!0}}return!1}function JS(t){const e=t.children[0];if(e&&e.type==="element"&&e.tagName==="input"&&e.properties&&(e.properties.type==="checkbox"||e.properties.type==="radio")){const n={...t,children:t.children.slice(1)};return{checkbox:e,rest:n}}if(e&&e.type==="element"&&e.tagName==="p"){const{checkbox:n,rest:r}=JS(e);if(n){const i={...t,children:[r,...t.children.slice(1)]};return{checkbox:n,rest:i}}}return{checkbox:void 0,rest:t}}function bf(t,e){const n=e.tagName==="ol",r=t.toSpecificContent(t.all(e),a9);let i=null;n&&(i=e.properties&&e.properties.start?Number.parseInt(String(e.properties.start),10):1);const s={type:"list",ordered:n,start:i,spread:zm(r),children:r};return t.patch(e,s),s}function a9(){return{type:"listItem",spread:!1,checked:null,children:[]}}const l9={};function Zc(t,e){const n=l9,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return ew(t,r,i)}function ew(t,e,n){if(u9(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return Ob(t.children,e,n)}return Array.isArray(t)?Ob(t,e,n):""}function Ob(t,e,n){const r=[];let i=-1;for(;++i<t.length;)r[i]=ew(t[i],e,n);return r.join("")}function u9(t){return!!(t&&typeof t=="object")}const tw=xo(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Jc(t){let e=-1;for(;++e<t.length;){const n=t[e];if(!iw(n)||"children"in n&&Jc(n.children))return!0}return!1}function nw(t){return rw(t,e,function(n){return n});function e(n){return n.every(function(r){return r.type==="text"?dl(r.value):!1})?[]:[{type:"paragraph",children:jm(n)}]}}function c9(t){return rw(t.children,e,n);function e(r){const i=yf(t);return i.children=r,[i]}function n(r){if("children"in r&&"children"in t){const i=yf(t),s=yf(r);return i.children=r.children,s.children.push(i),s}return{...r}}}function rw(t,e,n){const r=d9(t),i=[];let s=[],o=-1;for(;++o<r.length;){const a=r[o];iw(a)?s.push(a):(s.length>0&&(i.push(...e(s)),s=[]),i.push(n(a)))}return s.length>0&&(i.push(...e(s)),s=[]),i}function d9(t){const e=[];let n=-1;for(;++n<t.length;){const r=t[n];(r.type==="delete"||r.type==="link")&&Jc(r.children)?e.push(...c9(r)):e.push(r)}return e}function iw(t){const e=t.data&&t.data.hName;return e?QS({type:"element",tagName:e,properties:{},children:[]}):tw(t)}function yf(t){return ro({...t,children:[]})}function Db(t,e){const n=e.properties||{},r=e.tagName==="video"?String(n.poster||""):"";let i=String(n.src||""),s=-1,o=!1,a=t.all(e);if(io({type:"root",children:a},function(d){if(d.type==="link")return o=!0,tc}),o||Jc(a))return a;for(;!i&&++s<e.children.length;){const d=e.children[s];d.type==="element"&&d.tagName==="source"&&d.properties&&(i=String(d.properties.src||""))}if(r){const d={type:"image",title:null,url:t.resolve(r),alt:Zc(a)};t.patch(e,d),a=[d]}const u=a,c={type:"link",title:n.title?String(n.title):null,url:t.resolve(i),children:u};return t.patch(e,c),c}function Lb(t,e){const n=jm(t.all(e));if(n.length>0){const r={type:"paragraph",children:n};return t.patch(e,r),r}}const f9=['"'];function h9(t,e){const n=t.options.quotes||f9;t.qNesting++;const r=t.all(e);t.qNesting--;const i=n[t.qNesting%n.length],s=r[0],o=r[r.length-1],a=i.charAt(0),l=i.length>1?i.charAt(1):i;return s&&s.type==="text"?s.value=a+s.value:r.unshift({type:"text",value:a}),o&&o.type==="text"?o.value+=l:r.push({type:"text",value:l}),r}function p9(t,e){let n=t.all(e);(t.options.document||Jc(n))&&(n=nw(n));const r={type:"root",children:n};return t.patch(e,r),r}function m9(t,e){const n=GS(e);let r=-1;const i=[];for(;++r<n.length;){const s=n[r];i.push(s[1]?s[1]+" ("+s[0]+")":s[0])}if(i.length>0){const s={type:"text",value:i.join(", ")};return t.patch(e,s),s}}function Pb(t,e){const r={type:"strong",children:t.all(e)};return t.patch(e,r),r}function Bb(t,e){const r={type:"tableCell",children:t.all(e)};if(t.patch(e,r),e.properties){const i=e.properties.rowSpan,s=e.properties.colSpan;if(i||s){const o=r.data||(r.data={});i&&(o.hastUtilToMdastTemporaryRowSpan=i),s&&(o.hastUtilToMdastTemporaryColSpan=s)}}return r}function g9(t,e){const r={type:"tableRow",children:t.toSpecificContent(t.all(e),b9)};return t.patch(e,r),r}function b9(){return{type:"tableCell",children:[]}}function y9(t,e){if(t.inTable){const u={type:"text",value:fl(e)};return t.patch(e,u),u}t.inTable=!0;const{align:n,headless:r}=E9(e),i=t.toSpecificContent(t.all(e),Fb);r&&i.unshift(Fb());let s=-1;for(;++s<i.length;){const u=i[s],c=t.toSpecificContent(u.children,T9);u.children=c}let o=1;for(s=-1;++s<i.length;){const u=i[s].children;let c=-1;for(;++c<u.length;){const d=u[c];if(d.data){const f=d.data,h=Number.parseInt(String(f.hastUtilToMdastTemporaryColSpan),10)||1,p=Number.parseInt(String(f.hastUtilToMdastTemporaryRowSpan),10)||1;if(h>1||p>1){let g=s-1;for(;++g<s+p;){let b=c-1;for(;++b<c+h&&i[g];){const y=[];(g!==s||b!==c)&&y.push({type:"tableCell",children:[]}),i[g].children.splice(b,0,...y)}}}"hastUtilToMdastTemporaryColSpan"in d.data&&delete d.data.hastUtilToMdastTemporaryColSpan,"hastUtilToMdastTemporaryRowSpan"in d.data&&delete d.data.hastUtilToMdastTemporaryRowSpan,Object.keys(d.data).length===0&&delete d.data}}u.length>o&&(o=u.length)}for(s=-1;++s<i.length;){const u=i[s].children;let c=u.length-1;for(;++c<o;)u.push({type:"tableCell",children:[]})}let a=n.length-1;for(;++a<o;)n.push(null);t.inTable=!1;const l={type:"table",align:n,children:i};return t.patch(e,l),l}function E9(t){const e={align:[null],headless:!0};let n=0,r=0;return io(t,function(i){if(i.type==="element"){if(i.tagName==="table"&&t!==i)return HS;if((i.tagName==="th"||i.tagName==="td")&&i.properties){if(!e.align[r]){const s=String(i.properties.align||"")||null;(s==="center"||s==="left"||s==="right"||s===null)&&(e.align[r]=s)}e.headless&&n<2&&i.tagName==="th"&&(e.headless=!1),r++}else i.tagName==="thead"?e.headless=!1:i.tagName==="tr"&&(n++,r=0)}}),e}function T9(){return{type:"tableCell",children:[]}}function Fb(){return{type:"tableRow",children:[]}}function C9(t,e){const n={type:"text",value:e.value};return t.patch(e,n),n}function x9(t,e){const n={type:"text",value:fl(e)};return t.patch(e,n),n}function S9(t,e){const n={type:"text",value:"​"};return t.patch(e,n),n}const w9={comment:YP,doctype:Se,root:p9,text:C9},k9={applet:Se,area:Se,basefont:Se,bgsound:Se,caption:Se,col:Se,colgroup:Se,command:Se,content:Se,datalist:Se,dialog:Se,element:Se,embed:Se,frame:Se,frameset:Se,isindex:Se,keygen:Se,link:Se,math:Se,menu:Se,menuitem:Se,meta:Se,nextid:Se,noembed:Se,noframes:Se,optgroup:Se,option:Se,param:Se,script:Se,shadow:Se,source:Se,spacer:Se,style:Se,svg:Se,template:Se,title:Se,track:Se,abbr:xe,acronym:xe,bdi:xe,bdo:xe,big:xe,blink:xe,button:xe,canvas:xe,cite:xe,data:xe,details:xe,dfn:xe,font:xe,ins:xe,label:xe,map:xe,marquee:xe,meter:xe,nobr:xe,noscript:xe,object:xe,output:xe,progress:xe,rb:xe,rbc:xe,rp:xe,rt:xe,rtc:xe,ruby:xe,slot:xe,small:xe,span:xe,sup:xe,sub:xe,tbody:xe,tfoot:xe,thead:xe,time:xe,address:rt,article:rt,aside:rt,body:rt,center:rt,div:rt,fieldset:rt,figcaption:rt,figure:rt,form:rt,footer:rt,header:rt,hgroup:rt,html:rt,legend:rt,main:rt,multicol:rt,nav:rt,picture:rt,section:rt,a:DP,audio:Db,b:Pb,base:LP,blockquote:PP,br:BP,code:zo,dir:bf,dl:KP,dt:gf,dd:gf,del:mf,em:$l,h1:ds,h2:ds,h3:ds,h4:ds,h5:ds,h6:ds,hr:XP,i:$l,iframe:QP,img:Mb,image:Mb,input:e9,kbd:zo,li:gf,listing:Ul,mark:$l,ol:bf,p:Lb,plaintext:Ul,pre:Ul,q:h9,s:mf,samp:zo,select:m9,strike:mf,strong:Pb,summary:Lb,table:y9,td:Bb,textarea:x9,th:Bb,tr:g9,tt:zo,u:$l,ul:bf,var:zo,video:Db,wbr:S9,xmp:Ul};function xe(t,e){return t.all(e)}function rt(t,e){return t.toFlow(t.all(e))}function Se(){}const Hb={}.hasOwnProperty;function A9(t){return{all:v9,baseFound:!1,elementById:new Map,frozenBaseUrl:void 0,handlers:{...k9,...t.handlers},inTable:!1,nodeHandlers:{...w9,...t.nodeHandlers},one:N9,options:t,patch:_9,qNesting:0,resolve:I9,toFlow:R9,toSpecificContent:M9}}function v9(t){const e=t.children||[],n=[];let r=-1;for(;++r<e.length;){const i=e[r],s=this.one(i,t);Array.isArray(s)?n.push(...s):s&&n.push(s)}return n}function N9(t,e){if(t.type==="element"){if(t.properties&&t.properties.dataMdast==="ignore")return;if(Hb.call(this.handlers,t.tagName))return this.handlers[t.tagName](this,t,e)||void 0}else if(Hb.call(this.nodeHandlers,t.type))return this.nodeHandlers[t.type](this,t,e)||void 0;if("value"in t&&typeof t.value=="string"){const n={type:"text",value:t.value};return this.patch(t,n),n}if("children"in t)return this.all(t)}function _9(t,e){t.position&&(e.position=jS(t))}function I9(t){const e=this.frozenBaseUrl;return t==null?"":e?String(new URL(t,e)):t}function R9(t){return nw(t)}function M9(t,e){const n=e(),r=[];let i=[],s=-1;for(;++s<t.length;){const a=t[s];if(o(a))i.length>0&&(a.children.unshift(...i),i=[]),r.push(a);else{const l=a;i.push(l)}}if(i.length>0){let a=r[r.length-1];a||(a=e(),r.push(a)),a.children.push(...i),i=[]}return r;function o(a){return a.type===n.type}}const O9={};function Ub(t,e){const n=ro(t),r=e||O9,i=RP({newlines:r.newlines===!0}),s=A9(r);let o;i(n),io(n,function(l){if(l&&l.type==="element"&&l.properties){const u=String(l.properties.id||"")||void 0;u&&!s.elementById.has(u)&&s.elementById.set(u,l)}});const a=s.one(n,void 0);return a?Array.isArray(a)?o={type:"root",children:a}:o=a:o={type:"root",children:[]},io(o,function(l,u,c){if(l.type==="text"&&u!==void 0&&c){const d=c.children[u-1];if(d&&d.type===l.type)return d.value+=l.value,c.children.splice(u,1),d.position&&l.position&&(d.position.end=l.position.end),u-1;if(l.value=l.value.replace(/[\t ]*(\r?\n|\r)[\t ]*/,"$1"),c&&(c.type==="heading"||c.type==="paragraph"||c.type==="root")&&(u||(l.value=l.value.replace(/^[\t ]+/,"")),u===c.children.length-1&&(l.value=l.value.replace(/[\t ]+$/,""))),!l.value)return c.children.splice(u,1),u}}),o}const $b={document:!0};function BG(t,e){return t&&"run"in t?async function(n,r){const i=Ub(n,{...$b,...e});await t.run(i,r)}:function(n){return Ub(n,{...$b,...t})}}function nc(t,e){const n=String(t);if(typeof e!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(e);for(;i!==-1;)r++,i=n.indexOf(e,i+e.length);return r}const Ft=mi(/[A-Za-z]/),vt=mi(/[\dA-Za-z]/),D9=mi(/[#-'*+\--9=?A-Z^-~]/);function rc(t){return t!==null&&(t<32||t===127)}const ip=mi(/\d/),L9=mi(/[\dA-Fa-f]/),P9=mi(/[!-/:-@[-`{-~]/);function de(t){return t!==null&&t<-2}function Ve(t){return t!==null&&(t<0||t===32)}function Ae(t){return t===-2||t===-1||t===32}const ed=mi(new RegExp("\\p{P}|\\p{S}","u")),Ki=mi(/\s/);function mi(t){return e;function e(n){return n!==null&&n>-1&&t.test(String.fromCharCode(n))}}function B9(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function F9(t,e,n){const i=xo((n||{}).ignore||[]),s=H9(e);let o=-1;for(;++o<s.length;)US(t,"text",a);function a(u,c){let d=-1,f;for(;++d<c.length;){const h=c[d],p=f?f.children:void 0;if(i(h,p?p.indexOf(h):void 0,f))return;f=h}if(f)return l(u,c)}function l(u,c){const d=c[c.length-1],f=s[o][0],h=s[o][1];let p=0;const b=d.children.indexOf(u);let y=!1,E=[];f.lastIndex=0;let T=f.exec(u.value);for(;T;){const v=T.index,R={index:T.index,input:T.input,stack:[...c,u]};let A=h(...T,R);if(typeof A=="string"&&(A=A.length>0?{type:"text",value:A}:void 0),A===!1?f.lastIndex=v+1:(p!==v&&E.push({type:"text",value:u.value.slice(p,v)}),Array.isArray(A)?E.push(...A):A&&E.push(A),p=v+T[0].length,y=!0),!f.global)break;T=f.exec(u.value)}return y?(p<u.value.length&&E.push({type:"text",value:u.value.slice(p)}),d.children.splice(b,1,...E)):E=[u],b+E.length}}function H9(t){const e=[];if(!Array.isArray(t))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!t[0]||Array.isArray(t[0])?t:[t];let r=-1;for(;++r<n.length;){const i=n[r];e.push([U9(i[0]),$9(i[1])])}return e}function U9(t){return typeof t=="string"?new RegExp(B9(t),"g"):t}function $9(t){return typeof t=="function"?t:function(){return t}}const Ef="phrasing",Tf=["autolink","link","image","label"];function V9(){return{transforms:[G9],enter:{literalAutolink:j9,literalAutolinkEmail:Cf,literalAutolinkHttp:Cf,literalAutolinkWww:Cf},exit:{literalAutolink:K9,literalAutolinkEmail:Y9,literalAutolinkHttp:W9,literalAutolinkWww:q9}}}function z9(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:Ef,notInConstruct:Tf},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:Ef,notInConstruct:Tf},{character:":",before:"[ps]",after:"\\/",inConstruct:Ef,notInConstruct:Tf}]}}function j9(t){this.enter({type:"link",title:null,url:"",children:[]},t)}function Cf(t){this.config.enter.autolinkProtocol.call(this,t)}function W9(t){this.config.exit.autolinkProtocol.call(this,t)}function q9(t){this.config.exit.data.call(this,t);const e=this.stack[this.stack.length-1];e.type,e.url="http://"+this.sliceSerialize(t)}function Y9(t){this.config.exit.autolinkEmail.call(this,t)}function K9(t){this.exit(t)}function G9(t){F9(t,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,X9],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),Q9]],{ignore:["link","linkReference"]})}function X9(t,e,n,r,i){let s="";if(!sw(i)||(/^w/i.test(e)&&(n=e+n,e="",s="http://"),!Z9(n)))return!1;const o=J9(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:s+e+o[0],children:[{type:"text",value:e+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function Q9(t,e,n,r){return!sw(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+e+"@"+n,children:[{type:"text",value:e+"@"+n}]}}function Z9(t){const e=t.split(".");return!(e.length<2||e[e.length-1]&&(/_/.test(e[e.length-1])||!/[a-zA-Z\d]/.test(e[e.length-1]))||e[e.length-2]&&(/_/.test(e[e.length-2])||!/[a-zA-Z\d]/.test(e[e.length-2])))}function J9(t){const e=/[!"&'),.:;<>?\]}]+$/.exec(t);if(!e)return[t,void 0];t=t.slice(0,e.index);let n=e[0],r=n.indexOf(")");const i=nc(t,"(");let s=nc(t,")");for(;r!==-1&&i>s;)t+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),s++;return[t,n]}function sw(t,e){const n=t.input.charCodeAt(t.index-1);return(t.index===0||Ki(n)||ed(n))&&(!e||n!==47)}function Vn(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}ow.peek=l7;function e7(){this.buffer()}function t7(t){this.enter({type:"footnoteReference",identifier:"",label:""},t)}function n7(){this.buffer()}function r7(t){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},t)}function i7(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vn(this.sliceSerialize(t)).toLowerCase(),n.label=e}function s7(t){this.exit(t)}function o7(t){const e=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=Vn(this.sliceSerialize(t)).toLowerCase(),n.label=e}function a7(t){this.exit(t)}function l7(){return"["}function ow(t,e,n,r){const i=n.createTracker(r);let s=i.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return s+=i.move(n.safe(n.associationId(t),{after:"]",before:s})),a(),o(),s+=i.move("]"),s}function u7(){return{enter:{gfmFootnoteCallString:e7,gfmFootnoteCall:t7,gfmFootnoteDefinitionLabelString:n7,gfmFootnoteDefinition:r7},exit:{gfmFootnoteCallString:i7,gfmFootnoteCall:s7,gfmFootnoteDefinitionLabelString:o7,gfmFootnoteDefinition:a7}}}function c7(t){let e=!1;return t&&t.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:n,footnoteReference:ow},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,s,o){const a=s.createTracker(o);let l=a.move("[^");const u=s.enter("footnoteDefinition"),c=s.enter("label");return l+=a.move(s.safe(s.associationId(r),{before:l,after:"]"})),c(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((e?`
96
+ `:" ")+s.indentLines(s.containerFlow(r,a.current()),e?aw:d7))),u(),l}}function d7(t,e,n){return e===0?t:aw(t,e,n)}function aw(t,e,n){return(n?"":" ")+t}const f7=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];lw.peek=b7;function h7(){return{canContainEols:["delete"],enter:{strikethrough:m7},exit:{strikethrough:g7}}}function p7(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:f7}],handlers:{delete:lw}}}function m7(t){this.enter({type:"delete",children:[]},t)}function g7(t){this.exit(t)}function lw(t,e,n,r){const i=n.createTracker(r),s=n.enter("strikethrough");let o=i.move("~~");return o+=n.containerPhrasing(t,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),s(),o}function b7(){return"~"}function y7(t){return t.length}function E7(t,e){const n=e||{},r=(n.align||[]).concat(),i=n.stringLength||y7,s=[],o=[],a=[],l=[];let u=0,c=-1;for(;++c<t.length;){const g=[],b=[];let y=-1;for(t[c].length>u&&(u=t[c].length);++y<t[c].length;){const E=T7(t[c][y]);if(n.alignDelimiters!==!1){const T=i(E);b[y]=T,(l[y]===void 0||T>l[y])&&(l[y]=T)}g.push(E)}o[c]=g,a[c]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<u;)s[d]=Vb(r[d]);else{const g=Vb(r);for(;++d<u;)s[d]=g}d=-1;const f=[],h=[];for(;++d<u;){const g=s[d];let b="",y="";g===99?(b=":",y=":"):g===108?b=":":g===114&&(y=":");let E=n.alignDelimiters===!1?1:Math.max(1,l[d]-b.length-y.length);const T=b+"-".repeat(E)+y;n.alignDelimiters!==!1&&(E=b.length+E+y.length,E>l[d]&&(l[d]=E),h[d]=E),f[d]=T}o.splice(1,0,f),a.splice(1,0,h),c=-1;const p=[];for(;++c<o.length;){const g=o[c],b=a[c];d=-1;const y=[];for(;++d<u;){const E=g[d]||"";let T="",v="";if(n.alignDelimiters!==!1){const R=l[d]-(b[d]||0),A=s[d];A===114?T=" ".repeat(R):A===99?R%2?(T=" ".repeat(R/2+.5),v=" ".repeat(R/2-.5)):(T=" ".repeat(R/2),v=T):v=" ".repeat(R)}n.delimiterStart!==!1&&!d&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&E==="")&&(n.delimiterStart!==!1||d)&&y.push(" "),n.alignDelimiters!==!1&&y.push(T),y.push(E),n.alignDelimiters!==!1&&y.push(v),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||d!==u-1)&&y.push("|")}p.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return p.join(`
97
+ `)}function T7(t){return t==null?"":String(t)}function Vb(t){const e=typeof t=="string"?t.codePointAt(0):0;return e===67||e===99?99:e===76||e===108?108:e===82||e===114?114:0}const zb={}.hasOwnProperty;function uw(t,e){const n=e||{};function r(i,...s){let o=r.invalid;const a=r.handlers;if(i&&zb.call(i,t)){const l=String(i[t]);o=zb.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,i,...s)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const C7={}.hasOwnProperty;function cw(t,e){let n=-1,r;if(e.extensions)for(;++n<e.extensions.length;)cw(t,e.extensions[n]);for(r in e)if(C7.call(e,r))switch(r){case"extensions":break;case"unsafe":{jb(t[r],e[r]);break}case"join":{jb(t[r],e[r]);break}case"handlers":{x7(t[r],e[r]);break}default:t.options[r]=e[r]}return t}function jb(t,e){e&&t.push(...e)}function x7(t,e){e&&Object.assign(t,e)}function S7(t,e,n,r){const i=n.enter("blockquote"),s=n.createTracker(r);s.move("> "),s.shift(2);const o=n.indentLines(n.containerFlow(t,s.current()),w7);return i(),o}function w7(t,e,n){return">"+(n?"":" ")+t}function dw(t,e){return Wb(t,e.inConstruct,!0)&&!Wb(t,e.notInConstruct,!1)}function Wb(t,e,n){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return n;let r=-1;for(;++r<e.length;)if(t.includes(e[r]))return!0;return!1}function qb(t,e,n,r){let i=-1;for(;++i<n.unsafe.length;)if(n.unsafe[i].character===`
98
+ `&&dw(n.stack,n.unsafe[i]))return/[ \t]/.test(r.before)?"":" ";return`\\
99
+ `}function k7(t,e){const n=String(t);let r=n.indexOf(e),i=r,s=0,o=0;if(typeof e!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++s>o&&(o=s):s=1,i=r+e.length,r=n.indexOf(e,i);return o}function sp(t,e){return!!(e.options.fences===!1&&t.value&&!t.lang&&/[^ \r\n]/.test(t.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(t.value))}function A7(t){const e=t.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function v7(t,e,n,r){const i=A7(n),s=t.value||"",o=i==="`"?"GraveAccent":"Tilde";if(sp(t,n)){const d=n.enter("codeIndented"),f=n.indentLines(s,N7);return d(),f}const a=n.createTracker(r),l=i.repeat(Math.max(k7(s,i)+1,3)),u=n.enter("codeFenced");let c=a.move(l);if(t.lang){const d=n.enter(`codeFencedLang${o}`);c+=a.move(n.safe(t.lang,{before:c,after:" ",encode:["`"],...a.current()})),d()}if(t.lang&&t.meta){const d=n.enter(`codeFencedMeta${o}`);c+=a.move(" "),c+=a.move(n.safe(t.meta,{before:c,after:`
100
+ `,encode:["`"],...a.current()})),d()}return c+=a.move(`
101
+ `),s&&(c+=a.move(s+`
102
+ `)),c+=a.move(l),u(),c}function N7(t,e,n){return(n?"":" ")+t}function Wm(t){const e=t.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function _7(t,e,n,r){const i=Wm(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("[");return u+=l.move(n.safe(n.associationId(t),{before:u,after:"]",...l.current()})),u+=l.move("]: "),a(),!t.url||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(t.url,{before:u,after:t.title?" ":`
103
+ `,...l.current()}))),a(),t.title&&(a=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),o(),u}function I7(t){const e=t.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function fi(t){return"&#x"+t.toString(16).toUpperCase()+";"}function so(t){if(t===null||Ve(t)||Ki(t))return 1;if(ed(t))return 2}function ic(t,e,n){const r=so(t),i=so(e);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}fw.peek=R7;function fw(t,e,n,r){const i=I7(n),s=n.enter("emphasis"),o=n.createTracker(r),a=o.move(i);let l=o.move(n.containerPhrasing(t,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),c=ic(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=fi(u)+l.slice(1));const d=l.charCodeAt(l.length-1),f=ic(r.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+fi(d));const h=o.move(i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:c.outside},a+l+h}function R7(t,e,n){return n.options.emphasis||"*"}function hw(t,e){let n=!1;return io(t,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,tc}),!!((!t.depth||t.depth<3)&&Zc(t)&&(e.options.setext||n))}function M7(t,e,n,r){const i=Math.max(Math.min(6,t.depth||1),1),s=n.createTracker(r);if(hw(t,n)){const c=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(t,{...s.current(),before:`
104
+ `,after:`
105
+ `});return d(),c(),f+`
106
+ `+(i===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
107
+ `))+1))}const o="#".repeat(i),a=n.enter("headingAtx"),l=n.enter("phrasing");s.move(o+" ");let u=n.containerPhrasing(t,{before:"# ",after:`
108
+ `,...s.current()});return/^[\t ]/.test(u)&&(u=fi(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),a(),u}pw.peek=O7;function pw(t){return t.value||""}function O7(){return"<"}mw.peek=D7;function mw(t,e,n,r){const i=Wm(n),s=i==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let u=l.move("![");return u+=l.move(n.safe(t.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),a(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(a=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(t.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(a=n.enter("destinationRaw"),u+=l.move(n.safe(t.url,{before:u,after:t.title?" ":")",...l.current()}))),a(),t.title&&(a=n.enter(`title${s}`),u+=l.move(" "+i),u+=l.move(n.safe(t.title,{before:u,after:i,...l.current()})),u+=l.move(i),a()),u+=l.move(")"),o(),u}function D7(){return"!"}gw.peek=L7;function gw(t,e,n,r){const i=t.referenceType,s=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const u=n.safe(t.alt,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=c,s(),i==="full"||!u||u!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function L7(){return"!"}bw.peek=P7;function bw(t,e,n){let r=t.value||"",i="`",s=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++s<n.unsafe.length;){const o=n.unsafe[s],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let u=l.index;r.charCodeAt(u)===10&&r.charCodeAt(u-1)===13&&u--,r=r.slice(0,u)+" "+r.slice(l.index+1)}}return i+r+i}function P7(){return"`"}function yw(t,e){const n=Zc(t);return!!(!e.options.resourceLink&&t.url&&!t.title&&t.children&&t.children.length===1&&t.children[0].type==="text"&&(n===t.url||"mailto:"+n===t.url)&&/^[a-z][a-z+.-]+:/i.test(t.url)&&!/[\0- <>\u007F]/.test(t.url))}Ew.peek=B7;function Ew(t,e,n,r){const i=Wm(n),s=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(yw(t,n)){const c=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(t,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=c,d}a=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(t,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!t.url&&t.title||/[\0- \u007F]/.test(t.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(t.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(t.url,{before:u,after:t.title?" ":")",...o.current()}))),l(),t.title&&(l=n.enter(`title${s}`),u+=o.move(" "+i),u+=o.move(n.safe(t.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),a(),u}function B7(t,e,n){return yw(t,n)?"<":"["}Tw.peek=F7;function Tw(t,e,n,r){const i=t.referenceType,s=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const u=n.containerPhrasing(t,{before:l,after:"]",...a.current()});l+=a.move(u+"]["),o();const c=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(t),{before:l,after:"]",...a.current()});return o(),n.stack=c,s(),i==="full"||!u||u!==d?l+=a.move(d+"]"):i==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function F7(){return"["}function qm(t){const e=t.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function H7(t){const e=qm(t),n=t.options.bulletOther;if(!n)return e==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+n+"`) to be different");return n}function U7(t){const e=t.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function Cw(t){const e=t.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function $7(t,e,n,r){const i=n.enter("list"),s=n.bulletCurrent;let o=t.ordered?U7(n):qm(n);const a=t.ordered?o==="."?")":".":H7(n);let l=e&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!t.ordered){const c=t.children?t.children[0]:void 0;if((o==="*"||o==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),Cw(n)===o&&c){let d=-1;for(;++d<t.children.length;){const f=t.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const u=n.containerFlow(t,r);return n.bulletLastUsed=o,n.bulletCurrent=s,i(),u}function V7(t){const e=t.options.listItemIndent||"one";if(e!=="tab"&&e!=="one"&&e!=="mixed")throw new Error("Cannot serialize items with `"+e+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return e}function z7(t,e,n,r){const i=V7(n);let s=n.bulletCurrent||qm(n);e&&e.type==="list"&&e.ordered&&(s=(typeof e.start=="number"&&e.start>-1?e.start:1)+(n.options.incrementListMarker===!1?0:e.children.indexOf(t))+s);let o=s.length+1;(i==="tab"||i==="mixed"&&(e&&e.type==="list"&&e.spread||t.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(s+" ".repeat(o-s.length)),a.shift(o);const l=n.enter("listItem"),u=n.indentLines(n.containerFlow(t,a.current()),c);return l(),u;function c(d,f,h){return f?(h?"":" ".repeat(o))+d:(h?s:s+" ".repeat(o-s.length))+d}}function j7(t,e,n,r){const i=n.enter("paragraph"),s=n.enter("phrasing"),o=n.containerPhrasing(t,r);return s(),i(),o}function W7(t,e,n,r){return(t.children.some(function(o){return tw(o)})?n.containerPhrasing:n.containerFlow).call(n,t,r)}function q7(t){const e=t.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}xw.peek=Y7;function xw(t,e,n,r){const i=q7(n),s=n.enter("strong"),o=n.createTracker(r),a=o.move(i+i);let l=o.move(n.containerPhrasing(t,{after:i,before:a,...o.current()}));const u=l.charCodeAt(0),c=ic(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=fi(u)+l.slice(1));const d=l.charCodeAt(l.length-1),f=ic(r.after.charCodeAt(0),d,i);f.inside&&(l=l.slice(0,-1)+fi(d));const h=o.move(i+i);return s(),n.attentionEncodeSurroundingInfo={after:f.outside,before:c.outside},a+l+h}function Y7(t,e,n){return n.options.strong||"*"}function K7(t,e,n,r){return n.safe(t.value,r)}function G7(t){const e=t.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function X7(t,e,n){const r=(Cw(n)+(n.options.ruleSpaces?" ":"")).repeat(G7(n));return n.options.ruleSpaces?r.slice(0,-1):r}const Ym={blockquote:S7,break:qb,code:v7,definition:_7,emphasis:fw,hardBreak:qb,heading:M7,html:pw,image:mw,imageReference:gw,inlineCode:bw,link:Ew,linkReference:Tw,list:$7,listItem:z7,paragraph:j7,root:W7,strong:xw,text:K7,thematicBreak:X7},Q7=[Z7];function Z7(t,e,n,r){if(e.type==="code"&&sp(e,r)&&(t.type==="list"||t.type===e.type&&sp(t,r)))return!1;if("spread"in n&&typeof n.spread=="boolean")return t.type==="paragraph"&&(t.type===e.type||e.type==="definition"||e.type==="heading"&&hw(e,r))?void 0:n.spread?1:0}const xi=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"],J7=[{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"\r",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:`
109
+ `,inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde","codeFencedMetaGraveAccent","codeFencedMetaTilde","destinationLiteral","headingAtx"]},{character:" ",after:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",before:"[\\r\\n]",inConstruct:"phrasing"},{character:" ",inConstruct:["codeFencedLangGraveAccent","codeFencedLangTilde"]},{character:"!",after:"\\[",inConstruct:"phrasing",notInConstruct:xi},{character:'"',inConstruct:"titleQuote"},{atBreak:!0,character:"#"},{character:"#",inConstruct:"headingAtx",after:`(?:[\r
110
+ ]|$)`},{character:"&",after:"[#A-Za-z]",inConstruct:"phrasing"},{character:"'",inConstruct:"titleApostrophe"},{character:"(",inConstruct:"destinationRaw"},{before:"\\]",character:"(",inConstruct:"phrasing",notInConstruct:xi},{atBreak:!0,before:"\\d+",character:")"},{character:")",inConstruct:"destinationRaw"},{atBreak:!0,character:"*",after:`(?:[ \r
111
+ *])`},{character:"*",inConstruct:"phrasing",notInConstruct:xi},{atBreak:!0,character:"+",after:`(?:[ \r
112
+ ])`},{atBreak:!0,character:"-",after:`(?:[ \r
113
+ -])`},{atBreak:!0,before:"\\d+",character:".",after:`(?:[ \r
114
+ ]|$)`},{atBreak:!0,character:"<",after:"[!/?A-Za-z]"},{character:"<",after:"[!/?A-Za-z]",inConstruct:"phrasing",notInConstruct:xi},{character:"<",inConstruct:"destinationLiteral"},{atBreak:!0,character:"="},{atBreak:!0,character:">"},{character:">",inConstruct:"destinationLiteral"},{atBreak:!0,character:"["},{character:"[",inConstruct:"phrasing",notInConstruct:xi},{character:"[",inConstruct:["label","reference"]},{character:"\\",after:"[\\r\\n]",inConstruct:"phrasing"},{character:"]",inConstruct:["label","reference"]},{atBreak:!0,character:"_"},{character:"_",inConstruct:"phrasing",notInConstruct:xi},{atBreak:!0,character:"`"},{character:"`",inConstruct:["codeFencedLangGraveAccent","codeFencedMetaGraveAccent"]},{character:"`",inConstruct:"phrasing",notInConstruct:xi},{atBreak:!0,character:"~"}],Yb=document.createElement("i");function Km(t){const e="&"+t+";";Yb.innerHTML=e;const n=Yb.textContent;return n.charCodeAt(n.length-1)===59&&t!=="semi"||n===e?!1:n}function Sw(t,e){const n=Number.parseInt(t,e);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}const eB=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function ww(t){return t.replace(eB,tB)}function tB(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){const i=n.charCodeAt(1),s=i===120||i===88;return Sw(n.slice(s?2:1),s?16:10)}return Km(n)||t}function nB(t){return t.label||!t.identifier?t.label||"":ww(t.identifier)}function rB(t){if(!t._compiled){const e=(t.atBreak?"[\\r\\n][\\t ]*":"")+(t.before?"(?:"+t.before+")":"");t._compiled=new RegExp((e?"("+e+")":"")+(/[|\\{}()[\]^$+*?.-]/.test(t.character)?"\\":"")+t.character+(t.after?"(?:"+t.after+")":""),"g")}return t._compiled}function iB(t,e,n){const r=e.indexStack,i=t.children||[],s=[];let o=-1,a=n.before,l;r.push(-1);let u=e.createTracker(n);for(;++o<i.length;){const c=i[o];let d;if(r[r.length-1]=o,o+1<i.length){let p=e.handle.handlers[i[o+1].type];p&&p.peek&&(p=p.peek),d=p?p(i[o+1],t,e,{before:"",after:"",...u.current()}).charAt(0):""}else d=n.after;s.length>0&&(a==="\r"||a===`
115
+ `)&&c.type==="html"&&(s[s.length-1]=s[s.length-1].replace(/(\r?\n|\r)$/," "),a=" ",u=e.createTracker(n),u.move(s.join("")));let f=e.handle(c,t,e,{...u.current(),after:d,before:a});l&&l===f.slice(0,1)&&(f=fi(l.charCodeAt(0))+f.slice(1));const h=e.attentionEncodeSurroundingInfo;e.attentionEncodeSurroundingInfo=void 0,l=void 0,h&&(s.length>0&&h.before&&a===s[s.length-1].slice(-1)&&(s[s.length-1]=s[s.length-1].slice(0,-1)+fi(a.charCodeAt(0))),h.after&&(l=d)),u.move(f),s.push(f),a=f.slice(-1)}return r.pop(),s.join("")}function sB(t,e,n){const r=e.indexStack,i=t.children||[],s=e.createTracker(n),o=[];let a=-1;for(r.push(-1);++a<i.length;){const l=i[a];r[r.length-1]=a,o.push(s.move(e.handle(l,t,e,{before:`
116
+ `,after:`
117
+ `,...s.current()}))),l.type!=="list"&&(e.bulletLastUsed=void 0),a<i.length-1&&o.push(s.move(oB(l,i[a+1],t,e)))}return r.pop(),o.join("")}function oB(t,e,n,r){let i=r.join.length;for(;i--;){const s=r.join[i](t,e,n,r);if(s===!0||s===1)break;if(typeof s=="number")return`
118
+ `.repeat(1+s);if(s===!1)return`
119
+
120
+ <!---->
121
+
122
+ `}return`
123
+
124
+ `}const aB=/\r?\n|\r/g;function lB(t,e){const n=[];let r=0,i=0,s;for(;s=aB.exec(t);)o(t.slice(r,s.index)),n.push(s[0]),r=s.index+s[0].length,i++;return o(t.slice(r)),n.join("");function o(a){n.push(e(a,i,!a))}}function uB(t,e,n){const r=(n.before||"")+(e||"")+(n.after||""),i=[],s=[],o={};let a=-1;for(;++a<t.unsafe.length;){const c=t.unsafe[a];if(!dw(t.stack,c))continue;const d=t.compilePattern(c);let f;for(;f=d.exec(r);){const h="before"in c||!!c.atBreak,p="after"in c,g=f.index+(h?f[1].length:0);i.includes(g)?(o[g].before&&!h&&(o[g].before=!1),o[g].after&&!p&&(o[g].after=!1)):(i.push(g),o[g]={before:h,after:p})}}i.sort(cB);let l=n.before?n.before.length:0;const u=r.length-(n.after?n.after.length:0);for(a=-1;++a<i.length;){const c=i[a];c<l||c>=u||c+1<u&&i[a+1]===c+1&&o[c].after&&!o[c+1].before&&!o[c+1].after||i[a-1]===c-1&&o[c].before&&!o[c-1].before&&!o[c-1].after||(l!==c&&s.push(Kb(r.slice(l,c),"\\")),l=c,/[!-/:-@[-`{-~]/.test(r.charAt(c))&&(!n.encode||!n.encode.includes(r.charAt(c)))?s.push("\\"):(s.push(fi(r.charCodeAt(c))),l++))}return s.push(Kb(r.slice(l,u),n.after)),s.join("")}function cB(t,e){return t-e}function Kb(t,e){const n=/\\(?=[!-/:-@[-`{-~])/g,r=[],i=[],s=t+e;let o=-1,a=0,l;for(;l=n.exec(s);)r.push(l.index);for(;++o<r.length;)a!==r[o]&&i.push(t.slice(a,r[o])),i.push("\\"),a=r[o];return i.push(t.slice(a)),i.join("")}function dB(t){const e=t||{},n=e.now||{};let r=e.lineShift||0,i=n.line||1,s=n.column||1;return{move:l,current:o,shift:a};function o(){return{now:{line:i,column:s},lineShift:r}}function a(u){r+=u}function l(u){const c=u||"",d=c.split(/\r?\n|\r/g),f=d[d.length-1];return i+=d.length-1,s=d.length===1?s+f.length:1+f.length+r,c}}function fB(t,e){const n=e||{},r={associationId:nB,containerPhrasing:gB,containerFlow:bB,createTracker:dB,compilePattern:rB,enter:s,handlers:{...Ym},handle:void 0,indentLines:lB,indexStack:[],join:[...Q7],options:{},safe:yB,stack:[],unsafe:[...J7]};cw(r,n),r.options.tightDefinitions&&r.join.push(mB),r.handle=uw("type",{invalid:hB,unknown:pB,handlers:r.handlers});let i=r.handle(t,void 0,r,{before:`
125
+ `,after:`
126
+ `,now:{line:1,column:1},lineShift:0});return i&&i.charCodeAt(i.length-1)!==10&&i.charCodeAt(i.length-1)!==13&&(i+=`
127
+ `),i;function s(o){return r.stack.push(o),a;function a(){r.stack.pop()}}}function hB(t){throw new Error("Cannot handle value `"+t+"`, expected node")}function pB(t){const e=t;throw new Error("Cannot handle unknown node `"+e.type+"`")}function mB(t,e){if(t.type==="definition"&&t.type===e.type)return 0}function gB(t,e){return iB(t,this,e)}function bB(t,e){return sB(t,this,e)}function yB(t,e){return uB(this,t,e)}function EB(){return{enter:{table:TB,tableData:Gb,tableHeader:Gb,tableRow:xB},exit:{codeText:SB,table:CB,tableData:xf,tableHeader:xf,tableRow:xf}}}function TB(t){const e=t._align;this.enter({type:"table",align:e.map(function(n){return n==="none"?null:n}),children:[]},t),this.data.inTable=!0}function CB(t){this.exit(t),this.data.inTable=void 0}function xB(t){this.enter({type:"tableRow",children:[]},t)}function xf(t){this.exit(t)}function Gb(t){this.enter({type:"tableCell",children:[]},t)}function SB(t){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,wB));const n=this.stack[this.stack.length-1];n.type,n.value=e,this.exit(t)}function wB(t,e){return e==="|"?e:t}function kB(t){const e=t||{},n=e.tableCellPadding,r=e.tablePipeAlign,i=e.stringLength,s=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
128
+ `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(h,p,g,b){return u(c(h,g,b),h.align)}function a(h,p,g,b){const y=d(h,g,b),E=u([y]);return E.slice(0,E.indexOf(`
129
+ `))}function l(h,p,g,b){const y=g.enter("tableCell"),E=g.enter("phrasing"),T=g.containerPhrasing(h,{...b,before:s,after:s});return E(),y(),T}function u(h,p){return E7(h,{align:p,alignDelimiters:r,padding:n,stringLength:i})}function c(h,p,g){const b=h.children;let y=-1;const E=[],T=p.enter("table");for(;++y<b.length;)E[y]=d(b[y],p,g);return T(),E}function d(h,p,g){const b=h.children;let y=-1;const E=[],T=p.enter("tableRow");for(;++y<b.length;)E[y]=l(b[y],h,p,g);return T(),E}function f(h,p,g){let b=Ym.inlineCode(h,p,g);return g.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function AB(){return{exit:{taskListCheckValueChecked:Xb,taskListCheckValueUnchecked:Xb,paragraph:NB}}}function vB(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:_B}}}function Xb(t){const e=this.stack[this.stack.length-2];e.type,e.checked=t.type==="taskListCheckValueChecked"}function NB(t){const e=this.stack[this.stack.length-2];if(e&&e.type==="listItem"&&typeof e.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=e.children;let s=-1,o;for(;++s<i.length;){const a=i[s];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(t)}function _B(t,e,n,r){const i=t.children[0],s=typeof t.checked=="boolean"&&i&&i.type==="paragraph",o="["+(t.checked?"x":" ")+"] ",a=n.createTracker(r);s&&a.move(o);let l=Ym.listItem(t,e,n,{...r,...a.current()});return s&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,u)),l;function u(c){return c+o}}function IB(){return[V9(),u7(),h7(),EB(),AB()]}function RB(t){return{extensions:[z9(),c7(t),p7(),kB(t),vB()]}}function bn(t,e,n,r){const i=t.length;let s=0,o;if(e<0?e=-e>i?0:i+e:e=e>i?i:e,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(e,n),t.splice(...o);else for(n&&t.splice(e,n);s<r.length;)o=r.slice(s,s+1e4),o.unshift(e,0),t.splice(...o),s+=1e4,e+=1e4}function An(t,e){return t.length>0?(bn(t,t.length,0,e),t):e}const Qb={}.hasOwnProperty;function kw(t){const e={};let n=-1;for(;++n<t.length;)MB(e,t[n]);return e}function MB(t,e){let n;for(n in e){const i=(Qb.call(t,n)?t[n]:void 0)||(t[n]={}),s=e[n];let o;if(s)for(o in s){Qb.call(i,o)||(i[o]=[]);const a=s[o];OB(i[o],Array.isArray(a)?a:a?[a]:[])}}}function OB(t,e){let n=-1;const r=[];for(;++n<e.length;)(e[n].add==="after"?t:r).push(e[n]);bn(t,0,0,r)}const DB={tokenize:UB,partial:!0},Aw={tokenize:$B,partial:!0},vw={tokenize:VB,partial:!0},Nw={tokenize:zB,partial:!0},LB={tokenize:jB,partial:!0},_w={name:"wwwAutolink",tokenize:FB,previous:Rw},Iw={name:"protocolAutolink",tokenize:HB,previous:Mw},Ur={name:"emailAutolink",tokenize:BB,previous:Ow},gr={};function PB(){return{text:gr}}let Si=48;for(;Si<123;)gr[Si]=Ur,Si++,Si===58?Si=65:Si===91&&(Si=97);gr[43]=Ur;gr[45]=Ur;gr[46]=Ur;gr[95]=Ur;gr[72]=[Ur,Iw];gr[104]=[Ur,Iw];gr[87]=[Ur,_w];gr[119]=[Ur,_w];function BB(t,e,n){const r=this;let i,s;return o;function o(d){return!op(d)||!Ow.call(r,r.previous)||Gm(r.events)?n(d):(t.enter("literalAutolink"),t.enter("literalAutolinkEmail"),a(d))}function a(d){return op(d)?(t.consume(d),a):d===64?(t.consume(d),l):n(d)}function l(d){return d===46?t.check(LB,c,u)(d):d===45||d===95||vt(d)?(s=!0,t.consume(d),l):c(d)}function u(d){return t.consume(d),i=!0,l}function c(d){return s&&i&&Ft(r.previous)?(t.exit("literalAutolinkEmail"),t.exit("literalAutolink"),e(d)):n(d)}}function FB(t,e,n){const r=this;return i;function i(o){return o!==87&&o!==119||!Rw.call(r,r.previous)||Gm(r.events)?n(o):(t.enter("literalAutolink"),t.enter("literalAutolinkWww"),t.check(DB,t.attempt(Aw,t.attempt(vw,s),n),n)(o))}function s(o){return t.exit("literalAutolinkWww"),t.exit("literalAutolink"),e(o)}}function HB(t,e,n){const r=this;let i="",s=!1;return o;function o(d){return(d===72||d===104)&&Mw.call(r,r.previous)&&!Gm(r.events)?(t.enter("literalAutolink"),t.enter("literalAutolinkHttp"),i+=String.fromCodePoint(d),t.consume(d),a):n(d)}function a(d){if(Ft(d)&&i.length<5)return i+=String.fromCodePoint(d),t.consume(d),a;if(d===58){const f=i.toLowerCase();if(f==="http"||f==="https")return t.consume(d),l}return n(d)}function l(d){return d===47?(t.consume(d),s?u:(s=!0,l)):n(d)}function u(d){return d===null||rc(d)||Ve(d)||Ki(d)||ed(d)?n(d):t.attempt(Aw,t.attempt(vw,c),n)(d)}function c(d){return t.exit("literalAutolinkHttp"),t.exit("literalAutolink"),e(d)}}function UB(t,e,n){let r=0;return i;function i(o){return(o===87||o===119)&&r<3?(r++,t.consume(o),i):o===46&&r===3?(t.consume(o),s):n(o)}function s(o){return o===null?n(o):e(o)}}function $B(t,e,n){let r,i,s;return o;function o(u){return u===46||u===95?t.check(Nw,l,a)(u):u===null||Ve(u)||Ki(u)||u!==45&&ed(u)?l(u):(s=!0,t.consume(u),o)}function a(u){return u===95?r=!0:(i=r,r=void 0),t.consume(u),o}function l(u){return i||r||!s?n(u):e(u)}}function VB(t,e){let n=0,r=0;return i;function i(o){return o===40?(n++,t.consume(o),i):o===41&&r<n?s(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?t.check(Nw,e,s)(o):o===null||Ve(o)||Ki(o)?e(o):(t.consume(o),i)}function s(o){return o===41&&r++,t.consume(o),i}}function zB(t,e,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(t.consume(a),r):a===38?(t.consume(a),s):a===93?(t.consume(a),i):a===60||a===null||Ve(a)||Ki(a)?e(a):n(a)}function i(a){return a===null||a===40||a===91||Ve(a)||Ki(a)?e(a):r(a)}function s(a){return Ft(a)?o(a):n(a)}function o(a){return a===59?(t.consume(a),r):Ft(a)?(t.consume(a),o):n(a)}}function jB(t,e,n){return r;function r(s){return t.consume(s),i}function i(s){return vt(s)?n(s):e(s)}}function Rw(t){return t===null||t===40||t===42||t===95||t===91||t===93||t===126||Ve(t)}function Mw(t){return!Ft(t)}function Ow(t){return!(t===47||op(t))}function op(t){return t===43||t===45||t===46||t===95||vt(t)}function Gm(t){let e=t.length,n=!1;for(;e--;){const r=t[e][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return t.length>0&&!n&&(t[t.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}function So(t){const e=[];let n=-1,r=0,i=0;for(;++n<t.length;){const s=t.charCodeAt(n);let o="";if(s===37&&vt(t.charCodeAt(n+1))&&vt(t.charCodeAt(n+2)))i=2;else if(s<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(s))||(o=String.fromCharCode(s));else if(s>55295&&s<57344){const a=t.charCodeAt(n+1);s<56320&&a>56319&&a<57344?(o=String.fromCharCode(s,a),i=1):o="�"}else o=String.fromCharCode(s);o&&(e.push(t.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return e.join("")+t.slice(r)}function td(t,e,n){const r=[];let i=-1;for(;++i<t.length;){const s=t[i].resolveAll;s&&!r.includes(s)&&(e=s(e,n),r.push(s))}return e}const ap={name:"attention",resolveAll:WB,tokenize:qB};function WB(t,e){let n=-1,r,i,s,o,a,l,u,c;for(;++n<t.length;)if(t[n][0]==="enter"&&t[n][1].type==="attentionSequence"&&t[n][1]._close){for(r=n;r--;)if(t[r][0]==="exit"&&t[r][1].type==="attentionSequence"&&t[r][1]._open&&e.sliceSerialize(t[r][1]).charCodeAt(0)===e.sliceSerialize(t[n][1]).charCodeAt(0)){if((t[r][1]._close||t[n][1]._open)&&(t[n][1].end.offset-t[n][1].start.offset)%3&&!((t[r][1].end.offset-t[r][1].start.offset+t[n][1].end.offset-t[n][1].start.offset)%3))continue;l=t[r][1].end.offset-t[r][1].start.offset>1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;const d={...t[r][1].end},f={...t[n][1].start};Zb(d,-l),Zb(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...t[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...t[n][1].start},end:f},s={type:l>1?"strongText":"emphasisText",start:{...t[r][1].end},end:{...t[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},t[r][1].end={...o.start},t[n][1].start={...a.end},u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=An(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=An(u,[["enter",i,e],["enter",o,e],["exit",o,e],["enter",s,e]]),u=An(u,td(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=An(u,[["exit",s,e],["enter",a,e],["exit",a,e],["exit",i,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=An(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,bn(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n<t.length;)t[n][1].type==="attentionSequence"&&(t[n][1].type="data");return t}function qB(t,e){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,i=so(r);let s;return o;function o(l){return s=l,t.enter("attentionSequence"),a(l)}function a(l){if(l===s)return t.consume(l),a;const u=t.exit("attentionSequence"),c=so(l),d=!c||c===2&&i||n.includes(l),f=!i||i===2&&c||n.includes(r);return u._open=!!(s===42?d:d&&(i||!f)),u._close=!!(s===42?f:f&&(c||!d)),e(l)}}function Zb(t,e){t.column+=e,t.offset+=e,t._bufferIndex+=e}const YB={name:"autolink",tokenize:KB};function KB(t,e,n){let r=0;return i;function i(h){return t.enter("autolink"),t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.enter("autolinkProtocol"),s}function s(h){return Ft(h)?(t.consume(h),o):h===64?n(h):u(h)}function o(h){return h===43||h===45||h===46||vt(h)?(r=1,a(h)):u(h)}function a(h){return h===58?(t.consume(h),r=0,l):(h===43||h===45||h===46||vt(h))&&r++<32?(t.consume(h),a):(r=0,u(h))}function l(h){return h===62?(t.exit("autolinkProtocol"),t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.exit("autolink"),e):h===null||h===32||h===60||rc(h)?n(h):(t.consume(h),l)}function u(h){return h===64?(t.consume(h),c):D9(h)?(t.consume(h),u):n(h)}function c(h){return vt(h)?d(h):n(h)}function d(h){return h===46?(t.consume(h),r=0,c):h===62?(t.exit("autolinkProtocol").type="autolinkEmail",t.enter("autolinkMarker"),t.consume(h),t.exit("autolinkMarker"),t.exit("autolink"),e):f(h)}function f(h){if((h===45||vt(h))&&r++<63){const p=h===45?f:d;return t.consume(h),p}return n(h)}}function Re(t,e,n,r){const i=r?r-1:Number.POSITIVE_INFINITY;let s=0;return o;function o(l){return Ae(l)?(t.enter(n),a(l)):e(l)}function a(l){return Ae(l)&&s++<i?(t.consume(l),a):(t.exit(n),e(l))}}const hl={partial:!0,tokenize:GB};function GB(t,e,n){return r;function r(s){return Ae(s)?Re(t,i,"linePrefix")(s):i(s)}function i(s){return s===null||de(s)?e(s):n(s)}}const Dw={continuation:{tokenize:QB},exit:ZB,name:"blockQuote",tokenize:XB};function XB(t,e,n){const r=this;return i;function i(o){if(o===62){const a=r.containerState;return a.open||(t.enter("blockQuote",{_container:!0}),a.open=!0),t.enter("blockQuotePrefix"),t.enter("blockQuoteMarker"),t.consume(o),t.exit("blockQuoteMarker"),s}return n(o)}function s(o){return Ae(o)?(t.enter("blockQuotePrefixWhitespace"),t.consume(o),t.exit("blockQuotePrefixWhitespace"),t.exit("blockQuotePrefix"),e):(t.exit("blockQuotePrefix"),e(o))}}function QB(t,e,n){const r=this;return i;function i(o){return Ae(o)?Re(t,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):s(o)}function s(o){return t.attempt(Dw,e,n)(o)}}function ZB(t){t.exit("blockQuote")}const Lw={name:"characterEscape",tokenize:JB};function JB(t,e,n){return r;function r(s){return t.enter("characterEscape"),t.enter("escapeMarker"),t.consume(s),t.exit("escapeMarker"),i}function i(s){return P9(s)?(t.enter("characterEscapeValue"),t.consume(s),t.exit("characterEscapeValue"),t.exit("characterEscape"),e):n(s)}}const Pw={name:"characterReference",tokenize:eF};function eF(t,e,n){const r=this;let i=0,s,o;return a;function a(d){return t.enter("characterReference"),t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),l}function l(d){return d===35?(t.enter("characterReferenceMarkerNumeric"),t.consume(d),t.exit("characterReferenceMarkerNumeric"),u):(t.enter("characterReferenceValue"),s=31,o=vt,c(d))}function u(d){return d===88||d===120?(t.enter("characterReferenceMarkerHexadecimal"),t.consume(d),t.exit("characterReferenceMarkerHexadecimal"),t.enter("characterReferenceValue"),s=6,o=L9,c):(t.enter("characterReferenceValue"),s=7,o=ip,c(d))}function c(d){if(d===59&&i){const f=t.exit("characterReferenceValue");return o===vt&&!Km(r.sliceSerialize(f))?n(d):(t.enter("characterReferenceMarker"),t.consume(d),t.exit("characterReferenceMarker"),t.exit("characterReference"),e)}return o(d)&&i++<s?(t.consume(d),c):n(d)}}const Jb={partial:!0,tokenize:nF},ey={concrete:!0,name:"codeFenced",tokenize:tF};function tF(t,e,n){const r=this,i={partial:!0,tokenize:R};let s=0,o=0,a;return l;function l(A){return u(A)}function u(A){const O=r.events[r.events.length-1];return s=O&&O[1].type==="linePrefix"?O[2].sliceSerialize(O[1],!0).length:0,a=A,t.enter("codeFenced"),t.enter("codeFencedFence"),t.enter("codeFencedFenceSequence"),c(A)}function c(A){return A===a?(o++,t.consume(A),c):o<3?n(A):(t.exit("codeFencedFenceSequence"),Ae(A)?Re(t,d,"whitespace")(A):d(A))}function d(A){return A===null||de(A)?(t.exit("codeFencedFence"),r.interrupt?e(A):t.check(Jb,g,v)(A)):(t.enter("codeFencedFenceInfo"),t.enter("chunkString",{contentType:"string"}),f(A))}function f(A){return A===null||de(A)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),d(A)):Ae(A)?(t.exit("chunkString"),t.exit("codeFencedFenceInfo"),Re(t,h,"whitespace")(A)):A===96&&A===a?n(A):(t.consume(A),f)}function h(A){return A===null||de(A)?d(A):(t.enter("codeFencedFenceMeta"),t.enter("chunkString",{contentType:"string"}),p(A))}function p(A){return A===null||de(A)?(t.exit("chunkString"),t.exit("codeFencedFenceMeta"),d(A)):A===96&&A===a?n(A):(t.consume(A),p)}function g(A){return t.attempt(i,v,b)(A)}function b(A){return t.enter("lineEnding"),t.consume(A),t.exit("lineEnding"),y}function y(A){return s>0&&Ae(A)?Re(t,E,"linePrefix",s+1)(A):E(A)}function E(A){return A===null||de(A)?t.check(Jb,g,v)(A):(t.enter("codeFlowValue"),T(A))}function T(A){return A===null||de(A)?(t.exit("codeFlowValue"),E(A)):(t.consume(A),T)}function v(A){return t.exit("codeFenced"),e(A)}function R(A,O,P){let F=0;return N;function N(B){return A.enter("lineEnding"),A.consume(B),A.exit("lineEnding"),U}function U(B){return A.enter("codeFencedFence"),Ae(B)?Re(A,j,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(B):j(B)}function j(B){return B===a?(A.enter("codeFencedFenceSequence"),z(B)):P(B)}function z(B){return B===a?(F++,A.consume(B),z):F>=o?(A.exit("codeFencedFenceSequence"),Ae(B)?Re(A,I,"whitespace")(B):I(B)):P(B)}function I(B){return B===null||de(B)?(A.exit("codeFencedFence"),O(B)):P(B)}}}function nF(t,e,n){const r=this;return i;function i(o){return o===null?n(o):(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}const Sf={name:"codeIndented",tokenize:iF},rF={partial:!0,tokenize:sF};function iF(t,e,n){const r=this;return i;function i(u){return t.enter("codeIndented"),Re(t,s,"linePrefix",5)(u)}function s(u){const c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):de(u)?t.attempt(rF,o,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||de(u)?(t.exit("codeFlowValue"),o(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function sF(t,e,n){const r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):de(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),i):Re(t,s,"linePrefix",5)(o)}function s(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):de(o)?i(o):n(o)}}const oF={name:"codeText",previous:lF,resolve:aF,tokenize:uF};function aF(t){let e=t.length-4,n=3,r,i;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r<e;)if(t[r][1].type==="codeTextData"){t[n][1].type="codeTextPadding",t[e][1].type="codeTextPadding",n+=2,e-=2;break}}for(r=n-1,e++;++r<=e;)i===void 0?r!==e&&t[r][1].type!=="lineEnding"&&(i=r):(r===e||t[r][1].type==="lineEnding")&&(t[i][1].type="codeTextData",r!==i+2&&(t[i][1].end=t[r-1][1].end,t.splice(i+2,r-i-2),e-=r-i-2,r=i+2),i=void 0);return t}function lF(t){return t!==96||this.events[this.events.length-1][1].type==="characterEscape"}function uF(t,e,n){let r=0,i,s;return o;function o(d){return t.enter("codeText"),t.enter("codeTextSequence"),a(d)}function a(d){return d===96?(t.consume(d),r++,a):(t.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(t.enter("space"),t.consume(d),t.exit("space"),l):d===96?(s=t.enter("codeTextSequence"),i=0,c(d)):de(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),l):(t.enter("codeTextData"),u(d))}function u(d){return d===null||d===32||d===96||de(d)?(t.exit("codeTextData"),l(d)):(t.consume(d),u)}function c(d){return d===96?(t.consume(d),i++,c):i===r?(t.exit("codeTextSequence"),t.exit("codeText"),e(d)):(s.type="codeTextData",u(d))}}class cF{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return e<this.left.length?this.left[e]:this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(e,r):e>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(e,n,r){const i=n||0;this.setCursor(Math.trunc(e));const s=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&jo(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),jo(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),jo(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e<this.left.length){const n=this.left.splice(e,Number.POSITIVE_INFINITY);jo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);jo(this.left,n.reverse())}}}function jo(t,e){let n=0;if(e.length<1e4)t.push(...e);else for(;n<e.length;)t.push(...e.slice(n,n+1e4)),n+=1e4}function Bw(t){const e={};let n=-1,r,i,s,o,a,l,u;const c=new cF(t);for(;++n<c.length;){for(;n in e;)n=e[n];if(r=c.get(n),n&&r[1].type==="chunkFlow"&&c.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,s=0,s<l.length&&l[s][1].type==="lineEndingBlank"&&(s+=2),s<l.length&&l[s][1].type==="content"))for(;++s<l.length&&l[s][1].type!=="content";)l[s][1].type==="chunkText"&&(l[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(e,dF(c,n)),n=e[n],u=!0);else if(r[1]._container){for(s=n,i=void 0;s--;)if(o=c.get(s),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(i&&(c.get(i)[1].type="lineEndingBlank"),o[1].type="lineEnding",i=s);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;i&&(r[1].end={...c.get(i)[1].start},a=c.slice(i,n),a.unshift(r),c.splice(i,n-i+1,a))}}return bn(t,0,Number.POSITIVE_INFINITY,c.slice(0)),!u}function dF(t,e){const n=t.get(e)[1],r=t.get(e)[2];let i=e-1;const s=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],u={};let c,d,f=-1,h=n,p=0,g=0;const b=[g];for(;h;){for(;t.get(++i)[1]!==h;);s.push(i),h._tokenizer||(c=r.sliceStream(h),h.next||c.push(null),d&&o.defineSkip(h.start),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(c),h._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=h,h=h.next}for(h=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,b.push(g),h._tokenizer=void 0,h.previous=void 0,h=h.next);for(o.events=[],h?(h._tokenizer=void 0,h.previous=void 0):b.pop(),f=b.length;f--;){const y=a.slice(b[f],b[f+1]),E=s.pop();l.push([E,E+y.length-1]),t.splice(E,2,y)}for(l.reverse(),f=-1;++f<l.length;)u[p+l[f][0]]=p+l[f][1],p+=l[f][1]-l[f][0]-1;return u}const fF={resolve:pF,tokenize:mF},hF={partial:!0,tokenize:gF};function pF(t){return Bw(t),t}function mF(t,e){let n;return r;function r(a){return t.enter("content"),n=t.enter("chunkContent",{contentType:"content"}),i(a)}function i(a){return a===null?s(a):de(a)?t.check(hF,o,s)(a):(t.consume(a),i)}function s(a){return t.exit("chunkContent"),t.exit("content"),e(a)}function o(a){return t.consume(a),t.exit("chunkContent"),n.next=t.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,i}}function gF(t,e,n){const r=this;return i;function i(o){return t.exit("chunkContent"),t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),Re(t,s,"linePrefix")}function s(o){if(o===null||de(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(o):t.interrupt(r.parser.constructs.flow,n,e)(o)}}function Fw(t,e,n,r,i,s,o,a,l){const u=l||Number.POSITIVE_INFINITY;let c=0;return d;function d(y){return y===60?(t.enter(r),t.enter(i),t.enter(s),t.consume(y),t.exit(s),f):y===null||y===32||y===41||rc(y)?n(y):(t.enter(r),t.enter(o),t.enter(a),t.enter("chunkString",{contentType:"string"}),g(y))}function f(y){return y===62?(t.enter(s),t.consume(y),t.exit(s),t.exit(i),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),h(y))}function h(y){return y===62?(t.exit("chunkString"),t.exit(a),f(y)):y===null||y===60||de(y)?n(y):(t.consume(y),y===92?p:h)}function p(y){return y===60||y===62||y===92?(t.consume(y),h):h(y)}function g(y){return!c&&(y===null||y===41||Ve(y))?(t.exit("chunkString"),t.exit(a),t.exit(o),t.exit(r),e(y)):c<u&&y===40?(t.consume(y),c++,g):y===41?(t.consume(y),c--,g):y===null||y===32||y===40||rc(y)?n(y):(t.consume(y),y===92?b:g)}function b(y){return y===40||y===41||y===92?(t.consume(y),g):g(y)}}function Hw(t,e,n,r,i,s){const o=this;let a=0,l;return u;function u(h){return t.enter(r),t.enter(i),t.consume(h),t.exit(i),t.enter(s),c}function c(h){return a>999||h===null||h===91||h===93&&!l||h===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(t.exit(s),t.enter(i),t.consume(h),t.exit(i),t.exit(r),e):de(h)?(t.enter("lineEnding"),t.consume(h),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),d(h))}function d(h){return h===null||h===91||h===93||de(h)||a++>999?(t.exit("chunkString"),c(h)):(t.consume(h),l||(l=!Ae(h)),h===92?f:d)}function f(h){return h===91||h===92||h===93?(t.consume(h),a++,d):d(h)}}function Uw(t,e,n,r,i,s){let o;return a;function a(f){return f===34||f===39||f===40?(t.enter(r),t.enter(i),t.consume(f),t.exit(i),o=f===40?41:f,l):n(f)}function l(f){return f===o?(t.enter(i),t.consume(f),t.exit(i),t.exit(r),e):(t.enter(s),u(f))}function u(f){return f===o?(t.exit(s),l(o)):f===null?n(f):de(f)?(t.enter("lineEnding"),t.consume(f),t.exit("lineEnding"),Re(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(f))}function c(f){return f===o||f===null||de(f)?(t.exit("chunkString"),u(f)):(t.consume(f),f===92?d:c)}function d(f){return f===o||f===92?(t.consume(f),c):c(f)}}function ma(t,e){let n;return r;function r(i){return de(i)?(t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),n=!0,r):Ae(i)?Re(t,r,n?"linePrefix":"lineSuffix")(i):e(i)}}const bF={name:"definition",tokenize:EF},yF={partial:!0,tokenize:TF};function EF(t,e,n){const r=this;let i;return s;function s(h){return t.enter("definition"),o(h)}function o(h){return Hw.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function a(h){return i=Vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(t.enter("definitionMarker"),t.consume(h),t.exit("definitionMarker"),l):n(h)}function l(h){return Ve(h)?ma(t,u)(h):u(h)}function u(h){return Fw(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return t.attempt(yF,d,d)(h)}function d(h){return Ae(h)?Re(t,f,"whitespace")(h):f(h)}function f(h){return h===null||de(h)?(t.exit("definition"),r.parser.defined.push(i),e(h)):n(h)}}function TF(t,e,n){return r;function r(a){return Ve(a)?ma(t,i)(a):n(a)}function i(a){return Uw(t,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return Ae(a)?Re(t,o,"whitespace")(a):o(a)}function o(a){return a===null||de(a)?e(a):n(a)}}const CF={name:"hardBreakEscape",tokenize:xF};function xF(t,e,n){return r;function r(s){return t.enter("hardBreakEscape"),t.consume(s),i}function i(s){return de(s)?(t.exit("hardBreakEscape"),e(s)):n(s)}}const SF={name:"headingAtx",resolve:wF,tokenize:kF};function wF(t,e){let n=t.length-2,r=3,i,s;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},s={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},bn(t,r,n-r+1,[["enter",i,e],["enter",s,e],["exit",s,e],["exit",i,e]])),t}function kF(t,e,n){let r=0;return i;function i(c){return t.enter("atxHeading"),s(c)}function s(c){return t.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(t.consume(c),o):c===null||Ve(c)?(t.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||de(c)?(t.exit("atxHeading"),e(c)):Ae(c)?Re(t,a,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Ve(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}const AF=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ty=["pre","script","style","textarea"],vF={concrete:!0,name:"htmlFlow",resolveTo:IF,tokenize:RF},NF={partial:!0,tokenize:OF},_F={partial:!0,tokenize:MF};function IF(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function RF(t,e,n){const r=this;let i,s,o,a,l;return u;function u(w){return c(w)}function c(w){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(w),d}function d(w){return w===33?(t.consume(w),f):w===47?(t.consume(w),s=!0,g):w===63?(t.consume(w),i=3,r.interrupt?e:x):Ft(w)?(t.consume(w),o=String.fromCharCode(w),b):n(w)}function f(w){return w===45?(t.consume(w),i=2,h):w===91?(t.consume(w),i=5,a=0,p):Ft(w)?(t.consume(w),i=4,r.interrupt?e:x):n(w)}function h(w){return w===45?(t.consume(w),r.interrupt?e:x):n(w)}function p(w){const me="CDATA[";return w===me.charCodeAt(a++)?(t.consume(w),a===me.length?r.interrupt?e:j:p):n(w)}function g(w){return Ft(w)?(t.consume(w),o=String.fromCharCode(w),b):n(w)}function b(w){if(w===null||w===47||w===62||Ve(w)){const me=w===47,te=o.toLowerCase();return!me&&!s&&ty.includes(te)?(i=1,r.interrupt?e(w):j(w)):AF.includes(o.toLowerCase())?(i=6,me?(t.consume(w),y):r.interrupt?e(w):j(w)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(w):s?E(w):T(w))}return w===45||vt(w)?(t.consume(w),o+=String.fromCharCode(w),b):n(w)}function y(w){return w===62?(t.consume(w),r.interrupt?e:j):n(w)}function E(w){return Ae(w)?(t.consume(w),E):N(w)}function T(w){return w===47?(t.consume(w),N):w===58||w===95||Ft(w)?(t.consume(w),v):Ae(w)?(t.consume(w),T):N(w)}function v(w){return w===45||w===46||w===58||w===95||vt(w)?(t.consume(w),v):R(w)}function R(w){return w===61?(t.consume(w),A):Ae(w)?(t.consume(w),R):T(w)}function A(w){return w===null||w===60||w===61||w===62||w===96?n(w):w===34||w===39?(t.consume(w),l=w,O):Ae(w)?(t.consume(w),A):P(w)}function O(w){return w===l?(t.consume(w),l=null,F):w===null||de(w)?n(w):(t.consume(w),O)}function P(w){return w===null||w===34||w===39||w===47||w===60||w===61||w===62||w===96||Ve(w)?R(w):(t.consume(w),P)}function F(w){return w===47||w===62||Ae(w)?T(w):n(w)}function N(w){return w===62?(t.consume(w),U):n(w)}function U(w){return w===null||de(w)?j(w):Ae(w)?(t.consume(w),U):n(w)}function j(w){return w===45&&i===2?(t.consume(w),Z):w===60&&i===1?(t.consume(w),H):w===62&&i===4?(t.consume(w),ne):w===63&&i===3?(t.consume(w),x):w===93&&i===5?(t.consume(w),V):de(w)&&(i===6||i===7)?(t.exit("htmlFlowData"),t.check(NF,G,z)(w)):w===null||de(w)?(t.exit("htmlFlowData"),z(w)):(t.consume(w),j)}function z(w){return t.check(_F,I,G)(w)}function I(w){return t.enter("lineEnding"),t.consume(w),t.exit("lineEnding"),B}function B(w){return w===null||de(w)?z(w):(t.enter("htmlFlowData"),j(w))}function Z(w){return w===45?(t.consume(w),x):j(w)}function H(w){return w===47?(t.consume(w),o="",D):j(w)}function D(w){if(w===62){const me=o.toLowerCase();return ty.includes(me)?(t.consume(w),ne):j(w)}return Ft(w)&&o.length<8?(t.consume(w),o+=String.fromCharCode(w),D):j(w)}function V(w){return w===93?(t.consume(w),x):j(w)}function x(w){return w===62?(t.consume(w),ne):w===45&&i===2?(t.consume(w),x):j(w)}function ne(w){return w===null||de(w)?(t.exit("htmlFlowData"),G(w)):(t.consume(w),ne)}function G(w){return t.exit("htmlFlow"),e(w)}}function MF(t,e,n){const r=this;return i;function i(o){return de(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),s):n(o)}function s(o){return r.parser.lazy[r.now().line]?n(o):e(o)}}function OF(t,e,n){return r;function r(i){return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),t.attempt(hl,e,n)}}const DF={name:"htmlText",tokenize:LF};function LF(t,e,n){const r=this;let i,s,o;return a;function a(x){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(x),l}function l(x){return x===33?(t.consume(x),u):x===47?(t.consume(x),R):x===63?(t.consume(x),T):Ft(x)?(t.consume(x),P):n(x)}function u(x){return x===45?(t.consume(x),c):x===91?(t.consume(x),s=0,p):Ft(x)?(t.consume(x),E):n(x)}function c(x){return x===45?(t.consume(x),h):n(x)}function d(x){return x===null?n(x):x===45?(t.consume(x),f):de(x)?(o=d,H(x)):(t.consume(x),d)}function f(x){return x===45?(t.consume(x),h):d(x)}function h(x){return x===62?Z(x):x===45?f(x):d(x)}function p(x){const ne="CDATA[";return x===ne.charCodeAt(s++)?(t.consume(x),s===ne.length?g:p):n(x)}function g(x){return x===null?n(x):x===93?(t.consume(x),b):de(x)?(o=g,H(x)):(t.consume(x),g)}function b(x){return x===93?(t.consume(x),y):g(x)}function y(x){return x===62?Z(x):x===93?(t.consume(x),y):g(x)}function E(x){return x===null||x===62?Z(x):de(x)?(o=E,H(x)):(t.consume(x),E)}function T(x){return x===null?n(x):x===63?(t.consume(x),v):de(x)?(o=T,H(x)):(t.consume(x),T)}function v(x){return x===62?Z(x):T(x)}function R(x){return Ft(x)?(t.consume(x),A):n(x)}function A(x){return x===45||vt(x)?(t.consume(x),A):O(x)}function O(x){return de(x)?(o=O,H(x)):Ae(x)?(t.consume(x),O):Z(x)}function P(x){return x===45||vt(x)?(t.consume(x),P):x===47||x===62||Ve(x)?F(x):n(x)}function F(x){return x===47?(t.consume(x),Z):x===58||x===95||Ft(x)?(t.consume(x),N):de(x)?(o=F,H(x)):Ae(x)?(t.consume(x),F):Z(x)}function N(x){return x===45||x===46||x===58||x===95||vt(x)?(t.consume(x),N):U(x)}function U(x){return x===61?(t.consume(x),j):de(x)?(o=U,H(x)):Ae(x)?(t.consume(x),U):F(x)}function j(x){return x===null||x===60||x===61||x===62||x===96?n(x):x===34||x===39?(t.consume(x),i=x,z):de(x)?(o=j,H(x)):Ae(x)?(t.consume(x),j):(t.consume(x),I)}function z(x){return x===i?(t.consume(x),i=void 0,B):x===null?n(x):de(x)?(o=z,H(x)):(t.consume(x),z)}function I(x){return x===null||x===34||x===39||x===60||x===61||x===96?n(x):x===47||x===62||Ve(x)?F(x):(t.consume(x),I)}function B(x){return x===47||x===62||Ve(x)?F(x):n(x)}function Z(x){return x===62?(t.consume(x),t.exit("htmlTextData"),t.exit("htmlText"),e):n(x)}function H(x){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(x),t.exit("lineEnding"),D}function D(x){return Ae(x)?Re(t,V,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(x):V(x)}function V(x){return t.enter("htmlTextData"),o(x)}}const Xm={name:"labelEnd",resolveAll:HF,resolveTo:UF,tokenize:$F},PF={tokenize:VF},BF={tokenize:zF},FF={tokenize:jF};function HF(t){let e=-1;const n=[];for(;++e<t.length;){const r=t[e][1];if(n.push(t[e]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const i=r.type==="labelImage"?4:2;r.type="data",e+=i}}return t.length!==n.length&&bn(t,0,t.length,n),t}function UF(t,e){let n=t.length,r=0,i,s,o,a;for(;n--;)if(i=t[n][1],s){if(i.type==="link"||i.type==="labelLink"&&i._inactive)break;t[n][0]==="enter"&&i.type==="labelLink"&&(i._inactive=!0)}else if(o){if(t[n][0]==="enter"&&(i.type==="labelImage"||i.type==="labelLink")&&!i._balanced&&(s=n,i.type!=="labelLink")){r=2;break}}else i.type==="labelEnd"&&(o=n);const l={type:t[s][1].type==="labelLink"?"link":"image",start:{...t[s][1].start},end:{...t[t.length-1][1].end}},u={type:"label",start:{...t[s][1].start},end:{...t[o][1].end}},c={type:"labelText",start:{...t[s+r+2][1].end},end:{...t[o-2][1].start}};return a=[["enter",l,e],["enter",u,e]],a=An(a,t.slice(s+1,s+r+3)),a=An(a,[["enter",c,e]]),a=An(a,td(e.parser.constructs.insideSpan.null,t.slice(s+r+4,o-3),e)),a=An(a,[["exit",c,e],t[o-2],t[o-1],["exit",u,e]]),a=An(a,t.slice(o+1)),a=An(a,[["exit",l,e]]),bn(t,s,t.length,a),t}function $F(t,e,n){const r=this;let i=r.events.length,s,o;for(;i--;)if((r.events[i][1].type==="labelImage"||r.events[i][1].type==="labelLink")&&!r.events[i][1]._balanced){s=r.events[i][1];break}return a;function a(f){return s?s._inactive?d(f):(o=r.parser.defined.includes(Vn(r.sliceSerialize({start:s.end,end:r.now()}))),t.enter("labelEnd"),t.enter("labelMarker"),t.consume(f),t.exit("labelMarker"),t.exit("labelEnd"),l):n(f)}function l(f){return f===40?t.attempt(PF,c,o?c:d)(f):f===91?t.attempt(BF,c,o?u:d)(f):o?c(f):d(f)}function u(f){return t.attempt(FF,c,d)(f)}function c(f){return e(f)}function d(f){return s._balanced=!0,n(f)}}function VF(t,e,n){return r;function r(d){return t.enter("resource"),t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),i}function i(d){return Ve(d)?ma(t,s)(d):s(d)}function s(d){return d===41?c(d):Fw(t,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return Ve(d)?ma(t,l)(d):c(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?Uw(t,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):c(d)}function u(d){return Ve(d)?ma(t,c)(d):c(d)}function c(d){return d===41?(t.enter("resourceMarker"),t.consume(d),t.exit("resourceMarker"),t.exit("resource"),e):n(d)}}function zF(t,e,n){const r=this;return i;function i(a){return Hw.call(r,t,s,o,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(Vn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?e(a):n(a)}function o(a){return n(a)}}function jF(t,e,n){return r;function r(s){return t.enter("reference"),t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),i}function i(s){return s===93?(t.enter("referenceMarker"),t.consume(s),t.exit("referenceMarker"),t.exit("reference"),e):n(s)}}const WF={name:"labelStartImage",resolveAll:Xm.resolveAll,tokenize:qF};function qF(t,e,n){const r=this;return i;function i(a){return t.enter("labelImage"),t.enter("labelImageMarker"),t.consume(a),t.exit("labelImageMarker"),s}function s(a){return a===91?(t.enter("labelMarker"),t.consume(a),t.exit("labelMarker"),t.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):e(a)}}const YF={name:"labelStartLink",resolveAll:Xm.resolveAll,tokenize:KF};function KF(t,e,n){const r=this;return i;function i(o){return t.enter("labelLink"),t.enter("labelMarker"),t.consume(o),t.exit("labelMarker"),t.exit("labelLink"),s}function s(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):e(o)}}const wf={name:"lineEnding",tokenize:GF};function GF(t,e){return n;function n(r){return t.enter("lineEnding"),t.consume(r),t.exit("lineEnding"),Re(t,e,"linePrefix")}}const yu={name:"thematicBreak",tokenize:XF};function XF(t,e,n){let r=0,i;return s;function s(u){return t.enter("thematicBreak"),o(u)}function o(u){return i=u,a(u)}function a(u){return u===i?(t.enter("thematicBreakSequence"),l(u)):r>=3&&(u===null||de(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===i?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Ae(u)?Re(t,a,"whitespace")(u):a(u))}}const Yt={continuation:{tokenize:eH},exit:nH,name:"list",tokenize:JF},QF={partial:!0,tokenize:rH},ZF={partial:!0,tokenize:tH};function JF(t,e,n){const r=this,i=r.events[r.events.length-1];let s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return a;function a(h){const p=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(p==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:ip(h)){if(r.containerState.type||(r.containerState.type=p,t.enter(p,{_container:!0})),p==="listUnordered")return t.enter("listItemPrefix"),h===42||h===45?t.check(yu,n,u)(h):u(h);if(!r.interrupt||h===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(h)}return n(h)}function l(h){return ip(h)&&++o<10?(t.consume(h),l):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(t.exit("listItemValue"),u(h)):n(h)}function u(h){return t.enter("listItemMarker"),t.consume(h),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,t.check(hl,r.interrupt?n:c,t.attempt(QF,f,d))}function c(h){return r.containerState.initialBlankLine=!0,s++,f(h)}function d(h){return Ae(h)?(t.enter("listItemPrefixWhitespace"),t.consume(h),t.exit("listItemPrefixWhitespace"),f):n(h)}function f(h){return r.containerState.size=s+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(h)}}function eH(t,e,n){const r=this;return r.containerState._closeFlow=void 0,t.check(hl,i,s);function i(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Re(t,e,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!Ae(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(ZF,e,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Re(t,t.attempt(Yt,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function tH(t,e,n){const r=this;return Re(t,i,"listItemIndent",r.containerState.size+1);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?e(s):n(s)}}function nH(t){t.exit(this.containerState.type)}function rH(t,e,n){const r=this;return Re(t,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(s){const o=r.events[r.events.length-1];return!Ae(s)&&o&&o[1].type==="listItemPrefixWhitespace"?e(s):n(s)}}const ny={name:"setextUnderline",resolveTo:iH,tokenize:sH};function iH(t,e){let n=t.length,r,i,s;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(i=n)}else t[n][1].type==="content"&&t.splice(n,1),!s&&t[n][1].type==="definition"&&(s=n);const o={type:"setextHeading",start:{...t[r][1].start},end:{...t[t.length-1][1].end}};return t[i][1].type="setextHeadingText",s?(t.splice(i,0,["enter",o,e]),t.splice(s+1,0,["exit",t[r][1],e]),t[r][1].end={...t[s][1].end}):t[r][1]=o,t.push(["exit",o,e]),t}function sH(t,e,n){const r=this;let i;return s;function s(u){let c=r.events.length,d;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){d=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(t.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return t.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===i?(t.consume(u),a):(t.exit("setextHeadingLineSequence"),Ae(u)?Re(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||de(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}const oH={tokenize:pH,partial:!0};function aH(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:dH,continuation:{tokenize:fH},exit:hH}},text:{91:{name:"gfmFootnoteCall",tokenize:cH},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:lH,resolveTo:uH}}}}function lH(t,e,n){const r=this;let i=r.events.length;const s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;i--;){const l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const u=Vn(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!s.includes(u.slice(1))?n(l):(t.enter("gfmFootnoteCallLabelMarker"),t.consume(l),t.exit("gfmFootnoteCallLabelMarker"),e(l))}}function uH(t,e){let n=t.length;for(;n--;)if(t[n][1].type==="labelImage"&&t[n][0]==="enter"){t[n][1];break}t[n+1][1].type="data",t[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},t[n+3][1].start),end:Object.assign({},t[t.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},t[n+3][1].end),end:Object.assign({},t[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const s={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},t[t.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},s.start),end:Object.assign({},s.end)},a=[t[n+1],t[n+2],["enter",r,e],t[n+3],t[n+4],["enter",i,e],["exit",i,e],["enter",s,e],["enter",o,e],["exit",o,e],["exit",s,e],t[t.length-2],t[t.length-1],["exit",r,e]];return t.splice(n,t.length-n+1,...a),t}function cH(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s=0,o;return a;function a(d){return t.enter("gfmFootnoteCall"),t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(t.enter("gfmFootnoteCallMarker"),t.consume(d),t.exit("gfmFootnoteCallMarker"),t.enter("gfmFootnoteCallString"),t.enter("chunkString").contentType="string",u)}function u(d){if(s>999||d===93&&!o||d===null||d===91||Ve(d))return n(d);if(d===93){t.exit("chunkString");const f=t.exit("gfmFootnoteCallString");return i.includes(Vn(r.sliceSerialize(f)))?(t.enter("gfmFootnoteCallLabelMarker"),t.consume(d),t.exit("gfmFootnoteCallLabelMarker"),t.exit("gfmFootnoteCall"),e):n(d)}return Ve(d)||(o=!0),s++,t.consume(d),d===92?c:u}function c(d){return d===91||d===92||d===93?(t.consume(d),s++,u):u(d)}}function dH(t,e,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s,o=0,a;return l;function l(p){return t.enter("gfmFootnoteDefinition")._container=!0,t.enter("gfmFootnoteDefinitionLabel"),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(p){return p===94?(t.enter("gfmFootnoteDefinitionMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionMarker"),t.enter("gfmFootnoteDefinitionLabelString"),t.enter("chunkString").contentType="string",c):n(p)}function c(p){if(o>999||p===93&&!a||p===null||p===91||Ve(p))return n(p);if(p===93){t.exit("chunkString");const g=t.exit("gfmFootnoteDefinitionLabelString");return s=Vn(r.sliceSerialize(g)),t.enter("gfmFootnoteDefinitionLabelMarker"),t.consume(p),t.exit("gfmFootnoteDefinitionLabelMarker"),t.exit("gfmFootnoteDefinitionLabel"),f}return Ve(p)||(a=!0),o++,t.consume(p),p===92?d:c}function d(p){return p===91||p===92||p===93?(t.consume(p),o++,c):c(p)}function f(p){return p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),i.includes(s)||i.push(s),Re(t,h,"gfmFootnoteDefinitionWhitespace")):n(p)}function h(p){return e(p)}}function fH(t,e,n){return t.check(hl,e,t.attempt(oH,e,n))}function hH(t){t.exit("gfmFootnoteDefinition")}function pH(t,e,n){const r=this;return Re(t,i,"gfmFootnoteDefinitionIndent",5);function i(s){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?e(s):n(s)}}function mH(t){let n=(t||{}).singleTilde;const r={name:"strikethrough",tokenize:s,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let u=l;for(;u--;)if(o[u][0]==="exit"&&o[u][1].type==="strikethroughSequenceTemporary"&&o[u][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[u][1].end.offset-o[u][1].start.offset){o[l][1].type="strikethroughSequence",o[u][1].type="strikethroughSequence";const c={type:"strikethrough",start:Object.assign({},o[u][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[u][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",c,a],["enter",o[u][1],a],["exit",o[u][1],a],["enter",d,a]],h=a.parser.constructs.insideSpan.null;h&&bn(f,f.length,0,td(h,o.slice(u+1,l),a)),bn(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",c,a]]),bn(o,u-1,l-u+3,f),l=u+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function s(o,a,l){const u=this.previous,c=this.events;let d=0;return f;function f(p){return u===126&&c[c.length-1][1].type!=="characterEscape"?l(p):(o.enter("strikethroughSequenceTemporary"),h(p))}function h(p){const g=so(u);if(p===126)return d>1?l(p):(o.consume(p),d++,h);if(d<2&&!n)return l(p);const b=o.exit("strikethroughSequenceTemporary"),y=so(p);return b._open=!y||y===2&&!!g,b._close=!g||g===2&&!!y,a(p)}}}class gH{constructor(){this.map=[]}add(e,n,r){bH(this,e,n,r)}consume(e){if(this.map.sort(function(s,o){return s[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(e.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),e.length=this.map[n][0];r.push(e.slice()),e.length=0;let i=r.pop();for(;i;){for(const s of i)e.push(s);i=r.pop()}this.map.length=0}}function bH(t,e,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<t.map.length;){if(t.map[i][0]===e){t.map[i][1]+=n,t.map[i][2].push(...r);return}i+=1}t.map.push([e,n,r])}}function yH(t,e){let n=!1;const r=[];for(;e<t.length;){const i=t[e];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(t[e+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(t[e-1][1].type==="tableDelimiterMarker"){const s=r.length-1;r[s]=r[s]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);e+=1}return r}function EH(){return{flow:{null:{name:"table",tokenize:TH,resolveAll:CH}}}}function TH(t,e,n){const r=this;let i=0,s=0,o;return a;function a(N){let U=r.events.length-1;for(;U>-1;){const I=r.events[U][1].type;if(I==="lineEnding"||I==="linePrefix")U--;else break}const j=U>-1?r.events[U][1].type:null,z=j==="tableHead"||j==="tableRow"?A:l;return z===A&&r.parser.lazy[r.now().line]?n(N):z(N)}function l(N){return t.enter("tableHead"),t.enter("tableRow"),u(N)}function u(N){return N===124||(o=!0,s+=1),c(N)}function c(N){return N===null?n(N):de(N)?s>1?(s=0,r.interrupt=!0,t.exit("tableRow"),t.enter("lineEnding"),t.consume(N),t.exit("lineEnding"),h):n(N):Ae(N)?Re(t,c,"whitespace")(N):(s+=1,o&&(o=!1,i+=1),N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),o=!0,c):(t.enter("data"),d(N)))}function d(N){return N===null||N===124||Ve(N)?(t.exit("data"),c(N)):(t.consume(N),N===92?f:d)}function f(N){return N===92||N===124?(t.consume(N),d):d(N)}function h(N){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(N):(t.enter("tableDelimiterRow"),o=!1,Ae(N)?Re(t,p,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):p(N))}function p(N){return N===45||N===58?b(N):N===124?(o=!0,t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),g):R(N)}function g(N){return Ae(N)?Re(t,b,"whitespace")(N):b(N)}function b(N){return N===58?(s+=1,o=!0,t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),y):N===45?(s+=1,y(N)):N===null||de(N)?v(N):R(N)}function y(N){return N===45?(t.enter("tableDelimiterFiller"),E(N)):R(N)}function E(N){return N===45?(t.consume(N),E):N===58?(o=!0,t.exit("tableDelimiterFiller"),t.enter("tableDelimiterMarker"),t.consume(N),t.exit("tableDelimiterMarker"),T):(t.exit("tableDelimiterFiller"),T(N))}function T(N){return Ae(N)?Re(t,v,"whitespace")(N):v(N)}function v(N){return N===124?p(N):N===null||de(N)?!o||i!==s?R(N):(t.exit("tableDelimiterRow"),t.exit("tableHead"),e(N)):R(N)}function R(N){return n(N)}function A(N){return t.enter("tableRow"),O(N)}function O(N){return N===124?(t.enter("tableCellDivider"),t.consume(N),t.exit("tableCellDivider"),O):N===null||de(N)?(t.exit("tableRow"),e(N)):Ae(N)?Re(t,O,"whitespace")(N):(t.enter("data"),P(N))}function P(N){return N===null||N===124||Ve(N)?(t.exit("data"),O(N)):(t.consume(N),N===92?F:P)}function F(N){return N===92||N===124?(t.consume(N),P):P(N)}}function CH(t,e){let n=-1,r=!0,i=0,s=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,u,c,d;const f=new gH;for(;++n<t.length;){const h=t[n],p=h[1];h[0]==="enter"?p.type==="tableHead"?(a=!1,l!==0&&(ry(f,e,l,u,c),c=void 0,l=0),u={type:"table",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",u,e]])):p.type==="tableRow"||p.type==="tableDelimiterRow"?(r=!0,d=void 0,s=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,c={type:"tableBody",start:Object.assign({},p.start),end:Object.assign({},p.end)},f.add(n,0,[["enter",c,e]])),i=p.type==="tableDelimiterRow"?2:c?3:1):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(s[1]!==0&&(o[0]=o[1],d=Vl(f,e,s,i,void 0,d),s=[0,0,0,0]),o[2]=n)):p.type==="tableCellDivider"&&(r?r=!1:(s[1]!==0&&(o[0]=o[1],d=Vl(f,e,s,i,void 0,d)),s=o,o=[s[1],n,0,0])):p.type==="tableHead"?(a=!0,l=n):p.type==="tableRow"||p.type==="tableDelimiterRow"?(l=n,s[1]!==0?(o[0]=o[1],d=Vl(f,e,s,i,n,d)):o[1]!==0&&(d=Vl(f,e,o,i,n,d)),i=0):i&&(p.type==="data"||p.type==="tableDelimiterMarker"||p.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&ry(f,e,l,u,c),f.consume(e.events),n=-1;++n<e.events.length;){const h=e.events[n];h[0]==="enter"&&h[1].type==="table"&&(h[1]._align=yH(e.events,n))}return t}function Vl(t,e,n,r,i,s){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(s.end=Object.assign({},Ts(e.events,n[0])),t.add(n[0],0,[["exit",s,e]]));const l=Ts(e.events,n[1]);if(s={type:o,start:Object.assign({},l),end:Object.assign({},l)},t.add(n[1],0,[["enter",s,e]]),n[2]!==0){const u=Ts(e.events,n[2]),c=Ts(e.events,n[3]),d={type:a,start:Object.assign({},u),end:Object.assign({},c)};if(t.add(n[2],0,[["enter",d,e]]),r!==2){const f=e.events[n[2]],h=e.events[n[3]];if(f[1].end=Object.assign({},h[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const p=n[2]+1,g=n[3]-n[2]-1;t.add(p,g,[])}}t.add(n[3]+1,0,[["exit",d,e]])}return i!==void 0&&(s.end=Object.assign({},Ts(e.events,i)),t.add(i,0,[["exit",s,e]]),s=void 0),s}function ry(t,e,n,r,i){const s=[],o=Ts(e.events,n);i&&(i.end=Object.assign({},o),s.push(["exit",i,e])),r.end=Object.assign({},o),s.push(["exit",r,e]),t.add(n+1,0,s)}function Ts(t,e){const n=t[e],r=n[0]==="enter"?"start":"end";return n[1][r]}const xH={name:"tasklistCheck",tokenize:wH};function SH(){return{text:{91:xH}}}function wH(t,e,n){const r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(t.enter("taskListCheck"),t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),s)}function s(l){return Ve(l)?(t.enter("taskListCheckValueUnchecked"),t.consume(l),t.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(t.enter("taskListCheckValueChecked"),t.consume(l),t.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(t.enter("taskListCheckMarker"),t.consume(l),t.exit("taskListCheckMarker"),t.exit("taskListCheck"),a):n(l)}function a(l){return de(l)?e(l):Ae(l)?t.check({tokenize:kH},e,n)(l):n(l)}}function kH(t,e,n){return Re(t,r,"whitespace");function r(i){return i===null?n(i):e(i)}}function AH(t){return kw([PB(),aH(),mH(t),EH(),SH()])}const vH={};function FG(t){const e=this,n=t||vH,r=e.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(AH(n)),s.push(IB()),o.push(RB(n))}function HG(t){const e=this;e.compiler=n;function n(r){return fB(r,{...e.data("settings"),...t,extensions:e.data("toMarkdownExtensions")||[]})}}function iy(t){if(t)throw t}var kf,sy;function NH(){if(sy)return kf;sy=1;var t=Object.prototype.hasOwnProperty,e=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=function(u){return typeof Array.isArray=="function"?Array.isArray(u):e.call(u)==="[object Array]"},s=function(u){if(!u||e.call(u)!=="[object Object]")return!1;var c=t.call(u,"constructor"),d=u.constructor&&u.constructor.prototype&&t.call(u.constructor.prototype,"isPrototypeOf");if(u.constructor&&!c&&!d)return!1;var f;for(f in u);return typeof f>"u"||t.call(u,f)},o=function(u,c){n&&c.name==="__proto__"?n(u,c.name,{enumerable:!0,configurable:!0,value:c.newValue,writable:!0}):u[c.name]=c.newValue},a=function(u,c){if(c==="__proto__")if(t.call(u,c)){if(r)return r(u,c).value}else return;return u[c]};return kf=function l(){var u,c,d,f,h,p,g=arguments[0],b=1,y=arguments.length,E=!1;for(typeof g=="boolean"&&(E=g,g=arguments[1]||{},b=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});b<y;++b)if(u=arguments[b],u!=null)for(c in u)d=a(g,c),f=a(u,c),g!==f&&(E&&f&&(s(f)||(h=i(f)))?(h?(h=!1,p=d&&i(d)?d:[]):p=d&&s(d)?d:{},o(g,{name:c,newValue:l(E,p,f)})):typeof f<"u"&&o(g,{name:c,newValue:f}));return g},kf}var _H=NH();const Af=Sp(_H);function lp(t){if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)}function IH(){const t=[],e={run:n,use:r};return e;function n(...i){let s=-1;const o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...i);function a(l,...u){const c=t[++s];let d=-1;if(l){o(l);return}for(;++d<i.length;)(u[d]===null||u[d]===void 0)&&(u[d]=i[d]);i=u,c?RH(c,a)(...u):o(null,...u)}}function r(i){if(typeof i!="function")throw new TypeError("Expected `middelware` to be a function, not "+i);return t.push(i),e}}function RH(t,e){let n;return r;function r(...o){const a=t.length>o.length;let l;a&&o.push(i);try{l=t.apply(this,o)}catch(u){const c=u;if(a&&n)throw c;return i(c)}a||(l&&l.then&&typeof l.then=="function"?l.then(s,i):l instanceof Error?i(l):s(l))}function i(o,...a){n||(n=!0,e(o,...a))}function s(o){i(null,o)}}const MH=(function(t){const r=this.constructor.prototype,i=r[t],s=function(){return i.apply(s,arguments)};return Object.setPrototypeOf(s,r),s}),OH={}.hasOwnProperty;class Qm extends MH{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=IH()}copy(){const e=new Qm;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];e.use(...r)}return e.data(Af(!0,{},this.namespace)),e}data(e,n){return typeof e=="string"?arguments.length===2?(_f("data",this.frozen),this.namespace[e]=n,this):OH.call(this.namespace,e)&&this.namespace[e]||void 0:e?(_f("data",this.frozen),this.namespace=e,this):this.namespace}freeze(){if(this.frozen)return this;const e=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const i=n.call(e,...r);typeof i=="function"&&this.transformers.use(i)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(e){this.freeze();const n=zl(e),r=this.parser||this.Parser;return vf("parse",r),r(String(n),n)}process(e,n){const r=this;return this.freeze(),vf("process",this.parser||this.Parser),Nf("process",this.compiler||this.Compiler),n?i(void 0,n):new Promise(i);function i(s,o){const a=zl(e),l=r.parse(a);r.run(l,a,function(c,d,f){if(c||!d||!f)return u(c);const h=d,p=r.stringify(h,f);LH(p)?f.value=p:f.result=p,u(c,f)});function u(c,d){c||!d?o(c):s?s(d):n(void 0,d)}}}processSync(e){let n=!1,r;return this.freeze(),vf("processSync",this.parser||this.Parser),Nf("processSync",this.compiler||this.Compiler),this.process(e,i),ay("processSync","process",n),r;function i(s,o){n=!0,iy(s),r=o}}run(e,n,r){oy(e),this.freeze();const i=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?s(void 0,r):new Promise(s);function s(o,a){const l=zl(n);i.run(e,l,u);function u(c,d,f){const h=d||e;c?a(c):o?o(h):r(void 0,h,f)}}}runSync(e,n){let r=!1,i;return this.run(e,n,s),ay("runSync","run",r),i;function s(o,a){iy(o),i=a,r=!0}}stringify(e,n){this.freeze();const r=zl(n),i=this.compiler||this.Compiler;return Nf("stringify",i),oy(e),i(e,r)}use(e,...n){const r=this.attachers,i=this.namespace;if(_f("use",this.frozen),e!=null)if(typeof e=="function")l(e,n);else if(typeof e=="object")Array.isArray(e)?a(e):o(e);else throw new TypeError("Expected usable value, not `"+e+"`");return this;function s(u){if(typeof u=="function")l(u,[]);else if(typeof u=="object")if(Array.isArray(u)){const[c,...d]=u;l(c,d)}else o(u);else throw new TypeError("Expected usable value, not `"+u+"`")}function o(u){if(!("plugins"in u)&&!("settings"in u))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(u.plugins),u.settings&&(i.settings=Af(!0,i.settings,u.settings))}function a(u){let c=-1;if(u!=null)if(Array.isArray(u))for(;++c<u.length;){const d=u[c];s(d)}else throw new TypeError("Expected a list of plugins, not `"+u+"`")}function l(u,c){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===u){f=d;break}if(f===-1)r.push([u,...c]);else if(c.length>0){let[h,...p]=c;const g=r[f][1];lp(g)&&lp(h)&&(h=Af(!0,g,h)),r[f]=[u,h,...p]}}}}const UG=new Qm().freeze();function vf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `parser`")}function Nf(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `compiler`")}function _f(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function oy(t){if(!lp(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function ay(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function zl(t){return DH(t)?t:new np(t)}function DH(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function LH(t){return typeof t=="string"||PH(t)}function PH(t){return!!(t&&typeof t=="object"&&"byteLength"in t&&"byteOffset"in t)}function $G(t,e){return $w(t,{})||{type:"root",children:[]}}function $w(t,e){const n=BH(t,e);return n&&e.afterTransform&&e.afterTransform(t,n),n}function BH(t,e){switch(t.nodeType){case 1:return $H(t,e);case 3:return HH(t);case 8:return UH(t);case 9:return ly(t,e);case 10:return FH();case 11:return ly(t,e);default:return}}function ly(t,e){return{type:"root",children:Vw(t,e)}}function FH(){return{type:"doctype"}}function HH(t){return{type:"text",value:t.nodeValue||""}}function UH(t){return{type:"comment",value:t.nodeValue||""}}function $H(t,e){const n=t.namespaceURI,r=n===mu.svg?Zx:Qx,i=n===mu.html?t.tagName.toLowerCase():t.tagName,s=n===mu.html&&i==="template"?t.content:t,o=t.getAttributeNames(),a={};let l=-1;for(;++l<o.length;)a[o[l]]=t.getAttribute(o[l])||"";return r(i,a,Vw(s,e))}function Vw(t,e){const n=t.childNodes,r=[];let i=-1;for(;++i<n.length;){const s=$w(n[i],e);s!==void 0&&r.push(s)}return r}const VH={tokenize:zH};function zH(t){const e=t.attempt(this.parser.constructs.contentInitial,r,i);let n;return e;function r(a){if(a===null){t.consume(a);return}return t.enter("lineEnding"),t.consume(a),t.exit("lineEnding"),Re(t,e,"linePrefix")}function i(a){return t.enter("paragraph"),s(a)}function s(a){const l=t.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){t.exit("chunkText"),t.exit("paragraph"),t.consume(a);return}return de(a)?(t.consume(a),t.exit("chunkText"),s):(t.consume(a),o)}}const jH={tokenize:WH},uy={tokenize:qH};function WH(t){const e=this,n=[];let r=0,i,s,o;return a;function a(T){if(r<n.length){const v=n[r];return e.containerState=v[1],t.attempt(v[0].continuation,l,u)(T)}return u(T)}function l(T){if(r++,e.containerState._closeFlow){e.containerState._closeFlow=void 0,i&&E();const v=e.events.length;let R=v,A;for(;R--;)if(e.events[R][0]==="exit"&&e.events[R][1].type==="chunkFlow"){A=e.events[R][1].end;break}y(r);let O=v;for(;O<e.events.length;)e.events[O][1].end={...A},O++;return bn(e.events,R+1,0,e.events.slice(v)),e.events.length=O,u(T)}return a(T)}function u(T){if(r===n.length){if(!i)return f(T);if(i.currentConstruct&&i.currentConstruct.concrete)return p(T);e.interrupt=!!(i.currentConstruct&&!i._gfmTableDynamicInterruptHack)}return e.containerState={},t.check(uy,c,d)(T)}function c(T){return i&&E(),y(r),f(T)}function d(T){return e.parser.lazy[e.now().line]=r!==n.length,o=e.now().offset,p(T)}function f(T){return e.containerState={},t.attempt(uy,h,p)(T)}function h(T){return r++,n.push([e.currentConstruct,e.containerState]),f(T)}function p(T){if(T===null){i&&E(),y(0),t.consume(T);return}return i=i||e.parser.flow(e.now()),t.enter("chunkFlow",{_tokenizer:i,contentType:"flow",previous:s}),g(T)}function g(T){if(T===null){b(t.exit("chunkFlow"),!0),y(0),t.consume(T);return}return de(T)?(t.consume(T),b(t.exit("chunkFlow")),r=0,e.interrupt=void 0,a):(t.consume(T),g)}function b(T,v){const R=e.sliceStream(T);if(v&&R.push(null),T.previous=s,s&&(s.next=T),s=T,i.defineSkip(T.start),i.write(R),e.parser.lazy[T.start.line]){let A=i.events.length;for(;A--;)if(i.events[A][1].start.offset<o&&(!i.events[A][1].end||i.events[A][1].end.offset>o))return;const O=e.events.length;let P=O,F,N;for(;P--;)if(e.events[P][0]==="exit"&&e.events[P][1].type==="chunkFlow"){if(F){N=e.events[P][1].end;break}F=!0}for(y(r),A=O;A<e.events.length;)e.events[A][1].end={...N},A++;bn(e.events,P+1,0,e.events.slice(O)),e.events.length=A}}function y(T){let v=n.length;for(;v-- >T;){const R=n[v];e.containerState=R[1],R[0].exit.call(e,t)}n.length=T}function E(){i.write([null]),s=void 0,i=void 0,e.containerState._closeFlow=void 0}}function qH(t,e,n){return Re(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}const YH={tokenize:KH};function KH(t){const e=this,n=t.attempt(hl,r,t.attempt(this.parser.constructs.flowInitial,i,Re(t,t.attempt(this.parser.constructs.flow,i,t.attempt(fF,i)),"linePrefix")));return n;function r(s){if(s===null){t.consume(s);return}return t.enter("lineEndingBlank"),t.consume(s),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function i(s){if(s===null){t.consume(s);return}return t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),e.currentConstruct=void 0,n}}const GH={resolveAll:jw()},XH=zw("string"),QH=zw("text");function zw(t){return{resolveAll:jw(t==="text"?ZH:void 0),tokenize:e};function e(n){const r=this,i=this.parser.constructs[t],s=n.attempt(i,o,a);return o;function o(c){return u(c)?s(c):a(c)}function a(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),s(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;const d=i[c];let f=-1;if(d)for(;++f<d.length;){const h=d[f];if(!h.previous||h.previous.call(r,r.previous))return!0}return!1}}}function jw(t){return e;function e(n,r){let i=-1,s;for(;++i<=n.length;)s===void 0?n[i]&&n[i][1].type==="data"&&(s=i,i++):(!n[i]||n[i][1].type!=="data")&&(i!==s+2&&(n[s][1].end=n[i-1][1].end,n.splice(s+2,i-s-2),i=s+2),s=void 0);return t?t(n,r):n}}function ZH(t,e){let n=0;for(;++n<=t.length;)if((n===t.length||t[n][1].type==="lineEnding")&&t[n-1][1].type==="data"){const r=t[n-1][1],i=e.sliceStream(r);let s=i.length,o=-1,a=0,l;for(;s--;){const u=i[s];if(typeof u=="string"){for(o=u.length;u.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(u===-2)l=!0,a++;else if(u!==-1){s++;break}}if(e._contentTypeTextTrailing&&n===t.length&&(a=0),a){const u={type:n===t.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?o:r.start._bufferIndex+o,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(t.splice(n,0,["enter",u,e],["exit",u,e]),n+=2)}n++}return t}const JH={42:Yt,43:Yt,45:Yt,48:Yt,49:Yt,50:Yt,51:Yt,52:Yt,53:Yt,54:Yt,55:Yt,56:Yt,57:Yt,62:Dw},eU={91:bF},tU={[-2]:Sf,[-1]:Sf,32:Sf},nU={35:SF,42:yu,45:[ny,yu],60:vF,61:ny,95:yu,96:ey,126:ey},rU={38:Pw,92:Lw},iU={[-5]:wf,[-4]:wf,[-3]:wf,33:WF,38:Pw,42:ap,60:[YB,DF],91:YF,92:[CF,Lw],93:Xm,95:ap,96:oF},sU={null:[ap,GH]},oU={null:[42,95]},aU={null:[]},lU=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:oU,contentInitial:eU,disable:aU,document:JH,flow:nU,flowInitial:tU,insideSpan:sU,string:rU,text:iU},Symbol.toStringTag,{value:"Module"}));function uU(t,e,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const i={},s=[];let o=[],a=[];const l={attempt:O(R),check:O(A),consume:E,enter:T,exit:v,interrupt:O(A,{interrupt:!0})},u={code:null,containerState:{},defineSkip:g,events:[],now:p,parser:t,previous:null,sliceSerialize:f,sliceStream:h,write:d};let c=e.tokenize.call(u,l);return e.resolveAll&&s.push(e),u;function d(U){return o=An(o,U),b(),o[o.length-1]!==null?[]:(P(e,0),u.events=td(s,u.events,u),u.events)}function f(U,j){return dU(h(U),j)}function h(U){return cU(o,U)}function p(){const{_bufferIndex:U,_index:j,line:z,column:I,offset:B}=r;return{_bufferIndex:U,_index:j,line:z,column:I,offset:B}}function g(U){i[U.line]=U.column,N()}function b(){let U;for(;r._index<o.length;){const j=o[r._index];if(typeof j=="string")for(U=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===U&&r._bufferIndex<j.length;)y(j.charCodeAt(r._bufferIndex));else y(j)}}function y(U){c=c(U)}function E(U){de(U)?(r.line++,r.column=1,r.offset+=U===-3?2:1,N()):U!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),u.previous=U}function T(U,j){const z=j||{};return z.type=U,z.start=p(),u.events.push(["enter",z,u]),a.push(z),z}function v(U){const j=a.pop();return j.end=p(),u.events.push(["exit",j,u]),j}function R(U,j){P(U,j.from)}function A(U,j){j.restore()}function O(U,j){return z;function z(I,B,Z){let H,D,V,x;return Array.isArray(I)?G(I):"tokenize"in I?G([I]):ne(I);function ne(le){return Ne;function Ne(ye){const ge=ye!==null&&le[ye],De=ye!==null&&le.null,qe=[...Array.isArray(ge)?ge:ge?[ge]:[],...Array.isArray(De)?De:De?[De]:[]];return G(qe)(ye)}}function G(le){return H=le,D=0,le.length===0?Z:w(le[D])}function w(le){return Ne;function Ne(ye){return x=F(),V=le,le.partial||(u.currentConstruct=le),le.name&&u.parser.constructs.disable.null.includes(le.name)?te():le.tokenize.call(j?Object.assign(Object.create(u),j):u,l,me,te)(ye)}}function me(le){return U(V,x),B}function te(le){return x.restore(),++D<H.length?w(H[D]):Z}}}function P(U,j){U.resolveAll&&!s.includes(U)&&s.push(U),U.resolve&&bn(u.events,j,u.events.length-j,U.resolve(u.events.slice(j),u)),U.resolveTo&&(u.events=U.resolveTo(u.events,u))}function F(){const U=p(),j=u.previous,z=u.currentConstruct,I=u.events.length,B=Array.from(a);return{from:I,restore:Z};function Z(){r=U,u.previous=j,u.currentConstruct=z,u.events.length=I,a=B,N()}}function N(){r.line in i&&r.column<2&&(r.column=i[r.line],r.offset+=i[r.line]-1)}}function cU(t,e){const n=e.start._index,r=e.start._bufferIndex,i=e.end._index,s=e.end._bufferIndex;let o;if(n===i)o=[t[n].slice(r,s)];else{if(o=t.slice(n,i),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}s>0&&o.push(t[i].slice(0,s))}return o}function dU(t,e){let n=-1;const r=[];let i;for(;++n<t.length;){const s=t[n];let o;if(typeof s=="string")o=s;else switch(s){case-5:{o="\r";break}case-4:{o=`
130
+ `;break}case-3:{o=`\r
131
+ `;break}case-2:{o=e?" ":" ";break}case-1:{if(!e&&i)continue;o=" ";break}default:o=String.fromCharCode(s)}i=s===-2,r.push(o)}return r.join("")}function fU(t){const r={constructs:kw([lU,...(t||{}).extensions||[]]),content:i(VH),defined:[],document:i(jH),flow:i(YH),lazy:{},string:i(XH),text:i(QH)};return r;function i(s){return o;function o(a){return uU(r,s,a)}}}function hU(t){for(;!Bw(t););return t}const cy=/[\0\t\n\r]/g;function pU(){let t=1,e="",n=!0,r;return i;function i(s,o,a){const l=[];let u,c,d,f,h;for(s=e+(typeof s=="string"?s.toString():new TextDecoder(o||void 0).decode(s)),d=0,e="",n&&(s.charCodeAt(0)===65279&&d++,n=void 0);d<s.length;){if(cy.lastIndex=d,u=cy.exec(s),f=u&&u.index!==void 0?u.index:s.length,h=s.charCodeAt(f),!u){e=s.slice(d);break}if(h===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(s.slice(d,f)),t+=f-d),h){case 0:{l.push(65533),t++;break}case 9:{for(c=Math.ceil(t/4)*4,l.push(-2);t++<c;)l.push(-1);break}case 10:{l.push(-4),t=1;break}default:r=!0,t=1}d=f+1}return a&&(r&&l.push(-5),e&&l.push(e),l.push(null)),l}}const Ww={}.hasOwnProperty;function mU(t,e,n){return e&&typeof e=="object"&&(n=e,e=void 0),gU(n)(hU(fU(n).document().write(pU()(t,e,!0))))}function gU(t){const e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:s(Be),autolinkProtocol:F,autolinkEmail:F,atxHeading:s(Me),blockQuote:s(De),characterEscape:F,characterReference:F,codeFenced:s(qe),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:s(qe,o),codeText:s(oe,o),codeTextData:F,data:F,codeFlowValue:F,definition:s(ie),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:s(fe),hardBreakEscape:s(Fe),hardBreakTrailing:s(Fe),htmlFlow:s(Ce,o),htmlFlowData:F,htmlText:s(Ce,o),htmlTextData:F,image:s(lt),label:o,link:s(Be),listItem:s(Tn),listItemValue:f,listOrdered:s(Qe,d),listUnordered:s(Qe),paragraph:s(Cn),reference:w,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:s(Me),strong:s(an),thematicBreak:s(rs)},exit:{atxHeading:l(),atxHeadingSequence:R,autolink:l(),autolinkEmail:ge,autolinkProtocol:ye,blockQuote:l(),characterEscapeValue:N,characterReferenceMarkerHexadecimal:te,characterReferenceMarkerNumeric:te,characterReferenceValue:le,characterReference:Ne,codeFenced:l(b),codeFencedFence:g,codeFencedFenceInfo:h,codeFencedFenceMeta:p,codeFlowValue:N,codeIndented:l(y),codeText:l(B),codeTextData:N,data:N,definition:l(),definitionDestinationString:v,definitionLabelString:E,definitionTitleString:T,emphasis:l(),hardBreakEscape:l(j),hardBreakTrailing:l(j),htmlFlow:l(z),htmlFlowData:N,htmlText:l(I),htmlTextData:N,image:l(H),label:V,labelText:D,lineEnding:U,link:l(Z),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:me,resourceDestinationString:x,resourceTitleString:ne,resource:G,setextHeading:l(P),setextHeadingLineSequence:O,setextHeadingText:A,strong:l(),thematicBreak:l()}};qw(e,(t||{}).mdastExtensions||[]);const n={};return r;function r(W){let X={type:"root",children:[]};const be={stack:[X],tokenStack:[],config:e,enter:a,exit:u,buffer:o,resume:c,data:n},ke=[];let Pe=-1;for(;++Pe<W.length;)if(W[Pe][1].type==="listOrdered"||W[Pe][1].type==="listUnordered")if(W[Pe][0]==="enter")ke.push(Pe);else{const ln=ke.pop();Pe=i(W,ln,Pe)}for(Pe=-1;++Pe<W.length;){const ln=e[W[Pe][0]];Ww.call(ln,W[Pe][1].type)&&ln[W[Pe][1].type].call(Object.assign({sliceSerialize:W[Pe][2].sliceSerialize},be),W[Pe][1])}if(be.tokenStack.length>0){const ln=be.tokenStack[be.tokenStack.length-1];(ln[1]||dy).call(be,void 0,ln[0])}for(X.position={start:$r(W.length>0?W[0][1].start:{line:1,column:1,offset:0}),end:$r(W.length>0?W[W.length-2][1].end:{line:1,column:1,offset:0})},Pe=-1;++Pe<e.transforms.length;)X=e.transforms[Pe](X)||X;return X}function i(W,X,be){let ke=X-1,Pe=-1,ln=!1,Pt,Er,Lo,Po;for(;++ke<=be;){const un=W[ke];switch(un[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{un[0]==="enter"?Pe++:Pe--,Po=void 0;break}case"lineEndingBlank":{un[0]==="enter"&&(Pt&&!Po&&!Pe&&!Lo&&(Lo=ke),Po=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:Po=void 0}if(!Pe&&un[0]==="enter"&&un[1].type==="listItemPrefix"||Pe===-1&&un[0]==="exit"&&(un[1].type==="listUnordered"||un[1].type==="listOrdered")){if(Pt){let is=ke;for(Er=void 0;is--;){const Tr=W[is];if(Tr[1].type==="lineEnding"||Tr[1].type==="lineEndingBlank"){if(Tr[0]==="exit")continue;Er&&(W[Er][1].type="lineEndingBlank",ln=!0),Tr[1].type="lineEnding",Er=is}else if(!(Tr[1].type==="linePrefix"||Tr[1].type==="blockQuotePrefix"||Tr[1].type==="blockQuotePrefixWhitespace"||Tr[1].type==="blockQuoteMarker"||Tr[1].type==="listItemIndent"))break}Lo&&(!Er||Lo<Er)&&(Pt._spread=!0),Pt.end=Object.assign({},Er?W[Er][1].start:un[1].end),W.splice(Er||ke,0,["exit",Pt,un[2]]),ke++,be++}if(un[1].type==="listItemPrefix"){const is={type:"listItem",_spread:!1,start:Object.assign({},un[1].start),end:void 0};Pt=is,W.splice(ke,0,["enter",is,un[2]]),ke++,be++,Lo=void 0,Po=!0}}}return W[X][1]._spread=ln,be}function s(W,X){return be;function be(ke){a.call(this,W(ke),ke),X&&X.call(this,ke)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(W,X,be){this.stack[this.stack.length-1].children.push(W),this.stack.push(W),this.tokenStack.push([X,be||void 0]),W.position={start:$r(X.start),end:void 0}}function l(W){return X;function X(be){W&&W.call(this,be),u.call(this,be)}}function u(W,X){const be=this.stack.pop(),ke=this.tokenStack.pop();if(ke)ke[0].type!==W.type&&(X?X.call(this,W,ke[0]):(ke[1]||dy).call(this,W,ke[0]));else throw new Error("Cannot close `"+W.type+"` ("+ha({start:W.start,end:W.end})+"): it’s not open");be.position.end=$r(W.end)}function c(){return Zc(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(W){if(this.data.expectingFirstListItemValue){const X=this.stack[this.stack.length-2];X.start=Number.parseInt(this.sliceSerialize(W),10),this.data.expectingFirstListItemValue=void 0}}function h(){const W=this.resume(),X=this.stack[this.stack.length-1];X.lang=W}function p(){const W=this.resume(),X=this.stack[this.stack.length-1];X.meta=W}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const W=this.resume(),X=this.stack[this.stack.length-1];X.value=W.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const W=this.resume(),X=this.stack[this.stack.length-1];X.value=W.replace(/(\r?\n|\r)$/g,"")}function E(W){const X=this.resume(),be=this.stack[this.stack.length-1];be.label=X,be.identifier=Vn(this.sliceSerialize(W)).toLowerCase()}function T(){const W=this.resume(),X=this.stack[this.stack.length-1];X.title=W}function v(){const W=this.resume(),X=this.stack[this.stack.length-1];X.url=W}function R(W){const X=this.stack[this.stack.length-1];if(!X.depth){const be=this.sliceSerialize(W).length;X.depth=be}}function A(){this.data.setextHeadingSlurpLineEnding=!0}function O(W){const X=this.stack[this.stack.length-1];X.depth=this.sliceSerialize(W).codePointAt(0)===61?1:2}function P(){this.data.setextHeadingSlurpLineEnding=void 0}function F(W){const be=this.stack[this.stack.length-1].children;let ke=be[be.length-1];(!ke||ke.type!=="text")&&(ke=xn(),ke.position={start:$r(W.start),end:void 0},be.push(ke)),this.stack.push(ke)}function N(W){const X=this.stack.pop();X.value+=this.sliceSerialize(W),X.position.end=$r(W.end)}function U(W){const X=this.stack[this.stack.length-1];if(this.data.atHardBreak){const be=X.children[X.children.length-1];be.position.end=$r(W.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&e.canContainEols.includes(X.type)&&(F.call(this,W),N.call(this,W))}function j(){this.data.atHardBreak=!0}function z(){const W=this.resume(),X=this.stack[this.stack.length-1];X.value=W}function I(){const W=this.resume(),X=this.stack[this.stack.length-1];X.value=W}function B(){const W=this.resume(),X=this.stack[this.stack.length-1];X.value=W}function Z(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=X,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function H(){const W=this.stack[this.stack.length-1];if(this.data.inReference){const X=this.data.referenceType||"shortcut";W.type+="Reference",W.referenceType=X,delete W.url,delete W.title}else delete W.identifier,delete W.label;this.data.referenceType=void 0}function D(W){const X=this.sliceSerialize(W),be=this.stack[this.stack.length-2];be.label=ww(X),be.identifier=Vn(X).toLowerCase()}function V(){const W=this.stack[this.stack.length-1],X=this.resume(),be=this.stack[this.stack.length-1];if(this.data.inReference=!0,be.type==="link"){const ke=W.children;be.children=ke}else be.alt=X}function x(){const W=this.resume(),X=this.stack[this.stack.length-1];X.url=W}function ne(){const W=this.resume(),X=this.stack[this.stack.length-1];X.title=W}function G(){this.data.inReference=void 0}function w(){this.data.referenceType="collapsed"}function me(W){const X=this.resume(),be=this.stack[this.stack.length-1];be.label=X,be.identifier=Vn(this.sliceSerialize(W)).toLowerCase(),this.data.referenceType="full"}function te(W){this.data.characterReferenceType=W.type}function le(W){const X=this.sliceSerialize(W),be=this.data.characterReferenceType;let ke;be?(ke=Sw(X,be==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):ke=Km(X);const Pe=this.stack[this.stack.length-1];Pe.value+=ke}function Ne(W){const X=this.stack.pop();X.position.end=$r(W.end)}function ye(W){N.call(this,W);const X=this.stack[this.stack.length-1];X.url=this.sliceSerialize(W)}function ge(W){N.call(this,W);const X=this.stack[this.stack.length-1];X.url="mailto:"+this.sliceSerialize(W)}function De(){return{type:"blockquote",children:[]}}function qe(){return{type:"code",lang:null,meta:null,value:""}}function oe(){return{type:"inlineCode",value:""}}function ie(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function fe(){return{type:"emphasis",children:[]}}function Me(){return{type:"heading",depth:0,children:[]}}function Fe(){return{type:"break"}}function Ce(){return{type:"html",value:""}}function lt(){return{type:"image",title:null,url:"",alt:null}}function Be(){return{type:"link",title:null,url:"",children:[]}}function Qe(W){return{type:"list",ordered:W.type==="listOrdered",start:null,spread:W._spread,children:[]}}function Tn(W){return{type:"listItem",spread:W._spread,checked:null,children:[]}}function Cn(){return{type:"paragraph",children:[]}}function an(){return{type:"strong",children:[]}}function xn(){return{type:"text",value:""}}function rs(){return{type:"thematicBreak"}}}function $r(t){return{line:t.line,column:t.column,offset:t.offset}}function qw(t,e){let n=-1;for(;++n<e.length;){const r=e[n];Array.isArray(r)?qw(t,r):bU(t,r)}}function bU(t,e){let n;for(n in e)if(Ww.call(e,n))switch(n){case"canContainEols":{const r=e[n];r&&t[n].push(...r);break}case"transforms":{const r=e[n];r&&t[n].push(...r);break}case"enter":case"exit":{const r=e[n];r&&Object.assign(t[n],r);break}}}function dy(t,e){throw t?new Error("Cannot close `"+t.type+"` ("+ha({start:t.start,end:t.end})+"): a different token (`"+e.type+"`, "+ha({start:e.start,end:e.end})+") is open"):new Error("Cannot close document, a token (`"+e.type+"`, "+ha({start:e.start,end:e.end})+") is still open")}function VG(t){const e=this;e.parser=n;function n(r){return mU(r,{...e.data("settings"),...t,extensions:e.data("micromarkExtensions")||[],mdastExtensions:e.data("fromMarkdownExtensions")||[]})}}function yU(t,e){const n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function EU(t,e){const n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:`
132
+ `}]}function TU(t,e){const n=e.value?e.value+`
133
+ `:"",r={},i=e.lang?e.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return e.meta&&(s.data={meta:e.meta}),t.patch(e,s),s=t.applyData(e,s),s={type:"element",tagName:"pre",properties:{},children:[s]},t.patch(e,s),s}function CU(t,e){const n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function xU(t,e){const n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function SU(t,e){const n=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",r=String(e.identifier).toUpperCase(),i=So(r.toLowerCase()),s=t.footnoteOrder.indexOf(r);let o,a=t.footnoteCounts.get(r);a===void 0?(a=0,t.footnoteOrder.push(r),o=t.footnoteOrder.length):o=s+1,a+=1,t.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};t.patch(e,l);const u={type:"element",tagName:"sup",properties:{},children:[l]};return t.patch(e,u),t.applyData(e,u)}function wU(t,e){const n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function kU(t,e){if(t.options.allowDangerousHtml){const n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}}function Yw(t,e){const n=e.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+r}];const i=t.all(e),s=i[0];s&&s.type==="text"?s.value="["+s.value:i.unshift({type:"text",value:"["});const o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function AU(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Yw(t,e);const i={src:So(r.url||""),alt:e.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"img",properties:i,children:[]};return t.patch(e,s),t.applyData(e,s)}function vU(t,e){const n={src:So(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function NU(t,e){const n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function _U(t,e){const n=String(e.identifier).toUpperCase(),r=t.definitionById.get(n);if(!r)return Yw(t,e);const i={href:So(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);const s={type:"element",tagName:"a",properties:i,children:t.all(e)};return t.patch(e,s),t.applyData(e,s)}function IU(t,e){const n={href:So(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);const r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function RU(t,e,n){const r=t.all(e),i=n?MU(n):Kw(e),s={},o=[];if(typeof e.checked=="boolean"){const c=r[0];let d;c&&c.type==="element"&&c.tagName==="p"?d=c:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),s.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const c=r[a];(i||a!==0||c.type!=="element"||c.tagName!=="p")&&o.push({type:"text",value:`
134
+ `}),c.type==="element"&&c.tagName==="p"&&!i?o.push(...c.children):o.push(c)}const l=r[r.length-1];l&&(i||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
135
+ `});const u={type:"element",tagName:"li",properties:s,children:o};return t.patch(e,u),t.applyData(e,u)}function MU(t){let e=!1;if(t.type==="list"){e=t.spread||!1;const n=t.children;let r=-1;for(;!e&&++r<n.length;)e=Kw(n[r])}return e}function Kw(t){const e=t.spread;return e??t.children.length>1}function OU(t,e){const n={},r=t.all(e);let i=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++i<r.length;){const o=r[i];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const s={type:"element",tagName:e.ordered?"ol":"ul",properties:n,children:t.wrap(r,!0)};return t.patch(e,s),t.applyData(e,s)}function DU(t,e){const n={type:"element",tagName:"p",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function LU(t,e){const n={type:"root",children:t.wrap(t.all(e))};return t.patch(e,n),t.applyData(e,n)}function PU(t,e){const n={type:"element",tagName:"strong",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function BU(t,e){const n=t.all(e),r=n.shift(),i=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],o),i.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=VS(e.children[1]),l=$S(e.children[e.children.length-1]);a&&l&&(o.position={start:a,end:l}),i.push(o)}const s={type:"element",tagName:"table",properties:{},children:t.wrap(i,!0)};return t.patch(e,s),t.applyData(e,s)}function FU(t,e,n){const r=n?n.children:void 0,s=(r?r.indexOf(e):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:e.children.length;let l=-1;const u=[];for(;++l<a;){const d=e.children[l],f={},h=o?o[l]:void 0;h&&(f.align=h);let p={type:"element",tagName:s,properties:f,children:[]};d&&(p.children=t.all(d),t.patch(d,p),p=t.applyData(d,p)),u.push(p)}const c={type:"element",tagName:"tr",properties:{},children:t.wrap(u,!0)};return t.patch(e,c),t.applyData(e,c)}function HU(t,e){const n={type:"element",tagName:"td",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}const fy=9,hy=32;function UU(t){const e=String(t),n=/\r?\n|\r/g;let r=n.exec(e),i=0;const s=[];for(;r;)s.push(py(e.slice(i,r.index),i>0,!0),r[0]),i=r.index+r[0].length,r=n.exec(e);return s.push(py(e.slice(i),i>0,!1)),s.join("")}function py(t,e,n){let r=0,i=t.length;if(e){let s=t.codePointAt(r);for(;s===fy||s===hy;)r++,s=t.codePointAt(r)}if(n){let s=t.codePointAt(i-1);for(;s===fy||s===hy;)i--,s=t.codePointAt(i-1)}return i>r?t.slice(r,i):""}function $U(t,e){const n={type:"text",value:UU(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function VU(t,e){const n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}const zU={blockquote:yU,break:EU,code:TU,delete:CU,emphasis:xU,footnoteReference:SU,heading:wU,html:kU,imageReference:AU,image:vU,inlineCode:NU,linkReference:_U,link:IU,listItem:RU,list:OU,paragraph:DU,root:LU,strong:PU,table:BU,tableCell:HU,tableRow:FU,text:$U,thematicBreak:VU,toml:jl,yaml:jl,definition:jl,footnoteDefinition:jl};function jl(){}function jU(t,e){const n=[{type:"text",value:"↩"}];return e>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),n}function WU(t,e){return"Back to reference "+(t+1)+(e>1?"-"+e:"")}function qU(t){const e=typeof t.options.clobberPrefix=="string"?t.options.clobberPrefix:"user-content-",n=t.options.footnoteBackContent||jU,r=t.options.footnoteBackLabel||WU,i=t.options.footnoteLabel||"Footnotes",s=t.options.footnoteLabelTagName||"h2",o=t.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<t.footnoteOrder.length;){const u=t.footnoteById.get(t.footnoteOrder[l]);if(!u)continue;const c=t.all(u),d=String(u.identifier).toUpperCase(),f=So(d.toLowerCase());let h=0;const p=[],g=t.footnoteCounts.get(d);for(;g!==void 0&&++h<=g;){p.length>0&&p.push({type:"text",value:" "});let E=typeof n=="string"?n:n(l,h);typeof E=="string"&&(E={type:"text",value:E}),p.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+f+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(E)?E:[E]})}const b=c[c.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const E=b.children[b.children.length-1];E&&E.type==="text"?E.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...p)}else c.push(...p);const y={type:"element",tagName:"li",properties:{id:e+"fn-"+f},children:t.wrap(c,!0)};t.patch(u,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:s,properties:{...ro(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:`
136
+ `},{type:"element",tagName:"ol",properties:{},children:t.wrap(a,!0)},{type:"text",value:`
137
+ `}]}}const up={}.hasOwnProperty,YU={};function KU(t,e){const n=e||YU,r=new Map,i=new Map,s=new Map,o={...zU,...n.handlers},a={all:u,applyData:XU,definitionById:r,footnoteById:i,footnoteCounts:s,footnoteOrder:[],handlers:o,one:l,options:n,patch:GU,wrap:ZU};return io(t,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){const d=c.type==="definition"?r:i,f=String(c.identifier).toUpperCase();d.has(f)||d.set(f,c)}}),a;function l(c,d){const f=c.type,h=a.handlers[f];if(up.call(a.handlers,f)&&h)return h(a,c,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in c){const{children:g,...b}=c,y=ro(b);return y.children=a.all(c),y}return ro(c)}return(a.options.unknownHandler||QU)(a,c,d)}function u(c){const d=[];if("children"in c){const f=c.children;let h=-1;for(;++h<f.length;){const p=a.one(f[h],c);if(p){if(h&&f[h-1].type==="break"&&(!Array.isArray(p)&&p.type==="text"&&(p.value=my(p.value)),!Array.isArray(p)&&p.type==="element")){const g=p.children[0];g&&g.type==="text"&&(g.value=my(g.value))}Array.isArray(p)?d.push(...p):d.push(p)}}}return d}}function GU(t,e){t.position&&(e.position=jS(t))}function XU(t,e){let n=e;if(t&&t.data){const r=t.data.hName,i=t.data.hChildren,s=t.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&s&&Object.assign(n.properties,ro(s)),"children"in n&&n.children&&i!==null&&i!==void 0&&(n.children=i)}return n}function QU(t,e){const n=e.data||{},r="value"in e&&!(up.call(n,"hProperties")||up.call(n,"hChildren"))?{type:"text",value:e.value}:{type:"element",tagName:"div",properties:{},children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function ZU(t,e){const n=[];let r=-1;for(e&&n.push({type:"text",value:`
138
+ `});++r<t.length;)r&&n.push({type:"text",value:`
139
+ `}),n.push(t[r]);return e&&t.length>0&&n.push({type:"text",value:`
140
+ `}),n}function my(t){let e=0,n=t.charCodeAt(e);for(;n===9||n===32;)e++,n=t.charCodeAt(e);return t.slice(e)}function gy(t,e){const n=KU(t,e),r=n.one(t,void 0),i=qU(n),s=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&s.children.push({type:"text",value:`
141
+ `},i),s}function zG(t,e){return t&&"run"in t?async function(n,r){const i=gy(n,{file:r,...e});await t.run(i,r)}:function(n,r){return gy(n,{file:r,...t||e})}}const JU=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],e$=/["&'<>`]/g,t$=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,n$=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,r$=/[|\\{}()[\]^$+*?.]/g,by=new WeakMap;function i$(t,e){if(t=t.replace(e.subset?s$(e.subset):e$,r),e.subset||e.escapeOnly)return t;return t.replace(t$,n).replace(n$,r);function n(i,s,o){return e.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(s+2),e)}function r(i,s,o){return e.format(i.charCodeAt(0),o.charCodeAt(s+1),e)}}function s$(t){let e=by.get(t);return e||(e=o$(t),by.set(t,e)),e}function o$(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(r$,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const a$=/[\dA-Fa-f]/;function l$(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!a$.test(String.fromCharCode(e))?r:r+";"}const u$=/\d/;function c$(t,e,n){const r="&#"+String(t);return n&&e&&!u$.test(String.fromCharCode(e))?r:r+";"}const d$=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],If={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},f$=["cent","copy","divide","gt","lt","not","para","times"],Gw={}.hasOwnProperty,cp={};let Wl;for(Wl in If)Gw.call(If,Wl)&&(cp[If[Wl]]=Wl);const h$=/[^\dA-Za-z]/;function p$(t,e,n,r){const i=String.fromCharCode(t);if(Gw.call(cp,i)){const s=cp[i],o="&"+s;return n&&d$.includes(s)&&!f$.includes(s)&&(!r||e&&e!==61&&h$.test(String.fromCharCode(e)))?o:o+";"}return""}function m$(t,e,n){let r=l$(t,e,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=p$(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){const s=c$(t,e,n.omitOptionalSemicolons);s.length<r.length&&(r=s)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function Bs(t,e){return i$(t,Object.assign({format:m$},e))}const g$=/^>|^->|<!--|-->|--!>|<!-$/g,b$=[">"],y$=["<",">"];function E$(t,e,n,r){return r.settings.bogusComments?"<?"+Bs(t.value,Object.assign({},r.settings.characterReferences,{subset:b$}))+">":"<!--"+t.value.replace(g$,i)+"-->";function i(s){return Bs(s,Object.assign({},r.settings.characterReferences,{subset:y$}))}}function T$(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const ct=Qw(1),Xw=Qw(-1),C$=[];function Qw(t){return e;function e(n,r,i){const s=n?n.children:C$;let o=(r||0)+t,a=s[o];if(!i)for(;a&&dl(a);)o+=t,a=s[o];return a}}const x$={}.hasOwnProperty;function Zw(t){return e;function e(n,r,i){return x$.call(t,n.tagName)&&t[n.tagName](n,r,i)}}const Zm=Zw({body:w$,caption:Rf,colgroup:Rf,dd:N$,dt:v$,head:Rf,html:S$,li:A$,optgroup:_$,option:I$,p:k$,rp:yy,rt:yy,tbody:M$,td:Ey,tfoot:O$,th:Ey,thead:R$,tr:D$});function Rf(t,e,n){const r=ct(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&dl(r.value.charAt(0)))}function S$(t,e,n){const r=ct(n,e);return!r||r.type!=="comment"}function w$(t,e,n){const r=ct(n,e);return!r||r.type!=="comment"}function k$(t,e,n){const r=ct(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function A$(t,e,n){const r=ct(n,e);return!r||r.type==="element"&&r.tagName==="li"}function v$(t,e,n){const r=ct(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function N$(t,e,n){const r=ct(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function yy(t,e,n){const r=ct(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function _$(t,e,n){const r=ct(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function I$(t,e,n){const r=ct(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function R$(t,e,n){const r=ct(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function M$(t,e,n){const r=ct(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function O$(t,e,n){return!ct(n,e)}function D$(t,e,n){const r=ct(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function Ey(t,e,n){const r=ct(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const L$=Zw({body:F$,colgroup:H$,head:B$,html:P$,tbody:U$});function P$(t){const e=ct(t,-1);return!e||e.type!=="comment"}function B$(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function F$(t){const e=ct(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&dl(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function H$(t,e,n){const r=Xw(n,e),i=ct(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Zm(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function U$(t,e,n){const r=Xw(n,e),i=ct(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Zm(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}const ql={name:[[`
142
+ \f\r &/=>`.split(""),`
143
+ \f\r "&'/=>\``.split("")],[`\0
144
+ \f\r "&'/<=>`.split(""),`\0
145
+ \f\r "&'/<=>\``.split("")]],unquoted:[[`
146
+ \f\r &>`.split(""),`\0
147
+ \f\r "&'<=>\``.split("")],[`\0
148
+ \f\r "&'<=>\``.split(""),`\0
149
+ \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function $$(t,e,n,r){const i=r.schema,s=i.space==="svg"?!1:r.settings.omitOptionalTags;let o=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let l;i.space==="html"&&t.tagName==="svg"&&(r.schema=ll);const u=V$(r,t.properties),c=r.all(i.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=i,c&&(o=!1),(u||!s||!L$(t,e,n))&&(a.push("<",t.tagName,u?" "+u:""),o&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(c),!o&&(!s||!Zm(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function V$(t,e){const n=[];let r=-1,i;if(e){for(i in e)if(e[i]!==null&&e[i]!==void 0){const s=z$(t,i,e[i]);s&&n.push(s)}}for(;++r<n.length;){const s=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&s!=='"'&&s!=="'"&&(n[r]+=" ")}return n.join("")}function z$(t,e,n){const r=Im(t.schema,e),i=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,s=t.settings.allowDangerousCharacters?0:1;let o=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=Bs(r.attribute,Object.assign({},t.settings.characterReferences,{subset:ql.name[i][s]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?qD:KD)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?l:(t.settings.preferUnquoted&&(a=Bs(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:ql.unquoted[i][s]}))),a!==n&&(t.settings.quoteSmart&&nc(n,o)>nc(n,t.alternative)&&(o=t.alternative),a=o+Bs(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?ql.single:ql.double)[i][s],attribute:!0}))+o),l+(a&&"="+a))}const j$=["<","&"];function Jw(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:Bs(t.value,Object.assign({},r.settings.characterReferences,{subset:j$}))}function W$(t,e,n,r){return r.settings.allowDangerousHtml?t.value:Jw(t,e,n,r)}function q$(t,e,n,r){return r.all(t)}const Y$=uw("type",{invalid:K$,unknown:G$,handlers:{comment:E$,doctype:T$,element:$$,raw:W$,root:q$,text:Jw}});function K$(t){throw new Error("Expected node, not `"+t+"`")}function G$(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const X$={},Q$={},Z$=[];function J$(t,e){const n=e||X$,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:eV,all:tV,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||JU,characterReferences:n.characterReferences||Q$,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?ll:jc,quote:r,alternative:i}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function eV(t,e,n){return Y$(t,e,n,this)}function tV(t){const e=[],n=t&&t.children||Z$;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}function jG(t){const e=this,n={...e.data("settings"),...t};e.compiler=r;function r(i){return J$(i,n)}}class wo{match;handler;undoable;inCode;inCodeMark;constructor(e,n,r={}){this.match=e,this.match=e,this.handler=typeof n=="string"?nV(n):n,this.undoable=r.undoable!==!1,this.inCode=r.inCode||!1,this.inCodeMark=r.inCodeMark!==!1}}function nV(t){return function(e,n,r,i){let s=t;if(n[1]){let o=n[0].lastIndexOf(n[1]);s+=n[0].slice(o+n[1].length),r+=o;let a=r-i;a>0&&(s=n[0].slice(o-a,o)+s,r=i)}return e.tr.insertText(s,r,i)}}const rV=500;function WG({rules:t}){let e=new nt({state:{init(){return null},apply(n,r){let i=n.getMeta(this);return i||(n.selectionSet||n.docChanged?null:r)}},props:{handleTextInput(n,r,i,s){return Ty(n,r,i,s,t,e)},handleDOMEvents:{compositionend:n=>{setTimeout(()=>{let{$cursor:r}=n.state.selection;r&&Ty(n,r.pos,r.pos,"",t,e)})}}},isInputRules:!0});return e}function Ty(t,e,n,r,i,s){if(t.composing)return!1;const o=t.state.tr.insertText(r,e,n),a=o.mapping.map(e),l=o.mapping.map(n);let u=null,c=o.doc.resolve(a),d=c.parent.textBetween(Math.max(0,c.parentOffset-rV),c.parentOffset,null,"");for(let f=0;f<i.length;f++){let h=i[f];if(!h.inCodeMark&&c.marks().some(b=>b.type.spec.code))continue;if(c.parent.type.spec.code){if(!h.inCode)continue}else if(h.inCode==="only")continue;let p=h.match.exec(d);if(!p||p[0].length<r.length)continue;u??=t.state.apply(o);let g=h.handler(u,p,a-p[0].length,l);if(g)return t.dispatch(o),t.dispatch(PD(t.state.tr)),h.undoable&&g.setMeta(s,{transform:g,from:a,to:l,text:r}),t.dispatch(g),!0}return!1}new wo(/--$/,"—",{inCodeMark:!1});new wo(/\.\.\.$/,"…",{inCodeMark:!1});new wo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(")$/,"“",{inCodeMark:!1});new wo(/"$/,"”",{inCodeMark:!1});new wo(/(?:^|[\s\{\[\(\<'"\u2018\u201C])(')$/,"‘",{inCodeMark:!1});new wo(/'$/,"’",{inCodeMark:!1});class Ze extends he{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Ze.valid(r)?new Ze(r):he.near(r)}content(){return ee.empty}eq(e){return e instanceof Ze&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Ze(e.resolve(n.pos))}getBookmark(){return new Jm(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!iV(e)||!sV(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Ze.valid(e))return e;let i=e.pos,s=null;for(let o=e.depth;;o--){let a=e.node(o);if(n>0?e.indexAfter(o)<a.childCount:e.index(o)>0){s=a.child(n>0?e.indexAfter(o):e.index(o)-1);break}else if(o==0)return null;i+=n;let l=e.doc.resolve(i);if(Ze.valid(l))return l}for(;;){let o=n>0?s.firstChild:s.lastChild;if(!o){if(s.isAtom&&!s.isText&&!ae.isSelectable(s)){e=e.doc.resolve(i+s.nodeSize*n),r=!1;continue e}break}s=o,i+=n;let a=e.doc.resolve(i);if(Ze.valid(a))return a}return null}}}Ze.prototype.visible=!1;Ze.findFrom=Ze.findGapCursorFrom;he.jsonID("gapcursor",Ze);class Jm{constructor(e){this.pos=e}map(e){return new Jm(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Ze.valid(n)?new Ze(n):he.near(n)}}function ek(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function iV(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||ek(i.type))return!0;if(i.inlineContent)return!1}}return!0}function sV(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||ek(i.type))return!0;if(i.inlineContent)return!1}}return!0}function oV(){return new nt({props:{decorations:cV,createSelectionBetween(t,e,n){return e.pos==n.pos&&Ze.valid(n)?new Ze(n):null},handleClick:lV,handleKeyDown:aV,handleDOMEvents:{beforeinput:uV}}})}const aV=Vp({ArrowLeft:Yl("horiz",-1),ArrowRight:Yl("horiz",1),ArrowUp:Yl("vert",-1),ArrowDown:Yl("vert",1)});function Yl(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,s){let o=r.selection,a=e>0?o.$to:o.$from,l=o.empty;if(o instanceof ue){if(!s.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(e>0?a.after():a.before())}let u=Ze.findGapCursorFrom(a,e,l);return u?(i&&i(r.tr.setSelection(new Ze(u))),!0):!1}}function lV(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Ze.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&ae.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Ze(r))),!0)}function uV(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Ze))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=q.empty;for(let o=r.length-1;o>=0;o--)i=q.from(r[o].createAndFill(null,i));let s=t.state.tr.replace(n.pos,n.pos,new ee(i,0,0));return s.setSelection(ue.near(s.doc.resolve(n.pos+1))),t.dispatch(s),!1}function cV(t){if(!(t.selection instanceof Ze))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Le.create(t.doc,[ut.widget(t.selection.head,e,{key:"gapcursor"})])}const qG=Kn.create({name:"gapCursor",addProseMirrorPlugins(){return[oV()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=He(se(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),YG=gR.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});function nd(){return typeof window<"u"}function gi(t){return e0(t)?(t.nodeName||"").toLowerCase():"#document"}function yn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function br(t){var e;return(e=(e0(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function e0(t){return nd()?t instanceof Node||t instanceof yn(t).Node:!1}function Ke(t){return nd()?t instanceof Element||t instanceof yn(t).Element:!1}function At(t){return nd()?t instanceof HTMLElement||t instanceof yn(t).HTMLElement:!1}function za(t){return!nd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof yn(t).ShadowRoot}function pl(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=Dn(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&i!=="inline"&&i!=="contents"}function dV(t){return/^(table|td|th)$/.test(gi(t))}function rd(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const fV=/transform|translate|scale|rotate|perspective|filter/,hV=/paint|layout|strict|content/,wi=t=>!!t&&t!=="none";let Mf;function t0(t){const e=Ke(t)?Dn(t):t;return wi(e.transform)||wi(e.translate)||wi(e.scale)||wi(e.rotate)||wi(e.perspective)||!id()&&(wi(e.backdropFilter)||wi(e.filter))||fV.test(e.willChange||"")||hV.test(e.contain||"")}function pV(t){let e=Lr(t);for(;At(e)&&!Dr(e);){if(t0(e))return e;if(rd(e))return null;e=Lr(e)}return null}function id(){return Mf==null&&(Mf=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Mf}function Dr(t){return/^(html|body|#document)$/.test(gi(t))}function Dn(t){return yn(t).getComputedStyle(t)}function sd(t){return Ke(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Lr(t){if(gi(t)==="html")return t;const e=t.assignedSlot||t.parentNode||za(t)&&t.host||br(t);return za(e)?e.host:e}function tk(t){const e=Lr(t);return Dr(e)?t.ownerDocument?t.ownerDocument.body:t.body:At(e)&&pl(e)?e:tk(e)}function ai(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=tk(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),o=yn(i);if(s){const a=dp(o);return e.concat(o,o.visualViewport||[],pl(i)?i:[],a&&n?ai(a):[])}else return e.concat(i,ai(i,[],n))}function dp(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}const mV=["top","right","bottom","left"],Cy=["start","end"],xy=mV.reduce((t,e)=>t.concat(e,e+"-"+Cy[0],e+"-"+Cy[1]),[]),oo=Math.min,hn=Math.max,sc=Math.round,Kl=Math.floor,or=t=>({x:t,y:t}),gV={left:"right",right:"left",bottom:"top",top:"bottom"};function Sy(t,e,n){return hn(t,oo(e,n))}function ko(t,e){return typeof t=="function"?t(e):t}function fr(t){return t.split("-")[0]}function ar(t){return t.split("-")[1]}function nk(t){return t==="x"?"y":"x"}function rk(t){return t==="y"?"height":"width"}function _r(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function ik(t){return nk(_r(t))}function sk(t,e,n){n===void 0&&(n=!1);const r=ar(t),i=ik(t),s=rk(i);let o=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(o=ac(o)),[o,ac(o)]}function bV(t){const e=ac(t);return[oc(t),e,oc(e)]}function oc(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const wy=["left","right"],ky=["right","left"],yV=["top","bottom"],EV=["bottom","top"];function TV(t,e,n){switch(t){case"top":case"bottom":return n?e?ky:wy:e?wy:ky;case"left":case"right":return e?yV:EV;default:return[]}}function CV(t,e,n,r){const i=ar(t);let s=TV(fr(t),n==="start",r);return i&&(s=s.map(o=>o+"-"+i),e&&(s=s.concat(s.map(oc)))),s}function ac(t){const e=fr(t);return gV[e]+t.slice(e.length)}function xV(t){return{top:0,right:0,bottom:0,left:0,...t}}function SV(t){return typeof t!="number"?xV(t):{top:t,right:t,bottom:t,left:t}}function lc(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}var wV=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],uc=wV.join(","),ok=typeof Element>"u",ao=ok?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,cc=!ok&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},dc=function(e,n){var r;n===void 0&&(n=!0);var i=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),s=i===""||i==="true",o=s||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):dc(e.parentNode));return o},kV=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},ak=function(e,n,r){if(dc(e))return[];var i=Array.prototype.slice.apply(e.querySelectorAll(uc));return n&&ao.call(e,uc)&&i.unshift(e),i=i.filter(r),i},fc=function(e,n,r){for(var i=[],s=Array.from(e);s.length;){var o=s.shift();if(!dc(o,!1))if(o.tagName==="SLOT"){var a=o.assignedElements(),l=a.length?a:o.children,u=fc(l,!0,r);r.flatten?i.push.apply(i,u):i.push({scopeParent:o,candidates:u})}else{var c=ao.call(o,uc);c&&r.filter(o)&&(n||!e.includes(o))&&i.push(o);var d=o.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(o),f=!dc(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(o));if(d&&f){var h=fc(d===!0?o.children:d.children,!0,r);r.flatten?i.push.apply(i,h):i.push({scopeParent:o,candidates:h})}else s.unshift.apply(s,o.children)}}return i},lk=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},uk=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||kV(e))&&!lk(e)?0:e.tabIndex},AV=function(e,n){var r=uk(e);return r<0&&n&&!lk(e)?0:r},vV=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},ck=function(e){return e.tagName==="INPUT"},NV=function(e){return ck(e)&&e.type==="hidden"},_V=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},IV=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},RV=function(e){if(!e.name)return!0;var n=e.form||cc(e),r=function(a){return n.querySelectorAll('input[type="radio"][name="'+a+'"]')},i;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")i=r(window.CSS.escape(e.name));else try{i=r(e.name)}catch(o){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",o.message),!1}var s=IV(i,e.form);return!s||s===e},MV=function(e){return ck(e)&&e.type==="radio"},OV=function(e){return MV(e)&&!RV(e)},DV=function(e){var n,r=e&&cc(e),i=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==e){var o,a,l;for(s=!!((o=i)!==null&&o!==void 0&&(a=o.ownerDocument)!==null&&a!==void 0&&a.contains(i)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!s&&i;){var u,c,d;r=cc(i),i=(u=r)===null||u===void 0?void 0:u.host,s=!!((c=i)!==null&&c!==void 0&&(d=c.ownerDocument)!==null&&d!==void 0&&d.contains(i))}}return s},Ay=function(e){var n=e.getBoundingClientRect(),r=n.width,i=n.height;return r===0&&i===0},LV=function(e,n){var r=n.displayCheck,i=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var s=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(e).visibility==="hidden")return!0;var o=ao.call(e,"details>summary:first-of-type"),a=o?e.parentElement:e;if(ao.call(a,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof i=="function"){for(var l=e;e;){var u=e.parentElement,c=cc(e);if(u&&!u.shadowRoot&&i(u)===!0)return Ay(e);e.assignedSlot?e=e.assignedSlot:!u&&c!==e.ownerDocument?e=c.host:e=u}e=l}if(DV(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ay(e);return!1},PV=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var i=n.children.item(r);if(i.tagName==="LEGEND")return ao.call(n,"fieldset[disabled] *")?!0:!i.contains(e)}return!0}n=n.parentElement}return!1},fp=function(e,n){return!(n.disabled||NV(n)||LV(n,e)||_V(n)||PV(n))},hp=function(e,n){return!(OV(n)||uk(n)<0||!fp(e,n))},BV=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},dk=function(e){var n=[],r=[];return e.forEach(function(i,s){var o=!!i.scopeParent,a=o?i.scopeParent:i,l=AV(a,o),u=o?dk(i.candidates):a;l===0?o?n.push.apply(n,u):n.push(a):r.push({documentOrder:s,tabIndex:l,item:i,isScope:o,content:u})}),r.sort(vV).reduce(function(i,s){return s.isScope?i.push.apply(i,s.content):i.push(s.content),i},[]).concat(n)},od=function(e,n){n=n||{};var r;return n.getShadowRoot?r=fc([e],n.includeContainer,{filter:hp.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:BV}):r=ak(e,n.includeContainer,hp.bind(null,n)),dk(r)},FV=function(e,n){n=n||{};var r;return n.getShadowRoot?r=fc([e],n.includeContainer,{filter:fp.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=ak(e,n.includeContainer,fp.bind(null,n)),r},fk=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return ao.call(e,uc)===!1?!1:hp(n,e)};function HV(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function hk(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function UV(){return/apple/i.test(navigator.vendor)}function pp(){const t=/android/i;return t.test(HV())||t.test(hk())}function $V(){return hk().includes("jsdom/")}const vy="data-floating-ui-focusable",VV="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Cs(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function Gt(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&za(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function Xr(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Of(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function zV(t){return t.matches("html,body")}function Bt(t){return t?.ownerDocument||document}function jV(t){return At(t)&&t.matches(VV)}function Ny(t){return t?t.getAttribute("role")==="combobox"&&jV(t):!1}function _y(t){return t?t.hasAttribute(vy)?t:t.querySelector("["+vy+"]")||t:null}function Fs(t,e,n){return n===void 0&&(n=!0),t.filter(i=>{var s;return i.parentId===e&&(!n||((s=i.context)==null?void 0:s.open))}).flatMap(i=>[i,...Fs(t,i.id,n)])}function Iy(t,e){var n;let r=[],i=(n=t.find(s=>s.id===e))==null?void 0:n.parentId;for(;i;){const s=t.find(o=>o.id===i);i=s?.parentId,s&&(r=r.concat(s))}return r}function Df(t){t.preventDefault(),t.stopPropagation()}function WV(t){return"nativeEvent"in t}function qV(t){return t.mozInputSource===0&&t.isTrusted?!0:pp()&&t.pointerType?t.type==="click"&&t.buttons===1:t.detail===0&&!t.pointerType}function YV(t){return $V()?!1:!pp()&&t.width===0&&t.height===0||pp()&&t.width===1&&t.height===1&&t.pressure===0&&t.detail===0&&t.pointerType==="mouse"||t.width<1&&t.height<1&&t.pressure===0&&t.detail===0&&t.pointerType==="touch"}function mp(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var KV=typeof document<"u",GV=function(){},Nt=KV?C.useLayoutEffect:GV;const XV={...Cc};function Hn(t){const e=C.useRef(t);return Nt(()=>{e.current=t}),e}const QV=XV.useInsertionEffect,ZV=QV||(t=>t());function Jt(t){const e=C.useRef(()=>{});return ZV(()=>{e.current=t}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}const ml=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function pk(t,e){const n=od(t,ml()),r=n.length;if(r===0)return;const i=Cs(Bt(t)),s=n.indexOf(i),o=s===-1?e===1?0:r-1:s+e;return n[o]}function mk(t){return pk(Bt(t).body,1)||t}function gk(t){return pk(Bt(t).body,-1)||t}function ga(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!Gt(n,r)}function JV(t){od(t,ml()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Ry(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function My(t,e,n){let{reference:r,floating:i}=t;const s=_r(e),o=ik(e),a=rk(o),l=fr(e),u=s==="y",c=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[a]/2-i[a]/2;let h;switch(l){case"top":h={x:c,y:r.y-i.height};break;case"bottom":h={x:c,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-i.width,y:d};break;default:h={x:r.x,y:r.y}}switch(ar(e)){case"start":h[o]-=f*(n&&u?-1:1);break;case"end":h[o]+=f*(n&&u?-1:1);break}return h}async function ez(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:o,elements:a,strategy:l}=t,{boundary:u="clippingAncestors",rootBoundary:c="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=ko(e,t),p=SV(h),b=a[f?d==="floating"?"reference":"floating":d],y=lc(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(b)))==null||n?b:b.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:u,rootBoundary:c,strategy:l})),E=d==="floating"?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,T=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),v=await(s.isElement==null?void 0:s.isElement(T))?await(s.getScale==null?void 0:s.getScale(T))||{x:1,y:1}:{x:1,y:1},R=lc(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:T,strategy:l}):E);return{top:(y.top-R.top+p.top)/v.y,bottom:(R.bottom-y.bottom+p.bottom)/v.y,left:(y.left-R.left+p.left)/v.x,right:(R.right-y.right+p.right)/v.x}}const tz=50,nz=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:o}=n,a=o.detectOverflow?o:{...o,detectOverflow:ez},l=await(o.isRTL==null?void 0:o.isRTL(e));let u=await o.getElementRects({reference:t,floating:e,strategy:i}),{x:c,y:d}=My(u,r,l),f=r,h=0;const p={};for(let g=0;g<s.length;g++){const b=s[g];if(!b)continue;const{name:y,fn:E}=b,{x:T,y:v,data:R,reset:A}=await E({x:c,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:u,platform:a,elements:{reference:t,floating:e}});c=T??c,d=v??d,p[y]={...p[y],...R},A&&h<tz&&(h++,typeof A=="object"&&(A.placement&&(f=A.placement),A.rects&&(u=A.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:i}):A.rects),{x:c,y:d}=My(u,f,l)),g=-1)}return{x:c,y:d,placement:f,strategy:i,middlewareData:p}};function rz(t,e,n){return(t?[...n.filter(i=>ar(i)===t),...n.filter(i=>ar(i)!==t)]:n.filter(i=>fr(i)===i)).filter(i=>t?ar(i)===t||(e?oc(i)!==i:!1):!0)}const iz=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,r,i;const{rects:s,middlewareData:o,placement:a,platform:l,elements:u}=e,{crossAxis:c=!1,alignment:d,allowedPlacements:f=xy,autoAlignment:h=!0,...p}=ko(t,e),g=d!==void 0||f===xy?rz(d||null,h,f):f,b=await l.detectOverflow(e,p),y=((n=o.autoPlacement)==null?void 0:n.index)||0,E=g[y];if(E==null)return{};const T=sk(E,s,await(l.isRTL==null?void 0:l.isRTL(u.floating)));if(a!==E)return{reset:{placement:g[0]}};const v=[b[fr(E)],b[T[0]],b[T[1]]],R=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:E,overflows:v}],A=g[y+1];if(A)return{data:{index:y+1,overflows:R},reset:{placement:A}};const O=R.map(N=>{const U=ar(N.placement);return[N.placement,U&&c?N.overflows.slice(0,2).reduce((j,z)=>j+z,0):N.overflows[0],N.overflows]}).sort((N,U)=>N[1]-U[1]),F=((i=O.filter(N=>N[2].slice(0,ar(N[0])?2:3).every(U=>U<=0))[0])==null?void 0:i[0])||O[0][0];return F!==a?{data:{index:y+1,overflows:R},reset:{placement:F}}:{}}}},sz=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:o,initialPlacement:a,platform:l,elements:u}=e,{mainAxis:c=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...b}=ko(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const y=fr(i),E=_r(a),T=fr(a)===a,v=await(l.isRTL==null?void 0:l.isRTL(u.floating)),R=f||(T||!g?[ac(a)]:bV(a)),A=p!=="none";!f&&A&&R.push(...CV(a,g,p,v));const O=[a,...R],P=await l.detectOverflow(e,b),F=[];let N=((r=s.flip)==null?void 0:r.overflows)||[];if(c&&F.push(P[y]),d){const I=sk(i,o,v);F.push(P[I[0]],P[I[1]])}if(N=[...N,{placement:i,overflows:F}],!F.every(I=>I<=0)){var U,j;const I=(((U=s.flip)==null?void 0:U.index)||0)+1,B=O[I];if(B&&(!(d==="alignment"?E!==_r(B):!1)||N.every(D=>_r(D.placement)===E?D.overflows[0]>0:!0)))return{data:{index:I,overflows:N},reset:{placement:B}};let Z=(j=N.filter(H=>H.overflows[0]<=0).sort((H,D)=>H.overflows[1]-D.overflows[1])[0])==null?void 0:j.placement;if(!Z)switch(h){case"bestFit":{var z;const H=(z=N.filter(D=>{if(A){const V=_r(D.placement);return V===E||V==="y"}return!0}).map(D=>[D.placement,D.overflows.filter(V=>V>0).reduce((V,x)=>V+x,0)]).sort((D,V)=>D[1]-V[1])[0])==null?void 0:z[0];H&&(Z=H);break}case"initialPlacement":Z=a;break}if(i!==Z)return{reset:{placement:Z}}}return{}}}},oz=new Set(["left","top"]);async function az(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=fr(n),a=ar(n),l=_r(n)==="y",u=oz.has(o)?-1:1,c=s&&l?-1:1,d=ko(e,t);let{mainAxis:f,crossAxis:h,alignmentAxis:p}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return a&&typeof p=="number"&&(h=a==="end"?p*-1:p),l?{x:h*c,y:f*u}:{x:f*u,y:h*c}}const lz=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:o,middlewareData:a}=e,l=await az(e,t);return o===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:s+l.y,data:{...l,placement:o}}}}},uz=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i,platform:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x:E,y:T}=y;return{x:E,y:T}}},...u}=ko(t,e),c={x:n,y:r},d=await s.detectOverflow(e,u),f=_r(fr(i)),h=nk(f);let p=c[h],g=c[f];if(o){const y=h==="y"?"top":"left",E=h==="y"?"bottom":"right",T=p+d[y],v=p-d[E];p=Sy(T,p,v)}if(a){const y=f==="y"?"top":"left",E=f==="y"?"bottom":"right",T=g+d[y],v=g-d[E];g=Sy(T,g,v)}const b=l.fn({...e,[h]:p,[f]:g});return{...b,data:{x:b.x-n,y:b.y-r,enabled:{[h]:o,[f]:a}}}}}},cz=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:o,elements:a}=e,{apply:l=()=>{},...u}=ko(t,e),c=await o.detectOverflow(e,u),d=fr(i),f=ar(i),h=_r(i)==="y",{width:p,height:g}=s.floating;let b,y;d==="top"||d==="bottom"?(b=d,y=f===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(y=d,b=f==="end"?"top":"bottom");const E=g-c.top-c.bottom,T=p-c.left-c.right,v=oo(g-c[b],E),R=oo(p-c[y],T),A=!e.middlewareData.shift;let O=v,P=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(P=T),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(O=E),A&&!f){const N=hn(c.left,0),U=hn(c.right,0),j=hn(c.top,0),z=hn(c.bottom,0);h?P=p-2*(N!==0||U!==0?N+U:hn(c.left,c.right)):O=g-2*(j!==0||z!==0?j+z:hn(c.top,c.bottom))}await l({...e,availableWidth:P,availableHeight:O});const F=await o.getDimensions(a.floating);return p!==F.width||g!==F.height?{reset:{rects:!0}}:{}}}};function bk(t){const e=Dn(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=At(t),s=i?t.offsetWidth:n,o=i?t.offsetHeight:r,a=sc(n)!==s||sc(r)!==o;return a&&(n=s,r=o),{width:n,height:r,$:a}}function n0(t){return Ke(t)?t:t.contextElement}function Hs(t){const e=n0(t);if(!At(e))return or(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=bk(e);let o=(s?sc(n.width):n.width)/r,a=(s?sc(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const dz=or(0);function yk(t){const e=yn(t);return!id()||!e.visualViewport?dz:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function fz(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==yn(t)?!1:e}function Gi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=n0(t);let o=or(1);e&&(r?Ke(r)&&(o=Hs(r)):o=Hs(t));const a=fz(s,n,r)?yk(s):or(0);let l=(i.left+a.x)/o.x,u=(i.top+a.y)/o.y,c=i.width/o.x,d=i.height/o.y;if(s){const f=yn(s),h=r&&Ke(r)?yn(r):r;let p=f,g=dp(p);for(;g&&r&&h!==p;){const b=Hs(g),y=g.getBoundingClientRect(),E=Dn(g),T=y.left+(g.clientLeft+parseFloat(E.paddingLeft))*b.x,v=y.top+(g.clientTop+parseFloat(E.paddingTop))*b.y;l*=b.x,u*=b.y,c*=b.x,d*=b.y,l+=T,u+=v,p=yn(g),g=dp(p)}}return lc({width:c,height:d,x:l,y:u})}function ad(t,e){const n=sd(t).scrollLeft;return e?e.left+n:Gi(br(t)).left+n}function Ek(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-ad(t,n),i=n.top+e.scrollTop;return{x:r,y:i}}function hz(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",o=br(r),a=e?rd(e.floating):!1;if(r===o||a&&s)return n;let l={scrollLeft:0,scrollTop:0},u=or(1);const c=or(0),d=At(r);if((d||!d&&!s)&&((gi(r)!=="body"||pl(o))&&(l=sd(r)),d)){const h=Gi(r);u=Hs(r),c.x=h.x+r.clientLeft,c.y=h.y+r.clientTop}const f=o&&!d&&!s?Ek(o,l):or(0);return{width:n.width*u.x,height:n.height*u.y,x:n.x*u.x-l.scrollLeft*u.x+c.x+f.x,y:n.y*u.y-l.scrollTop*u.y+c.y+f.y}}function pz(t){return Array.from(t.getClientRects())}function mz(t){const e=br(t),n=sd(t),r=t.ownerDocument.body,i=hn(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=hn(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+ad(t);const a=-n.scrollTop;return Dn(r).direction==="rtl"&&(o+=hn(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:o,y:a}}const Oy=25;function gz(t,e){const n=yn(t),r=br(t),i=n.visualViewport;let s=r.clientWidth,o=r.clientHeight,a=0,l=0;if(i){s=i.width,o=i.height;const c=id();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}const u=ad(r);if(u<=0){const c=r.ownerDocument,d=c.body,f=getComputedStyle(d),h=c.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,p=Math.abs(r.clientWidth-d.clientWidth-h);p<=Oy&&(s-=p)}else u<=Oy&&(s+=u);return{width:s,height:o,x:a,y:l}}function bz(t,e){const n=Gi(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=At(t)?Hs(t):or(1),o=t.clientWidth*s.x,a=t.clientHeight*s.y,l=i*s.x,u=r*s.y;return{width:o,height:a,x:l,y:u}}function Dy(t,e,n){let r;if(e==="viewport")r=gz(t,n);else if(e==="document")r=mz(br(t));else if(Ke(e))r=bz(e,n);else{const i=yk(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return lc(r)}function Tk(t,e){const n=Lr(t);return n===e||!Ke(n)||Dr(n)?!1:Dn(n).position==="fixed"||Tk(n,e)}function yz(t,e){const n=e.get(t);if(n)return n;let r=ai(t,[],!1).filter(a=>Ke(a)&&gi(a)!=="body"),i=null;const s=Dn(t).position==="fixed";let o=s?Lr(t):t;for(;Ke(o)&&!Dr(o);){const a=Dn(o),l=t0(o);!l&&a.position==="fixed"&&(i=null),(s?!l&&!i:!l&&a.position==="static"&&!!i&&(i.position==="absolute"||i.position==="fixed")||pl(o)&&!l&&Tk(t,o))?r=r.filter(c=>c!==o):i=a,o=Lr(o)}return e.set(t,r),r}function Ez(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const o=[...n==="clippingAncestors"?rd(e)?[]:yz(e,this._c):[].concat(n),r],a=Dy(e,o[0],i);let l=a.top,u=a.right,c=a.bottom,d=a.left;for(let f=1;f<o.length;f++){const h=Dy(e,o[f],i);l=hn(h.top,l),u=oo(h.right,u),c=oo(h.bottom,c),d=hn(h.left,d)}return{width:u-d,height:c-l,x:d,y:l}}function Tz(t){const{width:e,height:n}=bk(t);return{width:e,height:n}}function Cz(t,e,n){const r=At(e),i=br(e),s=n==="fixed",o=Gi(t,!0,s,e);let a={scrollLeft:0,scrollTop:0};const l=or(0);function u(){l.x=ad(i)}if(r||!r&&!s)if((gi(e)!=="body"||pl(i))&&(a=sd(e)),r){const h=Gi(e,!0,s,e);l.x=h.x+e.clientLeft,l.y=h.y+e.clientTop}else i&&u();s&&!r&&i&&u();const c=i&&!r&&!s?Ek(i,a):or(0),d=o.left+a.scrollLeft-l.x-c.x,f=o.top+a.scrollTop-l.y-c.y;return{x:d,y:f,width:o.width,height:o.height}}function Lf(t){return Dn(t).position==="static"}function Ly(t,e){if(!At(t)||Dn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return br(t)===n&&(n=n.ownerDocument.body),n}function Ck(t,e){const n=yn(t);if(rd(t))return n;if(!At(t)){let i=Lr(t);for(;i&&!Dr(i);){if(Ke(i)&&!Lf(i))return i;i=Lr(i)}return n}let r=Ly(t,e);for(;r&&dV(r)&&Lf(r);)r=Ly(r,e);return r&&Dr(r)&&Lf(r)&&!t0(r)?n:r||pV(t)||n}const xz=async function(t){const e=this.getOffsetParent||Ck,n=this.getDimensions,r=await n(t.floating);return{reference:Cz(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Sz(t){return Dn(t).direction==="rtl"}const wz={convertOffsetParentRelativeRectToViewportRelativeRect:hz,getDocumentElement:br,getClippingRect:Ez,getOffsetParent:Ck,getElementRects:xz,getClientRects:pz,getDimensions:Tz,getScale:Hs,isElement:Ke,isRTL:Sz};function xk(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function kz(t,e){let n=null,r;const i=br(t);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),s();const u=t.getBoundingClientRect(),{left:c,top:d,width:f,height:h}=u;if(a||e(),!f||!h)return;const p=Kl(d),g=Kl(i.clientWidth-(c+f)),b=Kl(i.clientHeight-(d+h)),y=Kl(c),T={rootMargin:-p+"px "+-g+"px "+-b+"px "+-y+"px",threshold:hn(0,oo(1,l))||1};let v=!0;function R(A){const O=A[0].intersectionRatio;if(O!==l){if(!v)return o();O?o(!1,O):r=setTimeout(()=>{o(!1,1e-7)},1e3)}O===1&&!xk(u,t.getBoundingClientRect())&&o(),v=!1}try{n=new IntersectionObserver(R,{...T,root:i.ownerDocument})}catch{n=new IntersectionObserver(R,T)}n.observe(t)}return o(!0),s}function KG(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,u=n0(t),c=i||s?[...u?ai(u):[],...e?ai(e):[]]:[];c.forEach(y=>{i&&y.addEventListener("scroll",n,{passive:!0}),s&&y.addEventListener("resize",n)});const d=u&&a?kz(u,n):null;let f=-1,h=null;o&&(h=new ResizeObserver(y=>{let[E]=y;E&&E.target===u&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var T;(T=h)==null||T.observe(e)})),n()}),u&&!l&&h.observe(u),e&&h.observe(e));let p,g=l?Gi(t):null;l&&b();function b(){const y=Gi(t);g&&!xk(g,y)&&n(),g=y,p=requestAnimationFrame(b)}return n(),()=>{var y;c.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),d?.(),(y=h)==null||y.disconnect(),h=null,l&&cancelAnimationFrame(p)}}const Az=lz,vz=iz,Nz=uz,_z=sz,Iz=cz,Rz=(t,e,n)=>{const r=new Map,i={platform:wz,...n},s={...i.platform,_c:r};return nz(t,e,{...i,platform:s})};var Mz=typeof document<"u",Oz=function(){},Eu=Mz?C.useLayoutEffect:Oz;function hc(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,i;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!hc(t[r],e[r]))return!1;return!0}if(i=Object.keys(t),n=i.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,i[r]))return!1;for(r=n;r--!==0;){const s=i[r];if(!(s==="_owner"&&t.$$typeof)&&!hc(t[s],e[s]))return!1}return!0}return t!==t&&e!==e}function Sk(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Py(t,e){const n=Sk(t);return Math.round(e*n)/n}function Pf(t){const e=C.useRef(t);return Eu(()=>{e.current=t}),e}function Dz(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:i,elements:{reference:s,floating:o}={},transform:a=!0,whileElementsMounted:l,open:u}=t,[c,d]=C.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=C.useState(r);hc(f,r)||h(r);const[p,g]=C.useState(null),[b,y]=C.useState(null),E=C.useCallback(D=>{D!==A.current&&(A.current=D,g(D))},[]),T=C.useCallback(D=>{D!==O.current&&(O.current=D,y(D))},[]),v=s||p,R=o||b,A=C.useRef(null),O=C.useRef(null),P=C.useRef(c),F=l!=null,N=Pf(l),U=Pf(i),j=Pf(u),z=C.useCallback(()=>{if(!A.current||!O.current)return;const D={placement:e,strategy:n,middleware:f};U.current&&(D.platform=U.current),Rz(A.current,O.current,D).then(V=>{const x={...V,isPositioned:j.current!==!1};I.current&&!hc(P.current,x)&&(P.current=x,Ka.flushSync(()=>{d(x)}))})},[f,e,n,U,j]);Eu(()=>{u===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,d(D=>({...D,isPositioned:!1})))},[u]);const I=C.useRef(!1);Eu(()=>(I.current=!0,()=>{I.current=!1}),[]),Eu(()=>{if(v&&(A.current=v),R&&(O.current=R),v&&R){if(N.current)return N.current(v,R,z);z()}},[v,R,z,N,F]);const B=C.useMemo(()=>({reference:A,floating:O,setReference:E,setFloating:T}),[E,T]),Z=C.useMemo(()=>({reference:v,floating:R}),[v,R]),H=C.useMemo(()=>{const D={position:n,left:0,top:0};if(!Z.floating)return D;const V=Py(Z.floating,c.x),x=Py(Z.floating,c.y);return a?{...D,transform:"translate("+V+"px, "+x+"px)",...Sk(Z.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:V,top:x}},[n,a,Z.floating,c.x,c.y]);return C.useMemo(()=>({...c,update:z,refs:B,elements:Z,floatingStyles:H}),[c,z,B,Z,H])}const GG=(t,e)=>{const n=Az(t);return{name:n.name,fn:n.fn,options:[t,e]}},XG=(t,e)=>{const n=Nz(t);return{name:n.name,fn:n.fn,options:[t,e]}},QG=(t,e)=>{const n=_z(t);return{name:n.name,fn:n.fn,options:[t,e]}},ZG=(t,e)=>{const n=Iz(t);return{name:n.name,fn:n.fn,options:[t,e]}},JG=(t,e)=>{const n=vz(t);return{name:n.name,fn:n.fn,options:[t,e]}};function eX(t){const e=C.useRef(void 0),n=C.useCallback(r=>{const i=t.map(s=>{if(s!=null){if(typeof s=="function"){const o=s,a=o(r);return typeof a=="function"?a:()=>{o(null)}}return s.current=r,()=>{s.current=null}}});return()=>{i.forEach(s=>s?.())}},t);return C.useMemo(()=>t.every(r=>r==null)?null:r=>{e.current&&(e.current(),e.current=void 0),r!=null&&(e.current=n(r))},t)}const Lz="data-floating-ui-focusable",By="active",Fy="selected",Pz={...Cc};let Hy=!1,Bz=0;const Uy=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Bz++;function Fz(){const[t,e]=C.useState(()=>Hy?Uy():void 0);return Nt(()=>{t==null&&e(Uy())},[]),C.useEffect(()=>{Hy=!0},[]),t}const Hz=Pz.useId,wk=Hz||Fz;function Uz(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(i=>i(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const $z=C.createContext(null),Vz=C.createContext(null),kk=()=>{var t;return((t=C.useContext($z))==null?void 0:t.id)||null},ld=()=>C.useContext(Vz);function lo(t){return"data-floating-ui-"+t}function Kt(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const $y=lo("safe-polygon");function Bf(t,e,n){if(n&&!mp(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function Ff(t){return typeof t=="function"?t():t}function tX(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:i,events:s,elements:o}=t,{enabled:a=!0,delay:l=0,handleClose:u=null,mouseOnly:c=!1,restMs:d=0,move:f=!0}=e,h=ld(),p=kk(),g=Hn(u),b=Hn(l),y=Hn(n),E=Hn(d),T=C.useRef(),v=C.useRef(-1),R=C.useRef(),A=C.useRef(-1),O=C.useRef(!0),P=C.useRef(!1),F=C.useRef(()=>{}),N=C.useRef(!1),U=Jt(()=>{var H;const D=(H=i.current.openEvent)==null?void 0:H.type;return D?.includes("mouse")&&D!=="mousedown"});C.useEffect(()=>{if(!a)return;function H(D){let{open:V}=D;V||(Kt(v),Kt(A),O.current=!0,N.current=!1)}return s.on("openchange",H),()=>{s.off("openchange",H)}},[a,s]),C.useEffect(()=>{if(!a||!g.current||!n)return;function H(V){U()&&r(!1,V,"hover")}const D=Bt(o.floating).documentElement;return D.addEventListener("mouseleave",H),()=>{D.removeEventListener("mouseleave",H)}},[o.floating,n,r,a,g,U]);const j=C.useCallback(function(H,D,V){D===void 0&&(D=!0),V===void 0&&(V="hover");const x=Bf(b.current,"close",T.current);x&&!R.current?(Kt(v),v.current=window.setTimeout(()=>r(!1,H,V),x)):D&&(Kt(v),r(!1,H,V))},[b,r]),z=Jt(()=>{F.current(),R.current=void 0}),I=Jt(()=>{if(P.current){const H=Bt(o.floating).body;H.style.pointerEvents="",H.removeAttribute($y),P.current=!1}}),B=Jt(()=>i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1);C.useEffect(()=>{if(!a)return;function H(G){if(Kt(v),O.current=!1,c&&!mp(T.current)||Ff(E.current)>0&&!Bf(b.current,"open"))return;const w=Bf(b.current,"open",T.current);w?v.current=window.setTimeout(()=>{y.current||r(!0,G,"hover")},w):n||r(!0,G,"hover")}function D(G){if(B()){I();return}F.current();const w=Bt(o.floating);if(Kt(A),N.current=!1,g.current&&i.current.floatingContext){n||Kt(v),R.current=g.current({...i.current.floatingContext,tree:h,x:G.clientX,y:G.clientY,onClose(){I(),z(),B()||j(G,!0,"safe-polygon")}});const te=R.current;w.addEventListener("mousemove",te),F.current=()=>{w.removeEventListener("mousemove",te)};return}(T.current!=="touch"||!Gt(o.floating,G.relatedTarget))&&j(G)}function V(G){B()||i.current.floatingContext&&(g.current==null||g.current({...i.current.floatingContext,tree:h,x:G.clientX,y:G.clientY,onClose(){I(),z(),B()||j(G)}})(G))}function x(){Kt(v)}function ne(G){B()||j(G,!1)}if(Ke(o.domReference)){const G=o.domReference,w=o.floating;return n&&G.addEventListener("mouseleave",V),f&&G.addEventListener("mousemove",H,{once:!0}),G.addEventListener("mouseenter",H),G.addEventListener("mouseleave",D),w&&(w.addEventListener("mouseleave",V),w.addEventListener("mouseenter",x),w.addEventListener("mouseleave",ne)),()=>{n&&G.removeEventListener("mouseleave",V),f&&G.removeEventListener("mousemove",H),G.removeEventListener("mouseenter",H),G.removeEventListener("mouseleave",D),w&&(w.removeEventListener("mouseleave",V),w.removeEventListener("mouseenter",x),w.removeEventListener("mouseleave",ne))}}},[o,a,t,c,f,j,z,I,r,n,y,h,b,g,i,B,E]),Nt(()=>{var H;if(a&&n&&(H=g.current)!=null&&(H=H.__options)!=null&&H.blockPointerEvents&&U()){P.current=!0;const V=o.floating;if(Ke(o.domReference)&&V){var D;const x=Bt(o.floating).body;x.setAttribute($y,"");const ne=o.domReference,G=h==null||(D=h.nodesRef.current.find(w=>w.id===p))==null||(D=D.context)==null?void 0:D.elements.floating;return G&&(G.style.pointerEvents=""),x.style.pointerEvents="none",ne.style.pointerEvents="auto",V.style.pointerEvents="auto",()=>{x.style.pointerEvents="",ne.style.pointerEvents="",V.style.pointerEvents=""}}}},[a,n,p,o,h,g,U]),Nt(()=>{n||(T.current=void 0,N.current=!1,z(),I())},[n,z,I]),C.useEffect(()=>()=>{z(),Kt(v),Kt(A),I()},[a,o.domReference,z,I]);const Z=C.useMemo(()=>{function H(D){T.current=D.pointerType}return{onPointerDown:H,onPointerEnter:H,onMouseMove(D){const{nativeEvent:V}=D;function x(){!O.current&&!y.current&&r(!0,V,"hover")}c&&!mp(T.current)||n||Ff(E.current)===0||N.current&&D.movementX**2+D.movementY**2<2||(Kt(A),T.current==="touch"?x():(N.current=!0,A.current=window.setTimeout(x,Ff(E.current))))}}},[c,r,n,y,E]);return C.useMemo(()=>a?{reference:Z}:{},[a,Z])}let Vy=0;function fs(t,e){e===void 0&&(e={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:i=!1}=e;r&&cancelAnimationFrame(Vy);const s=()=>t?.focus({preventScroll:n});i?s():Vy=requestAnimationFrame(s)}function Hf(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&za(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function zz(t){return"composedPath"in t?t.composedPath()[0]:t.target}function jz(t){return t?.ownerDocument||document}const Us={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function zy(t){return t==="inert"?Us.inert:t==="aria-hidden"?Us["aria-hidden"]:Us.none}let Gl=new WeakSet,Xl={},Uf=0;const Wz=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype;function Ak(t){return t?za(t)?t.host:Ak(t.parentNode):null}const qz=(t,e)=>e.map(n=>{if(t.contains(n))return n;const r=Ak(n);return t.contains(r)?r:null}).filter(n=>n!=null);function Yz(t,e,n,r){const i="data-floating-ui-inert",s=r?"inert":n?"aria-hidden":null,o=qz(e,t),a=new Set,l=new Set(o),u=[];Xl[i]||(Xl[i]=new WeakMap);const c=Xl[i];o.forEach(d),f(e),a.clear();function d(h){!h||a.has(h)||(a.add(h),h.parentNode&&d(h.parentNode))}function f(h){!h||l.has(h)||[].forEach.call(h.children,p=>{if(gi(p)!=="script")if(a.has(p))f(p);else{const g=s?p.getAttribute(s):null,b=g!==null&&g!=="false",y=zy(s),E=(y.get(p)||0)+1,T=(c.get(p)||0)+1;y.set(p,E),c.set(p,T),u.push(p),E===1&&b&&Gl.add(p),T===1&&p.setAttribute(i,""),!b&&s&&p.setAttribute(s,s==="inert"?"":"true")}})}return Uf++,()=>{u.forEach(h=>{const p=zy(s),b=(p.get(h)||0)-1,y=(c.get(h)||0)-1;p.set(h,b),c.set(h,y),b||(!Gl.has(h)&&s&&h.removeAttribute(s),Gl.delete(h)),y||h.removeAttribute(i)}),Uf--,Uf||(Us.inert=new WeakMap,Us["aria-hidden"]=new WeakMap,Us.none=new WeakMap,Gl=new WeakSet,Xl={})}}function jy(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);const r=jz(t[0]).body;return Yz(t.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,e,n)}const r0={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},pc=C.forwardRef(function(e,n){const[r,i]=C.useState();Nt(()=>{UV()&&i("button")},[]);const s={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[lo("focus-guard")]:"",style:r0};return M.jsx("span",{...e,...s})}),Kz={clipPath:"inset(50%)",position:"fixed",top:0,left:0},vk=C.createContext(null),Wy=lo("portal");function Gz(t){t===void 0&&(t={});const{id:e,root:n}=t,r=wk(),i=Nk(),[s,o]=C.useState(null),a=C.useRef(null);return Nt(()=>()=>{s?.remove(),queueMicrotask(()=>{a.current=null})},[s]),Nt(()=>{if(!r||a.current)return;const l=e?document.getElementById(e):null;if(!l)return;const u=document.createElement("div");u.id=r,u.setAttribute(Wy,""),l.appendChild(u),a.current=u,o(u)},[e,r]),Nt(()=>{if(n===null||!r||a.current)return;let l=n||i?.portalNode;l&&!e0(l)&&(l=l.current),l=l||document.body;let u=null;e&&(u=document.createElement("div"),u.id=e,l.appendChild(u));const c=document.createElement("div");c.id=r,c.setAttribute(Wy,""),l=u||l,l.appendChild(c),a.current=c,o(c)},[e,n,r,i]),s}function nX(t){const{children:e,id:n,root:r,preserveTabOrder:i=!0}=t,s=Gz({id:n,root:r}),[o,a]=C.useState(null),l=C.useRef(null),u=C.useRef(null),c=C.useRef(null),d=C.useRef(null),f=o?.modal,h=o?.open,p=!!o&&!o.modal&&o.open&&i&&!!(r||s);return C.useEffect(()=>{if(!s||!i||f)return;function g(b){s&&ga(b)&&(b.type==="focusin"?Ry:JV)(s)}return s.addEventListener("focusin",g,!0),s.addEventListener("focusout",g,!0),()=>{s.removeEventListener("focusin",g,!0),s.removeEventListener("focusout",g,!0)}},[s,i,f]),C.useEffect(()=>{s&&(h||Ry(s))},[h,s]),M.jsxs(vk.Provider,{value:C.useMemo(()=>({preserveTabOrder:i,beforeOutsideRef:l,afterOutsideRef:u,beforeInsideRef:c,afterInsideRef:d,portalNode:s,setFocusManagerState:a}),[i,s]),children:[p&&s&&M.jsx(pc,{"data-type":"outside",ref:l,onFocus:g=>{if(ga(g,s)){var b;(b=c.current)==null||b.focus()}else{const y=o?o.domReference:null,E=gk(y);E?.focus()}}}),p&&s&&M.jsx("span",{"aria-owns":s.id,style:Kz}),s&&Ka.createPortal(e,s),p&&s&&M.jsx(pc,{"data-type":"outside",ref:u,onFocus:g=>{if(ga(g,s)){var b;(b=d.current)==null||b.focus()}else{const y=o?o.domReference:null,E=mk(y);E?.focus(),o?.closeOnFocusOut&&o?.onOpenChange(!1,g.nativeEvent,"focus-out")}}})]})}const Nk=()=>C.useContext(vk);function qy(t){return C.useMemo(()=>e=>{t.forEach(n=>{n&&(n.current=e)})},t)}const Yy=20;let ti=[];function i0(){ti=ti.filter(t=>{var e;return(e=t.deref())==null?void 0:e.isConnected})}function Xz(t){i0(),t&&gi(t)!=="body"&&(ti.push(new WeakRef(t)),ti.length>Yy&&(ti=ti.slice(-Yy)))}function Ky(){i0();const t=ti[ti.length-1];return t?.deref()}function Qz(t){const e=ml();return fk(t,e)?t:od(t,e)[0]||t}function Gy(t,e){var n;if(!e.current.includes("floating")&&!((n=t.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=ml(),s=FV(t,r).filter(a=>{const l=a.getAttribute("data-tabindex")||"";return fk(a,r)||a.hasAttribute("data-tabindex")&&!l.startsWith("-")}),o=t.getAttribute("tabindex");e.current.includes("floating")||s.length===0?o!=="0"&&t.setAttribute("tabindex","0"):(o!=="-1"||t.hasAttribute("data-tabindex")&&t.getAttribute("data-tabindex")!=="-1")&&(t.setAttribute("tabindex","-1"),t.setAttribute("data-tabindex","-1"))}const Zz=C.forwardRef(function(e,n){return M.jsx("button",{...e,type:"button",ref:n,tabIndex:-1,style:r0})});function rX(t){const{context:e,children:n,disabled:r=!1,order:i=["content"],guards:s=!0,initialFocus:o=0,returnFocus:a=!0,restoreFocus:l=!1,modal:u=!0,visuallyHiddenDismiss:c=!1,closeOnFocusOut:d=!0,outsideElementsInert:f=!1,getInsideElements:h=()=>[]}=t,{open:p,onOpenChange:g,events:b,dataRef:y,elements:{domReference:E,floating:T}}=e,v=Jt(()=>{var oe;return(oe=y.current.floatingContext)==null?void 0:oe.nodeId}),R=Jt(h),A=typeof o=="number"&&o<0,O=Ny(E)&&A,P=Wz(),F=P?s:!0,N=!F||P&&f,U=Hn(i),j=Hn(o),z=Hn(a),I=ld(),B=Nk(),Z=C.useRef(null),H=C.useRef(null),D=C.useRef(!1),V=C.useRef(!1),x=C.useRef(-1),ne=C.useRef(-1),G=B!=null,w=_y(T),me=Jt(function(oe){return oe===void 0&&(oe=w),oe?od(oe,ml()):[]}),te=Jt(oe=>{const ie=me(oe);return U.current.map(fe=>E&&fe==="reference"?E:w&&fe==="floating"?w:ie).filter(Boolean).flat()});C.useEffect(()=>{if(r||!u)return;function oe(fe){if(fe.key==="Tab"){Gt(w,Cs(Bt(w)))&&me().length===0&&!O&&Df(fe);const Me=te(),Fe=Xr(fe);U.current[0]==="reference"&&Fe===E&&(Df(fe),fe.shiftKey?fs(Me[Me.length-1]):fs(Me[1])),U.current[1]==="floating"&&Fe===w&&fe.shiftKey&&(Df(fe),fs(Me[0]))}}const ie=Bt(w);return ie.addEventListener("keydown",oe),()=>{ie.removeEventListener("keydown",oe)}},[r,E,w,u,U,O,me,te]),C.useEffect(()=>{if(r||!T)return;function oe(ie){const fe=Xr(ie),Fe=me().indexOf(fe);Fe!==-1&&(x.current=Fe)}return T.addEventListener("focusin",oe),()=>{T.removeEventListener("focusin",oe)}},[r,T,me]),C.useEffect(()=>{if(r||!d)return;function oe(){V.current=!0,setTimeout(()=>{V.current=!1})}function ie(Fe){const Ce=Fe.relatedTarget,lt=Fe.currentTarget,Be=Xr(Fe);queueMicrotask(()=>{const Qe=v(),Tn=!(Gt(E,Ce)||Gt(T,Ce)||Gt(Ce,T)||Gt(B?.portalNode,Ce)||Ce!=null&&Ce.hasAttribute(lo("focus-guard"))||I&&(Fs(I.nodesRef.current,Qe).find(Cn=>{var an,xn;return Gt((an=Cn.context)==null?void 0:an.elements.floating,Ce)||Gt((xn=Cn.context)==null?void 0:xn.elements.domReference,Ce)})||Iy(I.nodesRef.current,Qe).find(Cn=>{var an,xn,rs;return[(an=Cn.context)==null?void 0:an.elements.floating,_y((xn=Cn.context)==null?void 0:xn.elements.floating)].includes(Ce)||((rs=Cn.context)==null?void 0:rs.elements.domReference)===Ce})));if(lt===E&&w&&Gy(w,U),l&&lt!==E&&!(Be!=null&&Be.isConnected)&&Cs(Bt(w))===Bt(w).body){At(w)&&w.focus();const Cn=x.current,an=me(),xn=an[Cn]||an[an.length-1]||w;At(xn)&&xn.focus()}if(y.current.insideReactTree){y.current.insideReactTree=!1;return}(O||!u)&&Ce&&Tn&&!V.current&&Ce!==Ky()&&(D.current=!0,g(!1,Fe,"focus-out"))})}const fe=!!(!I&&B);function Me(){Kt(ne),y.current.insideReactTree=!0,ne.current=window.setTimeout(()=>{y.current.insideReactTree=!1})}if(T&&At(E))return E.addEventListener("focusout",ie),E.addEventListener("pointerdown",oe),T.addEventListener("focusout",ie),fe&&T.addEventListener("focusout",Me,!0),()=>{E.removeEventListener("focusout",ie),E.removeEventListener("pointerdown",oe),T.removeEventListener("focusout",ie),fe&&T.removeEventListener("focusout",Me,!0)}},[r,E,T,w,u,I,B,g,d,l,me,O,v,U,y]);const le=C.useRef(null),Ne=C.useRef(null),ye=qy([le,B?.beforeInsideRef]),ge=qy([Ne,B?.afterInsideRef]);C.useEffect(()=>{var oe,ie;if(r||!T)return;const fe=Array.from((B==null||(oe=B.portalNode)==null?void 0:oe.querySelectorAll("["+lo("portal")+"]"))||[]),Fe=(ie=(I?Iy(I.nodesRef.current,v()):[]).find(Be=>{var Qe;return Ny(((Qe=Be.context)==null?void 0:Qe.elements.domReference)||null)}))==null||(ie=ie.context)==null?void 0:ie.elements.domReference,Ce=[T,Fe,...fe,...R(),Z.current,H.current,le.current,Ne.current,B?.beforeOutsideRef.current,B?.afterOutsideRef.current,U.current.includes("reference")||O?E:null].filter(Be=>Be!=null),lt=u||O?jy(Ce,!N,N):jy(Ce);return()=>{lt()}},[r,E,T,u,U,B,O,F,N,I,v,R]),Nt(()=>{if(r||!At(w))return;const oe=Bt(w),ie=Cs(oe);queueMicrotask(()=>{const fe=te(w),Me=j.current,Fe=(typeof Me=="number"?fe[Me]:Me.current)||w,Ce=Gt(w,ie);!A&&!Ce&&p&&fs(Fe,{preventScroll:Fe===w})})},[r,p,w,A,te,j]),Nt(()=>{if(r||!w)return;const oe=Bt(w),ie=Cs(oe);Xz(ie);function fe(Ce){let{reason:lt,event:Be,nested:Qe}=Ce;if(["hover","safe-polygon"].includes(lt)&&Be.type==="mouseleave"&&(D.current=!0),lt==="outside-press")if(Qe)D.current=!1;else if(qV(Be)||YV(Be))D.current=!1;else{let Tn=!1;document.createElement("div").focus({get preventScroll(){return Tn=!0,!1}}),Tn?D.current=!1:D.current=!0}}b.on("openchange",fe);const Me=oe.createElement("span");Me.setAttribute("tabindex","-1"),Me.setAttribute("aria-hidden","true"),Object.assign(Me.style,r0),G&&E&&E.insertAdjacentElement("afterend",Me);function Fe(){if(typeof z.current=="boolean"){const Ce=E||Ky();return Ce&&Ce.isConnected?Ce:Me}return z.current.current||Me}return()=>{b.off("openchange",fe);const Ce=Cs(oe),lt=Gt(T,Ce)||I&&Fs(I.nodesRef.current,v(),!1).some(Qe=>{var Tn;return Gt((Tn=Qe.context)==null?void 0:Tn.elements.floating,Ce)}),Be=Fe();queueMicrotask(()=>{const Qe=Qz(Be);z.current&&!D.current&&At(Qe)&&(!(Qe!==Ce&&Ce!==oe.body)||lt)&&Qe.focus({preventScroll:!0}),Me.remove()})}},[r,T,w,z,y,b,I,G,E,v]),C.useEffect(()=>(queueMicrotask(()=>{D.current=!1}),()=>{queueMicrotask(i0)}),[r]),Nt(()=>{if(!r&&B)return B.setFocusManagerState({modal:u,closeOnFocusOut:d,open:p,onOpenChange:g,domReference:E}),()=>{B.setFocusManagerState(null)}},[r,B,u,p,g,d,E]),Nt(()=>{r||w&&Gy(w,U)},[r,w,U]);function De(oe){return r||!c||!u?null:M.jsx(Zz,{ref:oe==="start"?Z:H,onClick:ie=>g(!1,ie.nativeEvent),children:typeof c=="string"?c:"Dismiss"})}const qe=!r&&F&&(u?!O:!0)&&(G||u);return M.jsxs(M.Fragment,{children:[qe&&M.jsx(pc,{"data-type":"inside",ref:ye,onFocus:oe=>{if(u){const fe=te();fs(i[0]==="reference"?fe[0]:fe[fe.length-1])}else if(B!=null&&B.preserveTabOrder&&B.portalNode)if(D.current=!1,ga(oe,B.portalNode)){const fe=mk(E);fe?.focus()}else{var ie;(ie=B.beforeOutsideRef.current)==null||ie.focus()}}}),!O&&De("start"),n,De("end"),qe&&M.jsx(pc,{"data-type":"inside",ref:ge,onFocus:oe=>{if(u)fs(te()[0]);else if(B!=null&&B.preserveTabOrder&&B.portalNode)if(d&&(D.current=!0),ga(oe,B.portalNode)){const fe=gk(E);fe?.focus()}else{var ie;(ie=B.afterOutsideRef.current)==null||ie.focus()}}})]})}const Jz={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},ej={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},Xy=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function iX(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:i,dataRef:s}=t,{enabled:o=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:u="pointerdown",referencePress:c=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,g=ld(),b=Jt(typeof l=="function"?l:()=>!1),y=typeof l=="function"?b:l,E=C.useRef(!1),{escapeKey:T,outsidePress:v}=Xy(h),{escapeKey:R,outsidePress:A}=Xy(p),O=C.useRef(!1),P=Jt(I=>{var B;if(!n||!o||!a||I.key!=="Escape"||O.current)return;const Z=(B=s.current.floatingContext)==null?void 0:B.nodeId,H=g?Fs(g.nodesRef.current,Z):[];if(!T&&(I.stopPropagation(),H.length>0)){let D=!0;if(H.forEach(V=>{var x;if((x=V.context)!=null&&x.open&&!V.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}r(!1,WV(I)?I.nativeEvent:I,"escape-key")}),F=Jt(I=>{var B;const Z=()=>{var H;P(I),(H=Xr(I))==null||H.removeEventListener("keydown",Z)};(B=Xr(I))==null||B.addEventListener("keydown",Z)}),N=Jt(I=>{var B;const Z=s.current.insideReactTree;s.current.insideReactTree=!1;const H=E.current;if(E.current=!1,u==="click"&&H||Z||typeof y=="function"&&!y(I))return;const D=Xr(I),V="["+lo("inert")+"]",x=Bt(i.floating).querySelectorAll(V);let ne=Ke(D)?D:null;for(;ne&&!Dr(ne);){const te=Lr(ne);if(Dr(te)||!Ke(te))break;ne=te}if(x.length&&Ke(D)&&!zV(D)&&!Gt(D,i.floating)&&Array.from(x).every(te=>!Gt(ne,te)))return;if(At(D)&&z){const te=Dr(D),le=Dn(D),Ne=/auto|scroll/,ye=te||Ne.test(le.overflowX),ge=te||Ne.test(le.overflowY),De=ye&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,qe=ge&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,oe=le.direction==="rtl",ie=qe&&(oe?I.offsetX<=D.offsetWidth-D.clientWidth:I.offsetX>D.clientWidth),fe=De&&I.offsetY>D.clientHeight;if(ie||fe)return}const G=(B=s.current.floatingContext)==null?void 0:B.nodeId,w=g&&Fs(g.nodesRef.current,G).some(te=>{var le;return Of(I,(le=te.context)==null?void 0:le.elements.floating)});if(Of(I,i.floating)||Of(I,i.domReference)||w)return;const me=g?Fs(g.nodesRef.current,G):[];if(me.length>0){let te=!0;if(me.forEach(le=>{var Ne;if((Ne=le.context)!=null&&Ne.open&&!le.context.dataRef.current.__outsidePressBubbles){te=!1;return}}),!te)return}r(!1,I,"outside-press")}),U=Jt(I=>{var B;const Z=()=>{var H;N(I),(H=Xr(I))==null||H.removeEventListener(u,Z)};(B=Xr(I))==null||B.addEventListener(u,Z)});C.useEffect(()=>{if(!n||!o)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=v;let I=-1;function B(x){r(!1,x,"ancestor-scroll")}function Z(){window.clearTimeout(I),O.current=!0}function H(){I=window.setTimeout(()=>{O.current=!1},id()?5:0)}const D=Bt(i.floating);a&&(D.addEventListener("keydown",R?F:P,R),D.addEventListener("compositionstart",Z),D.addEventListener("compositionend",H)),y&&D.addEventListener(u,A?U:N,A);let V=[];return f&&(Ke(i.domReference)&&(V=ai(i.domReference)),Ke(i.floating)&&(V=V.concat(ai(i.floating))),!Ke(i.reference)&&i.reference&&i.reference.contextElement&&(V=V.concat(ai(i.reference.contextElement)))),V=V.filter(x=>{var ne;return x!==((ne=D.defaultView)==null?void 0:ne.visualViewport)}),V.forEach(x=>{x.addEventListener("scroll",B,{passive:!0})}),()=>{a&&(D.removeEventListener("keydown",R?F:P,R),D.removeEventListener("compositionstart",Z),D.removeEventListener("compositionend",H)),y&&D.removeEventListener(u,A?U:N,A),V.forEach(x=>{x.removeEventListener("scroll",B)}),window.clearTimeout(I)}},[s,i,a,y,u,n,r,f,o,T,v,P,R,F,N,A,U]),C.useEffect(()=>{s.current.insideReactTree=!1},[s,y,u]);const j=C.useMemo(()=>({onKeyDown:P,...c&&{[Jz[d]]:I=>{r(!1,I.nativeEvent,"reference-press")},...d!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[P,r,c,d]),z=C.useMemo(()=>{function I(B){B.button===0&&(E.current=!0)}return{onKeyDown:P,onMouseDown:I,onMouseUp:I,[ej[u]]:()=>{s.current.insideReactTree=!0}}},[P,u,s]);return C.useMemo(()=>o?{reference:j,floating:z}:{},[o,j,z])}function tj(t){const{open:e=!1,onOpenChange:n,elements:r}=t,i=wk(),s=C.useRef({}),[o]=C.useState(()=>Uz()),a=kk()!=null,[l,u]=C.useState(r.reference),c=Jt((h,p,g)=>{s.current.openEvent=h?p:void 0,o.emit("openchange",{open:h,event:p,reason:g,nested:a}),n?.(h,p,g)}),d=C.useMemo(()=>({setPositionReference:u}),[]),f=C.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return C.useMemo(()=>({dataRef:s,open:e,onOpenChange:c,elements:f,events:o,floatingId:i,refs:d}),[e,c,f,o,i,d])}function sX(t){t===void 0&&(t={});const{nodeId:e}=t,n=tj({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,i=r.elements,[s,o]=C.useState(null),[a,l]=C.useState(null),c=i?.domReference||s,d=C.useRef(null),f=ld();Nt(()=>{c&&(d.current=c)},[c]);const h=Dz({...t,elements:{...i,...a&&{reference:a}}}),p=C.useCallback(T=>{const v=Ke(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;l(v),h.refs.setReference(v)},[h.refs]),g=C.useCallback(T=>{(Ke(T)||T===null)&&(d.current=T,o(T)),(Ke(h.refs.reference.current)||h.refs.reference.current===null||T!==null&&!Ke(T))&&h.refs.setReference(T)},[h.refs]),b=C.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d}),[h.refs,g,p]),y=C.useMemo(()=>({...h.elements,domReference:c}),[h.elements,c]),E=C.useMemo(()=>({...h,...r,refs:b,elements:y,nodeId:e}),[h,b,y,e,r]);return Nt(()=>{r.dataRef.current.floatingContext=E;const T=f?.nodesRef.current.find(v=>v.id===e);T&&(T.context=E)}),C.useMemo(()=>({...h,context:E,refs:b,elements:y}),[h,b,y,E])}function $f(t,e,n){const r=new Map,i=n==="item";let s=t;if(i&&t){const{[By]:o,[Fy]:a,...l}=t;s=l}return{...n==="floating"&&{tabIndex:-1,[Lz]:""},...s,...e.map(o=>{const a=o?o[n]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((o,a)=>(a&&Object.entries(a).forEach(l=>{let[u,c]=l;if(!(i&&[By,Fy].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof c=="function"){var d;(d=r.get(u))==null||d.push(c),o[u]=function(){for(var f,h=arguments.length,p=new Array(h),g=0;g<h;g++)p[g]=arguments[g];return(f=r.get(u))==null?void 0:f.map(b=>b(...p)).find(b=>b!==void 0)}}}else o[u]=c}),o),{})}}function oX(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),n=t.map(a=>a?.floating),r=t.map(a=>a?.item),i=C.useCallback(a=>$f(a,t,"reference"),e),s=C.useCallback(a=>$f(a,t,"floating"),n),o=C.useCallback(a=>$f(a,t,"item"),r);return C.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:o}),[i,s,o])}const Qy=t=>t.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(e,n)=>(n?"-":"")+e.toLowerCase());function hs(t,e){return typeof t=="function"?t(e):t}function nj(t,e){const[n,r]=C.useState(t);return t&&!n&&r(!0),C.useEffect(()=>{if(!t&&n){const i=setTimeout(()=>r(!1),e);return()=>clearTimeout(i)}},[t,n,e]),n}function rj(t,e){e===void 0&&(e={});const{open:n,elements:{floating:r}}=t,{duration:i=250}=e,o=(typeof i=="number"?i:i.close)||0,[a,l]=C.useState("unmounted"),u=nj(n,o);return!u&&a==="close"&&l("unmounted"),Nt(()=>{if(r){if(n){l("initial");const c=requestAnimationFrame(()=>{Ka.flushSync(()=>{l("open")})});return()=>{cancelAnimationFrame(c)}}l("close")}},[n,r]),{isMounted:u,status:a}}function aX(t,e){e===void 0&&(e={});const{initial:n={opacity:0},open:r,close:i,common:s,duration:o=250}=e,a=t.placement,l=a.split("-")[0],u=C.useMemo(()=>({side:l,placement:a}),[l,a]),c=typeof o=="number",d=(c?o:o.open)||0,f=(c?o:o.close)||0,[h,p]=C.useState(()=>({...hs(s,u),...hs(n,u)})),{isMounted:g,status:b}=rj(t,{duration:o}),y=Hn(n),E=Hn(r),T=Hn(i),v=Hn(s);return Nt(()=>{const R=hs(y.current,u),A=hs(T.current,u),O=hs(v.current,u),P=hs(E.current,u)||Object.keys(R).reduce((F,N)=>(F[N]="",F),{});if(b==="initial"&&p(F=>({transitionProperty:F.transitionProperty,...O,...R})),b==="open"&&p({transitionProperty:Object.keys(P).map(Qy).join(","),transitionDuration:d+"ms",...O,...P}),b==="close"){const F=A||R;p({transitionProperty:Object.keys(F).map(Qy).join(","),transitionDuration:f+"ms",...O,...F})}},[f,T,y,E,v,d,b,u]),{isMounted:g,styles:h}}function _k(t,e,n){return n===void 0&&(n=!0),t.filter(i=>{var s;return i.parentId===e&&(!n||((s=i.context)==null?void 0:s.open))}).flatMap(i=>[i,..._k(t,i.id,n)])}function Zy(t,e){const[n,r]=t;let i=!1;const s=e.length;for(let o=0,a=s-1;o<s;a=o++){const[l,u]=e[o]||[0,0],[c,d]=e[a]||[0,0];u>=r!=d>=r&&n<=(c-l)*(r-u)/(d-u)+l&&(i=!i)}return i}function ij(t,e){return t[0]>=e.x&&t[0]<=e.x+e.width&&t[1]>=e.y&&t[1]<=e.y+e.height}function lX(t){t===void 0&&(t={});const{buffer:e=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=t,i={current:-1};let s=!1,o=null,a=null,l=typeof performance<"u"?performance.now():0;function u(d,f){const h=performance.now(),p=h-l;if(o===null||a===null||p===0)return o=d,a=f,l=h,null;const g=d-o,b=f-a,E=Math.sqrt(g*g+b*b)/p;return o=d,a=f,l=h,E}const c=d=>{let{x:f,y:h,placement:p,elements:g,onClose:b,nodeId:y,tree:E}=d;return function(v){function R(){Kt(i),b()}if(Kt(i),!g.domReference||!g.floating||p==null||f==null||h==null)return;const{clientX:A,clientY:O}=v,P=[A,O],F=zz(v),N=v.type==="mouseleave",U=Hf(g.floating,F),j=Hf(g.domReference,F),z=g.domReference.getBoundingClientRect(),I=g.floating.getBoundingClientRect(),B=p.split("-")[0],Z=f>I.right-I.width/2,H=h>I.bottom-I.height/2,D=ij(P,z),V=I.width>z.width,x=I.height>z.height,ne=(V?z:I).left,G=(V?z:I).right,w=(x?z:I).top,me=(x?z:I).bottom;if(U&&(s=!0,!N))return;if(j&&(s=!1),j&&!N){s=!0;return}if(N&&Ke(v.relatedTarget)&&Hf(g.floating,v.relatedTarget)||E&&_k(E.nodesRef.current,y).length)return;if(B==="top"&&h>=z.bottom-1||B==="bottom"&&h<=z.top+1||B==="left"&&f>=z.right-1||B==="right"&&f<=z.left+1)return R();let te=[];switch(B){case"top":te=[[ne,z.top+1],[ne,I.bottom-1],[G,I.bottom-1],[G,z.top+1]];break;case"bottom":te=[[ne,I.top+1],[ne,z.bottom-1],[G,z.bottom-1],[G,I.top+1]];break;case"left":te=[[I.right-1,me],[I.right-1,w],[z.left+1,w],[z.left+1,me]];break;case"right":te=[[z.right-1,me],[z.right-1,w],[I.left+1,w],[I.left+1,me]];break}function le(Ne){let[ye,ge]=Ne;switch(B){case"top":{const De=[V?ye+e/2:Z?ye+e*4:ye-e*4,ge+e+1],qe=[V?ye-e/2:Z?ye+e*4:ye-e*4,ge+e+1],oe=[[I.left,Z||V?I.bottom-e:I.top],[I.right,Z?V?I.bottom-e:I.top:I.bottom-e]];return[De,qe,...oe]}case"bottom":{const De=[V?ye+e/2:Z?ye+e*4:ye-e*4,ge-e],qe=[V?ye-e/2:Z?ye+e*4:ye-e*4,ge-e],oe=[[I.left,Z||V?I.top+e:I.bottom],[I.right,Z?V?I.top+e:I.bottom:I.top+e]];return[De,qe,...oe]}case"left":{const De=[ye+e+1,x?ge+e/2:H?ge+e*4:ge-e*4],qe=[ye+e+1,x?ge-e/2:H?ge+e*4:ge-e*4];return[...[[H||x?I.right-e:I.left,I.top],[H?x?I.right-e:I.left:I.right-e,I.bottom]],De,qe]}case"right":{const De=[ye-e,x?ge+e/2:H?ge+e*4:ge-e*4],qe=[ye-e,x?ge-e/2:H?ge+e*4:ge-e*4],oe=[[H||x?I.left+e:I.right,I.top],[H?x?I.left+e:I.right:I.left+e,I.bottom]];return[De,qe,...oe]}}}if(!Zy([A,O],te)){if(s&&!D)return R();if(!N&&r){const Ne=u(v.clientX,v.clientY);if(Ne!==null&&Ne<.1)return R()}Zy([A,O],le([f,h]))?!s&&r&&(i.current=window.setTimeout(R,40)):R()}}};return c.__options={blockPointerEvents:n},c}function uX(t,e=n=>n){return QA.useSyncExternalStoreWithSelector(t.subscribe,()=>t.state,()=>t.state,e,sj)}function sj(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,i]of t)if(!e.has(r)||!Object.is(i,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}if(t instanceof Date&&e instanceof Date)return t.getTime()===e.getTime();const n=Jy(t);if(n.length!==Jy(e).length)return!1;for(let r=0;r<n.length;r++)if(!Object.prototype.hasOwnProperty.call(e,n[r])||!Object.is(t[n[r]],e[n[r]]))return!1;return!0}function Jy(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}var Vf,eE;function oj(){return eE||(eE=1,Vf=function t(e,n){if(e===n)return!0;if(e&&n&&typeof e=="object"&&typeof n=="object"){if(e.constructor!==n.constructor)return!1;var r,i,s;if(Array.isArray(e)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!t(e[i],n[i]))return!1;return!0}if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;for(i of e.entries())if(!t(i[1],n.get(i[0])))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(i of e.entries())if(!n.has(i[0]))return!1;return!0}if(ArrayBuffer.isView(e)&&ArrayBuffer.isView(n)){if(r=e.length,r!=n.length)return!1;for(i=r;i--!==0;)if(e[i]!==n[i])return!1;return!0}if(e.constructor===RegExp)return e.source===n.source&&e.flags===n.flags;if(e.valueOf!==Object.prototype.valueOf)return e.valueOf()===n.valueOf();if(e.toString!==Object.prototype.toString)return e.toString()===n.toString();if(s=Object.keys(e),r=s.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,s[i]))return!1;for(i=r;i--!==0;){var o=s[i];if(!(o==="_owner"&&e.$$typeof)&&!t(e[o],n[o]))return!1}return!0}return e!==e&&n!==n}),Vf}var aj=oj();const cX=Sp(aj);var Ik={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},tE=wt.createContext&&wt.createContext(Ik),lj=["attr","size","title"];function uj(t,e){if(t==null)return{};var n,r,i=cj(t,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);for(r=0;r<s.length;r++)n=s[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function cj(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function mc(){return mc=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},mc.apply(null,arguments)}function nE(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function gc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?nE(Object(n),!0).forEach(function(r){dj(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):nE(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function dj(t,e,n){return(e=fj(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function fj(t){var e=hj(t,"string");return typeof e=="symbol"?e:e+""}function hj(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Rk(t){return t&&t.map((e,n)=>wt.createElement(e.tag,gc({key:n},e.attr),Rk(e.child)))}function ce(t){return e=>wt.createElement(pj,mc({attr:gc({},t.attr)},e),Rk(t.child))}function pj(t){var e=n=>{var{attr:r,size:i,title:s}=t,o=uj(t,lj),a=i||n.size||"1em",l;return n.className&&(l=n.className),t.className&&(l=(l?l+" ":"")+t.className),wt.createElement("svg",mc({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,o,{className:l,style:gc(gc({color:t.color||n.color},n.style),t.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&wt.createElement("title",null,s),t.children)};return tE!==void 0?wt.createElement(tE.Consumer,null,n=>e(n)):e(Ik)}function dX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 16.4183 7.58172 20 12 20ZM8 13H16C16 15.2091 14.2091 17 12 17C9.79086 17 8 15.2091 8 13ZM8 11C7.17157 11 6.5 10.3284 6.5 9.5C6.5 8.67157 7.17157 8 8 8C8.82843 8 9.5 8.67157 9.5 9.5C9.5 10.3284 8.82843 11 8 11ZM16 11C15.1716 11 14.5 10.3284 14.5 9.5C14.5 8.67157 15.1716 8 16 8C16.8284 8 17.5 8.67157 17.5 9.5C17.5 10.3284 16.8284 11 16 11Z"},child:[]}]})(t)}function fX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22ZM8 13C8 15.2091 9.79086 17 12 17C14.2091 17 16 15.2091 16 13H8ZM8 11C8.82843 11 9.5 10.3284 9.5 9.5C9.5 8.67157 8.82843 8 8 8C7.17157 8 6.5 8.67157 6.5 9.5C6.5 10.3284 7.17157 11 8 11ZM16 11C16.8284 11 17.5 10.3284 17.5 9.5C17.5 8.67157 16.8284 8 16 8C15.1716 8 14.5 8.67157 14.5 9.5C14.5 10.3284 15.1716 11 16 11Z"},child:[]}]})(t)}function hX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11V13H19V11H5Z"},child:[]}]})(t)}function pX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 10C3.9 10 3 10.9 3 12C3 13.1 3.9 14 5 14C6.1 14 7 13.1 7 12C7 10.9 6.1 10 5 10ZM19 10C17.9 10 17 10.9 17 12C17 13.1 17.9 14 19 14C20.1 14 21 13.1 21 12C21 10.9 20.1 10 19 10ZM12 10C10.9 10 10 10.9 10 12C10 13.1 10.9 14 12 14C13.1 14 14 13.1 14 12C14 10.9 13.1 10 12 10Z"},child:[]}]})(t)}function mX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M10 6V8H5V19H16V14H18V20C18 20.5523 17.5523 21 17 21H4C3.44772 21 3 20.5523 3 20V7C3 6.44772 3.44772 6 4 6H10ZM21 3V12L17.206 8.207L11.2071 14.2071L9.79289 12.7929L15.792 6.793L12 3H21Z"},child:[]}]})(t)}function gX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 19H20V12H22V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V12H4V19ZM14 9H19L12 16L5 9H10V3H14V9Z"},child:[]}]})(t)}function bX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM9 11V17H11V11H9ZM13 11V17H15V11H13ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function yX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 6H22V8H20V21C20 21.5523 19.5523 22 19 22H5C4.44772 22 4 21.5523 4 21V8H2V6H7V3C7 2.44772 7.44772 2 8 2H16C16.5523 2 17 2.44772 17 3V6ZM18 8H6V20H18V8ZM9 4V6H15V4H9Z"},child:[]}]})(t)}function EX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M9.9997 15.1709L19.1921 5.97852L20.6063 7.39273L9.9997 17.9993L3.63574 11.6354L5.04996 10.2212L9.9997 15.1709Z"},child:[]}]})(t)}function TX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M11 11V5H13V11H19V13H13V19H11V13H5V11H11Z"},child:[]}]})(t)}function CX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 16.0001H5.88889L11.1834 20.3319C11.2727 20.405 11.3846 20.4449 11.5 20.4449C11.7761 20.4449 12 20.2211 12 19.9449V4.05519C12 3.93977 11.9601 3.8279 11.887 3.73857C11.7121 3.52485 11.3971 3.49335 11.1834 3.66821L5.88889 8.00007H2C1.44772 8.00007 1 8.44778 1 9.00007V15.0001C1 15.5524 1.44772 16.0001 2 16.0001ZM23 12C23 15.292 21.5539 18.2463 19.2622 20.2622L17.8445 18.8444C19.7758 17.1937 21 14.7398 21 12C21 9.26016 19.7758 6.80629 17.8445 5.15557L19.2622 3.73779C21.5539 5.75368 23 8.70795 23 12ZM18 12C18 10.0883 17.106 8.38548 15.7133 7.28673L14.2842 8.71584C15.3213 9.43855 16 10.64 16 12C16 13.36 15.3213 14.5614 14.2842 15.2841L15.7133 16.7132C17.106 15.6145 18 13.9116 18 12Z"},child:[]}]})(t)}function xX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 18V20H2V18H22ZM2 3.5L10 8.5L2 13.5V3.5ZM22 11V13H12V11H22ZM22 4V6H12V4H22Z"},child:[]}]})(t)}function SX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V5.757L19 7.757V5H5V13.1L9 9.1005L13.328 13.429L12.0012 14.7562L11.995 18.995L16.2414 19.0012L17.571 17.671L18.8995 19H19V16.242L21 14.242V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM21.7782 7.80761L23.1924 9.22183L15.4142 17L13.9979 16.9979L14 15.5858L21.7782 7.80761ZM15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7Z"},child:[]}]})(t)}function wX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 15V18H24V20H21V23H19V20H16V18H19V15H21ZM21.0082 3C21.556 3 22 3.44495 22 3.9934L22.0007 13.3417C21.3749 13.1204 20.7015 13 20 13V5H4L4.001 19L13.2929 9.70715C13.6528 9.34604 14.22 9.31823 14.6123 9.62322L14.7065 9.70772L18.2521 13.2586C15.791 14.0069 14 16.2943 14 19C14 19.7015 14.1204 20.3749 14.3417 21.0007L2.9918 21C2.44405 21 2 20.5551 2 20.0066V3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082ZM8 7C9.10457 7 10 7.89543 10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9C6 7.89543 6.89543 7 8 7Z"},child:[]}]})(t)}function kX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5 11.1005L7 9.1005L12.5 14.6005L16 11.1005L19 14.1005V5H5V11.1005ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3ZM15.5 10C14.6716 10 14 9.32843 14 8.5C14 7.67157 14.6716 7 15.5 7C16.3284 7 17 7.67157 17 8.5C17 9.32843 16.3284 10 15.5 10Z"},child:[]}]})(t)}function AX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2 3.9934C2 3.44476 2.45531 3 2.9918 3H21.0082C21.556 3 22 3.44495 22 3.9934V20.0066C22 20.5552 21.5447 21 21.0082 21H2.9918C2.44405 21 2 20.5551 2 20.0066V3.9934ZM8 5V19H16V5H8ZM4 5V7H6V5H4ZM18 5V7H20V5H18ZM4 9V11H6V9H4ZM18 9V11H20V9H18ZM4 13V15H6V13H4ZM18 13V15H20V13H18ZM4 17V19H6V17H4ZM18 17V19H20V17H18Z"},child:[]}]})(t)}function vX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 3V12C8 14.2091 9.79086 16 12 16C14.2091 16 16 14.2091 16 12V3H18V12C18 15.3137 15.3137 18 12 18C8.68629 18 6 15.3137 6 12V3H8ZM4 20H20V22H4V20Z"},child:[]}]})(t)}function NX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 6V21H11V6H5V4H19V6H13Z"},child:[]}]})(t)}function _X(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 10V14H19V10H13ZM11 10H5V14H11V10ZM13 19H19V16H13V19ZM11 19V16H5V19H11ZM13 5V8H19V5H13ZM11 5H5V8H11V5ZM4 3H20C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3Z"},child:[]}]})(t)}function IX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17.1538 14C17.3846 14.5161 17.5 15.0893 17.5 15.7196C17.5 17.0625 16.9762 18.1116 15.9286 18.867C14.8809 19.6223 13.4335 20 11.5862 20C9.94674 20 8.32335 19.6185 6.71592 18.8555V16.6009C8.23538 17.4783 9.7908 17.917 11.3822 17.917C13.9333 17.917 15.2128 17.1846 15.2208 15.7196C15.2208 15.0939 15.0049 14.5598 14.5731 14.1173C14.5339 14.0772 14.4939 14.0381 14.4531 14H3V12H21V14H17.1538ZM13.076 11H7.62908C7.4566 10.8433 7.29616 10.6692 7.14776 10.4778C6.71592 9.92084 6.5 9.24559 6.5 8.45207C6.5 7.21602 6.96583 6.165 7.89749 5.299C8.82916 4.43299 10.2706 4 12.2219 4C13.6934 4 15.1009 4.32808 16.4444 4.98426V7.13591C15.2448 6.44921 13.9293 6.10587 12.4978 6.10587C10.0187 6.10587 8.77917 6.88793 8.77917 8.45207C8.77917 8.87172 8.99709 9.23796 9.43293 9.55079C9.86878 9.86362 10.4066 10.1135 11.0463 10.3004C11.6665 10.4816 12.3431 10.7148 13.076 11H13.076Z"},child:[]}]})(t)}function RX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 4H3V6H21V4ZM21 11H8V13H21V11ZM21 18H8V20H21V18ZM5 11H3V20H5V11Z"},child:[]}]})(t)}function MX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21 20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20C20.5523 3 21 3.44772 21 4V20ZM19 11V5H13.001V7H15L12 10L9 7H11V5H5V11H7V13H5V19H11V17H9L12 14L15 17H13.001V19H19V13H17V11H19ZM11 13H9V11H11V13ZM15 13H13V11H15V13Z"},child:[]}]})(t)}function OX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M20 3C20.5523 3 21 3.44772 21 4V20C21 20.5523 20.5523 21 20 21H4C3.44772 21 3 20.5523 3 20V4C3 3.44772 3.44772 3 4 3H20ZM11 5H5V10.999H7V9L10 12L7 15V13H5V19H11V17H13V19H19V13H17V15L14 12L17 9V10.999H19V5H13V7H11V5ZM13 13V15H11V13H13ZM13 9V11H11V9H13Z"},child:[]}]})(t)}function DX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM4.5 6.5C3.67157 6.5 3 5.82843 3 5C3 4.17157 3.67157 3.5 4.5 3.5C5.32843 3.5 6 4.17157 6 5C6 5.82843 5.32843 6.5 4.5 6.5ZM4.5 13.5C3.67157 13.5 3 12.8284 3 12C3 11.1716 3.67157 10.5 4.5 10.5C5.32843 10.5 6 11.1716 6 12C6 12.8284 5.32843 13.5 4.5 13.5ZM4.5 20.4C3.67157 20.4 3 19.7284 3 18.9C3 18.0716 3.67157 17.4 4.5 17.4C5.32843 17.4 6 18.0716 6 18.9C6 19.7284 5.32843 20.4 4.5 20.4ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function LX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 4H21V6H8V4ZM5 3V6H6V7H3V6H4V4H3V3H5ZM3 14V11.5H5V11H3V10H6V12.5H4V13H6V14H3ZM5 19.5H3V18.5H5V18H3V17H6V21H3V20H5V19.5ZM8 11H21V13H8V11ZM8 18H21V20H8V18Z"},child:[]}]})(t)}function PX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8.00008 6V9H5.00008V6H8.00008ZM3.00008 4V11H10.0001V4H3.00008ZM13.0001 4H21.0001V6H13.0001V4ZM13.0001 11H21.0001V13H13.0001V11ZM13.0001 18H21.0001V20H13.0001V18ZM10.7072 16.2071L9.29297 14.7929L6.00008 18.0858L4.20718 16.2929L2.79297 17.7071L6.00008 20.9142L10.7072 16.2071Z"},child:[]}]})(t)}function BX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M18.3638 15.5355L16.9496 14.1213L18.3638 12.7071C20.3164 10.7545 20.3164 7.58866 18.3638 5.63604C16.4112 3.68341 13.2453 3.68341 11.2927 5.63604L9.87849 7.05025L8.46428 5.63604L9.87849 4.22182C12.6122 1.48815 17.0443 1.48815 19.778 4.22182C22.5117 6.95549 22.5117 11.3876 19.778 14.1213L18.3638 15.5355ZM15.5353 18.364L14.1211 19.7782C11.3875 22.5118 6.95531 22.5118 4.22164 19.7782C1.48797 17.0445 1.48797 12.6123 4.22164 9.87868L5.63585 8.46446L7.05007 9.87868L5.63585 11.2929C3.68323 13.2455 3.68323 16.4113 5.63585 18.364C7.58847 20.3166 10.7543 20.3166 12.7069 18.364L14.1211 16.9497L15.5353 18.364ZM14.8282 7.75736L16.2425 9.17157L9.17139 16.2426L7.75717 14.8284L14.8282 7.75736Z"},child:[]}]})(t)}function FX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M17 17H22V19H19V22H17V17ZM7 7H2V5H5V2H7V7ZM18.364 15.5355L16.9497 14.1213L18.364 12.7071C20.3166 10.7545 20.3166 7.58866 18.364 5.63604C16.4113 3.68342 13.2455 3.68342 11.2929 5.63604L9.87868 7.05025L8.46447 5.63604L9.87868 4.22183C12.6123 1.48816 17.0445 1.48816 19.7782 4.22183C22.5118 6.9555 22.5118 11.3877 19.7782 14.1213L18.364 15.5355ZM15.5355 18.364L14.1213 19.7782C11.3877 22.5118 6.9555 22.5118 4.22183 19.7782C1.48816 17.0445 1.48816 12.6123 4.22183 9.87868L5.63604 8.46447L7.05025 9.87868L5.63604 11.2929C3.68342 13.2455 3.68342 16.4113 5.63604 18.364C7.58866 20.3166 10.7545 20.3166 12.7071 18.364L14.1213 16.9497L15.5355 18.364ZM14.8284 7.75736L16.2426 9.17157L9.17157 16.2426L7.75736 14.8284L14.8284 7.75736Z"},child:[]}]})(t)}function HX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M15 20H7V18H9.92661L12.0425 6H9V4H17V6H14.0734L11.9575 18H15V20Z"},child:[]}]})(t)}function UX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 5H11V19H8V21H16V19H13V5H16V3H8V5ZM2 7C1.44772 7 1 7.44772 1 8V16C1 16.5523 1.44772 17 2 17H8V15H3V9H8V7H2ZM16 9H21V15H16V17H22C22.5523 17 23 16.5523 23 16V8C23 7.44772 22.5523 7 22 7H16V9Z"},child:[]}]})(t)}function $X(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM7 12.5L3 16V9L7 12.5Z"},child:[]}]})(t)}function VX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM11 14H21V16H11V14ZM11 9H21V11H11V9ZM3 12.5L7 9V16L3 12.5Z"},child:[]}]})(t)}function zX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M21.097 8L18.499 12.5C20.7091 12.5 22.5 14.2909 22.5 16.5C22.5 18.7091 20.7091 20.5 18.5 20.5C16.2909 20.5 14.5 18.7091 14.5 16.5C14.5 15.7636 14.699 15.0737 15.0461 14.4811L18.788 8H21.097ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 14.5C17.3954 14.5 16.5 15.3954 16.5 16.5C16.5 17.6046 17.3954 18.5 18.5 18.5C19.6046 18.5 20.5 17.6046 20.5 16.5C20.5 15.3954 19.6046 14.5 18.5 14.5Z"},child:[]}]})(t)}function jX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8V10H17.6769L17.2126 12.6358C17.5435 12.5472 17.8912 12.5 18.25 12.5C20.4591 12.5 22.25 14.2909 22.25 16.5C22.25 18.7091 20.4591 20.5 18.25 20.5C16.4233 20.5 14.8827 19.2756 14.4039 17.6027L16.3271 17.0519C16.5667 17.8881 17.3369 18.5 18.25 18.5C19.3546 18.5 20.25 17.6046 20.25 16.5C20.25 15.3954 19.3546 14.5 18.25 14.5C17.6194 14.5 17.057 14.7918 16.6904 15.2478L14.8803 14.3439L16 8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function WX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM22 8V16H23.5V18H22V20H20V18H14.5V16.66L19.5 8H22ZM20 11.133L17.19 16H20V11.133Z"},child:[]}]})(t)}function qX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M22 8L21.9984 10L19.4934 12.883C21.0823 13.3184 22.25 14.7728 22.25 16.5C22.25 18.5711 20.5711 20.25 18.5 20.25C16.674 20.25 15.1528 18.9449 14.8184 17.2166L16.7821 16.8352C16.9384 17.6413 17.6481 18.25 18.5 18.25C19.4665 18.25 20.25 17.4665 20.25 16.5C20.25 15.5335 19.4665 14.75 18.5 14.75C18.214 14.75 17.944 14.8186 17.7056 14.9403L16.3992 13.3932L19.3484 10H15V8H22ZM4 4V11H11V4H13V20H11V13H4V20H2V4H4Z"},child:[]}]})(t)}function YX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M4 4V11H11V4H13V20H11V13H4V20H2V4H4ZM18.5 8C20.5711 8 22.25 9.67893 22.25 11.75C22.25 12.6074 21.9623 13.3976 21.4781 14.0292L21.3302 14.2102L18.0343 18H22V20H15L14.9993 18.444L19.8207 12.8981C20.0881 12.5908 20.25 12.1893 20.25 11.75C20.25 10.7835 19.4665 10 18.5 10C17.5818 10 16.8288 10.7071 16.7558 11.6065L16.75 11.75H14.75C14.75 9.67893 16.4289 8 18.5 8Z"},child:[]}]})(t)}function KX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M13 20H11V13H4V20H2V4H4V11H11V4H13V20ZM21.0005 8V20H19.0005L19 10.204L17 10.74V8.67L19.5005 8H21.0005Z"},child:[]}]})(t)}function GX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M5.55397 22H3.3999L10.9999 3H12.9999L20.5999 22H18.4458L16.0458 16H7.95397L5.55397 22ZM8.75397 14H15.2458L11.9999 5.88517L8.75397 14Z"},child:[]}]})(t)}function XX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3.41436 5.99995L5.70726 3.70706L4.29304 2.29285L0.585938 5.99995L4.29304 9.70706L5.70726 8.29285L3.41436 5.99995ZM9.58594 5.99995L7.29304 3.70706L8.70726 2.29285L12.4144 5.99995L8.70726 9.70706L7.29304 8.29285L9.58594 5.99995ZM14.0002 2.99995H21.0002C21.5524 2.99995 22.0002 3.44767 22.0002 3.99995V20C22.0002 20.5522 21.5524 21 21.0002 21H3.00015C2.44787 21 2.00015 20.5522 2.00015 20V12H4.00015V19H20.0002V4.99995H14.0002V2.99995Z"},child:[]}]})(t)}function QX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 11H12.5C13.8807 11 15 9.88071 15 8.5C15 7.11929 13.8807 6 12.5 6H8V11ZM18 15.5C18 17.9853 15.9853 20 13.5 20H6V4H12.5C14.9853 4 17 6.01472 17 8.5C17 9.70431 16.5269 10.7981 15.7564 11.6058C17.0979 12.3847 18 13.837 18 15.5ZM8 13V18H13.5C14.8807 18 16 16.8807 16 15.5C16 14.1193 14.8807 13 13.5 13H8Z"},child:[]}]})(t)}function ZX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM7 19H21V21H7V19ZM3 14H21V16H3V14ZM7 9H21V11H7V9Z"},child:[]}]})(t)}function JX(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H17V21H3V19ZM3 14H21V16H3V14ZM3 9H17V11H3V9Z"},child:[]}]})(t)}function eQ(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM3 19H21V21H3V19ZM3 14H21V16H3V14ZM3 9H21V11H3V9Z"},child:[]}]})(t)}function tQ(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 4H21V6H3V4ZM5 19H19V21H5V19ZM3 14H21V16H3V14ZM5 9H19V11H5V9Z"},child:[]}]})(t)}function nQ(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M23 12L15.9289 19.0711L14.5147 17.6569L20.1716 12L14.5147 6.34317L15.9289 4.92896L23 12ZM3.82843 12L9.48528 17.6569L8.07107 19.0711L1 12L8.07107 4.92896L9.48528 6.34317L3.82843 12Z"},child:[]}]})(t)}function rQ(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M3 8L9.00319 2H19.9978C20.5513 2 21 2.45531 21 2.9918V21.0082C21 21.556 20.5551 22 20.0066 22H3.9934C3.44476 22 3 21.5501 3 20.9932V8ZM10 4V9H5V20H19V4H10Z"},child:[]}]})(t)}function iQ(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.29117 20.8242L2 22L3.17581 16.7088C2.42544 15.3056 2 13.7025 2 12C2 6.47715 6.47715 2 12 2C17.5228 2 22 6.47715 22 12C22 17.5228 17.5228 22 12 22C10.2975 22 8.6944 21.5746 7.29117 20.8242ZM7.58075 18.711L8.23428 19.0605C9.38248 19.6745 10.6655 20 12 20C16.4183 20 20 16.4183 20 12C20 7.58172 16.4183 4 12 4C7.58172 4 4 7.58172 4 12C4 13.3345 4.32549 14.6175 4.93949 15.7657L5.28896 16.4192L4.63416 19.3658L7.58075 18.711Z"},child:[]}]})(t)}function sQ(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M7.24264 17.9967H3V13.754L14.435 2.319C14.8256 1.92848 15.4587 1.92848 15.8492 2.319L18.6777 5.14743C19.0682 5.53795 19.0682 6.17112 18.6777 6.56164L7.24264 17.9967ZM3 19.9967H21V21.9967H3V19.9967Z"},child:[]}]})(t)}function oQ(t){return ce({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M8 7V11L2 6L8 1V5H13C17.4183 5 21 8.58172 21 13C21 17.4183 17.4183 21 13 21H4V19H13C16.3137 19 19 16.3137 19 13C19 9.68629 16.3137 7 13 7H8Z"},child:[]}]})(t)}function aQ(t){return ce({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M482 152h60q8 0 8 8v704q0 8-8 8h-60q-8 0-8-8V160q0-8 8-8Z"},child:[]},{tag:"path",attr:{d:"M192 474h672q8 0 8 8v60q0 8-8 8H160q-8 0-8-8v-60q0-8 8-8Z"},child:[]}]})(t)}function lQ(t){return ce({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0z"},child:[]},{tag:"path",attr:{d:"m7 10 5 5 5-5z"},child:[]}]})(t)}function uQ(t){return ce({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"},child:[]}]})(t)}var mj=ZA();const gj=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},bj=({contentComponent:t})=>{const e=mj.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return M.jsx(M.Fragment,{children:Object.values(e)})};function yj(){const t=new Set;let e={},n=!1;const r=()=>{n||!t.size||(n=!0,queueMicrotask(()=>{n=!1,t.forEach(i=>i())}))};return{subscribe(i){return t.add(i),()=>{t.delete(i)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(i,s){e={...e,[i]:BE.createPortal(s.reactElement,s.element,i)},r()},removeRenderer(i){const s={...e};delete s[i],e=s,r()}}}var Ej=class extends wt.Component{constructor(t){super(t),this.editorContentRef=wt.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&(!((t=e.view.dom)===null||t===void 0)&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=yj(),e.createNodeViews(),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){const t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{var e;if(!(!((e=t.view.dom)===null||e===void 0)&&e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:gj(e,this.editorContentRef),...n}),t?.contentComponent&&M.jsx(bj,{contentComponent:t.contentComponent})]})}};const Tj=C.forwardRef((t,e)=>{const n=wt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return wt.createElement(Ej,{key:n,innerRef:e,...t})}),Cj=wt.memo(Tj),Mk=C.createContext({editor:null});Mk.Consumer;const Ok=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),xj=()=>C.useContext(Ok),cQ=wt.forwardRef((t,e)=>{const{onDragStart:n}=xj(),r=t.as||"div";return M.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function rE(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function iE(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function Sj(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function wj(t){if(rE(t)||iE(t))return!0;if(Sj(t)){const e=t.type;if(e)return rE(e)||iE(e)}return!1}function kj(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var Aj=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isEditorContentInitialized?Ka.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=kj(),s=wj(e),o={...n};o.ref&&!(i||s)&&delete o.ref,!o.ref&&(i||s)&&(o.ref=a=>{this.ref=a}),this.reactElement=M.jsx(e,{...o}),r==null||(t=r.contentComponent)===null||t===void 0||t.setRenderer(this.id,this)}updateProps(t={}){if(this.destroyed)return;let e=!1;const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const i=n[r];if(t[i]!==this.props[i]){e=!0;break}}e&&(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;e==null||(t=e.contentComponent)===null||t===void 0||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};wt.createContext({markViewContentRef:()=>{}});function vj(t){var e;const n=t.getRootNode(),r=typeof n.getSelection=="function"?n.getSelection():(e=t.ownerDocument)===null||e===void 0||(e=e.defaultView)===null||e===void 0?void 0:e.getSelection();if(!r||r.rangeCount===0)return null;const{anchorNode:i,anchorOffset:s,focusNode:o,focusOffset:a}=r;return!i||!o||!t.contains(i)||!t.contains(o)?null:()=>{try{r.setBaseAndExtent(i,s,o,a)}catch{}}}function Nj(t,e,n){return t.node(n)===e.node(n)&&t.before(n)===e.before(n)}function Dk(t){if(!Wp(t))return[];const{$from:e,$to:n}=t,r=[],i=Math.min(e.depth,n.depth);for(let s=1;s<=i&&Nj(e,n,s);s+=1)r.push(e.before(s));return r}var _j=class{constructor(t){this.views=new WeakMap,this.viewCount=0,this.insideViews=new Set,this.syncQueued=!1,this.scheduleSync=()=>{this.syncQueued||(this.syncQueued=!0,queueMicrotask(()=>{this.syncQueued=!1,this.sync()}))},this.handleTransaction=()=>this.scheduleSync(),this.editor=t}register(t){this.viewCount===0&&this.editor.on("transaction",this.handleTransaction),this.views.set(t.dom,t),this.viewCount+=1,this.scheduleSync()}unregister(t){this.views.delete(t.dom),this.viewCount-=1,this.insideViews.delete(t),this.viewCount===0&&this.editor.off("transaction",this.handleTransaction)}sync(){if(this.viewCount===0||this.editor.isDestroyed)return;const t=this.findInsideViews();this.updateViews(this.insideViews,t,!1),this.updateViews(t,this.insideViews,!0),this.insideViews=t}updateViews(t,e,n){for(const r of t)e.has(r)||r.setSelectionInside(n)}findInsideViews(){const t=new Set;for(const e of Dk(this.editor.state.selection)){const n=this.editor.view.nodeDOM(e),r=n?this.views.get(n):void 0;r&&t.add(r)}return t}};const sE=new WeakMap;function oE(t){let e=sE.get(t);return e||(e=new _j(t),sE.set(t,e)),e}var Ij=class extends bR{constructor(t,e,n){if(super(t,e,n),this.nodeSelected=!1,this.handlePositionUpdate=()=>{const r=this.getPos();typeof r!="number"||r===this.currentPos||(this.currentPos=r,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs=="function"&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");r?r.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on("update",this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){if(r==="storage"){var s;return(s=t.storage[e.name])!==null&&s!==void 0?s:{}}return Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,selectionInside:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const l=u=>u.charAt(0).toUpperCase()+u.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{if(l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement){l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper");const u=vj(this.contentDOMElement);l.appendChild(this.contentDOMElement),u?.()}}},i=this.component,s=C.memo(l=>M.jsx(Ok.Provider,{value:r,children:C.createElement(i,l)}));s.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.renderer=new Aj(s,{editor:this.editor,props:t,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),oE(this.editor).register(this),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){var t;if(this.renderer.element.firstElementChild&&!(!((t=this.renderer.element.firstElementChild)===null||t===void 0)&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(t,e,n){const r=o=>{this.renderer.updateProps(o),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const o=this.node,a=this.decorations,l=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:o,oldDecorations:a,newNode:t,newDecorations:e,oldInnerDecorations:l,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(t===this.node)return this.node=t,this.decorations=e,this.innerDecorations=n,!0;const i=this.getPos();this.node=t,this.decorations=e,this.innerDecorations=n,this.currentPos=i;const s={node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(s.getPos=()=>this.getPos()),r(s),!0}selectNode(){this.nodeSelected=!0,this.updateSelectedState(!0)}deselectNode(){this.nodeSelected=!1,this.updateSelectedState(this.options.selectedOnTextSelection===!0&&this.isTextSelectionInside())}setSelectionInside(t){const e=this.nodeSelected||this.options.selectedOnTextSelection===!0&&t;this.renderer.updateProps({selectionInside:t,selected:e}),this.renderer.element.classList.toggle("ProseMirror-selectednode",e)}updateSelectedState(t){this.renderer.updateProps({selected:t}),this.renderer.element.classList.toggle("ProseMirror-selectednode",t)}isTextSelectionInside(){const t=this.getPos();return typeof t=="number"&&Dk(this.editor.state.selection).includes(t)}destroy(){this.renderer.destroy(),oE(this.editor).unregister(this),this.options.trackNodeViewPosition&&this.editor.off("update",this.handlePositionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=va(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function dQ(t,e){return n=>n.editor.contentComponent?new Ij(t,n,e):{dom:document.createElement("span"),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}const s0=C.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});s0.displayName="TiptapContext";const Rj=()=>C.useContext(s0);function Lk({children:t,...e}){const n="editor"in e?e.editor:e.instance;if(!n)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const r=C.useMemo(()=>({editor:n}),[n]),i=C.useMemo(()=>({editor:n}),[n]);return M.jsx(Mk.Provider,{value:i,children:M.jsx(s0.Provider,{value:r,children:t})})}Lk.displayName="Tiptap";function Pk({...t}){const{editor:e}=Rj();return M.jsx(Cj,{editor:e,...t})}Pk.displayName="Tiptap.Content";Object.assign(Lk,{Content:Pk});function lr(t){return Object.keys(t)}function zf(t){return t&&typeof t=="object"&&!Array.isArray(t)}function o0(t,e){const n={...t},r=e;return zf(t)&&zf(e)&&Object.keys(e).forEach(i=>{zf(r[i])&&i in t?n[i]=o0(n[i],r[i]):n[i]=r[i]}),n}function Mj(t){return t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}function Oj(t){return typeof t!="string"||!t.includes("var(--mantine-scale)")?t:t.match(/^calc\((.*?)\)$/)?.[1].split("*")[0].trim()}function Dj(t){const e=Oj(t);return typeof e=="number"?e:typeof e=="string"?e.includes("calc")||e.includes("var")?e:e.includes("px")?Number(e.replace("px","")):e.includes("rem")?Number(e.replace("rem",""))*16:e.includes("em")?Number(e.replace("em",""))*16:Number(e):NaN}function aE(t){return t==="0rem"?"0rem":`calc(${t} * var(--mantine-scale))`}function Bk(t,{shouldScale:e=!1}={}){function n(r){if(r===0||r==="0")return`0${t}`;if(typeof r=="number"){const i=`${r/16}${t}`;return e?aE(i):i}if(typeof r=="string"){if(r===""||r.startsWith("calc(")||r.startsWith("clamp(")||r.includes("rgba("))return r;if(r.includes(","))return r.split(",").map(s=>n(s)).join(",");if(r.includes(" "))return r.split(" ").map(s=>n(s)).join(" ");const i=r.replace("px","");if(!Number.isNaN(Number(i))){const s=`${Number(i)/16}${t}`;return e?aE(s):s}}return r}return n}const Y=Bk("rem",{shouldScale:!0}),lE=Bk("em");function ud(t){return Object.keys(t).reduce((e,n)=>(t[n]!==void 0&&(e[n]=t[n]),e),{})}function Fk(t){if(typeof t=="number")return!0;if(typeof t=="string"){if(t.startsWith("calc(")||t.startsWith("var(")||t.includes(" ")&&t.trim()!=="")return!0;const e=/^[+-]?[0-9]+(\.[0-9]+)?(px|em|rem|ex|ch|lh|rlh|vw|vh|vmin|vmax|vb|vi|svw|svh|lvw|lvh|dvw|dvh|cm|mm|in|pt|pc|q|cqw|cqh|cqi|cqb|cqmin|cqmax|%)?$/;return t.trim().split(/\s+/).every(r=>e.test(r))}return!1}function Hk(t){return Array.isArray(t)||t===null?!1:typeof t=="object"?t.type!==C.Fragment:!1}function cd(t){const e=C.createContext(null);return[({children:i,value:s})=>M.jsx(e.Provider,{value:s,children:i}),()=>{const i=C.useContext(e);if(i===null)throw new Error(t);return i}]}function dd(t=null){const e=C.createContext(t);return[({children:i,value:s})=>M.jsx(e.Provider,{value:s,children:i}),()=>C.useContext(e)]}function uE(t,e){return n=>{if(typeof n!="string"||n.trim().length===0)throw new Error(e);return`${t}-${n}`}}function bc(t,e){let n=t;for(;(n=n.parentElement)&&!n.matches(e););return n}function Lj(t,e,n){for(let r=t-1;r>=0;r-=1)if(!e[r].disabled)return r;if(n){for(let r=e.length-1;r>-1;r-=1)if(!e[r].disabled)return r}return t}function Pj(t,e,n){for(let r=t+1;r<e.length;r+=1)if(!e[r].disabled)return r;if(n){for(let r=0;r<e.length;r+=1)if(!e[r].disabled)return r}return t}function Bj(t,e,n){return bc(t,n)===bc(e,n)}function a0({parentSelector:t,siblingSelector:e,onKeyDown:n,loop:r=!0,activateOnFocus:i=!1,dir:s="rtl",orientation:o}){return a=>{n?.(a);const l=Array.from(bc(a.currentTarget,t)?.querySelectorAll(e)||[]).filter(p=>Bj(a.currentTarget,p,t)),u=l.findIndex(p=>a.currentTarget===p),c=Pj(u,l,r),d=Lj(u,l,r),f=s==="rtl"?d:c,h=s==="rtl"?c:d;switch(a.key){case"ArrowRight":{o==="horizontal"&&(a.stopPropagation(),a.preventDefault(),l[f].focus(),i&&l[f].click());break}case"ArrowLeft":{o==="horizontal"&&(a.stopPropagation(),a.preventDefault(),l[h].focus(),i&&l[h].click());break}case"ArrowUp":{o==="vertical"&&(a.stopPropagation(),a.preventDefault(),l[d].focus(),i&&l[d].click());break}case"ArrowDown":{o==="vertical"&&(a.stopPropagation(),a.preventDefault(),l[c].focus(),i&&l[c].click());break}case"Home":{a.stopPropagation(),a.preventDefault(),!l[0].disabled&&l[0].focus();break}case"End":{a.stopPropagation(),a.preventDefault();const p=l.length-1;!l[p].disabled&&l[p].focus();break}}}}const Fj={app:100,modal:200,popover:300,overlay:400,max:9999};function gl(t){return Fj[t]}const Hj=()=>{};function Uj(t,e={active:!0}){return typeof t!="function"||!e.active?e.onKeyDown||Hj:n=>{n.key==="Escape"&&(t(n),e.onTrigger?.())}}function je(t,e="size",n=!0){if(t!==void 0)return Fk(t)?n?Y(t):t:`var(--${e}-${t})`}function bl(t){return je(t,"mantine-spacing")}function Dt(t){return t===void 0?"var(--mantine-radius-default)":je(t,"mantine-radius")}function rn(t){return je(t,"mantine-font-size")}function $j(t){return je(t,"mantine-line-height",!1)}function Uk(t){if(t)return je(t,"mantine-shadow",!1)}function en(t,e){return n=>{t?.(n),e?.(n)}}function Vj(t,e,n){return n?Array.from(bc(n,e)?.querySelectorAll(t)||[]).findIndex(r=>r===n):null}function zj(t="mantine-"){return`${t}${Math.random().toString(36).slice(2,11)}`}function cE(t){const e=C.useRef(t);return C.useEffect(()=>{e.current=t}),C.useMemo(()=>((...n)=>e.current?.(...n)),[])}const jj=["mousedown","touchstart"];function Wj(t,e,n){const r=C.useRef(null),i=e||jj;return C.useEffect(()=>{const s=o=>{const{target:a}=o??{};if(Array.isArray(n)){const l=!document.body.contains(a)&&a?.tagName!=="HTML";n.every(c=>!!c&&!o.composedPath().includes(c))&&!l&&t(o)}else r.current&&!r.current.contains(a)&&t(o)};return i.forEach(o=>document.addEventListener(o,s)),()=>{i.forEach(o=>document.removeEventListener(o,s))}},[r,t,n]),r}function qj(t,e){try{return t.addEventListener("change",e),()=>t.removeEventListener("change",e)}catch{return t.addListener(e),()=>t.removeListener(e)}}function Yj(t,e){return typeof window<"u"&&"matchMedia"in window?window.matchMedia(t).matches:!1}function Kj(t,e,{getInitialValueInEffect:n}={getInitialValueInEffect:!0}){const[r,i]=C.useState(n?e:Yj(t));return C.useEffect(()=>{try{const s=window.matchMedia(t);return i(s.matches),qj(s,o=>i(o.matches))}catch{return}},[t]),r||!1}const yl=typeof document<"u"?C.useLayoutEffect:C.useEffect;function ja(t,e){const n=C.useRef(!1);C.useEffect(()=>()=>{n.current=!1},[]),C.useEffect(()=>{if(n.current)return t();n.current=!0},e)}function Gj({opened:t,shouldReturnFocus:e=!0}){const n=C.useRef(null),r=()=>{n.current&&"focus"in n.current&&typeof n.current.focus=="function"&&n.current?.focus({preventScroll:!0})};return ja(()=>{let i=-1;const s=o=>{o.key==="Tab"&&window.clearTimeout(i)};return document.addEventListener("keydown",s),t?n.current=document.activeElement:e&&(i=window.setTimeout(r,10)),()=>{window.clearTimeout(i),document.removeEventListener("keydown",s)}},[t,e]),r}const Xj=/input|select|textarea|button|object/,$k="a, input, select, textarea, button, object, [tabindex]";function Qj(t){return t.style.display==="none"}function Zj(t){if(t.getAttribute("aria-hidden")||t.getAttribute("hidden")||t.getAttribute("type")==="hidden")return!1;let n=t;for(;n&&!(n===document.body||n.nodeType===11);){if(Qj(n))return!1;n=n.parentNode}return!0}function Vk(t){let e=t.getAttribute("tabindex");return e===null&&(e=void 0),parseInt(e,10)}function gp(t){const e=t.nodeName.toLowerCase(),n=!Number.isNaN(Vk(t));return(Xj.test(e)&&!t.disabled||t instanceof HTMLAnchorElement&&t.href||n)&&Zj(t)}function zk(t){const e=Vk(t);return(Number.isNaN(e)||e>=0)&&gp(t)}function Jj(t){return Array.from(t.querySelectorAll($k)).filter(zk)}function eW(t,e){const n=Jj(t);if(!n.length){e.preventDefault();return}const r=n[e.shiftKey?0:n.length-1],i=t.getRootNode();let s=r===i.activeElement||t===i.activeElement;const o=i.activeElement;if(o.tagName==="INPUT"&&o.getAttribute("type")==="radio"&&(s=n.filter(c=>c.getAttribute("type")==="radio"&&c.getAttribute("name")===o.getAttribute("name")).includes(r)),!s)return;e.preventDefault();const l=n[e.shiftKey?n.length-1:0];l&&l.focus()}function tW(t=!0){const e=C.useRef(null),n=i=>{let s=i.querySelector("[data-autofocus]");if(!s){const o=Array.from(i.querySelectorAll($k));s=o.find(zk)||o.find(gp)||null,!s&&gp(i)&&(s=i)}s&&s.focus({preventScroll:!0})},r=C.useCallback(i=>{t&&i!==null&&e.current!==i&&(i?(setTimeout(()=>{i.getRootNode()&&n(i)}),e.current=i):e.current=null)},[t]);return C.useEffect(()=>{if(!t)return;e.current&&setTimeout(()=>n(e.current));const i=s=>{s.key==="Tab"&&e.current&&eW(e.current,s)};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[t]),r}const nW=wt.useId||(()=>{});function rW(){const t=nW();return t?`mantine-${t.replace(/:/g,"")}`:""}function Ao(t){const e=rW(),[n,r]=C.useState(e);return yl(()=>{r(zj())},[]),typeof t=="string"?t:typeof window>"u"?e:n}function yc(t,e){if(typeof t=="function")return t(e);typeof t=="object"&&t!==null&&"current"in t&&(t.current=e)}function iW(...t){const e=new Map;return n=>{if(t.forEach(r=>{const i=yc(r,n);i&&e.set(r,i)}),e.size>0)return()=>{t.forEach(r=>{const i=e.get(r);i&&typeof i=="function"?i():yc(r,null)}),e.clear()}}}function Zn(...t){return C.useCallback(iW(...t),t)}function vo({value:t,defaultValue:e,finalValue:n,onChange:r=()=>{}}){const[i,s]=C.useState(e!==void 0?e:n),o=(a,...l)=>{s(a),r?.(a,...l)};return t!==void 0?[t,r,!0]:[i,o,!1]}function sW(t,e){return Kj("(prefers-reduced-motion: reduce)",t,e)}function fQ(){const[t,e]=C.useState(!1),n=C.useRef(null),r=C.useCallback(()=>{e(!0)},[]),i=C.useCallback(()=>{e(!1)},[]);return{ref:C.useCallback(o=>{n.current&&(n.current.removeEventListener("mouseenter",r),n.current.removeEventListener("mouseleave",i)),o&&(o.addEventListener("mouseenter",r),o.addEventListener("mouseleave",i)),n.current=o},[r,i]),hovered:t}}function oW(t=!1,e={}){const[n,r]=C.useState(t),i=C.useCallback(()=>{r(a=>a||(e.onOpen?.(),!0))},[e.onOpen]),s=C.useCallback(()=>{r(a=>a&&(e.onClose?.(),!1))},[e.onClose]),o=C.useCallback(()=>{n?s():i()},[s,i,n]);return[n,{open:i,close:s,toggle:o}]}function aW(t){return t.currentTarget instanceof HTMLElement&&t.relatedTarget instanceof HTMLElement?t.currentTarget.contains(t.relatedTarget):!1}function hQ({onBlur:t,onFocus:e}={}){const[n,r]=C.useState(!1),i=C.useRef(!1),s=C.useRef(null),o=cE(e),a=cE(t),l=C.useCallback(f=>{r(f),i.current=f},[]),u=C.useCallback(f=>{i.current||(l(!0),o(f))},[]),c=C.useCallback(f=>{i.current&&!aW(f)&&(l(!1),a(f))},[]),d=C.useCallback(f=>{f&&(s.current&&(s.current.removeEventListener("focusin",u),s.current.removeEventListener("focusout",c)),f.addEventListener("focusin",u),f.addEventListener("focusout",c),s.current=f)},[u,c]);return C.useEffect(()=>()=>{s.current&&(s.current.removeEventListener("focusin",u),s.current.removeEventListener("focusout",c))},[]),{ref:d,focused:n}}function l0(t){const e=wt.version;return typeof wt.version!="string"||e.startsWith("18.")?t?.ref:t?.props?.ref}function El(t){const e=C.Children.toArray(t);return e.length!==1||!Hk(e[0])?null:e[0]}const lW={};function uW(t){const e={};return t.forEach(n=>{Object.entries(n).forEach(([r,i])=>{e[r]?e[r]=Br(e[r],i):e[r]=i})}),e}function fd({theme:t,classNames:e,props:n,stylesCtx:r}){const s=(Array.isArray(e)?e:[e]).map(o=>typeof o=="function"?o(t,n,r):o||lW);return uW(s)}function Ec({theme:t,styles:e,props:n,stylesCtx:r}){return(Array.isArray(e)?e:[e]).reduce((s,o)=>typeof o=="function"?{...s,...o(t,n,r)}:{...s,...o},{})}const jk=C.createContext(null);function bi(){const t=C.useContext(jk);if(!t)throw new Error("[@mantine/core] MantineProvider was not found in tree");return t}function cW(){return bi().cssVariablesResolver}function dW(){return bi().classNamesPrefix}function u0(){return bi().getStyleNonce}function fW(){return bi().withStaticClasses}function hW(){return bi().headless}function pW(){return bi().stylesTransform?.sx}function mW(){return bi().stylesTransform?.styles}function hd(){return bi().env||"default"}function gW(t){return/^#?([0-9A-F]{3}){1,2}([0-9A-F]{2})?$/i.test(t)}function bW(t){let e=t.replace("#","");if(e.length===3){const o=e.split("");e=[o[0],o[0],o[1],o[1],o[2],o[2]].join("")}if(e.length===8){const o=parseInt(e.slice(6,8),16)/255;return{r:parseInt(e.slice(0,2),16),g:parseInt(e.slice(2,4),16),b:parseInt(e.slice(4,6),16),a:o}}const n=parseInt(e,16),r=n>>16&255,i=n>>8&255,s=n&255;return{r,g:i,b:s,a:1}}function yW(t){const[e,n,r,i]=t.replace(/[^0-9,./]/g,"").split(/[/,]/).map(Number);return{r:e,g:n,b:r,a:i===void 0?1:i}}function EW(t){const e=/^hsla?\(\s*(\d+)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(,\s*(0?\.\d+|\d+(\.\d+)?))?\s*\)$/i,n=t.match(e);if(!n)return{r:0,g:0,b:0,a:1};const r=parseInt(n[1],10),i=parseInt(n[2],10)/100,s=parseInt(n[3],10)/100,o=n[5]?parseFloat(n[5]):void 0,a=(1-Math.abs(2*s-1))*i,l=r/60,u=a*(1-Math.abs(l%2-1)),c=s-a/2;let d,f,h;return l>=0&&l<1?(d=a,f=u,h=0):l>=1&&l<2?(d=u,f=a,h=0):l>=2&&l<3?(d=0,f=a,h=u):l>=3&&l<4?(d=0,f=u,h=a):l>=4&&l<5?(d=u,f=0,h=a):(d=a,f=0,h=u),{r:Math.round((d+c)*255),g:Math.round((f+c)*255),b:Math.round((h+c)*255),a:o||1}}function c0(t){return gW(t)?bW(t):t.startsWith("rgb")?yW(t):t.startsWith("hsl")?EW(t):{r:0,g:0,b:0,a:1}}function Ql(t,e){if(t.startsWith("var("))return`color-mix(in srgb, ${t}, black ${e*100}%)`;const{r:n,g:r,b:i,a:s}=c0(t),o=1-e,a=l=>Math.round(l*o);return`rgba(${a(n)}, ${a(r)}, ${a(i)}, ${s})`}function Wa(t,e){return typeof t.primaryShade=="number"?t.primaryShade:e==="dark"?t.primaryShade.dark:t.primaryShade.light}function jf(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function TW(t){const e=t.match(/oklch\((.*?)%\s/);return e?parseFloat(e[1]):null}function CW(t){if(t.startsWith("oklch("))return(TW(t)||0)/100;const{r:e,g:n,b:r}=c0(t),i=e/255,s=n/255,o=r/255,a=jf(i),l=jf(s),u=jf(o);return .2126*a+.7152*l+.0722*u}function Wo(t,e=.179){return t.startsWith("var(")?!1:CW(t)>e}function ns({color:t,theme:e,colorScheme:n}){if(typeof t!="string")throw new Error(`[@mantine/core] Failed to parse color. Expected color to be a string, instead got ${typeof t}`);if(t==="bright")return{color:t,value:n==="dark"?e.white:e.black,shade:void 0,isThemeColor:!1,isLight:Wo(n==="dark"?e.white:e.black,e.luminanceThreshold),variable:"--mantine-color-bright"};if(t==="dimmed")return{color:t,value:n==="dark"?e.colors.dark[2]:e.colors.gray[7],shade:void 0,isThemeColor:!1,isLight:Wo(n==="dark"?e.colors.dark[2]:e.colors.gray[6],e.luminanceThreshold),variable:"--mantine-color-dimmed"};if(t==="white"||t==="black")return{color:t,value:t==="white"?e.white:e.black,shade:void 0,isThemeColor:!1,isLight:Wo(t==="white"?e.white:e.black,e.luminanceThreshold),variable:`--mantine-color-${t}`};const[r,i]=t.split("."),s=i?Number(i):void 0,o=r in e.colors;if(o){const a=s!==void 0?e.colors[r][s]:e.colors[r][Wa(e,n||"light")];return{color:r,value:a,shade:s,isThemeColor:o,isLight:Wo(a,e.luminanceThreshold),variable:i?`--mantine-color-${r}-${s}`:`--mantine-color-${r}-filled`}}return{color:t,value:t,isThemeColor:o,isLight:Wo(t,e.luminanceThreshold),shade:s,variable:void 0}}function Pr(t,e){const n=ns({color:t||e.primaryColor,theme:e});return n.variable?`var(${n.variable})`:t}function bp(t,e){const n={from:t?.from||e.defaultGradient.from,to:t?.to||e.defaultGradient.to,deg:t?.deg??e.defaultGradient.deg??0},r=Pr(n.from,e),i=Pr(n.to,e);return`linear-gradient(${n.deg}deg, ${r} 0%, ${i} 100%)`}function nr(t,e){if(typeof t!="string"||e>1||e<0)return"rgba(0, 0, 0, 1)";if(t.startsWith("var(")){const s=(1-e)*100;return`color-mix(in srgb, ${t}, transparent ${s}%)`}if(t.startsWith("oklch"))return t.includes("/")?t.replace(/\/\s*[\d.]+\s*\)/,`/ ${e})`):t.replace(")",` / ${e})`);const{r:n,g:r,b:i}=c0(t);return`rgba(${n}, ${r}, ${i}, ${e})`}const ps=nr,xW=({color:t,theme:e,variant:n,gradient:r,autoContrast:i})=>{const s=ns({color:t,theme:e}),o=typeof i=="boolean"?i:e.autoContrast;if(n==="none")return{background:"transparent",hover:"transparent",color:"inherit",border:"none"};if(n==="filled"){const a=o&&s.isLight?"var(--mantine-color-black)":"var(--mantine-color-white)";return s.isThemeColor?s.shade===void 0?{background:`var(--mantine-color-${t}-filled)`,hover:`var(--mantine-color-${t}-filled-hover)`,color:a,border:`${Y(1)} solid transparent`}:{background:`var(--mantine-color-${s.color}-${s.shade})`,hover:`var(--mantine-color-${s.color}-${s.shade===9?8:s.shade+1})`,color:a,border:`${Y(1)} solid transparent`}:{background:t,hover:Ql(t,.1),color:a,border:`${Y(1)} solid transparent`}}if(n==="light"){if(s.isThemeColor){if(s.shade===void 0)return{background:`var(--mantine-color-${t}-light)`,hover:`var(--mantine-color-${t}-light-hover)`,color:`var(--mantine-color-${t}-light-color)`,border:`${Y(1)} solid transparent`};const a=e.colors[s.color][s.shade];return{background:nr(a,.1),hover:nr(a,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${Y(1)} solid transparent`}}return{background:nr(t,.1),hover:nr(t,.12),color:t,border:`${Y(1)} solid transparent`}}if(n==="outline")return s.isThemeColor?s.shade===void 0?{background:"transparent",hover:`var(--mantine-color-${t}-outline-hover)`,color:`var(--mantine-color-${t}-outline)`,border:`${Y(1)} solid var(--mantine-color-${t}-outline)`}:{background:"transparent",hover:nr(e.colors[s.color][s.shade],.05),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${Y(1)} solid var(--mantine-color-${s.color}-${s.shade})`}:{background:"transparent",hover:nr(t,.05),color:t,border:`${Y(1)} solid ${t}`};if(n==="subtle"){if(s.isThemeColor){if(s.shade===void 0)return{background:"transparent",hover:`var(--mantine-color-${t}-light-hover)`,color:`var(--mantine-color-${t}-light-color)`,border:`${Y(1)} solid transparent`};const a=e.colors[s.color][s.shade];return{background:"transparent",hover:nr(a,.12),color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${Y(1)} solid transparent`}}return{background:"transparent",hover:nr(t,.12),color:t,border:`${Y(1)} solid transparent`}}return n==="transparent"?s.isThemeColor?s.shade===void 0?{background:"transparent",hover:"transparent",color:`var(--mantine-color-${t}-light-color)`,border:`${Y(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:`var(--mantine-color-${s.color}-${Math.min(s.shade,6)})`,border:`${Y(1)} solid transparent`}:{background:"transparent",hover:"transparent",color:t,border:`${Y(1)} solid transparent`}:n==="white"?s.isThemeColor?s.shade===void 0?{background:"var(--mantine-color-white)",hover:Ql(e.white,.01),color:`var(--mantine-color-${t}-filled)`,border:`${Y(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Ql(e.white,.01),color:`var(--mantine-color-${s.color}-${s.shade})`,border:`${Y(1)} solid transparent`}:{background:"var(--mantine-color-white)",hover:Ql(e.white,.01),color:t,border:`${Y(1)} solid transparent`}:n==="gradient"?{background:bp(r,e),hover:bp(r,e),color:"var(--mantine-color-white)",border:"none"}:n==="default"?{background:"var(--mantine-color-default)",hover:"var(--mantine-color-default-hover)",color:"var(--mantine-color-default-color)",border:`${Y(1)} solid var(--mantine-color-default-border)`}:{}},SW={dark:["#C9C9C9","#b8b8b8","#828282","#696969","#424242","#3b3b3b","#2e2e2e","#242424","#1f1f1f","#141414"],gray:["#f8f9fa","#f1f3f5","#e9ecef","#dee2e6","#ced4da","#adb5bd","#868e96","#495057","#343a40","#212529"],red:["#fff5f5","#ffe3e3","#ffc9c9","#ffa8a8","#ff8787","#ff6b6b","#fa5252","#f03e3e","#e03131","#c92a2a"],pink:["#fff0f6","#ffdeeb","#fcc2d7","#faa2c1","#f783ac","#f06595","#e64980","#d6336c","#c2255c","#a61e4d"],grape:["#f8f0fc","#f3d9fa","#eebefa","#e599f7","#da77f2","#cc5de8","#be4bdb","#ae3ec9","#9c36b5","#862e9c"],violet:["#f3f0ff","#e5dbff","#d0bfff","#b197fc","#9775fa","#845ef7","#7950f2","#7048e8","#6741d9","#5f3dc4"],indigo:["#edf2ff","#dbe4ff","#bac8ff","#91a7ff","#748ffc","#5c7cfa","#4c6ef5","#4263eb","#3b5bdb","#364fc7"],blue:["#e7f5ff","#d0ebff","#a5d8ff","#74c0fc","#4dabf7","#339af0","#228be6","#1c7ed6","#1971c2","#1864ab"],cyan:["#e3fafc","#c5f6fa","#99e9f2","#66d9e8","#3bc9db","#22b8cf","#15aabf","#1098ad","#0c8599","#0b7285"],teal:["#e6fcf5","#c3fae8","#96f2d7","#63e6be","#38d9a9","#20c997","#12b886","#0ca678","#099268","#087f5b"],green:["#ebfbee","#d3f9d8","#b2f2bb","#8ce99a","#69db7c","#51cf66","#40c057","#37b24d","#2f9e44","#2b8a3e"],lime:["#f4fce3","#e9fac8","#d8f5a2","#c0eb75","#a9e34b","#94d82d","#82c91e","#74b816","#66a80f","#5c940d"],yellow:["#fff9db","#fff3bf","#ffec99","#ffe066","#ffd43b","#fcc419","#fab005","#f59f00","#f08c00","#e67700"],orange:["#fff4e6","#ffe8cc","#ffd8a8","#ffc078","#ffa94d","#ff922b","#fd7e14","#f76707","#e8590c","#d9480f"]},dE="-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji",d0={scale:1,fontSmoothing:!0,focusRing:"auto",white:"#fff",black:"#000",colors:SW,primaryShade:{light:6,dark:8},primaryColor:"blue",variantColorResolver:xW,autoContrast:!1,luminanceThreshold:.3,fontFamily:dE,fontFamilyMonospace:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, Liberation Mono, Courier New, monospace",respectReducedMotion:!1,cursorType:"default",defaultGradient:{from:"blue",to:"cyan",deg:45},defaultRadius:"sm",activeClassName:"mantine-active",focusClassName:"",headings:{fontFamily:dE,fontWeight:"700",textWrap:"wrap",sizes:{h1:{fontSize:Y(34),lineHeight:"1.3"},h2:{fontSize:Y(26),lineHeight:"1.35"},h3:{fontSize:Y(22),lineHeight:"1.4"},h4:{fontSize:Y(18),lineHeight:"1.45"},h5:{fontSize:Y(16),lineHeight:"1.5"},h6:{fontSize:Y(14),lineHeight:"1.5"}}},fontSizes:{xs:Y(12),sm:Y(14),md:Y(16),lg:Y(18),xl:Y(20)},lineHeights:{xs:"1.4",sm:"1.45",md:"1.55",lg:"1.6",xl:"1.65"},radius:{xs:Y(2),sm:Y(4),md:Y(8),lg:Y(16),xl:Y(32)},spacing:{xs:Y(10),sm:Y(12),md:Y(16),lg:Y(20),xl:Y(32)},breakpoints:{xs:"36em",sm:"48em",md:"62em",lg:"75em",xl:"88em"},shadows:{xs:`0 ${Y(1)} ${Y(3)} rgba(0, 0, 0, 0.05), 0 ${Y(1)} ${Y(2)} rgba(0, 0, 0, 0.1)`,sm:`0 ${Y(1)} ${Y(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${Y(10)} ${Y(15)} ${Y(-5)}, rgba(0, 0, 0, 0.04) 0 ${Y(7)} ${Y(7)} ${Y(-5)}`,md:`0 ${Y(1)} ${Y(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${Y(20)} ${Y(25)} ${Y(-5)}, rgba(0, 0, 0, 0.04) 0 ${Y(10)} ${Y(10)} ${Y(-5)}`,lg:`0 ${Y(1)} ${Y(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${Y(28)} ${Y(23)} ${Y(-7)}, rgba(0, 0, 0, 0.04) 0 ${Y(12)} ${Y(12)} ${Y(-7)}`,xl:`0 ${Y(1)} ${Y(3)} rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.05) 0 ${Y(36)} ${Y(28)} ${Y(-7)}, rgba(0, 0, 0, 0.04) 0 ${Y(17)} ${Y(17)} ${Y(-7)}`},other:{},components:{}};function fE(t){return t==="auto"||t==="dark"||t==="light"}function wW({key:t="mantine-color-scheme-value"}={}){let e;return{get:n=>{if(typeof window>"u")return n;try{const r=window.localStorage.getItem(t);return fE(r)?r:n}catch{return n}},set:n=>{try{window.localStorage.setItem(t,n)}catch(r){console.warn("[@mantine/core] Local storage color scheme manager was unable to save color scheme.",r)}},subscribe:n=>{e=r=>{r.storageArea===window.localStorage&&r.key===t&&fE(r.newValue)&&n(r.newValue)},window.addEventListener("storage",e)},unsubscribe:()=>{window.removeEventListener("storage",e)},clear:()=>{window.localStorage.removeItem(t)}}}const kW="[@mantine/core] MantineProvider: Invalid theme.primaryColor, it accepts only key of theme.colors, learn more – https://mantine.dev/theming/colors/#primary-color",hE="[@mantine/core] MantineProvider: Invalid theme.primaryShade, it accepts only 0-9 integers or an object { light: 0-9, dark: 0-9 }";function Wf(t){return t<0||t>9?!1:parseInt(t.toString(),10)===t}function pE(t){if(!(t.primaryColor in t.colors))throw new Error(kW);if(typeof t.primaryShade=="object"&&(!Wf(t.primaryShade.dark)||!Wf(t.primaryShade.light)))throw new Error(hE);if(typeof t.primaryShade=="number"&&!Wf(t.primaryShade))throw new Error(hE)}function AW(t,e){if(!e)return pE(t),t;const n=o0(t,e);return e.fontFamily&&!e.headings?.fontFamily&&(n.headings.fontFamily=e.fontFamily),pE(n),n}const f0=C.createContext(null),vW=()=>C.useContext(f0)||d0;function on(){const t=C.useContext(f0);if(!t)throw new Error("@mantine/core: MantineProvider was not found in component tree, make sure you have it in your app");return t}function Wk({theme:t,children:e,inherit:n=!0}){const r=vW(),i=C.useMemo(()=>AW(n?r:d0,t),[t,r,n]);return M.jsx(f0.Provider,{value:i,children:e})}Wk.displayName="@mantine/core/MantineThemeProvider";function NW(){const t=on(),e=u0(),n=lr(t.breakpoints).reduce((r,i)=>{const s=t.breakpoints[i].includes("px"),o=Dj(t.breakpoints[i]),a=s?`${o-.1}px`:lE(o-.1),l=s?`${o}px`:lE(o);return`${r}@media (max-width: ${a}) {.mantine-visible-from-${i} {display: none !important;}}@media (min-width: ${l}) {.mantine-hidden-from-${i} {display: none !important;}}`},"");return M.jsx("style",{"data-mantine-styles":"classes",nonce:e?.(),dangerouslySetInnerHTML:{__html:n}})}function qf(t){return Object.entries(t).map(([e,n])=>`${e}: ${n};`).join("")}function qk(t,e){const n=e?[e]:[":root",":host"],r=qf(t.variables),i=r?`${n.join(", ")}{${r}}`:"",s=qf(t.dark),o=qf(t.light),a=c=>n.map(d=>d===":host"?`${d}([data-mantine-color-scheme="${c}"])`:`${d}[data-mantine-color-scheme="${c}"]`).join(", "),l=s?`${a("dark")}{${s}}`:"",u=o?`${a("light")}{${o}}`:"";return`${i}
150
+
151
+ ${l}
152
+
153
+ ${u}`}function Yk({color:t,theme:e,autoContrast:n}){return(typeof n=="boolean"?n:e.autoContrast)&&ns({color:t||e.primaryColor,theme:e}).isLight?"var(--mantine-color-black)":"var(--mantine-color-white)"}function mE(t,e){return Yk({color:t.colors[t.primaryColor][Wa(t,e)],theme:t,autoContrast:null})}function Zl({theme:t,color:e,colorScheme:n,name:r=e,withColorValues:i=!0}){if(!t.colors[e])return{};if(n==="light"){const a=Wa(t,"light"),l={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-filled)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${a===9?8:a+1})`,[`--mantine-color-${r}-light`]:ps(t.colors[e][a],.1),[`--mantine-color-${r}-light-hover`]:ps(t.colors[e][a],.12),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${a})`,[`--mantine-color-${r}-outline-hover`]:ps(t.colors[e][a],.05)};return i?{[`--mantine-color-${r}-0`]:t.colors[e][0],[`--mantine-color-${r}-1`]:t.colors[e][1],[`--mantine-color-${r}-2`]:t.colors[e][2],[`--mantine-color-${r}-3`]:t.colors[e][3],[`--mantine-color-${r}-4`]:t.colors[e][4],[`--mantine-color-${r}-5`]:t.colors[e][5],[`--mantine-color-${r}-6`]:t.colors[e][6],[`--mantine-color-${r}-7`]:t.colors[e][7],[`--mantine-color-${r}-8`]:t.colors[e][8],[`--mantine-color-${r}-9`]:t.colors[e][9],...l}:l}const s=Wa(t,"dark"),o={[`--mantine-color-${r}-text`]:`var(--mantine-color-${r}-4)`,[`--mantine-color-${r}-filled`]:`var(--mantine-color-${r}-${s})`,[`--mantine-color-${r}-filled-hover`]:`var(--mantine-color-${r}-${s===9?8:s+1})`,[`--mantine-color-${r}-light`]:ps(t.colors[e][Math.max(0,s-2)],.15),[`--mantine-color-${r}-light-hover`]:ps(t.colors[e][Math.max(0,s-2)],.2),[`--mantine-color-${r}-light-color`]:`var(--mantine-color-${r}-${Math.max(s-5,0)})`,[`--mantine-color-${r}-outline`]:`var(--mantine-color-${r}-${Math.max(s-4,0)})`,[`--mantine-color-${r}-outline-hover`]:ps(t.colors[e][Math.max(s-4,0)],.05)};return i?{[`--mantine-color-${r}-0`]:t.colors[e][0],[`--mantine-color-${r}-1`]:t.colors[e][1],[`--mantine-color-${r}-2`]:t.colors[e][2],[`--mantine-color-${r}-3`]:t.colors[e][3],[`--mantine-color-${r}-4`]:t.colors[e][4],[`--mantine-color-${r}-5`]:t.colors[e][5],[`--mantine-color-${r}-6`]:t.colors[e][6],[`--mantine-color-${r}-7`]:t.colors[e][7],[`--mantine-color-${r}-8`]:t.colors[e][8],[`--mantine-color-${r}-9`]:t.colors[e][9],...o}:o}function _W(t){return!!t&&typeof t=="object"&&"mantine-virtual-color"in t}function ms(t,e,n){lr(e).forEach(r=>Object.assign(t,{[`--mantine-${n}-${r}`]:e[r]}))}const Kk=t=>{const e=Wa(t,"light"),n=t.defaultRadius in t.radius?t.radius[t.defaultRadius]:Y(t.defaultRadius),r={variables:{"--mantine-z-index-app":"100","--mantine-z-index-modal":"200","--mantine-z-index-popover":"300","--mantine-z-index-overlay":"400","--mantine-z-index-max":"9999","--mantine-scale":t.scale.toString(),"--mantine-cursor-type":t.cursorType,"--mantine-webkit-font-smoothing":t.fontSmoothing?"antialiased":"unset","--mantine-moz-font-smoothing":t.fontSmoothing?"grayscale":"unset","--mantine-color-white":t.white,"--mantine-color-black":t.black,"--mantine-line-height":t.lineHeights.md,"--mantine-font-family":t.fontFamily,"--mantine-font-family-monospace":t.fontFamilyMonospace,"--mantine-font-family-headings":t.headings.fontFamily,"--mantine-heading-font-weight":t.headings.fontWeight,"--mantine-heading-text-wrap":t.headings.textWrap,"--mantine-radius-default":n,"--mantine-primary-color-filled":`var(--mantine-color-${t.primaryColor}-filled)`,"--mantine-primary-color-filled-hover":`var(--mantine-color-${t.primaryColor}-filled-hover)`,"--mantine-primary-color-light":`var(--mantine-color-${t.primaryColor}-light)`,"--mantine-primary-color-light-hover":`var(--mantine-color-${t.primaryColor}-light-hover)`,"--mantine-primary-color-light-color":`var(--mantine-color-${t.primaryColor}-light-color)`},light:{"--mantine-color-scheme":"light","--mantine-primary-color-contrast":mE(t,"light"),"--mantine-color-bright":"var(--mantine-color-black)","--mantine-color-text":t.black,"--mantine-color-body":t.white,"--mantine-color-error":"var(--mantine-color-red-6)","--mantine-color-placeholder":"var(--mantine-color-gray-5)","--mantine-color-anchor":`var(--mantine-color-${t.primaryColor}-${e})`,"--mantine-color-default":"var(--mantine-color-white)","--mantine-color-default-hover":"var(--mantine-color-gray-0)","--mantine-color-default-color":"var(--mantine-color-black)","--mantine-color-default-border":"var(--mantine-color-gray-4)","--mantine-color-dimmed":"var(--mantine-color-gray-6)","--mantine-color-disabled":"var(--mantine-color-gray-2)","--mantine-color-disabled-color":"var(--mantine-color-gray-5)","--mantine-color-disabled-border":"var(--mantine-color-gray-3)"},dark:{"--mantine-color-scheme":"dark","--mantine-primary-color-contrast":mE(t,"dark"),"--mantine-color-bright":"var(--mantine-color-white)","--mantine-color-text":"var(--mantine-color-dark-0)","--mantine-color-body":"var(--mantine-color-dark-7)","--mantine-color-error":"var(--mantine-color-red-8)","--mantine-color-placeholder":"var(--mantine-color-dark-3)","--mantine-color-anchor":`var(--mantine-color-${t.primaryColor}-4)`,"--mantine-color-default":"var(--mantine-color-dark-6)","--mantine-color-default-hover":"var(--mantine-color-dark-5)","--mantine-color-default-color":"var(--mantine-color-white)","--mantine-color-default-border":"var(--mantine-color-dark-4)","--mantine-color-dimmed":"var(--mantine-color-dark-2)","--mantine-color-disabled":"var(--mantine-color-dark-6)","--mantine-color-disabled-color":"var(--mantine-color-dark-3)","--mantine-color-disabled-border":"var(--mantine-color-dark-4)"}};ms(r.variables,t.breakpoints,"breakpoint"),ms(r.variables,t.spacing,"spacing"),ms(r.variables,t.fontSizes,"font-size"),ms(r.variables,t.lineHeights,"line-height"),ms(r.variables,t.shadows,"shadow"),ms(r.variables,t.radius,"radius"),t.colors[t.primaryColor].forEach((s,o)=>{r.variables[`--mantine-primary-color-${o}`]=`var(--mantine-color-${t.primaryColor}-${o})`}),lr(t.colors).forEach(s=>{const o=t.colors[s];if(_W(o)){Object.assign(r.light,Zl({theme:t,name:o.name,color:o.light,colorScheme:"light",withColorValues:!0})),Object.assign(r.dark,Zl({theme:t,name:o.name,color:o.dark,colorScheme:"dark",withColorValues:!0}));return}o.forEach((a,l)=>{r.variables[`--mantine-color-${s}-${l}`]=a}),Object.assign(r.light,Zl({theme:t,color:s,colorScheme:"light",withColorValues:!1})),Object.assign(r.dark,Zl({theme:t,color:s,colorScheme:"dark",withColorValues:!1}))});const i=t.headings.sizes;return lr(i).forEach(s=>{r.variables[`--mantine-${s}-font-size`]=i[s].fontSize,r.variables[`--mantine-${s}-line-height`]=i[s].lineHeight,r.variables[`--mantine-${s}-font-weight`]=i[s].fontWeight||t.headings.fontWeight}),r};function IW({theme:t,generator:e}){const n=Kk(t),r=e?.(t);return r?o0(n,r):n}const Yf=Kk(d0);function RW(t){const e={variables:{},light:{},dark:{}};return lr(t.variables).forEach(n=>{Yf.variables[n]!==t.variables[n]&&(e.variables[n]=t.variables[n])}),lr(t.light).forEach(n=>{Yf.light[n]!==t.light[n]&&(e.light[n]=t.light[n])}),lr(t.dark).forEach(n=>{Yf.dark[n]!==t.dark[n]&&(e.dark[n]=t.dark[n])}),e}function MW(t){return qk({variables:{},dark:{"--mantine-color-scheme":"dark"},light:{"--mantine-color-scheme":"light"}},t)}function Gk({cssVariablesSelector:t,deduplicateCssVariables:e}){const n=on(),r=u0(),i=cW(),s=IW({theme:n,generator:i}),o=(t===void 0||t===":root"||t===":host")&&e,a=o?RW(s):s,l=qk(a,t);return l?M.jsx("style",{"data-mantine-styles":!0,nonce:r?.(),dangerouslySetInnerHTML:{__html:`${l}${o?"":MW(t)}`}}):null}Gk.displayName="@mantine/CssVariables";function gs(t,e){const n=typeof window<"u"&&"matchMedia"in window&&window.matchMedia("(prefers-color-scheme: dark)")?.matches,r=t!=="auto"?t:n?"dark":"light";e()?.setAttribute("data-mantine-color-scheme",r)}function OW({manager:t,defaultColorScheme:e,getRootElement:n,forceColorScheme:r}){const i=C.useRef(null),[s,o]=C.useState(()=>t.get(e)),a=r||s,l=C.useCallback(c=>{r||(gs(c,n),o(c),t.set(c))},[t.set,a,r]),u=C.useCallback(()=>{o(e),gs(e,n),t.clear()},[t.clear,e]);return C.useEffect(()=>(t.subscribe(l),t.unsubscribe),[t.subscribe,t.unsubscribe]),yl(()=>{gs(t.get(e),n)},[]),C.useEffect(()=>{if(r)return gs(r,n),()=>{};r===void 0&&gs(s,n),typeof window<"u"&&"matchMedia"in window&&(i.current=window.matchMedia("(prefers-color-scheme: dark)"));const c=d=>{s==="auto"&&gs(d.matches?"dark":"light",n)};return i.current?.addEventListener("change",c),()=>i.current?.removeEventListener("change",c)},[s,r]),{colorScheme:a,setColorScheme:l,clearColorScheme:u}}function DW({respectReducedMotion:t,getRootElement:e}){yl(()=>{t&&e()?.setAttribute("data-respect-reduced-motion","true")},[t])}function LW({theme:t,children:e,getStyleNonce:n,withStaticClasses:r=!0,withGlobalClasses:i=!0,deduplicateCssVariables:s=!0,withCssVariables:o=!0,cssVariablesSelector:a,classNamesPrefix:l="mantine",colorSchemeManager:u=wW(),defaultColorScheme:c="light",getRootElement:d=()=>document.documentElement,cssVariablesResolver:f,forceColorScheme:h,stylesTransform:p,env:g}){const{colorScheme:b,setColorScheme:y,clearColorScheme:E}=OW({defaultColorScheme:c,forceColorScheme:h,manager:u,getRootElement:d});return DW({respectReducedMotion:t?.respectReducedMotion||!1,getRootElement:d}),M.jsx(jk.Provider,{value:{colorScheme:b,setColorScheme:y,clearColorScheme:E,getRootElement:d,classNamesPrefix:l,getStyleNonce:n,cssVariablesResolver:f,cssVariablesSelector:a??":root",withStaticClasses:r,stylesTransform:p,env:g},children:M.jsxs(Wk,{theme:t,children:[o&&M.jsx(Gk,{cssVariablesSelector:a,deduplicateCssVariables:s}),i&&M.jsx(NW,{}),e]})})}LW.displayName="@mantine/core/MantineProvider";function pd({classNames:t,styles:e,props:n,stylesCtx:r}){const i=on();return{resolvedClassNames:fd({theme:i,classNames:t,props:n,stylesCtx:r||void 0}),resolvedStyles:Ec({theme:i,styles:e,props:n,stylesCtx:r||void 0})}}const PW={always:"mantine-focus-always",auto:"mantine-focus-auto",never:"mantine-focus-never"};function BW({theme:t,options:e,unstyled:n}){return Br(e?.focusable&&!n&&(t.focusClassName||PW[t.focusRing]),e?.active&&!n&&t.activeClassName)}function FW({selector:t,stylesCtx:e,options:n,props:r,theme:i}){return fd({theme:i,classNames:n?.classNames,props:n?.props||r,stylesCtx:e})[t]}function gE({selector:t,stylesCtx:e,theme:n,classNames:r,props:i}){return fd({theme:n,classNames:r,props:i,stylesCtx:e})[t]}function HW({rootSelector:t,selector:e,className:n}){return t===e?n:void 0}function UW({selector:t,classes:e,unstyled:n}){return n?void 0:e[t]}function $W({themeName:t,classNamesPrefix:e,selector:n,withStaticClass:r}){return r===!1?[]:t.map(i=>`${e}-${i}-${n}`)}function VW({themeName:t,theme:e,selector:n,props:r,stylesCtx:i}){return t.map(s=>fd({theme:e,classNames:e.components[s]?.classNames,props:r,stylesCtx:i})?.[n])}function zW({options:t,classes:e,selector:n,unstyled:r}){return t?.variant&&!r?e[`${n}--${t.variant}`]:void 0}function jW({theme:t,options:e,themeName:n,selector:r,classNamesPrefix:i,classNames:s,classes:o,unstyled:a,className:l,rootSelector:u,props:c,stylesCtx:d,withStaticClasses:f,headless:h,transformedStyles:p}){return Br(BW({theme:t,options:e,unstyled:a||h}),VW({theme:t,themeName:n,selector:r,props:c,stylesCtx:d}),zW({options:e,classes:o,selector:r,unstyled:a}),gE({selector:r,stylesCtx:d,theme:t,classNames:s,props:c}),gE({selector:r,stylesCtx:d,theme:t,classNames:p,props:c}),FW({selector:r,stylesCtx:d,options:e,props:c,theme:t}),HW({rootSelector:u,selector:r,className:l}),UW({selector:r,classes:o,unstyled:a||h}),f&&!h&&$W({themeName:n,classNamesPrefix:i,selector:r,withStaticClass:e?.withStaticClass}),e?.className)}function WW({theme:t,themeName:e,props:n,stylesCtx:r,selector:i}){return e.map(s=>Ec({theme:t,styles:t.components[s]?.styles,props:n,stylesCtx:r})[i]).reduce((s,o)=>({...s,...o}),{})}function yp({style:t,theme:e}){return Array.isArray(t)?[...t].reduce((n,r)=>({...n,...yp({style:r,theme:e})}),{}):typeof t=="function"?t(e):t??{}}function qW(t){return t.reduce((e,n)=>(n&&Object.keys(n).forEach(r=>{e[r]={...e[r],...ud(n[r])}}),e),{})}function YW({vars:t,varsResolver:e,theme:n,props:r,stylesCtx:i,selector:s,themeName:o,headless:a}){return qW([a?{}:e?.(n,r,i),...o.map(l=>n.components?.[l]?.vars?.(n,r,i)),t?.(n,r,i)])?.[s]}function KW({theme:t,themeName:e,selector:n,options:r,props:i,stylesCtx:s,rootSelector:o,styles:a,style:l,vars:u,varsResolver:c,headless:d,withStylesTransform:f}){return{...!f&&WW({theme:t,themeName:e,props:i,stylesCtx:s,selector:n}),...!f&&Ec({theme:t,styles:a,props:i,stylesCtx:s})[n],...!f&&Ec({theme:t,styles:r?.styles,props:r?.props||i,stylesCtx:s})[n],...YW({theme:t,props:i,stylesCtx:s,vars:u,varsResolver:c,selector:n,themeName:e,headless:d}),...o===n?yp({style:l,theme:t}):null,...yp({style:r?.style,theme:t})}}function GW({props:t,stylesCtx:e,themeName:n}){const r=on(),i=mW()?.();return{getTransformedStyles:o=>i?[...o.map(l=>i(l,{props:t,theme:r,ctx:e})),...n.map(l=>i(r.components[l]?.styles,{props:t,theme:r,ctx:e}))].filter(Boolean):[],withStylesTransform:!!i}}function _e({name:t,classes:e,props:n,stylesCtx:r,className:i,style:s,rootSelector:o="root",unstyled:a,classNames:l,styles:u,vars:c,varsResolver:d,attributes:f}){const h=on(),p=dW(),g=fW(),b=hW(),y=(Array.isArray(t)?t:[t]).filter(v=>v),{withStylesTransform:E,getTransformedStyles:T}=GW({props:n,stylesCtx:r,themeName:y});return(v,R)=>({className:jW({theme:h,options:R,themeName:y,selector:v,classNamesPrefix:p,classNames:l,classes:e,unstyled:a,className:i,rootSelector:o,props:n,stylesCtx:r,withStaticClasses:g,headless:b,transformedStyles:T([R?.styles,u])}),style:KW({theme:h,themeName:y,selector:v,options:R,props:n,stylesCtx:r,rootSelector:o,styles:u,style:s,vars:c,varsResolver:d,headless:b,withStylesTransform:E}),...f?.[v]})}function XW(t,e){return typeof t=="boolean"?t:e.autoContrast}function re(t,e,n){const r=on(),i=r.components[t]?.defaultProps,s=typeof i=="function"?i(r):i;return{...e,...s,...ud(n)}}function Kf(t){return lr(t).reduce((e,n)=>t[n]!==void 0?`${e}${Mj(n)}:${t[n]};`:e,"").trim()}function QW({selector:t,styles:e,media:n,container:r}){const i=e?Kf(e):"",s=Array.isArray(n)?n.map(a=>`@media${a.query}{${t}{${Kf(a.styles)}}}`):[],o=Array.isArray(r)?r.map(a=>`@container ${a.query}{${t}{${Kf(a.styles)}}}`):[];return`${i?`${t}{${i}}`:""}${s.join("")}${o.join("")}`.trim()}function Xk(t){const e=u0();return M.jsx("style",{"data-mantine-styles":"inline",nonce:e?.(),dangerouslySetInnerHTML:{__html:QW(t)}})}function md(t){const{m:e,mx:n,my:r,mt:i,mb:s,ml:o,mr:a,me:l,ms:u,p:c,px:d,py:f,pt:h,pb:p,pl:g,pr:b,pe:y,ps:E,bd:T,bdrs:v,bg:R,c:A,opacity:O,ff:P,fz:F,fw:N,lts:U,ta:j,lh:z,fs:I,tt:B,td:Z,w:H,miw:D,maw:V,h:x,mih:ne,mah:G,bgsz:w,bgp:me,bgr:te,bga:le,pos:Ne,top:ye,left:ge,bottom:De,right:qe,inset:oe,display:ie,flex:fe,hiddenFrom:Me,visibleFrom:Fe,lightHidden:Ce,darkHidden:lt,sx:Be,...Qe}=t;return{styleProps:ud({m:e,mx:n,my:r,mt:i,mb:s,ml:o,mr:a,me:l,ms:u,p:c,px:d,py:f,pt:h,pb:p,pl:g,pr:b,pe:y,ps:E,bd:T,bg:R,c:A,opacity:O,ff:P,fz:F,fw:N,lts:U,ta:j,lh:z,fs:I,tt:B,td:Z,w:H,miw:D,maw:V,h:x,mih:ne,mah:G,bgsz:w,bgp:me,bgr:te,bga:le,pos:Ne,top:ye,left:ge,bottom:De,right:qe,inset:oe,display:ie,flex:fe,bdrs:v,hiddenFrom:Me,visibleFrom:Fe,lightHidden:Ce,darkHidden:lt,sx:Be}),rest:Qe}}const ZW={m:{type:"spacing",property:"margin"},mt:{type:"spacing",property:"marginTop"},mb:{type:"spacing",property:"marginBottom"},ml:{type:"spacing",property:"marginLeft"},mr:{type:"spacing",property:"marginRight"},ms:{type:"spacing",property:"marginInlineStart"},me:{type:"spacing",property:"marginInlineEnd"},mx:{type:"spacing",property:"marginInline"},my:{type:"spacing",property:"marginBlock"},p:{type:"spacing",property:"padding"},pt:{type:"spacing",property:"paddingTop"},pb:{type:"spacing",property:"paddingBottom"},pl:{type:"spacing",property:"paddingLeft"},pr:{type:"spacing",property:"paddingRight"},ps:{type:"spacing",property:"paddingInlineStart"},pe:{type:"spacing",property:"paddingInlineEnd"},px:{type:"spacing",property:"paddingInline"},py:{type:"spacing",property:"paddingBlock"},bd:{type:"border",property:"border"},bdrs:{type:"radius",property:"borderRadius"},bg:{type:"color",property:"background"},c:{type:"textColor",property:"color"},opacity:{type:"identity",property:"opacity"},ff:{type:"fontFamily",property:"fontFamily"},fz:{type:"fontSize",property:"fontSize"},fw:{type:"identity",property:"fontWeight"},lts:{type:"size",property:"letterSpacing"},ta:{type:"identity",property:"textAlign"},lh:{type:"lineHeight",property:"lineHeight"},fs:{type:"identity",property:"fontStyle"},tt:{type:"identity",property:"textTransform"},td:{type:"identity",property:"textDecoration"},w:{type:"spacing",property:"width"},miw:{type:"spacing",property:"minWidth"},maw:{type:"spacing",property:"maxWidth"},h:{type:"spacing",property:"height"},mih:{type:"spacing",property:"minHeight"},mah:{type:"spacing",property:"maxHeight"},bgsz:{type:"size",property:"backgroundSize"},bgp:{type:"identity",property:"backgroundPosition"},bgr:{type:"identity",property:"backgroundRepeat"},bga:{type:"identity",property:"backgroundAttachment"},pos:{type:"identity",property:"position"},top:{type:"size",property:"top"},left:{type:"size",property:"left"},bottom:{type:"size",property:"bottom"},right:{type:"size",property:"right"},inset:{type:"size",property:"inset"},display:{type:"identity",property:"display"},flex:{type:"identity",property:"flex"}};function h0(t,e){const n=ns({color:t,theme:e});return n.color==="dimmed"?"var(--mantine-color-dimmed)":n.color==="bright"?"var(--mantine-color-bright)":n.variable?`var(${n.variable})`:n.color}function JW(t,e){const n=ns({color:t,theme:e});return n.isThemeColor&&n.shade===void 0?`var(--mantine-color-${n.color}-text)`:h0(t,e)}function eq(t,e){if(typeof t=="number")return Y(t);if(typeof t=="string"){const[n,r,...i]=t.split(" ").filter(o=>o.trim()!=="");let s=`${Y(n)}`;return r&&(s+=` ${r}`),i.length>0&&(s+=` ${h0(i.join(" "),e)}`),s.trim()}return t}const bE={text:"var(--mantine-font-family)",mono:"var(--mantine-font-family-monospace)",monospace:"var(--mantine-font-family-monospace)",heading:"var(--mantine-font-family-headings)",headings:"var(--mantine-font-family-headings)"};function tq(t){return typeof t=="string"&&t in bE?bE[t]:t}const nq=["h1","h2","h3","h4","h5","h6"];function rq(t,e){return typeof t=="string"&&t in e.fontSizes?`var(--mantine-font-size-${t})`:typeof t=="string"&&nq.includes(t)?`var(--mantine-${t}-font-size)`:typeof t=="number"||typeof t=="string"?Y(t):t}function iq(t){return t}const sq=["h1","h2","h3","h4","h5","h6"];function oq(t,e){return typeof t=="string"&&t in e.lineHeights?`var(--mantine-line-height-${t})`:typeof t=="string"&&sq.includes(t)?`var(--mantine-${t}-line-height)`:t}function aq(t,e){return typeof t=="string"&&t in e.radius?`var(--mantine-radius-${t})`:typeof t=="number"||typeof t=="string"?Y(t):t}function lq(t){return typeof t=="number"?Y(t):t}function uq(t,e){if(typeof t=="number")return Y(t);if(typeof t=="string"){const n=t.replace("-","");if(!(n in e.spacing))return Y(t);const r=`--mantine-spacing-${n}`;return t.startsWith("-")?`calc(var(${r}) * -1)`:`var(${r})`}return t}const Gf={color:h0,textColor:JW,fontSize:rq,spacing:uq,radius:aq,identity:iq,size:lq,lineHeight:oq,fontFamily:tq,border:eq};function yE(t){return t.replace("(min-width: ","").replace("em)","")}function cq({media:t,...e}){const r=Object.keys(t).sort((i,s)=>Number(yE(i))-Number(yE(s))).map(i=>({query:i,styles:t[i]}));return{...e,media:r}}function dq(t){if(typeof t!="object"||t===null)return!1;const e=Object.keys(t);return!(e.length===1&&e[0]==="base")}function fq(t){return typeof t=="object"&&t!==null?"base"in t?t.base:void 0:t}function hq(t){return typeof t=="object"&&t!==null?lr(t).filter(e=>e!=="base"):[]}function pq(t,e){return typeof t=="object"&&t!==null&&e in t?t[e]:t}function Qk({styleProps:t,data:e,theme:n}){return cq(lr(t).reduce((r,i)=>{if(i==="hiddenFrom"||i==="visibleFrom"||i==="sx")return r;const s=e[i],o=Array.isArray(s.property)?s.property:[s.property],a=fq(t[i]);if(!dq(t[i]))return o.forEach(u=>{r.inlineStyles[u]=Gf[s.type](a,n)}),r;r.hasResponsiveStyles=!0;const l=hq(t[i]);return o.forEach(u=>{a!=null&&(r.styles[u]=Gf[s.type](a,n)),l.forEach(c=>{const d=`(min-width: ${n.breakpoints[c]})`;r.media[d]={...r.media[d],[u]:Gf[s.type](pq(t[i],c),n)}})}),r},{hasResponsiveStyles:!1,styles:{},inlineStyles:{},media:{}}))}function Zk(){return`__m__-${C.useId().replace(/[:«»]/g,"")}`}function Jk(t,e){return Array.isArray(t)?[...t].reduce((n,r)=>({...n,...Jk(r,e)}),{}):typeof t=="function"?t(e):t??{}}function eA(t){return t.startsWith("data-")?t:`data-${t}`}function mq(t){return Object.keys(t).reduce((e,n)=>{const r=t[n];return r===void 0||r===""||r===!1||r===null||(e[eA(n)]=t[n]),e},{})}function tA(t){return t?typeof t=="string"?{[eA(t)]:!0}:Array.isArray(t)?[...t].reduce((e,n)=>({...e,...tA(n)}),{}):mq(t):null}function Ep(t,e){return Array.isArray(t)?[...t].reduce((n,r)=>({...n,...Ep(r,e)}),{}):typeof t=="function"?t(e):t??{}}function gq({theme:t,style:e,vars:n,styleProps:r}){const i=Ep(e,t),s=Ep(n,t);return{...i,...s,...r}}const nA=C.forwardRef(({component:t,style:e,__vars:n,className:r,variant:i,mod:s,size:o,hiddenFrom:a,visibleFrom:l,lightHidden:u,darkHidden:c,renderRoot:d,__size:f,...h},p)=>{const g=on(),b=t||"div",{styleProps:y,rest:E}=md(h),v=pW()?.()?.(y.sx),R=Zk(),A=Qk({styleProps:y,theme:g,data:ZW}),O={ref:p,style:gq({theme:g,style:e,vars:n,styleProps:A.inlineStyles}),className:Br(r,v,{[R]:A.hasResponsiveStyles,"mantine-light-hidden":u,"mantine-dark-hidden":c,[`mantine-hidden-from-${a}`]:a,[`mantine-visible-from-${l}`]:l}),"data-variant":i,"data-size":Fk(o)?void 0:o||void 0,size:f,...tA(s),...E};return M.jsxs(M.Fragment,{children:[A.hasResponsiveStyles&&M.jsx(Xk,{selector:`.${R}`,styles:A.styles,media:A.media}),typeof d=="function"?d(O):M.jsx(b,{...O})]})});nA.displayName="@mantine/core/Box";const pe=nA;function rA(t){return t}function bq(t){const e=t;return n=>{const r=C.forwardRef((i,s)=>M.jsx(e,{...n,...i,ref:s}));return r.extend=e.extend,r.displayName=`WithProps(${e.displayName})`,r}}function Ie(t){const e=C.forwardRef(t);return e.extend=rA,e.withProps=n=>{const r=C.forwardRef((i,s)=>M.jsx(e,{...n,...i,ref:s}));return r.extend=e.extend,r.displayName=`WithProps(${e.displayName})`,r},e}function Lt(t){const e=C.forwardRef(t);return e.withProps=n=>{const r=C.forwardRef((i,s)=>M.jsx(e,{...n,...i,ref:s}));return r.extend=e.extend,r.displayName=`WithProps(${e.displayName})`,r},e.extend=rA,e}const yq=C.createContext({dir:"ltr",toggleDirection:()=>{},setDirection:()=>{}});function No(){return C.useContext(yq)}function gd(){return typeof window<"u"}function iA(t){return sA(t)?(t.nodeName||"").toLowerCase():"#document"}function _o(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Eq(t){var e;return(e=(sA(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function sA(t){return gd()?t instanceof Node||t instanceof _o(t).Node:!1}function Xt(t){return gd()?t instanceof Element||t instanceof _o(t).Element:!1}function p0(t){return gd()?t instanceof HTMLElement||t instanceof _o(t).HTMLElement:!1}function Tp(t){return!gd()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof _o(t).ShadowRoot}function Tq(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Cq=new Set(["html","body","#document"]);function Xf(t){return Cq.has(iA(t))}function xq(t){return _o(t).getComputedStyle(t)}function Sq(t){if(iA(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Tp(t)&&t.host||Eq(t);return Tp(e)?e.host:e}function wq(){const t=navigator.userAgentData;return t!=null&&t.platform?t.platform:navigator.platform}function kq(){const t=navigator.userAgentData;return t&&Array.isArray(t.brands)?t.brands.map(e=>{let{brand:n,version:r}=e;return n+"/"+r}).join(" "):navigator.userAgent}function Aq(){return/apple/i.test(navigator.vendor)}function vq(){return wq().toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints}function Nq(){return kq().includes("jsdom/")}const EE="data-floating-ui-focusable",_q="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function TE(t){let e=t.activeElement;for(;((n=e)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;e=e.shadowRoot.activeElement}return e}function qa(t,e){if(!t||!e)return!1;const n=e.getRootNode==null?void 0:e.getRootNode();if(t.contains(e))return!0;if(n&&Tp(n)){let r=e;for(;r;){if(t===r)return!0;r=r.parentNode||r.host}}return!1}function xs(t){return"composedPath"in t?t.composedPath()[0]:t.target}function Qf(t,e){if(e==null)return!1;if("composedPath"in t)return t.composedPath().includes(e);const n=t;return n.target!=null&&e.contains(n.target)}function Iq(t){return t.matches("html,body")}function Ii(t){return t?.ownerDocument||document}function Rq(t){return p0(t)&&t.matches(_q)}function Mq(t){if(!t||Nq())return!0;try{return t.matches(":focus-visible")}catch{return!0}}function Oq(t){return t?t.hasAttribute(EE)?t:t.querySelector("["+EE+"]")||t:null}function Tu(t,e,n){return n===void 0&&(n=!0),t.filter(i=>{var s;return i.parentId===e&&(!n||((s=i.context)==null?void 0:s.open))}).flatMap(i=>[i,...Tu(t,i.id,n)])}function Dq(t){return"nativeEvent"in t}function Cp(t,e){const n=["mouse","pen"];return n.push("",void 0),n.includes(t)}var Lq=typeof document<"u",Pq=function(){},ur=Lq?C.useLayoutEffect:Pq;const Bq={...Cc};function Jl(t){const e=C.useRef(t);return ur(()=>{e.current=t}),e}const Fq=Bq.useInsertionEffect,Hq=Fq||(t=>t());function ir(t){const e=C.useRef(()=>{});return Hq(()=>{e.current=t}),C.useCallback(function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}const Uq="data-floating-ui-focusable",CE="active",xE="selected",$q={...Cc};let SE=!1,Vq=0;const wE=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+Vq++;function zq(){const[t,e]=C.useState(()=>SE?wE():void 0);return ur(()=>{t==null&&e(wE())},[]),C.useEffect(()=>{SE=!0},[]),t}const jq=$q.useId,oA=jq||zq;function Wq(){const t=new Map;return{emit(e,n){var r;(r=t.get(e))==null||r.forEach(i=>i(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){var r;(r=t.get(e))==null||r.delete(n)}}}const qq=C.createContext(null),Yq=C.createContext(null),m0=()=>{var t;return((t=C.useContext(qq))==null?void 0:t.id)||null},g0=()=>C.useContext(Yq);function b0(t){return"data-floating-ui-"+t}function Sn(t){t.current!==-1&&(clearTimeout(t.current),t.current=-1)}const kE=b0("safe-polygon");function Cu(t,e,n){if(n&&!Cp(n))return 0;if(typeof t=="number")return t;if(typeof t=="function"){const r=t();return typeof r=="number"?r:r?.[e]}return t?.[e]}function Zf(t){return typeof t=="function"?t():t}function Kq(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,dataRef:i,events:s,elements:o}=t,{enabled:a=!0,delay:l=0,handleClose:u=null,mouseOnly:c=!1,restMs:d=0,move:f=!0}=e,h=g0(),p=m0(),g=Jl(u),b=Jl(l),y=Jl(n),E=Jl(d),T=C.useRef(),v=C.useRef(-1),R=C.useRef(),A=C.useRef(-1),O=C.useRef(!0),P=C.useRef(!1),F=C.useRef(()=>{}),N=C.useRef(!1),U=ir(()=>{var H;const D=(H=i.current.openEvent)==null?void 0:H.type;return D?.includes("mouse")&&D!=="mousedown"});C.useEffect(()=>{if(!a)return;function H(D){let{open:V}=D;V||(Sn(v),Sn(A),O.current=!0,N.current=!1)}return s.on("openchange",H),()=>{s.off("openchange",H)}},[a,s]),C.useEffect(()=>{if(!a||!g.current||!n)return;function H(V){U()&&r(!1,V,"hover")}const D=Ii(o.floating).documentElement;return D.addEventListener("mouseleave",H),()=>{D.removeEventListener("mouseleave",H)}},[o.floating,n,r,a,g,U]);const j=C.useCallback(function(H,D,V){D===void 0&&(D=!0),V===void 0&&(V="hover");const x=Cu(b.current,"close",T.current);x&&!R.current?(Sn(v),v.current=window.setTimeout(()=>r(!1,H,V),x)):D&&(Sn(v),r(!1,H,V))},[b,r]),z=ir(()=>{F.current(),R.current=void 0}),I=ir(()=>{if(P.current){const H=Ii(o.floating).body;H.style.pointerEvents="",H.removeAttribute(kE),P.current=!1}}),B=ir(()=>i.current.openEvent?["click","mousedown"].includes(i.current.openEvent.type):!1);C.useEffect(()=>{if(!a)return;function H(G){if(Sn(v),O.current=!1,c&&!Cp(T.current)||Zf(E.current)>0&&!Cu(b.current,"open"))return;const w=Cu(b.current,"open",T.current);w?v.current=window.setTimeout(()=>{y.current||r(!0,G,"hover")},w):n||r(!0,G,"hover")}function D(G){if(B()){I();return}F.current();const w=Ii(o.floating);if(Sn(A),N.current=!1,g.current&&i.current.floatingContext){n||Sn(v),R.current=g.current({...i.current.floatingContext,tree:h,x:G.clientX,y:G.clientY,onClose(){I(),z(),B()||j(G,!0,"safe-polygon")}});const te=R.current;w.addEventListener("mousemove",te),F.current=()=>{w.removeEventListener("mousemove",te)};return}(T.current!=="touch"||!qa(o.floating,G.relatedTarget))&&j(G)}function V(G){B()||i.current.floatingContext&&(g.current==null||g.current({...i.current.floatingContext,tree:h,x:G.clientX,y:G.clientY,onClose(){I(),z(),B()||j(G)}})(G))}function x(){Sn(v)}function ne(G){B()||j(G,!1)}if(Xt(o.domReference)){const G=o.domReference,w=o.floating;return n&&G.addEventListener("mouseleave",V),f&&G.addEventListener("mousemove",H,{once:!0}),G.addEventListener("mouseenter",H),G.addEventListener("mouseleave",D),w&&(w.addEventListener("mouseleave",V),w.addEventListener("mouseenter",x),w.addEventListener("mouseleave",ne)),()=>{n&&G.removeEventListener("mouseleave",V),f&&G.removeEventListener("mousemove",H),G.removeEventListener("mouseenter",H),G.removeEventListener("mouseleave",D),w&&(w.removeEventListener("mouseleave",V),w.removeEventListener("mouseenter",x),w.removeEventListener("mouseleave",ne))}}},[o,a,t,c,f,j,z,I,r,n,y,h,b,g,i,B,E]),ur(()=>{var H;if(a&&n&&(H=g.current)!=null&&(H=H.__options)!=null&&H.blockPointerEvents&&U()){P.current=!0;const V=o.floating;if(Xt(o.domReference)&&V){var D;const x=Ii(o.floating).body;x.setAttribute(kE,"");const ne=o.domReference,G=h==null||(D=h.nodesRef.current.find(w=>w.id===p))==null||(D=D.context)==null?void 0:D.elements.floating;return G&&(G.style.pointerEvents=""),x.style.pointerEvents="none",ne.style.pointerEvents="auto",V.style.pointerEvents="auto",()=>{x.style.pointerEvents="",ne.style.pointerEvents="",V.style.pointerEvents=""}}}},[a,n,p,o,h,g,U]),ur(()=>{n||(T.current=void 0,N.current=!1,z(),I())},[n,z,I]),C.useEffect(()=>()=>{z(),Sn(v),Sn(A),I()},[a,o.domReference,z,I]);const Z=C.useMemo(()=>{function H(D){T.current=D.pointerType}return{onPointerDown:H,onPointerEnter:H,onMouseMove(D){const{nativeEvent:V}=D;function x(){!O.current&&!y.current&&r(!0,V,"hover")}c&&!Cp(T.current)||n||Zf(E.current)===0||N.current&&D.movementX**2+D.movementY**2<2||(Sn(A),T.current==="touch"?x():(N.current=!0,A.current=window.setTimeout(x,Zf(E.current))))}}},[c,r,n,y,E]);return C.useMemo(()=>a?{reference:Z}:{},[a,Z])}const xp=()=>{},aA=C.createContext({delay:0,initialDelay:0,timeoutMs:0,currentId:null,setCurrentId:xp,setState:xp,isInstantPhase:!1}),Gq=()=>C.useContext(aA);function Xq(t){const{children:e,delay:n,timeoutMs:r=0}=t,[i,s]=C.useReducer((l,u)=>({...l,...u}),{delay:n,timeoutMs:r,initialDelay:n,currentId:null,isInstantPhase:!1}),o=C.useRef(null),a=C.useCallback(l=>{s({currentId:l})},[]);return ur(()=>{i.currentId?o.current===null?o.current=i.currentId:i.isInstantPhase||s({isInstantPhase:!0}):(i.isInstantPhase&&s({isInstantPhase:!1}),o.current=null)},[i.currentId,i.isInstantPhase]),M.jsx(aA.Provider,{value:C.useMemo(()=>({...i,setState:s,setCurrentId:a}),[i,a]),children:e})}function Qq(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,floatingId:i}=t,{id:s,enabled:o=!0}=e,a=s??i,l=Gq(),{currentId:u,setCurrentId:c,initialDelay:d,setState:f,timeoutMs:h}=l;return ur(()=>{o&&u&&(f({delay:{open:1,close:Cu(d,"close")}}),u!==a&&r(!1))},[o,a,r,f,u,d]),ur(()=>{function p(){r(!1),f({delay:d,currentId:null})}if(o&&u&&!n&&u===a){if(h){const g=window.setTimeout(p,h);return()=>{clearTimeout(g)}}p()}},[o,n,f,u,a,r,d,h]),ur(()=>{o&&(c===xp||!n||c(a))},[o,n,c,a]),l}const Zq={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},Jq={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},AE=t=>{var e,n;return{escapeKey:typeof t=="boolean"?t:(e=t?.escapeKey)!=null?e:!1,outsidePress:typeof t=="boolean"?t:(n=t?.outsidePress)!=null?n:!0}};function eY(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,elements:i,dataRef:s}=t,{enabled:o=!0,escapeKey:a=!0,outsidePress:l=!0,outsidePressEvent:u="pointerdown",referencePress:c=!1,referencePressEvent:d="pointerdown",ancestorScroll:f=!1,bubbles:h,capture:p}=e,g=g0(),b=ir(typeof l=="function"?l:()=>!1),y=typeof l=="function"?b:l,E=C.useRef(!1),{escapeKey:T,outsidePress:v}=AE(h),{escapeKey:R,outsidePress:A}=AE(p),O=C.useRef(!1),P=ir(I=>{var B;if(!n||!o||!a||I.key!=="Escape"||O.current)return;const Z=(B=s.current.floatingContext)==null?void 0:B.nodeId,H=g?Tu(g.nodesRef.current,Z):[];if(!T&&(I.stopPropagation(),H.length>0)){let D=!0;if(H.forEach(V=>{var x;if((x=V.context)!=null&&x.open&&!V.context.dataRef.current.__escapeKeyBubbles){D=!1;return}}),!D)return}r(!1,Dq(I)?I.nativeEvent:I,"escape-key")}),F=ir(I=>{var B;const Z=()=>{var H;P(I),(H=xs(I))==null||H.removeEventListener("keydown",Z)};(B=xs(I))==null||B.addEventListener("keydown",Z)}),N=ir(I=>{var B;const Z=s.current.insideReactTree;s.current.insideReactTree=!1;const H=E.current;if(E.current=!1,u==="click"&&H||Z||typeof y=="function"&&!y(I))return;const D=xs(I),V="["+b0("inert")+"]",x=Ii(i.floating).querySelectorAll(V);let ne=Xt(D)?D:null;for(;ne&&!Xf(ne);){const te=Sq(ne);if(Xf(te)||!Xt(te))break;ne=te}if(x.length&&Xt(D)&&!Iq(D)&&!qa(D,i.floating)&&Array.from(x).every(te=>!qa(ne,te)))return;if(p0(D)&&z){const te=Xf(D),le=xq(D),Ne=/auto|scroll/,ye=te||Ne.test(le.overflowX),ge=te||Ne.test(le.overflowY),De=ye&&D.clientWidth>0&&D.scrollWidth>D.clientWidth,qe=ge&&D.clientHeight>0&&D.scrollHeight>D.clientHeight,oe=le.direction==="rtl",ie=qe&&(oe?I.offsetX<=D.offsetWidth-D.clientWidth:I.offsetX>D.clientWidth),fe=De&&I.offsetY>D.clientHeight;if(ie||fe)return}const G=(B=s.current.floatingContext)==null?void 0:B.nodeId,w=g&&Tu(g.nodesRef.current,G).some(te=>{var le;return Qf(I,(le=te.context)==null?void 0:le.elements.floating)});if(Qf(I,i.floating)||Qf(I,i.domReference)||w)return;const me=g?Tu(g.nodesRef.current,G):[];if(me.length>0){let te=!0;if(me.forEach(le=>{var Ne;if((Ne=le.context)!=null&&Ne.open&&!le.context.dataRef.current.__outsidePressBubbles){te=!1;return}}),!te)return}r(!1,I,"outside-press")}),U=ir(I=>{var B;const Z=()=>{var H;N(I),(H=xs(I))==null||H.removeEventListener(u,Z)};(B=xs(I))==null||B.addEventListener(u,Z)});C.useEffect(()=>{if(!n||!o)return;s.current.__escapeKeyBubbles=T,s.current.__outsidePressBubbles=v;let I=-1;function B(x){r(!1,x,"ancestor-scroll")}function Z(){window.clearTimeout(I),O.current=!0}function H(){I=window.setTimeout(()=>{O.current=!1},Tq()?5:0)}const D=Ii(i.floating);a&&(D.addEventListener("keydown",R?F:P,R),D.addEventListener("compositionstart",Z),D.addEventListener("compositionend",H)),y&&D.addEventListener(u,A?U:N,A);let V=[];return f&&(Xt(i.domReference)&&(V=tu(i.domReference)),Xt(i.floating)&&(V=V.concat(tu(i.floating))),!Xt(i.reference)&&i.reference&&i.reference.contextElement&&(V=V.concat(tu(i.reference.contextElement)))),V=V.filter(x=>{var ne;return x!==((ne=D.defaultView)==null?void 0:ne.visualViewport)}),V.forEach(x=>{x.addEventListener("scroll",B,{passive:!0})}),()=>{a&&(D.removeEventListener("keydown",R?F:P,R),D.removeEventListener("compositionstart",Z),D.removeEventListener("compositionend",H)),y&&D.removeEventListener(u,A?U:N,A),V.forEach(x=>{x.removeEventListener("scroll",B)}),window.clearTimeout(I)}},[s,i,a,y,u,n,r,f,o,T,v,P,R,F,N,A,U]),C.useEffect(()=>{s.current.insideReactTree=!1},[s,y,u]);const j=C.useMemo(()=>({onKeyDown:P,...c&&{[Zq[d]]:I=>{r(!1,I.nativeEvent,"reference-press")},...d!=="click"&&{onClick(I){r(!1,I.nativeEvent,"reference-press")}}}}),[P,r,c,d]),z=C.useMemo(()=>({onKeyDown:P,onMouseDown(){E.current=!0},onMouseUp(){E.current=!0},[Jq[u]]:()=>{s.current.insideReactTree=!0}}),[P,u,s]);return C.useMemo(()=>o?{reference:j,floating:z}:{},[o,j,z])}function tY(t){const{open:e=!1,onOpenChange:n,elements:r}=t,i=oA(),s=C.useRef({}),[o]=C.useState(()=>Wq()),a=m0()!=null,[l,u]=C.useState(r.reference),c=ir((h,p,g)=>{s.current.openEvent=h?p:void 0,o.emit("openchange",{open:h,event:p,reason:g,nested:a}),n?.(h,p,g)}),d=C.useMemo(()=>({setPositionReference:u}),[]),f=C.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return C.useMemo(()=>({dataRef:s,open:e,onOpenChange:c,elements:f,events:o,floatingId:i,refs:d}),[e,c,f,o,i,d])}function y0(t){t===void 0&&(t={});const{nodeId:e}=t,n=tY({...t,elements:{reference:null,floating:null,...t.elements}}),r=t.rootContext||n,i=r.elements,[s,o]=C.useState(null),[a,l]=C.useState(null),c=i?.domReference||s,d=C.useRef(null),f=g0();ur(()=>{c&&(d.current=c)},[c]);const h=JA({...t,elements:{...i,...a&&{reference:a}}}),p=C.useCallback(T=>{const v=Xt(T)?{getBoundingClientRect:()=>T.getBoundingClientRect(),getClientRects:()=>T.getClientRects(),contextElement:T}:T;l(v),h.refs.setReference(v)},[h.refs]),g=C.useCallback(T=>{(Xt(T)||T===null)&&(d.current=T,o(T)),(Xt(h.refs.reference.current)||h.refs.reference.current===null||T!==null&&!Xt(T))&&h.refs.setReference(T)},[h.refs]),b=C.useMemo(()=>({...h.refs,setReference:g,setPositionReference:p,domReference:d}),[h.refs,g,p]),y=C.useMemo(()=>({...h.elements,domReference:c}),[h.elements,c]),E=C.useMemo(()=>({...h,...r,refs:b,elements:y,nodeId:e}),[h,b,y,e,r]);return ur(()=>{r.dataRef.current.floatingContext=E;const T=f?.nodesRef.current.find(v=>v.id===e);T&&(T.context=E)}),C.useMemo(()=>({...h,context:E,refs:b,elements:y}),[h,b,y,E])}function Jf(){return vq()&&Aq()}function nY(t,e){e===void 0&&(e={});const{open:n,onOpenChange:r,events:i,dataRef:s,elements:o}=t,{enabled:a=!0,visibleOnly:l=!0}=e,u=C.useRef(!1),c=C.useRef(-1),d=C.useRef(!0);C.useEffect(()=>{if(!a)return;const h=_o(o.domReference);function p(){!n&&p0(o.domReference)&&o.domReference===TE(Ii(o.domReference))&&(u.current=!0)}function g(){d.current=!0}function b(){d.current=!1}return h.addEventListener("blur",p),Jf()&&(h.addEventListener("keydown",g,!0),h.addEventListener("pointerdown",b,!0)),()=>{h.removeEventListener("blur",p),Jf()&&(h.removeEventListener("keydown",g,!0),h.removeEventListener("pointerdown",b,!0))}},[o.domReference,n,a]),C.useEffect(()=>{if(!a)return;function h(p){let{reason:g}=p;(g==="reference-press"||g==="escape-key")&&(u.current=!0)}return i.on("openchange",h),()=>{i.off("openchange",h)}},[i,a]),C.useEffect(()=>()=>{Sn(c)},[]);const f=C.useMemo(()=>({onMouseLeave(){u.current=!1},onFocus(h){if(u.current)return;const p=xs(h.nativeEvent);if(l&&Xt(p)){if(Jf()&&!h.relatedTarget){if(!d.current&&!Rq(p))return}else if(!Mq(p))return}r(!0,h.nativeEvent,"focus")},onBlur(h){u.current=!1;const p=h.relatedTarget,g=h.nativeEvent,b=Xt(p)&&p.hasAttribute(b0("focus-guard"))&&p.getAttribute("data-type")==="outside";c.current=window.setTimeout(()=>{var y;const E=TE(o.domReference?o.domReference.ownerDocument:document);!p&&E===o.domReference||qa((y=s.current.floatingContext)==null?void 0:y.refs.floating.current,E)||qa(o.domReference,E)||b||r(!1,g,"focus")})}}),[s,o.domReference,r,l]);return C.useMemo(()=>a?{reference:f}:{},[a,f])}function eh(t,e,n){const r=new Map,i=n==="item";let s=t;if(i&&t){const{[CE]:o,[xE]:a,...l}=t;s=l}return{...n==="floating"&&{tabIndex:-1,[Uq]:""},...s,...e.map(o=>{const a=o?o[n]:null;return typeof a=="function"?t?a(t):null:a}).concat(t).reduce((o,a)=>(a&&Object.entries(a).forEach(l=>{let[u,c]=l;if(!(i&&[CE,xE].includes(u)))if(u.indexOf("on")===0){if(r.has(u)||r.set(u,[]),typeof c=="function"){var d;(d=r.get(u))==null||d.push(c),o[u]=function(){for(var f,h=arguments.length,p=new Array(h),g=0;g<h;g++)p[g]=arguments[g];return(f=r.get(u))==null?void 0:f.map(b=>b(...p)).find(b=>b!==void 0)}}}else o[u]=c}),o),{})}}function rY(t){t===void 0&&(t=[]);const e=t.map(a=>a?.reference),n=t.map(a=>a?.floating),r=t.map(a=>a?.item),i=C.useCallback(a=>eh(a,t,"reference"),e),s=C.useCallback(a=>eh(a,t,"floating"),n),o=C.useCallback(a=>eh(a,t,"item"),r);return C.useMemo(()=>({getReferenceProps:i,getFloatingProps:s,getItemProps:o}),[i,s,o])}const iY=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function sY(t,e){var n,r;e===void 0&&(e={});const{open:i,elements:s,floatingId:o}=t,{enabled:a=!0,role:l="dialog"}=e,u=oA(),c=((n=s.domReference)==null?void 0:n.id)||u,d=C.useMemo(()=>{var E;return((E=Oq(s.floating))==null?void 0:E.id)||o},[s.floating,o]),f=(r=iY.get(l))!=null?r:l,p=m0()!=null,g=C.useMemo(()=>f==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:i?d:void 0}:{"aria-expanded":i?"true":"false","aria-haspopup":f==="alertdialog"?"dialog":f,"aria-controls":i?d:void 0,...f==="listbox"&&{role:"combobox"},...f==="menu"&&{id:c},...f==="menu"&&p&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[f,d,p,i,c,l]),b=C.useMemo(()=>{const E={id:d,...f&&{role:f}};return f==="tooltip"||l==="label"?E:{...E,...f==="menu"&&{"aria-labelledby":c}}},[f,d,c,l]),y=C.useCallback(E=>{let{active:T,selected:v}=E;const R={role:"option",...T&&{id:d+"-fui-option"}};switch(l){case"select":case"combobox":return{...R,"aria-selected":v}}return{}},[d,l]);return C.useMemo(()=>a?{reference:g,floating:b,item:y}:{},[a,g,b,y])}var lA={root:"m_87cf2631"};const oY={__staticSelector:"UnstyledButton"},yi=Lt((t,e)=>{const n=re("UnstyledButton",oY,t),{className:r,component:i="button",__staticSelector:s,unstyled:o,classNames:a,styles:l,style:u,attributes:c,...d}=n,f=_e({name:s,props:n,classes:lA,className:r,style:u,classNames:a,styles:l,unstyled:o,attributes:c});return M.jsx(pe,{...f("root",{focusable:!0}),component:i,ref:e,type:i==="button"?"button":void 0,...d})});yi.classes=lA;yi.displayName="@mantine/core/UnstyledButton";var uA={root:"m_515a97f8"};const E0=Ie((t,e)=>{const n=re("VisuallyHidden",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,attributes:u,...c}=n,d=_e({name:"VisuallyHidden",classes:uA,props:n,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:u});return M.jsx(pe,{component:"span",ref:e,...d("root"),...c})});E0.classes=uA;E0.displayName="@mantine/core/VisuallyHidden";var cA={root:"m_1b7284a3"};const aY=(t,{radius:e,shadow:n})=>({root:{"--paper-radius":e===void 0?void 0:Dt(e),"--paper-shadow":Uk(n)}}),T0=Lt((t,e)=>{const n=re("Paper",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,withBorder:l,vars:u,radius:c,shadow:d,variant:f,mod:h,attributes:p,...g}=n,b=_e({name:"Paper",props:n,classes:cA,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:p,vars:u,varsResolver:aY});return M.jsx(pe,{ref:e,mod:[{"data-with-border":l},h],...b("root"),variant:f,...g})});T0.classes=cA;T0.displayName="@mantine/core/Paper";function vE(t,e,n,r){return t==="center"||r==="center"?{top:e}:t==="end"?{bottom:n}:t==="start"?{top:n}:{}}function NE(t,e,n,r,i){return t==="center"||r==="center"?{left:e}:t==="end"?{[i==="ltr"?"right":"left"]:n}:t==="start"?{[i==="ltr"?"left":"right"]:n}:{}}const lY={bottom:"borderTopLeftRadius",left:"borderTopRightRadius",right:"borderBottomLeftRadius",top:"borderBottomRightRadius"};function uY({position:t,arrowSize:e,arrowOffset:n,arrowRadius:r,arrowPosition:i,arrowX:s,arrowY:o,dir:a}){const[l,u="center"]=t.split("-"),c={width:e,height:e,transform:"rotate(45deg)",position:"absolute",[lY[l]]:r},d=-e/2;return l==="left"?{...c,...vE(u,o,n,i),right:d,borderLeftColor:"transparent",borderBottomColor:"transparent",clipPath:"polygon(100% 0, 0 0, 100% 100%)"}:l==="right"?{...c,...vE(u,o,n,i),left:d,borderRightColor:"transparent",borderTopColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 100%)"}:l==="top"?{...c,...NE(u,s,n,i,a),bottom:d,borderTopColor:"transparent",borderLeftColor:"transparent",clipPath:"polygon(0 100%, 100% 100%, 100% 0)"}:l==="bottom"?{...c,...NE(u,s,n,i,a),top:d,borderBottomColor:"transparent",borderRightColor:"transparent",clipPath:"polygon(0 100%, 0 0, 100% 0)"}:{}}const Tc=C.forwardRef(({position:t,arrowSize:e,arrowOffset:n,arrowRadius:r,arrowPosition:i,visible:s,arrowX:o,arrowY:a,style:l,...u},c)=>{const{dir:d}=No();return s?M.jsx("div",{...u,ref:c,style:{...l,...uY({position:t,arrowSize:e,arrowOffset:n,arrowRadius:r,arrowPosition:i,dir:d,arrowX:o,arrowY:a})}}):null});Tc.displayName="@mantine/core/FloatingArrow";function dA(t,e){if(t==="rtl"&&(e.includes("right")||e.includes("left"))){const[n,r]=e.split("-"),i=n==="right"?"left":"right";return r===void 0?i:`${i}-${r}`}return e}var fA={root:"m_9814e45f"};const cY={zIndex:gl("modal")},dY=(t,{gradient:e,color:n,backgroundOpacity:r,blur:i,radius:s,zIndex:o})=>({root:{"--overlay-bg":e||(n!==void 0||r!==void 0)&&nr(n||"#000",r??.6)||void 0,"--overlay-filter":i?`blur(${Y(i)})`:void 0,"--overlay-radius":s===void 0?void 0:Dt(s),"--overlay-z-index":o?.toString()}}),Ya=Lt((t,e)=>{const n=re("Overlay",cY,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,fixed:u,center:c,children:d,radius:f,zIndex:h,gradient:p,blur:g,color:b,backgroundOpacity:y,mod:E,attributes:T,...v}=n,R=_e({name:"Overlay",props:n,classes:fA,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:T,vars:l,varsResolver:dY});return M.jsx(pe,{ref:e,...R("root"),mod:[{center:c,fixed:u},E],...v,children:d})});Ya.classes=fA;Ya.displayName="@mantine/core/Overlay";function th(t){const e=document.createElement("div");return e.setAttribute("data-portal","true"),typeof t.className=="string"&&e.classList.add(...t.className.split(" ").filter(Boolean)),typeof t.style=="object"&&Object.assign(e.style,t.style),typeof t.id=="string"&&e.setAttribute("id",t.id),e}function fY({target:t,reuseTargetNode:e,...n}){if(t)return typeof t=="string"?document.querySelector(t)||th(n):t;if(e){const r=document.querySelector("[data-mantine-shared-portal-node]");if(r)return r;const i=th(n);return i.setAttribute("data-mantine-shared-portal-node","true"),document.body.appendChild(i),i}return th(n)}const hY={reuseTargetNode:!0},hA=Ie((t,e)=>{const{children:n,target:r,reuseTargetNode:i,...s}=re("Portal",hY,t),[o,a]=C.useState(!1),l=C.useRef(null);return yl(()=>(a(!0),l.current=fY({target:r,reuseTargetNode:i,...s}),yc(e,l.current),!r&&!i&&l.current&&document.body.appendChild(l.current),()=>{!r&&!i&&l.current&&document.body.removeChild(l.current)}),[r]),!o||!l.current?null:Ka.createPortal(M.jsx(M.Fragment,{children:n}),l.current)});hA.displayName="@mantine/core/Portal";const uo=Ie(({withinPortal:t=!0,children:e,...n},r)=>hd()==="test"||!t?M.jsx(M.Fragment,{children:e}):M.jsx(hA,{ref:r,...n,children:e}));uo.displayName="@mantine/core/OptionalPortal";const qo=t=>({in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:`scale(.9) translateY(${t==="bottom"?10:-10}px)`},transitionProperty:"transform, opacity"}),eu={fade:{in:{opacity:1},out:{opacity:0},transitionProperty:"opacity"},"fade-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(30px)"},transitionProperty:"opacity, transform"},"fade-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-30px)"},transitionProperty:"opacity, transform"},"fade-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(30px)"},transitionProperty:"opacity, transform"},"fade-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-30px)"},transitionProperty:"opacity, transform"},scale:{in:{opacity:1,transform:"scale(1)"},out:{opacity:0,transform:"scale(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-y":{in:{opacity:1,transform:"scaleY(1)"},out:{opacity:0,transform:"scaleY(0)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"scale-x":{in:{opacity:1,transform:"scaleX(1)"},out:{opacity:0,transform:"scaleX(0)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"skew-up":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(-20px) skew(-10deg, -5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"skew-down":{in:{opacity:1,transform:"translateY(0) skew(0deg, 0deg)"},out:{opacity:0,transform:"translateY(20px) skew(-10deg, -5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-left":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(-5deg)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"rotate-right":{in:{opacity:1,transform:"translateY(0) rotate(0deg)"},out:{opacity:0,transform:"translateY(20px) rotate(5deg)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-down":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(-100%)"},common:{transformOrigin:"top"},transitionProperty:"transform, opacity"},"slide-up":{in:{opacity:1,transform:"translateY(0)"},out:{opacity:0,transform:"translateY(100%)"},common:{transformOrigin:"bottom"},transitionProperty:"transform, opacity"},"slide-left":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(100%)"},common:{transformOrigin:"left"},transitionProperty:"transform, opacity"},"slide-right":{in:{opacity:1,transform:"translateX(0)"},out:{opacity:0,transform:"translateX(-100%)"},common:{transformOrigin:"right"},transitionProperty:"transform, opacity"},pop:{...qo("bottom"),common:{transformOrigin:"center center"}},"pop-bottom-left":{...qo("bottom"),common:{transformOrigin:"bottom left"}},"pop-bottom-right":{...qo("bottom"),common:{transformOrigin:"bottom right"}},"pop-top-left":{...qo("top"),common:{transformOrigin:"top left"}},"pop-top-right":{...qo("top"),common:{transformOrigin:"top right"}}},_E={entering:"in",entered:"in",exiting:"out",exited:"out","pre-exiting":"out","pre-entering":"out"};function pY({transition:t,state:e,duration:n,timingFunction:r}){const i={WebkitBackfaceVisibility:"hidden",transitionDuration:`${n}ms`,transitionTimingFunction:r};return typeof t=="string"?t in eu?{transitionProperty:eu[t].transitionProperty,...i,...eu[t].common,...eu[t][_E[e]]}:{}:{transitionProperty:t.transitionProperty,...i,...t.common,...t[_E[e]]}}function mY({duration:t,exitDuration:e,timingFunction:n,mounted:r,onEnter:i,onExit:s,onEntered:o,onExited:a,enterDelay:l,exitDelay:u}){const c=on(),d=sW(),f=c.respectReducedMotion?d:!1,[h,p]=C.useState(f?0:t),[g,b]=C.useState(r?"entered":"exited"),y=C.useRef(-1),E=C.useRef(-1),T=C.useRef(-1);function v(){window.clearTimeout(y.current),window.clearTimeout(E.current),cancelAnimationFrame(T.current)}const R=O=>{v();const P=O?i:s,F=O?o:a,N=f?0:O?t:e;p(N),N===0?(typeof P=="function"&&P(),typeof F=="function"&&F(),b(O?"entered":"exited")):T.current=requestAnimationFrame(()=>{BE.flushSync(()=>{b(O?"pre-entering":"pre-exiting")}),T.current=requestAnimationFrame(()=>{typeof P=="function"&&P(),b(O?"entering":"exiting"),y.current=window.setTimeout(()=>{typeof F=="function"&&F(),b(O?"entered":"exited")},N)})})},A=O=>{if(v(),typeof(O?l:u)!="number"){R(O);return}E.current=window.setTimeout(()=>{R(O)},O?l:u)};return ja(()=>{A(r)},[r]),C.useEffect(()=>()=>{v()},[]),{transitionDuration:h,transitionStatus:g,transitionTimingFunction:n||"ease"}}function hi({keepMounted:t,transition:e="fade",duration:n=250,exitDuration:r=n,mounted:i,children:s,timingFunction:o="ease",onExit:a,onEntered:l,onEnter:u,onExited:c,enterDelay:d,exitDelay:f}){const h=hd(),{transitionDuration:p,transitionStatus:g,transitionTimingFunction:b}=mY({mounted:i,exitDuration:r,duration:n,timingFunction:o,onExit:a,onEntered:l,onEnter:u,onExited:c,enterDelay:d,exitDelay:f});return p===0||h==="test"?i?M.jsx(M.Fragment,{children:s({})}):t?s({display:"none"}):null:g==="exited"?t?s({display:"none"}):null:M.jsx(M.Fragment,{children:s(pY({transition:e,duration:p,state:g,timingFunction:b}))})}hi.displayName="@mantine/core/Transition";const[gY,pA]=cd("Popover component was not found in the tree");var mA={dropdown:"m_38a85659",arrow:"m_a31dc6c1",overlay:"m_3d7bc908"};function C0({children:t,active:e=!0,refProp:n="ref",innerRef:r}){const i=tW(e),s=Zn(i,r),o=El(t);return o?C.cloneElement(o,{[n]:s}):t}function gA(t){return M.jsx(E0,{tabIndex:-1,"data-autofocus":!0,...t})}C0.displayName="@mantine/core/FocusTrap";gA.displayName="@mantine/core/FocusTrapInitialFocus";C0.InitialFocus=gA;const x0=Ie((t,e)=>{const n=re("PopoverDropdown",null,t),{className:r,style:i,vars:s,children:o,onKeyDownCapture:a,variant:l,classNames:u,styles:c,...d}=n,f=pA(),h=Gj({opened:f.opened,shouldReturnFocus:f.returnFocus}),p=f.withRoles?{"aria-labelledby":f.getTargetId(),id:f.getDropdownId(),role:"dialog",tabIndex:-1}:{},g=Zn(e,f.floating);return f.disabled?null:M.jsx(uo,{...f.portalProps,withinPortal:f.withinPortal,children:M.jsx(hi,{mounted:f.opened,...f.transitionProps,transition:f.transitionProps?.transition||"fade",duration:f.transitionProps?.duration??150,keepMounted:f.keepMounted,exitDuration:typeof f.transitionProps?.exitDuration=="number"?f.transitionProps.exitDuration:f.transitionProps?.duration,children:b=>M.jsx(C0,{active:f.trapFocus&&f.opened,innerRef:g,children:M.jsxs(pe,{...p,...d,variant:l,onKeyDownCapture:Uj(()=>{f.onClose?.(),f.onDismiss?.()},{active:f.closeOnEscape,onTrigger:h,onKeyDown:a}),"data-position":f.placement,"data-fixed":f.floatingStrategy==="fixed"||void 0,...f.getStyles("dropdown",{className:r,props:n,classNames:u,styles:c,style:[{...b,zIndex:f.zIndex,top:f.y??0,left:f.x??0,width:f.width==="target"?void 0:Y(f.width),...f.referenceHidden?{display:"none"}:null},f.resolvedStyles.dropdown,c?.dropdown,i]}),children:[o,M.jsx(Tc,{ref:f.arrowRef,arrowX:f.arrowX,arrowY:f.arrowY,visible:f.withArrow,position:f.placement,arrowSize:f.arrowSize,arrowRadius:f.arrowRadius,arrowOffset:f.arrowOffset,arrowPosition:f.arrowPosition,...f.getStyles("arrow",{props:n,classNames:u,styles:c})})]})})})})});x0.classes=mA;x0.displayName="@mantine/core/PopoverDropdown";const bY={refProp:"ref",popupType:"dialog"},bA=Ie((t,e)=>{const{children:n,refProp:r,popupType:i,...s}=re("PopoverTarget",bY,t),o=El(n);if(!o)throw new Error("Popover.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const a=s,l=pA(),u=Zn(l.reference,l0(o),e),c=l.withRoles?{"aria-haspopup":i,"aria-expanded":l.opened,"aria-controls":l.opened?l.getDropdownId():void 0,id:l.getTargetId()}:{},d=o.props;return C.cloneElement(o,{...a,...c,...l.targetProps,className:Br(l.targetProps.className,a.className,d.className),[r]:u,...l.controlled?null:{onClick:()=>{l.onToggle(),d.onClick?.()}}})});bA.displayName="@mantine/core/PopoverTarget";function yY(t){if(t===void 0)return{shift:!0,flip:!0};const e={...t};return t.shift===void 0&&(e.shift=!0),t.flip===void 0&&(e.flip=!0),e}function EY(t,e,n){const r=yY(t.middlewares),i=[FE(t.offset),e3()];return t.dropdownVisible&&n!=="test"&&t.preventPositionChangeWhenVisible&&(r.flip=!1),r.flip&&i.push(typeof r.flip=="boolean"?xu():xu(r.flip)),r.shift&&i.push(wp(typeof r.shift=="boolean"?{limiter:Y0(),padding:5}:{limiter:Y0(),padding:5,...r.shift})),r.inline&&i.push(typeof r.inline=="boolean"?Zo():Zo(r.inline)),i.push(HE({element:t.arrowRef,padding:t.arrowOffset})),(r.size||t.width==="target")&&i.push(t3({...typeof r.size=="boolean"?{}:r.size,apply({rects:s,availableWidth:o,availableHeight:a,...l}){const c=e().refs.floating.current?.style??{};r.size&&(typeof r.size=="object"&&r.size.apply?r.size.apply({rects:s,availableWidth:o,availableHeight:a,...l}):Object.assign(c,{maxWidth:`${o}px`,maxHeight:`${a}px`})),t.width==="target"&&Object.assign(c,{width:`${s.reference.width}px`})}})),i}function TY(t){const e=hd(),[n,r]=vo({value:t.opened,defaultValue:t.defaultOpened,finalValue:!1,onChange:t.onChange}),i=C.useRef(n),s=()=>{n&&!t.disabled&&r(!1)},o=()=>{t.disabled||r(!n)},a=y0({strategy:t.strategy,placement:t.preventPositionChangeWhenVisible?t.positionRef.current:t.position,middleware:EY(t,()=>a,e),whileElementsMounted:t.keepMounted?void 0:nh});return C.useEffect(()=>{if(!(!a.refs.reference.current||!a.refs.floating.current)&&n)return nh(a.refs.reference.current,a.refs.floating.current,a.update)},[n,a.update]),ja(()=>{t.onPositionChange?.(a.placement),t.positionRef.current=a.placement},[a.placement,t.preventPositionChangeWhenVisible]),ja(()=>{n!==i.current&&(n?t.onOpen?.():t.onClose?.()),i.current=n},[n,t.onClose,t.onOpen]),yl(()=>{let l=-1;return n&&(l=window.setTimeout(()=>t.setDropdownVisible(!0),4)),()=>{window.clearTimeout(l)}},[n,t.position]),{floating:a,controlled:typeof t.opened=="boolean",opened:n,onClose:s,onToggle:o}}const CY={position:"bottom",offset:8,positionDependencies:[],transitionProps:{transition:"fade",duration:150},middlewares:{flip:!0,shift:!0,inline:!1},arrowSize:7,arrowOffset:5,arrowRadius:0,arrowPosition:"side",closeOnClickOutside:!0,withinPortal:!0,closeOnEscape:!0,trapFocus:!1,withRoles:!0,returnFocus:!1,withOverlay:!1,hideDetached:!0,clickOutsideEvents:["mousedown","touchstart"],zIndex:gl("popover"),__staticSelector:"Popover",width:"max-content"},xY=(t,{radius:e,shadow:n})=>({dropdown:{"--popover-radius":e===void 0?void 0:Dt(e),"--popover-shadow":Uk(n)}});function yr(t){const e=re("Popover",CY,t),{children:n,position:r,offset:i,onPositionChange:s,positionDependencies:o,opened:a,transitionProps:l,onExitTransitionEnd:u,onEnterTransitionEnd:c,width:d,middlewares:f,withArrow:h,arrowSize:p,arrowOffset:g,arrowRadius:b,arrowPosition:y,unstyled:E,classNames:T,styles:v,closeOnClickOutside:R,withinPortal:A,portalProps:O,closeOnEscape:P,clickOutsideEvents:F,trapFocus:N,onClose:U,onDismiss:j,onOpen:z,onChange:I,zIndex:B,radius:Z,shadow:H,id:D,defaultOpened:V,__staticSelector:x,withRoles:ne,disabled:G,returnFocus:w,variant:me,keepMounted:te,vars:le,floatingStrategy:Ne,withOverlay:ye,overlayProps:ge,hideDetached:De,attributes:qe,preventPositionChangeWhenVisible:oe,...ie}=e,fe=_e({name:x,props:e,classes:mA,classNames:T,styles:v,unstyled:E,attributes:qe,rootSelector:"dropdown",vars:le,varsResolver:xY}),{resolvedStyles:Me}=pd({classNames:T,styles:v,props:e}),[Fe,Ce]=C.useState(a??V??!1),lt=C.useRef(r),Be=C.useRef(null),[Qe,Tn]=C.useState(null),[Cn,an]=C.useState(null),{dir:xn}=No(),rs=hd(),W=Ao(D),X=TY({middlewares:f,width:d,position:dA(xn,r),offset:typeof i=="number"?i+(h?p/2:0):i,arrowRef:Be,arrowOffset:g,onPositionChange:s,positionDependencies:o,opened:a,defaultOpened:V,onChange:I,onOpen:z,onClose:U,onDismiss:j,strategy:Ne,dropdownVisible:Fe,setDropdownVisible:Ce,positionRef:lt,disabled:G,preventPositionChangeWhenVisible:oe,keepMounted:te});Wj(()=>{R&&(X.onClose(),j?.())},F,[Qe,Cn]);const be=C.useCallback(Pt=>{Tn(Pt),X.floating.refs.setReference(Pt)},[X.floating.refs.setReference]),ke=C.useCallback(Pt=>{an(Pt),X.floating.refs.setFloating(Pt)},[X.floating.refs.setFloating]),Pe=C.useCallback(()=>{l?.onExited?.(),u?.(),Ce(!1),oe||(lt.current=r)},[l?.onExited,u,oe,r]),ln=C.useCallback(()=>{l?.onEntered?.(),c?.()},[l?.onEntered,c]);return M.jsxs(gY,{value:{returnFocus:w,disabled:G,controlled:X.controlled,reference:be,floating:ke,x:X.floating.x,y:X.floating.y,arrowX:X.floating?.middlewareData?.arrow?.x,arrowY:X.floating?.middlewareData?.arrow?.y,opened:X.opened,arrowRef:Be,transitionProps:{...l,onExited:Pe,onEntered:ln},width:d,withArrow:h,arrowSize:p,arrowOffset:g,arrowRadius:b,arrowPosition:y,placement:X.floating.placement,trapFocus:N,withinPortal:A,portalProps:O,zIndex:B,radius:Z,shadow:H,closeOnEscape:P,onDismiss:j,onClose:X.onClose,onToggle:X.onToggle,getTargetId:()=>`${W}-target`,getDropdownId:()=>`${W}-dropdown`,withRoles:ne,targetProps:ie,__staticSelector:x,classNames:T,styles:v,unstyled:E,variant:me,keepMounted:te,getStyles:fe,resolvedStyles:Me,floatingStrategy:Ne,referenceHidden:De&&rs!=="test"?X.floating.middlewareData.hide?.referenceHidden:!1},children:[n,ye&&M.jsx(hi,{transition:"fade",mounted:X.opened,duration:l?.duration||250,exitDuration:l?.exitDuration||250,children:Pt=>M.jsx(uo,{withinPortal:A,children:M.jsx(Ya,{...ge,...fe("overlay",{className:ge?.className,style:[Pt,ge?.style]})})})})]})}yr.Target=bA;yr.Dropdown=x0;yr.displayName="@mantine/core/Popover";yr.extend=t=>t;var Un={root:"m_5ae2e3c",barsLoader:"m_7a2bd4cd",bar:"m_870bb79","bars-loader-animation":"m_5d2b3b9d",dotsLoader:"m_4e3f22d7",dot:"m_870c4af","loader-dots-animation":"m_aac34a1",ovalLoader:"m_b34414df","oval-loader-animation":"m_f8e89c4b"};const yA=C.forwardRef(({className:t,...e},n)=>M.jsxs(pe,{component:"span",className:Br(Un.barsLoader,t),...e,ref:n,children:[M.jsx("span",{className:Un.bar}),M.jsx("span",{className:Un.bar}),M.jsx("span",{className:Un.bar})]}));yA.displayName="@mantine/core/Bars";const EA=C.forwardRef(({className:t,...e},n)=>M.jsxs(pe,{component:"span",className:Br(Un.dotsLoader,t),...e,ref:n,children:[M.jsx("span",{className:Un.dot}),M.jsx("span",{className:Un.dot}),M.jsx("span",{className:Un.dot})]}));EA.displayName="@mantine/core/Dots";const TA=C.forwardRef(({className:t,...e},n)=>M.jsx(pe,{component:"span",className:Br(Un.ovalLoader,t),...e,ref:n}));TA.displayName="@mantine/core/Oval";const CA={bars:yA,oval:TA,dots:EA},SY={loaders:CA,type:"oval"},wY=(t,{size:e,color:n})=>({root:{"--loader-size":je(e,"loader-size"),"--loader-color":n?Pr(n,t):void 0}}),Io=Ie((t,e)=>{const n=re("Loader",SY,t),{size:r,color:i,type:s,vars:o,className:a,style:l,classNames:u,styles:c,unstyled:d,loaders:f,variant:h,children:p,attributes:g,...b}=n,y=_e({name:"Loader",props:n,classes:Un,className:a,style:l,classNames:u,styles:c,unstyled:d,attributes:g,vars:o,varsResolver:wY});return p?M.jsx(pe,{...y("root"),ref:e,...b,children:p}):M.jsx(pe,{...y("root"),ref:e,component:f[s],variant:h,size:r,...b})});Io.defaultLoaders=CA;Io.classes=Un;Io.displayName="@mantine/core/Loader";var Ro={root:"m_8d3f4000",icon:"m_8d3afb97",loader:"m_302b9fb1",group:"m_1a0f1b21",groupSection:"m_437b6484"};const IE={orientation:"horizontal"},kY=(t,{borderWidth:e})=>({group:{"--ai-border-width":Y(e)}}),S0=Ie((t,e)=>{const n=re("ActionIconGroup",IE,t),{className:r,style:i,classNames:s,styles:o,unstyled:a,orientation:l,vars:u,borderWidth:c,variant:d,mod:f,attributes:h,...p}=re("ActionIconGroup",IE,t),g=_e({name:"ActionIconGroup",props:n,classes:Ro,className:r,style:i,classNames:s,styles:o,unstyled:a,attributes:h,vars:u,varsResolver:kY,rootSelector:"group"});return M.jsx(pe,{...g("group"),ref:e,variant:d,mod:[{"data-orientation":l},f],role:"group",...p})});S0.classes=Ro;S0.displayName="@mantine/core/ActionIconGroup";const AY=(t,{radius:e,color:n,gradient:r,variant:i,autoContrast:s,size:o})=>{const a=t.variantColorResolver({color:n||t.primaryColor,theme:t,gradient:r,variant:i||"filled",autoContrast:s});return{groupSection:{"--section-height":je(o,"section-height"),"--section-padding-x":je(o,"section-padding-x"),"--section-fz":rn(o),"--section-radius":e===void 0?void 0:Dt(e),"--section-bg":n||i?a.background:void 0,"--section-color":a.color,"--section-bd":n||i?a.border:void 0}}},w0=Ie((t,e)=>{const n=re("ActionIconGroupSection",null,t),{className:r,style:i,classNames:s,styles:o,unstyled:a,vars:l,variant:u,gradient:c,radius:d,autoContrast:f,attributes:h,...p}=n,g=_e({name:"ActionIconGroupSection",props:n,classes:Ro,className:r,style:i,classNames:s,styles:o,unstyled:a,attributes:h,vars:l,varsResolver:AY,rootSelector:"groupSection"});return M.jsx(pe,{...g("groupSection"),ref:e,variant:u,...p})});w0.classes=Ro;w0.displayName="@mantine/core/ActionIconGroupSection";const vY=(t,{size:e,radius:n,variant:r,gradient:i,color:s,autoContrast:o})=>{const a=t.variantColorResolver({color:s||t.primaryColor,theme:t,gradient:i,variant:r||"filled",autoContrast:o});return{root:{"--ai-size":je(e,"ai-size"),"--ai-radius":n===void 0?void 0:Dt(n),"--ai-bg":s||r?a.background:void 0,"--ai-hover":s||r?a.hover:void 0,"--ai-hover-color":s||r?a.hoverColor:void 0,"--ai-color":a.color,"--ai-bd":s||r?a.border:void 0}}},bd=Lt((t,e)=>{const n=re("ActionIcon",null,t),{className:r,unstyled:i,variant:s,classNames:o,styles:a,style:l,loading:u,loaderProps:c,size:d,color:f,radius:h,__staticSelector:p,gradient:g,vars:b,children:y,disabled:E,"data-disabled":T,autoContrast:v,mod:R,attributes:A,...O}=n,P=_e({name:["ActionIcon",p],props:n,className:r,style:l,classes:Ro,classNames:o,styles:a,unstyled:i,attributes:A,vars:b,varsResolver:vY});return M.jsxs(yi,{...P("root",{active:!E&&!u&&!T}),...O,unstyled:i,variant:s,size:d,disabled:E||u,ref:e,mod:[{loading:u,disabled:E||T},R],children:[typeof u=="boolean"&&M.jsx(hi,{mounted:u,transition:"slide-down",duration:150,children:F=>M.jsx(pe,{component:"span",...P("loader",{style:F}),"aria-hidden":!0,children:M.jsx(Io,{color:"var(--ai-color)",size:"calc(var(--ai-size) * 0.55)",...c})})}),M.jsx(pe,{component:"span",mod:{loading:u},...P("icon"),children:y})]})});bd.classes=Ro;bd.displayName="@mantine/core/ActionIcon";bd.Group=S0;bd.GroupSection=w0;const xA=C.forwardRef(({size:t="var(--cb-icon-size, 70%)",style:e,...n},r)=>M.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...e,width:t,height:t},ref:r,...n,children:M.jsx("path",{d:"M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})}));xA.displayName="@mantine/core/CloseIcon";var SA={root:"m_86a44da5","root--subtle":"m_220c80f2"};const NY={variant:"subtle"},_Y=(t,{size:e,radius:n,iconSize:r})=>({root:{"--cb-size":je(e,"cb-size"),"--cb-radius":n===void 0?void 0:Dt(n),"--cb-icon-size":Y(r)}}),yd=Lt((t,e)=>{const n=re("CloseButton",NY,t),{iconSize:r,children:i,vars:s,radius:o,className:a,classNames:l,style:u,styles:c,unstyled:d,"data-disabled":f,disabled:h,variant:p,icon:g,mod:b,attributes:y,__staticSelector:E,...T}=n,v=_e({name:E||"CloseButton",props:n,className:a,style:u,classes:SA,classNames:l,styles:c,unstyled:d,attributes:y,vars:s,varsResolver:_Y});return M.jsxs(yi,{ref:e,...T,unstyled:d,variant:p,disabled:h,mod:[{disabled:h||f},b],...v("root",{variant:p,active:!h&&!f}),children:[g||M.jsx(xA,{}),i]})});yd.classes=SA;yd.displayName="@mantine/core/CloseButton";function IY(t){return C.Children.toArray(t).filter(Boolean)}var wA={root:"m_4081bf90"};const RY={preventGrowOverflow:!0,gap:"md",align:"center",justify:"flex-start",wrap:"wrap"},MY=(t,{grow:e,preventGrowOverflow:n,gap:r,align:i,justify:s,wrap:o},{childWidth:a})=>({root:{"--group-child-width":e&&n?a:void 0,"--group-gap":bl(r),"--group-align":i,"--group-justify":s,"--group-wrap":o}}),kA=Ie((t,e)=>{const n=re("Group",RY,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,children:l,gap:u,align:c,justify:d,wrap:f,grow:h,preventGrowOverflow:p,vars:g,variant:b,__size:y,mod:E,attributes:T,...v}=n,R=IY(l),A=R.length,O=bl(u??"md"),F={childWidth:`calc(${100/A}% - (${O} - ${O} / ${A}))`},N=_e({name:"Group",props:n,stylesCtx:F,className:i,style:s,classes:wA,classNames:r,styles:o,unstyled:a,attributes:T,vars:g,varsResolver:MY});return M.jsx(pe,{...N("root"),ref:e,variant:b,mod:[{grow:h},E],size:y,...v,children:R})});kA.classes=wA;kA.displayName="@mantine/core/Group";const[OY,DY]=dd({size:"sm"});var Ln={wrapper:"m_6c018570",input:"m_8fb7ebe7",section:"m_82577fc2",placeholder:"m_88bacfd0",root:"m_46b77525",label:"m_8fdc1311",required:"m_78a94662",error:"m_8f816625",description:"m_fe47ce59"};const AA=Ie((t,e)=>{const n=re("InputClearButton",null,t),{size:r,variant:i,vars:s,classNames:o,styles:a,...l}=n,u=DY(),{resolvedClassNames:c,resolvedStyles:d}=pd({classNames:o,styles:a,props:n});return M.jsx(yd,{variant:i||"transparent",ref:e,size:r||u?.size||"sm",classNames:c,styles:d,__staticSelector:"InputClearButton",style:{pointerEvents:"all",background:"var(--input-bg)",...l.style},...l})});AA.displayName="@mantine/core/InputClearButton";const LY={xs:7,sm:8,md:10,lg:12,xl:15};function PY({__clearable:t,__clearSection:e,rightSection:n,__defaultRightSection:r,size:i="sm"}){const s=t&&e;return s&&(n||r)?M.jsxs("div",{"data-combined-clear-section":!0,style:{display:"flex",gap:2,alignItems:"center",paddingInlineEnd:LY[i]},children:[s,n||r]}):n===null?null:n||s||r}const[BY,Ed]=dd({offsetBottom:!1,offsetTop:!1,describedBy:void 0,getStyles:null,inputId:void 0,labelId:void 0}),FY=(t,{size:e})=>({description:{"--input-description-size":e===void 0?void 0:`calc(${rn(e)} - ${Y(2)})`}}),Td=Ie((t,e)=>{const n=re("InputDescription",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,size:u,__staticSelector:c,__inheritStyles:d=!0,attributes:f,variant:h,...p}=re("InputDescription",null,n),g=Ed(),b=_e({name:["InputWrapper",c],props:n,classes:Ln,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:f,rootSelector:"description",vars:l,varsResolver:FY}),y=d&&g?.getStyles||b;return M.jsx(pe,{component:"p",ref:e,variant:h,size:u,...y("description",g?.getStyles?{className:i,style:s}:void 0),...p})});Td.classes=Ln;Td.displayName="@mantine/core/InputDescription";const HY=(t,{size:e})=>({error:{"--input-error-size":e===void 0?void 0:`calc(${rn(e)} - ${Y(2)})`}}),Cd=Ie((t,e)=>{const n=re("InputError",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,size:u,attributes:c,__staticSelector:d,__inheritStyles:f=!0,variant:h,...p}=n,g=_e({name:["InputWrapper",d],props:n,classes:Ln,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:c,rootSelector:"error",vars:l,varsResolver:HY}),b=Ed(),y=f&&b?.getStyles||g;return M.jsx(pe,{component:"p",ref:e,variant:h,size:u,...y("error",b?.getStyles?{className:i,style:s}:void 0),...p})});Cd.classes=Ln;Cd.displayName="@mantine/core/InputError";const RE={labelElement:"label"},UY=(t,{size:e})=>({label:{"--input-label-size":rn(e),"--input-asterisk-color":void 0}}),xd=Ie((t,e)=>{const n=re("InputLabel",RE,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,labelElement:u,size:c,required:d,htmlFor:f,onMouseDown:h,children:p,__staticSelector:g,variant:b,mod:y,attributes:E,...T}=re("InputLabel",RE,n),v=_e({name:["InputWrapper",g],props:n,classes:Ln,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:E,rootSelector:"label",vars:l,varsResolver:UY}),R=Ed(),A=R?.getStyles||v;return M.jsxs(pe,{...A("label",R?.getStyles?{className:i,style:s}:void 0),component:u,variant:b,size:c,ref:e,htmlFor:u==="label"?f:void 0,mod:[{required:d},y],onMouseDown:O=>{h?.(O),!O.defaultPrevented&&O.detail>1&&O.preventDefault()},...T,children:[p,d&&M.jsx("span",{...A("required"),"aria-hidden":!0,children:" *"})]})});xd.classes=Ln;xd.displayName="@mantine/core/InputLabel";const k0=Ie((t,e)=>{const n=re("InputPlaceholder",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,__staticSelector:u,variant:c,error:d,mod:f,attributes:h,...p}=n,g=_e({name:["InputPlaceholder",u],props:n,classes:Ln,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:h,rootSelector:"placeholder"});return M.jsx(pe,{...g("placeholder"),mod:[{error:!!d},f],component:"span",variant:c,ref:e,...p})});k0.classes=Ln;k0.displayName="@mantine/core/InputPlaceholder";function $Y(t,{hasDescription:e,hasError:n}){const r=t.findIndex(l=>l==="input"),i=t.slice(0,r),s=t.slice(r+1),o=e&&i.includes("description")||n&&i.includes("error");return{offsetBottom:e&&s.includes("description")||n&&s.includes("error"),offsetTop:o}}const VY={labelElement:"label",inputContainer:t=>t,inputWrapperOrder:["label","description","input","error"]},zY=(t,{size:e})=>({label:{"--input-label-size":rn(e),"--input-asterisk-color":void 0},error:{"--input-error-size":e===void 0?void 0:`calc(${rn(e)} - ${Y(2)})`},description:{"--input-description-size":e===void 0?void 0:`calc(${rn(e)} - ${Y(2)})`}}),A0=Ie((t,e)=>{const n=re("InputWrapper",VY,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,size:u,variant:c,__staticSelector:d,inputContainer:f,inputWrapperOrder:h,label:p,error:g,description:b,labelProps:y,descriptionProps:E,errorProps:T,labelElement:v,children:R,withAsterisk:A,id:O,required:P,__stylesApiProps:F,mod:N,attributes:U,...j}=n,z=_e({name:["InputWrapper",d],props:F||n,classes:Ln,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:U,vars:l,varsResolver:zY}),I={size:u,variant:c,__staticSelector:d},B=Ao(O),Z=typeof A=="boolean"?A:P,H=T?.id||`${B}-error`,D=E?.id||`${B}-description`,V=B,x=!!g&&typeof g!="boolean",ne=!!b,G=`${x?H:""} ${ne?D:""}`,w=G.trim().length>0?G.trim():void 0,me=y?.id||`${B}-label`,te=p&&M.jsx(xd,{labelElement:v,id:me,htmlFor:V,required:Z,...I,...y,children:p},"label"),le=ne&&M.jsx(Td,{...E,...I,size:E?.size||I.size,id:E?.id||D,children:b},"description"),Ne=M.jsx(C.Fragment,{children:f(R)},"input"),ye=x&&C.createElement(Cd,{...T,...I,size:T?.size||I.size,key:"error",id:T?.id||H},g),ge=h.map(De=>{switch(De){case"label":return te;case"input":return Ne;case"description":return le;case"error":return ye;default:return null}});return M.jsx(BY,{value:{getStyles:z,describedBy:w,inputId:V,labelId:me,...$Y(h,{hasDescription:ne,hasError:x})},children:M.jsx(pe,{ref:e,variant:c,size:u,mod:[{error:!!g},N],...z("root"),...j,children:ge})})});A0.classes=Ln;A0.displayName="@mantine/core/InputWrapper";const jY={variant:"default",leftSectionPointerEvents:"none",rightSectionPointerEvents:"none",withAria:!0,withErrorStyles:!0,size:"sm"},WY=(t,e,n)=>({wrapper:{"--input-margin-top":n.offsetTop?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-margin-bottom":n.offsetBottom?"calc(var(--mantine-spacing-xs) / 2)":void 0,"--input-height":je(e.size,"input-height"),"--input-fz":rn(e.size),"--input-radius":e.radius===void 0?void 0:Dt(e.radius),"--input-left-section-width":e.leftSectionWidth!==void 0?Y(e.leftSectionWidth):void 0,"--input-right-section-width":e.rightSectionWidth!==void 0?Y(e.rightSectionWidth):void 0,"--input-padding-y":e.multiline?je(e.size,"input-padding-y"):void 0,"--input-left-section-pointer-events":e.leftSectionPointerEvents,"--input-right-section-pointer-events":e.rightSectionPointerEvents}}),En=Lt((t,e)=>{const n=re("Input",jY,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,required:l,__staticSelector:u,__stylesApiProps:c,size:d,wrapperProps:f,error:h,disabled:p,leftSection:g,leftSectionProps:b,leftSectionWidth:y,rightSection:E,rightSectionProps:T,rightSectionWidth:v,rightSectionPointerEvents:R,leftSectionPointerEvents:A,variant:O,vars:P,pointer:F,multiline:N,radius:U,id:j,withAria:z,withErrorStyles:I,mod:B,inputSize:Z,attributes:H,__clearSection:D,__clearable:V,__defaultRightSection:x,...ne}=n,{styleProps:G,rest:w}=md(ne),me=Ed(),te={offsetBottom:me?.offsetBottom,offsetTop:me?.offsetTop},le=_e({name:["Input",u],props:c||n,classes:Ln,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:H,stylesCtx:te,rootSelector:"wrapper",vars:P,varsResolver:WY}),Ne=z?{required:l,disabled:p,"aria-invalid":!!h,"aria-describedby":me?.describedBy,id:me?.inputId||j}:{},ye=PY({__clearable:V,__clearSection:D,rightSection:E,__defaultRightSection:x,size:d});return M.jsx(OY,{value:{size:d||"sm"},children:M.jsxs(pe,{...le("wrapper"),...G,...f,mod:[{error:!!h&&I,pointer:F,disabled:p,multiline:N,"data-with-right-section":!!ye,"data-with-left-section":!!g},B],variant:O,size:d,children:[g&&M.jsx("div",{...b,"data-position":"left",...le("section",{className:b?.className,style:b?.style}),children:g}),M.jsx(pe,{component:"input",...w,...Ne,ref:e,required:l,mod:{disabled:p,error:!!h&&I},variant:O,__size:Z,...le("input")}),ye&&M.jsx("div",{...T,"data-position":"right",...le("section",{className:T?.className,style:T?.style}),children:ye})]})})});En.classes=Ln;En.Wrapper=A0;En.Label=xd;En.Error=Cd;En.Description=Td;En.Placeholder=k0;En.ClearButton=AA;En.displayName="@mantine/core/Input";function qY(t,e,n){const r=re(t,e,n),{label:i,description:s,error:o,required:a,classNames:l,styles:u,className:c,unstyled:d,__staticSelector:f,__stylesApiProps:h,errorProps:p,labelProps:g,descriptionProps:b,wrapperProps:y,id:E,size:T,style:v,inputContainer:R,inputWrapperOrder:A,withAsterisk:O,variant:P,vars:F,mod:N,attributes:U,...j}=r,{styleProps:z,rest:I}=md(j),B={label:i,description:s,error:o,required:a,classNames:l,className:c,__staticSelector:f,__stylesApiProps:h||r,errorProps:p,labelProps:g,descriptionProps:b,unstyled:d,styles:u,size:T,style:v,inputContainer:R,inputWrapperOrder:A,withAsterisk:O,variant:P,id:E,mod:N,attributes:U,...y};return{...I,classNames:l,styles:u,unstyled:d,wrapperProps:{...B,...z},inputProps:{required:a,classNames:l,styles:u,unstyled:d,size:T,__staticSelector:f,__stylesApiProps:h||r,error:o,variant:P,id:E,attributes:U}}}const YY={__staticSelector:"InputBase",withAria:!0,size:"sm"},Mo=Lt((t,e)=>{const{inputProps:n,wrapperProps:r,...i}=qY("InputBase",YY,t);return M.jsx(En.Wrapper,{...r,children:M.jsx(En,{...n,...i,ref:e})})});Mo.classes={...En.classes,...En.Wrapper.classes};Mo.displayName="@mantine/core/InputBase";const KY={gap:{type:"spacing",property:"gap"},rowGap:{type:"spacing",property:"rowGap"},columnGap:{type:"spacing",property:"columnGap"},align:{type:"identity",property:"alignItems"},justify:{type:"identity",property:"justifyContent"},wrap:{type:"identity",property:"flexWrap"},direction:{type:"identity",property:"flexDirection"}};var vA={root:"m_8bffd616"};const NA=Lt((t,e)=>{const n=re("Flex",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,gap:u,rowGap:c,columnGap:d,align:f,justify:h,wrap:p,direction:g,attributes:b,...y}=n,E=_e({name:"Flex",classes:vA,props:n,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:b,vars:l}),T=on(),v=Zk(),R=Qk({styleProps:{gap:u,rowGap:c,columnGap:d,align:f,justify:h,wrap:p,direction:g},theme:T,data:KY});return M.jsxs(M.Fragment,{children:[R.hasResponsiveStyles&&M.jsx(Xk,{selector:`.${v}`,styles:R.styles,media:R.media}),M.jsx(pe,{ref:e,...E("root",{className:v,style:ud(R.inlineStyles)}),...y})]})});NA.classes=vA;NA.displayName="@mantine/core/Flex";function _A({open:t,close:e,openDelay:n,closeDelay:r}){const i=C.useRef(-1),s=C.useRef(-1),o=()=>{window.clearTimeout(i.current),window.clearTimeout(s.current)},a=()=>{o(),n===0||n===void 0?t():i.current=window.setTimeout(t,n)},l=()=>{o(),r===0||r===void 0?e():s.current=window.setTimeout(e,r)};return C.useEffect(()=>o,[]),{openDropdown:a,closeDropdown:l}}function IA({style:t,size:e=16,...n}){return M.jsx("svg",{viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{...t,width:Y(e),height:Y(e),display:"block"},...n,children:M.jsx("path",{d:"M3.13523 6.15803C3.3241 5.95657 3.64052 5.94637 3.84197 6.13523L7.5 9.56464L11.158 6.13523C11.3595 5.94637 11.6759 5.95657 11.8648 6.15803C12.0536 6.35949 12.0434 6.67591 11.842 6.86477L7.84197 10.6148C7.64964 10.7951 7.35036 10.7951 7.15803 10.6148L3.15803 6.86477C2.95657 6.67591 2.94637 6.35949 3.13523 6.15803Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}IA.displayName="@mantine/core/AccordionChevron";var RA={root:"m_b6d8b162"};function GY(t){if(t==="start")return"start";if(t==="end"||t)return"end"}const XY={inherit:!1},QY=(t,{variant:e,lineClamp:n,gradient:r,size:i,color:s})=>({root:{"--text-fz":rn(i),"--text-lh":$j(i),"--text-gradient":e==="gradient"?bp(r,t):void 0,"--text-line-clamp":typeof n=="number"?n.toString():void 0,"--text-color":s?Pr(s,t):void 0}}),MA=Lt((t,e)=>{const n=re("Text",XY,t),{lineClamp:r,truncate:i,inline:s,inherit:o,gradient:a,span:l,__staticSelector:u,vars:c,className:d,style:f,classNames:h,styles:p,unstyled:g,variant:b,mod:y,size:E,attributes:T,...v}=n,R=_e({name:["Text",u],props:n,classes:RA,className:d,style:f,classNames:h,styles:p,unstyled:g,attributes:T,vars:c,varsResolver:QY});return M.jsx(pe,{...R("root",{focusable:!0}),ref:e,component:l?"span":"p",variant:b,mod:[{"data-truncate":GY(i),"data-line-clamp":typeof r=="number","data-inline":s,"data-inherit":o},y],size:E,...v})});MA.classes=RA;MA.displayName="@mantine/core/Text";function ZY({size:t,style:e,...n}){const r=t!==void 0?{width:Y(t),height:Y(t),...e}:e;return M.jsx("svg",{viewBox:"0 0 10 7",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:r,"aria-hidden":!0,...n,children:M.jsx("path",{d:"M4 4.586L1.707 2.293A1 1 0 1 0 .293 3.707l3 3a.997.997 0 0 0 1.414 0l5-5A1 1 0 1 0 8.293.293L4 4.586z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}var Sd={group:"m_11def92b",root:"m_f85678b6",image:"m_11f8ac07",placeholder:"m_104cd71f"};const OA=C.createContext(null),JY=OA.Provider;function eK(){return{withinGroup:!!C.useContext(OA)}}const tK=(t,{spacing:e})=>({group:{"--ag-spacing":bl(e)}}),v0=Ie((t,e)=>{const n=re("AvatarGroup",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,spacing:u,attributes:c,...d}=n,f=_e({name:"AvatarGroup",classes:Sd,props:n,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:c,vars:l,varsResolver:tK,rootSelector:"group"});return M.jsx(JY,{value:!0,children:M.jsx(pe,{ref:e,...f("group"),...d})})});v0.classes=Sd;v0.displayName="@mantine/core/AvatarGroup";function nK(t){return M.jsx("svg",{...t,"data-avatar-placeholder-icon":!0,viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:M.jsx("path",{d:"M0.877014 7.49988C0.877014 3.84219 3.84216 0.877045 7.49985 0.877045C11.1575 0.877045 14.1227 3.84219 14.1227 7.49988C14.1227 11.1575 11.1575 14.1227 7.49985 14.1227C3.84216 14.1227 0.877014 11.1575 0.877014 7.49988ZM7.49985 1.82704C4.36683 1.82704 1.82701 4.36686 1.82701 7.49988C1.82701 8.97196 2.38774 10.3131 3.30727 11.3213C4.19074 9.94119 5.73818 9.02499 7.50023 9.02499C9.26206 9.02499 10.8093 9.94097 11.6929 11.3208C12.6121 10.3127 13.1727 8.97172 13.1727 7.49988C13.1727 4.36686 10.6328 1.82704 7.49985 1.82704ZM10.9818 11.9787C10.2839 10.7795 8.9857 9.97499 7.50023 9.97499C6.01458 9.97499 4.71624 10.7797 4.01845 11.9791C4.97952 12.7272 6.18765 13.1727 7.49985 13.1727C8.81227 13.1727 10.0206 12.727 10.9818 11.9787ZM5.14999 6.50487C5.14999 5.207 6.20212 4.15487 7.49999 4.15487C8.79786 4.15487 9.84999 5.207 9.84999 6.50487C9.84999 7.80274 8.79786 8.85487 7.49999 8.85487C6.20212 8.85487 5.14999 7.80274 5.14999 6.50487ZM7.49999 5.10487C6.72679 5.10487 6.09999 5.73167 6.09999 6.50487C6.09999 7.27807 6.72679 7.90487 7.49999 7.90487C8.27319 7.90487 8.89999 7.27807 8.89999 6.50487C8.89999 5.73167 8.27319 5.10487 7.49999 5.10487Z",fill:"currentColor",fillRule:"evenodd",clipRule:"evenodd"})})}function rK(t){let e=0;for(let n=0;n<t.length;n+=1){const r=t.charCodeAt(n);e=(e<<5)-e+r,e|=0}return e}const iK=["blue","cyan","grape","green","indigo","lime","orange","pink","red","teal","violet"];function sK(t,e=iK){const n=rK(t),r=Math.abs(n)%e.length;return e[r]}function oK(t,e=2){const n=t.split(" ");return n.length===1?t.slice(0,e).toUpperCase():n.map(r=>r[0]).slice(0,e).join("").toUpperCase()}const aK=(t,{size:e,radius:n,variant:r,gradient:i,color:s,autoContrast:o,name:a,allowedInitialsColors:l})=>{const u=s==="initials"&&typeof a=="string"?sK(a,l):s,c=t.variantColorResolver({color:u||"gray",theme:t,gradient:i,variant:r||"light",autoContrast:o});return{root:{"--avatar-size":je(e,"avatar-size"),"--avatar-radius":n===void 0?void 0:Dt(n),"--avatar-bg":u||r?c.background:void 0,"--avatar-color":u||r?c.color:void 0,"--avatar-bd":u||r?c.border:void 0}}},N0=Lt((t,e)=>{const n=re("Avatar",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,src:u,alt:c,radius:d,color:f,gradient:h,imageProps:p,children:g,autoContrast:b,mod:y,name:E,allowedInitialsColors:T,attributes:v,...R}=n,A=eK(),[O,P]=C.useState(!u),F=_e({name:"Avatar",props:n,classes:Sd,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:v,vars:l,varsResolver:aK});return C.useEffect(()=>P(!u),[u]),M.jsx(pe,{...F("root"),mod:[{"within-group":A.withinGroup},y],ref:e,...R,children:O||!u?M.jsx("span",{...F("placeholder"),title:c,children:g||typeof E=="string"&&oK(E)||M.jsx(nK,{})}):M.jsx("img",{...p,...F("image"),src:u,alt:c,onError:N=>{P(!0),p?.onError?.(N)}})})});N0.classes=Sd;N0.displayName="@mantine/core/Avatar";N0.Group=v0;var DA={root:"m_347db0ec","root--dot":"m_fbd81e3d",label:"m_5add502a",section:"m_91fdda9b"};const lK=(t,{radius:e,color:n,gradient:r,variant:i,size:s,autoContrast:o,circle:a})=>{const l=t.variantColorResolver({color:n||t.primaryColor,theme:t,gradient:r,variant:i||"filled",autoContrast:o});return{root:{"--badge-height":je(s,"badge-height"),"--badge-padding-x":je(s,"badge-padding-x"),"--badge-fz":je(s,"badge-fz"),"--badge-radius":a||e===void 0?void 0:Dt(e),"--badge-bg":n||i?l.background:void 0,"--badge-color":n||i?l.color:void 0,"--badge-bd":n||i?l.border:void 0,"--badge-dot-color":i==="dot"?Pr(n,t):void 0}}},LA=Lt((t,e)=>{const n=re("Badge",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,radius:u,color:c,gradient:d,leftSection:f,rightSection:h,children:p,variant:g,fullWidth:b,autoContrast:y,circle:E,mod:T,attributes:v,...R}=n,A=_e({name:"Badge",props:n,classes:DA,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:v,vars:l,varsResolver:lK});return M.jsxs(pe,{variant:g,mod:[{block:b,circle:E,"with-right-section":!!h,"with-left-section":!!f},T],...A("root",{variant:g}),ref:e,...R,children:[f&&M.jsx("span",{...A("section"),"data-position":"left",children:f}),M.jsx("span",{...A("label"),children:p}),h&&M.jsx("span",{...A("section"),"data-position":"right",children:h})]})});LA.classes=DA;LA.displayName="@mantine/core/Badge";var Oo={root:"m_77c9d27d",inner:"m_80f1301b",label:"m_811560b9",section:"m_a74036a",loader:"m_a25b86ee",group:"m_80d6d844",groupSection:"m_70be2a01"};const ME={orientation:"horizontal"},uK=(t,{borderWidth:e})=>({group:{"--button-border-width":Y(e)}}),_0=Ie((t,e)=>{const n=re("ButtonGroup",ME,t),{className:r,style:i,classNames:s,styles:o,unstyled:a,orientation:l,vars:u,borderWidth:c,variant:d,mod:f,attributes:h,...p}=re("ButtonGroup",ME,t),g=_e({name:"ButtonGroup",props:n,classes:Oo,className:r,style:i,classNames:s,styles:o,unstyled:a,attributes:h,vars:u,varsResolver:uK,rootSelector:"group"});return M.jsx(pe,{...g("group"),ref:e,variant:d,mod:[{"data-orientation":l},f],role:"group",...p})});_0.classes=Oo;_0.displayName="@mantine/core/ButtonGroup";const cK=(t,{radius:e,color:n,gradient:r,variant:i,autoContrast:s,size:o})=>{const a=t.variantColorResolver({color:n||t.primaryColor,theme:t,gradient:r,variant:i||"filled",autoContrast:s});return{groupSection:{"--section-height":je(o,"section-height"),"--section-padding-x":je(o,"section-padding-x"),"--section-fz":o?.includes("compact")?rn(o.replace("compact-","")):rn(o),"--section-radius":e===void 0?void 0:Dt(e),"--section-bg":n||i?a.background:void 0,"--section-color":a.color,"--section-bd":n||i?a.border:void 0}}},I0=Ie((t,e)=>{const n=re("ButtonGroupSection",null,t),{className:r,style:i,classNames:s,styles:o,unstyled:a,vars:l,variant:u,gradient:c,radius:d,autoContrast:f,attributes:h,...p}=n,g=_e({name:"ButtonGroupSection",props:n,classes:Oo,className:r,style:i,classNames:s,styles:o,unstyled:a,attributes:h,vars:l,varsResolver:cK,rootSelector:"groupSection"});return M.jsx(pe,{...g("groupSection"),ref:e,variant:u,...p})});I0.classes=Oo;I0.displayName="@mantine/core/ButtonGroupSection";const dK={in:{opacity:1,transform:`translate(-50%, calc(-50% + ${Y(1)}))`},out:{opacity:0,transform:"translate(-50%, -200%)"},common:{transformOrigin:"center"},transitionProperty:"transform, opacity"},fK=(t,{radius:e,color:n,gradient:r,variant:i,size:s,justify:o,autoContrast:a})=>{const l=t.variantColorResolver({color:n||t.primaryColor,theme:t,gradient:r,variant:i||"filled",autoContrast:a});return{root:{"--button-justify":o,"--button-height":je(s,"button-height"),"--button-padding-x":je(s,"button-padding-x"),"--button-fz":s?.includes("compact")?rn(s.replace("compact-","")):rn(s),"--button-radius":e===void 0?void 0:Dt(e),"--button-bg":n||i?l.background:void 0,"--button-hover":n||i?l.hover:void 0,"--button-color":l.color,"--button-bd":n||i?l.border:void 0,"--button-hover-color":n||i?l.hoverColor:void 0}}},wd=Lt((t,e)=>{const n=re("Button",null,t),{style:r,vars:i,className:s,color:o,disabled:a,children:l,leftSection:u,rightSection:c,fullWidth:d,variant:f,radius:h,loading:p,loaderProps:g,gradient:b,classNames:y,styles:E,unstyled:T,"data-disabled":v,autoContrast:R,mod:A,attributes:O,...P}=n,F=_e({name:"Button",props:n,classes:Oo,className:s,style:r,classNames:y,styles:E,unstyled:T,attributes:O,vars:i,varsResolver:fK}),N=!!u,U=!!c;return M.jsxs(yi,{ref:e,...F("root",{active:!a&&!p&&!v}),unstyled:T,variant:f,disabled:a||p,mod:[{disabled:a||v,loading:p,block:d,"with-left-section":N,"with-right-section":U},A],...P,children:[typeof p=="boolean"&&M.jsx(hi,{mounted:p,transition:dK,duration:150,children:j=>M.jsx(pe,{component:"span",...F("loader",{style:j}),"aria-hidden":!0,children:M.jsx(Io,{color:"var(--button-color)",size:"calc(var(--button-height) / 1.8)",...g})})}),M.jsxs("span",{...F("inner"),children:[u&&M.jsx(pe,{component:"span",...F("section"),mod:{position:"left"},children:u}),M.jsx(pe,{component:"span",mod:{loading:p},...F("label"),children:l}),c&&M.jsx(pe,{component:"span",...F("section"),mod:{position:"right"},children:c})]})]})});wd.classes=Oo;wd.displayName="@mantine/core/Button";wd.Group=_0;wd.GroupSection=I0;const[hK,pK]=cd("Card component was not found in tree");var R0={root:"m_e615b15f",section:"m_599a2148"};const kd=Lt((t,e)=>{const n=re("CardSection",null,t),{classNames:r,className:i,style:s,styles:o,vars:a,withBorder:l,inheritPadding:u,mod:c,...d}=n,f=pK();return M.jsx(pe,{ref:e,mod:[{"with-border":l,"inherit-padding":u},c],...f.getStyles("section",{className:i,style:s,styles:o,classNames:r}),...d})});kd.classes=R0;kd.displayName="@mantine/core/CardSection";const mK=(t,{padding:e})=>({root:{"--card-padding":bl(e)}}),M0=Lt((t,e)=>{const n=re("Card",null,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,children:u,padding:c,attributes:d,...f}=n,h=_e({name:"Card",props:n,classes:R0,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:d,vars:l,varsResolver:mK}),p=C.Children.toArray(u),g=p.map((b,y)=>typeof b=="object"&&b&&"type"in b&&b.type===kd?C.cloneElement(b,{"data-first-section":y===0||void 0,"data-last-section":y===p.length-1||void 0}):b);return M.jsx(hK,{value:{getStyles:h},children:M.jsx(T0,{ref:e,unstyled:a,...h("root"),...f,children:g})})});M0.classes=R0;M0.displayName="@mantine/core/Card";M0.Section=kd;var PA={root:"m_f59ffda3",label:"m_be049a53","label--outline":"m_3904c1af","label--filled":"m_fa109255","label--light":"m_f7e165c3",iconWrapper:"m_9ac86df9",checkIcon:"m_d6d72580",input:"m_bde07329"};const[gK,bK]=dd();function BA(t){const{value:e,defaultValue:n,onChange:r,multiple:i,children:s}=re("ChipGroup",null,t),[o,a]=vo({value:e,defaultValue:n,finalValue:i?[]:null,onChange:r}),l=c=>Array.isArray(o)?o.includes(c):c===o,u=c=>{const d=c.currentTarget.value;Array.isArray(o)?a(o.includes(d)?o.filter(f=>f!==d):[...o,d]):a(d)};return M.jsx(gK,{value:{isChipSelected:l,onChange:u,multiple:i},children:s})}BA.displayName="@mantine/core/ChipGroup";const yK={type:"checkbox"},EK=(t,{size:e,radius:n,variant:r,color:i,autoContrast:s})=>{const o=t.variantColorResolver({color:i||t.primaryColor,theme:t,variant:r||"filled",autoContrast:s});return{root:{"--chip-fz":rn(e),"--chip-size":je(e,"chip-size"),"--chip-radius":n===void 0?void 0:Dt(n),"--chip-checked-padding":je(e,"chip-checked-padding"),"--chip-padding":je(e,"chip-padding"),"--chip-icon-size":je(e,"chip-icon-size"),"--chip-bg":i||r?o.background:void 0,"--chip-hover":i||r?o.hover:void 0,"--chip-color":i||r?o.color:void 0,"--chip-bd":i||r?o.border:void 0,"--chip-spacing":je(e,"chip-spacing")}}},O0=Ie((t,e)=>{const n=re("Chip",yK,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,id:u,checked:c,defaultChecked:d,onChange:f,value:h,wrapperProps:p,type:g,disabled:b,children:y,size:E,variant:T,icon:v,rootRef:R,autoContrast:A,mod:O,attributes:P,...F}=n,N=_e({name:"Chip",classes:PA,props:n,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:P,vars:l,varsResolver:EK}),U=bK(),j=Ao(u),{styleProps:z,rest:I}=md(F),[B,Z]=vo({value:c,defaultValue:d,finalValue:!1,onChange:f}),H=U?{checked:U.isChipSelected(h),onChange:V=>{U.onChange(V),f?.(V.currentTarget.checked)},type:U.multiple?"checkbox":"radio"}:{},D=H.checked||B;return M.jsxs(pe,{size:E,variant:T,ref:R,mod:O,...N("root"),...z,...p,children:[M.jsx("input",{type:g,...N("input"),checked:D,onChange:V=>Z(V.currentTarget.checked),id:j,disabled:b,ref:e,value:h,...H,...I}),M.jsxs("label",{htmlFor:j,"data-checked":D||void 0,"data-disabled":b||void 0,...N("label",{variant:T||"filled"}),children:[D&&v!==null&&v!==!1&&M.jsx("span",{...N("iconWrapper"),children:v===void 0?M.jsx(ZY,{...N("checkIcon")}):v}),M.jsx("span",{children:y})]})]})});O0.classes=PA;O0.displayName="@mantine/core/Chip";O0.Group=BA;var FA={root:"m_3eebeb36",label:"m_9e365f20"};const TK={orientation:"horizontal"},CK=(t,{color:e,variant:n,size:r})=>({root:{"--divider-color":e?Pr(e,t):void 0,"--divider-border-style":n,"--divider-size":je(r,"divider-size")}}),HA=Ie((t,e)=>{const n=re("Divider",TK,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,color:u,orientation:c,label:d,labelPosition:f,mod:h,attributes:p,...g}=n,b=_e({name:"Divider",classes:FA,props:n,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:p,vars:l,varsResolver:CK});return M.jsx(pe,{ref:e,mod:[{orientation:c,"with-label":!!d},h],...b("root"),...g,role:"separator",children:d&&M.jsx(pe,{component:"span",mod:{position:f},...b("label"),children:d})})});HA.classes=FA;HA.displayName="@mantine/core/Divider";const xK={multiple:!1},UA=C.forwardRef((t,e)=>{const{onChange:n,children:r,multiple:i,accept:s,name:o,form:a,resetRef:l,disabled:u,capture:c,inputProps:d,...f}=re("FileButton",xK,t),h=C.useRef(null),p=()=>{!u&&h.current?.click()},g=y=>{if(y.currentTarget.files===null)return n(i?[]:null);n(i?Array.from(y.currentTarget.files):y.currentTarget.files[0]||null)};return yc(l,()=>{h.current&&(h.current.value="")}),M.jsxs(M.Fragment,{children:[M.jsx("input",{style:{display:"none"},type:"file",accept:s,multiple:i,onChange:g,ref:Zn(e,h),name:o,form:a,capture:c,...d}),r({onClick:p,...f})]})});UA.displayName="@mantine/core/FileButton";const SK=({value:t})=>M.jsx("div",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Array.isArray(t)?t.map(e=>e.name).join(", "):t?.name}),wK={valueComponent:SK,size:"sm"},D0=Ie((t,e)=>{const n=re("FileInput",wK,t),{unstyled:r,vars:i,onChange:s,value:o,defaultValue:a,multiple:l,accept:u,name:c,form:d,valueComponent:f,clearable:h,clearButtonProps:p,readOnly:g,capture:b,fileInputProps:y,rightSection:E,size:T,placeholder:v,component:R,resetRef:A,classNames:O,styles:P,attributes:F,...N}=n,U=C.useRef(null),{resolvedClassNames:j,resolvedStyles:z}=pd({classNames:O,styles:P,props:n}),[I,B]=vo({value:o,defaultValue:a,onChange:s,finalValue:l?[]:null}),Z=Array.isArray(I)?I.length!==0:I!==null,H=E||(h&&Z&&!g?M.jsx(yd,{...p,variant:"subtle",onClick:()=>B(l?[]:null),size:T,unstyled:r}):null);return C.useEffect(()=>{(Array.isArray(I)&&I.length===0||I===null)&&U.current?.()},[I]),M.jsx(UA,{onChange:B,multiple:l,accept:u,name:c,form:d,resetRef:Zn(U,A),disabled:g,capture:b,inputProps:y,children:D=>M.jsx(Mo,{component:R||"button",ref:e,rightSection:H,...D,...N,__staticSelector:"FileInput",multiline:!0,type:"button",pointer:!0,__stylesApiProps:n,unstyled:r,size:T,classNames:O,styles:P,attributes:F,children:Z?M.jsx(f,{value:I}):M.jsx(En.Placeholder,{__staticSelector:"FileInput",classNames:j,styles:z,attributes:F,children:v})})})});D0.classes=Mo.classes;D0.displayName="@mantine/core/FileInput";const pQ=D0;var $A={root:"m_6e45937b",loader:"m_e8eb006c",overlay:"m_df587f17"};const OE={transitionProps:{transition:"fade",duration:0},overlayProps:{backgroundOpacity:.75},zIndex:gl("overlay")},kK=(t,{zIndex:e})=>({root:{"--lo-z-index":e?.toString()}}),VA=Ie((t,e)=>{const n=re("LoadingOverlay",OE,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,transitionProps:u,loaderProps:c,overlayProps:d,visible:f,zIndex:h,attributes:p,...g}=n,b=on(),y=_e({name:"LoadingOverlay",classes:$A,props:n,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:p,vars:l,varsResolver:kK}),E={...OE.overlayProps,...d};return M.jsx(hi,{transition:"fade",...u,mounted:!!f,children:T=>M.jsxs(pe,{...y("root",{style:T}),ref:e,...g,children:[M.jsx(Io,{...y("loader"),unstyled:a,...c}),M.jsx(Ya,{...E,...y("overlay"),darkHidden:!0,unstyled:a,color:d?.color||b.white}),M.jsx(Ya,{...E,...y("overlay"),lightHidden:!0,unstyled:a,color:d?.color||b.colors.dark[5]})]})})});VA.classes=$A;VA.displayName="@mantine/core/LoadingOverlay";const[AK,Ei]=cd("Menu component was not found in the tree");var Ti={dropdown:"m_dc9b7c9f",label:"m_9bfac126",divider:"m_efdf90cb",item:"m_99ac2aa1",itemLabel:"m_5476e0d3",itemSection:"m_8b75e504",chevron:"m_b85b0bed"};const L0=Ie((t,e)=>{const{classNames:n,className:r,style:i,styles:s,vars:o,...a}=re("MenuDivider",null,t),l=Ei();return M.jsx(pe,{ref:e,...l.getStyles("divider",{className:r,style:i,styles:s,classNames:n}),...a})});L0.classes=Ti;L0.displayName="@mantine/core/MenuDivider";const P0=Ie((t,e)=>{const{classNames:n,className:r,style:i,styles:s,vars:o,onMouseEnter:a,onMouseLeave:l,onKeyDown:u,children:c,...d}=re("MenuDropdown",null,t),f=C.useRef(null),h=Ei(),p=en(u,y=>{(y.key==="ArrowUp"||y.key==="ArrowDown")&&(y.preventDefault(),f.current?.querySelectorAll("[data-menu-item]:not(:disabled)")[0]?.focus())}),g=en(a,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.openDropdown()),b=en(l,()=>(h.trigger==="hover"||h.trigger==="click-hover")&&h.closeDropdown());return M.jsxs(yr.Dropdown,{...d,onMouseEnter:g,onMouseLeave:b,role:"menu","aria-orientation":"vertical",ref:Zn(e,f),...h.getStyles("dropdown",{className:r,style:i,styles:s,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,onKeyDown:p,children:[h.withInitialFocusPlaceholder&&M.jsx("div",{tabIndex:-1,"data-autofocus":!0,"data-mantine-stop-propagation":!0,style:{outline:0}}),c]})});P0.classes=Ti;P0.displayName="@mantine/core/MenuDropdown";const[vK,Ad]=dd(),B0=Lt((t,e)=>{const{classNames:n,className:r,style:i,styles:s,vars:o,color:a,closeMenuOnClick:l,leftSection:u,rightSection:c,children:d,disabled:f,"data-disabled":h,...p}=re("MenuItem",null,t),g=Ei(),b=Ad(),y=on(),{dir:E}=No(),T=C.useRef(null),v=p,R=en(v.onClick,()=>{h||(typeof l=="boolean"?l&&g.closeDropdownImmediately():g.closeOnItemClick&&g.closeDropdownImmediately())}),A=a?y.variantColorResolver({color:a,theme:y,variant:"light"}):void 0,O=a?ns({color:a,theme:y}):null,P=en(v.onKeyDown,F=>{F.key==="ArrowLeft"&&b&&(b.close(),b.focusParentItem())});return M.jsxs(yi,{onMouseDown:F=>F.preventDefault(),...p,unstyled:g.unstyled,tabIndex:g.menuItemTabIndex,...g.getStyles("item",{className:r,style:i,styles:s,classNames:n}),ref:Zn(T,e),role:"menuitem",disabled:f,"data-menu-item":!0,"data-disabled":f||h||void 0,"data-mantine-stop-propagation":!0,onClick:R,onKeyDown:a0({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:g.loop,dir:E,orientation:"vertical",onKeyDown:P}),__vars:{"--menu-item-color":O?.isThemeColor&&O?.shade===void 0?`var(--mantine-color-${O.color}-6)`:A?.color,"--menu-item-hover":A?.hover},children:[u&&M.jsx("div",{...g.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"left",children:u}),d&&M.jsx("div",{...g.getStyles("itemLabel",{styles:s,classNames:n}),children:d}),c&&M.jsx("div",{...g.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"right",children:c})]})});B0.classes=Ti;B0.displayName="@mantine/core/MenuItem";const F0=Ie((t,e)=>{const{classNames:n,className:r,style:i,styles:s,vars:o,...a}=re("MenuLabel",null,t),l=Ei();return M.jsx(pe,{ref:e,...l.getStyles("label",{className:r,style:i,styles:s,classNames:n}),...a})});F0.classes=Ti;F0.displayName="@mantine/core/MenuLabel";const H0=Ie((t,e)=>{const{classNames:n,className:r,style:i,styles:s,vars:o,onMouseEnter:a,onMouseLeave:l,onKeyDown:u,children:c,...d}=re("MenuSubDropdown",null,t),f=C.useRef(null),h=Ei(),p=Ad(),g=en(a,p?.open),b=en(l,p?.close);return M.jsx(yr.Dropdown,{...d,onMouseEnter:g,onMouseLeave:b,role:"menu","aria-orientation":"vertical",ref:Zn(e,f),...h.getStyles("dropdown",{className:r,style:i,styles:s,classNames:n,withStaticClass:!1}),tabIndex:-1,"data-menu-dropdown":!0,children:c})});H0.classes=Ti;H0.displayName="@mantine/core/MenuSubDropdown";const U0=Lt((t,e)=>{const{classNames:n,className:r,style:i,styles:s,vars:o,color:a,leftSection:l,rightSection:u,children:c,disabled:d,"data-disabled":f,closeMenuOnClick:h,...p}=re("MenuSubItem",null,t),g=Ei(),b=Ad(),y=on(),{dir:E}=No(),T=C.useRef(null),v=p,R=a?y.variantColorResolver({color:a,theme:y,variant:"light"}):void 0,A=a?ns({color:a,theme:y}):null,O=en(v.onKeyDown,U=>{U.key==="ArrowRight"&&(b?.open(),b?.focusFirstItem()),U.key==="ArrowLeft"&&b?.parentContext&&(b.parentContext.close(),b.parentContext.focusParentItem())}),P=en(v.onClick,()=>{!f&&h&&g.closeDropdownImmediately()}),F=en(v.onMouseEnter,b?.open),N=en(v.onMouseLeave,b?.close);return M.jsxs(yi,{onMouseDown:U=>U.preventDefault(),...p,unstyled:g.unstyled,tabIndex:g.menuItemTabIndex,...g.getStyles("item",{className:r,style:i,styles:s,classNames:n}),ref:Zn(T,e),role:"menuitem",disabled:d,"data-menu-item":!0,"data-sub-menu-item":!0,"data-disabled":d||f||void 0,"data-mantine-stop-propagation":!0,onMouseEnter:F,onMouseLeave:N,onClick:P,onKeyDown:a0({siblingSelector:"[data-menu-item]:not([data-disabled])",parentSelector:"[data-menu-dropdown]",activateOnFocus:!1,loop:g.loop,dir:E,orientation:"vertical",onKeyDown:O}),__vars:{"--menu-item-color":A?.isThemeColor&&A?.shade===void 0?`var(--mantine-color-${A.color}-6)`:R?.color,"--menu-item-hover":R?.hover},children:[l&&M.jsx("div",{...g.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"left",children:l}),c&&M.jsx("div",{...g.getStyles("itemLabel",{styles:s,classNames:n}),children:c}),M.jsx("div",{...g.getStyles("itemSection",{styles:s,classNames:n}),"data-position":"right",children:u||M.jsx(IA,{...g.getStyles("chevron"),size:14})})]})});U0.classes=Ti;U0.displayName="@mantine/core/MenuSubItem";function zA({children:t,refProp:e}){if(!Hk(t))throw new Error("Menu.Sub.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");return Ei(),M.jsx(yr.Target,{refProp:e,popupType:"menu",children:t})}zA.displayName="@mantine/core/MenuSubTarget";const NK={offset:0,position:"right-start",transitionProps:{duration:0},openDelay:0,middlewares:{shift:{crossAxis:!0}}};function Do(t){const{children:e,closeDelay:n,openDelay:r,...i}=re("MenuSub",NK,t),s=Ao(),[o,{open:a,close:l}]=oW(!1),u=Ad(),{openDropdown:c,closeDropdown:d}=_A({open:a,close:l,closeDelay:n,openDelay:r}),f=()=>window.setTimeout(()=>{document.getElementById(`${s}-dropdown`)?.querySelectorAll("[data-menu-item]:not([data-disabled])")[0]?.focus()},16),h=()=>window.setTimeout(()=>{document.getElementById(`${s}-target`)?.focus()},16);return M.jsx(vK,{value:{opened:o,close:d,open:c,focusFirstItem:f,focusParentItem:h,parentContext:u},children:M.jsx(yr,{opened:o,withinPortal:!1,withArrow:!1,id:s,...i,children:e})})}Do.extend=t=>t;Do.displayName="@mantine/core/MenuSub";Do.Target=zA;Do.Dropdown=H0;Do.Item=U0;const _K={refProp:"ref"},jA=C.forwardRef((t,e)=>{const{children:n,refProp:r,...i}=re("MenuTarget",_K,t),s=El(n);if(!s)throw new Error("Menu.Target component children should be an element or a component that accepts ref. Fragments, strings, numbers and other primitive values are not supported");const o=Ei(),a=s.props,l=en(a.onClick,()=>{o.trigger==="click"?o.toggleDropdown():o.trigger==="click-hover"&&(o.setOpenedViaClick(!0),o.opened||o.openDropdown())}),u=en(a.onMouseEnter,()=>(o.trigger==="hover"||o.trigger==="click-hover")&&o.openDropdown()),c=en(a.onMouseLeave,()=>{(o.trigger==="hover"||o.trigger==="click-hover"&&!o.openedViaClick)&&o.closeDropdown()});return M.jsx(yr.Target,{refProp:r,popupType:"menu",ref:e,...i,children:C.cloneElement(s,{onClick:l,onMouseEnter:u,onMouseLeave:c,"data-expanded":o.opened?!0:void 0})})});jA.displayName="@mantine/core/MenuTarget";const IK={trapFocus:!0,closeOnItemClick:!0,withInitialFocusPlaceholder:!0,clickOutsideEvents:["mousedown","touchstart","keydown"],loop:!0,trigger:"click",openDelay:0,closeDelay:100,menuItemTabIndex:-1};function Yn(t){const e=re("Menu",IK,t),{children:n,onOpen:r,onClose:i,opened:s,defaultOpened:o,trapFocus:a,onChange:l,closeOnItemClick:u,loop:c,closeOnEscape:d,trigger:f,openDelay:h,closeDelay:p,classNames:g,styles:b,unstyled:y,variant:E,vars:T,menuItemTabIndex:v,keepMounted:R,withInitialFocusPlaceholder:A,attributes:O,...P}=e,F=_e({name:"Menu",classes:Ti,props:e,classNames:g,styles:b,unstyled:y,attributes:O}),[N,U]=vo({value:s,defaultValue:o,finalValue:!1,onChange:l}),[j,z]=C.useState(!1),I=()=>{U(!1),z(!1),N&&i?.()},B=()=>{U(!0),!N&&r?.()},Z=()=>{N?I():B()},{openDropdown:H,closeDropdown:D}=_A({open:B,close:I,closeDelay:p,openDelay:h}),V=G=>Vj("[data-menu-item]","[data-menu-dropdown]",G),{resolvedClassNames:x,resolvedStyles:ne}=pd({classNames:g,styles:b,props:e});return M.jsx(AK,{value:{getStyles:F,opened:N,toggleDropdown:Z,getItemIndex:V,openedViaClick:j,setOpenedViaClick:z,closeOnItemClick:u,closeDropdown:f==="click"?I:D,openDropdown:f==="click"?B:H,closeDropdownImmediately:I,loop:c,trigger:f,unstyled:y,menuItemTabIndex:v,withInitialFocusPlaceholder:A},children:M.jsx(yr,{returnFocus:!0,...P,opened:N,onChange:Z,defaultOpened:o,trapFocus:R?!1:a,closeOnEscape:d,__staticSelector:"Menu",classNames:x,styles:ne,unstyled:y,variant:E,keepMounted:R,children:n})})}Yn.extend=t=>t;Yn.withProps=bq(Yn);Yn.classes=Ti;Yn.displayName="@mantine/core/Menu";Yn.Item=B0;Yn.Label=F0;Yn.Dropdown=P0;Yn.Target=jA;Yn.Divider=L0;Yn.Sub=Do;const RK={duration:100,transition:"fade"};function DE(t,e){return{...RK,...e,...t}}var vd={tooltip:"m_1b3c8819",arrow:"m_f898399f"};function MK({offset:t,position:e,defaultOpened:n}){const[r,i]=C.useState(n),s=C.useRef(null),{x:o,y:a,elements:l,refs:u,update:c,placement:d}=y0({placement:e,middleware:[wp({crossAxis:!0,padding:5,rootBoundary:"document"})]}),f=d.includes("right")?t:e.includes("left")?t*-1:0,h=d.includes("bottom")?t:e.includes("top")?t*-1:0,p=C.useCallback(({clientX:g,clientY:b})=>{u.setPositionReference({getBoundingClientRect(){return{width:0,height:0,x:g,y:b,left:g+f,top:b+h,right:g,bottom:b}}})},[l.reference]);return C.useEffect(()=>{if(u.floating.current){const g=s.current;g.addEventListener("mousemove",p);const b=tu(u.floating.current);return b.forEach(y=>{y.addEventListener("scroll",c)}),()=>{g.removeEventListener("mousemove",p),b.forEach(y=>{y.removeEventListener("scroll",c)})}}},[l.reference,u.floating.current,c,p,r]),{handleMouseMove:p,x:o,y:a,opened:r,setOpened:i,boundaryRef:s,floating:u.setFloating}}const OK={refProp:"ref",withinPortal:!0,offset:10,position:"right",zIndex:gl("popover")},DK=(t,{radius:e,color:n})=>({tooltip:{"--tooltip-radius":e===void 0?void 0:Dt(e),"--tooltip-bg":n?Pr(n,t):void 0,"--tooltip-color":n?"var(--mantine-color-white)":void 0}}),$0=Ie((t,e)=>{const n=re("TooltipFloating",OK,t),{children:r,refProp:i,withinPortal:s,style:o,className:a,classNames:l,styles:u,unstyled:c,radius:d,color:f,label:h,offset:p,position:g,multiline:b,zIndex:y,disabled:E,defaultOpened:T,variant:v,vars:R,portalProps:A,attributes:O,...P}=n,F=on(),N=_e({name:"TooltipFloating",props:n,classes:vd,className:a,style:o,classNames:l,styles:u,unstyled:c,attributes:O,rootSelector:"tooltip",vars:R,varsResolver:DK}),{handleMouseMove:U,x:j,y:z,opened:I,boundaryRef:B,floating:Z,setOpened:H}=MK({offset:p,position:g,defaultOpened:T}),D=El(r);if(!D)throw new Error("[@mantine/core] Tooltip.Floating component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");const V=Zn(B,l0(D),e),x=D.props,ne=w=>{x.onMouseEnter?.(w),U(w),H(!0)},G=w=>{x.onMouseLeave?.(w),H(!1)};return M.jsxs(M.Fragment,{children:[M.jsx(uo,{...A,withinPortal:s,children:M.jsx(pe,{...P,...N("tooltip",{style:{...Jk(o,F),zIndex:y,display:!E&&I?"block":"none",top:(z&&Math.round(z))??"",left:(j&&Math.round(j))??""}}),variant:v,ref:Z,mod:{multiline:b},children:h})}),C.cloneElement(D,{...x,[i]:V,onMouseEnter:ne,onMouseLeave:G})]})});$0.classes=vd;$0.displayName="@mantine/core/TooltipFloating";const WA=C.createContext(!1),LK=WA.Provider,PK=()=>C.useContext(WA),BK={openDelay:0,closeDelay:0};function V0(t){const{openDelay:e,closeDelay:n,children:r}=re("TooltipGroup",BK,t);return M.jsx(LK,{value:!0,children:M.jsx(Xq,{delay:{open:e,close:n},children:r})})}V0.displayName="@mantine/core/TooltipGroup";V0.extend=t=>t;function FK(t){if(t===void 0)return{shift:!0,flip:!0};const e={...t};return t.shift===void 0&&(e.shift=!0),t.flip===void 0&&(e.flip=!0),e}function HK(t){const e=FK(t.middlewares),n=[FE(t.offset)];return e.shift&&n.push(wp(typeof e.shift=="boolean"?{padding:8}:{padding:8,...e.shift})),e.flip&&n.push(typeof e.flip=="boolean"?xu():xu(e.flip)),n.push(HE({element:t.arrowRef,padding:t.arrowOffset})),e.inline?n.push(typeof e.inline=="boolean"?Zo():Zo(e.inline)):t.inline&&n.push(Zo()),n}function UK(t){const[e,n]=C.useState(t.defaultOpened),i=typeof t.opened=="boolean"?t.opened:e,s=PK(),o=Ao(),a=C.useCallback(R=>{n(R),R&&y(o)},[o]),{x:l,y:u,context:c,refs:d,placement:f,middlewareData:{arrow:{x:h,y:p}={}}}=y0({strategy:t.strategy,placement:t.position,open:i,onOpenChange:a,middleware:HK(t),whileElementsMounted:nh}),{delay:g,currentId:b,setCurrentId:y}=Qq(c,{id:o}),{getReferenceProps:E,getFloatingProps:T}=rY([Kq(c,{enabled:t.events?.hover,delay:s?g:{open:t.openDelay,close:t.closeDelay},mouseOnly:!t.events?.touch}),nY(c,{enabled:t.events?.focus,visibleOnly:!0}),sY(c,{role:"tooltip"}),eY(c,{enabled:typeof t.opened>"u"})]);ja(()=>{t.onPositionChange?.(f)},[f]);const v=i&&b&&b!==o;return{x:l,y:u,arrowX:h,arrowY:p,reference:d.setReference,floating:d.setFloating,getFloatingProps:T,getReferenceProps:E,isGroupPhase:v,opened:i,placement:f}}const LE={position:"top",refProp:"ref",withinPortal:!0,arrowSize:4,arrowOffset:5,arrowRadius:0,arrowPosition:"side",offset:5,transitionProps:{duration:100,transition:"fade"},events:{hover:!0,focus:!1,touch:!1},zIndex:gl("popover"),positionDependencies:[],middlewares:{flip:!0,shift:!0,inline:!1}},$K=(t,{radius:e,color:n,variant:r,autoContrast:i})=>{const s=t.variantColorResolver({theme:t,color:n||t.primaryColor,autoContrast:i,variant:r||"filled"});return{tooltip:{"--tooltip-radius":e===void 0?void 0:Dt(e),"--tooltip-bg":n?s.background:void 0,"--tooltip-color":n?s.color:void 0}}},Nd=Ie((t,e)=>{const n=re("Tooltip",LE,t),{children:r,position:i,refProp:s,label:o,openDelay:a,closeDelay:l,onPositionChange:u,opened:c,defaultOpened:d,withinPortal:f,radius:h,color:p,classNames:g,styles:b,unstyled:y,style:E,className:T,withArrow:v,arrowSize:R,arrowOffset:A,arrowRadius:O,arrowPosition:P,offset:F,transitionProps:N,multiline:U,events:j,zIndex:z,disabled:I,positionDependencies:B,onClick:Z,onMouseEnter:H,onMouseLeave:D,inline:V,variant:x,keepMounted:ne,vars:G,portalProps:w,mod:me,floatingStrategy:te,middlewares:le,autoContrast:Ne,attributes:ye,target:ge,...De}=re("Tooltip",LE,n),{dir:qe}=No(),oe=C.useRef(null),ie=UK({position:dA(qe,i),closeDelay:l,openDelay:a,onPositionChange:u,opened:c,defaultOpened:d,events:j,arrowRef:oe,arrowOffset:A,offset:typeof F=="number"?F+(v?R/2:0):F,positionDependencies:[...B,ge??r],inline:V,strategy:te,middlewares:le});C.useEffect(()=>{const Be=ge instanceof HTMLElement?ge:typeof ge=="string"?document.querySelector(ge):ge?.current||null;Be&&ie.reference(Be)},[ge,ie]);const fe=_e({name:"Tooltip",props:n,classes:vd,className:T,style:E,classNames:g,styles:b,unstyled:y,attributes:ye,rootSelector:"tooltip",vars:G,varsResolver:$K}),Me=El(r);if(!ge&&!Me)throw new Error("[@mantine/core] Tooltip component children should be an element or a component that accepts ref, fragments, strings, numbers and other primitive values are not supported");if(ge){const Be=DE(N,{duration:100,transition:"fade"});return M.jsx(M.Fragment,{children:M.jsx(uo,{...w,withinPortal:f,children:M.jsx(hi,{...Be,keepMounted:ne,mounted:!I&&!!ie.opened,duration:ie.isGroupPhase?10:Be.duration,children:Qe=>M.jsxs(pe,{...De,"data-fixed":te==="fixed"||void 0,variant:x,mod:[{multiline:U},me],...ie.getFloatingProps({ref:ie.floating,className:fe("tooltip").className,style:{...fe("tooltip").style,...Qe,zIndex:z,top:ie.y??0,left:ie.x??0}}),children:[o,M.jsx(Tc,{ref:oe,arrowX:ie.arrowX,arrowY:ie.arrowY,visible:v,position:ie.placement,arrowSize:R,arrowOffset:A,arrowRadius:O,arrowPosition:P,...fe("arrow")})]})})})})}const Fe=Me.props,Ce=Zn(ie.reference,l0(Me),e),lt=DE(N,{duration:100,transition:"fade"});return M.jsxs(M.Fragment,{children:[M.jsx(uo,{...w,withinPortal:f,children:M.jsx(hi,{...lt,keepMounted:ne,mounted:!I&&!!ie.opened,duration:ie.isGroupPhase?10:lt.duration,children:Be=>M.jsxs(pe,{...De,"data-fixed":te==="fixed"||void 0,variant:x,mod:[{multiline:U},me],...ie.getFloatingProps({ref:ie.floating,className:fe("tooltip").className,style:{...fe("tooltip").style,...Be,zIndex:z,top:ie.y??0,left:ie.x??0}}),children:[o,M.jsx(Tc,{ref:oe,arrowX:ie.arrowX,arrowY:ie.arrowY,visible:v,position:ie.placement,arrowSize:R,arrowOffset:A,arrowRadius:O,arrowPosition:P,...fe("arrow")})]})})}),C.cloneElement(Me,ie.getReferenceProps({onClick:Z,onMouseEnter:H,onMouseLeave:D,onMouseMove:n.onMouseMove,onPointerDown:n.onPointerDown,onPointerEnter:n.onPointerEnter,...Fe,className:Br(T,Fe.className),[s]:Ce}))]})});Nd.classes=vd;Nd.displayName="@mantine/core/Tooltip";Nd.Floating=$0;Nd.Group=V0;var qA={root:"m_18320242","skeleton-fade":"m_299c329c"};const VK={visible:!0,animate:!0},zK=(t,{width:e,height:n,radius:r,circle:i})=>({root:{"--skeleton-height":Y(n),"--skeleton-width":Y(i?n:e),"--skeleton-radius":i?"1000px":r===void 0?void 0:Dt(r)}}),YA=Ie((t,e)=>{const n=re("Skeleton",VK,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,width:u,height:c,circle:d,visible:f,radius:h,animate:p,mod:g,attributes:b,...y}=n,E=_e({name:"Skeleton",classes:qA,props:n,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:b,vars:l,varsResolver:zK});return M.jsx(pe,{ref:e,...E("root"),mod:[{visible:f,animate:p},g],...y})});YA.classes=qA;YA.displayName="@mantine/core/Skeleton";var KA={root:"m_6d731127"};const jK={gap:"md",align:"stretch",justify:"flex-start"},WK=(t,{gap:e,align:n,justify:r})=>({root:{"--stack-gap":bl(e),"--stack-align":n,"--stack-justify":r}}),GA=Ie((t,e)=>{const n=re("Stack",jK,t),{classNames:r,className:i,style:s,styles:o,unstyled:a,vars:l,align:u,justify:c,gap:d,variant:f,attributes:h,...p}=n,g=_e({name:"Stack",props:n,classes:KA,className:i,style:s,classNames:r,styles:o,unstyled:a,attributes:h,vars:l,varsResolver:WK});return M.jsx(pe,{ref:e,...g("root"),variant:f,...p})});GA.classes=KA;GA.displayName="@mantine/core/Stack";const[qK,z0]=cd("Tabs component was not found in the tree");var Tl={root:"m_89d60db1","list--default":"m_576c9d4",list:"m_89d33d6d",tab:"m_4ec4dce6",panel:"m_b0c91715",tabSection:"m_fc420b1f",tabLabel:"m_42bbd1ae","tab--default":"m_539e827b","list--outline":"m_6772fbd5","tab--outline":"m_b59ab47c","tab--pills":"m_c3381914"};const j0=Ie((t,e)=>{const n=re("TabsList",null,t),{children:r,className:i,grow:s,justify:o,classNames:a,styles:l,style:u,mod:c,...d}=n,f=z0();return M.jsx(pe,{...d,...f.getStyles("list",{className:i,style:u,classNames:a,styles:l,props:n,variant:f.variant}),ref:e,role:"tablist",variant:f.variant,mod:[{grow:s,orientation:f.orientation,placement:f.orientation==="vertical"&&f.placement,inverted:f.inverted},c],"aria-orientation":f.orientation,__vars:{"--tabs-justify":o},children:r})});j0.classes=Tl;j0.displayName="@mantine/core/TabsList";const W0=Ie((t,e)=>{const n=re("TabsPanel",null,t),{children:r,className:i,value:s,classNames:o,styles:a,style:l,mod:u,keepMounted:c,...d}=n,f=z0(),h=f.value===s,p=f.keepMounted||c||h?r:null;return M.jsx(pe,{...f.getStyles("panel",{className:i,classNames:o,styles:a,style:[l,h?void 0:{display:"none"}],props:n}),ref:e,mod:[{orientation:f.orientation},u],role:"tabpanel",id:f.getPanelId(s),"aria-labelledby":f.getTabId(s),...d,children:p})});W0.classes=Tl;W0.displayName="@mantine/core/TabsPanel";const q0=Ie((t,e)=>{const n=re("TabsTab",null,t),{className:r,children:i,rightSection:s,leftSection:o,value:a,onClick:l,onKeyDown:u,disabled:c,color:d,style:f,classNames:h,styles:p,vars:g,mod:b,tabIndex:y,...E}=n,T=on(),{dir:v}=No(),R=z0(),A=a===R.value,O=F=>{R.onChange(R.allowTabDeactivation&&a===R.value?null:a),l?.(F)},P={classNames:h,styles:p,props:n};return M.jsxs(yi,{...R.getStyles("tab",{className:r,style:f,variant:R.variant,...P}),disabled:c,unstyled:R.unstyled,variant:R.variant,mod:[{active:A,disabled:c,orientation:R.orientation,inverted:R.inverted,placement:R.orientation==="vertical"&&R.placement},b],ref:e,role:"tab",id:R.getTabId(a),"aria-selected":A,tabIndex:y!==void 0?y:A||R.value===null?0:-1,"aria-controls":R.getPanelId(a),onClick:O,__vars:{"--tabs-color":d?Pr(d,T):void 0},onKeyDown:a0({siblingSelector:'[role="tab"]',parentSelector:'[role="tablist"]',activateOnFocus:R.activateTabWithKeyboard,loop:R.loop,orientation:R.orientation||"horizontal",dir:v,onKeyDown:u}),...E,children:[o&&M.jsx("span",{...R.getStyles("tabSection",P),"data-position":"left",children:o}),i&&M.jsx("span",{...R.getStyles("tabLabel",P),children:i}),s&&M.jsx("span",{...R.getStyles("tabSection",P),"data-position":"right",children:s})]})});q0.classes=Tl;q0.displayName="@mantine/core/TabsTab";const PE="Tabs.Tab or Tabs.Panel component was rendered with invalid value or without value",YK={keepMounted:!0,orientation:"horizontal",loop:!0,activateTabWithKeyboard:!0,variant:"default",placement:"left"},KK=(t,{radius:e,color:n,autoContrast:r})=>({root:{"--tabs-radius":Dt(e),"--tabs-color":Pr(n,t),"--tabs-text-color":XW(r,t)?Yk({color:n,theme:t,autoContrast:r}):void 0}}),Cl=Ie((t,e)=>{const n=re("Tabs",YK,t),{defaultValue:r,value:i,onChange:s,orientation:o,children:a,loop:l,id:u,activateTabWithKeyboard:c,allowTabDeactivation:d,variant:f,color:h,radius:p,inverted:g,placement:b,keepMounted:y,classNames:E,styles:T,unstyled:v,className:R,style:A,vars:O,autoContrast:P,mod:F,attributes:N,...U}=n,j=Ao(u),[z,I]=vo({value:i,defaultValue:r,finalValue:null,onChange:s}),B=_e({name:"Tabs",props:n,classes:Tl,className:R,style:A,classNames:E,styles:T,unstyled:v,attributes:N,vars:O,varsResolver:KK});return M.jsx(qK,{value:{placement:b,value:z,orientation:o,id:j,loop:l,activateTabWithKeyboard:c,getTabId:uE(`${j}-tab`,PE),getPanelId:uE(`${j}-panel`,PE),onChange:I,allowTabDeactivation:d,variant:f,color:h,radius:p,inverted:g,keepMounted:y,unstyled:v,getStyles:B},children:M.jsx(pe,{ref:e,id:j,variant:f,mod:[{orientation:o,inverted:o==="horizontal"&&g,placement:o==="vertical"&&b},F],...B("root"),...U,children:a})})});Cl.classes=Tl;Cl.displayName="@mantine/core/Tabs";Cl.Tab=q0;Cl.Panel=W0;Cl.List=j0;const XA=Ie((t,e)=>{const n=re("TextInput",null,t);return M.jsx(Mo,{component:"input",ref:e,...n,__staticSelector:"TextInput"})});XA.classes=Mo.classes;XA.displayName="@mantine/core/TextInput";function mQ(t){return ce({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(t)}let GK="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",gQ=(t=21)=>{let e="",n=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)e+=GK[n[t]&63];return e};export{UG as $,bG as A,n4 as B,Xe as C,Le as D,Kn as E,q as F,yG as G,W3 as H,nG as I,FD as J,BD as K,LG as L,ho as M,gR as N,DG as O,nt as P,hG as Q,et as R,G0 as S,ue as T,fG as U,dG as V,lG as W,uG as X,cG as Y,oG as Z,aG as _,yt as a,sQ as a$,PG as a0,BG as a1,FG as a2,HG as a3,ae as a4,Zi as a5,CG as a6,xG as a7,oi as a8,SG as a9,zU as aA,jG as aB,kT as aC,Ks as aD,pt as aE,LT as aF,cI as aG,Au as aH,co as aI,Qi as aJ,Vh as aK,uX as aL,sX as aM,KG as aN,aX as aO,rj as aP,oX as aQ,iX as aR,tX as aS,eX as aT,nX as aU,rX as aV,cX as aW,dX as aX,oQ as aY,EX as aZ,pX as a_,kG as aa,wG as ab,vG as ac,AG as ad,NG as ae,io as af,he as ag,Wn as ah,Ht as ai,$G as aj,rD as ak,eG as al,Sh as am,sG as an,Oi as ao,WG as ap,wo as aq,c_ as ar,tG as as,jp as at,iG as au,qG as av,YG as aw,rI as ax,VG as ay,zG as az,ut as b,kA as b$,bX as b0,GG as b1,XG as b2,QG as b3,JG as b4,ZG as b5,hX as b6,XX as b7,fX as b8,rQ as b9,HX as bA,QX as bB,eQ as bC,ZX as bD,tQ as bE,JX as bF,$X as bG,VX as bH,BX as bI,iQ as bJ,OX as bK,MX as bL,lX as bM,uQ as bN,TX as bO,lQ as bP,mX as bQ,FX as bR,aQ as bS,xj as bT,cQ as bU,jk as bV,LW as bW,HA as bX,MA as bY,M0 as bZ,fQ as b_,CX as ba,AX as bb,kX as bc,_X as bd,NX as be,PX as bf,DX as bg,LX as bh,xX as bi,RX as bj,qX as bk,YX as bl,KX as bm,zX as bn,jX as bo,WX as bp,dQ as bq,UX as br,SX as bs,GX as bt,yX as bu,gX as bv,wX as bw,nQ as bx,IX as by,vX as bz,nI as c,Yn as c0,wd as c1,mQ as c2,ZY as c3,bd as c4,Nd as c5,hQ as c6,NA as c7,iW as c8,tW as c9,x0 as ca,bA as cb,yr as cc,XA as cd,Io as ce,GA as cf,LA as cg,pQ as ch,Cl as ci,VA as cj,YA as ck,N0 as cl,O0 as cm,gQ as cn,Je as d,ee as e,JK as f,DT as g,He as h,se as i,pG as j,mG as k,qp as l,fo as m,Gu as n,ea as o,Ta as p,Xi as q,Ls as r,IG as s,gG as t,wR as u,MG as v,OG as w,RG as x,Ge as y,_G as z};