agentic-documents 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/README.md +112 -5
- package/dist/{chunk-YBBQNCMC.js → chunk-6QOYS63L.js} +14 -189
- package/dist/{chunk-TFCRPEEM.js → chunk-7R7ZPPRF.js} +1 -1
- package/dist/{chunk-R5XUTBC3.js → chunk-E7B6T5WN.js} +29 -8
- package/dist/{chunk-IU3YIQ4Y.js → chunk-FX755I7V.js} +30 -8
- package/dist/{chunk-GYQFTF2E.js → chunk-L6W2AQUF.js} +15 -146
- package/dist/chunk-S6MQDWFK.js +150 -0
- package/dist/chunk-UPEGODUV.js +195 -0
- package/dist/{chunk-FZA5LQV3.js → chunk-YNHZCIGO.js} +86 -11
- package/dist/cli.js +8 -6
- package/dist/client.d.ts +23 -6
- package/dist/client.js +9 -2
- package/dist/{doc-C_8kCsl7.d.ts → doc-mJPajXEQ.d.ts} +5 -1
- package/dist/export-Cwx276UP.d.ts +17 -0
- package/dist/formats.d.ts +49 -0
- package/dist/formats.js +234 -0
- package/dist/index.d.ts +6 -5
- package/dist/index.js +11 -7
- package/dist/live-worker.d.ts +2 -2
- package/dist/live-worker.js +6 -4
- package/dist/live.d.ts +6 -2
- package/dist/live.js +4 -3
- package/dist/{mcp-P2C75IIG.js → mcp-ESSEG46C.js} +4 -2
- package/dist/{review-BQW2Ci2h.d.ts → review-Hgq8OgvD.d.ts} +2 -16
- package/dist/{service-Do2Jwb5U.d.ts → service-CqKE9DKz.d.ts} +38 -5
- package/dist/ui/_headers +4 -0
- package/dist/ui/app.css +1 -0
- package/dist/ui/app.js +270 -0
- package/dist/ui/assets/inter-latin-ext-wght-normal-HA22NDSG.woff2 +0 -0
- package/dist/ui/assets/inter-latin-wght-normal-NRMW37G5.woff2 +0 -0
- package/dist/ui/assets/jetbrains-mono-latin-ext-wght-normal-TSLVDSQR.woff2 +0 -0
- package/dist/ui/assets/jetbrains-mono-latin-wght-normal-VBS632QH.woff2 +0 -0
- package/dist/ui/index.html +13 -0
- package/dist/worker.d.ts +2 -2
- package/dist/worker.js +6 -4
- package/llms.txt +1 -0
- package/package.json +19 -3
package/dist/ui/app.js
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
var O8=Object.create;var VA=Object.defineProperty;var D8=Object.getOwnPropertyDescriptor;var N8=Object.getOwnPropertyNames;var _8=Object.getPrototypeOf,I8=Object.prototype.hasOwnProperty;var To=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(n){throw e=0,n}};var L8=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of N8(e))!I8.call(t,o)&&o!==n&&VA(t,o,{get:()=>e[o],enumerable:!(r=D8(e,o))||r.enumerable});return t};var R=(t,e,n)=>(n=t!=null?O8(_8(t)):{},L8(e||!t||!t.__esModule?VA(n,"default",{value:t,enumerable:!0}):n,t));var ek=To(te=>{"use strict";var ib=Symbol.for("react.transitional.element"),z8=Symbol.for("react.portal"),U8=Symbol.for("react.fragment"),B8=Symbol.for("react.strict_mode"),P8=Symbol.for("react.profiler"),H8=Symbol.for("react.consumer"),V8=Symbol.for("react.context"),j8=Symbol.for("react.forward_ref"),F8=Symbol.for("react.suspense"),$8=Symbol.for("react.memo"),qA=Symbol.for("react.lazy"),Y8=Symbol.for("react.activity"),q8=Symbol.for("react.view_transition"),jA=Symbol.iterator;function K8(t){return t===null||typeof t!="object"?null:(t=jA&&t[jA]||t["@@iterator"],typeof t=="function"?t:null)}var KA={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},GA=Object.assign,XA={};function Ka(t,e,n){this.props=t,this.context=e,this.refs=XA,this.updater=n||KA}Ka.prototype.isReactComponent={};Ka.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Ka.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function WA(){}WA.prototype=Ka.prototype;function sb(t,e,n){this.props=t,this.context=e,this.refs=XA,this.updater=n||KA}var lb=sb.prototype=new WA;lb.constructor=sb;GA(lb,Ka.prototype);lb.isPureReactComponent=!0;var FA=Array.isArray;function ob(){}var qe={H:null,A:null,T:null,S:null},JA=Object.prototype.hasOwnProperty;function ab(t,e,n){var r=n.ref;return{$$typeof:ib,type:t,key:e,ref:r!==void 0?r:null,props:n}}function G8(t,e){return ab(t.type,e,t.props)}function cb(t){return typeof t=="object"&&t!==null&&t.$$typeof===ib}function X8(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var $A=/\/+/g;function rb(t,e){return typeof t=="object"&&t!==null&&t.key!=null?X8(""+t.key):e.toString(36)}function W8(t){switch(t.status){case"fulfilled":return t.value;case"rejected":throw t.reason;default:switch(typeof t.status=="string"?t.then(ob,ob):(t.status="pending",t.then(function(e){t.status==="pending"&&(t.status="fulfilled",t.value=e)},function(e){t.status==="pending"&&(t.status="rejected",t.reason=e)})),t.status){case"fulfilled":return t.value;case"rejected":throw t.reason}}throw t}function qa(t,e,n,r,o){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var s=!1;if(t===null)s=!0;else switch(i){case"bigint":case"string":case"number":s=!0;break;case"object":switch(t.$$typeof){case ib:case z8:s=!0;break;case qA:return s=t._init,qa(s(t._payload),e,n,r,o)}}if(s)return o=o(t),s=r===""?"."+rb(t,0):r,FA(o)?(n="",s!=null&&(n=s.replace($A,"$&/")+"/"),qa(o,e,n,"",function(c){return c})):o!=null&&(cb(o)&&(o=G8(o,n+(o.key==null||t&&t.key===o.key?"":(""+o.key).replace($A,"$&/")+"/")+s)),e.push(o)),1;s=0;var l=r===""?".":r+":";if(FA(t))for(var a=0;a<t.length;a++)r=t[a],i=l+rb(r,a),s+=qa(r,e,n,i,o);else if(a=K8(t),typeof a=="function")for(t=a.call(t),a=0;!(r=t.next()).done;)r=r.value,i=l+rb(r,a++),s+=qa(r,e,n,i,o);else if(i==="object"){if(typeof t.then=="function")return qa(W8(t),e,n,r,o);throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.")}return s}function hp(t,e,n){if(t==null)return t;var r=[],o=0;return qa(t,r,"","",function(i){return e.call(n,i,o++)}),r}function J8(t){if(t._status===-1){var e=t._result,n=e();n.then(function(r){(t._status===0||t._status===-1)&&(t._status=1,t._result=r,n.status===void 0&&(n.status="fulfilled",n.value=r))},function(r){(t._status===0||t._status===-1)&&(t._status=2,t._result=r,n.status===void 0&&(n.status="rejected",n.reason=r))}),t._status===-1&&(t._status=0,t._result=n)}if(t._status===1)return t._result.default;throw t._result}var YA=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)};function QA(t){var e=qe.T,n={};n.types=e!==null?e.types:null,qe.T=n;try{var r=t(),o=qe.S;o!==null&&o(n,r),typeof r=="object"&&r!==null&&typeof r.then=="function"&&r.then(ob,YA)}catch(i){YA(i)}finally{e!==null&&n.types!==null&&(e.types=n.types),qe.T=e}}function ZA(t){var e=qe.T;if(e!==null){var n=e.types;n===null?e.types=[t]:n.indexOf(t)===-1&&n.push(t)}else QA(ZA.bind(null,t))}var Q8={map:hp,forEach:function(t,e,n){hp(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return hp(t,function(){e++}),e},toArray:function(t){return hp(t,function(e){return e})||[]},only:function(t){if(!cb(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};te.Activity=Y8;te.Children=Q8;te.Component=Ka;te.Fragment=U8;te.Profiler=P8;te.PureComponent=sb;te.StrictMode=B8;te.Suspense=F8;te.ViewTransition=q8;te.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=qe;te.__COMPILER_RUNTIME={__proto__:null,c:function(t){return qe.H.useMemoCache(t)}};te.addTransitionType=ZA;te.cache=function(t){return function(){return t.apply(null,arguments)}};te.cacheSignal=function(){return null};te.cloneElement=function(t,e,n){if(t==null)throw Error("The argument must be a React element, but you passed "+t+".");var r=GA({},t.props),o=t.key;if(e!=null)for(i in e.key!==void 0&&(o=""+e.key),e)!JA.call(e,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&e.ref===void 0||(r[i]=e[i]);var i=arguments.length-2;if(i===1)r.children=n;else if(1<i){for(var s=Array(i),l=0;l<i;l++)s[l]=arguments[l+2];r.children=s}return ab(t.type,o,r)};te.createContext=function(t){return t={$$typeof:V8,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null},t.Provider=t,t.Consumer={$$typeof:H8,_context:t},t};te.createElement=function(t,e,n){var r,o={},i=null;if(e!=null)for(r in e.key!==void 0&&(i=""+e.key),e)JA.call(e,r)&&r!=="key"&&r!=="__self"&&r!=="__source"&&(o[r]=e[r]);var s=arguments.length-2;if(s===1)o.children=n;else if(1<s){for(var l=Array(s),a=0;a<s;a++)l[a]=arguments[a+2];o.children=l}if(t&&t.defaultProps)for(r in s=t.defaultProps,s)o[r]===void 0&&(o[r]=s[r]);return ab(t,i,o)};te.createRef=function(){return{current:null}};te.forwardRef=function(t){return{$$typeof:j8,render:t}};te.isValidElement=cb;te.lazy=function(t){return{$$typeof:qA,_payload:{_status:-1,_result:t},_init:J8}};te.memo=function(t,e){return{$$typeof:$8,type:t,compare:e===void 0?null:e}};te.startTransition=QA;te.unstable_useCacheRefresh=function(){return qe.H.useCacheRefresh()};te.use=function(t){return qe.H.use(t)};te.useActionState=function(t,e,n){return qe.H.useActionState(t,e,n)};te.useCallback=function(t,e){return qe.H.useCallback(t,e)};te.useContext=function(t){return qe.H.useContext(t)};te.useDebugValue=function(){};te.useDeferredValue=function(t,e){return qe.H.useDeferredValue(t,e)};te.useEffect=function(t,e){return qe.H.useEffect(t,e)};te.useEffectEvent=function(t){return qe.H.useEffectEvent(t)};te.useId=function(){return qe.H.useId()};te.useImperativeHandle=function(t,e,n){return qe.H.useImperativeHandle(t,e,n)};te.useInsertionEffect=function(t,e){return qe.H.useInsertionEffect(t,e)};te.useLayoutEffect=function(t,e){return qe.H.useLayoutEffect(t,e)};te.useMemo=function(t,e){return qe.H.useMemo(t,e)};te.useOptimistic=function(t,e){return qe.H.useOptimistic(t,e)};te.useReducer=function(t,e,n){return qe.H.useReducer(t,e,n)};te.useRef=function(t){return qe.H.useRef(t)};te.useState=function(t){return qe.H.useState(t)};te.useSyncExternalStore=function(t,e,n){return qe.H.useSyncExternalStore(t,e,n)};te.useTransition=function(){return qe.H.useTransition()};te.version="19.3.1"});var P=To((Qre,tk)=>{"use strict";tk.exports=ek()});var dk=To(nt=>{"use strict";function hb(t,e){var n=t.length;t.push(e);e:for(;0<n;){var r=n-1>>>1,o=t[r];if(0<pp(o,e))t[r]=e,t[n]=o,n=r;else break e}}function Ao(t){return t.length===0?null:t[0]}function gp(t){if(t.length===0)return null;var e=t[0],n=t.pop();if(n!==e){t[0]=n;e:for(var r=0,o=t.length,i=o>>>1;r<i;){var s=2*(r+1)-1,l=t[s],a=s+1,c=t[a];if(0>pp(l,n))a<o&&0>pp(c,l)?(t[r]=c,t[a]=n,r=a):(t[r]=l,t[s]=n,r=s);else if(a<o&&0>pp(c,n))t[r]=c,t[a]=n,r=a;else break e}}return e}function pp(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}nt.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(nk=performance,nt.unstable_now=function(){return nk.now()}):(ub=Date,rk=ub.now(),nt.unstable_now=function(){return ub.now()-rk});var nk,ub,rk,ci=[],ss=[],Z8=1,Br=null,Sn=3,pb=!1,Cd=!1,Ed=!1,mb=!1,sk=typeof setTimeout=="function"?setTimeout:null,lk=typeof clearTimeout=="function"?clearTimeout:null,ok=typeof setImmediate<"u"?setImmediate:null;function mp(t){for(var e=Ao(ss);e!==null;){if(e.callback===null)gp(ss);else if(e.startTime<=t)gp(ss),e.sortIndex=e.expirationTime,hb(ci,e);else break;e=Ao(ss)}}function gb(t){if(Ed=!1,mp(t),!Cd)if(Ao(ci)!==null)Cd=!0,Xa||(Xa=!0,Ga());else{var e=Ao(ss);e!==null&&yb(gb,e.startTime-t)}}var Xa=!1,Td=-1,ak=5,ck=-1;function uk(){return mb?!0:!(nt.unstable_now()-ck<ak)}function db(){if(mb=!1,Xa){var t=nt.unstable_now();ck=t;var e=!0;try{e:{Cd=!1,Ed&&(Ed=!1,lk(Td),Td=-1),pb=!0;var n=Sn;try{t:{for(mp(t),Br=Ao(ci);Br!==null&&!(Br.expirationTime>t&&uk());){var r=Br.callback;if(typeof r=="function"){Br.callback=null,Sn=Br.priorityLevel;var o=r(Br.expirationTime<=t);if(t=nt.unstable_now(),typeof o=="function"){Br.callback=o,mp(t),e=!0;break t}Br===Ao(ci)&&gp(ci),mp(t)}else gp(ci);Br=Ao(ci)}if(Br!==null)e=!0;else{var i=Ao(ss);i!==null&&yb(gb,i.startTime-t),e=!1}}break e}finally{Br=null,Sn=n,pb=!1}e=void 0}}finally{e?Ga():Xa=!1}}}var Ga;typeof ok=="function"?Ga=function(){ok(db)}:typeof MessageChannel<"u"?(fb=new MessageChannel,ik=fb.port2,fb.port1.onmessage=db,Ga=function(){ik.postMessage(null)}):Ga=function(){sk(db,0)};var fb,ik;function yb(t,e){Td=sk(function(){t(nt.unstable_now())},e)}nt.unstable_IdlePriority=5;nt.unstable_ImmediatePriority=1;nt.unstable_LowPriority=4;nt.unstable_NormalPriority=3;nt.unstable_Profiling=null;nt.unstable_UserBlockingPriority=2;nt.unstable_cancelCallback=function(t){t.callback=null};nt.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ak=0<t?Math.floor(1e3/t):5};nt.unstable_getCurrentPriorityLevel=function(){return Sn};nt.unstable_next=function(t){switch(Sn){case 1:case 2:case 3:var e=3;break;default:e=Sn}var n=Sn;Sn=e;try{return t()}finally{Sn=n}};nt.unstable_requestPaint=function(){mb=!0};nt.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=Sn;Sn=t;try{return e()}finally{Sn=n}};nt.unstable_scheduleCallback=function(t,e,n){var r=nt.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?r+n:r):n=r,t){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return o=n+o,t={id:Z8++,callback:e,priorityLevel:t,startTime:n,expirationTime:o,sortIndex:-1},n>r?(t.sortIndex=n,hb(ss,t),Ao(ci)===null&&t===Ao(ss)&&(Ed?(lk(Td),Td=-1):Ed=!0,yb(gb,n-r))):(t.sortIndex=o,hb(ci,t),Cd||pb||(Cd=!0,Xa||(Xa=!0,Ga()))),t};nt.unstable_shouldYield=uk;nt.unstable_wrapCallback=function(t){var e=Sn;return function(){var n=Sn;Sn=e;try{return t.apply(this,arguments)}finally{Sn=n}}}});var hk=To((eoe,fk)=>{"use strict";fk.exports=dk()});var gk=To(xn=>{"use strict";var eH=P();function mk(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function ls(){}var zn={d:{f:ls,r:function(){throw Error(mk(522))},D:ls,C:ls,L:ls,m:ls,X:ls,S:ls,M:ls},p:0,findDOMNode:null},tH=Symbol.for("react.portal"),nH=Symbol.for("react.recoverable"),pk=Symbol.for("react.optimistic_key");function rH(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:tH,key:r==null?null:r===pk?pk:""+r,children:t,containerInfo:e,implementation:n}}var Ad=eH.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function yp(t,e){if(t==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}xn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=zn;xn.browser=function(t){return{$$typeof:nH,_reason:t}};xn.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(mk(299));return rH(t,e,null,n)};xn.flushSync=function(t){var e=Ad.T,n=zn.p;try{if(Ad.T=null,zn.p=2,t)return t()}finally{Ad.T=e,zn.p=n,zn.d.f()}};xn.preconnect=function(t,e){typeof t=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,zn.d.C(t,e))};xn.prefetchDNS=function(t){typeof t=="string"&&zn.d.D(t)};xn.preinit=function(t,e){if(typeof t=="string"&&e&&typeof e.as=="string"){var n=e.as,r=yp(n,e.crossOrigin),o=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;n==="style"?zn.d.S(t,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:r,integrity:o,fetchPriority:i}):n==="script"&&zn.d.X(t,{crossOrigin:r,integrity:o,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};xn.preinitModule=function(t,e){if(typeof t=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var n=yp(e.as,e.crossOrigin);zn.d.M(t,{crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0})}}else e==null&&zn.d.M(t)};xn.preload=function(t,e){if(typeof t=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var n=e.as,r=yp(n,e.crossOrigin);zn.d.L(t,n,{crossOrigin:r,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};xn.preloadModule=function(t,e){if(typeof t=="string")if(e){var n=yp(e.as,e.crossOrigin);zn.d.m(t,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:n,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0})}else zn.d.m(t)};xn.requestFormReset=function(t){zn.d.r(t)};xn.unstable_batchedUpdates=function(t,e){return t(e)};xn.useFormState=function(t,e,n){return Ad.H.useFormState(t,e,n)};xn.useFormStatus=function(){return Ad.H.useHostTransitionStatus()};xn.version="19.3.1"});var Wa=To((noe,vk)=>{"use strict";function yk(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(yk)}catch(t){console.error(t)}}yk(),vk.exports=gk()});var oN=To(Qm=>{"use strict";var It=hk(),rR=P(),oH=Wa();function k(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function oR(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function pf(t){for(var e=t,n=e;n&&!n.alternate;)e=n,(e.flags&4098)!==0&&(t=e.return),n=e.return;for(;e.return;)e=e.return;return e.tag===3?t:null}function iR(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function sR(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function bk(t){if(pf(t)!==t)throw Error(k(188))}function iH(t){var e=t.alternate;if(!e){if(e=pf(t),e===null)throw Error(k(188));return e!==t?null:t}for(var n=t,r=e;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return bk(o),t;if(i===r)return bk(o),e;i=i.sibling}throw Error(k(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s)throw Error(k(189))}}if(n.alternate!==r)throw Error(k(190))}if(n.tag!==3)throw Error(k(188));return n.stateNode.current===n?t:e}function lR(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=lR(t),e!==null)return e;t=t.sibling}return null}function Wn(t,e,n,r,o,i){for(;t!==null;){if((t.tag===5||t.tag===27||t.tag===6)&&n(t,r,o,i)||(t.tag!==22||t.memoizedState===null)&&(e||t.tag!==5&&t.tag!==27)&&Wn(t.child,e,n,r,o,i))return!0;t=t.sibling}return!1}function Gl(t){for(t=t.return;t!==null;){if(t.tag===3||t.tag===5||t.tag===27)return t;t=t.return}return null}function wk(t){var e=!1;for(t=t.return;t!==null&&(t.tag===4&&(e=!0),!(t.tag===3||t.tag===5||t.tag===27));)t=t.return;return e}function aR(t){var e=[null,null],n=Gl(t);return n===null||cR(e,t,n.child,{foundSelf:!1}),e}function cR(t,e,n,r){for(;n!==null;){if(n===e)r.foundSelf=!0;else if(n.tag===5||n.tag===27||n.tag===6){if(r.foundSelf)return t[1]=n,!0;t[0]=n}else if((n.tag!==22||n.memoizedState===null)&&cR(t,e,n.child,r))return!0;n=n.sibling}return!1}function _t(t){switch(t.tag){case 5:case 27:case 6:return t.stateNode;case 3:return t.stateNode.containerInfo;default:throw Error(k(559))}}var rc=null,Xb=null;function sH(t,e,n){return t===n?!0:t===e?(rc=t,!0):!1}function lH(t,e,n){return t===n?(Xb=t,!1):t===e?(Xb!==null&&(rc=t),!0):!1}function Sk(t){if(t===null)return null;do t=t===null?null:t.return;while(t&&t.tag!==5&&t.tag!==27&&t.tag!==3);return t||null}function Wb(t,e,n){for(var r=0,o=t;o;o=n(o))r++;o=0;for(var i=e;i;i=n(i))o++;for(;0<r-o;)t=n(t),r--;for(;0<o-r;)e=n(e),o--;for(;r--;){if(t===e||e!==null&&t===e.alternate)return t;t=n(t),e=n(e)}return null}var Pe=Object.assign,aH=Symbol.for("react.element"),vp=Symbol.for("react.transitional.element"),_d=Symbol.for("react.portal"),oc=Symbol.for("react.fragment"),uR=Symbol.for("react.strict_mode"),Jb=Symbol.for("react.profiler"),dR=Symbol.for("react.consumer"),No=Symbol.for("react.context"),s1=Symbol.for("react.forward_ref"),Qb=Symbol.for("react.suspense"),Zb=Symbol.for("react.suspense_list"),l1=Symbol.for("react.memo"),ds=Symbol.for("react.lazy"),ew=Symbol.for("react.activity"),cH=Symbol.for("react.legacy_hidden"),uH=Symbol.for("react.memo_cache_sentinel"),tw=Symbol.for("react.view_transition"),dH=Symbol.for("react.recoverable"),xk=Symbol.iterator;function kd(t){return t===null||typeof t!="object"?null:(t=xk&&t[xk]||t["@@iterator"],typeof t=="function"?t:null)}var fH=Symbol.for("react.client.reference");function nw(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===fH?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case oc:return"Fragment";case Jb:return"Profiler";case uR:return"StrictMode";case Qb:return"Suspense";case Zb:return"SuspenseList";case ew:return"Activity";case tw:return"ViewTransition"}if(typeof t=="object")switch(t.$$typeof){case _d:return"Portal";case No:return t.displayName||"Context";case dR:return(t._context.displayName||"Context")+".Consumer";case s1:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case l1:return e=t.displayName||null,e!==null?e:nw(t.type)||"Memo";case ds:e=t._payload,t=t._init;try{return nw(t(e))}catch{}}return null}var Id=Array.isArray,Z=rR.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ae=oH.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Ll={pending:!1,data:null,method:null,action:null},rw=[],ic=-1;function Po(t){return{current:t}}function ln(t){0>ic||(t.current=rw[ic],rw[ic]=null,ic--)}function Xe(t,e){ic++,rw[ic]=t.current,t.current=e}var zo=Po(null),Jd=Po(null),ws=Po(null),om=Po(null);function im(t,e){switch(Xe(ws,e),Xe(Jd,t),Xe(zo,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?zM(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=zM(e),t=_D(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}ln(zo),Xe(zo,t)}function Tc(){ln(zo),ln(Jd),ln(ws)}function ow(t){var e=t.memoizedState;e!==null&&(Lc._currentValue=e.memoizedState,Xe(om,t)),e=zo.current;var n=_D(e,t.type);e!==n&&(Xe(Jd,t),Xe(zo,n))}function sm(t){Jd.current===t&&(ln(zo),ln(Jd)),om.current===t&&(ln(om),Lc._currentValue=Ll)}var vb,Ck;function cs(t){if(vb===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);vb=e&&e[1]||"",Ck=-1<n.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+vb+t+Ck}var bb=!1;function wb(t,e){if(!t||bb)return"";bb=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(e){var d=function(){throw Error()};if(Object.defineProperty(d.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(d,[])}catch(p){var f=p}Reflect.construct(t,[],d)}else{try{d.call()}catch(p){f=p}d=!1;try{var h=Object.getOwnPropertyDescriptor(t.prototype,"props");Object.defineProperty(t.prototype,"props",{configurable:!0,set:function(){throw Error()}}),d=!0,new t}finally{d&&(h!==void 0?Object.defineProperty(t.prototype,"props",h):delete t.prototype.props)}}}else{try{throw Error()}catch(p){f=p}(d=t())&&typeof d.catch=="function"&&d.catch(function(){})}}catch(p){if(p&&f&&typeof p.stack=="string")return[p.stack,f.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var i=r.DetermineComponentFrameRoot(),s=i[0],l=i[1];if(s&&l){var a=s.split(`
|
|
4
|
+
`),c=l.split(`
|
|
5
|
+
`);for(o=r=0;r<a.length&&!a[r].includes("DetermineComponentFrameRoot");)r++;for(;o<c.length&&!c[o].includes("DetermineComponentFrameRoot");)o++;if(r===a.length||o===c.length)for(r=a.length-1,o=c.length-1;1<=r&&0<=o&&a[r]!==c[o];)o--;for(;1<=r&&0<=o;r--,o--)if(a[r]!==c[o]){if(r!==1||o!==1)do if(r--,o--,0>o||a[r]!==c[o]){var u=`
|
|
6
|
+
`+a[r].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=r&&0<=o);break}}}finally{bb=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?cs(n):""}function hH(t,e){switch(t.tag){case 26:case 27:case 5:return cs(t.type);case 16:return cs("Lazy");case 13:return t.child!==e&&e!==null?cs("Suspense Fallback"):cs("Suspense");case 19:return cs("SuspenseList");case 0:case 15:return wb(t.type,!1);case 11:return wb(t.type.render,!1);case 1:return wb(t.type,!0);case 31:return cs("Activity");case 30:return cs("ViewTransition");default:return""}}function Ek(t){try{var e="",n=null;do e+=hH(t,n),n=t,t=t.return;while(t);return e}catch(r){return`
|
|
7
|
+
Error generating stack: `+r.message+`
|
|
8
|
+
`+r.stack}}var iw=Object.prototype.hasOwnProperty,a1=It.unstable_scheduleCallback,Sb=It.unstable_cancelCallback,pH=It.unstable_shouldYield,mH=It.unstable_requestPaint,br=It.unstable_now,gH=It.unstable_getCurrentPriorityLevel,fR=It.unstable_ImmediatePriority,hR=It.unstable_UserBlockingPriority,lm=It.unstable_NormalPriority,yH=It.unstable_LowPriority,pR=It.unstable_IdlePriority,vH=It.log,bH=It.unstable_setDisableYieldValue,mf=null,wr=null;function ps(t){if(typeof vH=="function"&&bH(t),wr&&typeof wr.setStrictMode=="function")try{wr.setStrictMode(mf,t)}catch{}}var Sr=Math.clz32?Math.clz32:xH,wH=Math.log,SH=Math.LN2;function xH(t){return t>>>=0,t===0?32:31-(wH(t)/SH|0)|0}var bp=256,wp=262144,Sp=4194304;function Ol(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&-t;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function _m(t,e,n){var r=t.pendingLanes;if(r===0)return 0;var o=0,i=t.suspendedLanes,s=t.pingedLanes;t=t.warmLanes;var l=r&134217727;return l!==0?(r=l&~i,r!==0?o=Ol(r):(s&=l,s!==0?o=Ol(s):n||(n=l&~t,n!==0&&(o=Ol(n))))):(l=r&~i,l!==0?o=Ol(l):s!==0?o=Ol(s):n||(n=r&~t,n!==0&&(o=Ol(n)))),o===0?0:e!==0&&e!==o&&(e&i)===0&&(i=o&-o,n=e&-e,i>=n||i===32&&(n&4194048)!==0)?e:o}function gf(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function mR(t,e){(e&8)!==0&&(e|=e&32);var n=t.entangledLanes;if(n!==0)for(t=t.entanglements,n&=e;0<n;){var r=31-Sr(n),o=1<<r;e|=t[r],n&=~o}return e}function CH(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function gR(){var t=Sp;return Sp<<=1,(Sp&62914560)===0&&(Sp=4194304),t}function xb(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function yf(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function EH(t,e,n,r,o,i){var s=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var l=t.entanglements,a=t.expirationTimes,c=t.hiddenUpdates;for(n=s&~n;0<n;){var u=31-Sr(n),d=1<<u;l[u]=0,a[u]=-1;var f=c[u];if(f!==null)for(c[u]=null,u=0;u<f.length;u++){var h=f[u];h!==null&&(h.lane&=-536870913)}n&=~d}r!==0&&yR(t,r,0),i!==0&&o===0&&t.tag!==0&&(t.suspendedLanes|=i&~(s&~e))}function yR(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var r=31-Sr(e);t.entangledLanes|=e,t.entanglements[r]=t.entanglements[r]|1073741824|n&261930}function vR(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-Sr(n),o=1<<r;o&e|t[r]&e&&(t[r]|=e),n&=~o}}function bR(t,e){var n=e&-e;return n=(n&42)!==0?1:c1(n),(n&(t.suspendedLanes|e))!==0?0:n}function c1(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function u1(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function wR(){var t=Ae.p;return t!==0?t:(t=window.event,t===void 0?32:tN(t.type))}function Tk(t,e){var n=Ae.p;try{return Ae.p=t,e()}finally{Ae.p=n}}var xi=Math.random().toString(36).slice(2),on="__reactFiber$"+xi,Jn="__reactProps$"+xi,Bc="__reactContainer$"+xi,Ak="__reactEvents$"+xi,TH="__reactListeners$"+xi,AH="__reactHandles$"+xi,kk="__reactResources$"+xi,vf="__reactMarker$"+xi,am="__reactLoad$"+xi;function Im(t){delete t[on],delete t[Jn],delete t[TH],delete t[AH]}function _l(t){var e;if(e=t[on])return e;for(var n=t.parentNode;n;){if(e=n[Bc]||n[on]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=$M(t);t!==null;){if(n=t[on])return n;t=$M(t)}return e}t=n,n=t.parentNode}return null}function Pc(t){if(t=t[on]||t[Bc]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function Ld(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(k(33))}function mc(t){var e=t[kk];return e||(e=t[kk]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function qt(t){t[vf]=!0}function SR(t){t[am]=void 0}var xR=new Set,CR={};function Xl(t,e){Ac(t,e),Ac(t+"Capture",e)}function Ac(t,e){for(CR[t]=e,t=0;t<e.length;t++)xR.add(e[t])}var kH=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Mk={},Rk={};function MH(t){return iw.call(Rk,t)?!0:iw.call(Mk,t)?!1:kH.test(t)?Rk[t]=!0:(Mk[t]=!0,!1)}var Se=!1;function Ok(){var t=Se;return Se=!1,t}function Pp(t,e,n){if(MH(e))if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(e);return;case"boolean":var r=e.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){t.removeAttribute(e);return}}t.setAttribute(e,n)}}function xp(t,e,n){if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(e);return}t.setAttribute(e,n)}}function ui(t,e,n,r){if(r===null)t.removeAttribute(n);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(e,n,r)}}function mr(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ER(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function RH(t,e,n){var r=Object.getOwnPropertyDescriptor(t.constructor.prototype,e);if(!t.hasOwnProperty(e)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,i=r.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(s){n=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(s){n=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function sw(t){if(!t._valueTracker){var e=ER(t)?"checked":"value";t._valueTracker=RH(t,e,""+t[e])}}function TR(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=ER(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}var OH=/[\n"\\]/g;function Fr(t){return t.replace(OH,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function lw(t,e,n,r,o,i,s,l){t.name="",s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?t.type=s:t.removeAttribute("type"),e!=null?s==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+mr(e)):t.value!==""+mr(e)&&(t.value=""+mr(e)):s!=="submit"&&s!=="reset"||t.removeAttribute("value"),e!=null?s==="number"&&t.value==e?Cb(t,mr(t.value)):Cb(t,mr(e)):n!=null?Cb(t,mr(n)):r!=null&&t.removeAttribute("value"),o==null&&i!=null&&(t.defaultChecked=!!i),o!=null&&(t.checked=o&&typeof o!="function"&&typeof o!="symbol"),l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"?t.name=""+mr(l):t.removeAttribute("name")}function AR(t,e,n,r,o,i,s,l){if(i!=null&&typeof i!="function"&&typeof i!="symbol"&&typeof i!="boolean"&&(t.type=i),e!=null||n!=null){if(!(i!=="submit"&&i!=="reset"||e!=null)){sw(t);return}n=n!=null?""+mr(n):"",e=e!=null?""+mr(e):n,l||e===t.value||(t.value=e),t.defaultValue=e}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,t.checked=l?t.checked:!!r,t.defaultChecked=!!r,s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"&&(t.name=s),sw(t)}function Cb(t,e){t.defaultValue!==""+e&&(t.defaultValue=""+e)}function gc(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o<n.length;o++)e["$"+n[o]]=!0;for(n=0;n<t.length;n++)o=e.hasOwnProperty("$"+t[n].value),t[n].selected!==o&&(t[n].selected=o),o&&r&&(t[n].defaultSelected=!0)}else{for(n=""+mr(n),e=null,o=0;o<t.length;o++){if(t[o].value===n){t[o].selected=!0,r&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function kR(t,e,n){if(e!=null&&(e=""+mr(e),e!==t.value&&(t.value=e),n==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=n!=null?""+mr(n):""}function MR(t,e,n,r){if(e==null){if(r!=null){if(n!=null)throw Error(k(92));if(Id(r)){if(1<r.length)throw Error(k(93));r=r[0]}n=r}n==null&&(n=""),e=n}n=mr(e),t.defaultValue=n,r=t.textContent,r===n&&r!==""&&r!==null&&(t.value=r),sw(t)}function kc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var DH=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Dk(t,e,n){var r=e.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?r?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":r?t.setProperty(e,n):typeof n!="number"||n===0||DH.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function RR(t,e,n){if(e!=null&&typeof e!="object")throw Error(k(62));if(t=t.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||e!=null&&e.hasOwnProperty(r)||(r.indexOf("--")===0?t.setProperty(r,""):r==="float"?t.cssFloat="":t[r]="",Se=!0);for(var o in e)r=e[o],e.hasOwnProperty(o)&&n[o]!==r&&(Dk(t,o,r),Se=!0)}else for(var i in e)e.hasOwnProperty(i)&&Dk(t,i,e[i])}function d1(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var NH=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["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"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["maskType","mask-type"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["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"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["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"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),_H=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Hp(t){return _H.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function _o(){}var aw=null;function f1(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var sc=null,yc=null;function Nk(t){var e=Pc(t);if(e&&(t=e.stateNode)){var n=t[Jn]||null;e:switch(t=e.stateNode,e.type){case"input":if(lw(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Fr(""+e)+'"][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var o=r[Jn]||null;if(!o)throw Error(k(90));lw(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(e=0;e<n.length;e++)r=n[e],r.form===t.form&&TR(r)}break e;case"textarea":kR(t,n.value,n.defaultValue);break e;case"select":e=n.value,e!=null&&gc(t,!!n.multiple,e,!1)}}}var Eb=!1;function OR(t,e,n){if(Eb)return t(e,n);Eb=!0;try{var r=t(e);return r}finally{if(Eb=!1,(sc!==null||yc!==null)&&(Gm(),sc&&(e=sc,t=yc,yc=sc=null,Nk(e),t)))for(e=0;e<t.length;e++)Nk(t[e])}}function Qd(t,e){var n=t.stateNode;if(n===null)return null;var r=n[Jn]||null;if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(k(231,e,typeof n));return n}var gi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),cw=!1;if(gi)try{Ja={},Object.defineProperty(Ja,"passive",{get:function(){cw=!0}}),window.addEventListener("test",Ja,Ja),window.removeEventListener("test",Ja,Ja)}catch{cw=!1}var Ja,ms=null,h1=null,Vp=null;function DR(){if(Vp)return Vp;var t,e=h1,n=e.length,r,o="value"in ms?ms.value:ms.textContent,i=o.length;for(t=0;t<n&&e[t]===o[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===o[i-r];r++);return Vp=o.slice(t,1<r?1-r:void 0)}function jp(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Cp(){return!0}function _k(){return!1}function Hn(t){function e(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Cp:_k,this.isPropagationStopped=_k,this}return Pe(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Cp)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Cp)},persist:function(){},isPersistent:Cp}),e}var Ls={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Lm=Hn(Ls),bf=Pe({},Ls,{view:0,detail:0}),IH=Hn(bf),Tb,Ab,Md,zm=Pe({},bf,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:p1,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==Md&&(Md&&t.type==="mousemove"?(Tb=t.screenX-Md.screenX,Ab=t.screenY-Md.screenY):Ab=Tb=0,Md=t),Tb)},movementY:function(t){return"movementY"in t?t.movementY:Ab}}),Ik=Hn(zm),LH=Pe({},zm,{dataTransfer:0}),zH=Hn(LH),UH=Pe({},bf,{relatedTarget:0}),kb=Hn(UH),BH=Pe({},Ls,{animationName:0,elapsedTime:0,pseudoElement:0}),PH=Hn(BH),HH=Pe({},Ls,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),VH=Hn(HH),jH=Pe({},Ls,{data:0}),Lk=Hn(jH),FH={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$H={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},YH={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qH(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=YH[t])?!!e[t]:!1}function p1(){return qH}var KH=Pe({},bf,{key:function(t){if(t.key){var e=FH[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=jp(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?$H[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:p1,charCode:function(t){return t.type==="keypress"?jp(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?jp(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),GH=Hn(KH),XH=Pe({},zm,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),zk=Hn(XH),WH=Pe({},Ls,{submitter:0}),JH=Hn(WH),QH=Pe({},bf,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:p1}),ZH=Hn(QH),eV=Pe({},Ls,{propertyName:0,elapsedTime:0,pseudoElement:0}),tV=Hn(eV),nV=Pe({},zm,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),rV=Hn(nV),oV=Pe({},Ls,{newState:0,oldState:0,source:0}),iV=Hn(oV),sV=[9,13,27,32],m1=gi&&"CompositionEvent"in window,Bd=null;gi&&"documentMode"in document&&(Bd=document.documentMode);var lV=gi&&"TextEvent"in window&&!Bd,NR=gi&&(!m1||Bd&&8<Bd&&11>=Bd),Uk=" ",Bk=!1;function _R(t,e){switch(t){case"keyup":return sV.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function IR(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var lc=!1;function aV(t,e){switch(t){case"compositionend":return IR(e);case"keypress":return e.which!==32?null:(Bk=!0,Uk);case"textInput":return t=e.data,t===Uk&&Bk?null:t;default:return null}}function cV(t,e){if(lc)return t==="compositionend"||!m1&&_R(t,e)?(t=DR(),Vp=h1=ms=null,lc=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return NR&&e.locale!=="ko"?null:e.data;default:return null}}var uV={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Pk(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!uV[t.type]:e==="textarea"}function LR(t,e,n,r){sc?yc?yc.push(r):yc=[r]:sc=r,e=Om(e,"onChange"),0<e.length&&(n=new Lm("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Pd=null,Zd=null;function dV(t){OD(t,0)}function Um(t){var e=Ld(t);if(TR(e))return t}function Hk(t,e){if(t==="change")return e}var zR=!1;gi&&(gi?(Tp="oninput"in document,Tp||(Mb=document.createElement("div"),Mb.setAttribute("oninput","return;"),Tp=typeof Mb.oninput=="function"),Ep=Tp):Ep=!1,zR=Ep&&(!document.documentMode||9<document.documentMode));var Ep,Tp,Mb;function Vk(){Pd&&(Pd.detachEvent("onpropertychange",UR),Zd=Pd=null)}function UR(t){if(t.propertyName==="value"&&Um(Zd)){var e=[];LR(e,Zd,t,f1(t)),OR(dV,e)}}function fV(t,e,n){t==="focusin"?(Vk(),Pd=e,Zd=n,Pd.attachEvent("onpropertychange",UR)):t==="focusout"&&Vk()}function hV(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Um(Zd)}function pV(t,e){if(t==="click")return Um(e)}function mV(t,e){if(t==="input"||t==="change")return Um(e)}function gV(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Cr=typeof Object.is=="function"?Object.is:gV;function ef(t,e){if(Cr(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var o=n[r];if(!iw.call(e,o)||!Cr(t[o],e[o]))return!1}return!0}function uw(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function jk(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Fk(t,e){var n=jk(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=jk(n)}}function BR(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?BR(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function PR(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=uw(t.document);e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=uw(t.document)}return e}function g1(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var yV=gi&&"documentMode"in document&&11>=document.documentMode,ac=null,dw=null,Hd=null,fw=!1;function $k(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;fw||ac==null||ac!==uw(r)||(r=ac,"selectionStart"in r&&g1(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Hd&&ef(Hd,r)||(Hd=r,r=Om(dw,"onSelect"),0<r.length&&(e=new Lm("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=ac)))}function Ml(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var cc={animationend:Ml("Animation","AnimationEnd"),animationiteration:Ml("Animation","AnimationIteration"),animationstart:Ml("Animation","AnimationStart"),transitionrun:Ml("Transition","TransitionRun"),transitionstart:Ml("Transition","TransitionStart"),transitioncancel:Ml("Transition","TransitionCancel"),transitionend:Ml("Transition","TransitionEnd")},Rb={},HR={};gi&&(HR=document.createElement("div").style,"AnimationEvent"in window||(delete cc.animationend.animation,delete cc.animationiteration.animation,delete cc.animationstart.animation),"TransitionEvent"in window||delete cc.transitionend.transition);function Wl(t){if(Rb[t])return Rb[t];if(!cc[t])return t;var e=cc[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in HR)return Rb[t]=e[n];return t}var VR=Wl("animationend"),jR=Wl("animationiteration"),FR=Wl("animationstart"),vV=Wl("transitionrun"),bV=Wl("transitionstart"),wV=Wl("transitioncancel"),$R=Wl("transitionend"),YR=new Map,hw="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error fullscreenChange fullscreenError gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");hw.push("scrollEnd");function fo(t,e){YR.set(t,e),Xl(e,[t])}var SV=0;function yi(t,e){if(t.name!=null&&t.name!=="auto")return t.name;if(e.autoName!==null)return e.autoName;t=uo.identifierPrefix;var n=SV++;return t="_"+t+"t_"+n.toString(32)+"_",e.autoName=t}function Yk(t){if(t==null||typeof t=="string")return t;var e=null,n=Ec;if(n!==null)for(var r=0;r<n.length;r++){var o=t[n[r]];if(o!=null){if(o==="none")return"none";e=e==null?o:e+(" "+o)}}return e??t.default}function Ci(t,e){return t=Yk(t),e=Yk(e),e==null?t==="auto"?null:t:e==="auto"?null:e}var cm=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Hr=[],uc=0,y1=0;function Bm(){for(var t=uc,e=y1=uc=0;e<t;){var n=Hr[e];Hr[e++]=null;var r=Hr[e];Hr[e++]=null;var o=Hr[e];Hr[e++]=null;var i=Hr[e];if(Hr[e++]=null,r!==null&&o!==null){var s=r.pending;s===null?o.next=o:(o.next=s.next,s.next=o),r.pending=o}i!==0&&qR(n,o,i)}}function Pm(t,e,n,r){Hr[uc++]=t,Hr[uc++]=e,Hr[uc++]=n,Hr[uc++]=r,y1|=r,t.lanes|=r,t=t.alternate,t!==null&&(t.lanes|=r)}function v1(t,e,n,r){return Pm(t,e,n,r),um(t)}function Jl(t,e){return Pm(t,null,null,e),um(t)}function qR(t,e,n){t.lanes|=n;var r=t.alternate;r!==null&&(r.lanes|=n);for(var o=!1,i=t.return;i!==null;)i.childLanes|=n,r=i.alternate,r!==null&&(r.childLanes|=n),i.tag===22&&(t=i.stateNode,t===null||t._visibility&1||(o=!0)),t=i,i=i.return;return t.tag===3?(i=t.stateNode,o&&e!==null&&(o=31-Sr(n),t=i.hiddenUpdates,r=t[o],r===null?t[o]=[e]:r.push(e),e.lane=n|536870912),i):null}function um(t){if(50<Wd)throw Wd=0,Qp=null,Error(k(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var dc={};function xV(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Gn(t,e,n,r){return new xV(t,e,n,r)}function b1(t){return t=t.prototype,!(!t||!t.isReactComponent)}function pi(t,e){var n=t.alternate;return n===null?(n=Gn(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&1206910976,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function KR(t,e){t.flags&=1206910978;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function Fp(t,e,n,r,o,i){var s=0;if(r=t,typeof r=="function")b1(r)&&(s=1);else if(typeof r=="string")s=Gj(t,n,zo.current)?26:t==="html"||t==="head"||t==="body"?27:5;else e:switch(r){case ew:return t=Gn(31,n,e,o),t.elementType=ew,t.lanes=i,t;case oc:return zl(n.children,o,i,e);case uR:s=8,o|=24;break;case Jb:return t=Gn(12,n,e,o|2),t.elementType=Jb,t.lanes=i,t;case Qb:return t=Gn(13,n,e,o),t.elementType=Qb,t.lanes=i,t;case Zb:return t=Gn(19,n,e,o),t.elementType=Zb,t.lanes=i,t;case cH:case tw:return t=o|32,t=Gn(30,n,e,t),t.elementType=tw,t.lanes=i,t.stateNode={autoName:null,paired:null,clones:null,ref:null},t;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case No:s=10;break e;case dR:s=9;break e;case s1:s=11;break e;case l1:s=14;break e;case ds:s=16,r=null;break e}s=29,n=Error(k(130,t===null?"null":typeof t,"")),r=null}return e=Gn(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function zl(t,e,n,r){return t=Gn(7,t,r,e),t.lanes=n,t}function Ob(t,e,n){return t=Gn(6,t,null,e),t.lanes=n,t}function GR(t){var e=Gn(18,null,null,0);return e.stateNode=t,e}function Db(t,e,n){return e=Gn(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var qk=new WeakMap;function $r(t,e){if(typeof t=="object"&&t!==null){var n=qk.get(t);return n!==void 0?n:(e={value:t,source:e,stack:Ek(e)},qk.set(t,e),e)}return{value:t,source:e,stack:Ek(e)}}var fc=[],hc=0,dm=null,tf=0,Vr=[],jr=0,Os=null,Io=1,Lo="";function fi(t,e){fc[hc++]=tf,fc[hc++]=dm,dm=t,tf=e}function XR(t,e,n){Vr[jr++]=Io,Vr[jr++]=Lo,Vr[jr++]=Os,Os=t;var r=Io;t=Lo;var o=32-Sr(r)-1;r&=~(1<<o),n+=1;var i=32-Sr(e)+o;if(30<i){var s=o-o%5;i=(r&(1<<s)-1).toString(32),r>>=s,o-=s,Io=1<<32-Sr(e)+o|n<<o|r,Lo=i+t}else Io=1<<i|n<<o|r,Lo=t}function Hm(t){t.return!==null&&(fi(t,1),XR(t,1,0))}function w1(t){for(;t===dm;)dm=fc[--hc],fc[hc]=null,tf=fc[--hc],fc[hc]=null;for(;t===Os;)Os=Vr[--jr],Vr[jr]=null,Lo=Vr[--jr],Vr[jr]=null,Io=Vr[--jr],Vr[jr]=null}function WR(t,e){Vr[jr++]=Io,Vr[jr++]=Lo,Vr[jr++]=Os,Io=e.id,Lo=e.overflow,Os=t}var Kt=null,Ge=null,de=!1,Ss=null,Yr=!1,pw=Error(k(519));function Ds(t){var e=Error(k(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw nf($r(e,t)),pw}function Kk(t){var e=t.stateNode,n=t.type,r=t.memoizedProps;switch(e[on]=t,e[Jn]=r,n){case"dialog":he("cancel",e),he("close",e);break;case"iframe":case"object":case"embed":he("load",e);break;case"video":case"audio":for(n=0;n<lf.length;n++)he(lf[n],e);break;case"source":he("error",e);break;case"img":case"image":case"link":he("error",e),he("load",e);break;case"details":he("toggle",e);break;case"input":he("invalid",e),AR(e,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":he("invalid",e);break;case"textarea":he("invalid",e),MR(e,r.value,r.defaultValue,r.children)}n=r.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||e.textContent===""+n||r.suppressHydrationWarning===!0||ND(e.textContent,n)?(r.popover!=null&&(he("beforetoggle",e),he("toggle",e)),r.onScroll!=null&&he("scroll",e),r.onScrollEnd!=null&&he("scrollend",e),r.onClick!=null&&(e.onclick=_o),e=!0):e=!1,e||Ds(t,!0)}function fm(t){for(Kt=t.return;Kt;)switch(Kt.tag){case 5:case 31:case 13:Yr=!1;return;case 27:case 3:Yr=!0;return;default:Kt=Kt.return}}function Qa(t){if(t!==Kt)return!1;if(!de)return fm(t),de=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||Qw(t.type,t.memoizedProps)),n=!n),n&&Ge&&Ds(t),fm(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(k(317));Ge=FM(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(k(317));Ge=FM(t)}else e===27?(e=Ge,zs(t.type)?(t=n1,n1=null,Ge=t):Ge=e):Ge=Kt?qr(t.stateNode.nextSibling):null;return!0}function Hl(){Ge=Kt=null,de=!1}function Nb(){var t=Ss;return t!==null&&(qn===null?qn=t:qn.push.apply(qn,t),Ss=null),t}function nf(t){Ss===null?Ss=[t]:Ss.push(t)}var mw=Po(null),Ql=null,hi=null;function gs(t,e,n){Xe(mw,e._currentValue),e._currentValue=n}function mi(t){t._currentValue=mw.current,ln(mw)}function $p(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function gw(t,e,n,r){var o=t.child;for(o!==null&&(o.return=t);o!==null;){var i=o.dependencies;if(i!==null){var s=o.child;i=i.firstContext;e:for(;i!==null;){var l=i;i=o;for(var a=0;a<e.length;a++)if(l.context===e[a]){i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),$p(i.return,n,t),r||(s=null);break e}i=l.next}}else if(o.tag===18){if(s=o.return,s===null)throw Error(k(341));s.lanes|=n,i=s.alternate,i!==null&&(i.lanes|=n),$p(s,n,t),s=null}else o.tag===13&&o.memoizedState!==null&&o.memoizedState.dehydrated===null?(o.lanes|=n,s=o.alternate,s!==null&&(s.lanes|=n),$p(o.return,n,t),s=o.child,s=s!==null?s.sibling:null):s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}}function Vl(t,e,n,r){t=null;for(var o=e,i=!1;o!==null;){if(!i){if((o.flags&524288)!==0)i=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var s=o.alternate;if(s===null)throw Error(k(387));if(s=s.memoizedProps,s!==null){var l=o.type;Cr(o.pendingProps.value,s.value)||(t!==null?t.push(l):t=[l])}}else if(o===om.current){if(s=o.alternate,s===null)throw Error(k(387));s.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(t!==null?t.push(Lc):t=[Lc])}o=o.return}return t!==null&&gw(e,t,n,r),e.flags|=262144,t!==null}function hm(t){for(t=t.firstContext;t!==null;){if(!Cr(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function jl(t){Ql=t,hi=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function sn(t){return JR(Ql,t)}function Ap(t,e){return Ql===null&&jl(t),JR(t,e)}function JR(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},hi===null){if(t===null)throw Error(k(308));hi=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else hi=hi.next=e;return n}var CV=typeof AbortController<"u"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(n,r){t.push(r)}};this.abort=function(){e.aborted=!0,t.forEach(function(n){return n()})}},EV=It.unstable_scheduleCallback,TV=It.unstable_NormalPriority,xt={$$typeof:No,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function S1(){return{controller:new CV,data:new Map,refCount:0}}function wf(t){t.refCount--,t.refCount===0&&EV(TV,function(){t.controller.abort()})}function Gk(t,e){if((t.pendingLanes&4194048)!==0){var n=t.transitionTypes;for(n===null&&(n=t.transitionTypes=[]),t=0;t<e.length;t++){var r=e[t];n.indexOf(r)===-1&&n.push(r)}}}var zd=null;function AV(t){var e=t.transitionTypes;return t.transitionTypes=null,e}var Vd=null,yw=0,Fl=0,vc=null;function kV(t,e){if(Vd===null){var n=Vd=[];yw=0,Fl=X1(),vc={status:"pending",value:void 0,then:function(r){n.push(r)}}}return yw++,e.then(Xk,Xk),e}function Xk(){if(--yw===0&&(zd=null,Vd!==null)){vc!==null&&(vc.status="fulfilled");var t=Vd;Vd=null,Fl=0,vc=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function MV(t,e){var n=[],r={status:"pending",value:null,reason:null,then:function(o){n.push(o)}};return t.then(function(){r.status="fulfilled",r.value=e;for(var o=0;o<n.length;o++)(0,n[o])(e)},function(o){for(r.status="rejected",r.reason=o,o=0;o<n.length;o++)(0,n[o])(void 0)}),r}var Wk=Z.S;Z.S=function(t,e){if(mD=br(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&kV(t,e),zd!==null)for(var n=Nc;n!==null;)Gk(n,zd),n=n.next;if(n=t.types,n!==null){for(var r=Nc;r!==null;)Gk(r,n),r=r.next;if(Fl!==0){r=zd,r===null&&(r=zd=[]);for(var o=0;o<n.length;o++){var i=n[o];r.indexOf(i)===-1&&r.push(i)}}}Wk!==null&&Wk(t,e)};var Ul=Po(null);function x1(){var t=Ul.current;return t!==null?t:Be.pooledCache}function Yp(t,e){e===null?Xe(Ul,Ul.current):Xe(Ul,e.pool)}function QR(){var t=x1();return t===null?null:{parent:xt._currentValue,pool:t}}var Hc=Error(k(460)),C1=Error(k(474)),Vm=Error(k(542)),pm={then:function(){}};function Jk(t){return t=t.status,t==="fulfilled"||t==="rejected"}function ZR(t,e,n){switch(n=t[n],n===void 0?t.push(e):n!==e&&(e.then(_o,_o),e=n),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,Zk(t),t===void 0&&!("reason"in e)?Error(k(600)):t;default:if(typeof e.status=="string")e.then(_o,_o);else{if(t=Be,t!==null&&100<t.shellSuspendCounter)throw Error(k(482));t=e,t.status="pending",t.then(function(r){if(e.status==="pending"){var o=e;o.status="fulfilled",o.value=r}},function(r){if(e.status==="pending"){var o=e;o.status="rejected",o.reason=r}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,Zk(t),t}throw Bl=e,Hc}}function Dl(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Bl=n,Hc):n}}var Bl=null;function Qk(){if(Bl===null)throw Error(k(459));var t=Bl;return Bl=null,t}function Zk(t){if(t===Hc||t===Vm)throw Error(k(483))}var bc=null,rf=0;function kp(t){var e=rf;return rf+=1,bc===null&&(bc=[]),ZR(bc,t,e)}function as(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function Mp(t,e){throw e.$$typeof===aH?Error(k(525)):(t=Object.prototype.toString.call(e),Error(k(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function eO(t){function e(g,v){if(t){var b=g.deletions;b===null?(g.deletions=[v],g.flags|=16):b.push(v)}}function n(g,v){if(!t)return null;for(;v!==null;)e(g,v),v=v.sibling;return null}function r(g){for(var v=new Map;g!==null;)g.key===null?v.set(g.index,g):v.set(g.key,g),g=g.sibling;return v}function o(g,v){return g=pi(g,v),g.index=0,g.sibling=null,g}function i(g,v,b){return g.index=b,t?(b=g.alternate,b!==null?(b=b.index,b<v?(g.flags|=2,v):b):(g.flags|=134217730,v)):(g.flags|=1048576,v)}function s(g){return t&&g.alternate===null&&(g.flags|=134217730),g}function l(g,v,b,w){return v===null||v.tag!==6?(v=Ob(b,g.mode,w),v.return=g,v):(v=o(v,b),v.return=g,v)}function a(g,v,b,w){var S=b.type;return S===oc?(g=u(g,v,b.props.children,w,b.key),as(g,b),g):v!==null&&(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ds&&Dl(S)===v.type)?(v=o(v,b.props),as(v,b),v.return=g,v):(v=Fp(b.type,b.key,b.props,null,g.mode,w),as(v,b),v.return=g,v)}function c(g,v,b,w){return v===null||v.tag!==4||v.stateNode.containerInfo!==b.containerInfo||v.stateNode.implementation!==b.implementation?(v=Db(b,g.mode,w),v.return=g,v):(v=o(v,b.children||[]),v.return=g,v)}function u(g,v,b,w,S){return v===null||v.tag!==7?(v=zl(b,g.mode,w,S),v.return=g,v):(v=o(v,b),v.return=g,v)}function d(g,v,b){if(typeof v=="string"&&v!==""||typeof v=="number"||typeof v=="bigint")return v=Ob(""+v,g.mode,b),v.return=g,v;if(typeof v=="object"&&v!==null){switch(v.$$typeof){case vp:return b=Fp(v.type,v.key,v.props,null,g.mode,b),as(b,v),b.return=g,b;case _d:return v=Db(v,g.mode,b),v.return=g,v;case ds:return v=Dl(v),d(g,v,b)}if(Id(v)||kd(v))return v=zl(v,g.mode,b,null),v.return=g,v;if(typeof v.then=="function")return d(g,kp(v),b);if(v.$$typeof===No)return d(g,Ap(g,v),b);Mp(g,v)}return null}function f(g,v,b,w){var S=v!==null?v.key:null;if(typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint")return S!==null?null:l(g,v,""+b,w);if(typeof b=="object"&&b!==null){switch(b.$$typeof){case vp:return b.key===S?a(g,v,b,w):null;case _d:return b.key===S?c(g,v,b,w):null;case ds:return b=Dl(b),f(g,v,b,w)}if(Id(b)||kd(b))return S!==null?null:u(g,v,b,w,null);if(typeof b.then=="function")return f(g,v,kp(b),w);if(b.$$typeof===No)return f(g,v,Ap(g,b),w);Mp(g,b)}return null}function h(g,v,b,w,S){if(typeof w=="string"&&w!==""||typeof w=="number"||typeof w=="bigint")return g=g.get(b)||null,l(v,g,""+w,S);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case vp:return g=g.get(w.key===null?b:w.key)||null,a(v,g,w,S);case _d:return g=g.get(w.key===null?b:w.key)||null,c(v,g,w,S);case ds:return w=Dl(w),h(g,v,b,w,S)}if(Id(w)||kd(w))return g=g.get(b)||null,u(v,g,w,S,null);if(typeof w.then=="function")return h(g,v,b,kp(w),S);if(w.$$typeof===No)return h(g,v,b,Ap(v,w),S);Mp(v,w)}return null}function p(g,v,b,w){for(var S=null,C=null,x=v,E=v=0,A=null;x!==null&&E<b.length;E++){x.index>E?(A=x,x=null):A=x.sibling;var T=f(g,x,b[E],w);if(T===null){x===null&&(x=A);break}t&&x&&T.alternate===null&&e(g,x),v=i(T,v,E),C===null?S=T:C.sibling=T,C=T,x=A}if(E===b.length)return n(g,x),de&&fi(g,E),S;if(x===null){for(;E<b.length;E++)x=d(g,b[E],w),x!==null&&(v=i(x,v,E),C===null?S=x:C.sibling=x,C=x);return de&&fi(g,E),S}for(x=r(x);E<b.length;E++)A=h(x,g,E,b[E],w),A!==null&&(t&&(T=A.alternate,T!==null&&x.delete(T.key===null?E:T.key)),v=i(A,v,E),C===null?S=A:C.sibling=A,C=A);return t&&x.forEach(function(_){return e(g,_)}),de&&fi(g,E),S}function m(g,v,b,w){if(b==null)throw Error(k(151));for(var S=null,C=null,x=v,E=v=0,A=null,T=b.next();x!==null&&!T.done;E++,T=b.next()){x.index>E?(A=x,x=null):A=x.sibling;var _=f(g,x,T.value,w);if(_===null){x===null&&(x=A);break}t&&x&&_.alternate===null&&e(g,x),v=i(_,v,E),C===null?S=_:C.sibling=_,C=_,x=A}if(T.done)return n(g,x),de&&fi(g,E),S;if(x===null){for(;!T.done;E++,T=b.next())T=d(g,T.value,w),T!==null&&(v=i(T,v,E),C===null?S=T:C.sibling=T,C=T);return de&&fi(g,E),S}for(x=r(x);!T.done;E++,T=b.next())T=h(x,g,E,T.value,w),T!==null&&(t&&(A=T.alternate,A!==null&&x.delete(A.key===null?E:A.key)),v=i(T,v,E),C===null?S=T:C.sibling=T,C=T);return t&&x.forEach(function(z){return e(g,z)}),de&&fi(g,E),S}function y(g,v,b,w){if(typeof b=="object"&&b!==null&&b.type===oc&&b.key===null&&b.props.ref===void 0&&(b=b.props.children),typeof b=="object"&&b!==null){switch(b.$$typeof){case vp:e:{for(var S=b.key;v!==null;){if(v.key===S){if(S=b.type,S===oc){if(v.tag===7){n(g,v.sibling),w=o(v,b.props.children),as(w,b),w.return=g,g=w;break e}}else if(v.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===ds&&Dl(S)===v.type){n(g,v.sibling),w=o(v,b.props),as(w,b),w.return=g,g=w;break e}n(g,v);break}else e(g,v);v=v.sibling}b.type===oc?(w=zl(b.props.children,g.mode,w,b.key),as(w,b),w.return=g,g=w):(w=Fp(b.type,b.key,b.props,null,g.mode,w),as(w,b),w.return=g,g=w)}return s(g);case _d:e:{for(S=b.key;v!==null;){if(v.key===S)if(v.tag===4&&v.stateNode.containerInfo===b.containerInfo&&v.stateNode.implementation===b.implementation){n(g,v.sibling),w=o(v,b.children||[]),w.return=g,g=w;break e}else{n(g,v);break}else e(g,v);v=v.sibling}w=Db(b,g.mode,w),w.return=g,g=w}return s(g);case ds:return b=Dl(b),y(g,v,b,w)}if(Id(b))return p(g,v,b,w);if(kd(b)){if(S=kd(b),typeof S!="function")throw Error(k(150));return b=S.call(b),m(g,v,b,w)}if(typeof b.then=="function")return y(g,v,kp(b),w);if(b.$$typeof===No)return y(g,v,Ap(g,b),w);Mp(g,b)}return typeof b=="string"&&b!==""||typeof b=="number"||typeof b=="bigint"?(b=""+b,v!==null&&v.tag===6?(n(g,v.sibling),w=o(v,b),w.return=g,g=w):(n(g,v),w=Ob(b,g.mode,w),w.return=g,g=w),s(g)):n(g,v)}return function(g,v,b,w){try{rf=0;var S=y(g,v,b,w);return bc=null,S}catch(x){if(x===Hc||x===Vm)throw x;var C=Gn(29,x,null,g.mode);return C.lanes=w,C.return=g,C}}}var $l=eO(!0),tO=eO(!1),fs=!1;function E1(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function vw(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function xs(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Cs(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,(Te&2)!==0){var o=r.pending;return o===null?e.next=e:(e.next=o.next,o.next=e),r.pending=e,e=um(t),qR(t,null,n),e}return Pm(t,r,e,n),um(t)}function jd(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194048)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vR(t,n)}}function _b(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=e:i=i.next=e}else o=i=e;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,callbacks:r.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}var bw=!1;function Fd(){if(bw){var t=vc;if(t!==null)throw t}}function $d(t,e,n,r){bw=!1;var o=t.updateQueue;fs=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var a=l,c=a.next;a.next=null,s===null?i=c:s.next=c,s=a;var u=t.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==s&&(l===null?u.firstBaseUpdate=c:l.next=c,u.lastBaseUpdate=a))}if(i!==null){var d=o.baseState;s=0,u=c=a=null,l=i;do{var f=l.lane&-536870913,h=f!==l.lane;if(h?(me&f)===f:(r&f)===f){f!==0&&f===Fl&&(bw=!0),u!==null&&(u=u.next={lane:0,tag:l.tag,payload:l.payload,callback:null,next:null});e:{var p=t,m=l;f=e;var y=n;switch(m.tag){case 1:if(p=m.payload,typeof p=="function"){d=p.call(y,d,f);break e}d=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=m.payload,f=typeof p=="function"?p.call(y,d,f):p,f==null)break e;d=Pe({},d,f);break e;case 2:fs=!0}}f=l.callback,f!==null&&(t.flags|=64,h&&(t.flags|=8192),h=o.callbacks,h===null?o.callbacks=[f]:h.push(f))}else h={lane:f,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(c=u=h,a=d):u=u.next=h,s|=f;if(l=l.next,l===null){if(l=o.shared.pending,l===null)break;h=l,l=h.next,h.next=null,o.lastBaseUpdate=h,o.shared.pending=null}}while(!0);u===null&&(a=d),o.baseState=a,o.firstBaseUpdate=c,o.lastBaseUpdate=u,i===null&&(o.shared.lanes=0),Is|=s,t.lanes=s,t.memoizedState=d}}function nO(t,e){if(typeof t!="function")throw Error(k(191,t));t.call(e)}function rO(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)nO(n[t],e)}var Ns=Po(null),mm=Po(0);function eM(t,e){t=Si,Xe(mm,t),Xe(Ns,e),Si=t|e.baseLanes}function ww(){Xe(mm,Si),Xe(Ns,Ns.current)}function T1(){Si=mm.current,ln(Ns),ln(mm)}var un=Po(null),Cn=null;function Es(t){var e=t.alternate;Xe(an,an.current&1),Xe(un,t),Cn===null&&(e===null||Ns.current!==null||e.memoizedState!==null)&&(Cn=t)}function Sw(t){Xe(an,an.current),Xe(un,t),Cn===null&&(Cn=t)}function oO(t){t.tag===22?(Xe(an,an.current),Xe(un,t),Cn===null&&(Cn=t)):Ts()}function Ts(){Xe(an,an.current),Xe(un,un.current)}function gr(t){ln(un),Cn===t&&(Cn=null),ln(an)}var an=Po(0);function of(t,e){Xe(un,un.current),Xe(an,e)}function A1(t){ln(an),ln(un),Cn===t&&(Cn=null)}function gm(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||t1(n)||Z1(n)))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!=="independent"){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var vi=0,se=null,Le=null,St=null,ym=!1,wc=!1,Yl=!1,vm=0,sf=0,Sc=null,RV=0;function ct(){throw Error(k(321))}function k1(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Cr(t[n],e[n]))return!1;return!0}function M1(t,e,n,r,o,i){return vi=i,se=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Z.H=t===null||t.memoizedState===null?LO:zO,Yl=!1,i=n(r,o),Yl=!1,wc&&(i=sO(e,n,r,o)),iO(t),i}function iO(t){Z.H=bm;var e=Le!==null&&Le.next!==null;if(vi=0,St=Le=se=null,ym=!1,sf=0,Sc=null,e)throw Error(k(300));t===null||Ct||(t=t.dependencies,t!==null&&hm(t)&&(Ct=!0))}function sO(t,e,n,r){se=t;var o=0;do{if(wc&&(Sc=null),sf=0,wc=!1,25<=o)throw Error(k(301));if(o+=1,St=Le=null,t.updateQueue!=null){var i=t.updateQueue;i.lastEffect=null,i.events=null,i.stores=null,i.memoCache!=null&&(i.memoCache.index=0)}Z.H=UV,i=e(n,r)}while(wc);return i}function OV(){var t=Z.H,e=t.useState()[0];return e=typeof e.then=="function"?Sf(e):e,t=t.useState()[0],(Le!==null?Le.memoizedState:null)!==t&&(se.flags|=1024),e}function R1(){var t=vm!==0;return vm=0,t}function O1(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function D1(t){if(ym){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}ym=!1}vi=0,St=Le=se=null,wc=!1,sf=vm=0,Sc=null}function Pn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return St===null?se.memoizedState=St=t:St=St.next=t,St}function yt(){if(Le===null){var t=se.alternate;t=t!==null?t.memoizedState:null}else t=Le.next;var e=St===null?se.memoizedState:St.next;if(e!==null)St=e,Le=t;else{if(t===null)throw se.alternate===null?Error(k(467)):Error(k(310));Le=t,t={memoizedState:Le.memoizedState,baseState:Le.baseState,baseQueue:Le.baseQueue,queue:Le.queue,next:null},St===null?se.memoizedState=St=t:St=St.next=t}return St}function jm(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Sf(t){var e=sf;return sf+=1,Sc===null&&(Sc=[]),t=ZR(Sc,t,e),e=se,(St===null?e.memoizedState:St.next)===null&&(e=e.alternate,Z.H=e===null||e.memoizedState===null?LO:zO),t}function Fm(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return Sf(t);if(t.$$typeof===dH)return;if(t.$$typeof===No)return sn(t)}throw Error(k(438,String(t)))}function N1(t){var e=null,n=se.updateQueue;if(n!==null&&(e=n.memoCache),e==null){var r=se.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(e={data:r.data.map(function(o){return o.slice()}),index:0})))}if(e==null&&(e={data:[],index:0}),n===null&&(n=jm(),se.updateQueue=n),n.memoCache=e,n=e.data[e.index],n===void 0)for(n=e.data[e.index]=Array(t),r=0;r<t;r++)n[r]=uH;return e.index++,n}function bi(t,e){return typeof e=="function"?e(t):e}function qp(t){var e=yt();return _1(e,Le,t)}function _1(t,e,n){var r=t.queue;if(r===null)throw Error(k(311));r.lastRenderedReducer=n;var o=t.baseQueue,i=r.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}e.baseQueue=o=i,r.pending=null}if(i=t.baseState,o===null)t.memoizedState=i;else{e=o.next;var l=s=null,a=null,c=e,u=!1;do{var d=c.lane&-536870913;if(d!==c.lane?(me&d)===d:(vi&d)===d){var f=c.revertLane;if(f===0)a!==null&&(a=a.next={lane:0,revertLane:0,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null}),d===Fl&&(u=!0);else if((vi&f)===f){c=c.next,f===Fl&&(u=!0);continue}else d={lane:0,revertLane:c.revertLane,gesture:null,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},a===null?(l=a=d,s=i):a=a.next=d,se.lanes|=f,Is|=f;d=c.action,Yl&&n(i,d),i=c.hasEagerState?c.eagerState:n(i,d)}else f={lane:d,revertLane:c.revertLane,gesture:c.gesture,action:c.action,hasEagerState:c.hasEagerState,eagerState:c.eagerState,next:null},a===null?(l=a=f,s=i):a=a.next=f,se.lanes|=d,Is|=d;c=c.next}while(c!==null&&c!==e);if(a===null?s=i:a.next=l,!Cr(i,t.memoizedState)&&(Ct=!0,u&&(n=vc,n!==null)))throw n;t.memoizedState=i,t.baseState=s,t.baseQueue=a,r.lastRenderedState=i}return o===null&&(r.lanes=0),[t.memoizedState,r.dispatch]}function Ib(t){var e=yt(),n=e.queue;if(n===null)throw Error(k(311));n.lastRenderedReducer=t;var r=n.dispatch,o=n.pending,i=e.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=t(i,s.action),s=s.next;while(s!==o);Cr(i,e.memoizedState)||(Ct=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function lO(t,e,n){var r=se,o=yt(),i=de;if(i){if(n===void 0)throw Error(k(407));n=n()}else n=e();var s=!Cr((Le||o).memoizedState,n);if(s&&(o.memoizedState=n,Ct=!0),o=o.queue,I1(uO.bind(null,r,o,t),[t]),t=o.getSnapshot!==e||s||St!==null&&(St.memoizedState.tag&1)!==0,Mc(t?9:8,{destroy:void 0},cO.bind(null,r,o,n,e),null),t){if(r.flags|=2048,Be===null)throw Error(k(349));i||(vi&127)!==0||aO(r,e,n)}return n}function aO(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=se.updateQueue,e===null?(e=jm(),se.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function cO(t,e,n,r){e.value=n,e.getSnapshot=r,dO(e)&&fO(t)}function uO(t,e,n){return n(function(){dO(e)&&fO(t)})}function dO(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Cr(t,n)}catch{return!0}}function fO(t){var e=Jl(t,2);e!==null&&Xn(e,t,2)}function xw(t){var e=Pn();if(typeof t=="function"){var n=t;if(t=n(),Yl){ps(!0);try{n()}finally{ps(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:bi,lastRenderedState:t},e}function hO(t,e,n,r){return t.baseState=n,_1(t,Le,typeof r=="function"?r:bi)}function DV(t,e,n,r,o){if(Ym(t))throw Error(k(485));if(t=e.action,t!==null){var i={payload:o,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(s){i.listeners.push(s)}};Z.T!==null?n(!0):i.isTransition=!1,r(i),n=e.pending,n===null?(i.next=e.pending=i,pO(e,i)):(i.next=n.next,e.pending=n.next=i)}}function pO(t,e){var n=e.action,r=e.payload,o=t.state;if(e.isTransition){var i=Z.T,s={};s.types=i!==null?i.types:null,Z.T=s;try{var l=n(o,r),a=Z.S;a!==null&&a(s,l),tM(t,e,l)}catch(c){Cw(t,e,c)}finally{i!==null&&s.types!==null&&(i.types=s.types),Z.T=i}}else try{i=n(o,r),tM(t,e,i)}catch(c){Cw(t,e,c)}}function tM(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(r){nM(t,e,r)},function(r){return Cw(t,e,r)}):nM(t,e,n)}function nM(t,e,n){e.status="fulfilled",e.value=n,mO(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,pO(t,n)))}function Cw(t,e,n){var r=t.pending;if(t.pending=null,r!==null){r=r.next;do e.status="rejected",e.reason=n,mO(e),e=e.next;while(e!==r)}t.action=null}function mO(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function gO(t,e){return e}function rM(t,e){if(de){var n=Be.formState;if(n!==null){e:{var r=se;if(de){if(Ge){t:{for(var o=Ge,i=Yr;o.nodeType!==8;){if(!i){o=null;break t}if(o=qr(o.nextSibling),o===null){o=null;break t}}i=o.data,o=i==="F!"||i==="F"?o:null}if(o){Ge=qr(o.nextSibling),r=o.data==="F!";break e}}Ds(r)}r=!1}r&&(e=n[0])}}return n=Pn(),n.memoizedState=n.baseState=e,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:gO,lastRenderedState:e},n.queue=r,n=NO.bind(null,se,r),r.dispatch=n,r=xw(!1),i=B1.bind(null,se,!1,r.queue),r=Pn(),o={state:e,dispatch:null,action:t,pending:null},r.queue=o,n=DV.bind(null,se,o,i,n),o.dispatch=n,r.memoizedState=t,[e,n,!1]}function oM(t){var e=yt();return yO(e,Le,t)}function yO(t,e,n){if(e=_1(t,e,gO)[0],t=qp(bi)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var r=Sf(e)}catch(s){throw s===Hc?Vm:s}else r=e;e=yt();var o=e.queue,i=o.dispatch;return n!==e.memoizedState&&(se.flags|=2048,Mc(9,{destroy:void 0},NV.bind(null,o,n),null)),[r,i,t]}function NV(t,e){t.action=e}function iM(t){var e=yt(),n=Le;if(n!==null)return yO(e,n,t);yt(),e=e.memoizedState,n=yt();var r=n.queue.dispatch;return n.memoizedState=t,[e,r,!1]}function Mc(t,e,n,r){return t={tag:t,create:n,deps:r,inst:e,next:null},e=se.updateQueue,e===null&&(e=jm(),se.updateQueue=e),n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t),t}function vO(){return yt().memoizedState}function Kp(t,e,n,r){var o=Pn();se.flags|=t,o.memoizedState=Mc(1|e,{destroy:void 0},n,r===void 0?null:r)}function $m(t,e,n,r){var o=yt();r=r===void 0?null:r;var i=o.memoizedState.inst;Le!==null&&r!==null&&k1(r,Le.memoizedState.deps)?o.memoizedState=Mc(e,i,n,r):(se.flags|=t,o.memoizedState=Mc(1|e,i,n,r))}function sM(t,e){Kp(8390656,8,t,e)}function I1(t,e){$m(2048,8,t,e)}function _V(t){se.flags|=4;var e=se.updateQueue;if(e===null)e=jm(),se.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function bO(t){var e=yt().memoizedState;return _V({ref:e,nextImpl:t}),function(){if((Te&2)!==0)throw Error(k(440));return e.impl.apply(void 0,arguments)}}function wO(t,e){return $m(4,2,t,e)}function SO(t,e){return $m(4,4,t,e)}function xO(t,e){if(typeof e=="function"){t=t();var n=e(t);return function(){typeof n=="function"?n():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function CO(t,e,n){n=n!=null?n.concat([t]):null,$m(4,4,xO.bind(null,e,t),n)}function L1(){}function EO(t,e){var n=yt();e=e===void 0?null:e;var r=n.memoizedState;return e!==null&&k1(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function TO(t,e){var n=yt();e=e===void 0?null:e;var r=n.memoizedState;if(e!==null&&k1(e,r[1]))return r[0];if(r=t(),Yl){ps(!0);try{t()}finally{ps(!1)}}return n.memoizedState=[r,e],r}function z1(t,e,n){return n===void 0||(vi&1073741824)!==0&&(me&261930)===0?t.memoizedState=e:(t.memoizedState=n,t=yD(),se.lanes|=t,Is|=t,n)}function AO(t,e,n,r){return Cr(n,e)?n:Ns.current!==null?(t=z1(t,n,r),Cr(t,e)||(Ct=!0),t):(vi&106)===0||(vi&1073741824)!==0&&(me&261930)===0?(Ct=!0,t.memoizedState=n):(t=yD(),se.lanes|=t,Is|=t,e)}function kO(t,e,n,r,o){var i=Ae.p;Ae.p=i!==0&&8>i?i:8;var s=Z.T,l={};l.types=s!==null?s.types:null,Z.T=l,B1(t,!1,e,n);try{var a=o(),c=Z.S;if(c!==null&&c(l,a),a!==null&&typeof a=="object"&&typeof a.then=="function"){var u=MV(a,r);Yd(t,e,u,xr(t))}else Yd(t,e,r,xr(t))}catch(d){Yd(t,e,{then:function(){},status:"rejected",reason:d},xr())}finally{Ae.p=i,s!==null&&l.types!==null&&(s.types=l.types),Z.T=s}}function IV(){}function Ew(t,e,n,r){if(t.tag!==5)throw Error(k(476));var o=MO(t).queue;kO(t,o,e,Ll,n===null?IV:function(){return RO(t),n(r)})}function MO(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:Ll,baseState:Ll,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bi,lastRenderedState:Ll},next:null};var n={};return e.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:bi,lastRenderedState:n},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function RO(t){var e=MO(t);e.next===null&&(e=t.alternate.memoizedState),Yd(t,e.next.queue,{},xr())}function U1(){return sn(Lc)}function OO(){return yt().memoizedState}function DO(){return yt().memoizedState}function LV(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=xr();t=xs(n);var r=Cs(e,t,n);r!==null&&(Xn(r,e,n),jd(r,e,n)),e={cache:S1()},t.payload=e;return}e=e.return}}function zV(t,e,n){var r=xr();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Ym(t)?_O(e,n):(n=v1(t,e,n,r),n!==null&&(Xn(n,t,r),IO(n,e,r)))}function NO(t,e,n){var r=xr();Yd(t,e,n,r)}function Yd(t,e,n,r){var o={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Ym(t))_O(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,l=i(s,n);if(o.hasEagerState=!0,o.eagerState=l,Cr(l,s))return Pm(t,e,o,0),Be===null&&Bm(),!1}catch{}if(n=v1(t,e,o,r),n!==null)return Xn(n,t,r),IO(n,e,r),!0}return!1}function B1(t,e,n,r){if(r={lane:2,revertLane:X1(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Ym(t)){if(e)throw Error(k(479))}else e=v1(t,n,r,2),e!==null&&Xn(e,t,2)}function Ym(t){var e=t.alternate;return t===se||e!==null&&e===se}function _O(t,e){wc=ym=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function IO(t,e,n){if((n&4194048)!==0){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,vR(t,n)}}var bm={readContext:sn,use:Fm,useCallback:ct,useContext:ct,useEffect:ct,useImperativeHandle:ct,useLayoutEffect:ct,useInsertionEffect:ct,useMemo:ct,useReducer:ct,useRef:ct,useState:ct,useDebugValue:ct,useDeferredValue:ct,useTransition:ct,useSyncExternalStore:ct,useId:ct,useHostTransitionStatus:ct,useFormState:ct,useActionState:ct,useOptimistic:ct,useMemoCache:ct,useCacheRefresh:ct,useEffectEvent:ct},LO={readContext:sn,use:Fm,useCallback:function(t,e){return Pn().memoizedState=[t,e===void 0?null:e],t},useContext:sn,useEffect:sM,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,Kp(4194308,4,xO.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Kp(4194308,4,t,e)},useInsertionEffect:function(t,e){Kp(4,2,t,e)},useMemo:function(t,e){var n=Pn();e=e===void 0?null:e;var r=t();if(Yl){ps(!0);try{t()}finally{ps(!1)}}return n.memoizedState=[r,e],r},useReducer:function(t,e,n){var r=Pn();if(n!==void 0){var o=n(e);if(Yl){ps(!0);try{n(e)}finally{ps(!1)}}}else o=e;return r.memoizedState=r.baseState=o,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:o},r.queue=t,t=t.dispatch=zV.bind(null,se,t),[r.memoizedState,t]},useRef:function(t){var e=Pn();return t={current:t},e.memoizedState=t},useState:function(t){t=xw(t);var e=t.queue,n=NO.bind(null,se,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:L1,useDeferredValue:function(t,e){var n=Pn();return z1(n,t,e)},useTransition:function(){var t=xw(!1);return t=kO.bind(null,se,t.queue,!0,!1),Pn().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var r=se,o=Pn();if(de){if(n===void 0)throw Error(k(407));n=n()}else{if(n=e(),Be===null)throw Error(k(349));(me&127)!==0||aO(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,sM(uO.bind(null,r,i,t),[t]),r.flags|=2048,Mc(9,{destroy:void 0},cO.bind(null,r,i,n,e),null),n},useId:function(){var t=Pn(),e=Be.identifierPrefix;if(de){var n=Lo,r=Io;n=(r&~(1<<32-Sr(r)-1)).toString(32)+n,e="_"+e+"R_"+n,n=vm++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=RV++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:U1,useFormState:rM,useActionState:rM,useOptimistic:function(t){var e=Pn();e.memoizedState=e.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=n,e=B1.bind(null,se,!0,n),n.dispatch=e,[t,e]},useMemoCache:N1,useCacheRefresh:function(){return Pn().memoizedState=LV.bind(null,se)},useEffectEvent:function(t){var e=Pn(),n={impl:t};return e.memoizedState=n,function(){if((Te&2)!==0)throw Error(k(440));return n.impl.apply(void 0,arguments)}}},zO={readContext:sn,use:Fm,useCallback:EO,useContext:sn,useEffect:I1,useImperativeHandle:CO,useInsertionEffect:wO,useLayoutEffect:SO,useMemo:TO,useReducer:qp,useRef:vO,useState:function(){return qp(bi)},useDebugValue:L1,useDeferredValue:function(t,e){var n=yt();return AO(n,Le.memoizedState,t,e)},useTransition:function(){var t=qp(bi)[0],e=yt().memoizedState;return[typeof t=="boolean"?t:Sf(t),e]},useSyncExternalStore:lO,useId:OO,useHostTransitionStatus:U1,useFormState:oM,useActionState:oM,useOptimistic:function(t,e){var n=yt();return hO(n,Le,t,e)},useMemoCache:N1,useCacheRefresh:DO,useEffectEvent:bO},UV={readContext:sn,use:Fm,useCallback:EO,useContext:sn,useEffect:I1,useImperativeHandle:CO,useInsertionEffect:wO,useLayoutEffect:SO,useMemo:TO,useReducer:Ib,useRef:vO,useState:function(){return Ib(bi)},useDebugValue:L1,useDeferredValue:function(t,e){var n=yt();return Le===null?z1(n,t,e):AO(n,Le.memoizedState,t,e)},useTransition:function(){var t=Ib(bi)[0],e=yt().memoizedState;return[typeof t=="boolean"?t:Sf(t),e]},useSyncExternalStore:lO,useId:OO,useHostTransitionStatus:U1,useFormState:iM,useActionState:iM,useOptimistic:function(t,e){var n=yt();return Le!==null?hO(n,Le,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:N1,useCacheRefresh:DO,useEffectEvent:bO};function Lb(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Pe({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Tw={enqueueSetState:function(t,e,n){t=t._reactInternals;var r=xr(),o=xs(r);o.payload=e,n!=null&&(o.callback=n),e=Cs(t,o,r),e!==null&&(Xn(e,t,r),jd(e,t,r))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=xr(),o=xs(r);o.tag=1,o.payload=e,n!=null&&(o.callback=n),e=Cs(t,o,r),e!==null&&(Xn(e,t,r),jd(e,t,r))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=xr(),r=xs(n);r.tag=2,e!=null&&(r.callback=e),e=Cs(t,r,n),e!==null&&(Xn(e,t,n),jd(e,t,n))}};function lM(t,e,n,r,o,i,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,s):e.prototype&&e.prototype.isPureReactComponent?!ef(n,r)||!ef(o,i):!0}function aM(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Tw.enqueueReplaceState(e,e.state,null)}function ql(t,e){var n=e;if("ref"in e){n={};for(var r in e)r!=="ref"&&(n[r]=e[r])}if(t=t.defaultProps){n===e&&(n=Pe({},n));for(var o in t)n[o]===void 0&&(n[o]=t[o])}return n}function UO(t){cm(t)}function BO(t){console.error(t)}function PO(t){cm(t)}function wm(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(r){setTimeout(function(){throw r})}}function cM(t,e,n){try{var r=t.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Aw(t,e,n){return n=xs(n),n.tag=3,n.payload={element:null},n.callback=function(){wm(t,e)},n}function HO(t){return t=xs(t),t.tag=3,t}function VO(t,e,n,r){var o=n.type.getDerivedStateFromError;if(typeof o=="function"){var i=r.value;t.payload=function(){return o(i)},t.callback=function(){cM(e,n,r)}}var s=n.stateNode;s!==null&&typeof s.componentDidCatch=="function"&&(t.callback=function(){cM(e,n,r),typeof o!="function"&&(As===null?As=new Set([this]):As.add(this));var l=r.stack;this.componentDidCatch(r.value,{componentStack:l!==null?l:""})})}function BV(t,e,n,r,o){if(n.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(e=n.alternate,e!==null&&Vl(e,n,o,!0),n=un.current,n!==null){switch(n.tag){case 31:case 13:case 19:return Cn===null?Mm():n.alternate===null&&ut===0&&(ut=3),n.flags&=-257,n.flags|=65536,n.lanes=o,r===pm?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([r]):e.add(r),jb(t,r,o)),!1;case 22:return n.flags|=65536,r===pm?n.flags|=16384:(e=n.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=e):(n=e.retryQueue,n===null?e.retryQueue=new Set([r]):n.add(r)),jb(t,r,o)),!1}throw Error(k(435,n.tag))}return jb(t,r,o),Mm(),!1}if(de)return e=un.current,e!==null?((e.flags&65536)===0&&(e.flags|=256),e.flags|=65536,e.lanes=o,r!==pw&&(t=Error(k(422),{cause:r}),nf($r(t,n)))):(r!==pw&&(e=Error(k(423),{cause:r}),nf($r(e,n))),t=t.current.alternate,t.flags|=65536,o&=-o,t.lanes|=o,r=$r(r,n),o=Aw(t.stateNode,r,o),_b(t,o),ut!==4&&(ut=2)),!1;var i=Error(k(520),{cause:r});if(i=$r(i,n),Xd===null?Xd=[i]:Xd.push(i),ut!==4&&(ut=2),e===null)return!0;r=$r(r,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=o&-o,n.lanes|=t,t=Aw(n.stateNode,r,t),_b(n,t),!1;case 1:if(e=n.type,i=n.stateNode,(n.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||i!==null&&typeof i.componentDidCatch=="function"&&(As===null||!As.has(i))))return n.flags|=65536,o&=-o,n.lanes|=o,o=HO(o),VO(o,t,n,r),_b(n,o),!1;break;case 22:if(n.memoizedState!==null)return n.flags|=65536,!1}n=n.return}while(n!==null);return!1}var P1=Error(k(461)),Ct=!1;function Nt(t,e,n,r){e.child=t===null?tO(e,null,n,r):$l(e,t.child,n,r)}function uM(t,e,n,r,o){n=n.render;var i=e.ref;if("ref"in r){var s={};for(var l in r)l!=="ref"&&(s[l]=r[l])}else s=r;return jl(e),r=M1(t,e,n,s,i,o),l=R1(),t!==null&&!Ct?(O1(t,e,o),wi(t,e,o)):(de&&l&&Hm(e),e.flags|=1,Nt(t,e,r,o),e.child)}function dM(t,e,n,r,o){if(t===null){var i=n.type;return typeof i=="function"&&!b1(i)&&i.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=i,jO(t,e,i,r,o)):(t=Fp(n.type,null,r,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!V1(t,o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:ef,n(s,r)&&t.ref===e.ref)return wi(t,e,o)}return e.flags|=1,t=pi(i,r),t.ref=e.ref,t.return=e,e.child=t}function jO(t,e,n,r,o){if(t!==null){var i=t.memoizedProps;if(ef(i,r)&&t.ref===e.ref)if(Ct=!1,e.pendingProps=r=i,V1(t,o))(t.flags&131072)!==0&&(Ct=!0);else return e.lanes=t.lanes,wi(t,e,o)}return kw(t,e,n,r,o)}function FO(t,e,n,r){var o=r.children,i=t!==null?t.memoizedState:null;if(t===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((e.flags&128)!==0){if(i=i!==null?i.baseLanes|n:n,t!==null){for(r=e.child=t.child,o=0;r!==null;)o=o|r.lanes|r.childLanes,r=r.sibling;r=o&~i}else r=0,e.child=null;return fM(t,e,i,n,r)}if((n&536870912)!==0)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&Yp(e,i!==null?i.cachePool:null),i!==null?eM(e,i):ww(),oO(e);else return r=e.lanes=536870912,fM(t,e,i!==null?i.baseLanes|n:n,n,r)}else i!==null?(Yp(e,i.cachePool),eM(e,i),Ts(),e.memoizedState=null):(t!==null&&Yp(e,null),ww(),Ts());return Nt(t,e,o,n),e.child}function qd(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function fM(t,e,n,r,o){var i=x1();return i=i===null?null:{parent:xt._currentValue,pool:i},e.memoizedState={baseLanes:n,cachePool:i},t!==null&&Yp(e,null),ww(),oO(e),t!==null&&Vl(t,e,r,!0),e.childLanes=o,null}function Gp(t,e){return e=qm({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function hM(t,e,n){return $l(e,t.child,null,n),t=Gp(e,e.pendingProps),t.flags|=2,gr(e),e.memoizedState=null,t}function PV(t,e,n){var r=e.pendingProps,o=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(de){if(r.mode==="hidden")return t=Gp(e,r),e.lanes=536870912,t.memoizedState={baseLanes:0,cachePool:null},qd(null,t);if(Sw(e),(t=Ge)?(t=FD(t,Yr),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Os!==null?{id:Io,overflow:Lo}:null,retryLane:536870912,hydrationErrors:null},n=GR(t),n.return=e,e.child=n,Kt=e,Ge=null)):t=null,t===null)throw Ds(e);return e.lanes=536870912,null}return Gp(e,r)}var i=t.memoizedState;if(i!==null){var s=i.dehydrated;if(Sw(e),o)if(e.flags&256)e.flags&=-257,e=hM(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(k(558));else if(Ct||Vl(t,e,n,!1),o=(n&t.childLanes)!==0,Ct||o){if(Ns.current===null){if(r=Be,r!==null&&(s=bR(r,n),s!==0&&s!==i.retryLane))throw i.retryLane=s,Jl(t,s),Xn(r,t,s),P1;Mm()}e=hM(t,e,n)}else t=i.treeContext,Ge=qr(s.nextSibling),Kt=e,de=!0,Ss=null,Yr=!1,t!==null&&WR(e,t),e=Gp(e,r),e.flags|=134221824;return e}return t=pi(t.child,{mode:r.mode,children:r.children}),t.ref=e.ref,e.child=t,t.return=e,t}function ec(t,e){var n=e.ref;if(n===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(k(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function kw(t,e,n,r,o){return jl(e),n=M1(t,e,n,r,void 0,o),r=R1(),t!==null&&!Ct?(O1(t,e,o),wi(t,e,o)):(de&&r&&Hm(e),e.flags|=1,Nt(t,e,n,o),e.child)}function pM(t,e,n,r,o,i){return jl(e),e.updateQueue=null,n=sO(e,r,n,o),iO(t),r=R1(),t!==null&&!Ct?(O1(t,e,i),wi(t,e,i)):(de&&r&&Hm(e),e.flags|=1,Nt(t,e,n,i),e.child)}function mM(t,e,n,r,o){if(jl(e),e.stateNode===null){var i=dc,s=n.contextType;typeof s=="object"&&s!==null&&(i=sn(s)),i=new n(r,i),e.memoizedState=i.state!==null&&i.state!==void 0?i.state:null,i.updater=Tw,e.stateNode=i,i._reactInternals=e,i=e.stateNode,i.props=r,i.state=e.memoizedState,i.refs={},E1(e),s=n.contextType,i.context=typeof s=="object"&&s!==null?sn(s):dc,i.state=e.memoizedState,s=n.getDerivedStateFromProps,typeof s=="function"&&(Lb(e,n,s,r),i.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof i.getSnapshotBeforeUpdate=="function"||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(s=i.state,typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount(),s!==i.state&&Tw.enqueueReplaceState(i,i.state,null),$d(e,r,i,o),Fd(),i.state=e.memoizedState),typeof i.componentDidMount=="function"&&(e.flags|=4194308),r=!0}else if(t===null){i=e.stateNode;var l=e.memoizedProps,a=ql(n,l);i.props=a;var c=i.context,u=n.contextType;s=dc,typeof u=="object"&&u!==null&&(s=sn(u));var d=n.getDerivedStateFromProps;u=typeof d=="function"||typeof i.getSnapshotBeforeUpdate=="function",l=e.pendingProps!==l,u||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(l||c!==s)&&aM(e,i,r,s),fs=!1;var f=e.memoizedState;i.state=f,$d(e,r,i,o),Fd(),c=e.memoizedState,l||f!==c||fs?(typeof d=="function"&&(Lb(e,n,d,r),c=e.memoizedState),(a=fs||lM(e,n,a,r,f,c,s))?(u||typeof i.UNSAFE_componentWillMount!="function"&&typeof i.componentWillMount!="function"||(typeof i.componentWillMount=="function"&&i.componentWillMount(),typeof i.UNSAFE_componentWillMount=="function"&&i.UNSAFE_componentWillMount()),typeof i.componentDidMount=="function"&&(e.flags|=4194308)):(typeof i.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=c),i.props=r,i.state=c,i.context=s,r=a):(typeof i.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{i=e.stateNode,vw(t,e),s=e.memoizedProps,u=ql(n,s),i.props=u,d=e.pendingProps,f=i.context,c=n.contextType,a=dc,typeof c=="object"&&c!==null&&(a=sn(c)),l=n.getDerivedStateFromProps,(c=typeof l=="function"||typeof i.getSnapshotBeforeUpdate=="function")||typeof i.UNSAFE_componentWillReceiveProps!="function"&&typeof i.componentWillReceiveProps!="function"||(s!==d||f!==a)&&aM(e,i,r,a),fs=!1,f=e.memoizedState,i.state=f,$d(e,r,i,o),Fd();var h=e.memoizedState;s!==d||f!==h||fs||t!==null&&t.dependencies!==null&&hm(t.dependencies)?(typeof l=="function"&&(Lb(e,n,l,r),h=e.memoizedState),(u=fs||lM(e,n,u,r,f,h,a)||t!==null&&t.dependencies!==null&&hm(t.dependencies))?(c||typeof i.UNSAFE_componentWillUpdate!="function"&&typeof i.componentWillUpdate!="function"||(typeof i.componentWillUpdate=="function"&&i.componentWillUpdate(r,h,a),typeof i.UNSAFE_componentWillUpdate=="function"&&i.UNSAFE_componentWillUpdate(r,h,a)),typeof i.componentDidUpdate=="function"&&(e.flags|=4),typeof i.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof i.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=h),i.props=r,i.state=h,i.context=a,r=u):(typeof i.componentDidUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=4),typeof i.getSnapshotBeforeUpdate!="function"||s===t.memoizedProps&&f===t.memoizedState||(e.flags|=1024),r=!1)}return i=r,ec(t,e),r=(e.flags&128)!==0,i||r?(i=e.stateNode,n=r&&typeof n.getDerivedStateFromError!="function"?null:i.render(),e.flags|=1,t!==null&&r?(e.child=$l(e,t.child,null,o),e.child=$l(e,null,n,o)):Nt(t,e,n,o),e.memoizedState=i.state,t=e.child):t=wi(t,e,o),t}function gM(t,e,n,r){return Hl(),e.flags|=256,Nt(t,e,n,r),e.child}var Mw={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rw(t){return{baseLanes:t,cachePool:QR()}}function Ow(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=vr),t}function $O(t,e,n){var r=e.pendingProps,o=!1,i=(e.flags&128)!==0,s;if((s=i)||(s=t!==null&&t.memoizedState===null?!1:(an.current&2)!==0),s&&(o=!0,e.flags&=-129),s=(e.flags&32)!==0,e.flags&=-33,t===null){if(de){if(o?Es(e):Ts(),(t=Ge)?(t=FD(t,Yr),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Os!==null?{id:Io,overflow:Lo}:null,retryLane:536870912,hydrationErrors:null},n=GR(t),n.return=e,e.child=n,Kt=e,Ge=null)):t=null,t===null)throw Ds(e);return Z1(t)?e.lanes=32:e.lanes=536870912,null}return i=r.children,r=r.fallback,o?(Ts(),o=e.mode,i=qm({mode:"hidden",children:i},o),r=zl(r,o,n,null),i.return=e,r.return=e,i.sibling=r,e.child=i,r=e.child,r.memoizedState=Rw(n),r.childLanes=Ow(t,s,n),e.memoizedState=Mw,qd(null,r)):(Es(e),H1(e,i))}var l=t.memoizedState;if(l!==null){var a=l.dehydrated;if(a!==null)return HV(t,e,i,s,r,a,l,n)}return o?(Ts(),o=r.fallback,i=e.mode,l=t.child,a=l.sibling,r=pi(l,{mode:"hidden",children:r.children}),r.subtreeFlags=l.subtreeFlags&1206910976,a!==null?o=pi(a,o):(o=zl(o,i,n,null),o.flags|=2),o.return=e,r.return=e,r.sibling=o,e.child=r,qd(null,r),r=e.child,o=t.child.memoizedState,o===null?o=Rw(n):(i=o.cachePool,i!==null?(l=xt._currentValue,i=i.parent!==l?{parent:l,pool:l}:i):i=QR(),o={baseLanes:o.baseLanes|n,cachePool:i}),r.memoizedState=o,r.childLanes=Ow(t,s,n),e.memoizedState=Mw,qd(t.child,r)):(Es(e),n=t.child,t=n.sibling,n=pi(n,{mode:"visible",children:r.children}),n.return=e,n.sibling=null,t!==null&&(s=e.deletions,s===null?(e.deletions=[t],e.flags|=16):s.push(t)),e.child=n,e.memoizedState=null,n)}function H1(t,e){return e=qm({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function qm(t,e){return t=Gn(22,t,null,e),t.lanes=0,t}function Rp(t,e,n){return $l(e,t.child,null,n),t=H1(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function HV(t,e,n,r,o,i,s,l){if(n)return e.flags&256?(Es(e),e.flags&=-257,Rp(t,e,l)):e.memoizedState!==null?(Ts(),e.child=t.child,e.flags|=128,null):(Ts(),i=o.fallback,s=e.mode,o=qm({mode:"visible",children:o.children},s),i=zl(i,s,l,null),i.flags|=2,o.return=e,i.return=e,o.sibling=i,e.child=o,$l(e,t.child,null,l),o=e.child,o.memoizedState=Rw(l),o.childLanes=Ow(t,r,l),e.memoizedState=Mw,qd(null,o));if(Es(e),Z1(i)){if(r=i.nextSibling&&i.nextSibling.dataset,r)var a=r.dgst;return r=a,r!==""&&(o=Error(k(419)),o.stack="",o.digest=r,nf({value:o,source:null,stack:null})),Rp(t,e,l)}if(Ct||Vl(t,e,l,!1),r=(l&t.childLanes)!==0,Ct||r){if(Ns.current!==null)return Rp(t,e,l);if(r=Be,r!==null&&(o=bR(r,l),o!==0&&o!==s.retryLane))throw s.retryLane=o,Jl(t,o),Xn(r,t,o),P1;return t1(i)||Mm(),Rp(t,e,l)}return t1(i)?(e.flags|=192,e.child=t.child,null):(t=s.treeContext,Ge=qr(i.nextSibling),Kt=e,de=!0,Ss=null,Yr=!1,t!==null&&WR(e,t),e=H1(e,o.children),e.flags|=134221824,e)}function yM(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),$p(t.return,e,n)}function vM(t){for(var e=null;t!==null;){var n=t.alternate;n!==null&&gm(n)===null&&(e=t),t=t.sibling}return e}function Op(t,e,n,r,o,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o,treeForkCount:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o,s.treeForkCount=i)}function zb(t){var e=t.child;for(t.child=null;e!==null;){var n=e.sibling;e.sibling=t.child,t.child=e,e=n}}function Dw(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;r=r.children;var s=an.current;if(e.flags&128)return of(e,s),null;var l=(s&2)!==0;if(l?(s=s&1|2,e.flags|=128):s&=1,of(e,s),o==="backwards"&&t!==null?(zb(t),Nt(t,e,r,n),zb(t)):Nt(t,e,r,n),r=de?tf:0,!l&&t!==null&&(t.flags&128)!==0)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&yM(t,n,e);else if(t.tag===19)yM(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(o){case"backwards":n=vM(e.child),n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null,zb(e)),Op(e,!0,o,null,i,r);break;case"unstable_legacy-backwards":for(n=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&gm(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}Op(e,!0,n,null,i,r);break;case"together":Op(e,!1,null,null,void 0,r);break;case"independent":e.memoizedState=null;break;default:n=vM(e.child),n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),Op(e,!1,o,n,i,r)}return e.child}function bM(t,e,n){var r=e.pendingProps;return gs(e,e.type,r.value),Nt(t,e,r.children,n),e.child}function wi(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),Is|=e.lanes,(n&e.childLanes)===0)if(t!==null){if(Vl(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(k(153));if(e.child!==null){for(t=e.child,n=pi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=pi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function V1(t,e){return(t.lanes&e)!==0?!0:(t=t.dependencies,!!(t!==null&&hm(t)))}function VV(t,e,n){switch(e.tag){case 3:im(e,e.stateNode.containerInfo),gs(e,xt,t.memoizedState.cache),Hl();break;case 27:case 5:ow(e);break;case 4:im(e,e.stateNode.containerInfo);break;case 10:gs(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,Sw(e),null;break;case 13:var r=e.memoizedState;if(r!==null){if(r.dehydrated!==null)return Es(e),e.flags|=128,null;r=Vl(t,e,n,!1);var o=e.child.childLanes;return r||(n&o)!==0?$O(t,e,n):(Es(e),t=wi(t,e,n),t!==null?t.sibling:null)}Es(e);break;case 19:if(e.flags&128)return Dw(t,e,n);if(o=(t.flags&128)!==0,r=(n&e.childLanes)!==0,r||(Vl(t,e,n,!1),r=(n&e.childLanes)!==0),o){if(r)return Dw(t,e,n);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),of(e,an.current),r)break;return null;case 22:return e.lanes=0,FO(t,e,n,e.pendingProps);case 24:gs(e,xt,t.memoizedState.cache)}return wi(t,e,n)}function YO(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)Ct=!0;else{if(!V1(t,n)&&(e.flags&128)===0)return Ct=!1,VV(t,e,n);Ct=(t.flags&131072)!==0}else Ct=!1,de&&(e.flags&1048576)!==0&&XR(e,tf,e.index);switch(e.lanes=0,e.tag){case 16:e:{var r=e.pendingProps;if(t=Dl(e.elementType),e.type=t,typeof t=="function")b1(t)?(r=ql(t,r),e.tag=1,e=mM(null,e,t,r,n)):(e.tag=0,e=kw(null,e,t,r,n));else{if(t!=null){var o=t.$$typeof;if(o===s1){e.tag=11,e=uM(null,e,t,r,n);break e}else if(o===l1){e.tag=14,e=dM(null,e,t,r,n);break e}else if(o===No){e.tag=10,e.type=t,e=bM(null,e,n);break e}}throw e=nw(t)||t,Error(k(306,e,""))}}return e;case 0:return kw(t,e,e.type,e.pendingProps,n);case 1:return r=e.type,o=ql(r,e.pendingProps),mM(t,e,r,o,n);case 3:e:{if(im(e,e.stateNode.containerInfo),t===null)throw Error(k(387));r=e.pendingProps;var i=e.memoizedState;o=i.element,vw(t,e),$d(e,r,null,n);var s=e.memoizedState;if(r=s.cache,gs(e,xt,r),r!==i.cache&&gw(e,[xt],n,!0),Fd(),r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){e=gM(t,e,r,n);break e}else if(r!==o){o=$r(Error(k(424)),e),nf(o),e=gM(t,e,r,n);break e}else for(t=e.stateNode.containerInfo,t.nodeType===9?t=t.body:t=t.nodeName==="HTML"?t.ownerDocument.body:t,Ge=qr(t.firstChild),Kt=e,de=!0,Ss=null,Yr=!0,n=tO(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|134221824,n=n.sibling;else{if(Hl(),r===o){e=wi(t,e,n);break e}Nt(t,e,r,n)}e=e.child}return e;case 26:return ec(t,e),t===null?(n=qM(e.type,null,e.pendingProps,null))?e.memoizedState=n:de||(e.stateNode=ID(e.type,e.pendingProps,ws.current,e)):e.memoizedState=qM(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return ow(e),t===null&&de&&(r=e.stateNode=$D(e.type,e.pendingProps,ws.current),Kt=e,Yr=!0,o=Ge,zs(e.type)?(n1=o,Ge=qr(r.firstChild)):Ge=o),Nt(t,e,e.pendingProps.children,n),ec(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&de&&((o=r=Ge)&&(r=_j(r,e.type,e.pendingProps,Yr),r!==null?(e.stateNode=r,Kt=e,Ge=qr(r.firstChild),Yr=!1,o=!0):o=!1),o||Ds(e)),ow(e),o=e.type,i=e.pendingProps,s=t!==null?t.memoizedProps:null,r=i.children,Qw(o,i)?r=null:s!==null&&Qw(o,s)&&(e.flags|=32),e.memoizedState!==null&&(o=M1(t,e,OV,null,null,n),Lc._currentValue=o),ec(t,e),Nt(t,e,r,n),e.child;case 6:return t===null&&de&&((t=n=Ge)&&(n=Ij(n,e.pendingProps,Yr),n!==null?(e.stateNode=n,Kt=e,Ge=null,t=!0):t=!1),t||Ds(e)),null;case 13:return $O(t,e,n);case 4:return im(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=$l(e,null,r,n):Nt(t,e,r,n),e.child;case 11:return uM(t,e,e.type,e.pendingProps,n);case 7:return r=e.pendingProps,ec(t,e),Nt(t,e,r,n),e.child;case 8:return Nt(t,e,e.pendingProps.children,n),e.child;case 12:return Nt(t,e,e.pendingProps.children,n),e.child;case 10:return bM(t,e,n);case 9:return o=e.type._context,r=e.pendingProps.children,jl(e),o=sn(o),r=r(o),e.flags|=1,Nt(t,e,r,n),e.child;case 14:return dM(t,e,e.type,e.pendingProps,n);case 15:return jO(t,e,e.type,e.pendingProps,n);case 19:return Dw(t,e,n);case 31:return PV(t,e,n);case 22:return FO(t,e,n,e.pendingProps);case 24:return jl(e),r=sn(xt),t===null?(o=x1(),o===null&&(o=Be,i=S1(),o.pooledCache=i,i.refCount++,i!==null&&(o.pooledCacheLanes|=n),o=i),e.memoizedState={parent:r,cache:o},E1(e),gs(e,xt,o)):((t.lanes&n)!==0&&(vw(t,e),$d(e,null,null,n),Fd()),o=t.memoizedState,i=e.memoizedState,o.parent!==r?(o={parent:r,cache:r},e.memoizedState=o,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=o),gs(e,xt,r)):(r=i.cache,gs(e,xt,r),r!==o.cache&&gw(e,[xt],n,!0))),Nt(t,e,e.pendingProps.children,n),e.child;case 30:return e.stateNode===null&&(e.stateNode={autoName:null,paired:null,clones:null,ref:null}),r=e.pendingProps,r.name!=null&&r.name!=="auto"?e.flags|=t===null?18882560:18874368:de&&Hm(e),t!==null&&t.memoizedProps.name!==r.name?e.flags|=4194816:ec(t,e),Nt(t,e,r.children,n),e.child;case 29:throw e.pendingProps}throw Error(k(156,e.tag))}function di(t){t.flags|=4}function Ub(t,e,n,r,o){var i;if((i=(t.mode&32)!==0)&&(i=n===null?XM(e,r):XM(e,r)&&(r.src!==n.src||r.srcSet!==n.srcSet)),i){if(t.flags|=16777216,(o&335544128)===o)if(t.stateNode.complete)t.flags|=8192;else if(wD())t.flags|=8192;else throw Bl=pm,C1}else t.flags&=-16777217}function wM(t,e){if(e.type!=="stylesheet"||(e.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!GD(e))if(wD())t.flags|=8192;else throw Bl=pm,C1}function Dp(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?gR():536870912,t.lanes|=e,Rc|=e)}function Rd(t,e){if(!de)switch(t.tailMode){case"visible":break;case"collapsed":for(var n=t.tail,r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null;break;default:for(e=t.tail,n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null}}function Ke(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&1206910976,r|=o.flags&1206910976,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function jV(t,e,n){var r=e.pendingProps;switch(w1(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ke(e),null;case 1:return Ke(e),null;case 3:return n=e.stateNode,r=null,t!==null&&(r=t.memoizedState.cache),e.memoizedState.cache!==r&&(e.flags|=2048),mi(xt),Tc(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(Qa(e)?di(e):t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,Nb())),Ke(e),null;case 26:var o=e.type,i=e.memoizedState;return t===null?(di(e),i!==null?(Ke(e),wM(e,i)):(Ke(e),Ub(e,o,null,r,n))):i?i!==t.memoizedState?(di(e),Ke(e),wM(e,i)):(Ke(e),e.flags&=-16777217):(t=t.memoizedProps,t!==r&&di(e),Ke(e),Ub(e,o,t,r,n)),null;case 27:if(sm(e),n=ws.current,o=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==r&&di(e);else{if(!r){if(e.stateNode===null)throw Error(k(166));return Ke(e),e.subtreeFlags&=-33554433,null}t=zo.current,Qa(e)?Kk(e,t):(t=$D(o,r,n),e.stateNode=t,di(e))}return Ke(e),e.subtreeFlags&=-33554433,null;case 5:if(sm(e),o=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==r&&di(e);else{if(!r){if(e.stateNode===null)throw Error(k(166));return Ke(e),e.subtreeFlags&=-33554433,null}if(i=zo.current,Qa(e))Kk(e,i);else{var s=cf(ws.current);switch(i){case 1:i=s.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:i=s.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":i=s.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":i=s.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":i=s.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild);break;case"select":i=typeof r.is=="string"?s.createElement("select",{is:r.is}):s.createElement("select"),r.multiple?i.multiple=!0:r.size&&(i.size=r.size);break;default:i=typeof r.is=="string"?s.createElement(o,{is:r.is}):s.createElement(o)}}i[on]=e,i[Jn]=r;e:for(s=e.child;s!==null;){if(s.tag===5||s.tag===6)i.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===e)break e;for(;s.sibling===null;){if(s.return===null||s.return===e)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}e.stateNode=i;e:switch(cn(i,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&di(e)}}return Ke(e),e.subtreeFlags&=-33554433,Ub(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,n),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==r&&di(e);else{if(typeof r!="string"&&e.stateNode===null)throw Error(k(166));if(t=ws.current,Qa(e)){if(t=e.stateNode,n=e.memoizedProps,r=null,o=Kt,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}t[on]=e,t=!!(t.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||ND(t.nodeValue,n)),t||Ds(e,!0)}else t=cf(t).createTextNode(r),t[on]=e,e.stateNode=t}return Ke(e),null;case 31:if(n=e.memoizedState,t===null||t.memoizedState!==null){if(r=Qa(e),n!==null){if(t===null){if(!r)throw Error(k(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(k(557));t[on]=e}else Hl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ke(e),t=!1}else n=Nb(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),t=!0;if(!t)return e.flags&256?(gr(e),e):(gr(e),null);if((e.flags&128)!==0)throw Error(k(558))}return Ke(e),null;case 13:if(r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(o=Qa(e),r!==null&&r.dehydrated!==null){if(t===null){if(!o)throw Error(k(318));if(o=e.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(k(317));o[on]=e}else Hl(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ke(e),o=!1}else o=Nb(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=o),o=!0;if(!o)return e.flags&256?(gr(e),e):(gr(e),null)}return gr(e),(e.flags&128)!==0?(e.lanes=n,e):(n=r!==null,t=t!==null&&t.memoizedState!==null,n&&(r=e.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==o&&(r.flags|=2048)),n!==t&&n&&(e.child.flags|=8192),Dp(e,e.updateQueue),Ke(e),null);case 4:return Tc(),t===null&&W1(e.stateNode.containerInfo),e.flags|=67108864,Ke(e),null;case 10:return mi(e.type),Ke(e),null;case 19:if(A1(e),r=e.memoizedState,r===null)return Ke(e),null;if(o=(e.flags&128)!==0,i=r.rendering,i===null)if(o)Rd(r,!1);else{if(ut!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(i=gm(t),i!==null){for(e.flags|=128,Rd(r,!1),t=i.updateQueue,e.updateQueue=t,Dp(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)KR(n,t),n=n.sibling;return of(e,an.current&1|2),de&&fi(e,r.treeForkCount),e.child}t=t.sibling}r.tail!==null&&br()>Am&&(e.flags|=128,o=!0,Rd(r,!1),e.lanes=4194304)}else{if(!o)if(t=gm(i),t!==null){if(e.flags|=128,o=!0,t=t.updateQueue,e.updateQueue=t,Dp(e,t),Rd(r,!0),r.tail===null&&r.tailMode!=="collapsed"&&r.tailMode!=="visible"&&!i.alternate&&!de)return Ke(e),null}else 2*br()-r.renderingStartTime>Am&&n!==536870912&&(e.flags|=128,o=!0,Rd(r,!1),e.lanes=4194304);r.isBackwards?(i.sibling=e.child,e.child=i):(t=r.last,t!==null?t.sibling=i:e.child=i,r.last=i)}if(r.tail!==null){t=r.tail;e:{for(n=t;n!==null;){if(n.alternate!==null){n=!1;break e}n=n.sibling}n=!0}return r.rendering=t,r.tail=t.sibling,r.renderingStartTime=br(),t.sibling=null,i=an.current,i=o?i&1|2:i&1,r.tailMode==="visible"||r.tailMode==="collapsed"||!n||de?of(e,i):(n=i,Xe(un,e),Xe(an,n),Cn===null&&(Cn=e)),de&&fi(e,r.treeForkCount),t}return Ke(e),null;case 22:case 23:return gr(e),T1(),r=e.memoizedState!==null,t!==null?t.memoizedState!==null!==r&&(e.flags|=8192):r&&(e.flags|=8192),r?(n&536870912)!==0&&(e.flags&128)===0&&(Ke(e),e.subtreeFlags&6&&(e.flags|=8192)):Ke(e),n=e.updateQueue,n!==null&&Dp(e,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),r=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(r=e.memoizedState.cachePool.pool),r!==n&&(e.flags|=2048),t!==null&&ln(Ul),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),mi(xt),Ke(e),null;case 25:return null;case 30:return e.flags|=33554432,Ke(e),null}throw Error(k(156,e.tag))}function FV(t,e){switch(w1(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return mi(xt),Tc(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return sm(e),null;case 31:if(e.memoizedState!==null){if(gr(e),e.alternate===null)throw Error(k(340));Hl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(gr(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(k(340));Hl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return A1(e),t=e.flags,t&65536?(e.flags=t&-65537|128,t=e.memoizedState,t!==null&&(t.rendering=null,t.tail=null),e.flags|=4,e):null;case 4:return Tc(),null;case 10:return mi(e.type),null;case 22:case 23:return gr(e),T1(),t!==null&&ln(Ul),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return mi(xt),null;case 25:return null;default:return null}}function qO(t,e){switch(w1(e),e.tag){case 3:mi(xt),Tc();break;case 26:case 27:case 5:sm(e);break;case 4:Tc();break;case 31:e.memoizedState!==null&&gr(e);break;case 13:gr(e);break;case 19:A1(e);break;case 10:mi(e.type);break;case 22:case 23:gr(e),T1(),t!==null&&ln(Ul);break;case 24:mi(xt)}}function xf(t,e){try{var n=e.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var o=r.next;n=o;do{if((n.tag&t)===t){r=void 0;var i=n.create,s=n.inst;r=i(),s.destroy=r}n=n.next}while(n!==o)}}catch(l){De(e,e.return,l)}}function _s(t,e,n){try{var r=e.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var i=o.next;r=i;do{if((r.tag&t)===t){var s=r.inst,l=s.destroy;if(l!==void 0){s.destroy=void 0,o=e;var a=n,c=l;try{c()}catch(u){De(o,a,u)}}}r=r.next}while(r!==i)}}catch(u){De(e,e.return,u)}}function KO(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{rO(e,n)}catch(r){De(t,t.return,r)}}}function GO(t,e,n){n.props=ql(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(r){De(t,e,r)}}function Oo(t,e){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var r=t.stateNode;break;case 30:var o=t.stateNode,i=yi(t.memoizedProps,o);(o.ref===null||o.ref.name!==i)&&(o.ref=BD(i)),r=o.ref;break;case 7:if(t.stateNode===null){var s=new Er(t);Wn(t.child,!1,Dj,s,void 0,void 0),t.stateNode=s}r=t.stateNode;break;default:r=t.stateNode}typeof n=="function"?t.refCleanup=n(r):n.current=r}}catch(l){De(t,e,l)}}function rn(t,e){var n=t.ref,r=t.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(o){De(t,e,o)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(o){De(t,e,o)}else n.current=null}function Sm(t,e){if((t.tag===5||t.tag===27||t.tag===6)&&t.alternate===null&&e!==null)for(var n=0;n<e.length;n++)jD(t.stateNode,e[n])}function SM(t){for(var e=t.return;e!==null&&(F1(e)&&jD(t.stateNode,e.stateNode),!j1(e));)e=e.return}function Kd(t){for(var e=t.return;e!==null&&(F1(e)&&Nj(t.stateNode,e.stateNode),!j1(e));)e=e.return}function j1(t){return t.tag===5||t.tag===3||t.tag===27}function F1(t){return t&&t.tag===7&&t.stateNode!==null}function Nw(t){var e=t.type,n=t.memoizedProps,r=t.stateNode;try{e:switch(e){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(o){De(t,t.return,o)}}function Bb(t,e,n){try{var r=t.stateNode;hj(r,t.type,n,e),r[Jn]=e}catch(o){De(t,t.return,o)}}function XO(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&zs(t.type)||t.tag===4}function Pb(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||XO(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&zs(t.type)||t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function _w(t,e,n,r){var o=t.tag;if(o===5||o===6)o=t.stateNode,e?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(o,e):(e=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,e.appendChild(o),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=_o)),Sm(t,r),Se=!0;else if(o!==4&&(o===27&&(Sm(t,r),r=null,zs(t.type)&&(n=t.stateNode,e=null)),t=t.child,t!==null))for(_w(t,e,n,r),t=t.sibling;t!==null;)_w(t,e,n,r),t=t.sibling}function xm(t,e,n,r){var o=t.tag;if(o===5||o===6)o=t.stateNode,e?n.insertBefore(o,e):n.appendChild(o),Sm(t,r),Se=!0;else if(o!==4&&(o===27&&(Sm(t,r),r=null,zs(t.type)&&(n=t.stateNode)),t=t.child,t!==null))for(xm(t,e,n,r),t=t.sibling;t!==null;)xm(t,e,n,r),t=t.sibling}function WO(t){var e=t.stateNode,n=t.memoizedProps;try{for(var r=t.type,o=e.attributes;o.length;)e.removeAttributeNode(o[0]);cn(e,r,n),e[on]=t,e[Jn]=n}catch(i){De(t,t.return,i)}}var Cm=!1,yr=null;function xM(t){(t.tag===30||(t.subtreeFlags&33554432)!==0)&&(Cm=!0)}var Do=null;function CM(){var t=Do;return Do=null,t}var Kn=0;function Vc(t,e,n,r,o){return Kn=0,JO(t.child,e,n,r,o)}function JO(t,e,n,r,o){for(var i=!1;t!==null;){if(t.tag===5){var s=t.stateNode;if(r!==null){var l=Zw(s);r.push(l),l.view&&(i=!0)}else i||Zw(s).view&&(i=!0);Cm=!0,LD(s,Kn===0?e:e+"_"+Kn,n),Kn++}else(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&o||JO(t.child,e,n,r,o)&&(i=!0));t=t.sibling}return i}function Bo(t,e){for(;t!==null;)t.tag===5?zD(t.stateNode,t.memoizedProps):(t.tag!==22||t.memoizedState===null)&&(t.tag===30&&e||Bo(t.child,e)),t=t.sibling}function Xp(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if((t.tag!==22||t.memoizedState===null)&&(Xp(t),t.tag===30&&(t.flags&18874368)!==0&&t.stateNode.paired)){var e=t.memoizedProps;if(e.name==null||e.name==="auto")throw Error(k(544));var n=e.name;e=Ci(e.default,e.share),e!=="none"&&(Vc(t,n,e,null,!1)||Bo(t.child,!1))}t=t.sibling}}function Iw(t,e){if(t.tag===30){var n=t.stateNode,r=t.memoizedProps,o=yi(r,n),i=Ci(r.default,n.paired?r.share:r.enter);i!=="none"?Vc(t,o,i,null,!1)?(Xp(t),n.paired||e||Oc(t,r.onEnter)):Bo(t.child,!1):Xp(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)Iw(t,e),t=t.sibling;else Xp(t)}function Lw(t){if(yr!==null&&yr.size!==0){var e=yr;if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var n=t.memoizedProps,r=n.name;if(r!=null&&r!=="auto"){var o=e.get(r);if(o!==void 0){var i=Ci(n.default,n.share);if(i!=="none"&&(Vc(t,r,i,null,!1)?(i=t.stateNode,o.paired=i,i.paired=o,Oc(t,n.onShare)):Bo(t.child,!1)),e.delete(r),e.size===0)break}}}Lw(t)}t=t.sibling}}}function zw(t){if(t.tag===30){var e=t.memoizedProps,n=yi(e,t.stateNode),r=yr!==null?yr.get(n):void 0,o=Ci(e.default,r!==void 0?e.share:e.exit);o!=="none"&&(Vc(t,n,o,null,!1)?r!==void 0?(o=t.stateNode,r.paired=o,o.paired=r,yr.delete(n),Oc(t,e.onShare)):Oc(t,e.onExit):Bo(t.child,!1)),yr!==null&&Lw(t)}else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)zw(t),t=t.sibling;else yr!==null&&Lw(t)}function QO(t){for(t=t.child;t!==null;){if(t.tag===30){var e=t.memoizedProps,n=yi(e,t.stateNode);e=Ci(e.default,e.update),t.flags&=-5,e!=="none"&&Vc(t,n,e,t.memoizedState=[],!1)}else(t.subtreeFlags&33554432)!==0&&QO(t);t=t.sibling}}function Uw(t){if((t.subtreeFlags&18874368)!==0)for(t=t.child;t!==null;){if(t.tag!==22||t.memoizedState===null){if(t.tag===30&&(t.flags&18874368)!==0){var e=t.stateNode;e.paired!==null&&(e.paired=null,Bo(t.child,!1))}Uw(t)}t=t.sibling}}function Wp(t){if(t.tag===30)t.stateNode.paired=null,Bo(t.child,!1),Uw(t);else if((t.subtreeFlags&33554432)!==0)for(t=t.child;t!==null;)Wp(t),t=t.sibling;else Uw(t)}function ZO(t){for(t=t.child;t!==null;)t.tag===30?Bo(t.child,!1):(t.subtreeFlags&33554432)!==0&&ZO(t),t=t.sibling}function $1(t,e,n,r,o,i,s){for(var l=!1;e!==null;){if(e.tag===5){var a=e.stateNode;if(i!==null&&Kn<i.length){var c=i[Kn],u=Zw(a);(c.view||u.view)&&(l=!0);var d;if(d=(t.flags&4)===0)if(u.clip)d=!0;else{d=c.rect;var f=u.rect;d=d.y!==f.y||d.x!==f.x||d.height!==f.height||d.width!==f.width}d&&(t.flags|=4),u.abs?u=!c.abs:(c=c.rect,u=u.rect,u=c.height!==u.height||c.width!==u.width),u&&(t.flags|=32)}else t.flags|=32;(t.flags&4)!==0&&LD(a,Kn===0?n:n+"_"+Kn,o),l&&(t.flags&4)!==0||(Do===null&&(Do=[]),Do.push(a,Kn===0?r:r+"_"+Kn,e.memoizedProps)),Kn++}else(e.tag!==22||e.memoizedState===null)&&(e.tag===30&&s?t.flags|=e.flags&32:$1(t,e.child,n,r,o,i,s)&&(l=!0));e=e.sibling}return l}function eD(t,e){for(t=t.child;t!==null;){if(t.tag===30){var n=t.memoizedProps,r=t.stateNode,o=yi(n,r),i=Ci(n.default,n.update);if(e){r=r.clones;var s=r===null?null:r.map(bj)}else s=t.memoizedState,t.memoizedState=null;r=t;var l=t.child;Kn=0,o=$1(r,l,o,o,i,s,!1),(t.flags&4)!==0&&o&&(e||Oc(t,n.onUpdate))}else(t.subtreeFlags&33554432)!==0&&eD(t,e);t=t.sibling}}var $t=!1,Me=!1,ko=!1,Hb=!1,EM=typeof WeakSet=="function"?WeakSet:Set,Yt=null,Mo=!1,Ud=!1,Em=!1,Bw=!1;function $V(t,e,n){if(t=t.containerInfo,Ww=zc,t=PR(t),g1(t)){if("selectionStart"in t)var r={start:t.selectionStart,end:t.selectionEnd};else e:{r=(r=t.ownerDocument)&&r.defaultView||window;var o=r.getSelection&&r.getSelection();if(o&&o.rangeCount!==0){r=o.anchorNode;var i=o.anchorOffset,s=o.focusNode;o=o.focusOffset;try{r.nodeType,s.nodeType}catch{r=null;break e}var l=0,a=-1,c=-1,u=0,d=0,f=t,h=null;t:for(;;){for(var p;f!==r||i!==0&&f.nodeType!==3||(a=l+i),f!==s||o!==0&&f.nodeType!==3||(c=l+o),f.nodeType===3&&(l+=f.nodeValue.length),(p=f.firstChild)!==null;)h=f,f=p;for(;;){if(f===t)break t;if(h===r&&++u===i&&(a=l),h===s&&++d===o&&(c=l),(p=f.nextSibling)!==null)break;f=h,h=f.parentNode}f=p}r=a===-1||c===-1?null:{start:a,end:c}}else r=null}r=r||{start:0,end:0}}else r=null;for(Jw={focusedElem:t,selectionRange:r},zc=!1,n=(n&335544064)===n,Yt=e,e=n?9270:1024;Yt!==null;){if(t=Yt,n&&(r=t.deletions,r!==null))for(i=0;i<r.length;i++)n&&zw(r[i]);if(t.alternate===null&&(t.flags&2)!==0)n&&xM(t),Np(n);else{if(t.tag===22){if(r=t.alternate,t.memoizedState!==null){r!==null&&r.memoizedState===null&&n&&zw(r),Np(n);continue}else if(r!==null&&r.memoizedState!==null){n&&xM(t),Np(n);continue}}r=t.child,(t.subtreeFlags&e)!==0&&r!==null?(r.return=t,Yt=r):(n&&QO(t),Np(n))}}yr=null}function Np(t){for(;Yt!==null;){var e=Yt,n=t,r=e.alternate,o=e.flags;switch(e.tag){case 0:case 11:case 15:break;case 1:if((o&1024)!==0&&r!==null){n=void 0,o=r.memoizedProps,r=r.memoizedState;var i=e.stateNode;try{var s=ql(e.type,o);n=i.getSnapshotBeforeUpdate(s,r),i.__reactInternalSnapshotBeforeUpdate=n}catch(l){De(e,e.return,l)}}break;case 3:if((o&1024)!==0){if(r=e.stateNode.containerInfo,n=r.nodeType,n===9)e1(r);else if(n===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":e1(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;case 30:n&&r!==null&&(n=yi(r.memoizedProps,r.stateNode),o=e.memoizedProps,o=Ci(o.default,o.update),o!=="none"&&Vc(r,n,o,r.memoizedState=[],!0));break;default:if((o&1024)!==0)throw Error(k(163))}if(r=e.sibling,r!==null){r.return=e.return,Yt=r;break}Yt=e.return}}function tD(t,e,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:Ro(t,n),r&4&&xf(5,n);break;case 1:if(Ro(t,n),r&4)if(t=n.stateNode,e===null)try{t.componentDidMount()}catch(s){De(n,n.return,s)}else{var o=ql(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(o,e,t.__reactInternalSnapshotBeforeUpdate)}catch(s){De(n,n.return,s)}}r&64&&KO(n),r&512&&Oo(n,n.return);break;case 3:if(Ro(t,n),r&64&&(t=n.updateQueue,t!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{rO(t,e)}catch(s){De(n,n.return,s)}}break;case 27:e===null&&r&4&&WO(n);case 26:case 5:Ro(t,n),e===null&&r&4&&Nw(n),r&512&&Oo(n,n.return);break;case 12:Ro(t,n);break;case 31:Ro(t,n),r&4&&iD(t,n);break;case 13:Ro(t,n),r&4&&sD(t,n),r&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=nj.bind(null,n),Lj(t,n))));break;case 22:if(r=n.memoizedState!==null||$t,!r){var i=e!==null&&e.memoizedState!==null||Me;e=$t,o=Me,$t=r,(Me=i)&&!o?(r=2,(n.subtreeFlags&8772)!==0&&(r|=1),lo(t,n,r)):Ro(t,n),$t=e,Me=o}break;case 30:Ro(t,n),r&512&&Oo(n,n.return);break;case 7:r&512&&Oo(n,n.return);default:Ro(t,n)}}function Pw(t,e){for(t=t.child;t!==null;)nD(t,e),t=t.sibling}function nD(t,e){switch(t.tag){case 5:case 26:try{var n=t.stateNode;if(e){var r=n.style;typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none"}else{var o=t.stateNode,i=t.memoizedProps.style,s=i!=null&&i.hasOwnProperty("display")?i.display:null;o.style.display=s==null||typeof s=="boolean"?"":(""+s).trim()}}catch(a){De(t,t.return,a)}Hw(t,e);break;case 6:try{t.stateNode.nodeValue=e?"":t.memoizedProps,Se=!0}catch(a){De(t,t.return,a)}break;case 18:try{var l=t.stateNode;e?HM(l,!0):HM(t.stateNode,!1)}catch(a){De(t,t.return,a)}break;case 22:case 23:t.memoizedState===null&&Pw(t,e);break;default:Pw(t,e)}}function Hw(t,e){if(t.subtreeFlags&67108864)for(t=t.child;t!==null;){e:{var n=t,r=e;switch(n.tag){case 4:nD(n,r);break e;case 22:n.memoizedState===null&&Hw(n,r);break e;default:Hw(n,r)}}t=t.sibling}}function rD(t){var e=t.alternate;e!==null&&(t.alternate=null,rD(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&Im(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var rt=null,Yn=!1;function so(t,e,n){for(n=n.child;n!==null;)oD(t,e,n),n=n.sibling}function oD(t,e,n){if(wr&&typeof wr.onCommitFiberUnmount=="function")try{wr.onCommitFiberUnmount(mf,n)}catch{}switch(n.tag){case 26:Me||rn(n,e),so(t,e,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&!Me&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Me||rn(n,e),Kd(n);var r=rt,o=Yn;zs(n.type)&&(rt=n.stateNode,Yn=!1),so(t,e,n),YD(n.stateNode,n.type,n.memoizedProps),rt=r,Yn=o;break;case 5:Me||rn(n,e),Kd(n);case 6:if(n.tag===6&&Kd(n),r=rt,o=Yn,rt=null,so(t,e,n),rt=r,Yn=o,rt!==null)if(Yn)try{(rt.nodeType===9?rt.body:rt.nodeName==="HTML"?rt.ownerDocument.body:rt).removeChild(n.stateNode),Se=!0}catch(i){De(n,e,i)}else try{rt.removeChild(n.stateNode),Se=!0}catch(i){De(n,e,i)}break;case 18:rt!==null&&(Yn?(t=rt,PM(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),Uc(t)):PM(rt,n.stateNode));break;case 4:r=rt,o=Yn,rt=n.stateNode.containerInfo,Yn=!0,so(t,e,n),rt=r,Yn=o;break;case 0:case 11:case 14:case 15:_s(2,n,e),Me||_s(4,n,e),so(t,e,n);break;case 1:Me||(rn(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"&&GO(n,e,r)),so(t,e,n);break;case 21:so(t,e,n);break;case 22:Me=(r=Me)||n.memoizedState!==null,so(t,e,n),Me=r;break;case 30:rn(n,e),so(t,e,n);break;case 7:Me||rn(n,e),so(t,e,n);break;default:so(t,e,n)}}function iD(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Uc(t)}catch(n){De(e,e.return,n)}}}function sD(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Uc(t)}catch(n){De(e,e.return,n)}}function YV(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new EM),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new EM),e;default:throw Error(k(435,t.tag))}}function _p(t,e){var n=YV(t);e.forEach(function(r){if(!n.has(r)){n.add(r);var o=rj.bind(null,t,r);r.then(o,o)}})}function Un(t,e,n){var r=e.deletions;if(r!==null)for(var o=0;o<r.length;o++){var i=r[o],s=t,l=e,a=l;e:for(;a!==null;){switch(a.tag){case 27:if(zs(a.type)){rt=a.stateNode,Yn=!1;break e}break;case 5:rt=a.stateNode,Yn=!1;break e;case 3:case 4:rt=a.stateNode.containerInfo,Yn=!0;break e}a=a.return}if(rt===null)throw Error(k(160));oD(s,l,i),rt=null,Yn=!1,s=i.alternate,s!==null&&(s.return=null),i.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)lD(e,t,n),e=e.sibling}var ao=null;function lD(t,e,n){var r=t.alternate,o=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(o&4&&(r=t.updateQueue,r=r!==null?r.events:null,r!==null))for(var i=0;i<r.length;i++){var s=r[i];s.ref.impl=s.nextImpl}Un(e,t,n),Bn(t),o&4&&(_s(3,t,t.return),xf(3,t),_s(5,t,t.return));break;case 1:Un(e,t,n),Bn(t),o&512&&(Me||r===null||rn(r,r.return)),o&64&&$t&&(t=t.updateQueue,t!==null&&(e=t.callbacks,e!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?e:n.concat(e))));break;case 26:if(i=ao,Un(e,t,n),Bn(t),o&512&&(Me||r===null||rn(r,r.return)),o&4)if(o=r!==null?r.memoizedState:null,n=t.memoizedState,r===null)if(n===null)if(t.stateNode===null)if($t)t.stateNode=ID(t.type,t.memoizedProps,e.containerInfo,t);else{e:{e=t.type,n=t.memoizedProps,o=i.ownerDocument||i;t:switch(e){case"title":r=o.getElementsByTagName("title")[0],(!r||r[vf]||r[on]||r.namespaceURI==="http://www.w3.org/2000/svg"||r.hasAttribute("itemprop"))&&(r=o.createElement(e),o.head.insertBefore(r,o.querySelector("head > title"))),cn(r,e,n),r[on]=t,qt(r),e=r;break e;case"link":if(i=GM("link","href",o).get(e+(n.href||""))){for(s=0;s<i.length;s++)if(r=i[s],r.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&r.getAttribute("rel")===(n.rel==null?null:n.rel)&&r.getAttribute("title")===(n.title==null?null:n.title)&&r.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){i.splice(s,1);break t}}r=o.createElement(e),cn(r,e,n),o.head.appendChild(r);break;case"meta":if(i=GM("meta","content",o).get(e+(n.content||""))){for(s=0;s<i.length;s++)if(r=i[s],r.getAttribute("content")===(n.content==null?null:""+n.content)&&r.getAttribute("name")===(n.name==null?null:n.name)&&r.getAttribute("property")===(n.property==null?null:n.property)&&r.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&r.getAttribute("charset")===(n.charSet==null?null:n.charSet)){i.splice(s,1);break t}}r=o.createElement(e),cn(r,e,n),o.head.appendChild(r);break;default:throw Error(k(468,e))}r[on]=t,qt(r),e=r}t.stateNode=e}else $t||r1(i,t.type,t.stateNode);else t.stateNode=KM(i,n,t.memoizedProps);else o!==n?(o===null?(e=r.stateNode,e===null||Me||e.parentNode.removeChild(e)):o.count--,n===null?$t||r1(i,t.type,t.stateNode):KM(i,n,t.memoizedProps)):n===null&&t.stateNode!==null&&Bb(t,t.memoizedProps,r.memoizedProps);break;case 27:Un(e,t,n),Bn(t),o&512&&(Me||r===null||rn(r,r.return)),r!==null&&o&4&&Bb(t,t.memoizedProps,r.memoizedProps);break;case 5:if(i=ko,ko=!1,Un(e,t,n),ko=i,Bn(t),o&512&&(Me||r===null||rn(r,r.return)),t.flags&32){e=t.stateNode;try{kc(e,""),Se=!0}catch(u){De(t,t.return,u)}}o&4&&t.stateNode!=null&&(e=t.memoizedProps,Bb(t,e,r!==null?r.memoizedProps:e)),o&1024&&(Hb=!0);break;case 6:if(Un(e,t,n),Bn(t),o&4){if(t.stateNode===null)throw Error(k(162));e=t.memoizedProps,n=t.stateNode;try{n.nodeValue=e,Se=!0}catch(u){De(t,t.return,u)}}break;case 3:if(Se=!1,em=null,i=ao,ao=uf(e.containerInfo),Un(e,t,n),ao=i,Bn(t),o&4&&r!==null&&r.memoizedState.isDehydrated)try{Uc(e.containerInfo)}catch(u){De(t,t.return,u)}Hb&&(Hb=!1,aD(t)),Se=!1;break;case 4:o=ko,ko=$t,r=Ok(),i=ao,ao=uf(t.stateNode.containerInfo),Un(e,t,n),Bn(t),ao=i,Se&&Ud&&(Em=!0),Se=r,ko=o;break;case 12:Un(e,t,n),Bn(t);break;case 31:Un(e,t,n),Bn(t),o&4&&(e=t.updateQueue,e!==null&&(t.updateQueue=null,_p(t,e)));break;case 13:Un(e,t,n),Bn(t),t.child.flags&8192&&t.memoizedState!==null!=(r!==null&&r.memoizedState!==null)&&(Km=br()),o&4&&(e=t.updateQueue,e!==null&&(t.updateQueue=null,_p(t,e)));break;case 22:i=t.memoizedState!==null,s=r!==null&&r.memoizedState!==null;var l=$t,a=Me,c=ko;$t=l||i,ko=c||i,Me=a||s,Un(e,t,n),Me=a,ko=c,$t=l,Bn(t),o&8192&&(e=t.stateNode,e._visibility=i?e._visibility&-2:e._visibility|1,!i||r===null||s||$t||Me||(e=s||Me,n=$t,r=Me,$t=i||$t,Me=e,us(t,2),$t=n,Me=r),!i&&ko||Pw(t,i)),o&4&&(e=t.updateQueue,e!==null&&(n=e.retryQueue,n!==null&&(e.retryQueue=null,_p(t,n))));break;case 19:Un(e,t,n),Bn(t),o&4&&(e=t.updateQueue,e!==null&&(t.updateQueue=null,_p(t,e)));break;case 30:o&512&&(Me||r===null||rn(r,r.return)),o=Ok(),i=Ud,s=(n&335544064)===n,l=t.memoizedProps,Ud=s&&Ci(l.default,l.update)!=="none",Un(e,t,n),Bn(t),s&&r!==null&&Se&&(t.flags|=4),Ud=i,Se=o;break;case 21:break;case 7:o&512&&(Me||r===null||rn(r,r.return)),r&&r.stateNode!==null&&(r.stateNode._fragmentFiber=t);default:Un(e,t,n),Bn(t)}}function Bn(t){var e=t.flags;if(e&2){try{for(var n,r=t.return;r!==null;){if(XO(r)){n=r;break}r=r.return}r=null;for(var o=t.return;o!==null;){if(F1(o)){var i=o.stateNode;r===null?r=[i]:r.push(i)}if(j1(o))break;o=o.return}var s=r;if(n==null)throw Error(k(160));switch(n.tag){case 27:var l=n.stateNode,a=Pb(t);xm(t,a,l,s);break;case 5:var c=n.stateNode;n.flags&32&&(kc(c,""),n.flags&=-33);var u=Pb(t);xm(t,u,c,s);break;case 3:case 4:var d=n.stateNode.containerInfo,f=Pb(t);_w(t,f,d,s);break;default:throw Error(k(161))}}catch(h){De(t,t.return,h)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function aD(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;aD(e),e.tag===5&&e.flags&1024&&(e=e.stateNode,zc=!0,e.reset(),zc=!1),t=t.sibling}}function Za(t,e){if(e.subtreeFlags&9270)for(e=e.child;e!==null;)cD(e,t),e=e.sibling;else eD(e,!1)}function cD(t,e){var n=t.alternate;if(n===null)Iw(t,!1);else switch(t.tag){case 3:if(Bw=Mo=!1,CM(),Za(e,t),!Mo&&!Em){if(t=Do,t!==null)for(var r=0;r<t.length;r+=3){n=t[r];var o=t[r+1];zD(n,t[r+2]),n=n.ownerDocument.documentElement,n!==null&&n.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group("+o+")"})}t=e.containerInfo,t=t.nodeType===9?t.documentElement:t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName===""&&(t.style.viewTransitionName="none",t.animate({opacity:[0,0],pointerEvents:["none","none"]},{duration:0,fill:"forwards",pseudoElement:"::view-transition-group(root)"}),t.animate({width:[0,0],height:[0,0]},{duration:0,fill:"forwards",pseudoElement:"::view-transition"})),Bw=!0}Do=null;break;case 5:Za(e,t);break;case 4:r=Mo,Mo=!1,Za(e,t),Mo&&(Em=!0),Mo=r;break;case 22:t.memoizedState===null&&(n.memoizedState!==null?Iw(t,!1):Za(e,t));break;case 30:r=Mo,o=CM(),Mo=!1,Za(e,t),Mo&&(t.flags|=4);var i=t.memoizedProps,s=t.stateNode;e=yi(i,s),s=yi(n.memoizedProps,s);var l=Ci(i.default,i.update);l==="none"?e=!1:(i=n.memoizedState,n.memoizedState=null,n=t.child,Kn=0,e=$1(t,n,e,s,l,i,!0),Kn!==(i===null?0:i.length)&&(t.flags|=32)),(t.flags&4)!==0&&e?(Oc(t,t.memoizedProps.onUpdate),Do=o):o!==null&&(o.push.apply(o,Do),Do=o),Mo=(t.flags&32)!==0?!0:r;break;default:Za(e,t)}}function Ro(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)tD(t,e.alternate,e),e=e.sibling}function us(t,e){for(t=t.child;t!==null;){var n=t,r=e;switch(n.tag){case 0:case 11:case 14:case 15:_s(4,n,n.return),us(n,r);break;case 1:rn(n,n.return);var o=n.stateNode;typeof o.componentWillUnmount=="function"&&GO(n,n.return,o),us(n,r);break;case 27:(r&2)!==0&&YD(n.stateNode,n.type,n.memoizedProps);case 5:rn(n,n.return),n.tag!==5&&n.tag!==27||Kd(n),us(n,r);break;case 6:Kd(n);break;case 26:rn(n,n.return),o=n.stateNode,n.memoizedState!==null||o===null||Me||o.parentNode.removeChild(o),us(n,r);break;case 22:n.memoizedState===null&&us(n,r);break;case 30:rn(n,n.return),us(n,r);break;case 7:rn(n,n.return);default:us(n,r)}t=t.sibling}}function lo(t,e,n){for(n=(e.subtreeFlags&8772)!==0?n:n&-2,e=e.child;e!==null;){var r=e.alternate,o=t,i=e,s=i.flags,l=(n&1)!==0;switch(i.tag){case 0:case 11:case 15:lo(o,i,n),xf(4,i);break;case 1:if(lo(o,i,n),r=i,o=r.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(u){De(r,r.return,u)}if(r=i,o=r.updateQueue,o!==null){var a=r.stateNode;try{var c=o.shared.hiddenCallbacks;if(c!==null)for(o.shared.hiddenCallbacks=null,o=0;o<c.length;o++)nO(c[o],a)}catch(u){De(r,r.return,u)}}l&&s&64&&KO(i),Oo(i,i.return);break;case 27:(n&2)!==0&&WO(i);case 5:i.tag!==5&&i.tag!==27||SM(i),lo(o,i,n),l&&r===null&&s&4&&Nw(i),Oo(i,i.return);break;case 6:SM(i);break;case 26:a=i.stateNode,i.memoizedState!==null||a===null||$t||r1(uf(a.ownerDocument),i.type,a),lo(o,i,n),l&&r===null&&s&4&&Nw(i),Oo(i,i.return);break;case 12:lo(o,i,n);break;case 31:lo(o,i,n),l&&s&4&&iD(o,i);break;case 13:lo(o,i,n),l&&s&4&&sD(o,i);break;case 22:i.memoizedState===null&&lo(o,i,n),Oo(i,i.return);break;case 30:lo(o,i,n),Oo(i,i.return);break;case 7:Oo(i,i.return);default:lo(o,i,n)}e=e.sibling}}function Y1(t,e){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&wf(n))}function q1(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&wf(t))}function Pr(t,e,n,r){var o=(n&335544064)===n;if(e.subtreeFlags&(o?10262:10256))for(e=e.child;e!==null;)uD(t,e,n,r),e=e.sibling;else o&&ZO(e)}function uD(t,e,n,r){var o=(n&335544064)===n;o&&e.alternate===null&&e.return!==null&&e.return.alternate!==null&&Wp(e);var i=e.flags;switch(e.tag){case 0:case 11:case 15:Pr(t,e,n,r),i&2048&&xf(9,e);break;case 1:Pr(t,e,n,r);break;case 3:Pr(t,e,n,r),o&&Bw&&(t=t.containerInfo,t=t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,t.style.viewTransitionName==="root"&&(t.style.viewTransitionName=""),t=t.ownerDocument.documentElement,t!==null&&t.style.viewTransitionName==="none"&&(t.style.viewTransitionName="")),i&2048&&(i=null,e.alternate!==null&&(i=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==i&&(e.refCount++,i!=null&&wf(i)));break;case 12:if(i&2048){Pr(t,e,n,r),i=e.stateNode;try{var s=e.memoizedProps,l=s.id,a=s.onPostCommit;typeof a=="function"&&a(l,e.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(c){De(e,e.return,c)}}else Pr(t,e,n,r);break;case 31:Pr(t,e,n,r);break;case 13:Pr(t,e,n,r);break;case 23:break;case 22:s=e.stateNode,l=e.alternate,e.memoizedState!==null?(o&&l!==null&&l.memoizedState===null&&Wp(l),s._visibility&2?Pr(t,e,n,r):Gd(t,e)):(o&&l!==null&&l.memoizedState!==null&&Wp(e),s._visibility&2?Pr(t,e,n,r):(s._visibility|=2,tc(t,e,n,r,(e.subtreeFlags&10256)!==0||!1))),i&2048&&Y1(l,e);break;case 24:Pr(t,e,n,r),i&2048&&q1(e.alternate,e);break;case 30:o&&(i=e.alternate,i!==null&&(Bo(i.child,!0),Bo(e.child,!0))),Pr(t,e,n,r);break;default:Pr(t,e,n,r)}}function tc(t,e,n,r,o){for(o=o&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var i=t,s=e,l=n,a=r,c=s.flags;switch(s.tag){case 0:case 11:case 15:tc(i,s,l,a,o),xf(8,s);break;case 23:break;case 22:var u=s.stateNode;s.memoizedState!==null?u._visibility&2?tc(i,s,l,a,o):Gd(i,s):(u._visibility|=2,tc(i,s,l,a,o)),o&&c&2048&&Y1(s.alternate,s);break;case 24:tc(i,s,l,a,o),o&&c&2048&&q1(s.alternate,s);break;default:tc(i,s,l,a,o)}e=e.sibling}}function Gd(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var n=t,r=e,o=r.flags;switch(r.tag){case 22:Gd(n,r),o&2048&&Y1(r.alternate,r);break;case 24:Gd(n,r),o&2048&&q1(r.alternate,r);break;default:Gd(n,r)}e=e.sibling}}var Nl=8192;function Rl(t,e,n){if(t.subtreeFlags&Nl)for(t=t.child;t!==null;)dD(t,e,n),t=t.sibling}function dD(t,e,n){switch(t.tag){case 26:Rl(t,e,n),t.flags&Nl&&(t.memoizedState!==null?Xj(n,ao,t.memoizedState,t.memoizedProps):(t=t.stateNode,(e&335544128)===e&&WM(n,t)));break;case 5:Rl(t,e,n),t.flags&Nl&&(t=t.stateNode,(e&335544128)===e&&WM(n,t));break;case 3:case 4:var r=ao;ao=uf(t.stateNode.containerInfo),Rl(t,e,n),ao=r;break;case 22:t.memoizedState===null&&(r=t.alternate,r!==null&&r.memoizedState!==null?(r=Nl,Nl=16777216,Rl(t,e,n),Nl=r):Rl(t,e,n));break;case 30:if((t.flags&Nl)!==0&&(r=t.memoizedProps.name,r!=null&&r!=="auto")){var o=t.stateNode;o.paired=null,yr===null&&(yr=new Map),yr.set(r,o)}Rl(t,e,n);break;default:Rl(t,e,n)}}function fD(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function Od(t){var e=t.deletions;if((t.flags&16)!==0){if(e!==null)for(var n=0;n<e.length;n++){var r=e[n];Yt=r,pD(r,t)}fD(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)hD(t),t=t.sibling}function hD(t){switch(t.tag){case 0:case 11:case 15:Od(t),t.flags&2048&&_s(9,t,t.return);break;case 3:Od(t);break;case 12:Od(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,Jp(t)):Od(t);break;default:Od(t)}}function Jp(t){var e=t.deletions;if((t.flags&16)!==0){if(e!==null)for(var n=0;n<e.length;n++){var r=e[n];Yt=r,pD(r,t)}fD(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:_s(8,e,e.return),Jp(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,Jp(e));break;default:Jp(e)}t=t.sibling}}function pD(t,e){for(;Yt!==null;){var n=Yt;switch(n.tag){case 0:case 11:case 15:_s(8,n,e);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:wf(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,Yt=r;else e:for(n=t;Yt!==null;){r=Yt;var o=r.sibling,i=r.return;if(rD(r),r===n){Yt=null;break e}if(o!==null){o.return=i,Yt=o;break e}Yt=i}}}var qV={getCacheForType:function(t){var e=sn(xt),n=e.data.get(t);return n===void 0&&(n=t(),e.data.set(t,n)),n},cacheSignal:function(){return sn(xt).controller.signal}},KV=typeof WeakMap=="function"?WeakMap:Map,Te=0,Be=null,pe=null,me=0,Re=0,pr=null,ys=!1,jc=!1,K1=!1,Si=0,ut=0,Is=0,Pl=0,Tm=0,vr=0,Rc=0,Xd=null,qn=null,Vw=!1,Km=0,mD=0,Am=1/0,km=null,As=null,st=0,uo=null,Kl=null,Uo=0,jw=0,Fw=null,gD=null,xc=null,Cc=null,Ec=null,Wd=0,Qp=null;function xr(){return(Te&2)!==0&&me!==0?me&-me:Z.T!==null?X1():wR()}function yD(){if(vr===0)if((me&536870912)===0||de){var t=wp;wp<<=1,(wp&3932160)===0&&(wp=262144),vr=t}else vr=536870912;return t=un.current,t!==null&&(t.flags|=32),vr}function Oc(t,e){if(e!=null){var n=t.stateNode,r=n.ref;r===null&&(r=n.ref=BD(yi(t.memoizedProps,n))),Cc===null&&(Cc=[]),Cc.push(e.bind(null,r))}}function Xn(t,e,n){(t===Be&&(Re===2||Re===9)||t.cancelPendingCommit!==null)&&(Dc(t,0),vs(t,me,vr,!1)),yf(t,n),((Te&2)===0||t!==Be)&&(t===Be&&((Te&2)===0&&(Pl|=n),ut===4&&vs(t,me,vr,!1)),Ho(t))}function vD(t,e,n){if((Te&6)!==0)throw Error(k(327));var r=!n&&(e&127)===0&&(e&t.expiredLanes)===0||gf(t,e),o=r?WV(t,e):Vb(t,e,!0),i=r;do{if(o===0){jc&&!r&&vs(t,e,0,!1);break}else{if(n=t.current.alternate,i&&!GV(n)){o=Vb(t,e,!1),i=!1;continue}if(o===2){if(i=e,t.errorRecoveryDisabledLanes&i)var s=0;else s=t.pendingLanes&-536870913,s=s!==0?s:s&536870912?536870912:0;if(s!==0){e=s;e:{var l=t;o=Xd;var a=l.current.memoizedState.isDehydrated;if(a&&(Dc(l,s).flags|=256),s=Vb(l,s,!1),s!==2&&s!==6){if(K1&&!a){l.errorRecoveryDisabledLanes|=i,Pl|=i,o=4;break e}i=qn,qn=o,i!==null&&(qn===null?qn=i:qn.push.apply(qn,i))}o=s}if(i=!1,o!==2)continue}}if(o===1){Dc(t,0),vs(t,e,0,!0);break}e:{switch(r=t,i=o,i){case 0:case 1:throw Error(k(345));case 4:if((e&4194048)!==e&&(e&62914560)!==e)break;case 6:vs(r,e,vr,!ys);break e;case 2:qn=null;break;case 3:case 5:break;default:throw Error(k(329))}if((e&62914560)===e&&(o=Km+300-br(),10<o)){if(vs(r,e,vr,!ys),_m(r,0,!0)!==0)break e;Uo=e,r.timeoutHandle=J1(TM.bind(null,r,n,qn,km,Vw,e,vr,Pl,Rc,ys,i,"Throttled",-0,0),o);break e}TM(r,n,qn,km,Vw,e,vr,Pl,Rc,ys,i,null,-0,0)}}break}while(!0);Ho(t)}function TM(t,e,n,r,o,i,s,l,a,c,u,d,f,h){t.timeoutHandle=-1;var p=e.subtreeFlags,m=(i&335544064)===i;if(d=null,(m||p&8192||(p&16785408)===16785408)&&(d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:_o},yr=null,dD(e,i,d),m&&(p=d,m=t.containerInfo,m=(m.nodeType===9?m:m.ownerDocument).__reactViewTransition,m!=null&&(p.count++,p.waitingForViewTransition=!0,p=df.bind(p),m.finished.then(p,p))),p=(i&62914560)===i?Km-br():(i&4194048)===i?mD-br():0,p=Wj(d,p),p!==null)){Uo=i,t.cancelPendingCommit=p(kM.bind(null,t,e,i,n,r,o,s,l,a,c,u,d,null,f,h)),vs(t,i,s,!c);return}kM(t,e,i,n,r,o,s,l,a,c,u,d)}function GV(t){for(var e=t;;){var n=e.tag;if((n===0||n===11||n===15)&&e.flags&16384&&(n=e.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var o=n[r],i=o.getSnapshot;o=o.value;try{if(!Cr(i(),o))return!1}catch{return!1}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function vs(t,e,n,r){e=mR(t,e),e&=~Tm,e&=~Pl,t.suspendedLanes|=e,t.pingedLanes&=~e,r&&(t.warmLanes|=e),r=t.expirationTimes;for(var o=e;0<o;){var i=31-Sr(o),s=1<<i;r[i]=-1,o&=~s}n!==0&&yR(t,n,e)}function Gm(){return(Te&6)===0?(Cf(0,!1),!1):!0}function G1(){if(pe!==null){if(Re===0)var t=pe.return;else t=pe,hi=Ql=null,D1(t),bc=null,rf=0,t=pe;for(;t!==null;)qO(t.alternate,t),t=t.return;pe=null}}function Dc(t,e){var n=t.timeoutHandle;return n!==-1&&(t.timeoutHandle=-1,gj(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),Uo=0,G1(),Be=t,pe=n=pi(t.current,null),me=e,Re=0,pr=null,ys=!1,jc=gf(t,e),K1=!1,Rc=vr=Tm=Pl=Is=ut=0,qn=Xd=null,Vw=!1,Si=mR(t,e),Bm(),n}function bD(t,e){se=null,Z.H=bm,e===Hc||e===Vm?(e=Qk(),Re=3):e===C1?(e=Qk(),Re=4):Re=e===P1?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,pr=e,pe===null&&(ut=1,wm(t,$r(e,t.current)))}function wD(){var t=un.current;return t===null?!0:(me&4194048)===me?Cn===null:(me&62914560)===me||(me&536870912)!==0?t===Cn:!1}function SD(){var t=Z.H;return Z.H=bm,t===null?bm:t}function xD(){var t=Z.A;return Z.A=qV,t}function Mm(){ut=4,ys||(me&4194048)!==me&&un.current!==null||(jc=!0),(Is&134217727)===0&&(Pl&134217727)===0||Be===null||vs(Be,me,vr,!1)}function Vb(t,e,n){var r=Te;Te|=2;var o=SD(),i=xD();(Be!==t||me!==e)&&(km=null,Dc(t,e)),e=!1;var s=ut;e:do try{if(Re!==0&&pe!==null){var l=pe,a=pr;switch(Re){case 8:G1(),s=6;break e;case 3:case 2:case 9:case 6:un.current===null&&(e=!0);var c=Re;if(Re=0,pr=null,pc(t,l,a,c),n&&jc){s=0;break e}break;default:c=Re,Re=0,pr=null,pc(t,l,a,c)}}XV(),s=ut;break}catch(u){bD(t,u)}while(!0);return e&&t.shellSuspendCounter++,hi=Ql=null,Te=r,Z.H=o,Z.A=i,pe===null&&(Be=null,me=0,Bm()),s}function XV(){for(;pe!==null;)CD(pe)}function WV(t,e){var n=Te;Te|=2;var r=SD(),o=xD();Be!==t||me!==e?(km=null,Am=br()+500,Dc(t,e)):jc=gf(t,e);e:do try{if(Re!==0&&pe!==null){e=pe;var i=pr;t:switch(Re){case 1:Re=0,pr=null,pc(t,e,i,1);break;case 2:case 9:if(Jk(i)){Re=0,pr=null,AM(e);break}e=function(){Re!==2&&Re!==9||Be!==t||(Re=7),Ho(t)},i.then(e,e);break e;case 3:Re=7;break e;case 4:Re=5;break e;case 7:Jk(i)?(Re=0,pr=null,AM(e)):(Re=0,pr=null,pc(t,e,i,7));break;case 5:var s=null;switch(pe.tag){case 26:s=pe.memoizedState;case 5:case 27:var l=pe;if(s?GD(s):l.stateNode.complete){Re=0,pr=null;var a=l.sibling;if(a!==null)pe=a;else{var c=l.return;c!==null?(pe=c,Xm(c)):pe=null}break t}}Re=0,pr=null,pc(t,e,i,5);break;case 6:Re=0,pr=null,pc(t,e,i,6);break;case 8:G1(),ut=6;break e;default:throw Error(k(462))}}JV();break}catch(u){bD(t,u)}while(!0);return hi=Ql=null,Z.H=r,Z.A=o,Te=n,pe!==null?0:(Be=null,me=0,Bm(),ut)}function JV(){for(;pe!==null&&!pH();)CD(pe)}function CD(t){var e=YO(t.alternate,t,Si);t.memoizedProps=t.pendingProps,e===null?Xm(t):pe=e}function AM(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=pM(n,e,e.pendingProps,e.type,void 0,me);break;case 11:e=pM(n,e,e.pendingProps,e.type.render,e.ref,me);break;case 5:D1(e);var r=e;r===Kt&&(de?(fm(r),r.tag===5&&r.stateNode!=null&&(Ge=r.stateNode)):(fm(r),de=!0));default:qO(n,e),e=pe=KR(e,Si),e=YO(n,e,Si)}t.memoizedProps=t.pendingProps,e===null?Xm(t):pe=e}function pc(t,e,n,r){hi=Ql=null,D1(e),bc=null,rf=0;var o=e.return;try{if(BV(t,o,e,n,me)){ut=1,wm(t,$r(n,t.current)),pe=null;return}}catch(i){if(o!==null)throw pe=o,i;ut=1,wm(t,$r(n,t.current)),pe=null;return}e.flags&32768?(de||r===1?t=!0:jc||(me&536870912)!==0?t=!1:(ys=t=!0,(r===2||r===9||r===3||r===6)&&(r=un.current,r!==null&&r.tag===13&&(r.flags|=16384))),ED(e,t)):Xm(e)}function Xm(t){var e=t;do{if((e.flags&32768)!==0){ED(e,ys);return}t=e.return;var n=jV(e.alternate,e,Si);if(n!==null){pe=n;return}if(e=e.sibling,e!==null){pe=e;return}pe=e=t}while(e!==null);ut===0&&(ut=5)}function ED(t,e){do{var n=FV(t.alternate,t);if(n!==null){n.flags&=32767,pe=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!e&&(t=t.sibling,t!==null)){pe=t;return}pe=t=n}while(t!==null);ut=6,pe=null}function kM(t,e,n,r,o,i,s,l,a,c,u,d){t.cancelPendingCommit=null;do Wm();while(st!==0);if((Te&6)!==0)throw Error(k(327));if(e!==null){if(e===t.current)throw Error(k(177));t===Be&&(pe=Be=null,me=0),Kl=e,uo=t,Uo=n,Fw=o,gD=r,QV(t,e,n,s,l,a,d)}}function QV(t,e,n,r,o,i,s){var l=e.lanes|e.childLanes;if(jw=l,l|=y1,EH(t,n,l,r,o,i),Cc=null,(n&335544064)===n?(Ec=AV(t),r=10262):(Ec=null,r=10256),(e.subtreeFlags&r)!==0||(e.flags&r)!==0?(t.callbackNode=null,t.callbackPriority=0,oj(lm,function(){return Kw(),null})):(t.callbackNode=null,t.callbackPriority=0),Cm=!1,r=(e.flags&13878)!==0,(e.subtreeFlags&13878)!==0||r){r=Z.T,Z.T=null,o=Ae.p,Ae.p=2,i=Te,Te|=4;try{$V(t,e,n)}finally{Te=i,Ae.p=o,Z.T=r}}st=1,Cm?xc=xj(s,t.containerInfo,Ec,$w,Yw,ej,qw,Kw,ZV,null,null):($w(),Yw(),qw())}function ZV(t){if(st!==0){var e=uo.onRecoverableError;e(t,{componentStack:null})}}function ej(){st===3&&(st=0,cD(Kl,uo),st=4)}function $w(){if(st===1){st=0;var t=uo,e=Kl,n=Uo,r=(e.flags&13878)!==0;if((e.subtreeFlags&13878)!==0||r){r=Z.T,Z.T=null;var o=Ae.p;Ae.p=2;var i=Te;Te|=4;try{Ud=Em=!1,lD(e,t,n),n=Jw;var s=PR(t.containerInfo),l=n.focusedElem,a=n.selectionRange;if(s!==l&&l&&l.ownerDocument&&BR(l.ownerDocument.documentElement,l)){if(a!==null&&g1(l)){var c=a.start,u=a.end;if(u===void 0&&(u=c),"selectionStart"in l)l.selectionStart=c,l.selectionEnd=Math.min(u,l.value.length);else{var d=l.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var h=f.getSelection(),p=l.textContent.length,m=Math.min(a.start,p),y=a.end===void 0?m:Math.min(a.end,p);!h.extend&&m>y&&(s=y,y=m,m=s);var g=Fk(l,m),v=Fk(l,y);if(g&&v&&(h.rangeCount!==1||h.anchorNode!==g.node||h.anchorOffset!==g.offset||h.focusNode!==v.node||h.focusOffset!==v.offset)){var b=d.createRange();b.setStart(g.node,g.offset),h.removeAllRanges(),m>y?(h.addRange(b),h.extend(v.node,v.offset)):(b.setEnd(v.node,v.offset),h.addRange(b))}}}}for(d=[],h=l;h=h.parentNode;)h.nodeType===1&&d.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof l.focus=="function"&&l.focus(),l=0;l<d.length;l++){var w=d[l];w.element.scrollLeft=w.left,w.element.scrollTop=w.top}}zc=!!Ww,Jw=Ww=null}finally{Te=i,Ae.p=o,Z.T=r}}t.current=e,st=2}}function Yw(){if(st===2){st=0;var t=uo,e=Kl,n=(e.flags&8772)!==0;if((e.subtreeFlags&8772)!==0||n){n=Z.T,Z.T=null;var r=Ae.p;Ae.p=2;var o=Te;Te|=4;try{tD(t,e.alternate,e)}finally{Te=o,Ae.p=r,Z.T=n}}st=3}}function qw(){if(st===4||st===3){st=0;var t=xc;xc=null,mH();var e=uo,n=Kl,r=Uo,o=gD,i=(r&335544064)===r?10262:10256;if((n.subtreeFlags&i)!==0||(n.flags&i)!==0?st=5:(st=0,Kl=uo=null,TD(e,e.pendingLanes)),i=e.pendingLanes,i===0&&(As=null),u1(r),n=n.stateNode,wr&&typeof wr.onCommitFiberRoot=="function")try{wr.onCommitFiberRoot(mf,n,void 0,(n.current.flags&128)===128)}catch{}if(o!==null){n=Z.T,i=Ae.p,Ae.p=2,Z.T=null;try{for(var s=e.onRecoverableError,l=0;l<o.length;l++){var a=o[l];s(a.value,{componentStack:a.stack})}}finally{Z.T=n,Ae.p=i}}if(o=Cc,s=Ec,Ec=null,o!==null&&(Cc=null,s===null&&(s=[]),t!==null))for(a=0;a<o.length;a++)n=(0,o[a])(s),n!==void 0&&t.finished.finally(n);(Uo&3)!==0&&Wm(),Ho(e),i=e.pendingLanes,(r&261930)!==0&&(i&42)!==0?e===Qp?Wd++:(Wd=0,Qp=e):(Wd=0,Qp=null),Cf(0,!1)}}function TD(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,wf(e)))}function Wm(){return xc!==null&&(xc.skipTransition(),xc=null),$w(),Yw(),qw(),Kw()}function Kw(){if(st!==5)return!1;var t=uo,e=jw;jw=0;var n=u1(Uo),r=Z.T,o=Ae.p;try{Ae.p=32>n?32:n,Z.T=null,n=Fw,Fw=null;var i=uo,s=Uo;if(st=0,Kl=uo=null,Uo=0,(Te&6)!==0)throw Error(k(331));var l=Te;if(Te|=4,hD(i.current),uD(i,i.current,s,n),Te=l,Cf(0,!1),wr&&typeof wr.onPostCommitFiberRoot=="function")try{wr.onPostCommitFiberRoot(mf,i)}catch{}return!0}finally{Ae.p=o,Z.T=r,TD(t,e)}}function MM(t,e,n){e=$r(n,e),e=Aw(t.stateNode,e,2),t=Cs(t,e,2),t!==null&&(yf(t,2),Ho(t))}function De(t,e,n){if(t.tag===3)MM(t,t,n);else for(;e!==null;){if(e.tag===3){MM(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(As===null||!As.has(r))){t=$r(n,t),n=HO(2),r=Cs(e,n,2),r!==null&&(VO(n,r,e,t),yf(r,2),Ho(r));break}}e=e.return}}function jb(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new KV;var o=new Set;r.set(e,o)}else o=r.get(e),o===void 0&&(o=new Set,r.set(e,o));o.has(n)||(K1=!0,o.add(n),t=tj.bind(null,t,e,n),e.then(t,t))}function tj(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,Be===t&&(me&n)===n&&((ut===4||ut===3&&(me&62914560)===me&&300>br()-Km)&&(Te&2)===0?Dc(t,0):Tm|=n,Rc===me&&(Rc=0)),Ho(t)}function AD(t,e){e===0&&(e=gR()),t=Jl(t,e),t!==null&&(yf(t,e),Ho(t))}function nj(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),AD(t,n)}function rj(t,e){var n=0;switch(t.tag){case 31:case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;case 22:r=t.stateNode._retryCache;break;default:throw Error(k(314))}r!==null&&r.delete(e),AD(t,n)}function oj(t,e){return a1(t,e)}var Nc=null,nc=null,Gw=!1,Rm=!1,Fb=!1,bs=0;function Ho(t){t!==nc&&t.next===null&&(nc===null?Nc=nc=t:nc=nc.next=t),Rm=!0,Gw||(Gw=!0,sj())}function Cf(t,e){if(!Fb&&Rm){Fb=!0;do for(var n=!1,r=Nc;r!==null;){if(!e)if(t!==0){var o=r.pendingLanes;if(o===0)var i=0;else{var s=r.suspendedLanes,l=r.pingedLanes;i=(1<<31-Sr(42|t)+1)-1,i&=o&~(s&~l),i=i&201326741?i&201326741|1:i?i|2:0}i!==0&&(n=!0,RM(r,i))}else i=me,i=_m(r,r===Be?i:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(i&3)===0||gf(r,i)||(n=!0,RM(r,i));r=r.next}while(n);Fb=!1}}function ij(){kD()}function kD(){Rm=Gw=!1;var t=0;bs!==0&&mj()&&(t=bs);for(var e=br(),n=null,r=Nc;r!==null;){var o=r.next,i=MD(r,e);i===0?(r.next=null,n===null?Nc=o:n.next=o,o===null&&(nc=n)):(n=r,(t!==0||(i&3)!==0)&&(Rm=!0)),r=o}st!==0&&st!==5||Cf(t,!1),bs!==0&&(bs=0)}function MD(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,o=t.expirationTimes,i=t.pendingLanes&-62914561;0<i;){var s=31-Sr(i),l=1<<s,a=o[s];a===-1?((l&n)===0||(l&r)!==0)&&(o[s]=CH(l,e)):a<=e&&(t.expiredLanes|=l),i&=~l}if(e=Be,n=me,n=_m(t,t===e?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r=t.callbackNode,n===0||t===e&&(Re===2||Re===9)||t.cancelPendingCommit!==null)return r!==null&&r!==null&&Sb(r),t.callbackNode=null,t.callbackPriority=0;if((n&3)===0||gf(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(r!==null&&Sb(r),u1(n)){case 2:case 8:n=hR;break;case 32:n=lm;break;case 268435456:n=pR;break;default:n=lm}return r=RD.bind(null,t),n=a1(n,r),t.callbackPriority=e,t.callbackNode=n,e}return r!==null&&r!==null&&Sb(r),t.callbackPriority=2,t.callbackNode=null,2}function RD(t,e){if(st!==0&&st!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(Wm()&&t.callbackNode!==n)return null;var r=me;return r=_m(t,t===Be?r:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),r===0?null:(vD(t,r,e),MD(t,br()),t.callbackNode!=null&&t.callbackNode===n?RD.bind(null,t):null)}function RM(t,e){if(Wm())return null;vD(t,e,!0)}function sj(){yj(function(){(Te&6)!==0?a1(fR,ij):kD()})}function X1(){if(bs===0){var t=Fl;t===0&&(t=bp,bp<<=1,(bp&261888)===0&&(bp=256)),bs=t}return bs}function OM(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:Hp(t)}function lj(t,e,n,r,o){if(e==="submit"&&n&&n.stateNode===o){var i=OM((o[Jn]||null).action),s=r.submitter;s&&(e=(e=s[Jn]||null)?OM(e.formAction):s.getAttribute("formAction"),e!==null&&(i=e,s=null));var l=new Lm("action","action",null,r,o);t.push({event:l,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(bs!==0){var a=new FormData(o,s);Ew(n,{pending:!0,data:a,method:o.method,action:i},null,a)}}else typeof i=="function"&&(l.preventDefault(),a=new FormData(o,s),Ew(n,{pending:!0,data:a,method:o.method,action:i},i,a))},currentTarget:o}]})}}for(Ip=0;Ip<hw.length;Ip++)Lp=hw[Ip],DM=Lp.toLowerCase(),NM=Lp[0].toUpperCase()+Lp.slice(1),fo(DM,"on"+NM);var Lp,DM,NM,Ip;fo(VR,"onAnimationEnd");fo(jR,"onAnimationIteration");fo(FR,"onAnimationStart");fo("dblclick","onDoubleClick");fo("focusin","onFocus");fo("focusout","onBlur");fo(vV,"onTransitionRun");fo(bV,"onTransitionStart");fo(wV,"onTransitionCancel");fo($R,"onTransitionEnd");Ac("onMouseEnter",["mouseout","mouseover"]);Ac("onMouseLeave",["mouseout","mouseover"]);Ac("onPointerEnter",["pointerout","pointerover"]);Ac("onPointerLeave",["pointerout","pointerover"]);Xl("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Xl("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Xl("onBeforeInput",["compositionend","keypress","textInput","paste"]);Xl("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Xl("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Xl("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var lf="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),aj=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(lf));function OD(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],o=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var s=r.length-1;0<=s;s--){var l=r[s],a=l.instance,c=l.currentTarget;if(l=l.listener,a!==i&&o.isPropagationStopped())break e;i=l,o.currentTarget=c;try{i(o)}catch(u){cm(u)}o.currentTarget=null,i=a}else for(s=0;s<r.length;s++){if(l=r[s],a=l.instance,c=l.currentTarget,l=l.listener,a!==i&&o.isPropagationStopped())break e;i=l,o.currentTarget=c;try{i(o)}catch(u){cm(u)}o.currentTarget=null,i=a}}}}function he(t,e){var n=e[Ak];n===void 0&&(n=e[Ak]=new Set);var r=t+"__bubble";n.has(r)||(DD(e,t,2,!1),n.add(r))}function $b(t,e,n){var r=0;e&&(r|=4),DD(n,t,r,e)}var zp="_reactListening"+Math.random().toString(36).slice(2);function W1(t){if(!t[zp]){t[zp]=!0,xR.forEach(function(n){n!=="selectionchange"&&(aj.has(n)||$b(n,!1,t),$b(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[zp]||(e[zp]=!0,$b("selectionchange",!1,e))}}function DD(t,e,n,r){switch(tN(e)){case 2:var o=e6;break;case 8:o=t6;break;default:o=rS}n=o.bind(null,e,n,t),o=void 0,!cw||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),r?o!==void 0?t.addEventListener(e,n,{capture:!0,passive:o}):t.addEventListener(e,n,!0):o!==void 0?t.addEventListener(e,n,{passive:o}):t.addEventListener(e,n,!1)}function Yb(t,e,n,r,o){var i=r;if((e&1)===0&&(e&2)===0&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===o)break;if(s===4)for(s=r.return;s!==null;){var a=s.tag;if((a===3||a===4)&&s.stateNode.containerInfo===o)return;s=s.return}for(;l!==null;){if(s=_l(l),s===null)return;if(a=s.tag,a===5||a===6||a===26||a===27){r=i=s;continue e}l=l.parentNode}}r=r.return}OR(function(){var c=i,u=f1(n),d=[];e:{var f=YR.get(t);if(f!==void 0){var h=Lm,p=t;switch(t){case"keypress":if(jp(n)===0)break e;case"keydown":case"keyup":h=GH;break;case"focusin":p="focus",h=kb;break;case"focusout":p="blur",h=kb;break;case"beforeblur":case"afterblur":h=kb;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=Ik;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=zH;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=ZH;break;case VR:case jR:case FR:h=PH;break;case $R:h=tV;break;case"scroll":case"scrollend":h=IH;break;case"wheel":h=rV;break;case"copy":case"cut":case"paste":h=VH;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=zk;break;case"submit":h=JH;break;case"toggle":case"beforetoggle":h=iV}var m=(e&4)!==0,y=!m&&(t==="scroll"||t==="scrollend"),g=m?f!==null?f+"Capture":null:f;m=[];for(var v=c,b;v!==null;){var w=v;if(b=w.stateNode,w=w.tag,w!==5&&w!==26&&w!==27||b===null||g===null||(w=Qd(v,g),w!=null&&m.push(af(v,w,b))),y)break;v=v.return}0<m.length&&(f=new h(f,p,null,n,u),d.push({event:f,listeners:m}))}}if((e&7)===0){e:{if(h=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",h&&n!==aw&&(p=n.relatedTarget||n.fromElement)&&(_l(p)||p[Bc]))break e;(f||h)&&(p=u.window===u?u:(h=u.ownerDocument)?h.defaultView||h.parentWindow:window,f?(h=n.relatedTarget||n.toElement,f=c,h=h?_l(h):null,h!==null&&(y=pf(h),m=h.tag,h!==y||m!==5&&m!==27&&m!==6)&&(h=null)):(f=null,h=c),f!==h&&(m=Ik,w="onMouseLeave",g="onMouseEnter",v="mouse",(t==="pointerout"||t==="pointerover")&&(m=zk,w="onPointerLeave",g="onPointerEnter",v="pointer"),y=f==null?p:Ld(f),b=h==null?p:Ld(h),p=new m(w,v+"leave",f,n,u),p.target=y,p.relatedTarget=b,w=null,_l(u)===c&&(m=new m(g,v+"enter",h,n,u),m.target=b,m.relatedTarget=y,w=m),y=w,m=f&&h?Wb(f,h,cj):null,f!==null&&_M(d,p,f,m,!1),h!==null&&y!==null&&_M(d,y,h,m,!0)))}e:{if(f=c?Ld(c):window,h=f.nodeName&&f.nodeName.toLowerCase(),h==="select"||h==="input"&&f.type==="file")var S=Hk;else if(Pk(f))if(zR)S=mV;else{S=hV;var C=fV}else h=f.nodeName,!h||h.toLowerCase()!=="input"||f.type!=="checkbox"&&f.type!=="radio"?c&&d1(c.elementType)&&(S=Hk):S=pV;if(S&&(S=S(t,c))){LR(d,S,n,u);break e}C&&C(t,f,c)}switch(C=c?Ld(c):window,t){case"focusin":(Pk(C)||C.contentEditable==="true")&&(ac=C,dw=c,Hd=null);break;case"focusout":Hd=dw=ac=null;break;case"mousedown":fw=!0;break;case"contextmenu":case"mouseup":case"dragend":fw=!1,$k(d,n,u);break;case"selectionchange":if(yV)break;case"keydown":case"keyup":$k(d,n,u)}var x;if(m1)e:{switch(t){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else lc?_R(t,n)&&(E="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(NR&&n.locale!=="ko"&&(lc||E!=="onCompositionStart"?E==="onCompositionEnd"&&lc&&(x=DR()):(ms=u,h1="value"in ms?ms.value:ms.textContent,lc=!0)),C=Om(c,E),0<C.length&&(E=new Lk(E,t,null,n,u),d.push({event:E,listeners:C}),x?E.data=x:(x=IR(n),x!==null&&(E.data=x)))),(x=lV?aV(t,n):cV(t,n))&&(E=Om(c,"onBeforeInput"),0<E.length&&(C=new Lk("onBeforeInput","beforeinput",null,n,u),d.push({event:C,listeners:E}),C.data=x)),lj(d,t,c,n,u)}OD(d,e)})}function af(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Om(t,e){for(var n=e+"Capture",r=[];t!==null;){var o=t,i=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||i===null||(o=Qd(t,n),o!=null&&r.unshift(af(t,o,i)),o=Qd(t,e),o!=null&&r.push(af(t,o,i))),t.tag===3)return r;t=t.return}return[]}function cj(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function _M(t,e,n,r,o){for(var i=e._reactName,s=[];n!==null&&n!==r;){var l=n,a=l.alternate,c=l.stateNode;if(l=l.tag,a!==null&&a===r)break;l!==5&&l!==26&&l!==27||c===null||(a=c,o?(c=Qd(n,i),c!=null&&s.unshift(af(n,c,a))):o||(c=Qd(n,i),c!=null&&s.push(af(n,c,a)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}var uj=/\r\n?/g,dj=/\u0000|\uFFFD/g;function IM(t){return(typeof t=="string"?t:""+t).replace(uj,`
|
|
9
|
+
`).replace(dj,"")}function ND(t,e){return e=IM(e),IM(t)===e}function Oe(t,e,n,r,o,i){switch(n){case"children":if(typeof r=="string")e==="body"||e==="textarea"&&r===""||kc(t,r);else if(typeof r=="number"||typeof r=="bigint")e!=="body"&&kc(t,""+r);else return;break;case"className":xp(t,"class",r);break;case"tabIndex":xp(t,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":xp(t,n,r);break;case"style":RR(t,r,i);return;case"data":if(e!=="object"){xp(t,"data",r);break}case"src":case"href":if(r===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(n);break}r=Hp(r),t.setAttribute(n,r);break;case"action":case"formAction":if(typeof r=="function"){t.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof i=="function"&&(n==="formAction"?(e!=="input"&&Oe(t,e,"name",o.name,o,null),Oe(t,e,"formEncType",o.formEncType,o,null),Oe(t,e,"formMethod",o.formMethod,o,null),Oe(t,e,"formTarget",o.formTarget,o,null)):(Oe(t,e,"encType",o.encType,o,null),Oe(t,e,"method",o.method,o,null),Oe(t,e,"target",o.target,o,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){t.removeAttribute(n);break}r=Hp(r),t.setAttribute(n,r);break;case"onClick":r!=null&&(t.onclick=_o);return;case"onScroll":r!=null&&he("scroll",t);return;case"onScrollEnd":r!=null&&he("scrollend",t);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(k(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(k(60));i?.__html!==n&&(t.innerHTML=n)}}break;case"multiple":t.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":t.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){t.removeAttribute("xlink:href");break}n=Hp(r),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,r):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"credentialless":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":r===!0?t.setAttribute(n,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?t.setAttribute(n,r):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?t.setAttribute(n,r):t.removeAttribute(n);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?t.removeAttribute(n):t.setAttribute(n,r);break;case"popover":he("beforetoggle",t),he("toggle",t),Pp(t,"popover",r);break;case"xlinkActuate":ui(t,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":ui(t,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":ui(t,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":ui(t,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":ui(t,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":ui(t,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":ui(t,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":ui(t,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":ui(t,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":Pp(t,"is",r);break;case"innerText":case"textContent":return;default:if(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")n=NH.get(n)||n,Pp(t,n,r);else return}Se=!0}function Xw(t,e,n,r,o,i){switch(n){case"style":RR(t,r,i);return;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(k(61));if(n=r.__html,n!=null){if(o.children!=null)throw Error(k(60));i?.__html!==n&&(t.innerHTML=n)}}break;case"children":if(typeof r=="string")kc(t,r);else if(typeof r=="number"||typeof r=="bigint")kc(t,""+r);else return;break;case"onScroll":r!=null&&he("scroll",t);return;case"onScrollEnd":r!=null&&he("scrollend",t);return;case"onClick":r!=null&&(t.onclick=_o);return;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":return;case"innerText":case"textContent":return;default:if(!CR.hasOwnProperty(n))e:{if(n[0]==="o"&&n[1]==="n"&&(o=n.endsWith("Capture"),i=n.slice(2,o?n.length-7:void 0),e=t[Jn]||null,e=e!=null?e[n]:null,typeof e=="function"&&t.removeEventListener(i,e,o),typeof r=="function")){typeof e!="function"&&e!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(i,r,o);break e}Se=!0,n in t?t[n]=r:r===!0?t.setAttribute(n,""):Pp(t,n,r)}return}Se=!0}function cn(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":he("error",t),he("load",t);var r=!1,o=!1,i;for(i in n)if(n.hasOwnProperty(i)){var s=n[i];if(s!=null)switch(i){case"src":r=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(k(137,e));default:Oe(t,e,i,s,n,null)}}o&&Oe(t,e,"srcSet",n.srcSet,n,null),r&&Oe(t,e,"src",n.src,n,null);return;case"input":he("invalid",t);var l=i=s=o=null,a=null,c=null;for(r in n)if(n.hasOwnProperty(r)){var u=n[r];if(u!=null)switch(r){case"name":o=u;break;case"type":s=u;break;case"checked":a=u;break;case"defaultChecked":c=u;break;case"value":i=u;break;case"defaultValue":l=u;break;case"children":case"dangerouslySetInnerHTML":if(u!=null)throw Error(k(137,e));break;default:Oe(t,e,r,u,n,null)}}AR(t,i,l,a,c,s,o,!1);return;case"select":he("invalid",t),r=s=i=null;for(o in n)if(n.hasOwnProperty(o)&&(l=n[o],l!=null))switch(o){case"value":i=l;break;case"defaultValue":s=l;break;case"multiple":r=l;default:Oe(t,e,o,l,n,null)}e=i,n=s,t.multiple=!!r,e!=null?gc(t,!!r,e,!1):n!=null&&gc(t,!!r,n,!0);return;case"textarea":he("invalid",t),i=o=r=null;for(s in n)if(n.hasOwnProperty(s)&&(l=n[s],l!=null))switch(s){case"value":r=l;break;case"defaultValue":o=l;break;case"children":i=l;break;case"dangerouslySetInnerHTML":if(l!=null)throw Error(k(91));break;default:Oe(t,e,s,l,n,null)}MR(t,r,o,i);return;case"option":for(a in n)n.hasOwnProperty(a)&&(r=n[a],r!=null)&&(a==="selected"?t.selected=r&&typeof r!="function"&&typeof r!="symbol":Oe(t,e,a,r,n,null));return;case"dialog":he("beforetoggle",t),he("toggle",t),he("cancel",t),he("close",t);break;case"iframe":case"object":he("load",t);break;case"video":case"audio":for(r=0;r<lf.length;r++)he(lf[r],t);break;case"image":he("error",t),he("load",t);break;case"details":he("toggle",t);break;case"embed":case"source":case"link":he("error",t),he("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(c in n)if(n.hasOwnProperty(c)&&(r=n[c],r!=null))switch(c){case"children":case"dangerouslySetInnerHTML":throw Error(k(137,e));default:Oe(t,e,c,r,n,null)}return;default:if(d1(e)){for(u in n)n.hasOwnProperty(u)&&(r=n[u],r!==void 0&&Xw(t,e,u,r,n,void 0));return}}for(l in n)n.hasOwnProperty(l)&&(r=n[l],r!=null&&Oe(t,e,l,r,n,null))}var fj={};function hj(t,e,n,r){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,i=null,s=null,l=null,a=null,c=null,u=null;for(h in n){var d=n[h];if(n.hasOwnProperty(h)&&d!=null)switch(h){case"checked":break;case"value":break;case"defaultValue":a=d;default:r.hasOwnProperty(h)||Oe(t,e,h,null,r,d)}}for(var f in r){var h=r[f];if(d=n[f],r.hasOwnProperty(f)&&(h!=null||d!=null))switch(f){case"type":h!==d&&(Se=!0),i=h;break;case"name":h!==d&&(Se=!0),o=h;break;case"checked":h!==d&&(Se=!0),c=h;break;case"defaultChecked":h!==d&&(Se=!0),u=h;break;case"value":h!==d&&(Se=!0),s=h;break;case"defaultValue":h!==d&&(Se=!0),l=h;break;case"children":case"dangerouslySetInnerHTML":if(h!=null)throw Error(k(137,e));break;default:h!==d&&Oe(t,e,f,h,r,d)}}lw(t,s,l,a,c,u,i,o);return;case"select":h=s=l=f=null;for(i in n)if(a=n[i],n.hasOwnProperty(i)&&a!=null)switch(i){case"value":break;case"multiple":h=a;default:r.hasOwnProperty(i)||Oe(t,e,i,null,r,a)}for(o in r)if(i=r[o],a=n[o],r.hasOwnProperty(o)&&(i!=null||a!=null))switch(o){case"value":i!==a&&(Se=!0),f=i;break;case"defaultValue":i!==a&&(Se=!0),l=i;break;case"multiple":i!==a&&(Se=!0),s=i;default:i!==a&&Oe(t,e,o,i,r,a)}e=l,n=s,r=h,f!=null?gc(t,!!n,f,!1):!!r!=!!n&&(e!=null?gc(t,!!n,e,!0):gc(t,!!n,n?[]:"",!1));return;case"textarea":h=f=null;for(l in n)if(o=n[l],n.hasOwnProperty(l)&&o!=null&&!r.hasOwnProperty(l))switch(l){case"value":break;case"children":break;default:Oe(t,e,l,null,r,o)}for(s in r)if(o=r[s],i=n[s],r.hasOwnProperty(s)&&(o!=null||i!=null))switch(s){case"value":o!==i&&(Se=!0),f=o;break;case"defaultValue":o!==i&&(Se=!0),h=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(k(91));break;default:o!==i&&Oe(t,e,s,o,r,i)}kR(t,f,h);return;case"option":for(var p in n)f=n[p],n.hasOwnProperty(p)&&f!=null&&!r.hasOwnProperty(p)&&(p==="selected"?t.selected=!1:Oe(t,e,p,null,r,f));for(a in r)f=r[a],h=n[a],r.hasOwnProperty(a)&&f!==h&&(f!=null||h!=null)&&(a==="selected"?(f!==h&&(Se=!0),t.selected=f&&typeof f!="function"&&typeof f!="symbol"):Oe(t,e,a,f,r,h));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var m in n)f=n[m],n.hasOwnProperty(m)&&f!=null&&!r.hasOwnProperty(m)&&Oe(t,e,m,null,r,f);for(c in r)if(f=r[c],h=n[c],r.hasOwnProperty(c)&&f!==h&&(f!=null||h!=null))switch(c){case"children":case"dangerouslySetInnerHTML":if(f!=null)throw Error(k(137,e));break;default:Oe(t,e,c,f,r,h)}return;default:if(d1(e)){for(var y in n)f=n[y],n.hasOwnProperty(y)&&f!==void 0&&!r.hasOwnProperty(y)&&Xw(t,e,y,void 0,r,f);for(u in r)f=r[u],h=n[u],!r.hasOwnProperty(u)||f===h||f===void 0&&h===void 0||Xw(t,e,u,f,r,h);return}}for(var g in n)f=n[g],n.hasOwnProperty(g)&&f!=null&&!r.hasOwnProperty(g)&&Oe(t,e,g,null,r,f);for(d in r)f=r[d],h=n[d],!r.hasOwnProperty(d)||f===h||f==null&&h==null||Oe(t,e,d,f,r,h)}function LM(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function pj(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),r=0;r<n.length;r++){var o=n[r],i=o.transferSize,s=o.initiatorType,l=o.duration;if(i&&l&&LM(s)){for(s=0,l=o.responseEnd,r+=1;r<n.length;r++){var a=n[r],c=a.startTime;if(c>l)break;var u=a.transferSize,d=a.initiatorType;u&&LM(d)&&(a=a.responseEnd,s+=u*(a<l?1:(l-c)/(a-c)))}if(--r,e+=8*(i+s)/(o.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Ww=null,Jw=null;function cf(t){return t.nodeType===9?t:t.ownerDocument}function zM(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function _D(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function ID(t,e,n,r){return n=cf(n).createElement(t),n[on]=r,n[Jn]=e,cn(n,t,e),qt(n),n}function Qw(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var qb=null;function mj(){var t=window.event;return t&&t.type==="popstate"?t===qb?!1:(qb=t,!0):(qb=null,!1)}var J1=typeof setTimeout=="function"?setTimeout:void 0,gj=typeof clearTimeout=="function"?clearTimeout:void 0,UM=typeof Promise=="function"?Promise:void 0,BM=typeof requestAnimationFrame=="function"?requestAnimationFrame:J1,yj=typeof queueMicrotask=="function"?queueMicrotask:typeof UM<"u"?function(t){return UM.resolve(null).then(t).catch(vj)}:J1;function vj(t){setTimeout(function(){throw t})}function zs(t){return t==="head"}function PM(t,e){var n=e,r=0;do{var o=n.nextSibling;if(t.removeChild(n),o&&o.nodeType===8)if(n=o.data,n==="/$"||n==="/&"){if(r===0){t.removeChild(o),Uc(e);return}r--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")r++;else if(n==="html")Gb(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,Gb(n);for(var i=n.firstChild;i;){var s=i.nextSibling,l=i.nodeName;i[vf]||l==="SCRIPT"||l==="STYLE"||l==="LINK"&&i.rel.toLowerCase()==="stylesheet"||n.removeChild(i),i=s}}else n==="body"&&Gb(t.ownerDocument.body);n=o}while(n);Uc(e)}function HM(t,e){var n=t;t=0;do{var r=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),r&&r.nodeType===8)if(n=r.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=r}while(n)}function LD(t,e,n){if(e=CSS.escape(e)!==e?"r-"+btoa(e).replace(/=/g,""):e,t.style.viewTransitionName=e,n!=null&&(t.style.viewTransitionClass=n),n=getComputedStyle(t),n.display==="inline"){if(e=t.getClientRects(),e.length===1)var r=1;else for(var o=r=0;o<e.length;o++){var i=e[o];0<i.width&&0<i.height&&r++}r===1&&(t=t.style,t.display=e.length===1?"inline-block":"block",t.marginTop="-"+n.paddingTop,t.marginBottom="-"+n.paddingBottom)}}function zD(t,e){t=t.style,e=e.style;var n=e!=null?e.hasOwnProperty("viewTransitionName")?e.viewTransitionName:e.hasOwnProperty("view-transition-name")?e["view-transition-name"]:null:null;t.viewTransitionName=n==null||typeof n=="boolean"?"":(""+n).trim(),n=e!=null?e.hasOwnProperty("viewTransitionClass")?e.viewTransitionClass:e.hasOwnProperty("view-transition-class")?e["view-transition-class"]:null:null,t.viewTransitionClass=n==null||typeof n=="boolean"?"":(""+n).trim(),t.display==="inline-block"&&(e==null?t.display=t.margin="":(n=e.display,t.display=n==null||typeof n=="boolean"?"":n,n=e.margin,n!=null?t.margin=n:(n=e.hasOwnProperty("marginTop")?e.marginTop:e["margin-top"],t.marginTop=n==null||typeof n=="boolean"?"":n,e=e.hasOwnProperty("marginBottom")?e.marginBottom:e["margin-bottom"],t.marginBottom=e==null||typeof e=="boolean"?"":e)))}function UD(t,e,n){return n=n.ownerDocument.defaultView,{rect:t,abs:e.position==="absolute"||e.position==="fixed",clip:e.clipPath!=="none"||e.overflow!=="visible"||e.filter!=="none"||e.mask!=="none"||e.mask!=="none"||e.borderRadius!=="0px",view:0<=t.bottom&&0<=t.right&&t.top<=n.innerHeight&&t.left<=n.innerWidth}}function Zw(t){var e=t.getBoundingClientRect(),n=getComputedStyle(t);return UD(e,n,t)}function bj(t){var e=t.getBoundingClientRect();e=new DOMRect(e.x+2e4,e.y+2e4,e.width,e.height);var n=getComputedStyle(t);return UD(e,n,t)}function wj(t){return t.documentElement.clientHeight}function Sj(t){this.addEventListener("load",t),this.addEventListener("error",t)}function xj(t,e,n,r,o,i,s,l,a){var c=e.nodeType===9?e:e.ownerDocument;try{var u=c.startViewTransition({update:function(){var f=c.defaultView,h=f.navigation&&f.navigation.transition,p=c.fonts.status;r();var m=[];if(p==="loaded"&&(wj(c),c.fonts.status==="loading"&&m.push(c.fonts.ready)),p=m.length,t!==null)for(var y=t.suspenseyImages,g=0,v=0;v<y.length;v++){var b=y[v];if(!b.complete){var w=b.getBoundingClientRect();if(0<w.bottom&&0<w.right&&w.top<f.innerHeight&&w.left<f.innerWidth){if(g+=XD(b),g>tm){m.length=p;break}b=new Promise(Sj.bind(b)),m.push(b)}}}if(0<m.length)return f=Promise.race([Promise.all(m),new Promise(function(S){return setTimeout(S,500)})]).then(o,o),(h?Promise.allSettled([h.finished,f]):f).then(i,i);if(o(),h)return h.finished.then(i,i);i()},types:n});c.__reactViewTransition=u;var d=[];return u.ready.then(function(){for(var f=c.documentElement.getAnimations({subtree:!0}),h=0;h<f.length;h++){var p=f[h],m=p.effect,y=m.pseudoElement;if(y!=null&&y.startsWith("::view-transition")){d.push(p),p=m.getKeyframes();for(var g=y=void 0,v=!0,b=0;b<p.length;b++){var w=p[b],S=w.width;if(y===void 0)y=S;else if(y!==S){v=!1;break}if(S=w.height,g===void 0)g=S;else if(g!==S){v=!1;break}delete w.width,delete w.height,w.transform==="none"&&delete w.transform}v&&y!==void 0&&g!==void 0&&(m.setKeyframes(p),v=getComputedStyle(m.target,m.pseudoElement),v.width!==y||v.height!==g)&&(v=p[0],v.width=y,v.height=g,v=p[p.length-1],v.width=y,v.height=g,m.setKeyframes(p))}}s()},function(f){c.__reactViewTransition===u&&(c.__reactViewTransition=null);try{typeof f=="object"&&f!==null&&f.name==="InvalidStateError"&&(f.message==="View transition was skipped because document visibility state is hidden."||f.message==="Skipping view transition because document visibility state has become hidden."||f.message==="Skipping view transition because viewport size changed."||f.message==="Transition was aborted because of invalid state")&&(f=null),f!==null&&a(f)}finally{r(),o(),s()}}),u.finished.finally(function(){for(var f=0;f<d.length;f++)d[f].cancel();c.__reactViewTransition===u&&(c.__reactViewTransition=null),l()}),u}catch{return r(),o(),s(),null}}function Il(t,e){this._scope=document.documentElement,this._selector="::view-transition-"+t+"("+e+")"}Il.prototype.animate=function(t,e){return e=typeof e=="number"?{duration:e}:Pe({},e),e.pseudoElement=this._selector,this._scope.animate(t,e)};Il.prototype.getAnimations=function(){for(var t=this._scope,e=this._selector,n=t.getAnimations({subtree:!0}),r=[],o=0;o<n.length;o++){var i=n[o].effect;i!==null&&i.target===t&&i.pseudoElement===e&&r.push(n[o])}return r};Il.prototype.getComputedStyle=function(){return getComputedStyle(this._scope,this._selector)};function BD(t){return{name:t,group:new Il("group",t),imagePair:new Il("image-pair",t),old:new Il("old",t),new:new Il("new",t)}}function Er(t){this._fragmentFiber=t,this._observers=this._eventListeners=null}Er.prototype.addEventListener=function(t,e,n){var r=null,o=null;if(!(n!=null&&typeof n!="boolean"&&(r=n.signal||null,r!==null&&r.aborted))){this._eventListeners===null&&(this._eventListeners=[]);var i=this._eventListeners;if(PD(i,t,e,n)===-1){var s=this,l=e;n!=null&&typeof n!="boolean"&&n.once===!0&&(l=function(a){s.removeEventListener(t,e,n),typeof e=="function"?e.call(this,a):e.handleEvent(a)}),r!==null&&(o=s.removeEventListener.bind(s,t,e,n),r.addEventListener("abort",o,{once:!0}),o=r.removeEventListener.bind(r,"abort",o)),r=_c(n),i.push({type:t,listener:e,optionsOrUseCapture:n,attachedListener:l,cleanup:o}),Wn(this._fragmentFiber.child,!1,Cj,t,l,r)}this._eventListeners=i}};function Cj(t,e,n,r){return _t(t).addEventListener(e,n,r),!1}Er.prototype.removeEventListener=function(t,e,n){var r=this._eventListeners;if(r!==null&&(e=PD(r,t,e,n),e!==-1)){var o=r[e];n=o.attachedListener;var i=o.cleanup;o=_c(o.optionsOrUseCapture),Wn(this._fragmentFiber.child,!1,Ej,t,n,o),r.splice(e,1),i!==null&&i()}};function Ej(t,e,n,r){return _t(t).removeEventListener(e,n,r),!1}function _c(t){return t!=null&&typeof t!="boolean"&&(t.once===!0||t.signal instanceof AbortSignal)?{capture:t.capture,passive:t.passive}:t}function VM(t){return t==null?"c=0":typeof t=="boolean"?"c="+(t?"1":"0"):"c="+(t.capture?"1":"0")}function PD(t,e,n,r){if(t.length===0)return-1;r=VM(r);for(var o=0;o<t.length;o++){var i=t[o];if(i.type===e&&i.listener===n&&VM(i.optionsOrUseCapture)===r)return o}return-1}Er.prototype.dispatchEvent=function(t){var e=Gl(this._fragmentFiber);if(e===null)return!0;e=_t(e);var n=this._eventListeners;if(n!==null&&0<n.length||!t.bubbles){var r=e.nodeType===9?e.createComment(""):document.createTextNode("");if(n)for(var o=0;o<n.length;o++){var i=n[o];r.addEventListener(i.type,i.attachedListener,_c(i.optionsOrUseCapture))}if(e.appendChild(r),t=r.dispatchEvent(t),n)for(o=0;o<n.length;o++)i=n[o],r.removeEventListener(i.type,i.attachedListener,_c(i.optionsOrUseCapture));return e.removeChild(r),t}return e.dispatchEvent(t)};Er.prototype.focus=function(t){Wn(this._fragmentFiber.child,!0,HD,t,void 0,void 0)};function HD(t,e){return t.tag===6?!1:(t=_t(t),zj(t,e))}Er.prototype.focusLast=function(t){var e=[];Wn(this._fragmentFiber.child,!0,Q1,e,void 0,void 0);for(var n=e.length-1;0<=n&&!HD(e[n],t);n--);};function Q1(t,e){return e.push(t),!1}Er.prototype.blur=function(){var t=Gl(this._fragmentFiber);t!==null&&(t=_t(t),t=cf(t).activeElement,t!==null&&Wn(this._fragmentFiber.child,!1,Tj,t,void 0,void 0))};function Tj(t,e){return t.tag===6?!1:(t=_t(t),t===e||t.contains(e)?(e.blur(),!0):!1)}Er.prototype.observeUsing=function(t){this._observers===null&&(this._observers=new Set),this._observers.add(t),Wn(this._fragmentFiber.child,!1,Aj,t,void 0,void 0)};function Aj(t,e){return t.tag===6||(t=_t(t),e.observe(t)),!1}Er.prototype.unobserveUsing=function(t){var e=this._observers;if(e!==null&&e.has(t)){e.delete(t),Wn(this._fragmentFiber.child,!1,kj,t,void 0,void 0);for(var n=e=0;n<co.length;n++){var r=co[n];r.fragmentInstance===this&&r.observer===t?t.unobserve(r.instance):co[e++]=r}co.length=e}};function kj(t,e){return t.tag===6||(t=_t(t),e.unobserve(t)),!1}var co=[],Kb=!1;function Mj(t,e,n){co.push({fragmentInstance:t,observer:e,instance:n}),Kb||(Kb=!0,Uj(function(){Kb=!1;var r=co;co=[];for(var o=0;o<r.length;o++){var i=r[o];i.observer.unobserve(i.instance)}}))}Er.prototype.getClientRects=function(){var t=[];return Wn(this._fragmentFiber.child,!1,Rj,t,void 0,void 0),t};function Rj(t,e){if(t.tag===6){t=t.stateNode;var n=t.ownerDocument.createRange();n.selectNodeContents(t),e.push.apply(e,n.getClientRects())}else t=_t(t),e.push.apply(e,t.getClientRects());return!1}Er.prototype.getRootNode=function(t){var e=Gl(this._fragmentFiber);return e===null?this:_t(e).getRootNode(t)};Er.prototype.compareDocumentPosition=function(t){var e=Gl(this._fragmentFiber);if(e===null)return Node.DOCUMENT_POSITION_DISCONNECTED;var n=[];Wn(this._fragmentFiber.child,!1,Q1,n,void 0,void 0);var r=_t(e);if(n.length===0){if(n=r,wk(this._fragmentFiber)){e:{for(e=this._fragmentFiber.return;e!==null;){if(e.tag===4){e=e.stateNode.containerInfo;break e}if(e.tag===3||e.tag===5||e.tag===27)break;e=e.return}e=null}e!=null&&(n=e)}e=this._fragmentFiber;var o=r=n.compareDocumentPosition(t);return n===t?o=Node.DOCUMENT_POSITION_CONTAINS:r&Node.DOCUMENT_POSITION_CONTAINED_BY&&(n=aR(e)[1],n===null?o=Node.DOCUMENT_POSITION_PRECEDING:(t=_t(n).compareDocumentPosition(t),o=t===0||t&Node.DOCUMENT_POSITION_FOLLOWING?Node.DOCUMENT_POSITION_FOLLOWING:Node.DOCUMENT_POSITION_PRECEDING)),o|=Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC}e=_t(n[0]),o=_t(n[n.length-1]);var i=wk(this._fragmentFiber)?e.parentElement:r;if(i==null)return Node.DOCUMENT_POSITION_DISCONNECTED;r=i.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_CONTAINED_BY,i=i.compareDocumentPosition(o)&Node.DOCUMENT_POSITION_CONTAINED_BY;var s=e.compareDocumentPosition(t),l=o.compareDocumentPosition(t),a=s&Node.DOCUMENT_POSITION_CONTAINED_BY||l&Node.DOCUMENT_POSITION_CONTAINED_BY;return l=r&&i&&s&Node.DOCUMENT_POSITION_FOLLOWING&&l&Node.DOCUMENT_POSITION_PRECEDING,e=r&&e===t||i&&o===t||a||l?Node.DOCUMENT_POSITION_CONTAINED_BY:!r&&e===t||!i&&o===t?Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:s,e&Node.DOCUMENT_POSITION_DISCONNECTED||e&Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC||Oj(e,this._fragmentFiber,n[0],n[n.length-1],t)?e:Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC};function Oj(t,e,n,r,o){var i=_l(o);if(t&Node.DOCUMENT_POSITION_CONTAINED_BY){if(n=!!i)e:{for(;i!==null;){if(i.tag===7&&(i===e||i.alternate===e)){n=!0;break e}i=i.return}n=!1}return n}if(t&Node.DOCUMENT_POSITION_CONTAINS){if(i===null)return i=o.ownerDocument,o===i||o===i.documentElement||o===i.body;e:{for(i=e,e=Gl(e);i!==null;){if(!(i.tag!==5&&i.tag!==3&&i.tag!==27||i!==e&&i.alternate!==e)){i=!0;break e}i=i.return}i=!1}return i}return t&Node.DOCUMENT_POSITION_PRECEDING?((e=!!i)&&!(e=i===n)&&(e=Wb(n,i,Sk),e===null?e=!1:(Wn(e,!0,sH,i,n),i=rc,rc=null,e=i!==null)),e):t&Node.DOCUMENT_POSITION_FOLLOWING?((e=!!i)&&!(e=i===r)&&(e=Wb(r,i,Sk),e===null?e=!1:(Wn(e,!0,lH,i,r),i=rc,Xb=rc=null,e=i!==null)),e):!1}function jM(t,e){var n=t.ownerDocument.createRange();n.selectNodeContents(t),t=n.getBoundingClientRect(),window.scrollTo(window.scrollX+t.left,e?window.scrollY+t.top:window.scrollY+t.bottom-window.innerHeight)}Er.prototype.scrollIntoView=function(t){if(typeof t=="object")throw Error(k(566));var e=[];Wn(this._fragmentFiber.child,!1,Q1,e,void 0,void 0);var n=t!==!1;if(e.length===0){var r=aR(this._fragmentFiber);if(r=n?r[1]||r[0]||Gl(this._fragmentFiber):r[0]||r[1],r===null)return;if(r.tag===6){t=_t(r),jM(t,n);return}if(r=_t(r),r.nodeType!==9){if(r.nodeType===11){n="host"in r?r.host:null,n!==null&&n.scrollIntoView(t);return}r.scrollIntoView(t)}}for(r=n?e.length-1:0;r!==(n?-1:e.length);){var o=e[r];o.tag===6?(o=_t(o),jM(o,n)):_t(o).scrollIntoView(t),r+=n?-1:1}};function Dj(t,e){return t=_t(t),VD(t,e),!1}function VD(t,e){t.reactFragments==null&&(t.reactFragments=new Set),t.reactFragments.add(e)}function jD(t,e){var n=e._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];t.addEventListener(o.type,o.attachedListener,_c(o.optionsOrUseCapture))}t.nodeType!==3&&(n=e._observers,n!==null&&n.forEach(function(i){for(var s=0,l=0;l<co.length;l++){var a=co[l];(a.fragmentInstance!==e||a.observer!==i||a.instance!==t)&&(co[s++]=a)}co.length=s,i.observe(t)}),VD(t,e))}function Nj(t,e){var n=e._eventListeners;if(n!==null)for(var r=0;r<n.length;r++){var o=n[r];t.removeEventListener(o.type,o.attachedListener,_c(o.optionsOrUseCapture))}t.nodeType!==3&&(n=e._observers,n!==null&&n.forEach(function(i){typeof i.rootMargin=="string"?Mj(e,i,t):i.unobserve(t)}),t.reactFragments!=null&&t.reactFragments.delete(e))}function e1(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":e1(n),Im(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function _j(t,e,n,r){for(;t.nodeType===1;){var o=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!r&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(r){if(!t[vf])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(i=t.getAttribute("rel"),i==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(i!==o.rel||t.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||t.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||t.getAttribute("title")!==(o.title==null?null:o.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(i=t.getAttribute("src"),(i!==(o.src==null?null:o.src)||t.getAttribute("type")!==(o.type==null?null:o.type)||t.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&i&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var i=o.name==null?null:""+o.name;if(o.type==="hidden"&&t.getAttribute("name")===i)return t}else return t;if(t=qr(t.nextSibling),t===null)break}return null}function Ij(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=qr(t.nextSibling),t===null))return null;return t}function FD(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=qr(t.nextSibling),t===null))return null;return t}function t1(t){return t.data==="$?"||t.data==="$~"}function Z1(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function Lj(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var r=function(){e(),n.removeEventListener("DOMContentLoaded",r)};n.addEventListener("DOMContentLoaded",r),t._reactRetry=r}}function qr(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var n1=null;function FM(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return qr(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function $M(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function zj(t,e){function n(){r=!0}if(t.ownerDocument.activeElement===t)return!0;var r=!1;try{t.ownerDocument.addEventListener("focus",n,!0),(t.focus||HTMLElement.prototype.focus).call(t,e)}finally{t.ownerDocument.removeEventListener("focus",n,!0)}return r}function Uj(t){BM(function(){BM(function(e){return t(e)})})}function $D(t,e,n){switch(e=cf(n),t){case"html":if(t=e.documentElement,!t)throw Error(k(452));return t;case"head":if(t=e.head,!t)throw Error(k(453));return t;case"body":if(t=e.body,!t)throw Error(k(454));return t;default:throw Error(k(451))}}function YD(t,e,n){for(var r in n){var o=n[r];n.hasOwnProperty(r)&&o!=null&&Oe(t,e,r,null,fj,o)}n.dangerouslySetInnerHTML!=null&&(t.textContent=""),t.onclick===_o&&(t.onclick=null),Im(t)}function Gb(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);Im(t)}var Kr=new Map,YM=new Set;function uf(t){if(typeof t.getRootNode=="function"){var e=t.getRootNode();if(e.nodeType===9||e.nodeType===11)return e}return t.nodeType===9?t:t.ownerDocument}var Ei=Ae.d;Ae.d={f:Bj,r:Pj,D:Hj,C:Vj,L:jj,m:Fj,X:Yj,S:$j,M:qj};function Bj(){var t=Ei.f(),e=Gm();return t||e}function Pj(t){var e=Pc(t);e!==null&&e.tag===5&&e.type==="form"?RO(e):Ei.r(t)}var Fc=typeof document>"u"?null:document;function qD(t,e,n){var r=Fc;if(r&&typeof e=="string"&&e){var o=Fr(e);o='link[rel="'+t+'"][href="'+o+'"]',typeof n=="string"&&(o+='[crossorigin="'+n+'"]'),YM.has(o)||(YM.add(o),t={rel:t,crossOrigin:n,href:e},r.querySelector(o)===null&&(e=r.createElement("link"),cn(e,"link",t),qt(e),r.head.appendChild(e)))}}function Hj(t){Ei.D(t),qD("dns-prefetch",t,null)}function Vj(t,e){Ei.C(t,e),qD("preconnect",t,e)}function jj(t,e,n){Ei.L(t,e,n);var r=Fc;if(r&&t&&e){var o='link[rel="preload"][as="'+Fr(e)+'"]';e==="image"&&n&&n.imageSrcSet?(o+='[imagesrcset="'+Fr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(o+='[imagesizes="'+Fr(n.imageSizes)+'"]')):o+='[href="'+Fr(t)+'"]';var i=o;switch(e){case"style":i=Ic(t);break;case"script":i=$c(t)}if(!(Kr.has(i)||(t=Pe({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),Kr.set(i,t),r.querySelector(o)!==null||e==="style"&&r.querySelector(Ef(i))||e==="script"&&r.querySelector(Tf(i))))){var s=r.createElement("link");cn(s,"link",t),e==="style"&&(s[am]=!0,s.onload=s.onerror=function(){SR(s)}),qt(s),r.head.appendChild(s)}}}function Fj(t,e){Ei.m(t,e);var n=Fc;if(n&&t){var r=e&&typeof e.as=="string"?e.as:"script",o='link[rel="modulepreload"][as="'+Fr(r)+'"][href="'+Fr(t)+'"]',i=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":i=$c(t)}if(!Kr.has(i)&&(t=Pe({rel:"modulepreload",href:t},e),Kr.set(i,t),n.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Tf(i)))return}r=n.createElement("link"),cn(r,"link",t),qt(r),n.head.appendChild(r)}}}function $j(t,e,n){Ei.S(t,e,n);var r=Fc;if(r&&t){var o=mc(r).hoistableStyles,i=Ic(t);e=e||"default";var s=o.get(i);if(!s){var l={loading:0,preload:null};if(s=r.querySelector(Ef(i)))l.loading=5;else{t=Pe({rel:"stylesheet",href:t,"data-precedence":e},n),(n=Kr.get(i))&&eS(t,n);var a=s=r.createElement("link");qt(a),cn(a,"link",t),a._p=new Promise(function(c,u){a.onload=c,a.onerror=u}),a.addEventListener("load",function(){l.loading|=1}),a.addEventListener("error",function(){l.loading|=2}),l.loading|=4,Zp(s,e,r)}s={type:"stylesheet",instance:s,count:1,state:l},o.set(i,s)}}}function Yj(t,e){Ei.X(t,e);var n=Fc;if(n&&t){var r=mc(n).hoistableScripts,o=$c(t),i=r.get(o);i||(i=n.querySelector(Tf(o)),i||(t=Pe({src:t,async:!0},e),(e=Kr.get(o))&&tS(t,e),i=n.createElement("script"),qt(i),cn(i,"link",t),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(o,i))}}function qj(t,e){Ei.M(t,e);var n=Fc;if(n&&t){var r=mc(n).hoistableScripts,o=$c(t),i=r.get(o);i||(i=n.querySelector(Tf(o)),i||(t=Pe({src:t,async:!0,type:"module"},e),(e=Kr.get(o))&&tS(t,e),i=n.createElement("script"),qt(i),cn(i,"link",t),n.head.appendChild(i)),i={type:"script",instance:i,count:1,state:null},r.set(o,i))}}function qM(t,e,n,r){var o=(o=ws.current)?uf(o):null;if(!o)throw Error(k(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(n=Ic(n.href),e=mc(o).hoistableStyles,r=e.get(n),r||(r={type:"style",instance:null,count:0,state:null},e.set(n,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=Ic(n.href);var i=mc(o).hoistableStyles,s=i.get(t);if(s||(o=o.ownerDocument||o,s={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},i.set(t,s),(i=o.querySelector(Ef(t)))?i._p||(s.instance=i,s.state.loading=5):(i=Kr.get(t),i||(i={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Kr.set(t,i)),Kj(o,t,i,s.state))),e&&r===null)throw Error(k(528,""));return s}if(e&&r!==null)throw Error(k(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(n=$c(n),e=mc(o).hoistableScripts,r=e.get(n),r||(r={type:"script",instance:null,count:0,state:null},e.set(n,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(k(444,t))}}function Ic(t){return'href="'+Fr(t)+'"'}function Ef(t){return'link[rel="stylesheet"]['+t+"]"}function KD(t){return Pe({},t,{"data-precedence":t.precedence,precedence:null})}function Kj(t,e,n,r){if(e=t.querySelector('link[rel="preload"][as="style"]['+e+"]")){if(e[am]!==!0){r.loading=1;return}}else e=t.createElement("link"),e[am]=!0,e.onload=e.onerror=SR.bind(null,e),cn(e,"link",n),qt(e),t.head.appendChild(e);r.preload=e,e.addEventListener("load",function(){return r.loading|=1}),e.addEventListener("error",function(){return r.loading|=2})}function $c(t){return'[src="'+Fr(t)+'"]'}function Tf(t){return"script[async]"+t}function KM(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var r=t.querySelector('style[data-href~="'+Fr(n.href)+'"]');if(r)return e.instance=r,qt(r),r;var o=Pe({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(t.ownerDocument||t).createElement("style"),qt(r),cn(r,"style",o),Zp(r,n.precedence,t),e.instance=r;case"stylesheet":o=Ic(n.href);var i=t.querySelector(Ef(o));if(i)return e.state.loading|=4,e.instance=i,qt(i),i;r=KD(n),(o=Kr.get(o))&&eS(r,o),i=(t.ownerDocument||t).createElement("link"),qt(i);var s=i;return s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),cn(i,"link",r),e.state.loading|=4,Zp(i,n.precedence,t),e.instance=i;case"script":return i=$c(n.src),(o=t.querySelector(Tf(i)))?(e.instance=o,qt(o),o):(r=n,(o=Kr.get(i))&&(r=Pe({},n),tS(r,o)),t=t.ownerDocument||t,o=t.createElement("script"),qt(o),cn(o,"link",r),t.head.appendChild(o),e.instance=o);case"void":return null;default:throw Error(k(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(r=e.instance,e.state.loading|=4,Zp(r,n.precedence,t));return e.instance}function Zp(t,e,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,i=o,s=0;s<r.length;s++){var l=r[s];if(l.dataset.precedence===e)i=l;else if(i!==o)break}i?i.parentNode.insertBefore(t,i.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function eS(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.title==null&&(t.title=e.title)}function tS(t,e){t.crossOrigin==null&&(t.crossOrigin=e.crossOrigin),t.referrerPolicy==null&&(t.referrerPolicy=e.referrerPolicy),t.integrity==null&&(t.integrity=e.integrity)}var em=null;function GM(t,e,n){if(em===null){var r=new Map,o=em=new Map;o.set(n,r)}else o=em,r=o.get(n),r||(r=new Map,o.set(n,r));if(r.has(t))return r;for(r.set(t,null),n=n.getElementsByTagName(t),o=0;o<n.length;o++){var i=n[o];if(!(i[vf]||i[on]||t==="link"&&i.getAttribute("rel")==="stylesheet")&&i.namespaceURI!=="http://www.w3.org/2000/svg"){var s=i.getAttribute(e)||"";s=t+s;var l=r.get(s);l?l.push(i):r.set(s,[i])}}return r}function r1(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function Gj(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;return e.rel==="stylesheet"?(t=e.disabled,typeof e.precedence=="string"&&t==null):!0;case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function XM(t,e){return t==="img"&&e.src!=null&&e.src!==""&&e.onLoad==null&&e.loading!=="lazy"}function GD(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function XD(t){return(t.width||100)*(t.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function WM(t,e){typeof e.decode=="function"&&(t.imgCount++,e.complete||(t.imgBytes+=XD(e),t.suspenseyImages.push(e)),t=Jj.bind(t),e.decode().then(t,t))}function Xj(t,e,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var o=Ic(r.href),i=e.querySelector(Ef(o));if(i){e=i._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=df.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=i,qt(i);return}i=e.ownerDocument||e,r=KD(r),(o=Kr.get(o))&&eS(r,o),i=i.createElement("link"),qt(i);var s=i;s._p=new Promise(function(l,a){s.onload=l,s.onerror=a}),cn(i,"link",r),n.instance=i}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&(n.state.loading&3)===0&&(t.count++,n=df.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var tm=0;function Wj(t,e){return t.stylesheets&&t.count===0&&nm(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var r=setTimeout(function(){if(t.stylesheets&&nm(t,t.stylesheets),t.unsuspend){var i=t.unsuspend;t.unsuspend=null,i()}},6e4+e);0<t.imgBytes&&tm===0&&(tm=62500*pj());var o=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&nm(t,t.stylesheets),t.unsuspend)){var i=t.unsuspend;t.unsuspend=null,i()}},(t.imgBytes>tm?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function WD(t){if(t.count===0&&(t.imgCount===0||!t.waitingForImages)){if(t.stylesheets)nm(t,t.stylesheets);else if(t.unsuspend){var e=t.unsuspend;t.unsuspend=null,e()}}}function df(){this.count--,WD(this)}function Jj(){this.imgCount--,WD(this)}var Dm=null;function nm(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,Dm=new Map,e.forEach(Qj,t),Dm=null,df.call(t))}function Qj(t,e){if(!(e.state.loading&4)){var n=Dm.get(t);if(n)var r=n.get(null);else{n=new Map,Dm.set(t,n);for(var o=t.querySelectorAll("link[data-precedence],style[data-precedence]"),i=0;i<o.length;i++){var s=o[i];(s.nodeName==="LINK"||s.getAttribute("media")!=="not all")&&(n.set(s.dataset.precedence,s),r=s)}r&&n.set(null,r)}o=e.instance,s=o.getAttribute("data-precedence"),i=n.get(s)||r,i===r&&n.set(null,o),n.set(s,o),this.count++,r=df.bind(this),o.addEventListener("load",r),o.addEventListener("error",r),i?i.parentNode.insertBefore(o,i.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(o,t.firstChild)),e.state.loading|=4}}var Lc={$$typeof:No,Provider:null,Consumer:null,_currentValue:Ll,_currentValue2:Ll,_threadCount:0};function Zj(t,e,n,r,o,i,s,l,a){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=xb(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=xb(0),this.hiddenUpdates=xb(null),this.identifierPrefix=r,this.onUncaughtError=o,this.onCaughtError=i,this.onRecoverableError=s,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=a,this.transitionTypes=null,this.incompleteTransitions=new Map}function JD(t,e,n,r,o,i,s,l,a,c,u,d){return t=new Zj(t,e,n,s,a,c,u,d,l),e=1,i===!0&&(e|=24),i=Gn(3,null,null,e),t.current=i,i.stateNode=t,e=S1(),e.refCount++,t.pooledCache=e,e.refCount++,i.memoizedState={element:r,isDehydrated:n,cache:e},E1(i),t}function QD(t){return t?(t=dc,t):dc}function ZD(t,e,n,r,o,i){o=QD(o),r.context===null?r.context=o:r.pendingContext=o,r=xs(e),r.payload={element:n},i=i===void 0?null:i,i!==null&&(r.callback=i),n=Cs(t,r,e),n!==null&&(Xn(n,t,e),jd(n,t,e))}function JM(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function nS(t,e){JM(t,e),(t=t.alternate)&&JM(t,e)}function eN(t){if(t.tag===13||t.tag===31){var e=Jl(t,67108864);e!==null&&Xn(e,t,67108864),nS(t,67108864)}}function QM(t){if(t.tag===13||t.tag===31){var e=xr();e=c1(e);var n=Jl(t,e);n!==null&&Xn(n,t,e),nS(t,e)}}var zc=!0;function e6(t,e,n,r){var o=Z.T;Z.T=null;var i=Ae.p;try{Ae.p=2,rS(t,e,n,r)}finally{Ae.p=i,Z.T=o}}function t6(t,e,n,r){var o=Z.T;Z.T=null;var i=Ae.p;try{Ae.p=8,rS(t,e,n,r)}finally{Ae.p=i,Z.T=o}}function rS(t,e,n,r){if(zc){var o=o1(r);if(o===null)Yb(t,e,r,Nm,n),ZM(t,r);else if(r6(o,t,e,n,r))r.stopPropagation();else if(ZM(t,r),e&4&&-1<n6.indexOf(t)){for(;o!==null;){var i=Pc(o);if(i!==null)switch(i.tag){case 3:if(i=i.stateNode,i.current.memoizedState.isDehydrated){var s=Ol(i.pendingLanes);if(s!==0){var l=i;for(l.pendingLanes|=2,l.entangledLanes|=2;s;){var a=1<<31-Sr(s);l.entanglements[1]|=a,s&=~a}Ho(i),(Te&6)===0&&(Am=br()+500,Cf(0,!1))}}break;case 31:case 13:l=Jl(i,2),l!==null&&Xn(l,i,2),Gm(),nS(i,2)}if(i=o1(r),i===null&&Yb(t,e,r,Nm,n),i===o)break;o=i}o!==null&&r.stopPropagation()}else Yb(t,e,r,null,n)}}function o1(t){return t=f1(t),oS(t)}var Nm=null;function oS(t){if(Nm=null,t=_l(t),t!==null){var e=pf(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=iR(e),t!==null)return t;t=null}else if(n===31){if(t=sR(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return Nm=t,null}function tN(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"fullscreenerror":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"resize":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(gH()){case fR:return 2;case hR:return 8;case lm:case yH:return 32;case pR:return 268435456;default:return 32}default:return 32}}var i1=!1,ks=null,Ms=null,Rs=null,ff=new Map,hf=new Map,hs=[],n6="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ZM(t,e){switch(t){case"focusin":case"focusout":ks=null;break;case"dragenter":case"dragleave":Ms=null;break;case"mouseover":case"mouseout":Rs=null;break;case"pointerover":case"pointerout":ff.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":hf.delete(e.pointerId)}}function Dd(t,e,n,r,o,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[o]},e!==null&&(e=Pc(e),e!==null&&eN(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function r6(t,e,n,r,o){switch(e){case"focusin":return ks=Dd(ks,t,e,n,r,o),!0;case"dragenter":return Ms=Dd(Ms,t,e,n,r,o),!0;case"mouseover":return Rs=Dd(Rs,t,e,n,r,o),!0;case"pointerover":var i=o.pointerId;return ff.set(i,Dd(ff.get(i)||null,t,e,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,hf.set(i,Dd(hf.get(i)||null,t,e,n,r,o)),!0}return!1}function nN(t){var e=_l(t.target);if(e!==null){var n=pf(e);if(n!==null){if(e=n.tag,e===13){if(e=iR(n),e!==null){t.blockedOn=e,Tk(t.priority,function(){QM(n)});return}}else if(e===31){if(e=sR(n),e!==null){t.blockedOn=e,Tk(t.priority,function(){QM(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function rm(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=o1(t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);aw=r,n.target.dispatchEvent(r),aw=null}else return e=Pc(n),e!==null&&eN(e),t.blockedOn=n,!1;e.shift()}return!0}function eR(t,e,n){rm(t)&&n.delete(e)}function o6(){i1=!1,ks!==null&&rm(ks)&&(ks=null),Ms!==null&&rm(Ms)&&(Ms=null),Rs!==null&&rm(Rs)&&(Rs=null),ff.forEach(eR),hf.forEach(eR)}function Up(t,e){t.blockedOn===e&&(t.blockedOn=null,i1||(i1=!0,It.unstable_scheduleCallback(It.unstable_NormalPriority,o6)))}var Bp=null;function tR(t){Bp!==t&&(Bp=t,It.unstable_scheduleCallback(It.unstable_NormalPriority,function(){Bp===t&&(Bp=null);for(var e=0;e<t.length;e+=3){var n=t[e],r=t[e+1],o=t[e+2];if(typeof r!="function"){if(oS(r||n)===null)continue;break}var i=Pc(n);i!==null&&(t.splice(e,3),e-=3,Ew(i,{pending:!0,data:o,method:n.method,action:r},r,o))}}))}function Uc(t){function e(a){return Up(a,t)}ks!==null&&Up(ks,t),Ms!==null&&Up(Ms,t),Rs!==null&&Up(Rs,t),ff.forEach(e),hf.forEach(e);for(var n=0;n<hs.length;n++){var r=hs[n];r.blockedOn===t&&(r.blockedOn=null)}for(;0<hs.length&&(n=hs[0],n.blockedOn===null);)nN(n),n.blockedOn===null&&hs.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var o=n[r],i=n[r+1],s=o[Jn]||null;if(typeof i=="function")s||tR(n);else if(s){var l=null;if(i&&i.hasAttribute("formAction")){if(o=i,s=i[Jn]||null)l=s.formAction;else if(oS(o)!==null)continue}else l=s.action;typeof l=="function"?n[r+1]=l:(n.splice(r,3),r-=3),tR(n)}}}function rN(){function t(i){i.canIntercept&&i.info==="react-transition"&&i.intercept({handler:function(){return new Promise(function(s){return o=s})},focusReset:"manual",scroll:"manual"})}function e(){o!==null&&(o(),o=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var i=navigation.currentEntry;i&&i.url!=null&&navigation.navigate(i.url,{state:i.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,o=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){r=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),o!==null&&(o(),o=null)}}}function iS(t){this._internalRoot=t}Jm.prototype.render=iS.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(k(409));var n=e.current,r=xr();ZD(n,r,t,e,null,null)};Jm.prototype.unmount=iS.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;ZD(t.current,2,null,t,null,null),Gm(),e[Bc]=null}};function Jm(t){this._internalRoot=t}Jm.prototype.unstable_scheduleHydration=function(t){if(t){var e=wR();t={blockedOn:null,target:t,priority:e};for(var n=0;n<hs.length&&e!==0&&e<hs[n].priority;n++);hs.splice(n,0,t),n===0&&nN(t)}};var nR=rR.version;if(nR!=="19.3.1")throw Error(k(527,nR,"19.3.1"));Ae.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(k(188)):(t=Object.keys(t).join(","),Error(k(268,t)));return t=iH(e),t=t!==null?lR(t):null,t=t===null?null:t.stateNode,t};var i6={bundleType:0,version:"19.3.1",rendererPackageName:"react-dom",currentDispatcherRef:Z,reconcilerVersion:"19.3.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Nd=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Nd.isDisabled&&Nd.supportsFiber))try{mf=Nd.inject(i6),wr=Nd}catch{}var Nd;Qm.createRoot=function(t,e){if(!oR(t))throw Error(k(299));var n=!1,r="",o=UO,i=BO,s=PO;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onUncaughtError!==void 0&&(o=e.onUncaughtError),e.onCaughtError!==void 0&&(i=e.onCaughtError),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=JD(t,1,!1,null,null,n,r,null,o,i,s,rN),t[Bc]=e.current,W1(t),new iS(e)};Qm.hydrateRoot=function(t,e,n){if(!oR(t))throw Error(k(299));var r=!1,o="",i=UO,s=BO,l=PO,a=null;return n!=null&&(n.unstable_strictMode===!0&&(r=!0),n.identifierPrefix!==void 0&&(o=n.identifierPrefix),n.onUncaughtError!==void 0&&(i=n.onUncaughtError),n.onCaughtError!==void 0&&(s=n.onCaughtError),n.onRecoverableError!==void 0&&(l=n.onRecoverableError),n.formState!==void 0&&(a=n.formState)),e=JD(t,1,!0,e,n??null,r,o,a,i,s,l,rN),e.context=QD(null),n=e.current,r=xr(),r=c1(r),o=xs(r),o.callback=null,Cs(n,o,r),n=r,e.current.lanes=n,yf(e,n),Ho(e),t[Bc]=e.current,W1(t),new Jm(e)};Qm.version="19.3.1"});var lN=To((ooe,sN)=>{"use strict";function iN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iN)}catch(t){console.error(t)}}iN(),sN.exports=oN()});var uN=To(Zm=>{"use strict";var s6=Symbol.for("react.transitional.element"),l6=Symbol.for("react.fragment");function cN(t,e,n){var r=null;if(n!==void 0&&(r=""+n),e.key!==void 0&&(r=""+e.key),"key"in e){n={};for(var o in e)o!=="key"&&(n[o]=e[o])}else n=e;return e=n.ref,{$$typeof:s6,type:t,key:r,ref:e!==void 0?e:null,props:n}}Zm.Fragment=l6;Zm.jsx=cN;Zm.jsxs=cN});var le=To((loe,dN)=>{"use strict";dN.exports=uN()});var In=R(P(),1),R8=R(lN(),1);var aN="agentic-design-theme";var fn=R(P(),1),WN=R(le(),1),wg=R(P(),1),ie=R(P(),1),o2=R(P(),1),Xr=R(P(),1),VS=R(le(),1),xe=R(P(),1),l2=R(P(),1),a2=R(Wa(),1),pn=R(P(),1),y2=R(le(),1),v2=R(P(),1),_f=R(P(),1),FS=R(le(),1),lt=R(P(),1),qS=R(le(),1),JS=R(P(),1),Tn=R(P(),1),Tt=R(P(),1),H2=R(P(),1),V2=R(Wa(),1),F2=R(P(),1),Jc=R(le(),1),Og=R(P(),1),Z2=R(Wa(),1),e_=R(le(),1),dn=R(P(),1),t_=R(P(),1),Wr=R(P(),1),ho=R(P(),1),ru=R(P(),1),u_=R(P(),1),d_=R(le(),1),Jt=R(le(),1),Ng=R(P(),1),Ai=R(le(),1),qs=R(le(),1),Xs=R(P(),1),Zn=R(le(),1),_e=R(le(),1),ze=R(P(),1),M_=R(P(),1),Lg=R(P(),1),An=R(P(),1),O_=R(P(),1),zg=R(P(),1),D_=R(P(),1),Qe=R(P(),1),iu=R(P(),1),I_=R(P(),1),vt=R(le(),1),qo=R(P(),1),ne=R(P(),1),po=R(P(),1),cg=R(le(),1),Ut=R(P(),1),Us=R(le(),1),Hg=R(P(),1),yoe=R(le(),1),Wt=R(P(),1),z$=R(P(),1),jg=R(P(),1),Vs=R(le(),1),He=R(le(),1),Di=R(le(),1),vx=R(P(),1),O9=R(le(),1),oe=R(P(),1),A3=R(Wa(),1),Ne=R(le(),1),er=R(P(),1),ge=R(le(),1),Gt=R(P(),1),Vn=R(le(),1),Gg=R(P(),1),B3=R(P(),1),P3=R(le(),1),Noe=R(P(),1),_oe=R(le(),1),ea=R(le(),1),Nf=R(le(),1),Xt=R(le(),1),En=R(le(),1),tI=R(P(),1),Ax=R(le(),1),JN=(0,fn.createContext)(null),QN="(prefers-color-scheme: dark)";function a6(t){let e=window.matchMedia(QN);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)}var yS=["light","dark","system"],vS=t=>yS.includes(t);function fN(t,e){try{let n=window.localStorage.getItem(t);return vS(n)?n:e}catch{return e}}function ZN({children:t,defaultPreference:e="system",storageKey:n=aN}){if(!vS(e))throw new Error(`defaultPreference must be one of ${yS.join(", ")}`);let[r,o]=(0,fn.useState)(e),[i,s]=(0,fn.useState)(!1);(0,fn.useEffect)(()=>{o(fN(n,e)),s(!0)},[n,e]);let l=(0,fn.useSyncExternalStore)(a6,()=>window.matchMedia(QN).matches,()=>!1),a=r==="system"?l?"dark":"light":r;(0,fn.useEffect)(()=>{if(!i)return;let d=document.documentElement;return r==="system"?d.removeAttribute("data-theme"):d.setAttribute("data-theme",r),()=>d.removeAttribute("data-theme")},[r,i]),(0,fn.useEffect)(()=>{let d=f=>{(f.key===n||f.key===null)&&o(fN(n,e))};return window.addEventListener("storage",d),()=>window.removeEventListener("storage",d)},[n,e]);let c=(0,fn.useCallback)(d=>{if(!vS(d))throw new Error(`The theme must be one of ${yS.join(", ")}, got "${String(d)}"`);o(d);try{window.localStorage.setItem(n,d)}catch{}},[n]),u=(0,fn.useMemo)(()=>({preference:r,theme:a,setPreference:c}),[r,a,c]);return(0,WN.jsx)(JN.Provider,{value:u,children:t})}function e2(){let t=(0,fn.useContext)(JN);if(!t)throw new Error("useTheme needs a ThemeProvider above it.");return t}function Yo(...t){return t.filter(Boolean).join(" ")}var c6=Object.defineProperty,eu=(t,e)=>c6(t,"name",{value:e,configurable:!0}),t2=!!(typeof window<"u"&&window.document&&window.document.createElement);function ee(t,e,{checkForDefaultPrevented:n=!0}={}){return eu(function(o){if(t?.(o),n===!1||!o||!o.defaultPrevented)return e?.(o)},"handleEvent")}eu(ee,"composeEventHandlers");function u6(t){if(!t2)throw new Error("Cannot access window outside of the DOM");return t?.ownerDocument?.defaultView??window}eu(u6,"getOwnerWindow");function bS(t){if(!t2)throw new Error("Cannot access document outside of the DOM");return t?.ownerDocument??document}eu(bS,"getOwnerDocument");function n2(t,e=!1){let{activeElement:n}=bS(t);if(!n?.nodeName)return null;if(r2(n)&&n.contentDocument)return n2(n.contentDocument.body,e);if(e){let r=n.getAttribute("aria-activedescendant");if(r){let o=bS(n).getElementById(r);if(o)return o}}return n}eu(n2,"getActiveElement");function r2(t){return t.tagName==="IFRAME"}eu(r2,"isFrame");var d6=Object.defineProperty,HS=(t,e)=>d6(t,"name",{value:e,configurable:!0});function wS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}HS(wS,"setRef");function i2(...t){return e=>{let n=!1,r=t.map(o=>{let i=wS(o,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let o=0;o<r.length;o++){let i=r[o];typeof i=="function"?i():wS(t[o],null)}}}}HS(i2,"composeRefs");function Je(...t){return o2.useCallback(i2(...t),t)}HS(Je,"useComposedRefs");var f6=Object.defineProperty,Gr=(t,e)=>f6(t,"name",{value:e,configurable:!0});function h6(t,e){let n=Xr.createContext(e);n.displayName=t+"Context";let r=Gr(i=>{let{children:s,...l}=i,a=Xr.useMemo(()=>l,Object.values(l));return(0,VS.jsx)(n.Provider,{value:a,children:s})},"Provider");r.displayName=t+"Provider";function o(i,s={}){let{optional:l=!1}=s,a=Xr.useContext(n);if(a)return a;if(e!==void 0)return e;if(!l)throw new Error(`\`${i}\` must be used within \`${t}\``)}return Gr(o,"useContext"),[r,o]}Gr(h6,"createContext");function Ar(t,e=[]){let n=[];function r(i,s){let l=Xr.createContext(s);l.displayName=i+"Context";let a=n.length;n=[...n,s];let c=Gr(d=>{let{scope:f,children:h,...p}=d,m=f?.[t]?.[a]||l,y=Xr.useMemo(()=>p,Object.values(p));return(0,VS.jsx)(m.Provider,{value:y,children:h})},"Provider");c.displayName=i+"Provider";function u(d,f,h={}){let{optional:p=!1}=h,m=f?.[t]?.[a]||l,y=Xr.useContext(m);if(y)return y;if(s!==void 0)return s;if(!p)throw new Error(`\`${d}\` must be used within \`${i}\``)}return Gr(u,"useContext"),[c,u]}Gr(r,"createContext");let o=Gr(()=>{let i=n.map(s=>Xr.createContext(s));return Gr(function(l){let a=l?.[t]||i;return Xr.useMemo(()=>({[`__scope${t}`]:{...l,[t]:a}}),[l,a])},"useScope")},"createScope");return o.scopeName=t,[r,s2(o,...e)]}Gr(Ar,"createContextScope");function s2(...t){let e=t[0];if(t.length===1)return e;let n=Gr(()=>{let r=t.map(o=>({useScope:o(),scopeName:o.scopeName}));return Gr(function(i){let s=r.reduce((l,{useScope:a,scopeName:c})=>{let d=a(i)[`__scope${c}`];return{...l,...d}},{});return Xr.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])},"useComposedScopes")},"createScope");return n.scopeName=e.scopeName,n}Gr(s2,"composeContextScopes");var p6=Object.defineProperty,kr=(t,e)=>p6(t,"name",{value:e,configurable:!0});function Fs(t){let e=pn.forwardRef((n,r)=>{let{children:o,...i}=n,s=null,l=!1,a=[];o=m2(o),pn.Children.forEach(o,f=>{if(h2(f)){l=!0;let h=f,p="child"in h.props?h.props.child:h.props.children;for(;jS(p)&&typeof pg=="function";)p=pg(p._payload);s=m6(h,p),a.push(s?.props?.children)}else a.push(f)}),s?s=pn.cloneElement(s,void 0,a):!l&&pn.Children.count(o)===1&&pn.isValidElement(o)&&(s=o);let c=s?f2(s):void 0,u=Je(r,c);if(!s){if(o||o===0)throw new Error(l?v6(t):y6(t));return o}let d=d2(i,s.props??{});return s.type!==pn.Fragment&&(d.ref=r?u:c),pn.cloneElement(s,d)});return e.displayName=`${t}.Slot`,e}kr(Fs,"createSlot");var c2=Symbol.for("radix.slottable");function u2(t){let e=kr(n=>"child"in n?n.children(n.child):n.children,"Slottable");return e.displayName=`${t}.Slottable`,e.__radixId=c2,e}kr(u2,"createSlottable");var m6=kr((t,e)=>"child"in t.props?pn.isValidElement(e)?pn.cloneElement(e,void 0,t.props.children(e.props.children)):null:pn.isValidElement(e)?e:null,"getSlottableElementFromSlottable");function d2(t,e){let n={...e};for(let r in e){let o=t[r],i=e[r];/^on[A-Z]/.test(r)?o&&i?n[r]=(...l)=>{let a=i(...l);return o(...l),a}:o&&(n[r]=o):r==="style"?n[r]={...o,...i}:r==="className"?n[r]=[o,i].filter(Boolean).join(" "):r==="aria-describedby"&&(n[r]=g2(i,o))}return{...t,...n}}kr(d2,"mergeProps");function f2(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}kr(f2,"getElementRef");function h2(t){return pn.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===c2}kr(h2,"isSlottable");var g6=Symbol.for("react.lazy");function jS(t){return t!=null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===g6&&"_payload"in t&&p2(t._payload)}kr(jS,"isLazyComponent");function p2(t){return typeof t=="object"&&t!==null&&"then"in t}kr(p2,"isPromiseLike");function m2(t){let e=t;for(;jS(e)&&typeof pg=="function";)e=pg(e._payload);return e}kr(m2,"useUnwrappedLazy");function g2(...t){let e=new Set;for(let n of t)if(typeof n=="string")for(let r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}kr(g2,"concatAriaDescribedby");var y6=kr(t=>`${t} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,"createSlotError"),v6=kr(t=>`${t} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,"createSlottableError"),pg=pn[" use ".trim().toString()],b6=Object.defineProperty,w6=(t,e)=>b6(t,"name",{value:e,configurable:!0}),S6=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],je=S6.reduce((t,e)=>{let n=Fs(`Primitive.${e}`),r=l2.forwardRef((o,i)=>{let{asChild:s,...l}=o,a=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),(0,y2.jsx)(a,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function Sg(t,e){t&&a2.flushSync(()=>t.dispatchEvent(e))}w6(Sg,"dispatchDiscreteCustomEvent");var hn=globalThis?.document?v2.useLayoutEffect:()=>{},x6=Object.defineProperty,C6=(t,e)=>x6(t,"name",{value:e,configurable:!0}),hN=_f[" useInsertionEffect ".trim().toString()];function Tr(t){let e=_f.useRef(t);return typeof hN=="function"?hN(()=>{e.current=t}):hn(()=>{e.current=t}),_f.useMemo(()=>((...n)=>e.current?.(...n)),[])}C6(Tr,"useCallbackRef");var E6=Object.defineProperty,Lt=(t,e)=>E6(t,"name",{value:e,configurable:!0}),SS="dismissableLayer.update",T6="dismissableLayer.pointerDownOutside",A6="dismissableLayer.focusOutside",pN,$S=xe.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),xg=xe.forwardRef(Lt(function(e,n){let{disableOutsidePointerEvents:r=!1,deferPointerDownOutside:o=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:a,onDismiss:c,...u}=e,d=xe.useContext($S),[f,h]=xe.useState(null),p=f?.ownerDocument??globalThis?.document,[,m]=xe.useState({}),y=Je(n,h),g=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=v?g.indexOf(v):-1,w=f?g.indexOf(f):-1,S=d.layersWithOutsidePointerEventsDisabled.size>0,C=w>=b,x=xe.useRef(!1),E=w2(z=>{s?.(z),a?.(z),z.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:o,isDeferredPointerDownOutsideRef:x,dismissableSurfaces:d.dismissableSurfaces,shouldHandlePointerDownOutside:xe.useCallback(z=>{if(!(z instanceof Node))return!1;let $=[...d.branches].some(I=>I.contains(z));return C&&!$},[d.branches,C])}),A=S2(z=>{if(o&&x.current)return;let $=z.target;[...d.branches].some(j=>j.contains($))||(l?.(z),a?.(z),z.defaultPrevented||c?.())},p),T=f?w===g.length-1:!1,_=Tr(z=>{z.key==="Escape"&&(i?.(z),!z.defaultPrevented&&c&&(z.preventDefault(),c()))});return xe.useEffect(()=>{if(T)return p.addEventListener("keydown",_,{capture:!0}),()=>p.removeEventListener("keydown",_,{capture:!0})},[p,T,_]),xe.useEffect(()=>{if(f)return r&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(pN=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(f)),d.layers.add(f),xS(),()=>{r&&(d.layersWithOutsidePointerEventsDisabled.delete(f),d.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=pN))}},[f,p,r,d]),xe.useEffect(()=>()=>{f&&(d.layers.delete(f),d.layersWithOutsidePointerEventsDisabled.delete(f),xS())},[f,d]),xe.useEffect(()=>{let z=Lt(()=>m({}),"handleUpdate");return document.addEventListener(SS,z),()=>document.removeEventListener(SS,z)},[]),(0,FS.jsx)(je.div,{...u,ref:y,style:{pointerEvents:S?C?"auto":"none":void 0,...e.style},onFocusCapture:ee(e.onFocusCapture,A.onFocusCapture),onBlurCapture:ee(e.onBlurCapture,A.onBlurCapture),onPointerDownCapture:ee(e.onPointerDownCapture,E.onPointerDownCapture)})},"DismissableLayer")),k6=xe.forwardRef(Lt(function(e,n){let r=xe.useContext($S),o=xe.useRef(null),i=Je(n,o);return xe.useEffect(()=>{let s=o.current;if(s)return r.branches.add(s),()=>{r.branches.delete(s)}},[r.branches]),(0,FS.jsx)(je.div,{...e,ref:i})},"DismissableLayerBranch"));function b2(){let t=xe.useContext($S),[e,n]=xe.useState(null);return xe.useEffect(()=>{if(e)return t.dismissableSurfaces.add(e),()=>{t.dismissableSurfaces.delete(e)}},[e,t.dismissableSurfaces]),n}Lt(b2,"useDismissableLayerSurface");var M6=Lt(()=>!0,"IS_TRUE");function w2(t,e){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:o,dismissableSurfaces:i,shouldHandlePointerDownOutside:s=M6}=e,l=Tr(t),a=xe.useRef(!1),c=xe.useRef(!1),u=xe.useRef(new Map),d=xe.useRef(()=>{});return xe.useEffect(()=>{function f(){c.current=!1,o.current=!1,u.current.clear()}Lt(f,"resetOutsideInteraction");function h(){return Array.from(u.current.values()).some(Boolean)}Lt(h,"isOutsideInteractionIntercepted");function p(b){if(!c.current)return;let w=b.target;w instanceof Node&&[...i].some(C=>C.contains(w))||u.current.set(b.type,!0),b.type==="click"&&window.setTimeout(()=>{c.current&&d.current()},0)}Lt(p,"handleInteractionCapture");function m(b){c.current&&u.current.set(b.type,!1)}Lt(m,"handleInteractionBubble");let y=Lt(b=>{if(b.target&&!a.current){let S=function(){n.removeEventListener("click",d.current);let x=h();f(),x||YS(T6,l,C,{discrete:!0})};var w=S;if(Lt(S,"handleAndDispatchPointerDownOutsideEvent"),!s(b.target)){n.removeEventListener("click",d.current),f(),a.current=!1;return}let C={originalEvent:b};c.current=!0,o.current=r&&b.button===0,u.current.clear(),!r||b.button!==0?S():(n.removeEventListener("click",d.current),d.current=S,n.addEventListener("click",d.current,{once:!0}))}else n.removeEventListener("click",d.current),f();a.current=!1},"handlePointerDown"),g=["pointerup","mousedown","mouseup","touchstart","touchend","click"];for(let b of g)n.addEventListener(b,p,!0),n.addEventListener(b,m);let v=window.setTimeout(()=>{n.addEventListener("pointerdown",y)},0);return()=>{window.clearTimeout(v),n.removeEventListener("pointerdown",y),n.removeEventListener("click",d.current);for(let b of g)n.removeEventListener(b,p,!0),n.removeEventListener(b,m)}},[n,l,r,o,i,s]),{onPointerDownCapture:Lt(()=>a.current=!0,"onPointerDownCapture")}}Lt(w2,"usePointerDownOutside");function S2(t,e=globalThis?.document){let n=Tr(t),r=xe.useRef(!1);return xe.useEffect(()=>{let o=Lt(i=>{i.target&&!r.current&&YS(A6,n,{originalEvent:i},{discrete:!1})},"handleFocus");return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:Lt(()=>r.current=!0,"onFocusCapture"),onBlurCapture:Lt(()=>r.current=!1,"onBlurCapture")}}Lt(S2,"useFocusOutside");function xS(){let t=new CustomEvent(SS);document.dispatchEvent(t)}Lt(xS,"dispatchUpdate");function YS(t,e,n,{discrete:r}){let o=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?Sg(o,i):o.dispatchEvent(i)}Lt(YS,"handleAndDispatchCustomEvent");var R6=Object.defineProperty,Et=(t,e)=>R6(t,"name",{value:e,configurable:!0}),sS="focusScope.autoFocusOnMount",lS="focusScope.autoFocusOnUnmount",mN={bubbles:!1,cancelable:!0},x2=lt.forwardRef(Et(function(e,n){let{loop:r=!1,trapped:o=!1,branches:i,onMountAutoFocus:s,onUnmountAutoFocus:l,...a}=e,[c,u]=lt.useState(null),d=Tr(s),f=Tr(l),h=lt.useRef(null),p=Je(n,u),m=lt.useRef(i);lt.useEffect(()=>{m.current=i});let y=lt.useCallback(b=>b?c?.contains(b)?!0:!!m.current?.some(w=>w.contains(b)):!1,[c]),g=lt.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;lt.useEffect(()=>{if(o){let C=function(T){if(g.paused||!c)return;let _=T.target;y(_)?h.current=_:Ti(h.current,{select:!0})},x=function(T){if(g.paused||!c)return;let _=T.relatedTarget;_!==null&&(y(_)||Ti(h.current,{select:!0}))},E=function(T){if(document.activeElement===document.body)for(let z of T)z.removedNodes.length>0&&Ti(c)};var b=C,w=x,S=E;Et(C,"handleFocusIn"),Et(x,"handleFocusOut"),Et(E,"handleMutations"),document.addEventListener("focusin",C),document.addEventListener("focusout",x);let A=new MutationObserver(E);return c&&A.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",C),document.removeEventListener("focusout",x),A.disconnect()}}},[o,c,g.paused,y]),lt.useEffect(()=>{if(c){gN.add(g);let b=document.activeElement;if(!c.contains(b)){let S=new CustomEvent(sS,mN);c.addEventListener(sS,d),c.dispatchEvent(S),S.defaultPrevented||(E2(R2(WS(c)),{select:!0}),document.activeElement===b&&Ti(c))}return()=>{c.removeEventListener(sS,d);let S=c.ownerDocument,C=CustomEvent;setTimeout(()=>{let x=new C(lS,mN);c.addEventListener(lS,f),c.dispatchEvent(x),x.defaultPrevented||Ti(b??S.body,{select:!0}),c.removeEventListener(lS,f),gN.remove(g)},0)}}},[c,d,f,g]);let v=lt.useCallback(b=>{if(!r&&!o||g.paused)return;let w=b.key==="Tab"&&!b.altKey&&!b.ctrlKey&&!b.metaKey,S=document.activeElement;if(w&&S){let C=b.currentTarget,[x,E]=T2(C);x&&E?!b.shiftKey&&S===E?(b.preventDefault(),r&&Ti(x,{select:!0})):b.shiftKey&&S===x&&(b.preventDefault(),r&&Ti(E,{select:!0})):S===C&&b.preventDefault()}},[r,o,g.paused]);return(0,qS.jsx)(je.div,{tabIndex:-1,...a,ref:p,onKeyDown:v})},"FocusScope")),C2=lt.createContext(null);function KS({registry:t,children:e}){return t?(0,qS.jsx)(C2.Provider,{value:t,children:e}):e}Et(KS,"FocusScopeBranchProvider");function GS(){let[t,e]=lt.useState([]),n=lt.useMemo(()=>({add:Et(r=>e(o=>o.includes(r)?o:[...o,r]),"add"),remove:Et(r=>e(o=>o.filter(i=>i!==r)),"remove")}),[]);return{nodes:t,registry:n}}Et(GS,"useFocusScopeBranchRegistry");function XS(t){let e=lt.useContext(C2);lt.useEffect(()=>{if(!(!t||!e))return e.add(t),()=>e.remove(t)},[t,e])}Et(XS,"useFocusScopeBranch");function E2(t,{select:e=!1}={}){let n=document.activeElement;for(let r of t)if(Ti(r,{select:e}),document.activeElement!==n)return}Et(E2,"focusFirst");function T2(t){let e=WS(t),n=CS(e,t),r=CS(e.reverse(),t);return[n,r]}Et(T2,"getTabbableEdges");function WS(t){let e=[],r=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Et(o=>{let i=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||i?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;r.nextNode();)e.push(r.currentNode);return e}Et(WS,"getTabbableCandidates");function CS(t,e){let n=typeof e.checkVisibility=="function"&&e.checkVisibility({checkVisibilityCSS:!0});for(let r of t)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):A2(r,{upTo:e})))return r}Et(CS,"findVisible");function A2(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}Et(A2,"isHidden");function k2(t){return t.tagName==="INPUT"&&typeof t.select=="function"}Et(k2,"isSelectableInput");function Ti(t,{select:e=!1}={}){if(t&&t.focus){let r=(t.ownerDocument??document).activeElement;t.focus({preventScroll:!0}),t!==r&&k2(t)&&e&&t.select()}}Et(Ti,"focus");var gN=M2();function M2(){let t=[];return{add(e){let n=t[0];e!==n&&n?.pause(),t=ES(t,e),t.unshift(e)},remove(e){t=ES(t,e),t[0]?.resume()}}}Et(M2,"createFocusScopesStack");function ES(t,e){let n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}Et(ES,"arrayRemove");function R2(t){return t.filter(e=>e.tagName!=="A")}Et(R2,"removeLinks");var O6=Object.defineProperty,D6=(t,e)=>O6(t,"name",{value:e,configurable:!0}),N6=JS[" useId ".trim().toString()]||(()=>{}),_6=0;function Ps(t){let[e,n]=JS.useState(N6());return hn(()=>{t||n(r=>r??String(_6++))},[t]),t||(e?`radix-${e}`:"")}D6(Ps,"useId");var I6=["top","right","bottom","left"],$s=Math.min,ki=Math.max,mg=Math.round,eg=Math.floor,Mi=t=>({x:t,y:t}),L6={left:"right",right:"left",bottom:"top",top:"bottom"};function O2(t,e,n){return ki(t,$s(e,n))}function Ri(t,e){return typeof t=="function"?t(e):t}function Ys(t){return t.split("-")[0]}function tu(t){return t.split("-")[1]}function QS(t){return t==="x"?"y":"x"}function ZS(t){return t==="y"?"height":"width"}function jo(t){let e=t[0];return e==="t"||e==="b"?"y":"x"}function ex(t){return QS(jo(t))}function z6(t,e,n){n===void 0&&(n=!1);let r=tu(t),o=ex(t),i=ZS(o),s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=gg(s)),[s,gg(s)]}function U6(t){let e=gg(t);return[TS(t),e,TS(e)]}function TS(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}var yN=["left","right"],vN=["right","left"],B6=["top","bottom"],P6=["bottom","top"];function H6(t,e,n){switch(t){case"top":case"bottom":return n?e?vN:yN:e?yN:vN;case"left":case"right":return e?B6:P6;default:return[]}}function V6(t,e,n,r){let o=tu(t),i=H6(Ys(t),n==="start",r);return o&&(i=i.map(s=>s+"-"+o),e&&(i=i.concat(i.map(TS)))),i}function gg(t){let e=Ys(t);return L6[e]+t.slice(e.length)}function j6(t){var e,n,r,o;return{top:(e=t.top)!=null?e:0,right:(n=t.right)!=null?n:0,bottom:(r=t.bottom)!=null?r:0,left:(o=t.left)!=null?o:0}}function D2(t){return typeof t!="number"?j6(t):{top:t,right:t,bottom:t,left:t}}function yg(t){let{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function bN(t,e,n){let{reference:r,floating:o}=t,i=jo(e),s=ex(e),l=ZS(s),a=Ys(e),c=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,f=r[l]/2-o[l]/2,h;switch(a){case"top":h={x:u,y:r.y-o.height};break;case"bottom":h={x:u,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:d};break;case"left":h={x:r.x-o.width,y:d};break;default:h={x:r.x,y:r.y}}let p=tu(e);return p&&(h[s]+=f*(p==="end"?1:-1)*(n&&c?-1:1)),h}async function F6(t,e){var n;e===void 0&&(e={});let{x:r,y:o,platform:i,rects:s,elements:l,strategy:a}=t,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:f=!1,padding:h=0}=Ri(e,t),p=D2(h),y=l[f?d==="floating"?"reference":"floating":d],g=yg(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(y)))==null||n?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:c,rootBoundary:u,strategy:a})),v=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),w=await(i.isElement==null?void 0:i.isElement(b))&&await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1},S=yg(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:b,strategy:a}):v);return{top:(g.top-S.top+p.top)/w.y,bottom:(S.bottom-g.bottom+p.bottom)/w.y,left:(g.left-S.left+p.left)/w.x,right:(S.right-g.right+p.right)/w.x}}var $6=50,Y6=async(t,e,n)=>{let{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,l=s.detectOverflow?s:{...s,detectOverflow:F6},a=await(s.isRTL==null?void 0:s.isRTL(e)),c=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:u,y:d}=bN(c,r,a),f=r,h=0,p={};for(let m=0;m<i.length;m++){let y=i[m];if(!y)continue;let{name:g,fn:v}=y,{x:b,y:w,data:S,reset:C}=await v({x:u,y:d,initialPlacement:r,placement:f,strategy:o,middlewareData:p,rects:c,platform:l,elements:{reference:t,floating:e}});u=b??u,d=w??d,p[g]={...p[g],...S},C&&h<$6&&(h++,typeof C=="object"&&(C.placement&&(f=C.placement),C.rects&&(c=C.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):C.rects),{x:u,y:d}=bN(c,f,a)),m=-1)}return{x:u,y:d,placement:f,strategy:o,middlewareData:p}},q6=t=>({name:"arrow",options:t,async fn(e){let{x:n,y:r,placement:o,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:c,padding:u=0}=Ri(t,e)||{};if(c==null)return{};let d=D2(u),f={x:n,y:r},h=ex(o),p=ZS(h),m=await s.getDimensions(c),y=h==="y",g=y?"top":"left",v=y?"bottom":"right",b=y?"clientHeight":"clientWidth",w=i.reference[p]+i.reference[h]-f[h]-i.floating[p],S=f[h]-i.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),x=C?C[b]:0;(!x||!await(s.isElement==null?void 0:s.isElement(C)))&&(x=l.floating[b]||i.floating[p]);let E=w/2-S/2,A=x/2-m[p]/2-1,T=$s(d[g],A),_=$s(d[v],A),z=x-m[p]-_,$=x/2-m[p]/2+E,I=O2(T,$,z),j=!a.arrow&&tu(o)!=null&&$!==I&&i.reference[p]/2-($<T?T:_)-m[p]/2<0,D=j?$<T?$-T:$-z:0;return{[h]:f[h]+D,data:{[h]:I,centerOffset:$-I-D,...j&&{alignmentOffset:D}},reset:j}}}),K6=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;let{placement:o,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:c}=e,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...y}=Ri(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Ys(o),v=jo(l),b=Ys(l)===l,w=await(a.isRTL==null?void 0:a.isRTL(c.floating)),S=f||(b||!m?[gg(l)]:U6(l)),C=p!=="none";!f&&C&&S.push(...V6(l,m,p,w));let x=[l,...S],E=await a.detectOverflow(e,y),A=[],T=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&A.push(E[g]),d){let I=z6(o,s,w);A.push(E[I[0]],E[I[1]])}if(T=[...T,{placement:o,overflows:A}],!A.every(I=>I<=0)){var _,z;let I=(((_=i.flip)==null?void 0:_.index)||0)+1,j=x[I];if(j&&(!(d==="alignment"?v!==jo(j):!1)||T.every(U=>jo(U.placement)===v?U.overflows[0]>0:!0)))return{data:{index:I,overflows:T},reset:{placement:j}};let D=(z=T.filter(K=>K.overflows[0]<=0).sort((K,U)=>K.overflows[1]-U.overflows[1])[0])==null?void 0:z.placement;if(!D)switch(h){case"bestFit":{var $;let K=($=T.filter(U=>{if(C){let re=jo(U.placement);return re===v||re==="y"}return!0}).map(U=>[U.placement,U.overflows.filter(re=>re>0).reduce((re,Y)=>re+Y,0)]).sort((U,re)=>U[1]-re[1])[0])==null?void 0:$[0];K&&(D=K);break}case"initialPlacement":D=l;break}if(o!==D)return{reset:{placement:D}}}return{}}}};function wN(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function SN(t){return I6.some(e=>t[e]>=0)}var G6=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){let{rects:n,platform:r}=e,{strategy:o="referenceHidden",...i}=Ri(t,e);switch(o){case"referenceHidden":{let s=await r.detectOverflow(e,{...i,elementContext:"reference"}),l=wN(s,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:SN(l)}}}case"escaped":{let s=await r.detectOverflow(e,{...i,altBoundary:!0}),l=wN(s,n.floating);return{data:{escapedOffsets:l,escaped:SN(l)}}}default:return{}}}}},N2=new Set(["left","top"]);async function X6(t,e){let{placement:n,platform:r,elements:o}=t,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Ys(n),l=tu(n),a=jo(n)==="y",c=N2.has(s)?-1:1,u=i&&a?-1:1,d=Ri(e,t),{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 l&&typeof p=="number"&&(h=l==="end"?p*-1:p),a?{x:h*u,y:f*c}:{x:f*c,y:h*u}}var W6=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;let{x:o,y:i,placement:s,middlewareData:l}=e,a=await X6(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+a.x,y:i+a.y,data:{...a,placement:s}}}}},J6=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){let{x:n,y:r,placement:o,platform:i}=e,{mainAxis:s=!0,crossAxis:l=!1,limiter:a={fn:v=>{let{x:b,y:w}=v;return{x:b,y:w}}},...c}=Ri(t,e),u={x:n,y:r},d=await i.detectOverflow(e,c),f=jo(o),h=QS(f),p=u[h],m=u[f],y=(v,b)=>O2(b+d[v==="y"?"top":"left"],b,b-d[v==="y"?"bottom":"right"]);s&&(p=y(h,p)),l&&(m=y(f,m));let g=a.fn({...e,[h]:p,[f]:m});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[h]:s,[f]:l}}}}}},Q6=function(t){return t===void 0&&(t={}),{options:t,fn(e){var n,r;let{x:o,y:i,placement:s,rects:l,middlewareData:a}=e,{offset:c=0,mainAxis:u=!0,crossAxis:d=!0}=Ri(t,e),f={x:o,y:i},h=jo(s),p=QS(h),m=f[p],y=f[h],g=Ri(c,e),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:(n=g.mainAxis)!=null?n:0,crossAxis:(r=g.crossAxis)!=null?r:0};if(u){let S=p==="y"?"height":"width",C=l.reference[p]-l.floating[S]+v.mainAxis,x=l.reference[p]+l.reference[S]-v.mainAxis;m<C?m=C:m>x&&(m=x)}if(d){var b,w;let S=p==="y"?"width":"height",C=N2.has(Ys(s)),x=l.reference[h]-l.floating[S]+(C&&((b=a.offset)==null?void 0:b[h])||0)+(C?0:v.crossAxis),E=l.reference[h]+l.reference[S]+(C?0:((w=a.offset)==null?void 0:w[h])||0)-(C?v.crossAxis:0);y<x?y=x:y>E&&(y=E)}return{[p]:m,[h]:y}}}},Z6=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){let{placement:n,rects:r,platform:o,elements:i}=e,{apply:s=()=>{},...l}=Ri(t,e),a=await o.detectOverflow(e,l),c=Ys(n),u=tu(n),d=jo(n)==="y",{width:f,height:h}=r.floating,p,m;c==="top"||c==="bottom"?(p=c,m=u===(await(o.isRTL==null?void 0:o.isRTL(i.floating))?"start":"end")?"left":"right"):(m=c,p=u==="end"?"top":"bottom");let y=h-a.top-a.bottom,g=f-a.left-a.right,v=$s(h-a[p],y),b=$s(f-a[m],g),w=e.middlewareData.shift,S=!w,C=v,x=b;w!=null&&w.enabled.x&&(x=g),w!=null&&w.enabled.y&&(C=y),S&&!u&&(d?x=f-2*ki(a.left,a.right):C=h-2*ki(a.top,a.bottom)),await s({...e,availableWidth:x,availableHeight:C});let E=await o.getDimensions(i.floating);return f!==E.width||h!==E.height?{reset:{rects:!0}}:{}}}};function Cg(){return typeof window<"u"}function nu(t){return _2(t)?(t.nodeName||"").toLowerCase():"#document"}function Qn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Ni(t){var e;return(e=(_2(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function _2(t){return Cg()?t instanceof Node||t instanceof Qn(t).Node:!1}function Fo(t){return Cg()?t instanceof Element||t instanceof Qn(t).Element:!1}function Ks(t){return Cg()?t instanceof HTMLElement||t instanceof Qn(t).HTMLElement:!1}function xN(t){return!Cg()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Qn(t).ShadowRoot}function Eg(t){let{overflow:e,overflowX:n,overflowY:r,display:o}=$o(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&o!=="inline"&&o!=="contents"}function eF(t){return/^(table|td|th)$/.test(nu(t))}function Tg(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}var tF=/transform|translate|scale|rotate|perspective|filter/,nF=/paint|layout|strict|content/,Zl=t=>!!t&&t!=="none",aS;function tx(t){let e=Fo(t)?$o(t):t;return Zl(e.transform)||Zl(e.translate)||Zl(e.scale)||Zl(e.rotate)||Zl(e.perspective)||!nx()&&(Zl(e.backdropFilter)||Zl(e.filter))||tF.test(e.willChange||"")||nF.test(e.contain||"")}function rF(t){let e=ta(t);for(;Ks(e)&&!Mf(e);){if(tx(e))return e;if(Tg(e))return null;e=ta(e)}return null}function nx(){return aS==null&&(aS=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),aS}function Mf(t){return/^(html|body|#document)$/.test(nu(t))}function $o(t){return Qn(t).getComputedStyle(t)}function Ag(t){return Fo(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ta(t){if(nu(t)==="html")return t;let e=t.assignedSlot||t.parentNode||xN(t)&&t.host||Ni(t);return xN(e)?e.host:e}function I2(t){let e=ta(t);return Mf(e)?(t.ownerDocument||t).body:Ks(e)&&Eg(e)?e:I2(e)}function Rf(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);let o=I2(t),i=o===((r=t.ownerDocument)==null?void 0:r.body),s=Qn(o);if(i){let l=AS(s);return e.concat(s,s.visualViewport||[],Eg(o)?o:[],l&&n?Rf(l):[])}else return e.concat(o,Rf(o,[],n))}function AS(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function L2(t){let e=$o(t),n=parseFloat(e.width)||0,r=parseFloat(e.height)||0,o=Ks(t),i=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=mg(n)!==i||mg(r)!==s;return l&&(n=i,r=s),{width:n,height:r,$:l}}function rx(t){return Fo(t)?t:t.contextElement}function Wc(t){let e=rx(t);if(!Ks(e))return Mi(1);let n=e.getBoundingClientRect(),{width:r,height:o,$:i}=L2(e),s=(i?mg(n.width):n.width)/r,l=(i?mg(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}var oF=Mi(0);function z2(t){let e=Qn(t);return!nx()||!e.visualViewport?oF:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function iF(t,e,n){return e===void 0&&(e=!1),!!n&&e&&n===Qn(t)}function na(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);let o=t.getBoundingClientRect(),i=rx(t),s=Mi(1);e&&(r?Fo(r)&&(s=Wc(r)):s=Wc(t));let l=iF(i,n,r)?z2(i):Mi(0),a=(o.left+l.x)/s.x,c=(o.top+l.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i&&r){let f=Qn(i),h=Fo(r)?Qn(r):r,p=f,m=AS(p);for(;m&&h!==p;){let y=Wc(m),g=m.getBoundingClientRect(),v=$o(m),b=g.left+(m.clientLeft+parseFloat(v.paddingLeft))*y.x,w=g.top+(m.clientTop+parseFloat(v.paddingTop))*y.y;a*=y.x,c*=y.y,u*=y.x,d*=y.y,a+=b,c+=w,p=Qn(m),m=AS(p)}}return yg({width:u,height:d,x:a,y:c})}function kg(t,e){let n=Ag(t).scrollLeft;return e?e.left+n:na(Ni(t)).left+n}function U2(t,e){let n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-kg(t,n),o=n.top+e.scrollTop;return{x:r,y:o}}function sF(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t,i=o==="fixed",s=Ni(r),l=e?Tg(e.floating):!1;if(r===s||l&&i)return n;let a={scrollLeft:0,scrollTop:0},c=Mi(1),u=Mi(0),d=Ks(r);if((d||!i)&&((nu(r)!=="body"||Eg(s))&&(a=Ag(r)),d)){let h=na(r);c=Wc(r),u.x=h.x+r.clientLeft,u.y=h.y+r.clientTop}let f=s&&!d&&!i?U2(s,a):Mi(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-a.scrollLeft*c.x+u.x+f.x,y:n.y*c.y-a.scrollTop*c.y+u.y+f.y}}function lF(t){return t.getClientRects?Array.from(t.getClientRects()):[]}function aF(t){let e=Ag(t),n=t.ownerDocument.body,r=ki(t.scrollWidth,t.clientWidth,n.scrollWidth,n.clientWidth),o=ki(t.scrollHeight,t.clientHeight,n.scrollHeight,n.clientHeight),i=-e.scrollLeft+kg(t),s=-e.scrollTop;return $o(n).direction==="rtl"&&(i+=ki(t.clientWidth,n.clientWidth)-r),{width:r,height:o,x:i,y:s}}var cF=25;function uF(t,e,n){n===void 0&&(n="viewport");let r=n==="layoutViewport",o=Qn(t),i=Ni(t),s=o.visualViewport,l=i.clientWidth,a=i.clientHeight,c=0,u=0;if(s){let f=!nx()||e==="fixed";r?f||(c=-s.offsetLeft,u=-s.offsetTop):(l=s.width,a=s.height,f&&(c=s.offsetLeft,u=s.offsetTop))}if(kg(i)<=0){let f=i.ownerDocument,h=f.body,p=getComputedStyle(h),m=f.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,y=Math.abs(i.clientWidth-h.clientWidth-m),g=getComputedStyle(i).scrollbarGutter==="stable both-edges"?y/2:y;g<=cF&&(l-=g)}return{width:l,height:a,x:c,y:u}}function dF(t,e){let n=na(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,i=Wc(t),s=t.clientWidth*i.x,l=t.clientHeight*i.y,a=o*i.x,c=r*i.y;return{width:s,height:l,x:a,y:c}}function CN(t,e,n){let r;if(e==="viewport"||e==="layoutViewport")r=uF(t,n,e);else if(e==="document")r=aF(Ni(t));else if(Fo(e))r=dF(e,n);else{let o=z2(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return yg(r)}function fF(t,e){let n=e.get(t);if(n)return n;let r=Rf(t,[],!1).filter(l=>Fo(l)&&nu(l)!=="body"),o=null,i=$o(t).position==="fixed",s=i?ta(t):t;for(;Fo(s)&&!Mf(s);){let l=$o(s),a=tx(s),c=o?o.position:i?"fixed":"";!a&&(c==="fixed"||c==="absolute"&&l.position==="static")?r=r.filter(d=>d!==s):o=l,s=ta(s)}return e.set(t,r),r}function hF(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t,s=[...n==="clippingAncestors"?Tg(e)?[]:fF(e,this._c):[].concat(n),r],l=CN(e,s[0],o),a=l.top,c=l.right,u=l.bottom,d=l.left;for(let f=1;f<s.length;f++){let h=CN(e,s[f],o);a=ki(h.top,a),c=$s(h.right,c),u=$s(h.bottom,u),d=ki(h.left,d)}return{width:c-d,height:u-a,x:d,y:a}}function pF(t){let{width:e,height:n}=L2(t);return{width:e,height:n}}function mF(t,e,n){let r=Ks(e),o=Ni(e),i=n==="fixed",s=na(t,!0,i,e),l={scrollLeft:0,scrollTop:0},a=Mi(0);if((r||!i)&&((nu(e)!=="body"||Eg(o))&&(l=Ag(e)),r)){let f=na(e,!0,i,e);a.x=f.x+e.clientLeft,a.y=f.y+e.clientTop}!r&&o&&(a.x=kg(o));let c=o&&!r&&!i?U2(o,l):Mi(0),u=s.left+l.scrollLeft-a.x-c.x,d=s.top+l.scrollTop-a.y-c.y;return{x:u,y:d,width:s.width,height:s.height}}function cS(t){return $o(t).position==="static"}function EN(t,e){if(!Ks(t)||$o(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Ni(t)===n&&(n=n.ownerDocument.body),n}function B2(t,e){let n=Qn(t);if(Tg(t))return n;if(!Ks(t)){let o=ta(t);for(;o&&!Mf(o);){if(Fo(o)&&!cS(o))return o;o=ta(o)}return n}let r=EN(t,e);for(;r&&eF(r)&&cS(r);)r=EN(r,e);return r&&Mf(r)&&cS(r)&&!tx(r)?n:r||rF(t)||n}var gF=async function(t){let e=this.getOffsetParent||B2,n=this.getDimensions,r=await n(t.floating);return{reference:mF(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function yF(t){return $o(t).direction==="rtl"}var vF={convertOffsetParentRelativeRectToViewportRelativeRect:sF,getDocumentElement:Ni,getClippingRect:hF,getOffsetParent:B2,getElementRects:gF,getClientRects:lF,getDimensions:pF,getScale:Wc,isElement:Fo,isRTL:yF};function P2(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function bF(t,e,n){let r=null,o,i=Ni(t);function s(){var u;clearTimeout(o),(u=r)==null||u.disconnect(),r=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),s();let f=t.getBoundingClientRect(),{left:h,top:p,width:m,height:y}=f;if(u||e(),!m||!y)return;let g=eg(p),v=eg(i.clientWidth-(h+m)),b=eg(i.clientHeight-(p+y)),w=eg(h),C={rootMargin:-g+"px "+-v+"px "+-b+"px "+-w+"px",threshold:ki(0,$s(1,d))||1},x=!0;function E(A){let T=A[0].intersectionRatio;if(!P2(f,t.getBoundingClientRect()))return l();if(T!==d){if(!x)return l();T?l(!1,T):o=setTimeout(()=>{l(!1,1e-7)},1e3)}x=!1}try{r=new IntersectionObserver(E,{...C,root:i.ownerDocument})}catch{r=new IntersectionObserver(E,C)}r.observe(t)}let a=Qn(t),c=()=>l(n);return a.addEventListener("resize",c),l(!0),()=>{a.removeEventListener("resize",c),s()}}function wF(t,e,n,r){r===void 0&&(r={});let{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=r,c=rx(t),u=o||i?[...c?Rf(c):[],...e?Rf(e):[]]:[];u.forEach(g=>{o&&g.addEventListener("scroll",n),i&&g.addEventListener("resize",n)});let d=c&&l?bF(c,n,i):null,f=-1,h=null;s&&(h=new ResizeObserver(g=>{let[v]=g;v&&v.target===c&&h&&e&&(h.unobserve(e),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var b;(b=h)==null||b.observe(e)})),n()}),c&&!a&&h.observe(c),e&&h.observe(e));let p,m=a?na(t):null;a&&y();function y(){let g=na(t);m&&!P2(m,g)&&n(),m=g,p=requestAnimationFrame(y)}return n(),()=>{var g;u.forEach(v=>{o&&v.removeEventListener("scroll",n),i&&v.removeEventListener("resize",n)}),d?.(),(g=h)==null||g.disconnect(),h=null,a&&cancelAnimationFrame(p)}}var SF=W6,xF=J6,CF=K6,EF=Z6,TF=G6,TN=q6,AF=Q6,kF=(t,e,n)=>{let r=new Map,o=n??{},i={...vF,...o.platform,_c:r};return Y6(t,e,{...o,platform:i})},MF=typeof document<"u",RF=function(){},sg=MF?H2.useLayoutEffect:RF;function vg(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,o;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(!vg(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){let i=o[r];if(!(i==="_owner"&&t.$$typeof)&&!vg(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function j2(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function AN(t,e){let n=j2(t);return Math.round(e*n)/n}function uS(t){let e=Tt.useRef(t);return sg(()=>{e.current=t}),e}function OF(t){t===void 0&&(t={});let{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:l=!0,whileElementsMounted:a,open:c}=t,[u,d]=Tt.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[f,h]=Tt.useState(r);vg(f,r)||h(r);let[p,m]=Tt.useState(null),[y,g]=Tt.useState(null),v=Tt.useCallback(U=>{U!==C.current&&(C.current=U,m(U))},[]),b=Tt.useCallback(U=>{U!==x.current&&(x.current=U,g(U))},[]),w=i||p,S=s||y,C=Tt.useRef(null),x=Tt.useRef(null),E=Tt.useRef(u),A=a!=null,T=uS(a),_=uS(o),z=uS(c),$=Tt.useCallback(()=>{if(!C.current||!x.current)return;let U={placement:e,strategy:n,middleware:f};_.current&&(U.platform=_.current),kF(C.current,x.current,U).then(re=>{let Y={...re,isPositioned:z.current!==!1};I.current&&!vg(E.current,Y)&&(E.current=Y,V2.flushSync(()=>{d(Y)}))})},[f,e,n,_,z]);sg(()=>{c===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(U=>({...U,isPositioned:!1})))},[c]);let I=Tt.useRef(!1);sg(()=>(I.current=!0,()=>{I.current=!1}),[]),sg(()=>{if(w&&(C.current=w),S&&(x.current=S),w&&S){if(T.current)return T.current(w,S,$);$()}},[w,S,$,T,A]);let j=Tt.useMemo(()=>({reference:C,floating:x,setReference:v,setFloating:b}),[v,b]),D=Tt.useMemo(()=>({reference:w,floating:S}),[w,S]),K=Tt.useMemo(()=>{let U={position:n,left:0,top:0};if(!D.floating)return U;let re=AN(D.floating,u.x),Y=AN(D.floating,u.y);return l?{...U,transform:"translate("+re+"px, "+Y+"px)",...j2(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:re,top:Y}},[n,l,D.floating,u.x,u.y]);return Tt.useMemo(()=>({...u,update:$,refs:j,elements:D,floatingStyles:K}),[u,$,j,D,K])}var DF=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){let{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?TN({element:r.current,padding:o}).fn(n):{}:r?TN({element:r,padding:o}).fn(n):{}}}},NF=(t,e)=>{let n=SF(t);return{name:n.name,fn:n.fn,options:[t,e]}},_F=(t,e)=>{let n=xF(t);return{name:n.name,fn:n.fn,options:[t,e]}},IF=(t,e)=>({fn:AF(t).fn,options:[t,e]}),LF=(t,e)=>{let n=CF(t);return{name:n.name,fn:n.fn,options:[t,e]}},zF=(t,e)=>{let n=EF(t);return{name:n.name,fn:n.fn,options:[t,e]}},UF=(t,e)=>{let n=TF(t);return{name:n.name,fn:n.fn,options:[t,e]}},BF=(t,e)=>{let n=DF(t);return{name:n.name,fn:n.fn,options:[t,e]}},PF=Object.defineProperty,HF=(t,e)=>PF(t,"name",{value:e,configurable:!0});function $2(t){let[e,n]=F2.useState(void 0);return hn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});let r=0,o=new ResizeObserver(i=>{if(!Array.isArray(i)||!i.length)return;let s=i[0];window.cancelAnimationFrame(r),r=window.requestAnimationFrame(()=>{let l,a;if("borderBoxSize"in s){let c=s.borderBoxSize,u=Array.isArray(c)?c[0]:c;l=u.inlineSize,a=u.blockSize}else l=t.offsetWidth,a=t.offsetHeight;n({width:l,height:a})})});return o.observe(t,{box:"border-box"}),()=>{window.cancelAnimationFrame(r),o.unobserve(t)}}else n(void 0)},[t]),e}HF($2,"useSize");var VF=Object.defineProperty,Hs=(t,e)=>VF(t,"name",{value:e,configurable:!0}),kN={Partial:"partial",Always:"always"},MN={Optimized:"optimized",Always:"always"},Y2="Popper",[q2,Mg]=Ar(Y2),[jF,K2]=q2(Y2),G2=Hs(t=>{let{__scopePopper:e,children:n}=t,[r,o]=Tn.useState(null),[i,s]=Tn.useState(void 0);return(0,Jc.jsx)(jF,{scope:e,anchor:r,onAnchorChange:o,placementState:i,setPlacementState:s,children:n})},"Popper"),FF="PopperAnchor",X2=Tn.forwardRef(Hs(function(e,n){let{__scopePopper:r,virtualRef:o,...i}=e,s=K2(FF,r),l=Tn.useRef(null),a=s.onAnchorChange,c=Tn.useCallback(m=>{l.current=m,m&&a(m)},[a]),u=Je(n,c),d=Tn.useRef(null);Tn.useEffect(()=>{if(!o)return;let m=d.current;d.current=o.current,m!==d.current&&a(d.current)});let f=s.placementState&&Rg(s.placementState),h=f?.[0],p=f?.[1];return o?null:(0,Jc.jsx)(je.div,{"data-radix-popper-side":h,"data-radix-popper-align":p,...i,ref:u})},"PopperAnchor")),W2="PopperContent",[$F,doe]=q2(W2),J2=Tn.forwardRef(Hs(function(e,n){let{__scopePopper:r,side:o="bottom",sideOffset:i=0,align:s="center",alignOffset:l=0,arrowPadding:a=0,avoidCollisions:c=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=kN.Partial,hideWhenDetached:h=!1,updatePositionStrategy:p=MN.Optimized,onPlaced:m,...y}=e,g=K2(W2,r),[v,b]=Tn.useState(null),w=Je(n,b),[S,C]=Tn.useState(null),x=$2(S),E=x?.width??0,A=x?.height??0,T=o+(s!=="center"?"-"+s:""),_=typeof d=="number"?d:{top:0,right:0,bottom:0,left:0,...d},z=Array.isArray(u)?u:[u],$=z.length>0,I={padding:_,boundary:z.filter(Q2),altBoundary:$},{refs:j,floatingStyles:D,placement:K,isPositioned:U,middlewareData:re}=OF({strategy:"fixed",placement:T,whileElementsMounted:Hs((...li)=>wF(...li,{animationFrame:p===MN.Always}),"whileElementsMounted"),elements:{reference:g.anchor},middleware:[NF({mainAxis:i+A,alignmentAxis:l}),c&&_F({mainAxis:!0,crossAxis:!1,...f===kN.Partial?{limiter:IF()}:{},...I}),c&&LF({...I}),zF({...I,apply:Hs(({elements:li,rects:Ya,availableWidth:xd,availableHeight:fp})=>{let{width:kl,height:ai}=Ya.reference,Ln=li.floating.style;Ln.setProperty("--radix-popper-available-width",`${xd}px`),Ln.setProperty("--radix-popper-available-height",`${fp}px`),Ln.setProperty("--radix-popper-anchor-width",`${kl}px`),Ln.setProperty("--radix-popper-anchor-height",`${ai}px`)},"apply")}),S&&BF({element:S,padding:a}),YF({arrowWidth:E,arrowHeight:A}),h&&UF($?{strategy:"referenceHidden",...I}:{strategy:"referenceHidden",padding:I.padding,altBoundary:I.altBoundary})]}),Y=g.setPlacementState;hn(()=>(Y(K),()=>{Y(void 0)}),[K,Y]);let[ke,gt]=Rg(K),Dt=Tr(m);hn(()=>{U&&Dt?.()},[U,Dt]);let Co=re.arrow?.x,wn=re.arrow?.y,W=re.arrow?.centerOffset!==0,[Eo,si]=Tn.useState();return hn(()=>{v&&si(window.getComputedStyle(v).zIndex)},[v]),(0,Jc.jsx)("div",{ref:j.setFloating,"data-radix-popper-content-wrapper":"",style:{...D,transform:U?D.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Eo,"--radix-popper-transform-origin":[re.transformOrigin?.x,re.transformOrigin?.y].join(" "),...re.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:(0,Jc.jsx)($F,{scope:r,placedSide:ke,placedAlign:gt,onArrowChange:C,arrowX:Co,arrowY:wn,shouldHideArrow:W,children:(0,Jc.jsx)(je.div,{"data-side":ke,"data-align":gt,...y,ref:w,style:{...y.style,animation:U?y.style?.animation:"none"}})})})},"PopperContent"));function Q2(t){return t!==null}Hs(Q2,"isNotNull");var YF=Hs(t=>({name:"transformOrigin",options:t,fn(e){let{placement:n,rects:r,middlewareData:o}=e,s=o.arrow?.centerOffset!==0,l=s?0:t.arrowWidth,a=s?0:t.arrowHeight,[c,u]=Rg(n),d={start:"0%",center:"50%",end:"100%"}[u],f=(o.arrow?.x??0)+l/2,h=(o.arrow?.y??0)+a/2,p="",m="";return c==="bottom"?(p=s?d:`${f}px`,m=`${-a}px`):c==="top"?(p=s?d:`${f}px`,m=`${r.floating.height+a}px`):c==="right"?(p=`${-a}px`,m=s?d:`${h}px`):c==="left"&&(p=`${r.floating.width+a}px`,m=s?d:`${h}px`),{data:{x:p,y:m}}}}),"transformOrigin");function Rg(t){let[e,n="center"]=t.split("-");return[e,n]}Hs(Rg,"getSideAndAlignFromPlacement");var qF=Object.defineProperty,KF=(t,e)=>qF(t,"name",{value:e,configurable:!0}),Dg=Og.forwardRef(KF(function(e,n){let{container:r,...o}=e,[i,s]=Og.useState(!1);hn(()=>s(!0),[]);let l=r||i&&globalThis?.document?.body;return l?Z2.createPortal((0,e_.jsx)(je.div,{...o,ref:n}),l):null},"Portal")),GF=Object.defineProperty,Oi=(t,e)=>GF(t,"name",{value:e,configurable:!0});function n_(t,e){return t_.useReducer((n,r)=>e[n][r]??n,t)}Oi(n_,"useStateMachine");var Gs=Oi(t=>{let{present:e,children:n}=t,r=r_(e),o=typeof n=="function"?n({present:r.isPresent}):dn.Children.only(n),i=o_(r.ref,i_(o));return typeof n=="function"||r.isPresent?dn.cloneElement(o,{ref:i}):null},"Presence");function r_(t){let[e,n]=dn.useState(),r=dn.useRef(null),o=dn.useRef(t),i=dn.useRef("none"),s=dn.useRef(void 0),l=t?"mounted":"unmounted",[a,c]=n_(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return dn.useEffect(()=>{a==="mounted"?(i.current=s.current??Xc(r.current),s.current=void 0):i.current="none"},[a]),hn(()=>{let u=r.current,d=o.current;if(d!==t){let h=i.current,p=Xc(u);t?(s.current=p,c("MOUNT")):p==="none"||u?.display==="none"?c("UNMOUNT"):c(d&&h!==p?"ANIMATION_OUT":"UNMOUNT"),o.current=t}},[t,c]),hn(()=>{if(e){let u,d=e.ownerDocument.defaultView??window,f=Oi(p=>{let y=Xc(r.current).includes(CSS.escape(p.animationName));if(p.target===e&&y&&(c("ANIMATION_END"),!o.current)){let g=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},"handleAnimationEnd"),h=Oi(p=>{p.target===e&&(i.current=Xc(r.current))},"handleAnimationStart");return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:dn.useCallback(u=>{if(u){let d=getComputedStyle(u);r.current=d,s.current=Xc(d)}else r.current=null;n(u)},[])}}Oi(r_,"usePresence");function kS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}Oi(kS,"setRef");function o_(...t){let e=dn.useRef(t);return e.current=t,dn.useCallback(n=>{let r=e.current,o=!1,i=r.map(s=>{let l=kS(s,n);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let s=0;s<i.length;s++){let l=i[s];typeof l=="function"?l():kS(r[s],null)}}},[])}Oi(o_,"useStableComposedRefs");function Xc(t){return t?.animationName||"none"}Oi(Xc,"getAnimationName");function i_(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}Oi(i_,"getElementRef");var s_=!1,XF=Object.defineProperty,WF=(t,e)=>XF(t,"name",{value:e,configurable:!0}),RN=ru[" useEffectEvent ".trim().toString()],ON=ru[" useInsertionEffect ".trim().toString()];function l_(t){if(typeof RN=="function")return RN(t);let e=ru.useRef(()=>{throw new Error("Cannot call an event handler while rendering.")});return typeof ON=="function"?ON(()=>{e.current=t}):hn(()=>{e.current=t}),ru.useMemo(()=>((...n)=>e.current?.(...n)),[])}WF(l_,"useEffectEvent");var JF=Object.defineProperty,If=(t,e)=>JF(t,"name",{value:e,configurable:!0}),QF=Wr[" useInsertionEffect ".trim().toString()]||hn;function ou({prop:t,defaultProp:e,onChange:n=If(()=>{},"onChange"),caller:r}){let[o,i,s]=a_({defaultProp:e,onChange:n}),l=t!==void 0,a=l?t:o;if(s_){let u=Wr.useRef(t!==void 0);Wr.useEffect(()=>{let d=u.current;d!==l&&console.warn(`${r} is changing from ${d?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}let c=Wr.useCallback(u=>{if(l){let d=c_(u)?u(t):u;d!==t&&s.current?.(d)}else i(u)},[l,t,i,s]);return[a,c]}If(ou,"useControllableState");function a_({defaultProp:t,onChange:e}){let[n,r]=Wr.useState(t),o=Wr.useRef(n),i=Wr.useRef(e);return QF(()=>{i.current=e},[e]),Wr.useEffect(()=>{o.current!==n&&(i.current?.(n),o.current=n)},[n,o]),[n,r,i]}If(a_,"useUncontrolledState");function c_(t){return typeof t=="function"}If(c_,"isFunction");var DN=Symbol("RADIX:SYNC_STATE");function ZF(t,e,n,r){let{prop:o,defaultProp:i,onChange:s,caller:l}=e,a=o!==void 0,c=l_(s);if(s_){let y=ho.useRef(o!==void 0);ho.useEffect(()=>{let g=y.current;g!==a&&console.warn(`${l} is changing from ${g?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),y.current=a},[a,l])}let u=[{...n,state:i}];r&&u.push(r);let[d,f]=ho.useReducer((y,g)=>{if(g.type===DN)return{...y,state:g.state};let v=t(y,g);return a&&!Object.is(v.state,y.state)&&c(v.state),v},...u),h=d.state,p=ho.useRef(h);ho.useEffect(()=>{p.current!==h&&(p.current=h,a||c(h))},[h,p,a]);let m=ho.useMemo(()=>o!==void 0?{...d,state:o}:d,[d,o]);return ho.useEffect(()=>{a&&!Object.is(o,d.state)&&f({type:DN,state:o})},[o,d.state,a]),[m,f]}If(ZF,"useControllableStateReducer");var e7=Object.defineProperty,t7=(t,e)=>e7(t,"name",{value:e,configurable:!0}),n7=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),ox=u_.forwardRef(t7(function(e,n){return(0,d_.jsx)(je.span,{...e,ref:n,style:{...n7,...e.style}})},"VisuallyHidden")),r7=Object.defineProperty,Bt=(t,e)=>r7(t,"name",{value:e,configurable:!0}),[ix,foe]=Ar("Tooltip",[Mg]),sx=Mg(),o7="TooltipProvider",i7=700,MS="tooltip.open",[s7,lx]=ix(o7),l7=Bt(t=>{let{__scopeTooltip:e,delayDuration:n=i7,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:i}=t,s=ie.useRef(!0),l=ie.useRef(!1),a=ie.useRef(0);return ie.useEffect(()=>{let c=a.current;return()=>window.clearTimeout(c)},[]),(0,Jt.jsx)(s7,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:ie.useCallback(()=>{r<=0||(window.clearTimeout(a.current),s.current=!1)},[r]),onClose:ie.useCallback(()=>{r<=0||(window.clearTimeout(a.current),a.current=window.setTimeout(()=>s.current=!0,r))},[r]),isPointerInTransitRef:l,onPointerInTransitChange:ie.useCallback(c=>{l.current=c},[]),disableHoverableContent:o,children:i})},"TooltipProvider"),RS="Tooltip",[a7,Lf]=ix(RS),c7=Bt(t=>{let{__scopeTooltip:e,children:n,open:r,defaultOpen:o,onOpenChange:i,disableHoverableContent:s,delayDuration:l}=t,a=lx(RS,t.__scopeTooltip),c=sx(e),[u,d]=ie.useState(null),[f,h]=ie.useState(void 0),p=Ps(),m=ie.useRef(0),y=s??a.disableHoverableContent,g=l??a.delayDuration,v=ie.useRef(!1),[b,w]=ou({prop:r,defaultProp:o??!1,onChange:Bt(T=>{T?(a.onOpen(),document.dispatchEvent(new CustomEvent(MS))):a.onClose(),i?.(T)},"onChange"),caller:RS}),S=ie.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),C=ie.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,w(!0)},[w]),x=ie.useCallback(()=>{window.clearTimeout(m.current),m.current=0,w(!1)},[w]),E=ie.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,w(!0),m.current=0},g)},[g,w]);return ie.useEffect(()=>()=>{m.current&&(window.clearTimeout(m.current),m.current=0)},[]),(0,Jt.jsx)(G2,{...c,children:(0,Jt.jsx)(a7,{scope:e,contentId:f??p,setContentId:h,open:b,stateAttribute:S,trigger:u,onTriggerChange:d,onTriggerEnter:ie.useCallback(()=>{a.isOpenDelayedRef.current?E():C()},[a.isOpenDelayedRef,E,C]),onTriggerLeave:ie.useCallback(()=>{y?x():(window.clearTimeout(m.current),m.current=0)},[x,y]),onOpen:C,onClose:x,disableHoverableContent:y,children:n})})},"Tooltip"),NN="TooltipTrigger",u7=ie.forwardRef(Bt(function(e,n){let{__scopeTooltip:r,"aria-describedby":o,...i}=e,s=Lf(NN,r),l=lx(NN,r),a=sx(r),c=ie.useRef(null),u=Je(n,c,s.onTriggerChange),d=ie.useRef(!1),f=ie.useRef(!1),h=ie.useCallback(()=>d.current=!1,[]);return ie.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),(0,Jt.jsx)(X2,{asChild:!0,...a,children:(0,Jt.jsx)(je.button,{"aria-describedby":s.open?w_(o,s.contentId):o,"data-state":s.stateAttribute,...i,ref:u,onPointerMove:ee(e.onPointerMove,p=>{p.pointerType!=="touch"&&!f.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),f.current=!0)}),onPointerLeave:ee(e.onPointerLeave,()=>{s.onTriggerLeave(),f.current=!1}),onPointerDown:ee(e.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:ee(e.onFocus,()=>{d.current||s.onOpen()}),onBlur:ee(e.onBlur,s.onClose),onClick:ee(e.onClick,s.onClose)})})},"TooltipTrigger")),f_="TooltipPortal",[d7,f7]=ix(f_,{forceMount:void 0}),h7=Bt(t=>{let{__scopeTooltip:e,forceMount:n,children:r,container:o}=t,i=Lf(f_,e);return(0,Jt.jsx)(d7,{scope:e,forceMount:n,children:(0,Jt.jsx)(Gs,{present:n||i.open,children:(0,Jt.jsx)(Dg,{asChild:!0,container:o,children:r})})})},"TooltipPortal"),Of="TooltipContent",p7=ie.forwardRef(Bt(function(e,n){let r=f7(Of,e.__scopeTooltip),{forceMount:o=r.forceMount,side:i="top",...s}=e,l=Lf(Of,e.__scopeTooltip);return(0,Jt.jsx)(Gs,{present:o||l.open,children:l.disableHoverableContent?(0,Jt.jsx)(h_,{side:i,...s,ref:n}):(0,Jt.jsx)(m7,{side:i,...s,ref:n})})},"TooltipContent")),m7=ie.forwardRef(Bt(function(e,n){let r=Lf(Of,e.__scopeTooltip),o=lx(Of,e.__scopeTooltip),i=ie.useRef(null),s=Je(n,i),[l,a]=ie.useState(null),{trigger:c,onClose:u}=r,d=i.current,{onPointerInTransitChange:f}=o,h=ie.useCallback(()=>{a(null),f(!1)},[f]),p=ie.useCallback((m,y)=>{let g=m.currentTarget,v={x:m.clientX,y:m.clientY},b=p_(v,g.getBoundingClientRect()),w=m_(v,b),S=g_(y.getBoundingClientRect()),C=v_([...w,...S]);a(C),f(!0)},[f]);return ie.useEffect(()=>()=>h(),[h]),ie.useEffect(()=>{if(c&&d){let m=Bt(g=>p(g,d),"handleTriggerLeave"),y=Bt(g=>p(g,c),"handleContentLeave");return c.addEventListener("pointerleave",m),d.addEventListener("pointerleave",y),()=>{c.removeEventListener("pointerleave",m),d.removeEventListener("pointerleave",y)}}},[c,d,p,h]),ie.useEffect(()=>{if(l){let m=Bt(y=>{let g=y.target,v={x:y.clientX,y:y.clientY},b=c?.contains(g)||d?.contains(g),w=!y_(v,l);b?h():w&&(h(),u())},"handleTrackPointerGrace");return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[c,d,l,u,h]),(0,Jt.jsx)(h_,{...e,ref:s})},"TooltipContentHoverable")),g7=u2("TooltipContent"),h_=ie.forwardRef(Bt(function(e,n){let{__scopeTooltip:r,children:o,"aria-label":i,id:s,onEscapeKeyDown:l,onPointerDownOutside:a,...c}=e,u=Lf(Of,r),d=sx(r),{onClose:f}=u,[h,p]=ie.useState(null),m=Je(n,p);XS(h),ie.useEffect(()=>(document.addEventListener(MS,f),()=>document.removeEventListener(MS,f)),[f]),ie.useEffect(()=>{if(u.trigger){let g=Bt(v=>{v.target instanceof Node&&v.target.contains(u.trigger)&&f()},"handleScroll");return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[u.trigger,f]);let{setContentId:y}=u;return hn(()=>(y(s),()=>{y(void 0)}),[s,y]),(0,Jt.jsx)(xg,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:a,onFocusOutside:g=>g.preventDefault(),onDismiss:f,children:(0,Jt.jsxs)(J2,{"data-state":u.stateAttribute,role:i?void 0:"tooltip",id:i?void 0:u.contentId,...d,...c,ref:m,style:{...c.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[(0,Jt.jsx)(g7,{children:o}),i?(0,Jt.jsx)(ox,{id:u.contentId,role:"tooltip",children:i}):null]})})},"TooltipContentImpl"));function p_(t,e){let n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,o,i)){case i:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}Bt(p_,"getExitSideFromRect");function m_(t,e,n=5){let r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}Bt(m_,"getPaddedExitPoints");function g_(t){let{top:e,right:n,bottom:r,left:o}=t;return[{x:o,y:e},{x:n,y:e},{x:n,y:r},{x:o,y:r}]}Bt(g_,"getPointsFromRect");function y_(t,e){let{x:n,y:r}=t,o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}Bt(y_,"isPointInPolygon");function v_(t){let e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),b_(e)}Bt(v_,"getHull");function b_(t){if(t.length<=1)return t.slice();let e=[];for(let r=0;r<t.length;r++){let o=t[r];for(;e.length>=2;){let i=e[e.length-1],s=e[e.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))e.pop();else break}e.push(o)}e.pop();let n=[];for(let r=t.length-1;r>=0;r--){let o=t[r];for(;n.length>=2;){let i=n[n.length-1],s=n[n.length-2];if((i.x-s.x)*(o.y-s.y)>=(i.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}Bt(b_,"getHullPresorted");function w_(...t){let e=new Set;for(let n of t)if(typeof n=="string")for(let r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}Bt(w_,"concatAriaDescribedby");var S_=(0,Ng.createContext)(!1);function ax({children:t,delayDuration:e=300}){return(0,Ai.jsx)(S_.Provider,{value:!0,children:(0,Ai.jsx)(l7,{delayDuration:e,skipDelayDuration:150,children:t})})}function y7({content:t,children:e,side:n="top"}){let r=(0,Ng.useContext)(S_),o=(0,Ai.jsxs)(c7,{children:[(0,Ai.jsx)(u7,{asChild:!0,children:e}),(0,Ai.jsx)(h7,{children:(0,Ai.jsx)(p7,{className:"ad-tooltip",side:n,sideOffset:6,children:t})})]});return r?o:(0,Ai.jsx)(ax,{children:o})}var Pt=(0,wg.forwardRef)(function({variant:e="secondary",size:n="md",loading:r=!1,type:o="button",className:i,children:s,onClick:l,...a},c){return(0,qs.jsxs)("button",{ref:c,type:o,className:Yo("ad-button",`ad-button--${e}`,`ad-button--${n}`,i),onClick:u=>r?u.preventDefault():l?.(u),...a,"aria-busy":r||void 0,"aria-disabled":r||a["aria-disabled"],children:[r&&(0,qs.jsx)("span",{className:"ad-spinner","aria-hidden":"true"}),s,r&&(0,qs.jsx)("span",{className:"ad-sr-only",children:", loading"})]})}),v7=(0,wg.forwardRef)(function(e,n){let r=e["aria-describedby"]?.split(" ").filter(o=>!o.startsWith("radix-")).join(" ");return(0,qs.jsx)(Pt,{ref:n,...e,"aria-describedby":r||void 0})}),ra=(0,wg.forwardRef)(function({label:e,icon:n,tooltip:r=!0,variant:o="ghost",className:i,...s},l){if(e.trim()==="")throw new Error("IconButton needs a non-empty label.");let a=(0,qs.jsx)(v7,{ref:l,variant:o,className:Yo("ad-icon-button",i),...s,"aria-label":s.loading?`${e}, loading`:e,children:s.loading?null:n});return r?(0,qs.jsx)(y7,{content:e,children:a}):a});function mo(t){let{d:e,...n}=t;return(0,Zn.jsx)("svg",{viewBox:"0 0 20 20",width:"1.25em",height:"1.25em",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",...n,children:(0,Zn.jsx)("path",{d:e})})}var x_=t=>(0,Zn.jsx)(mo,{d:"M5 5l10 10M15 5L5 15",...t}),C_=t=>(0,Zn.jsx)(mo,{d:"M10 6v5M10 14h.01M10 2.5l8 14H2z",...t}),b7=t=>(0,Zn.jsx)(mo,{d:"M4 10.5l4 4 8-9",...t}),E_=t=>(0,Zn.jsx)(mo,{d:"M10 4v12M4 10h12",...t}),T_=t=>(0,Zn.jsx)(mo,{d:"M4.5 10h.01M10 10h.01M15.5 10h.01",strokeWidth:"3",...t}),w7=t=>(0,Zn.jsx)(mo,{d:"M10 9v5M10 6h.01M10 2.5a7.5 7.5 0 100 15 7.5 7.5 0 000-15z",...t}),S7=t=>(0,Zn.jsx)(mo,{d:"M3.5 5.5h13M3.5 10h13M3.5 14.5h13",...t}),x7=t=>(0,Zn.jsx)(mo,{d:"M5 2.5h6l4 4v11H5zM11 2.5v4h4",...t}),C7=t=>(0,Zn.jsx)(mo,{d:"M2.5 5.5h5l1.5 2h8.5v8h-15z",...t}),E7=t=>(0,Zn.jsx)(mo,{d:"M4 7.5h12v8a1 1 0 01-1 1H5a1 1 0 01-1-1zM10 7.5v-3M7.5 11.5h.01M12.5 11.5h.01",...t}),T7=t=>(0,Zn.jsx)(mo,{d:"M7.5 7.5l5 5M12.5 7.5l-5 5M10 2.5a7.5 7.5 0 100 15 7.5 7.5 0 000-15z",...t});function _g(t,{label:e,hint:n,error:r}){if(e==null||e===!1||typeof e=="string"&&e.trim()==="")throw new Error("A field needs a non-empty label.");let o=(0,Xs.useId)(),i=t||o,s=n?`${i}-hint`:void 0,l=r?`${i}-error`:void 0;return{id:i,hintId:s,errorId:l,control:{id:i,"aria-describedby":[s,l].filter(Boolean).join(" ")||void 0,"aria-invalid":r?!0:void 0}}}function zf(t,e){return[t,e].filter(Boolean).join(" ")||void 0}function A7({hintId:t,errorId:e,hint:n,error:r}){return(0,_e.jsxs)(_e.Fragment,{children:[n&&(0,_e.jsx)("p",{id:t,className:"ad-field__hint",children:n}),r&&(0,_e.jsxs)("p",{id:e,className:"ad-field__error",role:"alert",children:[(0,_e.jsx)(C_,{}),r]})]})}function cx({id:t,label:e,hideLabel:n,required:r,children:o,...i}){return(0,_e.jsxs)("div",{className:"ad-field",children:[(0,_e.jsxs)("label",{className:Yo("ad-field__label",n&&"ad-sr-only"),htmlFor:t,children:[e,r&&(0,_e.jsx)("span",{"aria-hidden":"true",children:" *"})]}),o,(0,_e.jsx)(A7,{...i})]})}var Ws=(0,Xs.forwardRef)(function({label:e,hint:n,error:r,className:o,id:i,...s},l){let a=_g(i,{label:e,hint:n,error:r});return(0,_e.jsx)(cx,{...a,label:e,hint:n,error:r,required:s.required,children:(0,_e.jsx)("input",{ref:l,className:Yo("ad-input",o),...s,...a.control,"aria-describedby":zf(a.control["aria-describedby"],s["aria-describedby"]),"aria-invalid":a.control["aria-invalid"]??s["aria-invalid"]})})}),hoe=(0,Xs.forwardRef)(function({label:e,hint:n,error:r,className:o,id:i,...s},l){let a=_g(i,{label:e,hint:n,error:r});return(0,_e.jsx)(cx,{...a,label:e,hint:n,error:r,required:s.required,children:(0,_e.jsx)("textarea",{ref:l,className:Yo("ad-input ad-textarea",o),...s,...a.control,"aria-describedby":zf(a.control["aria-describedby"],s["aria-describedby"]),"aria-invalid":a.control["aria-invalid"]??s["aria-invalid"]})})}),A_=(0,Xs.forwardRef)(function({label:e,hideLabel:n,hint:r,error:o,className:i,id:s,children:l,...a},c){let u=_g(s,{label:e,hint:r,error:o});return(0,_e.jsx)(cx,{...u,label:e,hideLabel:n,hint:r,error:o,required:a.required,children:(0,_e.jsx)("span",{className:"ad-select",children:(0,_e.jsx)("select",{ref:c,className:Yo("ad-input",i),...a,...u.control,"aria-describedby":zf(u.control["aria-describedby"],a["aria-describedby"]),"aria-invalid":u.control["aria-invalid"]??a["aria-invalid"],children:l})})})});function k_(t,e,n){let{id:r,hintId:o,control:i}=_g(t,{label:e,hint:n});return{id:r,hintId:o,describedBy:i["aria-describedby"]}}var poe=(0,Xs.forwardRef)(function({label:e,hint:n,className:r,id:o,...i},s){let{id:l,hintId:a,describedBy:c}=k_(o,e,n);return(0,_e.jsxs)("div",{className:"ad-toggle",children:[(0,_e.jsxs)("label",{className:"ad-toggle__row",htmlFor:l,children:[(0,_e.jsx)("input",{ref:s,id:l,type:"checkbox",className:Yo("ad-checkbox",r),...i,"aria-describedby":zf(c,i["aria-describedby"])}),(0,_e.jsx)("span",{children:e})]}),n&&(0,_e.jsx)("p",{id:a,className:"ad-field__hint",children:n})]})}),moe=(0,Xs.forwardRef)(function({label:e,hint:n,className:r,id:o,...i},s){let{id:l,hintId:a,describedBy:c}=k_(o,e,n);return(0,_e.jsxs)("div",{className:"ad-toggle",children:[(0,_e.jsxs)("label",{className:"ad-toggle__row",htmlFor:l,children:[(0,_e.jsx)("input",{ref:s,id:l,type:"checkbox",role:"switch",className:Yo("ad-switch",r),...i,"aria-describedby":zf(c,i["aria-describedby"])}),(0,_e.jsx)("span",{children:e})]}),n&&(0,_e.jsx)("p",{id:a,className:"ad-field__hint",children:n})]})}),k7=Object.defineProperty,ux=(t,e)=>k7(t,"name",{value:e,configurable:!0}),tg=0,Yc=null;function M7(t){return Ig(),t.children}ux(M7,"FocusGuards");function Ig(){M_.useEffect(()=>{Yc||(Yc={start:OS(),end:OS()});let{start:t,end:e}=Yc;return document.body.firstElementChild!==t&&document.body.insertAdjacentElement("afterbegin",t),document.body.lastElementChild!==e&&document.body.insertAdjacentElement("beforeend",e),tg++,()=>{tg===1&&(Yc?.start.remove(),Yc?.end.remove(),Yc=null),tg=Math.max(0,tg-1)}},[])}ux(Ig,"useFocusGuards");function OS(){let t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}ux(OS,"createFocusGuard");var Vo=function(){return Vo=Object.assign||function(e){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Vo.apply(this,arguments)};function R_(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(t);o<r.length;o++)e.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(n[r[o]]=t[r[o]]);return n}function R7(t,e,n){if(n||arguments.length===2)for(var r=0,o=e.length,i;r<o;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var lg="right-scroll-bar-position",ag="width-before-scroll-bar",O7="with-scroll-bars-hidden",D7="--removed-body-scroll-bar-size";function dS(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function N7(t,e){var n=(0,O_.useState)(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=e,n.facade}var _7=typeof window<"u"?zg.useLayoutEffect:zg.useEffect,_N=new WeakMap;function I7(t,e){var n=N7(e||null,function(r){return t.forEach(function(o){return dS(o,r)})});return _7(function(){var r=_N.get(n);if(r){var o=new Set(r),i=new Set(t),s=n.current;o.forEach(function(l){i.has(l)||dS(l,null)}),i.forEach(function(l){o.has(l)||dS(l,s)})}_N.set(n,t)},[t]),n}function L7(t){return t}function z7(t,e){e===void 0&&(e=L7);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var s=e(i,r);return n.push(s),function(){n=n.filter(function(l){return l!==s})}},assignSyncMedium:function(i){for(r=!0;n.length;){var s=n;n=[],s.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var s=[];if(n.length){var l=n;n=[],l.forEach(i),s=n}var a=function(){var u=s;s=[],u.forEach(i)},c=function(){return Promise.resolve().then(a)};c(),n={push:function(u){s.push(u),c()},filter:function(u){return s=s.filter(u),n}}}};return o}function U7(t){t===void 0&&(t={});var e=z7(null);return e.options=Vo({async:!0,ssr:!1},t),e}var N_=function(t){var e=t.sideCar,n=R_(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return D_.createElement(r,Vo({},n))};N_.isSideCarExport=!0;function B7(t,e){return t.useMedium(e),N_}var __=U7(),fS=function(){},Ug=An.forwardRef(function(t,e){var n=An.useRef(null),r=An.useState({onScrollCapture:fS,onWheelCapture:fS,onTouchMoveCapture:fS}),o=r[0],i=r[1],s=t.forwardProps,l=t.children,a=t.className,c=t.removeScrollBar,u=t.enabled,d=t.shards,f=t.sideCar,h=t.noRelative,p=t.noIsolation,m=t.inert,y=t.allowPinchZoom,g=t.as,v=g===void 0?"div":g,b=t.gapMode,w=R_(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=f,C=I7([n,e]),x=Vo(Vo({},w),o);return An.createElement(An.Fragment,null,u&&An.createElement(S,{sideCar:__,removeScrollBar:c,shards:d,noRelative:h,noIsolation:p,inert:m,setCallbacks:i,allowPinchZoom:!!y,lockRef:n,gapMode:b}),s?An.cloneElement(An.Children.only(l),Vo(Vo({},x),{ref:C})):An.createElement(v,Vo({},x,{className:a,ref:C}),l))});Ug.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Ug.classNames={fullWidth:ag,zeroRight:lg};var IN,P7=function(){if(IN)return IN;if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function H7(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=P7();return e&&t.setAttribute("nonce",e),t}function V7(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function j7(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var F7=function(){var t=0,e=null;return{add:function(n){t==0&&(e=H7())&&(V7(e,n),j7(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},$7=function(){var t=F7();return function(e,n){I_.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},L_=function(){var t=$7(),e=function(n){var r=n.styles,o=n.dynamic;return t(r,o),null};return e},Y7={left:0,top:0,right:0,gap:0},hS=function(t){return parseInt(t||"",10)||0},q7=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],o=e[t==="padding"?"paddingRight":"marginRight"];return[hS(n),hS(r),hS(o)]},K7=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Y7;var e=q7(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},G7=L_(),Qc="data-scroll-locked",X7=function(t,e,n,r){var o=t.left,i=t.top,s=t.right,l=t.gap;return n===void 0&&(n="margin"),`
|
|
10
|
+
.`.concat(O7,` {
|
|
11
|
+
overflow: hidden `).concat(r,`;
|
|
12
|
+
padding-right: `).concat(l,"px ").concat(r,`;
|
|
13
|
+
}
|
|
14
|
+
body[`).concat(Qc,`] {
|
|
15
|
+
overflow: hidden `).concat(r,`;
|
|
16
|
+
overscroll-behavior: contain;
|
|
17
|
+
`).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
|
|
18
|
+
padding-left: `.concat(o,`px;
|
|
19
|
+
padding-top: `).concat(i,`px;
|
|
20
|
+
padding-right: `).concat(s,`px;
|
|
21
|
+
margin-left:0;
|
|
22
|
+
margin-top:0;
|
|
23
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
24
|
+
`),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.`).concat(lg,` {
|
|
28
|
+
right: `).concat(l,"px ").concat(r,`;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.`).concat(ag,` {
|
|
32
|
+
margin-right: `).concat(l,"px ").concat(r,`;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.`).concat(lg," .").concat(lg,` {
|
|
36
|
+
right: 0 `).concat(r,`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.`).concat(ag," .").concat(ag,` {
|
|
40
|
+
margin-right: 0 `).concat(r,`;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
body[`).concat(Qc,`] {
|
|
44
|
+
`).concat(D7,": ").concat(l,`px;
|
|
45
|
+
}
|
|
46
|
+
`)},LN=function(){var t=parseInt(document.body.getAttribute(Qc)||"0",10);return isFinite(t)?t:0},W7=function(){iu.useEffect(function(){return document.body.setAttribute(Qc,(LN()+1).toString()),function(){var t=LN()-1;t<=0?document.body.removeAttribute(Qc):document.body.setAttribute(Qc,t.toString())}},[])},J7=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,o=r===void 0?"margin":r;W7();var i=iu.useMemo(function(){return K7(o)},[o]);return iu.createElement(G7,{styles:X7(i,!e,o,n?"":"!important")})},DS=!1;if(typeof window<"u")try{Af=Object.defineProperty({},"passive",{get:function(){return DS=!0,!0}}),window.addEventListener("test",Af,Af),window.removeEventListener("test",Af,Af)}catch{DS=!1}var Af,qc=DS?{passive:!1}:!1,Q7=function(t){return t.tagName==="TEXTAREA"},z_=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Q7(t)&&n[e]==="visible")},Z7=function(t){return z_(t,"overflowY")},e$=function(t){return z_(t,"overflowX")},zN=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=U_(t,r);if(o){var i=B_(t,r),s=i[1],l=i[2];if(s>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},t$=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},n$=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},U_=function(t,e){return t==="v"?Z7(e):e$(e)},B_=function(t,e){return t==="v"?t$(e):n$(e)},r$=function(t,e){return t==="h"&&e==="rtl"?-1:1},o$=function(t,e,n,r,o){var i=r$(t,window.getComputedStyle(e).direction),s=i*r,l=n.target,a=e.contains(l),c=!1,u=s>0,d=0,f=0;do{if(!l)break;var h=B_(t,l),p=h[0],m=h[1],y=h[2],g=m-y-i*p;(p||g)&&U_(t,l)&&(d+=g,f+=p);var v=l.parentNode;l=v&&v.nodeType===Node.DOCUMENT_FRAGMENT_NODE?v.host:v}while(!a&&l!==document.body||a&&(e.contains(l)||e===l));return(u&&(o&&Math.abs(d)<1||!o&&s>d)||!u&&(o&&Math.abs(f)<1||!o&&-s>f))&&(c=!0),c},ng=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},UN=function(t){return[t.deltaX,t.deltaY]},BN=function(t){return t&&"current"in t?t.current:t},i$=function(t,e){return t[0]===e[0]&&t[1]===e[1]},s$=function(t){return`
|
|
47
|
+
.block-interactivity-`.concat(t,` {pointer-events: none;}
|
|
48
|
+
.allow-interactivity-`).concat(t,` {pointer-events: all;}
|
|
49
|
+
`)},l$=0,Kc=[];function a$(t){var e=Qe.useRef([]),n=Qe.useRef([0,0]),r=Qe.useRef(),o=Qe.useState(l$++)[0],i=Qe.useState(L_)[0],s=Qe.useRef(t);Qe.useEffect(function(){s.current=t},[t]),Qe.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(o));var m=R7([t.lockRef.current],(t.shards||[]).map(BN),!0).filter(Boolean);return m.forEach(function(y){return y.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),m.forEach(function(y){return y.classList.remove("allow-interactivity-".concat(o))})}}},[t.inert,t.lockRef.current,t.shards]);var l=Qe.useCallback(function(m,y){if("touches"in m&&m.touches.length===2||m.type==="wheel"&&m.ctrlKey)return!s.current.allowPinchZoom;var g=ng(m),v=n.current,b="deltaX"in m?m.deltaX:v[0]-g[0],w="deltaY"in m?m.deltaY:v[1]-g[1],S,C=m.target,x=Math.abs(b)>Math.abs(w)?"h":"v";if("touches"in m&&x==="h"&&C.type==="range")return!1;var E=window.getSelection(),A=E&&E.anchorNode,T=A?A===C||A.contains(C):!1;if(T)return!1;var _=zN(x,C);if(!_)return!0;if(_?S=x:(S=x==="v"?"h":"v",_=zN(x,C)),!_)return!1;if(!r.current&&"changedTouches"in m&&(b||w)&&(r.current=S),!S)return!0;var z=r.current||S;return o$(z,y,m,z==="h"?b:w,!0)},[]),a=Qe.useCallback(function(m){var y=m;if(!(!Kc.length||Kc[Kc.length-1]!==i)){var g="deltaY"in y?UN(y):ng(y),v=e.current.filter(function(S){return S.name===y.type&&(S.target===y.target||y.target===S.shadowParent)&&i$(S.delta,g)})[0];if(v&&v.should){y.cancelable&&y.preventDefault();return}if(!v){var b=(s.current.shards||[]).map(BN).filter(Boolean).filter(function(S){return S.contains(y.target)}),w=b.length>0?l(y,b[0]):!s.current.noIsolation;w&&y.cancelable&&y.preventDefault()}}},[]),c=Qe.useCallback(function(m,y,g,v){var b={name:m,delta:y,target:g,should:v,shadowParent:c$(g)};e.current.push(b),setTimeout(function(){e.current=e.current.filter(function(w){return w!==b})},1)},[]),u=Qe.useCallback(function(m){n.current=ng(m),r.current=void 0},[]),d=Qe.useCallback(function(m){c(m.type,UN(m),m.target,l(m,t.lockRef.current))},[]),f=Qe.useCallback(function(m){c(m.type,ng(m),m.target,l(m,t.lockRef.current))},[]);Qe.useEffect(function(){return Kc.push(i),t.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener("wheel",a,qc),document.addEventListener("touchmove",a,qc),document.addEventListener("touchstart",u,qc),function(){Kc=Kc.filter(function(m){return m!==i}),document.removeEventListener("wheel",a,qc),document.removeEventListener("touchmove",a,qc),document.removeEventListener("touchstart",u,qc)}},[]);var h=t.removeScrollBar,p=t.inert;return Qe.createElement(Qe.Fragment,null,p?Qe.createElement(i,{styles:s$(o)}):null,h?Qe.createElement(J7,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function c$(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}var u$=B7(__,a$),P_=Lg.forwardRef(function(t,e){return Lg.createElement(Ug,Vo({},t,{ref:e,sideCar:u$}))});P_.classNames=Ug.classNames;var H_=P_,d$=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},Gc=new WeakMap,rg=new WeakMap,og={},pS=0,V_=function(t){return t&&(t.host||V_(t.parentNode))},f$=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=V_(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},h$=function(t,e,n,r){var o=f$(e,Array.isArray(t)?t:[t]);og[n]||(og[n]=new WeakMap);var i=og[n],s=[],l=new Set,a=new Set(o),c=function(d){!d||l.has(d)||(l.add(d),c(d.parentNode))};o.forEach(c);var u=function(d){!d||a.has(d)||Array.prototype.forEach.call(d.children,function(f){if(l.has(f))u(f);else try{var h=f.getAttribute(r),p=h!==null&&h!=="false",m=(Gc.get(f)||0)+1,y=(i.get(f)||0)+1;Gc.set(f,m),i.set(f,y),s.push(f),m===1&&p&&rg.set(f,!0),y===1&&f.setAttribute(n,"true"),p||f.setAttribute(r,"true")}catch(g){console.error("aria-hidden: cannot operate on ",f,g)}})};return u(e),l.clear(),pS++,function(){s.forEach(function(d){var f=Gc.get(d)-1,h=i.get(d)-1;Gc.set(d,f),i.set(d,h),f||(rg.has(d)||d.removeAttribute(r),rg.delete(d)),h||d.removeAttribute(n)}),pS--,pS||(Gc=new WeakMap,Gc=new WeakMap,rg=new WeakMap,og={})}},j_=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),o=e||d$(t);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),h$(r,o,n,"aria-hidden")):function(){return null}},p$=Object.defineProperty,tr=(t,e)=>p$(t,"name",{value:e,configurable:!0}),dx="Dialog",[F_,goe]=Ar(dx),[m$,go]=F_(dx),g$=tr(t=>{let{__scopeDialog:e,children:n,open:r,defaultOpen:o,onOpenChange:i,modal:s=!0}=t,l=ze.useRef(null),a=ze.useRef(null),{nodes:c,registry:u}=GS(),[d,f]=ou({prop:r,defaultProp:o??!1,onChange:i,caller:dx}),[h,p]=ze.useState(0),[m,y]=ze.useState(0);return(0,vt.jsx)(m$,{scope:e,triggerRef:l,contentRef:a,contentId:Ps(),titleId:Ps(),descriptionId:Ps(),titlePresent:h>0,descriptionPresent:m>0,setTitleCount:p,setDescriptionCount:y,open:d,onOpenChange:f,onOpenToggle:ze.useCallback(()=>f(g=>!g),[f]),modal:s,branchNodes:c,branchRegistry:u,children:n})},"Dialog"),y$="DialogTrigger",v$=ze.forwardRef(tr(function(e,n){let{__scopeDialog:r,...o}=e,i=go(y$,r),s=Je(n,i.triggerRef);return(0,vt.jsx)(je.button,{type:"button","aria-haspopup":"dialog","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":Bg(i.open),...o,ref:s,onClick:ee(e.onClick,i.onOpenToggle)})},"DialogTrigger")),$_="DialogPortal",[b$,Y_]=F_($_,{forceMount:void 0}),w$=tr(t=>{let{__scopeDialog:e,forceMount:n,children:r,container:o}=t,i=go($_,e);return(0,vt.jsx)(b$,{scope:e,forceMount:n,children:ze.Children.map(r,s=>(0,vt.jsx)(Gs,{present:n||i.open,children:(0,vt.jsx)(Dg,{asChild:!0,container:o,children:s})}))})},"DialogPortal"),NS="DialogOverlay",S$=ze.forwardRef(tr(function(e,n){let r=Y_(NS,e.__scopeDialog),{forceMount:o=r.forceMount,...i}=e,s=go(NS,e.__scopeDialog);return s.modal?(0,vt.jsx)(Gs,{present:o||s.open,children:(0,vt.jsx)(C$,{...i,ref:n})}):null},"DialogOverlay")),x$=Fs("DialogOverlay.RemoveScroll"),C$=ze.forwardRef(tr(function(e,n){let{__scopeDialog:r,...o}=e,i=go(NS,r),s=b2(),l=Je(n,s);return(0,vt.jsx)(H_,{as:x$,allowPinchZoom:!0,shards:ze.useMemo(()=>[i.contentRef,...i.branchNodes.map(a=>({current:a}))],[i.contentRef,i.branchNodes]),children:(0,vt.jsx)(je.div,{"data-state":Bg(i.open),...o,ref:l,style:{pointerEvents:"auto",...o.style}})})},"DialogOverlayImpl")),Df="DialogContent",E$=ze.forwardRef(tr(function(e,n){let r=Y_(Df,e.__scopeDialog),{forceMount:o=r.forceMount,...i}=e,s=go(Df,e.__scopeDialog);return(0,vt.jsx)(Gs,{present:o||s.open,children:s.modal?(0,vt.jsx)(T$,{...i,ref:n}):(0,vt.jsx)(A$,{...i,ref:n})})},"DialogContent")),T$=ze.forwardRef(tr(function(e,n){let r=go(Df,e.__scopeDialog),o=ze.useRef(null),i=Je(n,r.contentRef,o);return ze.useEffect(()=>{let s=o.current;if(s)return j_(s)},[]),(0,vt.jsx)(q_,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,onCloseAutoFocus:ee(e.onCloseAutoFocus,s=>{s.preventDefault(),r.triggerRef.current?.focus()}),onPointerDownOutside:ee(e.onPointerDownOutside,s=>{let l=s.detail.originalEvent,a=l.button===0&&l.ctrlKey===!0;(l.button===2||a)&&s.preventDefault()}),onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault())})},"DialogContentModal")),A$=ze.forwardRef(tr(function(e,n){let r=go(Df,e.__scopeDialog),o=ze.useRef(!1),i=ze.useRef(!1);return(0,vt.jsx)(q_,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:s=>{e.onCloseAutoFocus?.(s),s.defaultPrevented||(o.current||r.triggerRef.current?.focus(),s.preventDefault()),o.current=!1,i.current=!1},onInteractOutside:s=>{e.onInteractOutside?.(s),s.defaultPrevented||(o.current=!0,s.detail.originalEvent.type==="pointerdown"&&(i.current=!0));let l=s.target;r.triggerRef.current?.contains(l)&&s.preventDefault(),s.detail.originalEvent.type==="focusin"&&i.current&&s.preventDefault()}})},"DialogContentNonModal")),q_=ze.forwardRef(tr(function(e,n){let{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:i,onCloseAutoFocus:s,"aria-describedby":l,children:a,...c}=e,u=go(Df,r);return Ig(),(0,vt.jsx)(KS,{registry:u.branchRegistry,children:(0,vt.jsx)(x2,{asChild:!0,loop:!0,trapped:o,branches:u.branchNodes,onMountAutoFocus:i,onUnmountAutoFocus:s,children:(0,vt.jsx)(xg,{role:"dialog",id:u.contentId,"aria-labelledby":u.titlePresent?u.titleId:void 0,"aria-describedby":u.descriptionPresent?G_(l,u.descriptionId):l,"data-state":Bg(u.open),...c,ref:n,deferPointerDownOutside:!0,onDismiss:()=>u.onOpenChange(!1),children:a})})})},"DialogContentImpl")),k$=ze.forwardRef(tr(function(e,n){let{__scopeDialog:r,...o}=e,i=go("DialogTitle",r),{setTitleCount:s}=i;return hn(()=>(s(l=>l+1),()=>s(l=>l-1)),[s]),(0,vt.jsx)(je.h2,{id:i.titleId,...o,ref:n})},"DialogTitle")),M$=ze.forwardRef(tr(function(e,n){let{__scopeDialog:r,...o}=e,i=go("DialogDescription",r),{setDescriptionCount:s}=i;return hn(()=>(s(l=>l+1),()=>s(l=>l-1)),[s]),(0,vt.jsx)(je.p,{id:i.descriptionId,...o,ref:n})},"DialogDescription")),R$="DialogClose",K_=ze.forwardRef(tr(function(e,n){let{__scopeDialog:r,...o}=e,i=go(R$,r);return(0,vt.jsx)(je.button,{type:"button",...o,ref:n,onClick:ee(e.onClick,()=>i.onOpenChange(!1))})},"DialogClose"));function G_(...t){let e=new Set;for(let n of t)if(typeof n=="string")for(let r of String(n).trim().split(/\s+/))r&&e.add(r);return e.size>0?Array.from(e).join(" "):void 0}tr(G_,"concatAriaDescribedby");function Bg(t){return t?"open":"closed"}tr(Bg,"getState");var O$=Object.defineProperty,zt=(t,e)=>O$(t,"name",{value:e,configurable:!0});function Pg(t){let e=t+"CollectionProvider",[n,r]=Ar(e),[o,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=zt(m=>{let{scope:y,children:g}=m,v=po.useRef(null),b=po.useRef(new Map).current;return(0,cg.jsx)(o,{scope:y,itemMap:b,collectionRef:v,children:g})},"CollectionProvider");s.displayName=e;let l=t+"CollectionSlot",a=Fs(l),c=po.forwardRef((m,y)=>{let{scope:g,children:v}=m,b=i(l,g),w=Je(y,b.collectionRef);return(0,cg.jsx)(a,{ref:w,children:v})});c.displayName=l;let u=t+"CollectionItemSlot",d="data-radix-collection-item",f=Fs(u),h=po.forwardRef((m,y)=>{let{scope:g,children:v,...b}=m,w=po.useRef(null),S=Je(y,w),C=i(u,g);return po.useEffect(()=>(C.itemMap.set(w,{ref:w,...b}),()=>{C.itemMap.delete(w)})),(0,cg.jsx)(f,{[d]:"",ref:S,children:v})});h.displayName=u;function p(m){let y=i(t+"CollectionConsumer",m);return po.useCallback(()=>{let v=y.collectionRef.current;if(!v)return[];let b=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(y.itemMap.values()).sort((C,x)=>b.indexOf(C.ref.current)-b.indexOf(x.ref.current))},[y.collectionRef,y.itemMap])}return zt(p,"useCollection"),[{Provider:s,Slot:c,ItemSlot:h},p,r]}zt(Pg,"createCollection");var PN=new WeakMap,ig=class Bs extends Map{static{zt(this,"OrderedDict")}#e;constructor(e){super(e),this.#e=[...super.keys()],PN.set(this,!0)}set(e,n){return PN.get(this)&&!this.has(e)&&this.#e.push(e),super.set(e,n),this}insert(e,n,r){let o=this.has(n),i=o?this.size:this.size+1,s=fx(e),l=s>=0?Math.min(s,i-1):Math.max(i+s,0);if(o?this.#e.indexOf(n)===l:l===this.size)return this.set(n,r),this;let a=this.#e.filter(u=>u!==n);a.splice(l,0,n);let c=a.map(u=>[u,u===n?r:this.get(u)]);this.clear();for(let[u,d]of c)this.set(u,d);return this}with(e,n,r){let o=new Bs(this);return o.insert(e,n,r),o}before(e){let n=this.#e.indexOf(e)-1;if(!(n<0))return this.entryAt(n)}setBefore(e,n,r){let o=this.#e.indexOf(e);if(o===-1)return this;let i=this.#e.indexOf(n),s=i!==-1&&i<o?o-1:o;return this.insert(s,n,r)}after(e){let n=this.#e.indexOf(e);if(n=n===-1||n===this.size-1?-1:n+1,n!==-1)return this.entryAt(n)}setAfter(e,n,r){let o=this.#e.indexOf(e);if(o===-1)return this;let i=this.#e.indexOf(n),s=i!==-1&&i<=o?o:o+1;return this.insert(s,n,r)}first(){return this.entryAt(0)}last(){return this.entryAt(-1)}clear(){return this.#e=[],super.clear()}delete(e){let n=super.delete(e);return n&&this.#e.splice(this.#e.indexOf(e),1),n}deleteAt(e){let n=this.keyAt(e);return n!==void 0?this.delete(n):!1}at(e){let n=ug(this.#e,e);if(n!==void 0)return this.get(n)}entryAt(e){let n=ug(this.#e,e);if(n!==void 0)return[n,this.get(n)]}indexOf(e){return this.#e.indexOf(e)}keyAt(e){return ug(this.#e,e)}from(e,n){let r=this.indexOf(e);if(r===-1)return;let o=r+n;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.at(o)}keyFrom(e,n){let r=this.indexOf(e);if(r===-1)return;let o=r+n;return o<0&&(o=0),o>=this.size&&(o=this.size-1),this.keyAt(o)}find(e,n){let r=0;for(let o of this){if(Reflect.apply(e,n,[o,r,this]))return o;r++}}findIndex(e,n){let r=0;for(let o of this){if(Reflect.apply(e,n,[o,r,this]))return r;r++}return-1}filter(e,n){let r=[],o=0;for(let i of this)Reflect.apply(e,n,[i,o,this])&&r.push(i),o++;return new Bs(r)}map(e,n){let r=[],o=0;for(let i of this)r.push([i[0],Reflect.apply(e,n,[i,o,this])]),o++;return new Bs(r)}reduce(...e){let[n,r]=e,o=e.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let i=0,s=r;for(let l of this)i===0&&!o?s=l:s=Reflect.apply(n,this,[s,l,i,this]),i++;return s}reduceRight(...e){let[n,r]=e,o=e.length>1;if(!o&&this.size===0)throw new TypeError("Reduce of empty OrderedDict with no initial value");let i=r;for(let s=this.size-1;s>=0;s--){let l=this.entryAt(s);s===this.size-1&&!o?i=l:i=Reflect.apply(n,this,[i,l,s,this])}return i}sort(e){if(typeof e!="function")throw new TypeError("OrderedDict.sort requires a compare function");let n=[...this.entries()].sort(e);this.clear();for(let[r,o]of n)this.set(r,o);return this}toSorted(e){if(typeof e!="function")throw new TypeError("OrderedDict.toSorted requires a compare function");let n=[...this.entries()].sort(e);return new Bs(n)}toReversed(){let e=new Bs;for(let n=this.size-1;n>=0;n--){let r=this.keyAt(n),o=this.get(r);e.set(r,o)}return e}toSpliced(...e){let n=[...this.entries()];return n.splice(...e),new Bs(n)}slice(e,n){let r=new Bs;for(let o of this.#e.slice(e,n))r.set(o,this.get(o));return r}every(e,n){let r=0;for(let o of this){if(!Reflect.apply(e,n,[o,r,this]))return!1;r++}return!0}some(e,n){let r=0;for(let o of this){if(Reflect.apply(e,n,[o,r,this]))return!0;r++}return!1}};function ug(t,e){if("at"in Array.prototype)return Array.prototype.at.call(t,e);let n=X_(t,e);return n===-1?void 0:t[n]}zt(ug,"at");function X_(t,e){let n=t.length,r=fx(e),o=r>=0?r:n+r;return o<0||o>=n?-1:o}zt(X_,"toSafeIndex");function fx(t){return t!==t||t===0?0:Math.trunc(t)}zt(fx,"toSafeInteger");function D$(t){let e=t+"CollectionProvider",[n,r]=Ar(e),[o,i]=n(e);o.displayName=t+"CollectionStableContextProvider";let[s,l]=n(e);s.displayName=t+"CollectionStatefulContextProvider";let a=zt(({state:C,...x})=>C?(0,Us.jsx)(u,{...x,state:C}):(0,Us.jsx)(c,{...x}),"CollectionProvider");a.displayName=e;let c=zt(C=>{let x=v();return(0,Us.jsx)(u,{...C,state:x})},"CollectionInit");c.displayName=t+"CollectionInit";let u=zt(C=>{let{scope:x,children:E,state:A}=C,T=Ut.useRef(null),[_,z]=Ut.useState(null),$=Je(T,z),[I,j]=A,D=Ut.useRef(new ig),K=Ut.useCallback(()=>{let U=D.current;return Q_(U)||U.sort(dg),U},[]);return Ut.useEffect(()=>{if(!_)return;let U=Z_(()=>{j(re=>{let Y=re.toSorted(dg);return Y.some(([gt],Dt)=>re.keyAt(Dt)!==gt)?Y:re})});return U.observe(_,{childList:!0,subtree:!0}),()=>{U.disconnect()}},[_,j]),(0,Us.jsx)(o,{scope:x,collectionElementRef:$,collectionElementRefObject:T,getCollection:K,setCollection:j,registryRef:D,children:(0,Us.jsx)(s,{scope:x,collectionElement:_,collection:I,children:E})})},"CollectionProviderImpl");u.displayName=t+"CollectionProviderImpl";let d=t+"CollectionSlot",f=Fs(d),h=Ut.forwardRef((C,x)=>{let{scope:E,children:A}=C,T=i(d,E),_=Je(x,T.collectionElementRef);return(0,Us.jsx)(f,{ref:_,children:A})});h.displayName=d;let p=t+"CollectionItemSlot",m="data-radix-collection-item",y=Fs(p),g=Ut.forwardRef((C,x)=>{let{scope:E,children:A,...T}=C,_=Ut.useRef(null),z=i(p,E),{setCollection:$,registryRef:I}=z,j=Ut.useRef(T);W_(j.current,T)||(j.current=T);let D=j.current,K=Ut.useCallback(Y=>{let ke=I.current;Y?ke.set(Y,{...j.current,element:Y}):_.current&&ke.delete(_.current)},[I]),U=Je(x,K,_);hn(()=>{let Y=_.current,ke=I.current;Y&&ke.has(Y)&&ke.set(Y,{...D,element:Y})},[D,I]);let re=Ut.useRef(null);return Ut.useEffect(()=>{let Y=_.current,ke=re.current;(ke?.element??null)===Y&&(!Y||ke?.itemData===D)||(re.current=Y?{element:Y,itemData:D}:null,$(gt=>{let Dt=new ig(gt);return ke&&ke.element!==Y&&Dt.delete(ke.element),Y&&Dt.set(Y,{...D,element:Y}),Dt.sort(dg)}))}),Ut.useEffect(()=>()=>{let Y=re.current;re.current=null,Y&&$(ke=>{if(!ke.has(Y.element))return ke;let gt=new ig(ke);return gt.delete(Y.element),gt})},[$]),(0,Us.jsx)(y,{[m]:"",ref:U,children:A})});g.displayName=p;function v(){return Ut.useState(new ig)}zt(v,"useInitCollection");function b(C){let{collection:x}=l(t+"CollectionConsumer",C);return x}zt(b,"useCollection");function w(C){let{getCollection:x}=i(t+"CollectionConsumer",C);return x}return zt(w,"useGetCollection"),[{Provider:a,Slot:h,ItemSlot:g},{createCollectionScope:r,useCollection:b,useGetCollection:w,useInitCollection:v}]}zt(D$,"createCollection");function W_(t,e){if(t===e)return!0;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return!1;let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||t[o]!==e[o])return!1;return!0}zt(W_,"shallowEqual");function J_(t,e){return!!(e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_PRECEDING)}zt(J_,"isElementPreceding");function Q_(t){let e;for(let n of t.keys()){if(e){let r=e.compareDocumentPosition(n);if(!(r&Node.DOCUMENT_POSITION_DISCONNECTED)&&r&Node.DOCUMENT_POSITION_PRECEDING)return!1}e=n}return!0}zt(Q_,"isInDocumentOrder");function dg(t,e){return!t[1].element||!e[1].element?0:J_(t[1].element,e[1].element)?-1:1}zt(dg,"sortByDocumentPosition");function Z_(t){return new MutationObserver(n=>{for(let r of n)if(r.type==="childList"){t();return}})}zt(Z_,"getChildListObserver");var N$=Object.defineProperty,_$=(t,e)=>N$(t,"name",{value:e,configurable:!0}),I$={LTR:"ltr",RTL:"rtl"},L$=Hg.createContext(void 0);function Vg(t){let e=Hg.useContext(L$);return t||e||I$.LTR}_$(Vg,"useDirection");var U$=Object.defineProperty,hx=(t,e)=>U$(t,"name",{value:e,configurable:!0}),mS=!1;function e3(){let[t,e]=jg.useState(mS);return jg.useEffect(()=>{mS||(mS=!0,e(!0))},[]),t}hx(e3,"useIsHydrated");var t3=z$[" useSyncExternalStore ".trim().toString()];function n3(){return()=>{}}hx(n3,"subscribe");function r3(){return t3(n3,()=>!0,()=>!1)}hx(r3,"useIsHydratedModern");var B$=typeof t3=="function"?r3:e3,P$=Object.defineProperty,oa=(t,e)=>P$(t,"name",{value:e,configurable:!0}),gS="rovingFocusGroup.onEntryFocus",H$={bubbles:!1,cancelable:!0},Fg="RovingFocusGroup",[_S,o3,V$]=Pg(Fg),[j$,Js]=Ar(Fg,[V$]),HN={Vertical:"vertical",Horizontal:"horizontal"},F$={LTR:"ltr",RTL:"rtl"},[$$,Y$]=j$(Fg),i3=Wt.forwardRef(oa(function(e,n){return(0,Vs.jsx)(_S.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,Vs.jsx)(_S.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,Vs.jsx)(q$,{...e,ref:n})})})},"RovingFocusGroup")),q$=Wt.forwardRef(oa(function(e,n){let{__scopeRovingFocusGroup:r,orientation:o,loop:i=!1,dir:s,currentTabStopId:l,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=e,h=Wt.useRef(null),p=Je(n,h),m=Vg(s),[y,g]=ou({prop:l,defaultProp:a??null,onChange:c,caller:Fg}),[v,b]=Wt.useState(!1),w=Tr(u),S=o3(r),C=Wt.useRef(!1),[x,E]=Wt.useState(0);return Wt.useEffect(()=>{let A=h.current;if(A)return A.addEventListener(gS,w),()=>A.removeEventListener(gS,w)},[w]),(0,Vs.jsx)($$,{scope:r,orientation:o,dir:m,loop:i,currentTabStopId:y,onItemFocus:Wt.useCallback(A=>g(A),[g]),onItemShiftTab:Wt.useCallback(()=>b(!0),[]),onFocusableItemAdd:Wt.useCallback(()=>E(A=>A+1),[]),onFocusableItemRemove:Wt.useCallback(()=>E(A=>A-1),[]),children:(0,Vs.jsx)(je.div,{tabIndex:v||x===0?-1:0,"data-orientation":o,...f,ref:p,style:{outline:"none",...e.style},onMouseDown:ee(e.onMouseDown,()=>{C.current=!0}),onFocus:ee(e.onFocus,A=>{let T=!C.current;if(A.target===A.currentTarget&&T&&!v){let _=new CustomEvent(gS,H$);if(A.currentTarget.dispatchEvent(_),!_.defaultPrevented){let z=S().filter(K=>K.focusable),$=z.find(K=>K.active),I=z.find(K=>K.id===y),D=[$,I,...z].filter(Boolean).map(K=>K.ref.current);px(D,d)}}C.current=!1}),onBlur:ee(e.onBlur,()=>b(!1))})})},"RovingFocusGroupImpl")),K$="RovingFocusGroupItem",s3=Wt.forwardRef(oa(function(e,n){let{__scopeRovingFocusGroup:r,focusable:o=!0,active:i=!1,tabStopId:s,children:l,...a}=e,c=Ps(),u=s||c,d=Y$(K$,r),f=d.currentTabStopId===u,h=o3(r),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:y}=d,g=B$();return hn(()=>{if(!(!g||!o))return p(),()=>m()},[g,o,p,m]),Wt.useEffect(()=>{if(!(g||!o))return p(),()=>m()},[g,o,p,m]),(0,Vs.jsx)(_S.ItemSlot,{scope:r,id:u,focusable:o,active:i,children:(0,Vs.jsx)(je.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...a,ref:n,onMouseDown:ee(e.onMouseDown,v=>{o?d.onItemFocus(u):v.preventDefault()}),onFocus:ee(e.onFocus,()=>d.onItemFocus(u)),onKeyDown:ee(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){d.onItemShiftTab();return}if(v.target!==v.currentTarget)return;let b=a3(v,d.orientation,d.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let S=h().filter(C=>C.focusable).map(C=>C.ref.current);if(b==="last")S.reverse();else if(b==="prev"||b==="next"){b==="prev"&&S.reverse();let C=S.indexOf(v.currentTarget);S=d.loop?c3(S,C+1):S.slice(C+1)}setTimeout(()=>px(S))}}),children:typeof l=="function"?l({isCurrentTabStop:f,hasTabStop:y!=null}):l})})},"RovingFocusGroupItem")),G$={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function l3(t,e){return e!==F$.RTL?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}oa(l3,"getDirectionAwareKey");function a3(t,e,n){let r=l3(t.key,n);if(!(e===HN.Vertical&&["ArrowLeft","ArrowRight"].includes(r))&&!(e===HN.Horizontal&&["ArrowUp","ArrowDown"].includes(r)))return G$[r]}oa(a3,"getFocusIntent");function px(t,e=!1){let n=document.activeElement;for(let r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}oa(px,"focusFirst");function c3(t,e){return t.map((n,r)=>t[(e+r)%t.length])}oa(c3,"wrapArray");var X$=Object.defineProperty,We=(t,e)=>X$(t,"name",{value:e,configurable:!0}),IS=["Enter"," "],W$=["ArrowDown","PageUp","Home"],u3=["ArrowUp","PageDown","End"],J$=[...W$,...u3],boe={ltr:[...IS,"ArrowRight"],rtl:[...IS,"ArrowLeft"]},$g="Menu",[LS,Q$,Z$]=Pg($g),[ia,d3]=Ar($g,[Z$,Mg,Js]),mx=Mg(),f3=Js(),[e9,Uf]=ia($g),[t9,gx]=ia($g),n9=We(t=>{let{__scopeMenu:e,open:n=!1,children:r,dir:o,onOpenChange:i,modal:s=!0}=t,l=mx(e),[a,c]=ne.useState(null),u=ne.useRef(!1),d=Tr(i),f=Vg(o);return ne.useEffect(()=>{let h=We(()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},"handleKeyDown"),p=We(()=>u.current=!1,"handlePointer");return document.addEventListener("keydown",h,{capture:!0}),()=>{document.removeEventListener("keydown",h,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),ne.useEffect(()=>{if(!n)return;let h=We(()=>d(!1),"handleBlur");return window.addEventListener("blur",h),()=>window.removeEventListener("blur",h)},[n,d]),(0,He.jsx)(G2,{...l,children:(0,He.jsx)(e9,{scope:e,open:n,onOpenChange:d,content:a,onContentChange:c,children:(0,He.jsx)(t9,{scope:e,onClose:ne.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:s,children:r})})})},"Menu"),r9=ne.forwardRef(We(function(e,n){let{__scopeMenu:r,...o}=e,i=mx(r);return(0,He.jsx)(X2,{...i,...o,ref:n})},"MenuAnchor")),h3="MenuPortal",[o9,i9]=ia(h3,{forceMount:void 0}),s9=We(t=>{let{__scopeMenu:e,forceMount:n,children:r,container:o}=t,i=Uf(h3,e);return(0,He.jsx)(o9,{scope:e,forceMount:n,children:(0,He.jsx)(Gs,{present:n||i.open,children:(0,He.jsx)(Dg,{asChild:!0,container:o,children:r})})})},"MenuPortal"),js="MenuContent",[l9,p3]=ia(js),a9=ne.forwardRef(We(function(e,n){let r=i9(js,e.__scopeMenu),{forceMount:o=r.forceMount,...i}=e,s=Uf(js,e.__scopeMenu),l=gx(js,e.__scopeMenu);return(0,He.jsx)(LS.Provider,{scope:e.__scopeMenu,children:(0,He.jsx)(Gs,{present:o||s.open,children:(0,He.jsx)(LS.Slot,{scope:e.__scopeMenu,children:l.modal?(0,He.jsx)(c9,{...i,ref:n}):(0,He.jsx)(u9,{...i,ref:n})})})})},"MenuContent")),c9=ne.forwardRef(We(function(e,n){let r=Uf(js,e.__scopeMenu),o=ne.useRef(null),i=Je(n,o);return ne.useEffect(()=>{let s=o.current;if(s)return j_(s)},[]),(0,He.jsx)(m3,{...e,ref:i,trapFocus:r.open,disableOutsidePointerEvents:r.open,disableOutsideScroll:!0,onFocusOutside:ee(e.onFocusOutside,s=>s.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentModal")),u9=ne.forwardRef(We(function(e,n){let r=Uf(js,e.__scopeMenu);return(0,He.jsx)(m3,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>r.onOpenChange(!1)})},"MenuRootContentNonModal")),d9=Fs("MenuContent.ScrollLock"),m3=ne.forwardRef(We(function(e,n){let{__scopeMenu:r,loop:o=!1,trapFocus:i,onOpenAutoFocus:s,onCloseAutoFocus:l,disableOutsidePointerEvents:a,onEntryFocus:c,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,disableOutsideScroll:m,...y}=e,g=Uf(js,r),v=gx(js,r),b=mx(r),w=f3(r),S=Q$(r),[C,x]=ne.useState(null),E=ne.useRef(null),[A,T]=ne.useState(null);XS(A);let{nodes:_,registry:z}=GS(),$=!!(i||m),I=Je(n,E,g.onContentChange,T),j=ne.useRef(0),D=ne.useRef(""),K=ne.useRef(0),U=ne.useRef(null),re=ne.useRef("right"),Y=ne.useRef(0),ke=ne.useMemo(()=>m?[E,..._.map(W=>({current:W}))]:[],[E,_,m]),gt=m?H_:ne.Fragment,Dt=m?{as:d9,allowPinchZoom:!0,shards:ke}:void 0,Co=We(W=>{let Eo=D.current+W,si=S().filter(Ln=>!Ln.disabled),li=document.activeElement,Ya=si.find(Ln=>Ln.ref.current===li)?.textValue,xd=si.map(Ln=>Ln.textValue),fp=w3(xd,Eo,Ya),kl=si.find(Ln=>Ln.textValue===fp)?.ref.current;function ai(Ln){D.current=Ln,window.clearTimeout(j.current),Ln!==""&&(j.current=window.setTimeout(()=>ai(""),1e3))}We(ai,"updateSearch"),ai(Eo),kl&&setTimeout(()=>kl.focus())},"handleTypeaheadSearch");ne.useEffect(()=>()=>window.clearTimeout(j.current),[]),Ig();let wn=ne.useCallback(W=>re.current===U.current?.side&&x3(W,U.current?.area),[]);return(0,He.jsx)(l9,{scope:r,searchRef:D,onItemEnter:ne.useCallback(W=>{wn(W)&&W.preventDefault()},[wn]),onItemLeave:ne.useCallback(W=>{wn(W)||(E.current?.focus(),x(null))},[wn]),onTriggerLeave:ne.useCallback(W=>{wn(W)&&W.preventDefault()},[wn]),pointerGraceTimerRef:K,onPointerGraceIntentChange:ne.useCallback(W=>{U.current=W},[]),children:(0,He.jsx)(KS,{registry:$?z:null,children:(0,He.jsx)(gt,{...Dt,children:(0,He.jsx)(x2,{asChild:!0,trapped:i,branches:_,onMountAutoFocus:ee(s,W=>{W.preventDefault(),E.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:(0,He.jsx)(xg,{asChild:!0,disableOutsidePointerEvents:a,onEscapeKeyDown:u,onPointerDownOutside:d,onFocusOutside:f,onInteractOutside:h,onDismiss:p,children:(0,He.jsx)(i3,{asChild:!0,...w,dir:v.dir,orientation:"vertical",loop:o,currentTabStopId:C,onCurrentTabStopIdChange:x,onEntryFocus:ee(c,W=>{v.isUsingKeyboardRef.current||W.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,He.jsx)(J2,{role:"menu","aria-orientation":"vertical","data-state":g3(g.open),"data-radix-menu-content":"",dir:v.dir,...b,...y,ref:I,style:{outline:"none",...y.style},onKeyDown:ee(y.onKeyDown,W=>{let si=W.target.closest("[data-radix-menu-content]")===W.currentTarget,li=W.ctrlKey||W.altKey||W.metaKey,Ya=W.key.length===1;si&&(W.key==="Tab"&&W.preventDefault(),!li&&Ya&&Co(W.key));let xd=E.current;if(W.target!==xd||!J$.includes(W.key))return;W.preventDefault();let kl=S().filter(ai=>!ai.disabled).map(ai=>ai.ref.current);u3.includes(W.key)&&kl.reverse(),v3(kl)}),onBlur:ee(e.onBlur,W=>{W.currentTarget.contains(W.target)||(window.clearTimeout(j.current),D.current="")}),onPointerMove:ee(e.onPointerMove,bg(W=>{let Eo=W.target,si=Y.current!==W.clientX;if(W.currentTarget.contains(Eo)&&si){let li=W.clientX>Y.current?"right":"left";re.current=li,Y.current=W.clientX}}))})})})})})})})},"MenuContentImpl")),zS="MenuItem",VN="menu.itemSelect",f9=ne.forwardRef(We(function(e,n){let{disabled:r=!1,onSelect:o,...i}=e,s=ne.useRef(null),l=gx(zS,e.__scopeMenu),a=p3(zS,e.__scopeMenu),c=Je(n,s),u=ne.useRef(!1),d=We(()=>{let f=s.current;if(!r&&f){let h=new CustomEvent(VN,{bubbles:!0,cancelable:!0});f.addEventListener(VN,p=>o?.(p),{once:!0}),Sg(f,h),h.defaultPrevented?u.current=!1:l.onClose()}},"handleSelect");return(0,He.jsx)(h9,{...i,ref:c,disabled:r,onClick:ee(e.onClick,d),onPointerDown:f=>{e.onPointerDown?.(f),u.current=!0},onPointerUp:ee(e.onPointerUp,f=>{u.current||f.currentTarget?.click()}),onKeyDown:ee(e.onKeyDown,f=>{r||f.target!==f.currentTarget||a.searchRef.current!==""&&f.key===" "||IS.includes(f.key)&&(f.currentTarget.click(),f.preventDefault())})})},"MenuItem")),h9=ne.forwardRef(We(function(e,n){let{__scopeMenu:r,disabled:o=!1,textValue:i,...s}=e,l=p3(zS,r),a=f3(r),c=ne.useRef(null),u=Je(n,c),[d,f]=ne.useState(!1),[h,p]=ne.useState("");return ne.useEffect(()=>{let m=c.current;m&&p((m.textContent??"").trim())},[s.children]),(0,He.jsx)(LS.ItemSlot,{scope:r,disabled:o,textValue:i??h,children:(0,He.jsx)(s3,{asChild:!0,...a,focusable:!o,children:(0,He.jsx)(je.div,{role:"menuitem","data-highlighted":d?"":void 0,"aria-disabled":o||void 0,"data-disabled":o?"":void 0,...s,ref:u,onPointerMove:ee(e.onPointerMove,bg(m=>{o?l.onItemLeave(m):(l.onItemEnter(m),m.defaultPrevented||m.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:ee(e.onPointerLeave,bg(m=>l.onItemLeave(m))),onFocus:ee(e.onFocus,()=>f(!0)),onBlur:ee(e.onBlur,()=>f(!1))})})})},"MenuItemImpl")),p9="MenuRadioGroup",[woe,Soe]=ia(p9,{value:void 0,onValueChange:We(()=>{},"onValueChange")}),m9="MenuItemIndicator",[xoe,Coe]=ia(m9,{checked:!1}),g9=ne.forwardRef(We(function(e,n){let{__scopeMenu:r,...o}=e;return(0,He.jsx)(je.div,{role:"separator","aria-orientation":"horizontal",...o,ref:n})},"MenuSeparator")),y9="MenuSub",[Eoe,Toe]=ia(y9);function g3(t){return t?"open":"closed"}We(g3,"getOpenState");function y3(t){return t==="indeterminate"}We(y3,"isIndeterminate");function v9(t){return y3(t)?"indeterminate":t?"checked":"unchecked"}We(v9,"getCheckedState");function v3(t){let e=document.activeElement;for(let n of t)if(n===e||(n.focus(),document.activeElement!==e))return}We(v3,"focusFirst");function b3(t,e){return t.map((n,r)=>t[(e+r)%t.length])}We(b3,"wrapArray");function w3(t,e,n){let o=e.length>1&&Array.from(e).every(c=>c===e[0])?e[0]:e,i=n?t.indexOf(n):-1,s=b3(t,Math.max(i,0));o.length===1&&(s=s.filter(c=>c!==n));let a=s.find(c=>c.toLowerCase().startsWith(o.toLowerCase()));return a!==n?a:void 0}We(w3,"getNextMatch");function S3(t,e){let{x:n,y:r}=t,o=!1;for(let i=0,s=e.length-1;i<e.length;s=i++){let l=e[i],a=e[s],c=l.x,u=l.y,d=a.x,f=a.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(o=!o)}return o}We(S3,"isPointInPolygon");function x3(t,e){if(!e)return!1;let n={x:t.clientX,y:t.clientY};return S3(n,e)}We(x3,"isPointerInGraceArea");function bg(t){return e=>e.pointerType==="mouse"?t(e):void 0}We(bg,"whenMouse");var b9=Object.defineProperty,su=(t,e)=>b9(t,"name",{value:e,configurable:!0}),yx="DropdownMenu",[w9,Aoe]=Ar(yx,[d3]),lu=d3(),[S9,C3]=w9(yx),x9=su(t=>{let{__scopeDropdownMenu:e,children:n,dir:r,open:o,defaultOpen:i,onOpenChange:s,modal:l=!0}=t,a=lu(e),c=qo.useRef(null),[u,d]=ou({prop:o,defaultProp:i??!1,onChange:s,caller:yx});return(0,Di.jsx)(S9,{scope:e,triggerId:Ps(),triggerRef:c,contentId:Ps(),open:u,onOpenChange:d,onOpenToggle:qo.useCallback(()=>d(f=>!f),[d]),modal:l,children:(0,Di.jsx)(n9,{...a,open:u,onOpenChange:d,dir:r,modal:l,children:n})})},"DropdownMenu"),C9="DropdownMenuTrigger",E9=qo.forwardRef(su(function(e,n){let{__scopeDropdownMenu:r,disabled:o=!1,...i}=e,s=C3(C9,r),l=lu(r),a=Je(n,s.triggerRef);return(0,Di.jsx)(r9,{asChild:!0,...l,children:(0,Di.jsx)(je.button,{type:"button",id:s.triggerId,"aria-haspopup":"menu","aria-expanded":s.open,"aria-controls":s.open?s.contentId:void 0,"data-state":s.open?"open":"closed","data-disabled":o?"":void 0,disabled:o,...i,ref:a,onPointerDown:ee(e.onPointerDown,c=>{!o&&c.button===0&&c.ctrlKey===!1&&(s.onOpenToggle(),s.open||c.preventDefault())}),onKeyDown:ee(e.onKeyDown,c=>{o||(["Enter"," "].includes(c.key)&&s.onOpenToggle(),c.key==="ArrowDown"&&s.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(c.key)&&c.preventDefault())})})})},"DropdownMenuTrigger")),T9=su(t=>{let{__scopeDropdownMenu:e,...n}=t,r=lu(e);return(0,Di.jsx)(s9,{...r,...n})},"DropdownMenuPortal"),A9="DropdownMenuContent",k9=qo.forwardRef(su(function(e,n){let{__scopeDropdownMenu:r,...o}=e,i=C3(A9,r),s=lu(r),l=qo.useRef(!1);return(0,Di.jsx)(a9,{id:i.contentId,"aria-labelledby":i.triggerId,...s,...o,ref:n,onCloseAutoFocus:ee(e.onCloseAutoFocus,a=>{l.current||i.triggerRef.current?.focus(),l.current=!1,a.preventDefault()}),onInteractOutside:ee(e.onInteractOutside,a=>{let c=a.detail.originalEvent,u=c.button===0&&c.ctrlKey===!0,d=c.button===2||u;(!i.modal||d)&&(l.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})},"DropdownMenuContent")),M9=qo.forwardRef(su(function(e,n){let{__scopeDropdownMenu:r,...o}=e,i=lu(r);return(0,Di.jsx)(f9,{...i,...o,ref:n})},"DropdownMenuItem")),R9=qo.forwardRef(su(function(e,n){let{__scopeDropdownMenu:r,...o}=e,i=lu(r);return(0,Di.jsx)(g9,{...i,...o,ref:n})},"DropdownMenuSeparator")),D9=Object.defineProperty,E3=(t,e)=>D9(t,"name",{value:e,configurable:!0});var T3="Tabs",[N9,koe]=Ar(T3,[Js]),Moe=Js(),[Roe,Ooe]=N9(T3);function _9(t,e){return`${t}-trigger-${e}`}E3(_9,"makeTriggerId");function I9(t,e){return`${t}-content-${e}`}E3(I9,"makeContentId");var L9=Object.defineProperty,Ve=(t,e)=>L9(t,"name",{value:e,configurable:!0}),jN=oe[" startTransition ".trim().toString()]||(()=>{}),k3="ToastProvider",[bx,M3,z9]=Pg("Toast"),US={Up:"up",Down:"down",Left:"left",Right:"right"},FN={Foreground:"foreground",Background:"background"},[R3,Doe]=Ar("Toast",[z9]),[U9,Yg]=R3(k3);function fg(t){typeof jN=="function"?jN(t):t()}Ve(fg,"scheduleUpdate");var B9=Ve(t=>{let{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:o=US.Right,swipeThreshold:i=50,announcerContainer:s,children:l}=t,[a,c]=oe.useState(null),[u,d]=oe.useState(0),f=oe.useRef(!1),h=oe.useCallback(y=>{fg(()=>c(y))},[]),p=oe.useCallback(()=>{fg(()=>d(y=>y+1))},[]),m=oe.useCallback(()=>{fg(()=>d(y=>y-1))},[]);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${k3}\`. Expected non-empty \`string\`.`),(0,Ne.jsx)(bx.Provider,{scope:e,children:(0,Ne.jsx)(U9,{scope:e,label:n,duration:r,swipeDirection:o,swipeThreshold:i,toastCount:u,viewport:a,onViewportChange:h,onToastAdd:p,onToastRemove:m,isClosePausedRef:f,announcerContainer:s,children:l})})},"ToastProvider"),P9="ToastViewport",H9=["F8"],BS="toast.viewportPause",PS="toast.viewportResume",V9=oe.forwardRef(Ve(function(e,n){let{__scopeToast:r,hotkey:o=H9,label:i="Notifications ({hotkey})",...s}=e,l=Yg(P9,r),a=M3(r),c=oe.useRef(null),u=oe.useRef(null),d=oe.useRef(null),f=oe.useRef(null),h=Je(n,f,l.onViewportChange),p=o.join("+").replace(/Key/g,"").replace(/Digit/g,""),m=l.toastCount>0;oe.useEffect(()=>{let g=Ve(v=>{o.length!==0&&o.every(w=>v[w]||v.code===w)&&f.current?.focus()},"handleKeyDown");return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[o]),oe.useEffect(()=>{let g=c.current,v=f.current;if(m&&g&&v){let b=Ve(()=>{if(!l.isClosePausedRef.current){let x=new CustomEvent(BS);v.dispatchEvent(x),l.isClosePausedRef.current=!0}},"handlePause"),w=Ve(()=>{if(l.isClosePausedRef.current){let x=new CustomEvent(PS);v.dispatchEvent(x),l.isClosePausedRef.current=!1}},"handleResume"),S=Ve(x=>{!g.contains(x.relatedTarget)&&w()},"handleFocusOutResume"),C=Ve(()=>{g.contains(document.activeElement)||w()},"handlePointerLeaveResume");return g.addEventListener("focusin",b),g.addEventListener("focusout",S),g.addEventListener("pointermove",b),g.addEventListener("pointerleave",C),window.addEventListener("blur",b),window.addEventListener("focus",w),()=>{g.removeEventListener("focusin",b),g.removeEventListener("focusout",S),g.removeEventListener("pointermove",b),g.removeEventListener("pointerleave",C),window.removeEventListener("blur",b),window.removeEventListener("focus",w)}}},[m,l.isClosePausedRef]);let y=oe.useCallback(({tabbingDirection:g})=>{let b=a().map(w=>{let S=w.ref.current,C=[S,...N3(S)];return g==="forwards"?C:C.reverse()});return(g==="forwards"?b.reverse():b).flat()},[a]);return oe.useEffect(()=>{let g=f.current;if(g){let v=Ve(b=>{let w=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!w){let C=document.activeElement,x=b.shiftKey;if(b.target===g&&x){u.current?.focus();return}let T=y({tabbingDirection:x?"backwards":"forwards"}),_=T.findIndex(z=>z===C);hg(T.slice(_+1))?b.preventDefault():x?u.current?.focus():d.current?.focus()}},"handleKeyDown");return g.addEventListener("keydown",v),()=>g.removeEventListener("keydown",v)}},[a,y]),(0,Ne.jsxs)(k6,{ref:c,role:"region","aria-label":i.replace("{hotkey}",p),tabIndex:-1,style:{pointerEvents:m?void 0:"none"},children:[m&&(0,Ne.jsx)($N,{ref:u,onFocusFromOutsideViewport:()=>{let g=y({tabbingDirection:"forwards"});hg(g)}}),(0,Ne.jsx)(bx.Slot,{scope:r,children:(0,Ne.jsx)(je.ol,{tabIndex:-1,...s,ref:h})}),m&&(0,Ne.jsx)($N,{ref:d,onFocusFromOutsideViewport:()=>{let g=y({tabbingDirection:"backwards"});hg(g)}})]})},"ToastViewport")),j9="ToastFocusProxy",$N=oe.forwardRef(Ve(function(e,n){let{__scopeToast:r,onFocusFromOutsideViewport:o,...i}=e,s=Yg(j9,r);return(0,Ne.jsx)(ox,{tabIndex:0,...i,ref:n,style:{position:"fixed"},onFocus:l=>{let a=l.relatedTarget;!s.viewport?.contains(a)&&o()}})},"ToastFocusProxy")),qg="Toast",F9="toast.swipeStart",$9="toast.swipeMove",Y9="toast.swipeCancel",q9="toast.swipeEnd",K9=oe.forwardRef(Ve(function(e,n){let{forceMount:r,open:o,defaultOpen:i,onOpenChange:s,...l}=e,[a,c]=ou({prop:o,defaultProp:i??!0,onChange:s,caller:qg});return(0,Ne.jsx)(Gs,{present:r||a,children:(0,Ne.jsx)(W9,{open:a,...l,ref:n,onClose:()=>c(!1),onPause:Tr(e.onPause),onResume:Tr(e.onResume),onSwipeStart:ee(e.onSwipeStart,u=>{u.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:ee(e.onSwipeMove,u=>{let{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","move"),u.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${f}px`)}),onSwipeCancel:ee(e.onSwipeCancel,u=>{u.currentTarget.setAttribute("data-swipe","cancel"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:ee(e.onSwipeEnd,u=>{let{x:d,y:f}=u.detail.delta;u.currentTarget.setAttribute("data-swipe","end"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),u.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),u.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${d}px`),u.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${f}px`),c(!1)})})})},"Toast")),[G9,X9]=R3(qg,{onClose(){}}),W9=oe.forwardRef(Ve(function(e,n){let{__scopeToast:r,type:o=FN.Foreground,duration:i,open:s,onClose:l,onEscapeKeyDown:a,onPause:c,onResume:u,onSwipeStart:d,onSwipeMove:f,onSwipeCancel:h,onSwipeEnd:p,...m}=e,y=Yg(qg,r),g=M3(r),[v,b]=oe.useState(null),w=Je(n,b),S=oe.useRef(null),C=oe.useRef(null),x=i||y.duration,E=oe.useRef(0),A=oe.useRef(x),T=oe.useRef(0),{onToastAdd:_,onToastRemove:z}=y,$=Tr(()=>{v?.contains(document.activeElement)&&y.viewport?.focus(),l()}),I=oe.useCallback(D=>{!D||D===1/0||(window.clearTimeout(T.current),E.current=new Date().getTime(),T.current=window.setTimeout($,D))},[$]);oe.useEffect(()=>{let D=y.viewport;if(D){let K=Ve(()=>{I(A.current),u?.()},"handleResume"),U=Ve(()=>{let re=new Date().getTime()-E.current;A.current=A.current-re,window.clearTimeout(T.current),c?.()},"handlePause");return D.addEventListener(BS,U),D.addEventListener(PS,K),()=>{D.removeEventListener(BS,U),D.removeEventListener(PS,K)}}},[y.viewport,x,c,u,I]),oe.useEffect(()=>{A.current=x,s&&!y.isClosePausedRef.current&&I(x)},[s,x,y.isClosePausedRef,I]),oe.useEffect(()=>()=>{window.clearTimeout(T.current)},[]),oe.useEffect(()=>(_(),()=>z()),[_,z]);let j=oe.useMemo(()=>v?wx(v):null,[v]);return y.viewport?(0,Ne.jsxs)(Ne.Fragment,{children:[j&&(0,Ne.jsx)(J9,{__scopeToast:r,role:"status","aria-live":o===FN.Foreground?"assertive":"polite",children:j}),(0,Ne.jsx)(G9,{scope:r,onClose:$,children:A3.createPortal((0,Ne.jsx)(bx.ItemSlot,{scope:r,children:(0,Ne.jsx)(xg,{asChild:!0,onEscapeKeyDown:ee(a,D=>{g().some(U=>U.ref.current?.contains(D.target))||$()}),children:(0,Ne.jsx)(je.li,{tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":y.swipeDirection,...m,ref:w,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:ee(e.onKeyDown,D=>{D.key==="Escape"&&(a?.(D.nativeEvent),D.nativeEvent.defaultPrevented||$())}),onPointerDown:ee(e.onPointerDown,D=>{D.button===0&&(S.current={x:D.clientX,y:D.clientY})}),onPointerMove:ee(e.onPointerMove,D=>{if(!S.current)return;let K=D.clientX-S.current.x,U=D.clientY-S.current.y,re=!!C.current,Y=["left","right"].includes(y.swipeDirection),ke=["left","up"].includes(y.swipeDirection)?Math.min:Math.max,gt=Y?ke(0,K):0,Dt=Y?0:ke(0,U),Co=D.pointerType==="touch"?10:2,wn={x:gt,y:Dt},W={originalEvent:D,delta:wn};re?(C.current=wn,kf($9,f,W,{discrete:!1})):YN(wn,y.swipeDirection,Co)?(C.current=wn,kf(F9,d,W,{discrete:!1}),D.target.setPointerCapture(D.pointerId)):(Math.abs(K)>Co||Math.abs(U)>Co)&&(S.current=null)}),onPointerUp:ee(e.onPointerUp,D=>{let K=C.current,U=D.target;if(U.hasPointerCapture(D.pointerId)&&U.releasePointerCapture(D.pointerId),C.current=null,S.current=null,K){let re=D.currentTarget,Y={originalEvent:D,delta:K};YN(K,y.swipeDirection,y.swipeThreshold)?kf(q9,p,Y,{discrete:!0}):kf(Y9,h,Y,{discrete:!0}),re.addEventListener("click",ke=>ke.preventDefault(),{once:!0})}})})})}),y.viewport)})]}):null},"ToastImpl")),J9=Ve(t=>{let{__scopeToast:e,children:n,...r}=t,o=Yg(qg,e),[i,s]=oe.useState(!1),[l,a]=oe.useState(!1);return O3(()=>s(!0)),oe.useEffect(()=>{let c=window.setTimeout(()=>a(!0),1e3);return()=>window.clearTimeout(c)},[]),l?null:(0,Ne.jsx)(Dg,{asChild:!0,container:o.announcerContainer||void 0,children:(0,Ne.jsx)(ox,{...r,children:i&&(0,Ne.jsxs)(Ne.Fragment,{children:[o.label," ",n]})})})},"ToastAnnounce"),Q9=oe.forwardRef(Ve(function(e,n){let{__scopeToast:r,...o}=e;return(0,Ne.jsx)(je.div,{...o,ref:n})},"ToastTitle")),Z9=oe.forwardRef(Ve(function(e,n){let{__scopeToast:r,...o}=e;return(0,Ne.jsx)(je.div,{...o,ref:n})},"ToastDescription")),eY="ToastClose",tY=oe.forwardRef(Ve(function(e,n){let{__scopeToast:r,...o}=e,i=X9(eY,r);return(0,Ne.jsx)(nY,{asChild:!0,children:(0,Ne.jsx)(je.button,{type:"button",...o,ref:n,onClick:ee(e.onClick,i.onClose)})})},"ToastClose")),nY=oe.forwardRef(Ve(function(e,n){let{__scopeToast:r,altText:o,...i}=e;return(0,Ne.jsx)(je.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":o||void 0,...i,ref:n})},"ToastAnnounceExclude"));function wx(t){let e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),D3(r)){let o=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!o)if(i){let s=r.dataset.radixToastAnnounceAlt;s&&e.push(s)}else e.push(...wx(r))}}),e}Ve(wx,"getAnnounceTextContent");function kf(t,e,n,{discrete:r}){let o=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?Sg(o,i):o.dispatchEvent(i)}Ve(kf,"handleAndDispatchCustomEvent");var YN=Ve((t,e,n=0)=>{let r=Math.abs(t.x),o=Math.abs(t.y),i=r>o;return e===US.Left||e===US.Right?i&&r>n:!i&&o>n},"isDeltaInDirection");function O3(t=()=>{}){let e=Tr(t);hn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}Ve(O3,"useNextFrame");function D3(t){return t.nodeType===t.ELEMENT_NODE}Ve(D3,"isHTMLElement");function N3(t){let e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:Ve(r=>{let o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP},"acceptNode")});for(;n.nextNode();)e.push(n.currentNode);return e}Ve(N3,"getTabbableCandidates");function hg(t){let e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}Ve(hg,"focusFirst");function Bf({open:t,onOpenChange:e,trigger:n,title:r,description:o,children:i,footer:s}){if(r.trim()==="")throw new Error("A dialog needs a non-empty title.");let l=(0,er.useRef)(null),a=(0,er.useRef)(!1);if(t&&!a.current&&typeof document<"u"){let c=document.activeElement,u=c?.closest('[role="menu"]')?.getAttribute("aria-labelledby");l.current=u&&document.getElementById(u)||c}return a.current=!!t,(0,ge.jsxs)(g$,{open:t,onOpenChange:e,children:[n&&(0,ge.jsx)(v$,{asChild:!0,children:n}),(0,ge.jsxs)(w$,{children:[(0,ge.jsx)(S$,{className:"ad-overlay"}),(0,ge.jsxs)(E$,{className:"ad-dialog",...o?{}:{"aria-describedby":void 0},onCloseAutoFocus:c=>{!n&&l.current instanceof HTMLElement&&l.current.isConnected&&(c.preventDefault(),l.current.focus())},onOpenAutoFocus:c=>{let u=c.currentTarget.querySelector("[data-autofocus]");u&&(c.preventDefault(),u.focus())},children:[(0,ge.jsx)(k$,{className:"ad-dialog__title",children:r}),(0,ge.jsx)(K_,{asChild:!0,children:(0,ge.jsx)(ra,{label:"Close",icon:(0,ge.jsx)(x_,{}),size:"sm",className:"ad-dialog__close",tooltip:!1})}),o&&(0,ge.jsx)(M$,{className:"ad-dialog__description",children:o}),i&&(0,ge.jsx)("div",{className:"ad-dialog__body",children:i}),s&&(0,ge.jsx)("div",{className:"ad-dialog__footer",children:s})]})]})]})}var Kg=K_;function _3({trigger:t,items:e,align:n="end"}){for(let o of e)if(o!=="separator"&&o.label.trim()==="")throw new Error("A menu item needs a non-empty label.");let r=(0,er.isValidElement)(t)&&t.type===ra?(0,er.cloneElement)(t,{tooltip:!1}):t;return(0,ge.jsxs)(x9,{modal:!1,children:[(0,ge.jsx)(E9,{asChild:!0,children:r}),(0,ge.jsx)(T9,{children:(0,ge.jsx)(k9,{className:"ad-menu",align:n,sideOffset:6,children:e.map((o,i)=>o==="separator"?(0,ge.jsx)(R9,{className:"ad-menu__separator"},`sep-${i}`):(0,ge.jsxs)(M9,{className:o.danger?"ad-menu__item ad-menu__item--danger":"ad-menu__item",disabled:o.disabled,onSelect:o.onSelect,children:[o.icon,(0,ge.jsx)("span",{children:o.label}),o.shortcut&&(0,ge.jsx)("kbd",{className:"ad-menu__shortcut",children:o.shortcut})]},`${i}-${o.label}`))})})]})}var rY=(0,er.createContext)(null),qN={info:w7,success:b7,warning:C_,danger:T7},oY={info:"Notice",success:"Success",warning:"Warning",danger:"Error"};function I3({children:t}){let[e,n]=(0,er.useState)([]),r=(0,er.useCallback)(i=>{if(typeof i.title!="string"||i.title.trim()==="")throw new Error("A toast needs a non-empty title.");let s=i.tone===void 0?"info":Object.hasOwn(qN,i.tone)?i.tone:"danger";n(l=>[...l,{...i,tone:s,id:Date.now()+Math.random()}])},[]),o=i=>n(s=>s.filter(l=>l.id!==i));return(0,ge.jsx)(rY.Provider,{value:r,children:(0,ge.jsxs)(B9,{swipeDirection:"right",children:[t,e.map(({id:i,title:s,description:l,tone:a="info"})=>{let c=qN[a];return(0,ge.jsxs)(K9,{className:`ad-toast ad-toast--${a}`,type:a==="danger"?"foreground":"background",duration:a==="danger"?1/0:8e3,onOpenChange:u=>!u&&o(i),children:[(0,ge.jsx)(c,{className:"ad-toast__icon"}),(0,ge.jsxs)("div",{children:[(0,ge.jsxs)(Q9,{className:"ad-toast__title",children:[(0,ge.jsxs)("span",{className:"ad-sr-only",children:[oY[a],": "]}),s]}),l&&(0,ge.jsx)(Z9,{className:"ad-toast__description",children:l})]}),(0,ge.jsx)(tY,{asChild:!0,children:(0,ge.jsx)(ra,{label:"Dismiss",icon:(0,ge.jsx)(x_,{}),size:"sm",tooltip:!1})})]},i)}),(0,ge.jsx)(V9,{className:"ad-toast-viewport",label:"Notifications ({hotkey})"})]})})}var L3="(max-width: 47.99rem)",iY=t=>{let e=window.matchMedia(L3);return e.addEventListener("change",t),()=>e.removeEventListener("change",t)};function z3({brand:t,sidebar:e,topbar:n,children:r}){let[o,i]=(0,Gt.useState)(!1),s=(0,Gt.useRef)(null),l=(0,Gt.useRef)(null),a=(0,Gt.useRef)(!1),c=(0,Gt.useId)(),u=(0,Gt.useId)(),d=(0,Gt.useSyncExternalStore)(iY,()=>window.matchMedia(L3).matches,()=>!1),f=(0,Gt.useRef)(d),h=(0,Gt.useRef)(null),p=(0,Gt.useRef)(null);if(d!==f.current){let v=document.activeElement,b=h.current;p.current=h.current??v,h.current=null,f.current=d,a.current=!1,i(d&&(!!b||!!s.current?.contains(v)))}(0,Gt.useLayoutEffect)(()=>{let v=p.current;p.current=null,v instanceof HTMLElement&&v.isConnected&&v!==document.activeElement&&v!==document.body&&v.focus()},[d]),(0,Gt.useEffect)(()=>{o&&a.current&&s.current?.querySelector("a")?.focus()},[o]);let m=v=>{if(v.key!=="Escape"||!o)return;let b=v.target;!s.current?.contains(b)&&!l.current?.contains(b)||(i(!1),l.current?.focus())},y=(0,Vn.jsxs)("header",{className:"ad-shell__topbar",children:[(0,Vn.jsx)(ra,{ref:l,className:"ad-shell__menu",label:"Navigation",icon:(0,Vn.jsx)(S7,{}),"aria-expanded":o,"aria-controls":c,onClick:()=>{a.current=!o,i(v=>!v)}}),(0,Vn.jsx)("div",{className:"ad-shell__actions",children:n})]},"topbar"),g=(0,Vn.jsxs)("div",{id:c,ref:s,className:"ad-shell__sidebar","data-open":o,onBlur:v=>{!f.current&&!v.relatedTarget&&s.current&&getComputedStyle(s.current).display==="none"&&(h.current=v.target)},onFocus:()=>{h.current=null},children:[(0,Vn.jsx)("p",{className:"ad-shell__brand",children:t}),e]},"sidebar");return(0,Vn.jsxs)("div",{className:"ad-shell",onKeyDown:m,children:[(0,Vn.jsx)("a",{className:"ad-skip-link",href:`#${u}`,children:"Skip to content"}),d?[y,g]:[g,y],(0,Vn.jsx)("main",{id:u,className:"ad-shell__content",tabIndex:-1,children:r})]})}function U3({label:t,items:e}){return(0,Vn.jsx)("nav",{"aria-label":t,children:(0,Vn.jsx)("ul",{className:"ad-sidebar-nav",children:e.map(n=>(0,Vn.jsx)("li",{children:(0,Vn.jsxs)("a",{className:"ad-sidebar-nav__link",href:n.href,"aria-current":n.current?"page":void 0,children:[n.icon,n.label]})},n.href))})})}var sY=Object.defineProperty,H3=(t,e)=>sY(t,"name",{value:e,configurable:!0}),Sx={Horizontal:"horizontal",Vertical:"vertical"},KN=Sx.Horizontal,lY=Object.values(Sx),aY=B3.forwardRef(H3(function(e,n){let{decorative:r,orientation:o=KN,...i}=e,s=V3(o)?o:KN,l=s===Sx.Vertical?s:void 0,a=r?{role:"none"}:{"aria-orientation":l,role:"separator"};return(0,P3.jsx)(je.div,{"data-orientation":s,...a,...i,ref:n})},"Separator"));function V3(t){return lY.includes(t)}H3(V3,"isValidOrientation");var xx="ToggleGroup",[j3,F3]=Ar(xx,[Js]),Loe=Js(),[zoe,Uoe]=j3(xx),[Boe,Poe]=j3(xx),cY=Object.defineProperty,Cx=(t,e)=>cY(t,"name",{value:e,configurable:!0}),$3="Toolbar",[uY,Hoe]=Ar($3,[Js,F3]),Y3=Js(),Voe=F3(),[dY,fY]=uY($3),hY=Gg.forwardRef(Cx(function(e,n){let{__scopeToolbar:r,orientation:o="horizontal",dir:i,loop:s=!0,...l}=e,a=Y3(r),c=Vg(i);return(0,ea.jsx)(dY,{scope:r,orientation:o,dir:c,children:(0,ea.jsx)(i3,{asChild:!0,...a,orientation:o,dir:c,loop:s,children:(0,ea.jsx)(je.div,{role:"toolbar","aria-orientation":o,dir:c,...l,ref:n})})})},"Toolbar")),pY="ToolbarSeparator",mY=Gg.forwardRef(Cx(function(e,n){let{__scopeToolbar:r,...o}=e,i=fY(pY,r);return(0,ea.jsx)(aY,{orientation:i.orientation==="horizontal"?"vertical":"horizontal",...o,ref:n})},"ToolbarSeparator")),gY=Gg.forwardRef(Cx(function(e,n){let{__scopeToolbar:r,...o}=e,i=Y3(r);return(0,ea.jsx)(s3,{asChild:!0,...i,focusable:!e.disabled,children:(0,ea.jsx)(je.button,{type:"button",...o,ref:n})})},"ToolbarButton"));function q3({label:t,children:e,dir:n}){let r=n??(typeof document<"u"&&document.documentElement.dir==="rtl"?"rtl":"ltr");return(0,Nf.jsx)(hY,{className:"ad-toolbar","aria-label":t,dir:r,children:e})}function K3({pressed:t,...e}){return(0,Nf.jsx)(gY,{asChild:!0,children:(0,Nf.jsx)(ra,{size:"sm","aria-pressed":t,...e})})}function Xg(){return(0,Nf.jsx)(mY,{className:"ad-toolbar__separator"})}var yY=40,vY=/^[\p{L}\p{M}\p{N}\p{P}\p{S}\p{Zs}\u200C\u200D]*$/u,bY=/(?![\p{Default_Ignorable_Code_Point}\u2800])[\p{L}\p{N}\p{P}\p{S}]/u,GN="[\\p{Script=Arabic}\\p{Script=Devanagari}\\p{Script=Bengali}\\p{Script=Gujarati}\\p{Script=Gurmukhi}\\p{Script=Tamil}\\p{Script=Telugu}\\p{Script=Kannada}\\p{Script=Malayalam}\\p{Script=Sinhala}\\p{Extended_Pictographic}\\p{Emoji_Modifier}]",wY=new RegExp(`(?<=${GN}\\p{M}*)[\\u200C\\u200D](?=${GN})`,"gu"),SY=/[\p{Default_Ignorable_Code_Point}\u2800]/u,xY=/^[\p{M}\u200C-\u200F]/u,CY=/\p{M}{5,}/u;function au(t){return G3(t,yY)}function G3(t,e){if(typeof t!="string"||t.length>e)return null;let n=t.replace(wY,"");return/[\u200C-\u200F]/.test(n)||!vY.test(t)||!bY.test(t)||CY.test(n)||SY.test(n)||xY.test(t)||/^\s|\s$|\s{2,}|(?! )\p{Zs}|[\u200C-\u200F]$|[\u200C-\u200F]{2,}/u.test(t)?null:t}var XN={active:"",away:"Away",paused:"Paused"},Zc=t=>t.kind==="person"?"person":"agent",X3=t=>typeof t.status=="string"&&Object.hasOwn(XN,t.status)?XN[t.status]:"";function Ex(t){return au(t.name)??(Zc(t)==="agent"?"Unnamed agent":"Unnamed person")}function EY(t){let e=t.trim().split(/\s+/).filter(Boolean);return(e.length>1?[e[0],e[e.length-1]]:[e[0]??""]).map(r=>Array.from(r).find(o=>/[\p{L}\p{N}]/u.test(o))?.toUpperCase()??"").join("")}function W3({entry:t,label:e}){return(0,Xt.jsx)("span",{className:Yo("ad-avatar",`ad-avatar--${Zc(t)}`),role:e?"img":void 0,"aria-label":e,"aria-hidden":e?void 0:!0,children:Zc(t)==="agent"?(0,Xt.jsx)(E7,{"aria-hidden":"true"}):EY(Ex(t))})}function J3(t){let e=Zc(t)==="agent",n=t.actingFor===void 0?null:au(t.actingFor)??"Unnamed person";return[Ex(t),e?"agent":"person",e&&`acting for ${n??"an unknown person"}`,X3(t).toLowerCase()].filter(Boolean).join(", ")}function Tx({entry:t,className:e}){let n=Ex(t),r=X3(t),o=Zc(t)==="agent",i=t.actingFor===void 0?null:au(t.actingFor)??"Unnamed person";return(0,Xt.jsxs)("span",{className:Yo("ad-chip",e),children:[(0,Xt.jsx)(W3,{entry:t}),(0,Xt.jsx)("span",{className:"ad-chip__name",title:n,"aria-hidden":"true",children:n}),o&&(0,Xt.jsx)("span",{className:"ad-pill","aria-hidden":"true",title:i?`An agent acting for ${i}.`:"An agent, not a person.",children:"Agent"}),o&&(0,Xt.jsxs)("span",{className:"ad-chip__meta","aria-hidden":"true",children:["for ",i??"unknown"]}),r&&(0,Xt.jsx)("span",{className:"ad-chip__meta","aria-hidden":"true",children:r}),(0,Xt.jsx)("span",{className:"ad-sr-only",children:J3(t)})]})}function TY(t){let e=t.filter(o=>Zc(o)==="agent").length,n=t.length-e,r=(o,i,s)=>o===0?[]:[`${o} ${o===1?i:s}`];return[...r(n,"person","people"),...r(e,"agent","agents")].join(", ")}function Q3({entries:t,max:e=4,label:n="Here now"}){let r=t.slice(0,e),o=t.length-r.length;return(0,Xt.jsxs)("div",{className:"ad-stack",children:[(0,Xt.jsxs)("ul",{className:"ad-stack__list","aria-label":n,children:[r.map(i=>{let s=J3(i);return(0,Xt.jsx)("li",{title:s,children:(0,Xt.jsx)(W3,{entry:i,label:s})},i.id)}),o>0&&(0,Xt.jsx)("li",{children:(0,Xt.jsxs)("span",{className:"ad-avatar ad-avatar--more",role:"img","aria-label":`${o} more`,children:["+",o]})})]}),t.length>0&&(0,Xt.jsx)("span",{className:"ad-stack__summary",children:TY(t)})]})}function cu({title:t,description:e,action:n}){return(0,En.jsxs)("div",{className:"ad-empty",children:[(0,En.jsx)("h2",{className:"ad-empty__title",children:t}),e&&(0,En.jsx)("p",{className:"ad-empty__description",children:e}),n]})}function Z3({label:t,children:e}){return(0,En.jsx)("ul",{className:"ad-files","aria-label":t,children:e})}var AY=200;function eI({name:t,href:e,kind:n="file",modified:r,editedBy:o,actions:i}){let s=G3(t,AY)??"Untitled",l=r instanceof Date&&!Number.isNaN(r.getTime());return(0,En.jsxs)("li",{className:"ad-file-row",children:[(0,En.jsx)("span",{className:"ad-file-row__icon","aria-hidden":"true",children:n==="folder"?(0,En.jsx)(C7,{}):(0,En.jsx)(x7,{})}),(0,En.jsx)("a",{className:"ad-file-row__name",href:e,title:s,children:s}),(0,En.jsxs)("span",{className:"ad-file-row__meta",children:["Edited by ",(0,En.jsx)(Tx,{entry:o})]}),l?(0,En.jsx)("time",{className:"ad-file-row__time",dateTime:r.toISOString(),children:r.toLocaleDateString("en",{day:"numeric",month:"short",year:"numeric"})}):(0,En.jsx)("span",{className:"ad-file-row__time",children:"Date unknown"}),i&&(0,En.jsx)("span",{className:"ad-file-row__actions",children:i})]})}var Wg=R(P(),1);var Ko=class extends Error{constructor(n,r,o,i=[]){super(r);this.code=n;this.status=o;this.matches=i;this.name="DocsApiError"}code;status;matches},kY=encodeURIComponent;function nI(t){if(!t.token)throw new TypeError("createClient needs a token");let e=t.baseUrl.replace(/\/+$/,""),n=t.fetch??((...y)=>globalThis.fetch(...y)),r=(y,g)=>new Ko("BAD_RESPONSE",`the server sent a reply that is not valid: ${g}`,y),o=y=>typeof y=="object"&&y!==null&&!Array.isArray(y),i=y=>o(y)&&typeof y.occurrence=="number"&&typeof y.context=="string";async function s(y,g,v={},b="application/json"){let w=new URLSearchParams;for(let[T,_]of Object.entries(g.query??{}))_!==void 0&&w.set(T,String(_));let S=w.toString(),C=`${e}${y}${S?`?${S}`:""}`,x={authorization:`Bearer ${t.token}`};g.json&&(x["content-type"]="application/json");let E=await n(C,{method:g.method,headers:x,body:g.body,signal:v.signal});if(E.ok){let T=(E.headers.get("content-type")??"").toLowerCase();if(!T.startsWith(b))throw r(E.status,`unexpected content type "${T}"`);return E}let A;try{let T=await E.json();o(T.error)&&(A=T.error)}catch{}throw new Ko(typeof A?.code=="string"?A.code:"HTTP_ERROR",typeof A?.message=="string"?A.message:`the server answered ${E.status}`,E.status,Array.isArray(A?.matches)?A.matches.filter(i):[])}async function l(y,g,v){let b;try{b=await y.json()}catch{throw r(y.status,"the body is not JSON")}if(!g(b))throw r(y.status,`expected ${v}`);return b}let a=y=>`/api/v1/docs/${kY(y)}`,c=y=>o(y)&&y.ok===!0,u=y=>Array.isArray(y)&&y.every(o),d=async(y,g,v,b,w)=>await l(await s(y,{method:"GET",query:g},w),v,b),f=async(y,g,v,b,w)=>await l(await s(y,{method:"POST",json:!0,body:JSON.stringify(g)},w),v,b),h=(y,g,v)=>f(y,g,c,"{ ok: true }",v),p=(y,g,v)=>d(y,g,u,"a list",v),m=(y,g,v,b)=>f(y,g,w=>o(w)&&typeof w[v]=="string",`{ ${v}: string }`,b);return{async health(y){return await l(await s("/health",{method:"GET"},y),g=>o(g)&&g.ok===!0&&typeof g.pack=="string","{ ok, pack }")},me:y=>d("/api/v1/me",{},g=>o(g)&&typeof g.kind=="string"&&typeof g.name=="string"&&Array.isArray(g.scopes)&&(g.role==="editor"||g.role==="viewer"),"the token identity",y),create:(y,g)=>m("/api/v1/docs",y,"id",g),list:y=>p("/api/v1/docs",{},y),rename:(y,g,v)=>h(`${a(y)}/rename`,g,v),remove:(y,g)=>h(`${a(y)}/remove`,{},g),async read(y,g={},v){return(await s(`${a(y)}/read`,{method:"GET",query:g},v,"text/markdown")).text()},outline:(y,g)=>p(`${a(y)}/outline`,{},g),edits:(y,g)=>p(`${a(y)}/edits`,{},g),insert:(y,g,v)=>h(`${a(y)}/insert`,g,v),replace:(y,g,v)=>h(`${a(y)}/replace`,g,v),delete:(y,g,v)=>h(`${a(y)}/delete`,g,v),append:(y,g,v)=>h(`${a(y)}/append`,g,v),suggest:(y,g,v)=>m(`${a(y)}/suggest`,g,"suggestion",v),suggestions:(y,g={},v)=>p(`${a(y)}/suggestions`,g,v),accept:(y,g,v)=>h(`${a(y)}/accept`,g,v),reject:(y,g,v)=>h(`${a(y)}/reject`,g,v),comment:(y,g,v)=>m(`${a(y)}/comment`,g,"thread",v),reply:(y,g,v)=>h(`${a(y)}/reply`,g,v),resolve:(y,g,v)=>h(`${a(y)}/resolve`,g,v),reopen:(y,g,v)=>h(`${a(y)}/reopen`,g,v),threads:(y,g={},v)=>p(`${a(y)}/threads`,g,v),export:(async(y,g,v)=>{let b=await s(`${a(y)}/export`,{method:"GET",query:g},v,{md:"text/markdown",html:"text/html",odt:"application/vnd.oasis.opendocument.text"}[g.format]);return g.format==="odt"?new Uint8Array(await b.arrayBuffer()):b.text()}),room:(y,g)=>d(`${a(y)}/room`,{},v=>o(v)&&Array.isArray(v.contributors),"{ contributors }",g),async state(y,g){return new Uint8Array(await(await s(`${a(y)}/state`,{method:"GET"},g,"application/octet-stream")).arrayBuffer())},async checkpoint(y,g,v){let b=v?.create===!1?{create:!1}:void 0;return await l(await s(`${a(y)}/checkpoint`,{method:"POST",body:g,query:b},v),c,"{ ok: true }")}}}var kx="agentic-documents.token",Mx=()=>sessionStorage.getItem(kx),rI=t=>sessionStorage.setItem(kx,t),Rx=()=>sessionStorage.removeItem(kx),Jg=t=>nI({baseUrl:location.origin,token:t}),Ox=(0,Wg.createContext)(null);function Go(){let t=(0,Wg.useContext)(Ox);if(!t)throw new Error("no session");return t}function _i(t){return t instanceof Ko?t.code==="UNAUTHENTICATED"?"The server did not accept this token.":t.code==="FORBIDDEN"?"This token may not do that.":t.code==="NO_DOCUMENT"?"This document does not exist. It may have been removed.":t.message:t instanceof Error?`Could not reach the server: ${t.message}`:"Something went wrong."}var uu=t=>t!=="human";var oI=Object.defineProperty,iI=(t,e)=>{let n={};for(var r in t)oI(n,r,{get:t[r],enumerable:!0});return e||oI(n,Symbol.toStringTag,{value:"Module"}),n};function kn(t){this.content=t}kn.prototype={constructor:kn,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,o=r.find(t),i=r.content.slice();return o==-1?i.push(n||t,e):(i[o+1]=e,n&&(i[o]=n)),new kn(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new kn(n)},addToStart:function(t,e){return new kn([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new kn(n)},addBefore:function(t,e,n){var r=this.remove(e),o=r.content.slice(),i=r.find(t);return o.splice(i==-1?o.length:i,0,e,n),new kn(o)},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=kn.from(t),t.size?new kn(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=kn.from(t),t.size?new kn(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=kn.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}};kn.from=function(t){if(t instanceof kn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new kn(e)};var Dx=kn;function gI(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){let s=o.text,l=i.text,a=0;for(;s[a]==l[a];a++)n++;return a&&a<s.length&&a<l.length&&bI(s.charCodeAt(a-1))&&vI(s.charCodeAt(a))&&n--,n}if(o.content.size||i.content.size){let s=gI(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function yI(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),l=e.child(--i),a=s.nodeSize;if(s==l){n-=a,r-=a;continue}if(!s.sameMarkup(l))return{a:n,b:r};if(s.isText&&s.text!=l.text){let c=s.text,u=l.text,d=c.length,f=u.length;for(;d>0&&f>0&&c[d-1]==u[f-1];)d--,f--,n--,r--;return d&&f&&d<c.length&&bI(c.charCodeAt(d-1))&&vI(c.charCodeAt(d))&&(n++,r++),{a:n,b:r}}if(s.content.size||l.content.size){let c=yI(s.content,l.content,n-1,r-1);if(c)return c}n-=a,r-=a}}function vI(t){return t>=56320&&t<57344}function bI(t){return t>=55296&&t<56320}var M=class t{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,o=0,i){for(let s=0,l=0;l<n;s++){let a=this.content[s],c=l+a.nodeSize;if(c>e&&r(a,o+l,i||null,s)!==!1&&a.content.size){let u=l+1;a.nodesBetween(Math.max(0,e-u),Math.min(a.content.size,n-u),r,o+u)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,n-a):l.isLeaf?o?typeof o=="function"?o(l):o:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&r&&(s?s=!1:i+=r),i+=c},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<e.content.length;i++)o.push(e.content[i]);return new t(o,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],o=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),r.push(l),o+=l.nodeSize),s=a}return new t(r,o)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new t(o,i)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(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 o=this.content[n];e(o,r,n),r+=o.nodeSize}}findDiffStart(e,n=0){return gI(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return yI(this,e,n,r)}findIndex(e){if(e==0)return Qg(0,e);if(e==this.size)return Qg(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 o=this.child(n),i=r+o.nodeSize;if(i>=e)return i==e?Qg(n+1,i):Qg(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return t.fromArray(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let o=0;o<e.length;o++){let i=e[o];r+=i.nodeSize,o&&i.isText&&e[o-1].sameMarkup(i)?(n||(n=e.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new t(n||e,r)}static from(e){if(!e)return t.empty;if(e instanceof t)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new t([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};M.empty=new M([],0);var Nx={index:0,offset:0};function Qg(t,e){return Nx.index=t,Nx.offset=e,Nx}function ty(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(!ty(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ty(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}var ve=class t{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let o=0;o<e.length;o++){let i=e[o];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,o));else{if(i.type.excludes(this.type))return e;!r&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}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&&ty(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`);return r.create(n.attrs)}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 t.none;if(e instanceof t)return[e];let n=e.slice();return n.sort((r,o)=>r.type.rank-o.type.rank),n}};ve.none=[];var Qs=class extends Error{},N=class t{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=SI(this.content,e+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(wI(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 t.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(M.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new t(e,r,o)}};N.empty=new N(M.empty,0,0);function wI(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:l}=t.findIndex(n);if(o==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(wI(i.content,e-o-1,n-o-1)))}function SI(t,e,n,r,o,i){let{index:s,offset:l}=t.findIndex(e),a=t.maybeChild(s);if(l==e||a.isText)return i&&r<=0&&o<=0&&!i.canReplace(s,s,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=SI(a.content,e-l-1,n,s==0?r-1:0,s==t.childCount-1?o-1:0,a);return c&&t.replaceChild(s,a.copy(c))}function MY(t,e,n){if(n.openStart>t.depth)throw new Qs("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new Qs("Inconsistent open depths");return xI(t,e,n,0)}function xI(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r<t.depth-n.openStart){let s=xI(t,e,n,r+1);return i.copy(i.content.replaceChild(o,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,l=s.content;return la(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=RY(n,t);return la(i,EI(t,s,l,e,r))}else return la(i,ny(t,e,r))}function CI(t,e){if(!e.type.compatibleContent(t.type))throw new Qs("Cannot join "+e.type.name+" onto "+t.type.name)}function _x(t,e,n){let r=t.node(n);return CI(r,e.node(n)),r}function sa(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 Pf(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(sa(t.nodeAfter,r),i++));for(let l=i;l<s;l++)sa(o.child(l),r);e&&e.depth==n&&e.textOffset&&sa(e.nodeBefore,r)}function la(t,e){if(!t.type.validContent(e))throw new Qs("Invalid content for node "+t.type.name);return t.copy(e)}function EI(t,e,n,r,o){let i=t.depth>o&&_x(t,e,o+1),s=r.depth>o&&_x(n,r,o+1),l=[];return Pf(null,t,o,l),i&&s&&e.index(o)==n.index(o)?(CI(i,s),sa(la(i,EI(t,e,n,r,o+1)),l)):(i&&sa(la(i,ny(t,e,o+1)),l),Pf(e,n,o,l),s&&sa(la(s,ny(n,r,o+1)),l)),Pf(r,null,o,l),new M(l)}function ny(t,e,n){let r=[];if(Pf(null,t,n,r),t.depth>n){let o=_x(t,e,n+1);sa(la(o,ny(t,e,n+1)),r)}return Pf(e,null,n,r),new M(r)}function RY(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(M.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var ry=class t{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],o=e.child(n);return r?e.child(n).cut(r):o}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],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)o+=r.child(i).nodeSize;return o}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ve.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),o=e.maybeChild(n);if(!r){let l=r;r=o,o=l}let i=r.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!o||!i[s].isInSet(o.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,o=e.parent.maybeChild(e.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!o||!r[i].isInSet(o.marks))&&(r=r[i--].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 aa(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=[],o=0,i=n;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),c=i-a;if(r.push(s,l,o+a),!c||(s=s.child(l),s.isText))break;i=c-1,o+=a+1}return new t(n,r,i)}static resolveCached(e,n){let r=sI.get(e);if(r)for(let i=0;i<r.elts.length;i++){let s=r.elts[i];if(s.pos==n)return s}else sI.set(e,r=new Ix);let o=r.elts[r.i]=t.resolve(e,n);return r.i=(r.i+1)%OY,o}},Ix=class{constructor(){this.elts=[],this.i=0}},OY=12,sI=new WeakMap,aa=class{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)}},DY=Object.create(null),nr=class t{constructor(e,n,r,o=ve.none){this.type=e,this.attrs=n,this.marks=o,this.content=r||M.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,o=0){this.content.nodesBetween(e,n,r,o,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,o){return this.content.textBetween(e,n,r,o)}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&&ty(this.attrs,n||e.defaultAttrs||DY)&&ve.sameSet(this.marks,r||ve.none)}copy(e=null){return e==this.content?this:new t(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new t(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 N.empty;let o=this.resolve(e),i=this.resolve(n),s=r?0:o.sharedDepth(n),l=o.start(s),c=o.node(s).content.cut(o.pos-l,i.pos-l);return new N(c,o.depth-s,i.depth-s)}replace(e,n,r){return MY(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:o}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(o==e||n.isText)return n;e-=o+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 o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}resolve(e){return ry.resolveCached(this,e)}resolveNoCache(e){return ry.resolve(this,e)}rangeHasMark(e,n,r){let o=!1;return n>e&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}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()+")"),TI(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=M.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let a=o;a<i;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,n,r,o){if(o&&!this.type.allowsMarks(o))return!1;let i=this.contentMatchAt(e).matchType(r),s=i&&i.matchFragment(this.content,n);return s?s.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),lI(this.type.attrs,this.attrs,"node",this.type.name);let e=ve.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];lI(r.type.attrs,r.attrs,"mark",r.type.name),e=r.addToSet(e)}if(!ve.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 o=M.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};nr.prototype.text=void 0;var Lx=class t extends nr{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):TI(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 t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(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 TI(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}function lI(t,e,n,r){for(let o in e)if(!(o in t))throw new RangeError(`Unsupported attribute ${o} for ${n} of type ${r}`);for(let o in t)t[o].validate&&t[o].validate(e[o])}var ca=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new zx(e,n);if(r.next==null)return t.empty;let o=AI(r);r.next&&r.err("Unexpected trailing text");let i=BY(UY(o));return PY(i,r),i}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 o=this;for(let i=n;o&&i<r;i++)o=o.matchType(e.child(i).type);return o}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 o=[this];function i(s,l){let a=s.matchFragment(e,r);if(a&&(!n||a.validEnd))return M.from(l.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:u,next:d}=s.next[c];if(!(u.isText||u.hasRequiredAttrs())&&o.indexOf(d)==-1){o.push(d);let f=i(d,l.concat(u));if(f)return f}}return null}return i(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 o=r.shift(),i=o.match;if(i.matchType(e)){let s=[];for(let l=o;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),n[l.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 o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&n(r.next[o].next)}return n(this),e.map((r,o)=>{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)i+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return i}).join(`
|
|
50
|
+
`)}};ca.empty=new ca(!0);var zx=class{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 AI(t){let e=[];do e.push(NY(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function NY(t){let e=[];do e.push(_Y(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function _Y(t){let e=zY(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=IY(t,e);else break;return e}function aI(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function IY(t,e){let n=aI(t),r=n;return t.eat(",")&&(t.next!="}"?r=aI(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function LY(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.isInGroup(e)&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function zY(t){if(t.eat("(")){let e=AI(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=LY(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 UY(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,l,a){let c={term:a,to:l};return e[s].push(c),c}function o(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,c)=>a.concat(i(c,l)),[]);if(s.type=="seq")for(let a=0;;a++){let c=i(s.exprs[a],l);if(a==s.exprs.length-1)return c;o(c,l=n())}else if(s.type=="star"){let a=n();return r(l,a),o(i(s.expr,a),a),[r(a)]}else if(s.type=="plus"){let a=n();return o(i(s.expr,l),a),o(i(s.expr,a),a),[r(a)]}else{if(s.type=="opt")return[r(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let c=0;c<s.min;c++){let u=n();o(i(s.expr,a),u),a=u}if(s.max==-1)o(i(s.expr,a),a);else for(let c=s.min;c<s.max;c++){let u=n();r(a,u),o(i(s.expr,a),u),a=u}return[r(a)]}else{if(s.type=="name")return[r(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function kI(t,e){return e-t}function cI(t,e){let n=[];return r(e),n.sort(kI);function r(o){let i=t[o];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(o);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&n.indexOf(a)==-1&&r(a)}}}function BY(t){let e=Object.create(null);return n(cI(t,0));function n(r){let o=[];r.forEach(s=>{t[s].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let u=0;u<o.length;u++)o[u][0]==l&&(c=o[u][1]);cI(t,a).forEach(u=>{c||o.push([l,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=e[r.join(",")]=new ca(r.indexOf(t.length-1)>-1);for(let s=0;s<o.length;s++){let l=o[s][1].sort(kI);i.next.push({type:o[s][0],next:e[l.join(",")]||n(l)})}return i}}function PY(t,e){for(let n=0,r=[t];n<r.length;n++){let o=r[n],i=!o.validEnd,s=[];for(let l=0;l<o.next.length;l++){let{type:a,next:c}=o.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function MI(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 RI(t,e){let n=Object.create(null);for(let r in t){let o=t[r],i=e&&e[r];if(i===void 0)if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r);else o.validate&&o.validate(i);n[r]=i}return n}function OI(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new Ux(t,r,e[r]);return n}var oy=class t{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=OI(e,r.attrs),this.defaultAttrs=MI(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==ca.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:RI(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new nr(this,this.computeAttrs(e),M.from(n),ve.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new nr(this,this.computeAttrs(e),n,ve.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let o=this.contentMatch.matchFragment(n),i=o&&o.fillBefore(M.empty,!0);return i?new nr(this,e,n.append(i),ve.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){}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:ve.none:e}static compile(e,n){let r=Object.create(null);e.forEach((i,s)=>r[i]=new t(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function HY(t,e,n){let r=n.split("|");return o=>{let i=o===null?"null":typeof o;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${i}`)}}var Ux=class{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?HY(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Vf=class t{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=OI(e,o.attrs),this.excluded=null;let i=MI(this.attrs);this.instance=i?new ve(this,i):null}create(e=null){return!e&&this.instance?this.instance:new ve(this,RI(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new t(i,o++,n,s)),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]}excludes(e){return this.excluded.indexOf(e)>-1}},ua=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Dx.from(e.nodes),n.marks=Dx.from(e.marks||{}),this.nodes=oy.compile(this.spec.nodes,this),this.marks=Vf.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=r[s]||(r[s]=ca.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?uI(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:uI(this,s.split(" "))}this.nodeFromJSON=o=>nr.fromJSON(this,o),this.markFromJSON=o=>ve.fromJSON(this,o),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof oy){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,o)}text(e,n){let r=this.nodes.text;return new Lx(r,r.defaultAttrs,e,ve.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 uI(t,e){let n=[];for(let r=0;r<e.length;r++){let o=e[r],i=t.marks[o],s=i;if(i)n.push(i);else for(let l in t.marks){let a=t.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function VY(t){return t.tag!=null}function jY(t){return t.style!=null}var Ii=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(o=>{if(VY(o))this.tags.push(o);else if(jY(o)){let i=/[^=]*/.exec(o.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(o)}}),this.normalizeLists=!this.tags.some(o=>{if(!/^(ul|ol)\b/.test(o.tag)||!o.node)return!1;let i=e.nodes[o.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let r=new iy(this,n,!1);return r.addAll(e,ve.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new iy(this,n,!0);return r.addAll(e,ve.none,n.from,n.to),N.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let i=this.tags[o];if(YY(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,r,o){for(let i=o?this.styles.indexOf(o)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let a=s.getAttrs(n);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,o)}for(let o in e.marks){let i=e.marks[o].spec.parseDOM;i&&i.forEach(s=>{r(s=fI(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=fI(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},DI={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},FY={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},NI={ol:!0,ul:!0},jf=1,Bx=2,Hf=4;function dI(t,e,n){return e!=null?(e?jf:0)|(e==="full"?Bx:0):t&&t.whitespace=="pre"?jf|Bx:n&~Hf}var du=class{constructor(e,n,r,o,i,s){this.type=e,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=ve.none,this.match=i||(s&Hf?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&jf)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.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&&!DI.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}},iy=class{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let o=n.topNode,i,s=dI(null,n.preserveWhitespace,0)|(r?Hf:0);o?i=new du(o.type,o.attrs,ve.none,!0,n.topMatch||o.type.contentMatch,s):r?i=new du(null,null,ve.none,!0,null,s):i=new du(e.schema.topNodeType,null,ve.none,!0,null,s),this.nodes=[i],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,o=this.top,i=o.options&Bx?"full":this.localPreserveWS||(o.options&jf)>0,{schema:s}=this.parser;if(i==="full"||o.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
|
|
51
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=r.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[a]&&this.insertNode(s.text(l[a]),n,!/\S/.test(l[a]));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 l=o.content[o.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(r=r.slice(1))}r&&this.insertNode(s.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let o=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;NI.hasOwnProperty(s)&&this.parser.normalizeLists&&$Y(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,r));e:if(a?a.ignore:FY.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let c,u=this.needsBlock;if(DI.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=a&&a.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(e,n);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=o}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
52
|
+
`),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 o=0;o<this.parser.matchedStyles.length;o++){let i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?n=n.filter(c=>!a.clearMark(c)):n=n.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return n}addElementByRule(e,n,r,o){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let a=this.enter(s,n.attrs||null,r,n.preserveWhitespace);a&&(i=!0,r=a)}else{let a=this.parser.schema.marks[n.mark];r=r.concat(a.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(o)this.addElement(e,r,o);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,r,!1));else{let a=e;typeof n.contentElement=="string"?a=e.querySelector(n.contentElement):typeof n.contentElement=="function"?a=n.contentElement(e):n.contentElement&&(a=n.contentElement),this.findAround(e,a,!0),this.addAll(a,r),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,r,o){let i=r||0;for(let s=r?e.childNodes[r]:e.firstChild,l=o==null?null:e.childNodes[o];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,r){let o,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],c=a.findWrapping(e);if(c&&(!o||o.length>c.length+l)&&(o=c,i=a,!c.length))break;if(a.solid){if(r)break;l+=2}}if(!o)return null;this.sync(i);for(let s=0;s<o.length;s++)n=this.enterInner(o[s],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let o=this.findPlace(e,n,r);if(o){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=ve.none;for(let l of o.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):hI(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,r,o){let i=this.findPlace(e.create(n),r,!1);return i&&(i=this.enterInner(e,n,r,!0,o)),i}enterInner(e,n,r,o=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=dI(e,i,s.options);s.options&Hf&&s.content.length==0&&(l|=Hf);let a=ve.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):hI(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new du(e,n,a,o,null,l)),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|=jf)}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 o=r.length-1;o>=0;o--)e+=r[o].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 o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&n.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(l,a)=>{for(;l>=0;l--){let c=n[l];if(c==""){if(l==n.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let u=a>0||a==0&&o?this.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;a--}}return!0};return s(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 $Y(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&NI.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function YY(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function fI(t){let e={};for(let n in t)e[n]=t[n];return e}function hI(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:u}=l.edge(a);if(c==e||i.indexOf(u)<0&&s(u))return!0}};if(s(o.contentMatch))return!0}}var Li=class t{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Zg(n).createDocumentFragment());let o=r,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let c=s.marks[a];if(!this.marks[c.type.name]){a++;continue}if(!c.eq(i[l][0])||c.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)o=i.pop()[1];for(;a<s.marks.length;){let c=s.marks[a++],u=this.serializeMark(c,s.isInline,n);u&&(i.push([c,o]),o.appendChild(u.dom),o=u.contentDOM||u.dom)}}o.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){if(e.isText)return Zg(n).createTextNode(e.text);let{dom:r,contentDOM:o}=ey(Zg(n),this.nodes[e.type.name](e),null,e.attrs);if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,o)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let o=e.marks.length-1;o>=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&ey(Zg(r),o(e,n),null,e.attrs)}static renderSpec(e,n,r=null,o){return typeof n=="string"?{dom:e.createTextNode(n)}:ey(e,n,r,o)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=pI(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return pI(e.marks)}};function pI(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Zg(t){return t.document||window.document}var mI=new WeakMap;function qY(t){let e=mI.get(t);return e===void 0&&mI.set(t,e=KY(t)),e}function KY(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 o=0;o<r.length;o++)n(r[o]);else for(let o in r)n(r[o])}return n(t),e}function ey(t,e,n,r){if(e.nodeType==1)return{dom:e};if(e.dom&&e.dom.nodeType==1)return e;let o=e[0],i;if(typeof o!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=qY(r))&&i.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 s=o.indexOf(" ");s>0&&(n=o.slice(0,s),o=o.slice(s+1));let l,a=n?t.createElementNS(n,o):t.createElement(o),c=e[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?a.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&a.style?a.style.cssText=c[d]:a.setAttribute(d,c[d])}}for(let d=u;d<e.length;d++){let f=e[d];if(f===0){if(d<e.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else if(typeof f=="string")a.appendChild(t.createTextNode(f));else{let{dom:h,contentDOM:p}=ey(t,f,n,r);if(a.appendChild(h),p){if(l)throw new RangeError("Multiple content holes");l=p}}}return{dom:a,contentDOM:l}}var UI=65535,BI=Math.pow(2,16);function XY(t,e){return t+e*BI}function _I(t){return t&UI}function WY(t){return(t-(t&UI))/BI}var PI=1,HI=2,sy=4,VI=8,Yf=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&VI)>0}get deletedBefore(){return(this.delInfo&(PI|sy))>0}get deletedAfter(){return(this.delInfo&(HI|sy))>0}get deletedAcross(){return(this.delInfo&sy)>0}},zi=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=_I(e);if(!this.inverted)for(let o=0;o<r;o++)n+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+n+WY(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 o=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let c=this.ranges[l+i],u=this.ranges[l+s],d=a+c;if(e<=d){let f=c?e==a?-1:e==d?1:n:n,h=a+o+(f<0?0:u);if(r)return h;let p=e==(n<0?a:d)?null:XY(l/3,e-a),m=0;return c&&(m|=e==a?HI:e==d?PI:sy,(n<0?e!=a:e!=d)&&(m|=VI)),new Yf(h,m,p)}o+=u-c}return r?e+o:new Yf(e+o,0,null)}touches(e,n){let r=0,o=_I(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let c=this.ranges[l+i],u=a+c;if(e<=u&&l==o*3)return!0;r+=this.ranges[l+s]-c}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o<this.ranges.length;o+=3){let s=this.ranges[o],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),c=this.ranges[o+n],u=this.ranges[o+r];e(l,l+c,a,a+u),i+=u-c}}invert(){return new t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?t.empty:new t(e<0?[0,-e,0]:[0,0,e])}};zi.empty=new zi([]);var qf=class t{constructor(e,n,r=0,o=e?e.length:0){this.mirror=n,this.from=r,this.to=o,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new t(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 o=e.getMirror(n);this.appendMap(e._maps[n],o!=null&&o<n?r+o: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 o=e.getMirror(n);this.appendMap(e._maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new t;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 o=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Yf(e,o,null)}},Px=Object.create(null),bt=class{getMap(){return zi.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Px[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 Px)throw new RangeError("Duplicate use of step JSON ID "+e);return Px[e]=n,n.prototype.jsonID=e,n}},Qt=class t{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new t(e,null)}static fail(e){return new t(null,e)}static fromReplace(e,n,r,o){try{return t.ok(e.replace(n,r,o))}catch(i){if(i instanceof Qs)return t.fail(i.message);throw i}}};function Fx(t,e,n){let r=[];for(let o=0;o<t.childCount;o++){let i=t.child(o);i.content.size&&(i=i.copy(Fx(i.content,e,i))),i.isInline&&(i=e(i,n,o)),r.push(i)}return M.fromArray(r)}var Kf=class t extends bt{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),o=r.node(r.sharedDepth(this.to)),i=new N(Fx(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return Qt.fromReplace(e,this.from,this.to,i)}invert(e){let n=[];return e.nodesBetween(this.from,this.to,(r,o)=>{if(r.isInline&&r.isAtom){let i=this.mark.addToSet(r.marks);if(!ve.sameSet(i,r.marks)){let s=Math.max(this.from,o),l=Math.min(this.to,o+r.nodeSize);ly(Zs,s,l,this.mark,n);for(let a of r.marks)a.isInSet(i)||ly(t,s,l,a,n)}}}),n.length==1?n[0]:new Gf(n)}map(e){let n=e.map(this.from,1),r=e.map(this.to,-1);return n>=r?null:new t(n,r,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(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 t(n.from,n.to,e.markFromJSON(n.mark))}};bt.jsonID("addMark",Kf);var Zs=class t extends bt{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 N(Fx(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return Qt.fromReplace(e,this.from,this.to,r)}invert(e){let n=[];return e.nodesBetween(this.from,this.to,(r,o)=>{r.isInline&&r.isAtom&&this.mark.isInSet(r.marks)&&ly(Kf,Math.max(this.from,o),Math.min(this.to,o+r.nodeSize),this.mark,n)}),n.length==1?n[0]:new Gf(n)}map(e){let n=e.map(this.from,1),r=e.map(this.to,-1);return n>=r?null:new t(n,r,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(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 t(n.from,n.to,e.markFromJSON(n.mark))}};bt.jsonID("removeMark",Zs);function ly(t,e,n,r,o){let i=o.length?o[o.length-1]:null;i&&i instanceof t&&i.to==e&&i.mark.eq(r)?o[o.length-1]=new t(i.from,n,r):o.push(new t(e,n,r))}var Gf=class t extends bt{constructor(e){super(),this.steps=e}apply(e){for(let n of this.steps){let r=n.apply(e);if(!r.doc)return r;e=r.doc}return new Qt(e,null)}invert(e){return new t(this.steps.map(n=>n.invert(e)))}map(e){let n=[];for(let r of this.steps){let o=r.map(e);o&&n.push(o)}return n.length?new t(n):null}toJSON(){return{stepType:"markSet",steps:this.steps.map(e=>e.toJSON())}}static fromJSON(e,n){if(!Array.isArray(n.steps)||!n.steps.every(r=>r.stepType=="addMark"||r.stepType=="removeMark"))throw new RangeError("Invalid JSON for MarkSetStep");return new t(n.steps.map(r=>bt.fromJSON(e,r)))}};bt.jsonID("markSet",Gf);var Xf=class t extends bt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Qt.fromReplace(e,this.pos,this.pos+1,new N(M.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 o=0;o<n.marks.length;o++)if(!n.marks[o].isInSet(r))return new t(this.pos,n.marks[o]);return new t(this.pos,this.mark)}}return new fu(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(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 t(n.pos,e.markFromJSON(n.mark))}};bt.jsonID("addNodeMark",Xf);var fu=class t extends bt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Qt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Qt.fromReplace(e,this.pos,this.pos+1,new N(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Xf(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(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 t(n.pos,e.markFromJSON(n.mark))}};bt.jsonID("removeNodeMark",fu);var dt=class t extends bt{constructor(e,n,r,o=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=o}apply(e){return this.structure&&Vx(e,this.from,this.to)?Qt.fail("Structure replace would overwrite content"):Qt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new zi([this.from,this.to-this.from,this.slice.size])}invert(e){return new t(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&&t.MAP_BIAS<0?n:e.mapResult(this.from,1);return r.deletedAcross&&n.deletedAcross?null:new t(r.pos,Math.max(r.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof t)||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?N.empty:new N(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new t(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?N.empty:new N(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new t(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 t(n.from,n.to,N.fromJSON(e,n.slice),!!n.structure)}};dt.MAP_BIAS=1;bt.jsonID("replace",dt);var At=class t extends bt{constructor(e,n,r,o,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=o,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Vx(e,this.from,this.gapFrom)||Vx(e,this.gapTo,this.to)))return Qt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Qt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Qt.fromReplace(e,this.from,this.to,r):Qt.fail("Content does not fit in gap")}getMap(){return new zi([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 t(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),o=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||o<n.pos||i>r.pos?null:new t(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,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 t(n.from,n.to,n.gapFrom,n.gapTo,N.fromJSON(e,n.slice),n.insert,!!n.structure)}};bt.jsonID("replaceAround",At);function Vx(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function JY(t,e,n,r){let o=[];t.doc.nodesBetween(e,n,(i,s,l)=>{if(!i.isInline)return;let a=i.marks;if(!r.isInSet(a)&&l.type.allowsMarkType(r.type)){let c=Math.max(s,e),u=Math.min(s+i.nodeSize,n);ly(Kf,c,u,r,o)}}),o.forEach(i=>t.step(i))}function QY(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline||!s.isAtom)return;i++;let a=null;if(r instanceof Vf){let c=s.marks,u;for(;u=r.isInSet(c);)(a||(a=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(s.marks)&&(a=[r]):a=s.marks;if(a&&a.length){let c=Math.min(l+s.nodeSize,n);for(let u=0;u<a.length;u++){let d=a[u],f;for(let h=0;h<o.length;h++){let p=o[h];p.step==i-1&&d.eq(o[h].style)&&(f=p)}f?(f.to=c,f.step=i):o.push({style:d,from:Math.max(l,e),to:c,step:i})}}}),o.forEach(s=>t.step(new Zs(s.from,s.to,s.style)))}function $x(t,e,n,r=n.contentMatch,o=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let c=i.child(a),u=l+c.nodeSize,d=r.matchType(c.type);if(!d)s.push(new dt(l,u,N.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||t.step(new Zs(l,u,c.marks[f]));if(o&&c.isText&&n.whitespace!="pre"){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(c.text);)p||(p=new N(M.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new dt(l+f.index,l+f.index+f[0].length,p))}}l=u}if(!r.validEnd){let a=r.fillBefore(M.empty,!0);t.replace(l,l,new N(a,0,0))}for(let a=s.length-1;a>=0;a--)t.step(s[a])}function ZY(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ui(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,o=0,i=0;;--r){let s=t.$from.node(r),l=t.$from.index(r)+o,a=t.$to.indexAfter(r)-i;if(r<t.depth&&s.canReplace(l,a,n))return r;if(r==0||s.type.spec.isolating||!ZY(s,l,a))break;l&&(o=1),a<s.childCount&&(i=1)}return null}function eq(t,e,n){let{$from:r,$to:o,depth:i}=e,s=r.before(i+1),l=o.after(i+1),a=s,c=l,u=M.empty,d=0;for(let p=i,m=!1;p>n;p--)m||r.index(p)>0?(m=!0,u=M.from(r.node(p).copy(u)),d++):a--;let f=M.empty,h=0;for(let p=i,m=!1;p>n;p--)m||o.after(p+1)<o.end(p)?(m=!0,f=M.from(o.node(p).copy(f)),h++):c++;t.step(new At(a,c,s,l,new N(u.append(f),d,h),u.size-d,!0))}function pu(t,e,n=null,r=t){let o=tq(t,e),i=o&&nq(r,e);return i?o.map(II).concat({type:e,attrs:n}).concat(i.map(II)):null}function II(t){return{type:t,attrs:null}}function tq(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.contentMatchAt(r).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(r,o,s)?i:null}function nq(t,e){let{parent:n,startIndex:r,endIndex:o}=t,i=n.child(r),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let c=r;a&&c<o;c++)a=a.matchType(n.child(c).type);return!a||!a.validEnd?null:s}function rq(t,e,n){let r=M.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let l=n[s].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new At(o,i,o,i,new N(r,0,0),n.length,!0))}function oq(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let a=typeof o=="function"?o(s):o;if(s.isTextblock&&!s.hasMarkup(r,a)&&iq(t.doc,t.mapping.slice(i).map(l),r)){let c=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!p?c=!1:!h&&p&&(c=!0)}c===!1&&FI(t,s,l,i),$x(t,t.mapping.slice(i).map(l,1),r,void 0,c===null);let u=t.mapping.slice(i),d=u.map(l,1),f=u.map(l+s.nodeSize,1);return t.step(new At(d,f,d+1,f-1,new N(M.from(r.create(a,null,s.marks)),0,0),1,!0)),c===!0&&jI(t,s,l,i),!1}})}function jI(t,e,n,r){e.forEach((o,i)=>{if(o.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(o.text);){let a=t.mapping.slice(r).map(n+1+i+s.index);t.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function FI(t,e,n,r){e.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
|
|
53
|
+
`))}})}function iq(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function sq(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new At(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new N(M.from(s),0,0),1,!0))}function Jr(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let c=o.depth-1,u=n-2;c>i;c--,u--){let d=o.node(c),f=o.index(c);if(d.type.spec.isolating)return!1;let h=d.content.cutByIndex(f,d.childCount),p=r&&r[u+1];p&&(h=h.replaceChild(0,p.type.create(p.attrs)));let m=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!m.type.validContent(h))return!1}let l=o.indexAfter(i),a=r&&r[0];return o.node(i).canReplaceWith(l,l,a?a.type:o.node(i+1).type)}function lq(t,e,n=1,r){let o=t.doc.resolve(e),i=M.empty,s=M.empty;for(let l=o.depth,a=o.depth-n,c=n-1;l>a;l--,c--){i=M.from(o.node(l).copy(i));let u=r&&r[c];s=M.from(u?u.type.create(u.attrs,s):o.node(l).copy(s))}t.step(new dt(e,e,new N(i.append(s),n,n),!0))}function yo(t,e){let n=t.resolve(e),r=n.index();return $I(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function aq(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let o=0;o<e.childCount;o++){let i=e.child(o),s=i.type==r?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function $I(t,e){return!!(t&&e&&!t.isLeaf&&aq(t,e))}function mu(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,l=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),l++,s=r.node(o).maybeChild(l)):(i=r.node(o).maybeChild(l-1),s=r.node(o+1)),i&&!i.isTextblock&&$I(i,s)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function cq(t,e,n){let r=null,{linebreakReplacement:o}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(o&&s.inlineContent){let u=s.whitespace=="pre",d=!!s.contentMatch.matchType(o);u&&!d?r=!1:!u&&d&&(r=!0)}let l=t.steps.length;if(r===!1){let u=t.doc.resolve(e+n);FI(t,u.node(),u.before(),l)}s.inlineContent&&$x(t,e+n-1,s,i.node().contentMatchAt(i.index()),r==null);let a=t.mapping.slice(l),c=a.map(e-n);if(t.step(new dt(c,a.map(e+n,-1),N.empty,!0)),r===!0){let u=t.doc.resolve(c);jI(t,u.node(),u.before(),t.steps.length)}return t}function uq(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 o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i<r.node(o).childCount)return null}return null}function uy(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let o=n.content;for(let i=0;i<n.openStart;i++)o=o.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=r.depth;s>=0;s--){let l=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,a=r.index(s)+(l>0?1:0),c=r.node(s),u=!1;if(i==1)u=c.canReplace(a,a,o);else{let d=c.contentMatchAt(a).findWrapping(o.firstChild.type);u=d&&c.canReplaceWith(a,a,d[0])}if(u)return l==0?r.pos:l<0?r.before(s+1):r.after(s+1)}return null}function da(t,e,n=e,r=N.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return YI(o,i,r)?new dt(e,n,r):new jx(o,i,r).fit()}function YI(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var jx=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=M.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=M.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,l=o.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new N(i,s,l);return e>-1?new At(r.pos,e,this.$to.pos,this.$to.end(),a,n):a.size||r.pos!=this.$to.pos?new dt(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let i=n.firstChild;if(n.childCount>1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=LI(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],u,d=null;if(n==1&&(s?c.matchType(s.type)||(d=c.fillBefore(M.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:l,parent:i,inject:d};if(n==2&&s&&(u=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:l,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced;return zI(e,-1)<=n?!1:(this.unplaced.size>1&&zI(e,1)>r&&r++,this.unplaced=new N(e,n+1,r),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=LI(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new N(Ff(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new N(Ff(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let m=0;m<i.length;m++)this.openFrontierNode(i[m]);let s=this.unplaced,l=r?r.content:s.content,a=s.openStart-e,c=0,u=[],{match:d,type:f}=this.frontier[n];if(o){for(let m=0;m<o.childCount;m++)u.push(o.child(m));d=d.matchFragment(o)}let h=l.size+e-(s.content.size-s.openEnd);for(;c<l.childCount;){let m=l.child(c),y=d.matchType(m.type);if(!y)break;c++,(c>1||a==0||m.content.size)&&(d=y,u.push(qI(m.mark(f.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?h:-1)))}let p=c==l.childCount;p||(h=-1),this.placed=$f(this.placed,n,M.from(u)),this.frontier[n].match=d,p&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,y=l;m<h;m++){let g=y.lastChild;this.frontier.push({type:g.type,match:g.contentMatchAt(g.childCount)}),y=g.content}this.unplaced=p?e==0?N.empty:new N(Ff(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new N(Ff(s.content,e,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Hx(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,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Hx(e,n,o,r,i);if(s){for(let l=n-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],u=Hx(e,l,c,a,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?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=$f(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=$f(this.placed,this.depth,M.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(M.empty,!0);n.childCount&&(this.placed=$f(this.placed,this.frontier.length,n))}};function Ff(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Ff(t.firstChild.content,e-1,n)))}function $f(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy($f(t.lastChild.content,e-1,n)))}function LI(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function qI(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,qI(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(M.empty,!0)))),t.copy(r)}function Hx(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=r.fillBefore(i.content,!0,s);return l&&!dq(n,i.content,s)?l:null}function dq(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function fq(t){return t.spec.defining||t.spec.definingForContent}function zI(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 hq(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let o=t.doc.resolve(e),i=t.doc.resolve(n);if(YI(o,i,r))return t.step(new dt(e,n,r));let s=GI(o,i);s[s.length-1]==0&&s.pop();let l=-(o.depth+1);s.unshift(l);for(let f=o.depth,h=o.pos-1;f>0;f--,h--){let p=o.node(f).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(f)>-1?l=f:o.before(f)==h&&s.splice(1,0,-f)}let a=s.indexOf(l),c=[],u=r.openStart;for(let f=r.content,h=0;;h++){let p=f.firstChild;if(c.push(p),h==r.openStart)break;f=p.content}for(let f=u-1;f>=0;f--){let h=c[f],p=fq(h.type);if(p&&!h.sameMarkup(o.node(Math.abs(l)-1)))u=f;else if(p||!h.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let h=(f+u+1)%(r.openStart+1),p=c[h];if(p)for(let m=0;m<s.length;m++){let y=s[(m+a)%s.length],g=!0;y<0&&(g=!1,y=-y);let v=o.node(y-1),b=o.index(y-1);if(v.canReplaceWith(b,b,p.type,p.marks))return t.replace(o.before(y),g?i.after(y):n,new N(KI(r.content,0,r.openStart,h),h,r.openEnd))}}let d=t.steps.length;for(let f=s.length-1;f>=0&&(t.replace(e,n,r),!(t.steps.length>d));f--){let h=s[f];h<0||(e=o.before(h),n=i.after(h))}}function KI(t,e,n,r,o){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(KI(i.content,e+1,n,r,i)))}if(e>r){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(M.empty,!0))}return t}function pq(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=uq(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new N(M.from(r),0,0))}function mq(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n);if(r.parent.isTextblock&&o.parent.isTextblock&&r.start()!=o.start()&&r.parentOffset==0&&o.parentOffset==0){let s=r.sharedDepth(n),l=!1;for(let a=r.depth;a>s;a--)r.node(a).type.spec.isolating&&(l=!0);for(let a=o.depth;a>s;a--)o.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=r.depth;a>0&&e==r.start(a);a--)e=r.before(a);for(let a=o.depth;a>0&&n==o.start(a);a--)n=o.before(a);r=t.doc.resolve(e),o=t.doc.resolve(n)}}let i=GI(r,o);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return t.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return t.delete(r.before(l),o.after(l))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s&&r.start(s-1)==o.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),o.index(s-1)))return t.delete(r.before(s),n);t.delete(e,n)}function GI(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(i<t.pos-(t.depth-o)||e.end(o)>e.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}var ay=class t extends bt{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 Qt.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return Qt.fromReplace(e,this.pos,this.pos+1,new N(M.from(o),0,n.isLeaf?0:1))}getMap(){return zi.empty}invert(e){return new t(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 t(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 t(n.pos,n.attr,n.value)}};bt.jsonID("attr",ay);var cy=class t extends bt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Qt.ok(r)}getMap(){return zi.empty}invert(e){return new t(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 t(n.attr,n.value)}};bt.jsonID("docAttr",cy);var hu=class extends Error{};hu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};hu.prototype=Object.create(Error.prototype);hu.prototype.constructor=hu;hu.prototype.name="TransformError";var el=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new qf}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new hu(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 o=this.mapping.maps[r];r&&(e=o.map(e,1),n=o.map(n,-1)),o.forEach((i,s,l,a)=>{e=Math.min(e,l),n=Math.max(n,a)})}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=N.empty){let o=da(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new N(M.from(r),0,0))}delete(e,n){return this.replace(e,n,N.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return hq(this,e,n,r),this}replaceRangeWith(e,n,r){return pq(this,e,n,r),this}deleteRange(e,n){return mq(this,e,n),this}lift(e,n){return eq(this,e,n),this}join(e,n=1){return cq(this,e,n),this}wrap(e,n){return rq(this,e,n),this}setBlockType(e,n=e,r,o=null){return oq(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return sq(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new ay(e,n,r)),this}setDocAttribute(e,n){return this.step(new cy(e,n)),this}addNodeMark(e,n){return this.step(new Xf(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 ve)n.isInSet(r.marks)&&this.step(new fu(e,n));else{let o=r.marks,i,s=[];for(;i=n.isInSet(o);)s.push(new fu(e,i)),o=i.removeFromSet(o);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,r){return lq(this,e,n,r),this}addMark(e,n,r){return JY(this,e,n,r),this}removeMark(e,n,r){return QY(this,e,n,r),this}clearIncompatible(e,n,r){return $x(this,e,n,r),this}};var Yx=Object.create(null),H=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new yu(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=N.empty){let r=n.content.lastChild,o=null;for(let l=0;l<n.openEnd;l++)o=r,r=r.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:c}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(a.pos),u.map(c.pos),l?N.empty:n),l==0&&JI(e,i,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,o=this.ranges;for(let i=0;i<o.length;i++){let{$from:s,$to:l}=o[i],a=e.mapping.slice(r),c=a.map(s.pos),u=a.map(l.pos);i?e.deleteRange(c,u):(e.replaceRangeWith(c,u,n),JI(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let o=e.parent.inlineContent?new L(e):gu(e.node(0),e.parent,e.pos,e.index(),n,r);if(o)return o;for(let i=e.depth-1;i>=0;i--){let s=n<0?gu(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):gu(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new mn(e.node(0))}static atStart(e){return gu(e,e,0,0,1)||new mn(e)}static atEnd(e){return gu(e,e,e.content.size,e.childCount,-1)||new mn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Yx[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 Yx)throw new RangeError("Duplicate use of selection JSON ID "+e);return Yx[e]=n,n.prototype.jsonID=e,n}getBookmark(){return L.between(this.$anchor,this.$head).getBookmark()}};H.prototype.visible=!0;var yu=class{constructor(e,n){this.$from=e,this.$to=n}},XI=!1;function WI(t){!XI&&!t.parent.inlineContent&&(XI=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var L=class t extends H{constructor(e,n=e){WI(e),WI(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 H.near(r);let o=e.resolve(n.map(this.anchor));return new t(o.parent.inlineContent?o:r,r)}replace(e,n=N.empty){if(super.replace(e,n),n==N.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new fy(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 t(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=H.findFrom(n,r,!0)||H.findFrom(n,-r,!0);if(i)n=i.$head;else return H.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(H.findFrom(e,-r,!0)||H.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=o<0&&(e=n))),new t(e,n)}};H.jsonID("text",L);var fy=class t{constructor(e,n){this.anchor=e,this.head=n}map(e){return new t(e.map(this.anchor),e.map(this.head))}resolve(e){return L.between(e.resolve(this.anchor),e.resolve(this.head))}},V=class t extends H{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:o}=n.mapResult(this.anchor),i=e.resolve(o);return r?H.near(i):new t(i)}content(){return new N(M.from(this.node),0,0)}eq(e){return e instanceof t&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Kx(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new t(e.resolve(n.anchor))}static create(e,n){return new t(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}};V.prototype.visible=!1;H.jsonID("node",V);var Kx=class t{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new fy(r,r):new t(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&V.isSelectable(r)?new V(n):H.near(n)}},mn=class t extends H{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=N.empty){if(n==N.empty){e.delete(0,e.doc.content.size);let r=H.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new t(e)}map(e){return new t(e)}eq(e){return e instanceof t}getBookmark(){return gq}};H.jsonID("all",mn);var gq={map(){return this},resolve(t){return new mn(t)}};function gu(t,e,n,r,o,i=!1){if(e.inlineContent)return L.create(t,n);for(let s=r-(o>0?0:1);o>0?s<e.childCount:s>=0;s+=o){let l=e.child(s);if(l.isAtom){if(!i&&V.isSelectable(l))return V.create(t,n-(o<0?l.nodeSize:0))}else{let a=gu(t,l,n+o,o<0?l.childCount:0,o,i);if(a)return a}n+=l.nodeSize*o}return null}function JI(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof dt||o instanceof At))return;let i=t.mapping.maps[r],s;i.forEach((l,a,c,u)=>{s==null&&(s=u)}),t.setSelection(H.near(t.doc.resolve(s),n))}var QI=1,dy=2,ZI=4,Gx=class extends el{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|QI)&~dy,this.storedMarks=null,this}get selectionSet(){return(this.updated&QI)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=dy,this}ensureMarks(e){return ve.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&dy)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~dy,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)||ve.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(H.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|=ZI,this}get scrolledIntoView(){return(this.updated&ZI)>0}};function eL(t,e){return!e||!t?t:t.bind(e)}var fa=class{constructor(e,n,r){this.name=e,this.init=eL(n.init,r),this.apply=eL(n.apply,r)}},yq=[new fa("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new fa("selection",{init(t,e){return t.selection||H.atStart(e.doc)},apply(t){return t.selection}}),new fa("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new fa("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],Wf=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=yq.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 fa(r.key,r.spec.state,r))})}},ha=class t{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 o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),o=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=o?o[s].n:0,c=o?o[s].state:this,u=a<n.length&&l.spec.appendTransaction.call(l,a?n.slice(a):n,c,r);if(u&&r.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!o){o=[];for(let d=0;d<this.config.plugins.length;d++)o.push(d<s?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}o&&(o[s]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new t(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let i=r[o];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new Gx(this)}static create(e){let n=new Wf(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new t(n);for(let o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(e,r);return r}reconfigure(e){let n=new Wf(this.schema,e.plugins),r=n.fields,o=new t(n);for(let i=0;i<r.length;i++){let s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(e,o)}return o}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 o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.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 o=new Wf(e.schema,e.plugins),i=new t(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=nr.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=H.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],c=a.spec.state;if(a.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=c.fromJSON.call(a,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}};function tL(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=tL(o,e,{})),n[r]=o}return n}var G=class{constructor(e){this.spec=e,this.props={},e.props&&tL(e.props,this,this.props),this.key=e.key?e.key.key:nL("plugin")}getState(e){return e[this.key]}},qx=Object.create(null);function nL(t){return t in qx?t+"$"+ ++qx[t]:(qx[t]=0,t+"$")}var ae=class{constructor(e="key"){this.key=nL(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var oL=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function iL(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Wx=(t,e,n)=>{let r=iL(t,n);if(!r)return!1;let o=Qx(r);if(!o){let s=r.blockRange(),l=s&&Ui(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=o.nodeBefore;if(fL(t,o,e,-1))return!0;if(r.parent.content.size==0&&(vu(i,"end")||V.isSelectable(i)))for(let s=r.depth;;s--){let l=da(t.doc,r.before(s),r.after(s),N.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=t.tr.step(l);a.setSelection(vu(i,"end")?H.findFrom(a.doc.resolve(a.mapping.map(o.pos,-1)),-1):V.create(a.doc,o.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),!0):!1},hy=(t,e,n)=>{let r=iL(t,n);if(!r)return!1;let o=Qx(r);return o?sL(t,o,e):!1},py=(t,e,n)=>{let r=lL(t,n);if(!r)return!1;let o=tC(r);return o?sL(t,o,e):!1};function sL(t,e,n){let r=e.nodeBefore,o=r,i=e.pos-1;for(;!o.isTextblock;i--){if(o.type.spec.isolating)return!1;let u=o.lastChild;if(!u)return!1;o=u}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let c=da(t.doc,i,a,N.empty);if(!c||c.from!=i||c instanceof dt&&c.slice.size>=a-i)return!1;if(n){let u=t.tr.step(c);u.setSelection(L.create(u.doc,i)),n(u.scrollIntoView())}return!0}function vu(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}var Jx=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=Qx(r)}let s=i&&i.nodeBefore;return!s||!V.isSelectable(s)?!1:(e&&e(t.tr.setSelection(V.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Qx(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 lL(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}var Zx=(t,e,n)=>{let r=lL(t,n);if(!r)return!1;let o=tC(r);if(!o)return!1;let i=o.nodeAfter;if(fL(t,o,e,1))return!0;if(r.parent.content.size==0&&(vu(i,"start")||V.isSelectable(i))){let s=da(t.doc,r.before(),r.after(),N.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(vu(i,"start")?H.findFrom(l.doc.resolve(l.mapping.map(o.pos)),1):V.create(l.doc,l.mapping.map(o.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&o.depth==r.depth-1?(e&&e(t.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),!0):!1},eC=(t,e,n)=>{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;i=tC(r)}let s=i&&i.nodeAfter;return!s||!V.isSelectable(s)?!1:(e&&e(t.tr.setSelection(V.create(t.doc,i.pos)).scrollIntoView()),!0)};function tC(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}var aL=(t,e)=>{let n=t.selection,r=n instanceof V,o;if(r){if(n.node.isTextblock||!yo(t.doc,n.from))return!1;o=n.from}else if(o=mu(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(V.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},cL=(t,e)=>{let n=t.selection,r;if(n instanceof V){if(n.node.isTextblock||!yo(t.doc,n.to))return!1;r=n.to}else if(r=mu(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},uL=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&Ui(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},nC=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
|
|
54
|
+
`).scrollIntoView()),!0)};function rC(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var oC=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=rC(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),a=t.tr.replaceWith(l,l,s.createAndFill());a.setSelection(H.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},iC=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof mn||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=rC(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(L.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},sC=(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 i=n.before();if(Jr(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&Ui(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function vq(t){return(e,n)=>{if(e.selection instanceof V&&e.selection.node.isBlock){let{$from:h}=e.selection;return!h.parentOffset||!Jr(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 L||e.selection instanceof mn)&&r.deleteSelection();let{$from:o}=r.selection,i=r.steps.length,s=[],l,a,c=!1,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),a=rC(o.node(h-1).contentMatchAt(o.indexAfter(h-1)));let m=t&&t(o.parent,c,o);s.unshift(m||(c&&a?{type:a}:null)),l=h;break}else{if(h==1)return!1;s.unshift(null)}let d=o.pos,f=Jr(r.doc,d,s.length,s);if(f||(s[0]=a?{type:a}:null,f=Jr(r.doc,d,s.length,s)),!f)return!1;if(r.split(d,s.length,s),!c&&u&&o.node(l).type!=a){let h=r.mapping.slice(i),p=h.map(o.before(l)),m=r.doc.resolve(p);a&&o.node(l-1).canReplaceWith(m.index(),m.index()+1,a)&&r.setNodeMarkup(h.map(o.before(l)),a)}return n&&n(r.scrollIntoView()),!0}}var bq=vq();var dL=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(V.create(t.doc,o))),!0)},wq=(t,e)=>(e&&e(t.tr.setSelection(new mn(t.doc))),!0);function Sq(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||yo(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function fL(t,e,n,r){let o=e.nodeBefore,i=e.nodeAfter,s,l,a=o.type.spec.isolating||i.type.spec.isolating;if(!a&&Sq(t,e,n))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(s=(l=o.contentMatchAt(o.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,p=M.empty;for(let g=s.length-1;g>=0;g--)p=M.from(s[g].create(null,p));p=M.from(o.copy(p));let m=t.tr.step(new At(e.pos-1,h,e.pos,h,new N(p,1,0),s.length,!0)),y=m.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==o.type&&yo(m.doc,y.pos)&&m.join(y.pos),n(m.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&a?null:H.findFrom(e,1),d=u&&u.$from.blockRange(u.$to),f=d&&Ui(d);if(f!=null&&f>=e.depth)return n&&n(t.tr.lift(d,f).scrollIntoView()),!0;if(c&&vu(i,"start",!0)&&vu(o,"end")){let h=o,p=[];for(;p.push(h),!h.isTextblock;)h=h.lastChild;let m=i,y=1;for(;!m.isTextblock;m=m.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,m.content)){if(n){let g=M.empty;for(let b=p.length-1;b>=0;b--)g=M.from(p[b].copy(g));let v=t.tr.step(new At(e.pos-p.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new N(g,p.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function hL(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(L.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}var lC=hL(-1),aC=hL(1);function pL(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),l=s&&pu(s,t,e);return l?(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function cC(t,e=null){return function(n,r){let o=!1;for(let i=0;i<n.selection.ranges.length&&!o;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(a,c)=>{if(o)return!1;if(!(!a.isTextblock||a.hasMarkup(t,e)))if(a.type==t)o=!0;else{let u=n.doc.resolve(c),d=u.index();o=u.parent.canReplaceWith(d,d+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=n.selection.ranges[s];i.setBlockType(l,a,t,e)}r(i.scrollIntoView())}return!0}}function uC(...t){return function(e,n,r){for(let o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var Xx=uC(oL,Wx,Jx),rL=uC(oL,Zx,eC),tl={Enter:uC(nC,iC,sC,bq),"Mod-Enter":oC,Backspace:Xx,"Mod-Backspace":Xx,"Shift-Backspace":Xx,Delete:rL,"Mod-Delete":rL,"Mod-a":wq},xq={"Ctrl-h":tl.Backspace,"Alt-Backspace":tl["Mod-Backspace"],"Ctrl-d":tl.Delete,"Ctrl-Alt-Backspace":tl["Mod-Delete"],"Alt-Delete":tl["Mod-Delete"],"Alt-d":tl["Mod-Delete"],"Ctrl-a":lC,"Ctrl-e":aC};for(let t in tl)xq[t]=tl[t];var sie=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1;function mL(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return Cq(l,s,t,e)?(r&&r(l.scrollIntoView()),!0):!1}}function Cq(t,e,n,r=null){let o=!1,i=e,s=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 a=s.resolve(e.start-2);i=new aa(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new aa(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),o=!0}let l=pu(i,n,r,e);return l?(t&&Eq(t,e,l,o,n),!0):!1}function Eq(t,e,n,r,o){let i=M.empty;for(let u=n.length-1;u>=0;u--)i=M.from(n[u].type.create(n[u].attrs,i));t.step(new At(e.start-(r?2:0),e.end,e.start,e.end,new N(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==o&&(s=u+1);let l=n.length-s,a=e.start+n.length-(r?2:0),c=e.parent;for(let u=e.startIndex,d=e.endIndex,f=!0;u<d;u++,f=!1)!f&&Jr(t.doc,a,l)&&(t.split(a,l),a+=2*l),a+=c.child(u).nodeSize;return t}function gL(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,s=>s.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?Tq(e,n,t,i):Aq(e,n,i):!0:!1}}function Tq(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new At(i-1,s,i,s,new N(M.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new aa(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));let l=Ui(r);if(l==null)return!1;o.lift(r,l);let a=o.doc.resolve(o.mapping.map(i,-1)-1);return yo(o.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&o.join(a.pos),e(o.scrollIntoView()),!0}function Aq(t,e,n){let r=t.tr,o=n.parent;for(let h=n.end,p=n.endIndex-1,m=n.startIndex;p>m;p--)h-=o.child(p).nodeSize,r.delete(h-1,h+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,a=n.endIndex==o.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(l?0:1),u+1,s.content.append(a?M.empty:M.from(o))))return!1;let d=i.pos,f=d+s.nodeSize;return r.step(new At(d-(l?1:0),f+(a?1:0),d+1,f-1,new N((l?M.empty:M.from(o.copy(M.empty))).append(a?M.empty:M.from(o.copy(M.empty))),l?0:1,a?0:1),l?0:1)),e(r.scrollIntoView()),!0}function yL(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,c=>c.childCount>0&&c.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=t)return!1;if(n){let c=a.lastChild&&a.lastChild.type==l.type,u=M.from(c?t.create():null),d=new N(M.from(t.create(null,M.from(l.type.create(null,u)))),c?3:1,0),f=i.start,h=i.end;n(e.tr.step(new At(f-(c?3:1),h,f,h,d,1,!0)).scrollIntoView())}return!0}}var gn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},xu=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},mC=null,Pi=function(t,e,n){let r=mC||(mC=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},kq=function(){mC=null},Sa=function(t,e,n,r){return n&&(vL(t,e,n,r,-1)||vL(t,e,n,r,1))},Mq=/^(img|br|input|textarea|hr)$/i;function vL(t,e,n,r,o){for(var i;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Rn(t))){let s=t.parentNode;if(!s||!F(s)||sh(t)||Mq.test(t.nodeName)||t.contentEditable=="false")return!1;e=gn(t)+(o<0?0:1),t=s}else if(F(t)){let s=t.childNodes[e+(o<0?-1:0)];if(F(s)&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=o;else return!1;else t=s,e=o<0?Rn(t):0}else return!1}}function Rn(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function F(t){return t.nodeType==1}function Ht(t){return t.nodeType==3}function xa(t,e){return e?t.contains(F(e)?e:e.parentNode):!1}function Rq(t,e){for(;;){if(Ht(t)&&e)return t;if(F(t)&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Rn(t)}else if(t.parentNode&&!sh(t))e=gn(t),t=t.parentNode;else return null}}function Oq(t,e){for(;;){if(Ht(t)&&e<t.nodeValue.length)return t;if(F(t)&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!sh(t))e=gn(t)+1,t=t.parentNode;else return null}}function Dq(t,e,n){for(let r=e==0,o=e==Rn(t);r||o;){if(t==n)return!0;let i=gn(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Rn(t)}}function sh(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)}var Ty=function(t){return t.focusNode&&Sa(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function pa(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function Nq(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function _q(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(Rn(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(Rn(r.startContainer),r.startOffset)}}}var Xo=typeof navigator<"u"?navigator:null,bL=typeof document<"u"?document:null,sl=Xo&&Xo.userAgent||"",gC=/Edge\/(\d+)/.exec(sl),GL=/MSIE \d/.exec(sl),yC=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(sl),rr=!!(GL||yC||gC),ol=GL?document.documentMode:yC?+yC[1]:gC?+gC[1]:0,Mr=!rr&&/gecko\/(\d+)/i.test(sl);Mr&&+(/Firefox\/(\d+)/.exec(sl)||[0,0])[1];var vC=!rr&&/Chrome\/(\d+)/.exec(sl),yn=!!vC,XL=vC?+vC[1]:0,On=!rr&&!!Xo&&/Apple Computer/.test(Xo.vendor),Cu=On&&(/Mobile\/\w+/.test(sl)||!!Xo&&Xo.maxTouchPoints>2),Qr=Cu||(Xo?/Mac/.test(Xo.platform):!1),WL=Xo?/Win/.test(Xo.platform):!1,Hi=/Android \d/.test(sl),Ay=!!bL&&"webkitFontSmoothing"in bL.documentElement.style,Iq=Ay?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Lq(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 Bi(t,e){return typeof t=="number"?t:t[e]}function zq(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 wL(t,e,n){if(!bC(e)&&e.left==0)return;let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(!F(s)){s=xu(s);continue}let l=s==i.body,a=l?Lq(i):zq(s),c=0,u=0;if(e.top<a.top+Bi(r,"top")?u=-(a.top-e.top+Bi(o,"top")):e.bottom>a.bottom-Bi(r,"bottom")&&(u=e.bottom-e.top>a.bottom-a.top?e.top+Bi(o,"top")-a.top:e.bottom-a.bottom+Bi(o,"bottom")),e.left<a.left+Bi(r,"left")?c=-(a.left-e.left+Bi(o,"left")):e.right>a.right-Bi(r,"right")&&(c=e.right-a.right+Bi(o,"right")),c||u)if(l)i.defaultView.scrollBy(c,u);else{let f=s.scrollLeft,h=s.scrollTop;u&&(s.scrollTop+=u),c&&(s.scrollLeft+=c);let p=s.scrollLeft-f,m=s.scrollTop-h;e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m}}let d=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s=d=="absolute"?s.offsetParent:xu(s)}}function Uq(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=n-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:JL(t.dom)}}function JL(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=xu(r));return e}function Bq({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;QL(n,r==0?0:r-e)}function QL(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:o,left:i}=t[n];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=i&&(r.scrollLeft=i)}}var bu=null;function Pq(t){if(t.setActive)return t.setActive();if(bu)return t.focus(bu);let e=JL(t);t.focus(bu==null?{get preventScroll(){return bu={preventScroll:!0},!0}}:void 0),bu||(bu=!1,QL(e,0))}function ZL(t,e){let n,r=2e8,o,i=0,s=e.top,l=e.top,a,c;for(let u=t.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(F(u))f=u.getClientRects();else if(Ht(u))f=Pi(u).getClientRects();else continue;for(let h=0;h<f.length;h++){let p=f[h];if(p.top<=s&&p.bottom>=l){s=Math.max(p.bottom,s),l=Math.min(p.top,l);let m=p.left>e.left?p.left-e.left:p.right<e.left?e.left-p.right:0;if(m<r){n=u,r=m,o=m&&Ht(n)?{left:p.right<e.left?p.right:p.left,top:e.top}:e,F(u)&&m&&(i=d+(e.left>=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!a&&p.left<=e.left&&p.right>=e.left&&(a=u,c={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)&&(i=d+1)}}return!n&&a&&(n=a,o=c,r=0),n&&Ht(n)?Hq(n,o):!n||r?{node:t,offset:i}:ZL(n,o)}function Hq(t,e){let n=t.nodeValue.length,r=document.createRange(),o;for(let i=0;i<n;i++){r.setEnd(t,i+1),r.setStart(t,i);let s=nl(r,1);if(s.top!=s.bottom&&LC(e,s)){o={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return r.detach(),o||{node:t,offset:0}}function LC(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Vq(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function jq(t,e,n){let{node:r,offset:o}=ZL(e,n),i=-1;if(F(r)&&!r.firstChild){let s=r.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function Fq(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),a;if(!l)return null;if(F(l.dom)&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>r.left||a.top>r.top?o=l.posBefore:(!s&&a.right<r.left||a.bottom<r.top)&&(o=l.posAfter),s=!0),!l.contentDOM&&o<0&&!l.node.isText))return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return o>-1?o:t.docView.posFromDOM(e,n,-1)}function ez(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),i=o;;){let s=t.childNodes[i];if(F(s)){let l=s.getClientRects();for(let a=0;a<l.length;a++){let c=l[a];if(LC(e,c))return ez(s,e,c)}}if((i=(i+1)%r)==o)break}return t}function $q(t,e){let n=t.dom.ownerDocument,r,o=0,i=_q(n,e.left,e.top);i&&({node:r,offset:o}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s)){let c=t.dom.getBoundingClientRect();if(!LC(e,c)||(s=ez(t.dom,e,c),!s))return null}if(On)for(let c=s;r&&c;c=xu(c))c.draggable&&(r=void 0);if(s=Vq(s,e),r){if(Mr&&F(r)&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let u=r.childNodes[o],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=e.left&&d.bottom>e.top&&o++}let c;Ay&&o&&F(r)&&F(c=r.childNodes[o-1])&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&F(r.lastChild)&&e.top>r.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(o==0||!F(r)||r.childNodes[o-1].nodeName!="BR")&&(l=Fq(t,r,o,e))}l==null&&(l=jq(t,s,e));let a=t.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function bC(t){return t.top<t.bottom||t.left<t.right}function nl(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(bC(r))return r}return Array.prototype.find.call(n,bC)||t.getBoundingClientRect()}var Yq=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function tz(t,e,n){let{node:r,offset:o,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=Ay||Mr;if(Ht(r))if(s&&(Yq.test(r.nodeValue)||(n<0?!o:o==r.nodeValue.length))){let a=nl(Pi(r,o,o),n);if(Mr&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let c=nl(Pi(r,o-1,o-1),-1);if(c.top==a.top){let u=nl(Pi(r,o,o+1),-1);if(u.top!=a.top)return Jf(u,u.left<c.left)}}return a}else{let a=o,c=o,u=n<0?1:-1;return n<0&&!o?(c++,u=-1):n>=0&&o==r.nodeValue.length?(a--,u=1):n<0?a--:c++,Jf(nl(Pi(r,a,c),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Rn(r))){let a=r.childNodes[o-1];if(F(a))return dC(a.getBoundingClientRect(),!1)}if(i==null&&o<Rn(r)){let a=r.childNodes[o];if(F(a))return dC(a.getBoundingClientRect(),!0)}return dC(r.getBoundingClientRect(),n>=0)}if(i==null&&o&&(n<0||o==Rn(r))){let a=r.childNodes[o-1],c=Ht(a)?Pi(a,Rn(a)-(s?0:1)):F(a)&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(c)return Jf(nl(c,1),!1)}if(i==null&&o<Rn(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let c=a?Ht(a)?Pi(a,0,s?0:1):F(a)?a:null:null;if(c)return Jf(nl(c,-1),!0)}return Jf(nl(Ht(r)?Pi(r):r,-n),n>=0)}function Jf(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 dC(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 nz(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function qq(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return nz(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=tz(t,o.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(F(l))a=l.getClientRects();else if(Ht(l))a=Pi(l,0,l.nodeValue.length).getClientRects();else continue;for(let c=0;c<a.length;c++){let u=a[c];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}var Kq=/[\u0590-\u08ac]/;function Gq(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,l=t.domSelection();return l?!Kq.test(r.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:nz(t,e,()=>{let{focusNode:a,focusOffset:c,anchorNode:u,anchorOffset:d}=t.domSelectionRange(),f=l.caretBidiLevel;l.modify("move",n,"character");let h=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:p,focusOffset:m}=t.domSelectionRange(),y=p&&!xa(h,p)||a==p&&c==m;try{l.collapse(u,d),a&&(a!=u||c!=d)&&l.extend&&l.extend(a,c)}catch{}return f!=null&&(l.caretBidiLevel=f),y}):r.pos==r.start()||r.pos==r.end()}var SL=null,xL=null,CL=!1;function Xq(t,e,n){return SL==e&&xL==n?CL:(SL=e,xL=n,CL=n=="up"||n=="down"?qq(t,e,n):Gq(t,e,n))}var Zr=0,EL=1,ma=2,vo=3,Ca=class{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Zr,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 o=this.children[n];if(o==e)return r;r+=o.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&&xa(this.contentDOM,e))if(r<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=n>gn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM)){let i=e.compareDocumentPosition(this.contentDOM);i&16?o=n>Array.from(e.childNodes).findIndex(s=>s.contains(this.contentDOM)):o=!(i&4)}else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(F(s)?xa(s,e):s==e))r=!1;else return i}}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 o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],i=r+o.size;if(r==e&&i!=r){for(;!o.border&&o.children.length;)for(let s=0;s<o.children.length;s++){let l=o.children[s];if(l.size){o=l;break}}return o}if(e<i)return o.descAt(e-r-o.border);r=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let i=0;r<this.children.length;r++){let s=this.children[r],l=i+s.size;if(l>e){o=e-i;break}i=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(;r>0;r--){let i=this.children[r-1];if(i.size||!(i instanceof yy||i instanceof my&&i.side>=0))break}if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?gn(i.dom)+1:0}}else{let i,s=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?gn(i.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 o=-1,i=-1;for(let s=r,l=0;;l++){let a=this.children[l],c=s+a.size;if(o==-1&&e<=c){let u=s+a.border;if(e>=u&&n<=c-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,n,u);e=s;for(let d=l;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){o=gn(f.dom)+1;break}e-=f.size}o==-1&&(o=0)}if(o>-1&&(c>n||l==this.children.length-1)){n=c;for(let u=l+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=gn(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:e,to:n,fromOffset:o,toOffset:i}}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(!F(n)||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,o=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],y=p+m.size;if(i>p&&s<y)return m.setSelection(e-p-m.border,n-p-m.border,r,o);p=y}let l=this.domFromPos(e,e?-1:1),a=n==e?l:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((Mr||On)&&e==n){let{node:h,offset:p}=l;if(Ht(h)){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
55
|
+
`),d&&p==h.nodeValue.length)for(let m=h,y;m;m=m.parentNode){if(y=m.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:gn(y)+1});break}let g=m.pmViewDesc;if(g&&g.node&&g.node.isBlock)break}}else{let m=h.childNodes[p-1];d=m&&(m.nodeName=="BR"||m.contentEditable=="false")}}if(Mr&&u.focusNode&&u.focusNode!=a.node&&F(u.focusNode)){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(o=!0)}if(!(o||d&&On)&&Sa(l.node,l.offset,u.anchorNode,u.anchorOffset)&&Sa(a.node,a.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||e==n)&&!(d&&Mr)){c.collapse(l.node,l.offset);try{e!=n&&c.extend(a.node,a.offset),f=!0}catch{}}if(!f){if(e>n){let p=l;l=a,a=p}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),c.removeAllRanges(),c.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,o=0;o<this.children.length;o++){let i=this.children[o],s=r+i.size;if(r==s?e<=s&&n>=r:e<s&&n>r){let l=r+i.border,a=s-i.border;if(e>=l&&n<=a){this.dirty=e==r||n==s?ma:EL,e==l&&n==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=vo:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ma:vo}r=s}this.dirty=ma}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ma:EL;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}},my=class extends Ca{constructor(e,n,r,o){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){let l=F(s)?s:document.createElement("span");l!=s&&(l.appendChild(s),s=l),l.hasAttribute("contenteditable")||(l.contentEditable="false"),l.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Zr&&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}},wC=class extends Ca{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}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}},ya=class t extends Ca{constructor(e,n,r,o,i){super(e,[],r,o),this.mark=n,this.spec=i}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=Li.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new t(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&vo||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=vo&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Zr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Zr}}slice(e,n,r){let o=t.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;n<s&&(i=EC(i,n,s,r)),e>0&&(i=EC(i,0,e,r));for(let l=0;l<i.length;l++)i[l].parent=o;return o.children=i,o}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}},il=class t extends Ca{constructor(e,n,r,o,i,s,l){super(e,[],i,s),this.node=n,this.outerDeco=r,this.innerDeco=o,this.nodeDOM=l}static create(e,n,r,o,i,s){let l=i.nodeViews[n.type.name],a,c=l&&l(n,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},r,o),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(!Ht(u))throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=Li.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=iz(u,r,n),c?a=new SC(e,n,r,o,u,d||null,f,c):n.isText?new gy(e,n,r,o,u,f):new t(e,n,r,o,u,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 o=this.children[r];if(this.dom.contains(o.dom.parentNode)){n.contentElement=o.dom.parentNode;break}}if(!n.contentElement){let r=e&&e.find(o=>F(o)&&e.indexOf(o.parentNode)<0&&this.dom.contains(o));r?n.contentElement=r:n.getContent=()=>M.empty}}return n}matchesNode(e,n,r){return this.dirty==Zr&&e.eq(this.node)&&vy(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,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new CC(this,s&&s.node,e),c=this.node.inlineContent,u=c&&this.node.isBlock;Zq(this.node,this.innerDeco,(d,f,h)=>{d.spec.marks?a.syncToMarks(d.spec.marks,r,e,f):d.type.side>=0&&!h&&a.syncToMarks(f==this.node.childCount?ve.none:this.node.child(f).marks,r,e,f),a.placeWidget(d,e,o)},(d,f,h,p)=>{a.syncToMarks(d.marks,r,e,p),u&&d.isAtom&&!d.isText&&a.addHackNode("IMG",a.top);let m;a.findNodeMatch(d,f,h,p)||l&&e.state.selection.from>o&&e.state.selection.to<o+d.nodeSize&&(m=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(d,f,h,m,e)||a.updateNextNode(d,f,h,e,p,o)||a.addNode(d,f,h,e,o),o+=d.nodeSize,c&&(u=d.isAtom&&!d.isText)}),a.syncToMarks([],r,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==ma)&&(s&&this.protectLocalComposition(e,s),rz(this.contentDOM,this.children,e),Cu&&eK(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof L)||r<n||o>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=tK(this.node.content,s,r-n,o-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new wC(this,i,n,o);e.input.compositionNodes.push(s),this.children=EC(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==vo||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Zr}updateOuterDeco(e){if(vy(e,this.outerDeco))return;let n=!F(this.nodeDOM),r=this.dom;this.dom=oz(this.dom,this.nodeDOM,xC(this.outerDeco,this.node,n),xC(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){F(this.nodeDOM)&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}};function TL(t,e,n,r,o){iz(r,e,t);let i=new il(void 0,t,e,n,r,r,r);return i.contentDOM&&i.updateChildren(o,0),i}var gy=class t extends il{constructor(e,n,r,o,i,s){super(e,n,r,o,i,null,s)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==vo||this.dirty!=Zr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Zr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Zr,!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 o=this.node.cut(e,n),i=document.createTextNode(o.text);return new t(this.parent,o,this.outerDeco,this.innerDeco,i,i)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=vo)}get domAtom(){return!1}isText(e){return this.node.text==e}},yy=class extends Ca{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Zr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},SC=class extends il{constructor(e,n,r,o,i,s,l,a){super(e,n,r,o,i,s,l),this.spec=a}update(e,n,r,o){if(this.dirty==vo)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,o)}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 rz(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=r;)r=AL(r),o=!0;r=r.nextSibling}else o=!0,t.insertBefore(l,r);if(s instanceof ya){let a=r?r.previousSibling:t.lastChild;rz(s.contentDOM,s.children,n),r=a?a.nextSibling:t.firstChild}}for(;r;)r=AL(r),o=!0;o&&n.trackWrites==t&&(n.trackWrites=null)}var Zf=function(t){t&&(this.nodeName=t)};Zf.prototype=Object.create(null);var ga=[new Zf];function xC(t,e,n){if(t.length==0)return ga;let r=n?ga[0]:new Zf,o=[r];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&o.push(r=new Zf(s.nodeName));for(let l in s){let a=s[l];a!=null&&(n&&o.length==1&&o.push(r=new Zf(e.isInline?"span":"div")),l=="class"?r.class=(r.class?r.class+" ":"")+a:l=="style"?r.style=(r.style?r.style+";":"")+a:l!="nodeName"&&(r[l]=a))}}}return o}function oz(t,e,n,r){if(n==ga&&r==ga)return e;let o=e;for(let i=0;i<r.length;i++){let s=r[i],l=n[i];if(i){let a;l&&l.nodeName==s.nodeName&&o!=t&&(a=o.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(o),l=ga[0]),o=a}Wq(o,l||ga[0],s)}return o}function Wq(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):[],o=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.remove(r[i]);for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.add(o[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,o;for(;o=r.exec(e.style);)t.style.removeProperty(o[1])}n.style&&(t.style.cssText+=n.style)}}function iz(t,e,n){return oz(t,t,ga,xC(e,n,!F(t)))}function vy(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 AL(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}var CC=class{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Jq(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,o){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=Zr,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,c=this.top.children.length;o<this.preMatch.index&&(c=Math.min(this.index+3,c));for(let u=this.index;u<c;u++){let d=this.top.children[u];if(d.matchesMark(e[s])&&!this.isLocked(d.dom)){a=u;break}}if(a<0&&this.index<this.top.children.length){let u=this.top.children[this.index];u instanceof ya&&u.dirty!=vo&&u.mark.type==e[s].type&&u.spec.update&&!this.isLocked(u.dom)&&u.spec.update(e[s])&&(u.mark=e[s],a=this.index,this.changed=!0)}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let u=ya.create(this.top,e[s],n,r);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let c=this.top.children[l];if(c.matchesNode(e,n,r)&&!this.preMatch.matched.has(c)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,r,o,i){let s=this.top.children[o];return s.dirty==vo&&s.dom==s.contentDOM&&(s.dirty=ma),s.update(e,n,r,i)?(this.destroyBetween(this.index,o),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 o=this.index;o<this.top.children.length;o++)if(this.top.children[o]==r)return o}return-1}e=n}}updateNextNode(e,n,r,o,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof il){let c=this.preMatch.matched.get(a);if(c!=null&&c!=i)return!1;let u=a.dom,d,f=this.isLocked(u)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=vo&&vy(n,a.outerDeco));if(!f&&a.update(e,n,r,o))return this.destroyBetween(this.index,l),a.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(a,e,n,r,o,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=ma,d.updateChildren(o,s+1),d.dirty=Zr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,o,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!vy(r,e.outerDeco)||!o.eq(e.innerDeco))return null;let l=il.create(this.top,n,r,o,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,n,r,o,i){let s=il.create(this.top,e,n,r,o,i);s.contentDOM&&s.updateChildren(o,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,r){let o=this.index<this.top.children.length?this.top.children[this.index]:null;if(o&&o.matchesWidget(e)&&(e==o.widget||!o.widget.type.toDOM.parentNode))this.index++;else{let i=new my(this.top,e,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof ya;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof gy)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((On||yn)&&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 o=new yy(this.top,[],r,null);n!=this.top?n.children.push(o):n.children.splice(this.index++,0,o),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||F(e)&&e.contains(this.lock.parentNode))}};function Jq(t,e){let n=e,r=n.children.length,o=t.childCount,i=new Map,s=[];e:for(;o>0;){let l;for(;;)if(r){let c=n.children[r-1];if(c instanceof ya)n=c,r=c.children.length;else{l=c,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let a=l.node;if(a){if(a!=t.child(o-1))break;--o,i.set(l,o),s.push(l)}}return{index:o,matched:i,matches:s.reverse()}}function Qq(t,e){return t.type.side-e.type.side}function Zq(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let c=0;c<t.childCount;c++){let u=t.child(c);r(u,o,e.forChild(i,u),c),i+=u.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let u,d;for(;s<o.length&&o[s].to==i;){let y=o[s++];y.widget&&(u?(d||(d=[u])).push(y):u=y)}if(u)if(d){d.sort(Qq);for(let y=0;y<d.length;y++)n(d[y],c,!!a)}else n(u,c,!!a);let f,h;if(a)h=-1,f=a,a=null;else if(c<t.childCount)h=c,f=t.child(c++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)l.push(o[s++]);let p=i+f.nodeSize;if(f.isText){let y=p;s<o.length&&o[s].from<y&&(y=o[s].from);for(let g=0;g<l.length;g++)l[g].to<y&&(y=l[g].to);y<p&&(a=f.cut(y-i),f=f.cut(0,y-i),p=y,h=-1)}else for(;s<o.length&&o[s].to<p;)s++;let m=f.isInline&&!f.isLeaf?l.filter(y=>!y.inline):l.slice();r(f,m,e.forChild(i,f),h),i=p}}function eK(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 tK(t,e,n,r){for(let o=0,i=0;o<t.childCount&&i<=r;){let s=t.child(o++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;o<t.childCount;){let c=t.child(o++);if(i+=c.nodeSize,!c.isText)break;a+=c.text}if(i>=n){if(i>=r&&a.slice(r-e.length-l,r-l)==e)return r-e.length;let c=l<r?a.lastIndexOf(e,r-l-1):-1;if(c>=0&&c+e.length+l>=n)return l+c;if(n==r&&a.length>=r+e.length-l&&a.slice(r-l,r-l+e.length)==e)return r}}return-1}function EC(t,e,n,r,o){let i=[];for(let s=0,l=0;s<t.length;s++){let a=t[s],c=l,u=l+=a.size;c>=n||u<=e?i.push(a):(c<e&&i.push(a.slice(0,e-c,r)),o&&(i.push(o),o=void 0),u>n&&i.push(a.slice(n-c,a.size,r)))}return i}function zC(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(Ty(n)){for(a=s;o&&!o.node;)o=o.parent;if(o&&o.node.isAtom&&V.isSelectable(o.node)&&o.parent&&!(o.node.isInline&&Dq(n.focusNode,n.focusOffset,o.dom))){let d=o.posBefore;c=new V(s==d?l:r.resolve(d))}else if(Mr&&e=="key"&&s>t.state.selection.to&&F(n.focusNode)&&n.focusOffset==n.focusNode.childNodes.length&&o&&o.posAtStart>t.state.selection.to)for(let d=n.focusNode;;d=d.parentNode){if(getComputedStyle(d).overflow!="visible"){c=H.findFrom(r.resolve(o.posAtStart),1);break}if(d==o.dom||d.nextSibling||!d.parentNode||!F(d.parentNode))break}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=s,f=s;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;[a,s]=f==t.state.selection.anchor?[f,d]:[d,f],l=r.resolve(s)}else a=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let u=r.resolve(a);if(!c){let d=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;c=UC(t,u,l,d)}return c}function sz(t){return t.editable?t.hasFocus():az(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function ji(t,e=!1){let n=t.state.selection;if(lz(t,n),!sz(t))return;let r=t.input.mouseDown;if(!e&&yn&&r){let o=t.domSelectionRange(),i=t.domObserver.currentSelection;if(o.anchorNode&&i.anchorNode&&Sa(o.anchorNode,o.anchorOffset,i.anchorNode,i.anchorOffset)&&r.delaySelUpdate()){t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)rK(t);else{let{anchor:o,head:i}=n,s,l;kL&&!(n instanceof L)&&(n.$from.parent.inlineContent||(s=ML(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=ML(t,n.to))),t.docView.setSelection(o,i,t,e),kL&&(s&&RL(s),l&&RL(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&nK(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}var kL=On||yn&&XL<63;function ML(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(On&&o&&o.contentEditable=="false")return fC(o);if((!o||o.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(o)return fC(o);if(i)return fC(i)}}function fC(t){return t.contentEditable="true",On&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function RL(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function nK(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!sz(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function rK(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,gn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&rr&&ol<=11&&(n.disabled=!0,n.disabled=!1)}function lz(t,e){if(e instanceof V){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(OL(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else OL(t)}function OL(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function UC(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||L.between(e,n,r)}function DL(t){return t.editable&&!t.hasFocus()?!1:az(t)}function az(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return xa(t.dom,e.anchorNode)&&(t.editable||xa(t.dom,e.focusNode))}catch{return!1}}function oK(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Sa(e.node,e.offset,n.anchorNode,n.anchorOffset)}function TC(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&H.findFrom(i,e)}function rl(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function NL(t,e,n){let r=t.state.selection;if(r instanceof L)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return rl(t,new L(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=TC(t.state,e);return o&&o instanceof V?rl(t,o):!1}else if(!Qr||n.indexOf("m")<0){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?V.isSelectable(i)?rl(t,new V(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):rl(t,new L(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1}}else return!1;else{if(r instanceof V&&r.node.isInline)return rl(t,new L(e>0?r.$to:r.$from));{let o=TC(t.state,e);return o?rl(t,o):!1}}}function eh(t,e){let n=t.pmViewDesc;return n?n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR"):F(t)&&t.contentEditable=="false"}function wu(t,e){return e<0?iK(t):sK(t)}function iK(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(Mr&&F(n)&&r<Rn(n)&&eh(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(!F(n))break;let l=n.childNodes[r-1];if(eh(l,-1))o=n,i=--r;else if(Ht(l))n=l,r=n.nodeValue.length;else break}else{if(cz(n))break;{let l=n.previousSibling;for(;l&&eh(l,-1);)o=n.parentNode,i=gn(l),l=l.previousSibling;if(l)n=l,r=Rn(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?AC(t,n,r):o&&AC(t,o,i)}function sK(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Rn(n),i,s;for(;;)if(r<o){if(!F(n))break;let l=n.childNodes[r];if(eh(l,1))i=n,s=++r;else break}else{if(cz(n))break;{let l=n.nextSibling;for(;l&&eh(l,1);)i=l.parentNode,s=gn(l)+1,l=l.nextSibling;if(l)n=l,r=0,o=Rn(n);else{if(n=n.parentNode,n==t.dom)break;r=o=0}}}i&&AC(t,i,s)}function cz(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function lK(t,e){for(;t&&e==t.childNodes.length&&!sh(t);)e=gn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(Ht(n))return n;if(F(n)&&n.contentEditable=="false")break;t=n,e=0}}function aK(t,e){for(;t&&!e&&!sh(t);)e=gn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(Ht(n))return n;if(F(n)&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function AC(t,e,n){if(!Ht(e)){let s,l;(l=lK(e,n))?(e=l,n=0):(s=aK(e,n))&&(e=s,n=s.nodeValue.length)}let r=t.domSelection(),o=t.domSelectionRange();if(!r)return;Ty(o)?r.collapse(e,n):r.extend&&(r.collapse(o.anchorNode,o.anchorOffset),r.extend(e,n)),t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&ji(t)},50)}function _L(t,e){let n=t.state.doc.resolve(e);if(!(yn||WL)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let s=t.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>i.top&&l<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),l=(s.top+s.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(s.left-i.left)>1)return s.left>i.left?"ltr":"rtl"}}let r=t.dom;for(let i=n.depth;i>0;i--)if(n.node(i).isBlock){r=t.nodeDOM(n.before(i))||r;break}return getComputedStyle(r).direction=="rtl"?"rtl":"ltr"}function IL(t,e,n){let r=t.state.selection;if(r instanceof L&&!r.empty||n.indexOf("s")>-1||Qr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=TC(t.state,e);if(s&&s instanceof V)return rl(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,l=r instanceof mn?H.near(s,e):H.findFrom(s,e);return l?rl(t,l):!1}return!1}function LL(t,e){if(!(t.state.selection instanceof L))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function zL(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function cK(t){if(!On||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&F(e)&&n==0&&e.firstChild&&F(e.firstChild)&&e.firstChild.contentEditable=="false"){let r=e.firstChild;zL(t,r,"true"),setTimeout(()=>zL(t,r,"false"),20)}return!1}function uK(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function dK(t,e){let n=e.keyCode,r=uK(e);if(n==8||Qr&&n==72&&r=="c")return LL(t,-1)||wu(t,-1);if(n==46&&!e.shiftKey||Qr&&n==68&&r=="c")return LL(t,1)||wu(t,1);if(n==13||n==27)return!0;if(n==37||Qr&&n==66&&r=="c"){let o=n==37?_L(t,t.state.selection.from)=="ltr"?-1:1:-1;return NL(t,o,r)||wu(t,o)}else if(n==39||Qr&&n==70&&r=="c"){let o=n==39?_L(t,t.state.selection.from)=="ltr"?1:-1:1;return NL(t,o,r)||wu(t,o)}else{if(n==38||Qr&&n==80&&r=="c")return IL(t,-1,r)||wu(t,-1);if(n==40||Qr&&n==78&&r=="c")return cK(t)||IL(t,1,r)||wu(t,1);if(r==(Qr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function BC(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let s=t.someProp("clipboardSerializer")||Li.fromSchema(t.state.schema),l=mz(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,u,d=0;for(;c&&F(c)&&(u=pz[c.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let p=l.createElement(u[h]);for(;a.firstChild;)p.appendChild(a.firstChild);a.appendChild(p),d++}c=a.firstChild}c&&F(c)&&c.setAttribute("data-pm-slice",`${o} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
|
|
56
|
+
|
|
57
|
+
`);return{dom:a,text:f,slice:e}}function uz(t,e,n,r,o){let i=o.parent.type.spec.code,s,l;if(!n&&!e)return null;let a=!!e&&(r||i||!n);if(a){if(t.someProp("transformPastedText",f=>{e=f(e,i||r,t)}),i)return l=new N(M.from(t.state.schema.text(e.replace(/\r\n?/g,`
|
|
58
|
+
`))),0,0),t.someProp("transformPasted",f=>{l=f(l,t,!0)}),l;let d=t.someProp("clipboardTextParser",f=>f(e,o,r,t));if(d)l=d;else{let f=o.marks(),{schema:h}=t.state,p=Li.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(m=>{let y=s.appendChild(document.createElement("p"));m&&y.appendChild(p.serializeNode(h.text(m,f)))})}}else t.someProp("transformPastedHTML",d=>{n=d(n,t)}),s=mK(n),Ay&&gK(s);let c=s&&s.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=s.firstChild;for(;f&&!F(f);)f=f.nextSibling;if(!f)break;s=f}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||Ii.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||u),context:o,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!fK.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)l=yK(UL(l,+u[1],+u[2]),u[4]);else if(l=N.maxOpen(hK(l.content,o),!0),l.openStart||l.openEnd){let d=0,f=0;for(let h=l.content.firstChild;d<l.openStart&&!h.type.spec.isolating;d++,h=h.firstChild);for(let h=l.content.lastChild;f<l.openEnd&&!h.type.spec.isolating;f++,h=h.lastChild);l=UL(l,d,f)}return t.someProp("transformPasted",d=>{l=d(l,t,a)}),l}var fK=/^(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 hK(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let a=o.findWrapping(l.type),c;if(!a)return s=null;if(c=s.length&&i.length&&fz(a,i,l,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=hz(s[s.length-1],i.length));let u=dz(l,a);s.push(u),o=o.matchType(u.type),i=a}}),s)return M.from(s)}return t}function dz(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,M.from(t));return t}function fz(t,e,n,r,o){if(o<t.length&&o<e.length&&t[o]==e[o]){let i=fz(t,e,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==t.length-1?n.type:t[o+1]))return r.copy(r.content.append(M.from(dz(n,t,o+1))))}}function hz(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,hz(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(M.empty,!0);return t.copy(n.append(r))}function kC(t,e,n,r,o,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),o<r-1&&(l=kC(l,e,n,r,o+1,i)),o>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(M.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function UL(t,e,n){return e<t.openStart&&(t=new N(kC(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new N(kC(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}var pz={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 mz(){return document.implementation.createHTMLDocument("title")}var Qf=null;function pK(t){let e=window.trustedTypes;if(!e)return t;if(!Qf){if(Qf=e.defaultPolicy)try{return Qf.createHTML(t)}catch{}Qf=e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})}return Qf.createHTML(t)}function mK(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=mz(),r=n.body,o=/<([a-z][^>\s]+)/i.exec(t),i;if((i=o&&pz[o[1].toLowerCase()])&&(t=i.map(s=>"<"+s+">").join("")+t+i.map(s=>"</"+s+">").reverse().join("")),r.innerHTML=pK(t),i)for(let s=0;s<i.length;s++)r=r.querySelector(i[s])||r;for(let s=0;s<n.styleSheets.length;s++){let l=n.styleSheets[s];for(let a=0;a<l.rules.length;a++){let c=l.rules[a];if(c instanceof CSSStyleRule){let u=r.querySelectorAll(c.selectorText);for(let d=0;d<u.length;d++)u[d].style.cssText+=c.style.cssText}}}return r}function gK(t){let e=t.querySelectorAll(yn?"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=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function yK(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:o,openStart:i,openEnd:s}=t;for(let l=r.length-2;l>=0;l-=2){let a=n.nodes[r[l]];if(!a||a.hasRequiredAttrs())break;try{o=M.from(a.create(r[l+1],o))}catch{break}i++,s++}return new N(o,i,s)}var jn={},Fn={},vK={touchstart:!0,touchmove:!0},MC=class{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 bK(t){for(let e in jn){let n=jn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{SK(t,r)&&!PC(t,r)&&(t.editable||!(r.type in Fn))&&n(t,r)},vK[e]?{passive:!0}:void 0)}On&&t.dom.addEventListener("input",()=>null),RC(t)}function Vi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function wK(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 RC(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>PC(t,r))})}function PC(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function SK(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 xK(t,e){!PC(t,e)&&jn[e.type]&&(t.editable||!(e.type in Fn))&&jn[e.type](t,e)}Fn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!vz(t)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Hi&&yn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Cu&&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",o=>o(t,pa(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||dK(t,n)?n.preventDefault():Vi(t,"key")};Fn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Fn.keypress=(t,e)=>{let n=e;if(vz(t)||!n.charCode||n.ctrlKey&&!n.altKey||Qr&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof L)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(o).scrollIntoView();!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",s=>s(t,r.$from.pos,r.$to.pos,o,i))&&t.dispatch(i()),n.preventDefault()}};function lh(t){return{left:t.clientX,top:t.clientY}}function CK(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function HC(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),o,!0):l(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function ah(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 EK(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&V.isSelectable(r)?(ah(t,new V(n)),!0):!1}function TK(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof V&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(V.isSelectable(l)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(ah(t,V.create(t.state.doc,o)),!0):!1}function AK(t,e,n,r,o){return HC(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?TK(t,n):EK(t,n))}function kK(t,e,n,r){return HC(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function MK(t,e,n,r){return HC(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||RK(t,n,r)}function RK(t,e,n){if(n.button!=0)return!1;let r=gz(t,e,!0),o=t.state.doc;return r?(ah(t,r),r instanceof L&&o.eq(t.state.doc)&&(t.input.mouseDown=new DC(t,r)),!0):!1}function gz(t,e,n){let r=t.state.doc;if(e==-1)return r.inlineContent?L.create(r,0,r.content.size):null;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),l=o.before(i);if(s.inlineContent)return L.create(r,l+1,l+1+s.content.size);if(n&&V.isSelectable(s))return V.create(r,l)}return null}function VC(t){return wy(t)}var yz=Qr?"metaKey":"ctrlKey";jn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=VC(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&CK(n,t.input.lastClick)&&!n[yz]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button},t.input.mouseDown&&t.input.mouseDown.done();let s=t.posAtCoords(lh(n));s&&(i=="singleClick"?t.input.mouseDown=new OC(t,s,n,!!r):(i=="doubleClick"?kK:MK)(t,s.pos,s.inside,n)?n.preventDefault():Vi(t,"pointer"))};var by=class{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}},OC=class extends by{constructor(e,n,r,o){super(e),this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!r[yz],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}let l=o?null:r.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&F(a.nodeDOM)?a.nodeDOM:null;let{selection:c}=e.state;r.button==0&&(i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof V&&c.from<=s&&c.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Mr&&!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()),Vi(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||ji(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(lh(e))),this.updateAllowDefault(e),this.allowDefault||!n?Vi(this.view,"pointer"):AK(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||On&&this.mightDrag&&!this.mightDrag.node.isAtom||yn&&!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)?(ah(this.view,H.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Vi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Vi(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}},DC=class extends by{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(),Vi(this.view,"pointer");let n=this.view.posAtCoords(lh(e)),r=n&&gz(this.view,n.inside,!1);if(!r)return;let{doc:o}=this.view.state,i=this.startSelection,[s,l]=r.from<i.from?[i.to,r.from]:[i.from,r.to];ah(this.view,L.create(o,s,l))}};jn.touchstart=t=>{t.input.lastTouch=Date.now(),VC(t),Vi(t,"pointer")};jn.touchmove=t=>{t.input.lastTouch=Date.now(),Vi(t,"pointer")};jn.contextmenu=t=>VC(t);function vz(t,e){return t.composing?!0:On&&Math.abs(Date.now()-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var OK=Hi?5e3:-1;Fn.compositionstart=Fn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof L&&e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||yn&&WL&&DK(t)))t.markCursor=t.state.storedMarks||n.marks(),wy(t,!0),t.markCursor=null;else if(wy(t,!e.selection.empty),Mr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&F(o)&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(Ht(s)){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}bz(t,OK)};function DK(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||!F(e)||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return F(r)&&r.contentEditable=="false"}Fn.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++,bz(t,20))};function bz(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>wy(t),e))}function wz(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Date.now());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function NK(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=Rq(e.focusNode,e.focusOffset),r=Oq(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let o=r.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return r}}return n||r}function wy(t,e=!1){if(!(Hi&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),wz(t),e||t.docView&&t.docView.dirty){let n=zC(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 _K(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(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}var th=rr&&ol<15||Cu&&Iq<604;jn.copy=Fn.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=th?null:n.clipboardData,s=r.content(),{dom:l,text:a}=BC(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):_K(t,l),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function IK(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function LK(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 o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?nh(t,r.value,null,o,e):nh(t,r.textContent,r.innerHTML,o,e)},50)}function nh(t,e,n,r,o){let i=uz(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",a=>a(t,o,i||N.empty)))return!0;if(!i)return!1;let s=IK(i),l=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Sz(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," "):""}Fn.paste=(t,e)=>{let n=e;if(t.composing&&!Hi)return;let r=th?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&nh(t,Sz(r),r.getData("text/html"),o,n)?n.preventDefault():LK(t,n)};var Sy=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},zK=Qr?"altKey":"ctrlKey";function xz(t,e){let n;return t.someProp("dragCopies",r=>{n=n||r(e)}),n!=null?!n:!e[zK]}jn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(lh(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof V?o.to-1:o.to))){if(r&&r.mightDrag)s=V.create(t.state.doc,r.mightDrag.pos);else if(n.target&&F(n.target)){let d=t.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=t.docView&&(s=V.create(t.state.doc,d.posBefore))}}let l=(s||t.state.selection).content(),{dom:a,text:c,slice:u}=BC(t,l);(!n.dataTransfer.files.length||!yn||XL>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(th?"Text":"text/html",a.innerHTML),n.dataTransfer.effectAllowed="copyMove",th||n.dataTransfer.setData("text/plain",c),t.dragging=new Sy(u,xz(t,n),s)};jn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Fn.dragover=Fn.dragenter=(t,e)=>e.preventDefault();Fn.drop=(t,e)=>{try{UK(t,e,t.dragging)}finally{t.dragging=null}};function UK(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords(lh(e));if(!r)return;let o=t.state.doc.resolve(r.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=uz(t,Sz(e.dataTransfer),th?null:e.dataTransfer.getData("text/html"),!1,o);let s=!!(n&&xz(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||N.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?uy(t.state.doc,o.pos,i):o.pos;l==null&&(l=o.pos);let a=t.state.tr;if(s){let{node:h}=n;h?h.replace(a):a.deleteSelection()}let c=a.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,d=a.doc;if(u?a.replaceRangeWith(c,c,i.content.firstChild):a.replaceRange(c,c,i),a.doc.eq(d))return;let f=a.doc.resolve(c);if(u&&V.isSelectable(i.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new V(f));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((p,m,y,g)=>h=g),a.setSelection(UC(t,f,a.doc.resolve(h)))}t.focus(),t.dispatch(a.setMeta("uiEvent","drop"))}jn.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())&&ji(t)},20))};jn.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)};jn.beforeinput=(t,e)=>{if(Hi&&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",i=>i(t,pa(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Fn)jn[t]=Fn[t];function rh(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}var oh=class{constructor(e){this.frag=e,this.index=0,this.off=0}nodeAt(e){for(;this.off<=e&&this.index<this.frag.childCount;){let n=this.frag.child(this.index);if(this.off==e)return n;this.off+=n.nodeSize,this.index++}return null}},xy=class t{constructor(e,n){this.toDOM=e,this.spec=n||ba,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new ot(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof t&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&rh(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},va=class t{constructor(e,n){this.attrs=e,this.spec=n||ba}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new ot(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof t&&rh(this.attrs,e.attrs)&&rh(this.spec,e.spec)}static is(e){return e.type instanceof t}destroy(){}},NC=class t{constructor(e,n){this.attrs=e,this.spec=n||ba}map(e,n,r,o){let i=e.mapResult(n.from+o,1);if(i.deleted)return null;let s=e.mapResult(n.to+o,-1);return s.deleted||s.pos<=i.pos?null:new ot(i.pos-r,s.pos-r,this)}valid(e,n,r){let o=r.nodeAt(n.from);return!!o&&!o.isText&&n.from+o.nodeSize==n.to}eq(e){return this==e||e instanceof t&&rh(this.attrs,e.attrs)&&rh(this.spec,e.spec)}destroy(){}},ot=class t{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new t(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 t(e,e,new xy(n,r))}static inline(e,n,r,o){return new t(e,n,new va(r,o))}static node(e,n,r,o){return new t(e,n,new NC(r,o))}get spec(){return this.type.spec}get inline(){return this.type instanceof va}get widget(){return this.type instanceof xy}},Su=[],ba={},ce=class t{constructor(e,n){this.local=e.length?e:Su,this.children=n.length?n:Su}static create(e,n){return n.length?Ey(n,e,0,ba):Mn}find(e,n,r){let o=[];return this.findInner(e??0,n??1e9,o,0,r),o}findInner(e,n,r,o,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&r.push(l.copy(l.from+o,l.to+o))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,r,o+l,i)}}map(e,n,r){return this==Mn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ba)}mapInner(e,n,r,o,i){let s;if(this.local.length){let l=new oh(n.content);for(let a=0;a<this.local.length;a++){let c=this.local[a].map(e,r,o);c&&c.type.valid(n,c,l)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[a].spec)}}return this.children.length?BK(this.children,s||[],e,n,r,o,i):s?new t(s.sort(wa),Su):Mn}add(e,n){return n.length?this==Mn?t.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let o,i=0;e.forEach((l,a)=>{let c=a+r,u;if(u=Ez(n,l,c)){for(o||(o=this.children.slice());i<o.length&&o[i]<a;)i+=3;o[i]==a?o[i+2]=o[i+2].addInner(l,u,c+1):o.splice(i,0,a,a+l.nodeSize,Ey(u,l,c+1,ba)),i+=3}});let s=Cz(i?Tz(n):n,-r);if(s.length){let l=new oh(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||s.splice(a--,1)}return new t(s.length?this.local.concat(s).sort(wa):this.local,o||this.children)}remove(e){return e.length==0||this==Mn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,o=this.local;for(let i=0;i<r.length;i+=3){let s,l=r[i]+n,a=r[i+1]+n;for(let u=0,d;u<e.length;u++)(d=e[u])&&d.from>l&&d.to<a&&(e[u]=null,(s||(s=[])).push(d));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(s,l+1);c!=Mn?r[i+2]=c:(r.splice(i,3),i-=3)}if(o.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<o.length;l++)o[l].eq(s,n)&&(o==this.local&&(o=this.local.slice()),o.splice(l--,1))}return r==this.children&&o==this.local?this:o.length||r.length?new t(o,r):Mn}forChild(e,n){if(this==Mn)return this;if(n.isLeaf)return t.empty;let r,o;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(r=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof va){let c=Math.max(i,a.from)-i,u=Math.min(s,a.to)-i;c<u&&(o||(o=[])).push(a.copy(c,u))}}if(o){let l=new t(o.sort(wa),Su);return r?new Cy([l,r]):l}return r||Mn}eq(e){if(this==e)return!0;if(!(e instanceof t)||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 jC(this.localsInner(e))}localsInner(e){if(this==Mn)return Su;if(e.inlineContent||!this.local.some(va.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof va||n.push(this.local[r]);return n}forEachSet(e){e(this)}};ce.empty=new ce([],[]);ce.removeOverlap=jC;var Mn=ce.empty,Cy=class t{constructor(e){this.members=e}map(e,n){let r=this.members.map(o=>o.map(e,n,ba));return t.from(r)}forChild(e,n){if(n.isLeaf)return ce.empty;let r=[];for(let o=0;o<this.members.length;o++){let i=this.members[o].forChild(e,n);i!=Mn&&(i instanceof t?r=r.concat(i.members):r.push(i))}return t.from(r)}eq(e){if(!(e instanceof t)||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 o=0;o<this.members.length;o++){let i=this.members[o].localsInner(e);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?jC(r?n:n.sort(wa)):Su}static from(e){switch(e.length){case 0:return Mn;case 1:return e[0];default:return new t(e.every(n=>n instanceof ce)?e:e.reduce((n,r)=>n.concat(r instanceof ce?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}};function BK(t,e,n,r,o,i,s){let l=t.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,h,p,m)=>{let y=m-p-(h-f);for(let g=0;g<l.length;g+=3){let v=l[g+1];if(v<0||f>v+u-d)continue;let b=l[g]+u-d;h>=b?l[g+1]=f<=b?-2:-1:f>=u&&y&&(l[g]+=y,l[g+1]+=y)}d+=y}),u=n.maps[c].map(u,-1)}let a=!1;for(let c=0;c<l.length;c+=3)if(l[c+1]<0){if(l[c+1]==-2){a=!0,l[c+1]=-1;continue}let u=n.map(t[c]+i),d=u-o;if(d<0||d>=r.content.size){a=!0;continue}let f=n.map(t[c+1]+i,-1),h=f-o,{index:p,offset:m}=r.content.findIndex(d),y=r.maybeChild(p);if(y&&m==d&&m+y.nodeSize==h){let g=l[c+2].mapInner(n,y,u+1,t[c]+i+1,s);g!=Mn?(l[c]=d,l[c+1]=h,l[c+2]=g):(l[c+1]=-2,a=!0)}else a=!0}if(a){let c=PK(l,t,e,n,o,i,s),u=Ey(c,r,0,s);e=u.local;for(let d=0;d<l.length;d+=3)l[d+1]<0&&(l.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let h=u.children[d];for(;f<l.length&&l[f]<h;)f+=3;l.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ce(e.sort(wa),l)}function Cz(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let o=t[r];n.push(new ot(o.from+e,o.to+e,o.type))}return n}function PK(t,e,n,r,o,i,s){function l(a,c){for(let u=0;u<a.local.length;u++){let d=a.local[u].map(r,o,c);d?n.push(d):s.onRemove&&s.onRemove(a.local[u].spec)}for(let u=0;u<a.children.length;u+=3)l(a.children[u+2],a.children[u]+c+1)}for(let a=0;a<t.length;a+=3)t[a+1]==-1&&l(t[a+2],e[a]+i+1);return n}function Ez(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,o=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<r&&((o||(o=[])).push(s),t[i]=null);return o}function Tz(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ey(t,e,n,r){let o=[],i=!1;e.forEach((l,a)=>{let c=Ez(t,l,a+n);if(c){i=!0;let u=Ey(c,l,n+a+1,r);u!=Mn&&o.push(a,a+l.nodeSize,u)}});let s=Cz(i?Tz(t):t,-n).sort(wa);if(s.length){let l=new oh(e.content);for(let a=0;a<s.length;a++)s[a].type.valid(e,s[a],l)||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1))}return s.length||o.length?new ce(s,o):Mn}function wa(t,e){return t.from-e.from||t.to-e.to}function jC(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let o=n+1;o<e.length;o++){let i=e[o];if(i.from==r.from){i.to!=r.to&&(e==t&&(e=t.slice()),e[o]=i.copy(i.from,r.to),BL(e,o+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,i.from),BL(e,o,r.copy(i.from,r.to)));break}}}return e}function BL(t,e,n){for(;e<t.length&&wa(n,t[e])>0;)e++;t.splice(e,0,n)}function hC(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Mn&&e.push(r)}),t.cursorWrapper&&e.push(ce.create(t.state.doc,[t.cursorWrapper.deco])),Cy.from(e)}var HK={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},VK=rr&&ol<=11,_C=class{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}},IC=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new _C,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;o<r.length;o++)this.queue.push(r[o]);rr&&ol<=11&&r.some(o=>o.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():On&&e.composing&&r.some(o=>o.type=="childList"&&o.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),VK&&(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,HK)),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(DL(this.view)){if(this.suppressingSelectionUpdates)return ji(this.view);if(rr&&ol<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Sa(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 i=e.focusNode;i;i=xu(i))n.add(i);for(let i=e.anchorNode;i;i=xu(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:Ht(r)?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,o=!1;!this.suppressingSelectionUpdates&&DL(e)&&(r=e.domSelectionRange(),o=!this.currentSelection.eq(r)&&!this.ignoreSelectionChange(r));let i=-1,s=-1,l=!1,a=[];if(e.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],a);d&&(i=i<0?d.from:Math.min(d.from,i),s=s<0?d.to:Math.max(d.to,s),d.typeOver&&(l=!0))}if(a.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46||yn&&(e.composing||e.input.compositionEndedAt>Date.now()-50)&&n.some(u=>u.type=="childList"&&u.removedNodes.length))){for(let u of a)if(u.nodeName=="BR"&&u.parentNode){let d=u.nextSibling;for(;d&&F(d);){if(d.contentEditable=="false"){u.parentNode.removeChild(u);break}d=d.firstChild}}}else if(Mr&&a.length){let u=a.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let h=f.parentNode;h&&h.nodeName=="LI"&&(!d||$K(e,d)!=h)&&f.remove()}}}let c=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Ty(r)&&(c=zC(e))&&c.eq(H.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,ji(e),this.currentSelection.set(r),e.scrollToSelection()):(i>-1||o)&&(i>-1&&(e.docView.markDirty(i,s),jK(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,YK(e,a)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):r&&!this.currentSelection.eq(r)&&ji(e),r&&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 u=0;u<e.addedNodes.length;u++){let d=e.addedNodes[u];n.push(d),Ht(d)&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let o=e.previousSibling,i=e.nextSibling;if(rr&&ol<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=e.addedNodes[u];(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(o=d),(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(i=f)}let s=o&&o.parentNode==e.target?gn(o)+1:0,l=r.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?gn(i):e.target.childNodes.length,c=r.localPosFromDOM(e.target,a,1);return{from:l,to:c}}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})}},PL=new WeakMap,HL=!1;function jK(t){if(!PL.has(t)&&(PL.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Mr,HL)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."),HL=!0}}function VL(t,e){let n=e.startContainer,r=e.startOffset,o=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return Sa(s.node,s.offset,o,i)&&([n,r,o,i]=[o,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function FK(t,e){if(e.getComposedRanges){let o=e.getComposedRanges(t.root)[0];if(o)return VL(t,o)}let n;function r(o){o.preventDefault(),o.stopImmediatePropagation(),n=o.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?VL(t,n):null}function $K(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 YK(t,e){var n;let{focusNode:r,focusOffset:o}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||!F(a)||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),r==i&&t.domSelection().collapse(i,o)}else i.parentNode.removeChild(i)}}function qK(t,e,n,r){let{node:o,fromOffset:i,toOffset:s,from:l,to:a}=t.docView.parseRange(e,n),c=t.domSelectionRange(),u,d=c.anchorNode;if(d&&xa(t.dom,d)&&(u=[{node:d,offset:c.anchorOffset}],Ty(c)||u.push({node:c.focusNode,offset:c.focusOffset})),yn&&t.input.lastKeyCode===8)for(let g=s;g>i;g--){let v=o.childNodes[g-1],b=v.pmViewDesc;if(v.nodeName=="BR"&&!b){s=g;break}if(!b||b.size)break}let f=t.state.doc,h=t.someProp("domParser")||Ii.fromSchema(t.state.schema),p=f.resolve(l),m=null,y=h.parse(o,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:i,to:s,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:KK(r),context:p});if(u&&u[0].pos!=null){let g=u[0].pos,v=u[1]&&u[1].pos;v==null&&(v=g),m={anchor:g+l,head:v+l}}return{doc:y,sel:m,from:l,to:a}}var KK=t=>e=>{let n=e.pmViewDesc;if(n)return n.parseRule(t);if(e.nodeName=="BR"&&e.parentNode){if(On&&/^(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||On&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null},GK=/^(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 XK(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let x=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=zC(t,x);if(E&&!t.state.selection.eq(E)){if(yn&&Hi&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",T=>T(t,pa(13,"Enter"))))return;let A=t.state.tr.setSelection(E);x=="pointer"?A.setMeta("pointer",!0):x=="key"&&A.scrollIntoView(),i&&A.setMeta("composition",i),t.dispatch(A)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let a=t.state.selection,c=qK(t,e,n,o),u=t.state.doc,d=u.slice(c.from,c.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=ZK(d.content,c.doc.content,c.from,f,h);if(p&&t.input.domChangeCount++,(Cu&&t.input.lastIOSEnter>Date.now()-225||Hi)&&o.some(x=>F(x)&&!GK.test(x.nodeName))&&(!p||p.endA>=p.endB)&&t.someProp("handleKeyDown",x=>x(t,pa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!p)if(r&&a instanceof L&&!a.empty&&a.$head.sameParent(a.$anchor)&&!t.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))p={start:a.from,endA:a.to,endB:a.to};else{if(c.sel){let x=jL(t,t.state.doc,c.sel);if(x&&!x.eq(t.state.selection)){let E=t.state.tr.setSelection(x);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&p.start==p.endB&&t.state.selection instanceof L&&(p.start>t.state.selection.from&&p.start<=t.state.selection.from+2&&t.state.selection.from>=c.from?p.start=t.state.selection.from:p.endA<t.state.selection.to&&p.endA>=t.state.selection.to-2&&t.state.selection.to<=c.to&&(p.endB+=t.state.selection.to-p.endA,p.endA=t.state.selection.to)),rr&&ol<=11&&p.endB==p.start+1&&p.endA==p.start&&p.start>c.from&&c.doc.textBetween(p.start-c.from-1,p.start-c.from+1)==" \xA0"&&(p.start--,p.endA--,p.endB--);let m=c.doc.resolveNoCache(p.start-c.from),y=c.doc.resolveNoCache(p.endB-c.from),g=u.resolve(p.start),v=m.sameParent(y)&&m.parent.inlineContent&&g.end()>=p.endA;if((Cu&&t.input.lastIOSEnter>Date.now()-225&&(!v||o.some(x=>x.nodeName=="DIV"||x.nodeName=="P"))||!v&&QK(c.doc,m.pos,y.pos))&&t.someProp("handleKeyDown",x=>x(t,pa(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>p.start&&(v?p.endA>p.start&&p.endB==p.start:JK(u,p.start,p.endA,m,y))&&t.someProp("handleKeyDown",x=>x(t,pa(8,"Backspace")))){Hi&&yn&&t.domObserver.suppressSelectionUpdates();return}yn&&p.endB==p.start&&(t.input.lastChromeDelete=Date.now()),Hi&&!v&&m.start()!=y.start()&&y.parentOffset==0&&m.depth==y.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==p.endA&&(p.endB-=2,y=c.doc.resolveNoCache(p.endB-c.from),setTimeout(()=>{t.someProp("handleKeyDown",function(x){return x(t,pa(13,"Enter"))})},20));let b=p.start,w=p.endA,S=x=>{let E=x||t.state.tr.replace(b,w,c.doc.slice(p.start-c.from,p.endB-c.from));if(c.sel){let A=jL(t,E.doc,c.sel);A&&!(yn&&t.composing&&A.empty&&(p.start!=p.endB||t.input.lastChromeDelete<Date.now()-100)&&(A.head==b||A.head==E.mapping.map(w)-1)||rr&&A.empty&&A.head==b)&&E.setSelection(A)}return i&&E.setMeta("composition",i),E.scrollIntoView()},C;if(v)if(m.pos==y.pos){rr&&ol<=11&&m.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>ji(t),20));let x=S(t.state.tr.delete(b,w)),E=u.resolve(p.start).marksAcross(u.resolve(p.endA));E&&x.ensureMarks(E),t.dispatch(x)}else if(p.endA==p.endB&&(C=WK(m.parent.content.cut(m.parentOffset,y.parentOffset),g.parent.content.cut(g.parentOffset,p.endA-g.start())))){let x=S(t.state.tr);C.type=="add"?x.addMark(b,w,C.mark):x.removeMark(b,w,C.mark),t.dispatch(x)}else if(m.parent.child(m.index()).isText&&m.index()==y.index()-(y.textOffset?0:1)){let x=m.parent.textBetween(m.parentOffset,y.parentOffset),E=()=>S(t.state.tr.insertText(x,b,w));t.someProp("handleTextInput",A=>A(t,b,w,x,E))||t.dispatch(E())}else t.dispatch(S());else t.dispatch(S())}function jL(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:UC(t,e.resolve(n.anchor),e.resolve(n.head))}function WK(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,l,a;for(let u=0;u<r.length;u++)o=r[u].removeFromSet(o);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(o.length==1&&i.length==0)l=o[0],s="add",a=u=>u.mark(l.addToSet(u.marks));else if(o.length==0&&i.length==1)l=i[0],s="remove",a=u=>u.mark(l.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<e.childCount;u++)c.push(a(e.child(u)));if(M.from(c).eq(t))return{mark:l,type:s}}function JK(t,e,n,r,o){if(n-e<=o.pos-r.pos||pC(r,!0,!1)<o.pos)return!1;let i=t.resolve(e);if(!r.parent.inlineContent){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(pC(i,!0,!0));return!s.parent.isTextblock||s.pos>n||pC(s,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function QK(t,e,n){let r=0,o=0;return t.nodesBetween(e,n,(i,s)=>{i.isTextblock&&s>=e&&s<n?r++:(i.isText?/\S/.test(i.text.slice(Math.max(0,e-s),Math.min(i.nodeSize,n-s))):i.isLeaf)&&o++}),o==0&&r==1}function pC(t,e,n){let r=t.depth,o=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function ZK(t,e,n,r,o){let i=t.findDiffStart(e,n),s=n+t.size,l=n+e.size;if(i==null)return null;let{a,b:c}=t.findDiffEnd(e,s,l);if(o=="end"){let u=Math.max(0,i-Math.min(a,c));r-=a+u-i}if(a<i&&s<l){let u=r<=i&&r>=a?i-r:0;i-=u,c=i+(c-a),a=i}else if(c<i){let u=r<=i&&r>=c?i-r:0;i-=u,a=i+(a-c),c=i}return{start:i,endA:a,endB:c}}var ih=class{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 MC,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(KL),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=YL(this),$L(this),this.nodeViews=qL(this),this.docView=TL(this.state.doc,FL(this),hC(this),this.dom,this),this.domObserver=new IC(this,(r,o,i,s)=>XK(this,r,o,i,s)),this.domObserver.start(),bK(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&&RC(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(KL),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 o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(wz(this),s=!0),this.state=e;let l=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=qL(this);tG(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&RC(this),this.editable=YL(this),$L(this);let a=hC(this),c=FL(this),u=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(e.doc,c,a);(d||!e.selection.eq(o.selection))&&(s=!0);let f=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Uq(this);if(s){this.domObserver.stop();let h=d&&(rr||yn)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&eG(o.selection,e.selection);if(d){let m=yn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=NK(this)),(i||!this.docView.update(e.doc,c,a,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=TL(e.doc,c,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let p=this.input.mouseDown;h||!(p&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&oK(this)&&p.delaySelUpdate())?ji(this,h):(lz(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&Bq(f)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!xa(this.dom,e))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof V){let n=this.docView.domAfterPos(this.state.selection.from);F(n)&&wL(this,n.getBoundingClientRect(),e)}else wL(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,o=-1;if(r.from<this.state.doc.content.size&&this.state.doc.nodeAt(r.from)==r.node)o=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&i<this.state.doc.content.size&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Sy(e.slice,e.move,o<0?void 0:V.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(o=n?n(l):l))return o}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(o=n?n(l):l))return o}}hasFocus(){if(rr){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&&Pq(this.dom),ji(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 $q(this,e)}coordsAtPos(e,n=1){return tz(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 o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return Xq(this,n||this.state,e)}pasteHTML(e,n){return nh(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return nh(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return BC(this,e)}destroy(){this.docView&&(wK(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],hC(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,kq())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return xK(this,e)}domSelectionRange(){let e=this.dom.isConnected!==!1&&this.domSelection();return e?On&&this.root.nodeType===11&&Nq(this.dom.ownerDocument)==this.dom&&FK(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};ih.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function FL(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"),[ot.node(0,t.state.doc.content.size,e)]}function $L(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:ot.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function YL(t){return!t.someProp("editable",e=>e(t.state)===!1)}function eG(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 qL(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function tG(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function KL(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 Fi={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:"'"},My={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},nG=typeof navigator<"u"&&/Mac/.test(navigator.platform),rG=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(kt=0;kt<10;kt++)Fi[48+kt]=Fi[96+kt]=String(kt);var kt;for(kt=1;kt<=24;kt++)Fi[kt+111]="F"+kt;var kt;for(kt=65;kt<=90;kt++)Fi[kt]=String.fromCharCode(kt+32),My[kt]=String.fromCharCode(kt);var kt;for(ky in Fi)My.hasOwnProperty(ky)||(My[ky]=Fi[ky]);var ky;function Az(t){var e=nG&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||rG&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?My:Fi)[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}var oG=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),iG=typeof navigator<"u"&&/Win/.test(navigator.platform);function sG(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))oG?s=!0:o=!0;else throw new Error("Unrecognized modifier name: "+a)}return r&&(n="Alt-"+n),o&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function lG(t){let e=Object.create(null);for(let n in t)e[sG(n)]=t[n];return e}function FC(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 kz(t){return new G({props:{handleKeyDown:ch(t)}})}function ch(t){let e=lG(t);return function(n,r){let o=Az(r),i,s=e[FC(o,r)];if(s&&s(n.state,n.dispatch,n))return!0;if(o.length==1&&o!=" "){if(r.shiftKey){let l=e[FC(o,r,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(iG&&r.ctrlKey&&r.altKey)&&(i=Fi[r.keyCode])&&i!=o){let l=e[FC(i,r)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var Ry=200,vn=function(){};vn.prototype.append=function(e){return e.length?(e=vn.from(e),!this.length&&e||e.length<Ry&&this.leafAppend(e)||this.length<Ry&&e.leafPrepend(this)||this.appendInner(e)):this};vn.prototype.prepend=function(e){return e.length?vn.from(e).append(this):this};vn.prototype.appendInner=function(e){return new aG(this,e)};vn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?vn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};vn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};vn.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)};vn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};vn.from=function(e){return e instanceof vn?e:e&&e.length?new Mz(e):vn.empty};var Mz=(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(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,l){for(var a=i;a<s;a++)if(o(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(o,i,s,l){for(var a=i-1;a>=s;a--)if(o(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Ry)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Ry)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(vn);vn.empty=new Mz([]);var aG=(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,o,i,s){var l=this.left.length;if(o<l&&this.left.forEachInner(r,o,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(r,Math.max(o-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var l=this.left.length;if(o>l&&this.right.forEachInvertedInner(r,o-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(r,Math.min(o,l),i,s)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var i=this.left.length;return o<=i?this.left.slice(r,o):r>=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,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})(vn),$C=vn;var cG=500,Ea=class t{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 o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,l,a,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){o||(o=this.remapping(r,f+1),i=o.maps.length),i--,u.push(d);return}if(o){u.push(new Wo(d.map));let h=d.step.map(o.slice(i)),p;h&&s.maybeStep(h).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new Wo(p,void 0,void 0,c.length+u.length))),i--,p&&o.appendMap(p,i)}else s.maybeStep(d.step);if(d.selection)return l=o?d.selection.map(o.slice(i)):d.selection,a=new t(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,n,r,o){let i=[],s=this.eventCount,l=this.items,a=!o&&l.length?l.get(l.length-1):null;for(let u=0;u<e.steps.length;u++){let d=e.steps[u].invert(e.docs[u]),f=new Wo(e.mapping.maps[u],d,n),h;(h=a&&a.merge(f))&&(f=h,u?i.pop():l=l.slice(0,l.length-1)),i.push(f),n&&(s++,n=void 0),o||(a=f)}let c=s-r.depth;return c>dG&&(l=uG(l,c),s-=c),new t(l.append(i),s)}remapping(e,n){let r=new qf;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new Wo(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;n=Math.min(this.items.length,n);let r=[],o=this.items.length-n,i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(f=>{f.selection&&l--},o);let a=n;this.items.forEach(f=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let p=i.maps[h];if(f.step){let m=e.steps[h].invert(e.docs[h]),y=f.selection&&f.selection.map(i.slice(a+1,h));y&&l++,r.push(new Wo(p,m,y))}else r.push(new Wo(p))},o);let c=[];for(let f=n;f<s;f++)c.push(new Wo(i.maps[f]));let u=this.items.slice(0,o).append(c).append(r),d=new t(u,l);return d.emptyItemCount()>cG&&(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,o=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)o.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(n.slice(r)),c=a&&a.getMap();if(r--,c&&n.appendMap(c,r),a){let u=s.selection&&s.selection.map(n.slice(r));u&&i++;let d=new Wo(c.invert(),a,u),f,h=o.length-1;(f=o.length&&o[h].merge(d))?o[h]=f:o.push(d)}}else s.map&&r--},this.items.length,0),new t($C.from(o.reverse()),i)}};Ea.empty=new Ea($C.empty,0);function uG(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}var Wo=class t{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},Jo=class{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},dG=20;function fG(t,e,n,r){let o=n.getMeta(ll),i;if(o)return o.historyState;n.getMeta(Nz)&&(t=new Jo(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(ll))return s.getMeta(ll).redo?new Jo(t.done.addTransform(n,void 0,r,Oy(e)),t.undone,Rz(n.mapping.maps),t.prevTime,t.prevComposition):new Jo(t.done,t.undone.addTransform(n,void 0,r,Oy(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),a=t.prevTime==0||!s&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-r.newGroupDelay||!hG(n,t.prevRanges)),c=s?YC(t.prevRanges,n.mapping):Rz(n.mapping.maps);return new Jo(t.done.addTransform(n,a?e.selection.getBookmark():void 0,r,Oy(e)),Ea.empty,c,n.time,l??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Jo(t.done.rebased(n,i),t.undone.rebased(n,i),YC(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Jo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),YC(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function hG(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i<e.length;i+=2)r<=e[i+1]&&o>=e[i]&&(n=!0)}),n}function Rz(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,o,i,s)=>e.push(i,s));return e}function YC(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let o=e.map(t[r],1),i=e.map(t[r+1],-1);o<=i&&n.push(o,i)}return n}function pG(t,e,n){let r=Oy(e),o=ll.get(e).spec.config,i=(n?t.undone:t.done).popEvent(e,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(n?t.done:t.undone).addTransform(i.transform,e.selection.getBookmark(),o,r),a=new Jo(n?l:i.remaining,n?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(ll,{redo:n,historyState:a})}var qC=!1,Oz=null;function Oy(t){let e=t.plugins;if(Oz!=e){qC=!1,Oz=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){qC=!0;break}}return qC}function Dz(t){return t.setMeta(Nz,!0)}var ll=new ae("history"),Nz=new ae("closeHistory");function _z(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new G({key:ll,state:{init(){return new Jo(Ea.empty,Ea.empty,null,0,-1)},apply(e,n,r){return fG(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,o=r=="historyUndo"?KC:r=="historyRedo"?GC:null;return!o||!e.editable?!1:(n.preventDefault(),o(e.state,e.dispatch))}}}})}function Dy(t,e){return(n,r)=>{let o=ll.getState(n);if(!o||(t?o.undone:o.done).eventCount==0)return!1;if(r){let i=pG(o,n,t);i&&r(e?i.scrollIntoView():i)}return!0}}var KC=Dy(!1,!0),GC=Dy(!0,!0),Lie=Dy(!1,!1),zie=Dy(!0,!1);function Iz(t){return t.getMeta(ll)!=null}function Hy(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:o}=n,{storedMarks:i}=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 i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Mu=class tU{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(){let{rawCommands:e,editor:n,state:r}=this,{view:o}=n,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{let d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l=[],a=!!e,c=e||i.tr,u=()=>(!a&&n&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),l.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(r).map(([f,h])=>[f,(...m)=>{let y=this.buildProps(c,n),g=h(...m)(y);return l.push(g),d}])),run:u};return d}static createFakeChain(){let e=new Proxy({},{get:(n,r)=>{if(r!=="then")return r==="run"?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:n,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(n).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}static createFallbackCan(){let e=tU.createFakeChain();return new Proxy({chain:()=>e},{get:(n,r)=>{if(r!=="then")return r==="chain"?n.chain:()=>!1}})}buildProps(e,n=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,l={tr:e,editor:o,view:s,state:Hy({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([a,c])=>[a,(...u)=>c(...u)(l)]))}};return l}},mG=()=>({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),gG=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),yG=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;let{doc:c,mapping:u}=e,d=c.resolve(u.map(a)),f=c.resolve(u.map(a+l.nodeSize)),h=d.blockRange(f);if(!h)return;let p=Ui(h);if(l.type.isTextblock){let{defaultType:m}=d.parent.contentMatchAt(d.index());e.setNodeMarkup(h.start,m)}(p||p===0)&&e.lift(h,p)})}),!0},vG=t=>e=>t(e),bG=()=>({state:t,dispatch:e})=>iC(t,e),wG=(t,e)=>({editor:n,tr:r})=>{let{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new L(r.doc.resolve(Math.max(s-1,0)))),!0},SG=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){let s=o.before(i),l=o.after(i);t.delete(s,l).scrollIntoView()}return!0}return!1};function Mt(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}var xG=t=>({tr:e,state:n,dispatch:r})=>{let o=Mt(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){let l=i.before(s),a=i.after(s);e.delete(l,a).scrollIntoView()}return!0}return!1},CG=t=>({tr:e,dispatch:n})=>{let{from:r,to:o}=t;return n&&e.delete(r,o),!0},EG=t=>t.content?/^text(\*|\+)/.test(t.content):!1,Lz=(t,e,n)=>{if(!t.parent.isInline||n==="left"&&t.pos>t.start()||n==="right"&&t.pos<t.end())return t.pos;let r=e.nodes[t.parent.type.name].spec;return EG(r)?n==="left"?t.start()-1:t.end()+1:t.pos},TG=(t,e,n)=>({from:Lz(t,n,"left"),to:Lz(e,n,"right")}),AG=()=>({state:t,dispatch:e})=>{if(t.selection.empty)return!1;if(e){let n=t.tr,{ranges:r}=t.selection,o=t.selection instanceof L?t.selection.$from.marksAcross(t.selection.$to):null,i=n.steps.length;r.forEach(s=>{let l=n.mapping.slice(i),a=n.doc.resolve(l.map(s.$from.pos)),c=n.doc.resolve(l.map(s.$to.pos)),{from:u,to:d}=TG(a,c,t.schema);n.deleteRange(u,d)}),n.selection.empty||n.setSelection(L.near(n.doc.resolve(n.selection.from))),o&&n.ensureMarks(o),n.scrollIntoView(),e(n)}return!0},kG=()=>({commands:t})=>t.keyboardShortcut("Enter"),MG=()=>({state:t,dispatch:e})=>oC(t,e);function ZC(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function By(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:ZC(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function nU(t,e,n={}){return t.find(r=>r.type===e&&By(Object.fromEntries(Object.keys(n).map(o=>[o,r.attrs[o]])),n))}function zz(t,e,n={}){return!!nU(t,e,n)}function eE(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(a=>a.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(a=>a.type===e))return;if(!n){let a=r.node.marks.find(c=>c.type===e);a&&(n=a.attrs)}if(!nU([...r.node.marks],e,n))return;let o=r.index,i=t.start()+r.offset,s=o+1,l=i+r.node.nodeSize;for(;o>0&&zz([...t.parent.child(o-1).marks],e,n);)o-=1,i-=t.parent.child(o).nodeSize;for(;s<t.parent.childCount&&zz([...t.parent.child(s).marks],e,n);)l+=t.parent.child(s).nodeSize,s+=1;return{from:i,to:l}}function $i(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}var RG=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=$i(t,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:u}=l;if(o){let d=eE(a,i,e);if(d&&d.from<=c&&d.to>=u){let f=L.create(s,d.from,d.to);n.setSelection(f)}}return!0},OG=t=>e=>{let 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 rU(t){return t instanceof L}function Ta(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function XC(t,e=null){if(!e)return null;let n=H.atStart(t),r=H.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;let o=n.from,i=r.to;return e==="all"?L.create(t,Ta(0,o,i),Ta(t.content.size,o,i)):L.create(t,Ta(e,o,i),Ta(e,o,i))}function Uz(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function Py(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function DG(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var NG=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};let s=()=>{(Py()||Uz())&&r.dom.focus(),DG()&&!Py()&&!Uz()&&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(i&&t===null&&!rU(n.state.selection))return s(),!0;let l=XC(o.doc,t)||n.state.selection,a=n.state.selection.eq(l);return i&&(a||o.setSelection(l),a&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},_G=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),IG=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),oU=t=>{let e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){let r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&oU(r)}return t};function Ny(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return oU(n)}function iU(t){return typeof t?.nodesBetween=="function"}function Ru(t,e,n){if(iU(t))return t;let r=typeof t=="object"&&t!==null;n={slice:!0,parseOptions:{},...n};let o=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return M.fromArray(t.map(s=>e.nodeFromJSON(s)));let i=e.nodeFromJSON(t);return n.errorOnInvalidContent&&i.check(),i}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Ru("",e,n)}if(o){if(n.errorOnInvalidContent){let s=!1,l="",a=new ua({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:c=>(s=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Ii.fromSchema(a).parseSlice(Ny(t),n.parseOptions):Ii.fromSchema(a).parse(Ny(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}let i=Ii.fromSchema(e);return n.slice?i.parseSlice(Ny(t),n.parseOptions).content:i.parse(Ny(t),n.parseOptions)}return Ru("",e,n)}function sU(t){return!("type"in t)}function lU(t,e,n){let r=t.steps.length-1;if(r<e)return;let o=t.steps[r];if(!(o instanceof dt||o instanceof At))return;let i=t.mapping.maps[r],s=0;i.forEach((l,a,c,u)=>{s===0&&(s=u)}),t.setSelection(H.near(t.doc.resolve(s),n))}var LG=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l,a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Ru(e,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(y){a(y)}try{var s;l=Ru(e,i.schema,{parseOptions:c,errorOnInvalidContent:(s=n.errorOnInvalidContent)!==null&&s!==void 0?s:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:u,to:d}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},f=!0,h=!0,p=sU(l)?l.content:[l];if(p.forEach(y=>{y.check(),f=f?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),u===d&&h){let{parent:y}=r.doc.resolve(u);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(u-=1,d+=1)}let m;if(f)Array.isArray(e)?m=e.map(y=>y.text||"").join(""):iU(e)?m=p.map(y=>{var g;return(g=y.text)!==null&&g!==void 0?g:""}).join(""):typeof e=="object"&&e&&e.text?m=e.text:m=e,r.insertText(m,u,d);else{m=M.from(p);let y=r.doc.resolve(u),g=y.node(),v=y.parentOffset===0,b=g.isText||g.isTextblock,w=g.content.size>0;v&&b&&w&&h&&(u=Math.max(0,u-1)),r.replaceWith(u,d,p)}n.updateSelection&&lU(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0};function aU(t){for(let e=0;e<t.edgeCount;e+=1){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var zG=(t={})=>({tr:e,dispatch:n,editor:r})=>{let{pos:o,attrs:i,content:s,updateSelection:l=!0}=t,a;typeof o=="number"?a=e.doc.resolve(o):o?a=o:a=e.selection.$from;let c=aU(a.parent.contentMatchAt(a.index()));if(!c)return!1;let u=Object.keys(c.spec.attrs||{}),d=i?Object.fromEntries(Object.entries(i).filter(([h])=>u.includes(h))):{},f;if(s){let h=Ru(s,r.schema);f=c.createAndFill(d,h)}else f=c.createAndFill(d);return f?(n&&(e.insert(a.pos,f),l&&lU(e,e.steps.length-1,-1)),!0):!1},UG=()=>({state:t,dispatch:e})=>aL(t,e),BG=()=>({state:t,dispatch:e})=>cL(t,e),PG=()=>({state:t,dispatch:e})=>Wx(t,e),HG=()=>({state:t,dispatch:e})=>Zx(t,e),cU=(t,e)=>{let n=t.resolve(e),r=n.nodeBefore,o=n.nodeAfter;return!r||!o?!1:!r.type.spec.isolating&&!o.type.spec.isolating},VG=()=>({state:t,dispatch:e,tr:n})=>{try{let r=mu(t.doc,t.selection.$from.pos,-1);return r==null||!cU(t.doc,r)?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},jG=()=>({state:t,dispatch:e,tr:n})=>{try{let r=mu(t.doc,t.selection.$from.pos,1);return r==null||!cU(t.doc,r)?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},FG=()=>({state:t,dispatch:e})=>hy(t,e),$G=()=>({state:t,dispatch:e})=>py(t,e);function uU(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function YG(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let l=0;l<e.length-1;l+=1){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))r=!0;else if(/^(c|ctrl|control)$/i.test(a))o=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Py()||uU()?s=!0:o=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return r&&(n=`Alt-${n}`),o&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var qG=t=>({editor:e,view:n,tr:r,dispatch:o})=>{let i=YG(t).split(/-(?!$)/),s=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,l))});return a?.steps.forEach(c=>{let u=c.map(r.mapping);u&&o&&r.maybeStep(u)}),!0};function Qo(t,e,n={}){let{from:r,to:o,empty:i}=t.selection,s=e?Mt(e,t.schema):null,l=[];t.doc.nodesBetween(r,o,(u,d)=>{if(u.isText)return;let f=Math.max(r,d),h=Math.min(o,d+u.nodeSize);l.push({node:u,from:f,to:h})});let a=o-r,c=l.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>By(u.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((u,d)=>u+d.to-d.from,0)>=a}var KG=(t,e={})=>({state:n,dispatch:r})=>Qo(n,Mt(t,n.schema),e)?uL(n,r):!1,GG=()=>({state:t,dispatch:e})=>sC(t,e),XG=t=>({state:e,dispatch:n})=>{let r=Mt(t,e.schema);return gL(r)(e,n)},WG=()=>({state:t,dispatch:e})=>nC(t,e);function Vy(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function Bz(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var JG=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,l=Vy(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=Mt(t,r.schema)),l==="mark"&&(s=$i(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(u,d)=>{i&&i===u.type&&(a=!0,o&&n.setNodeMarkup(d,void 0,Bz(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(f=>{s===f.type&&(a=!0,o&&n.addMark(d,d+u.nodeSize,s.create(Bz(f.attrs,e))))})})}),a},QG=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),ZG=()=>({tr:t,dispatch:e})=>{if(e){let n=new mn(t.doc);t.setSelection(n)}return!0},eX=()=>({state:t,dispatch:e})=>Jx(t,e),tX=()=>({state:t,dispatch:e})=>eC(t,e),nX=()=>({state:t,dispatch:e})=>dL(t,e),rX=()=>({state:t,dispatch:e})=>aC(t,e),oX=()=>({state:t,dispatch:e})=>lC(t,e);function WC(t,e,n={},r={}){return Ru(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var iX=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:l})=>{let{doc:a}=i;if(r.preserveWhitespace!=="full"){let c=WC(t,o.schema,r,{errorOnInvalidContent:e??o.options.enableContentCheck});if(s){let u=sU(c)?c.content:[c];i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!n)}return!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},t,{parseOptions:r,errorOnInvalidContent:e??o.options.enableContentCheck})};function dU(t,e){let n=$i(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,a=>{s.push(...a.marks)});let l=s.find(a=>a.type.name===n.name);return l?{...l.attrs}:{}}function tE(t,e){let n=new el(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function fU(t,e,n){let r=[];return t.nodesBetween(e.from,e.to,(o,i)=>{n(o)&&r.push({node:o,pos:i})}),r}function Du(t,e){for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function jy(t){return e=>Du(e.$from,t)}function B(t,e,n){return t.config[e]===void 0&&t.parent?B(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?B(t.parent,e,n):null}):t.config[e]}function nE(t){return t.map(e=>{let n=B(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return n?[e,...nE(n())]:e}).flat(10)}function rE(t,e){let n=Li.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function hU(t,e){let n=new Map;for(let o of t){var r;let i=(r=n.get(o.type))!==null&&r!==void 0?r:new Map;i.set(o.name,o),n.set(o.type,i)}return[...Object.values(e.nodes),...Object.values(e.marks)].flatMap(o=>{var i;return Object.entries((i=o.spec.attrs)!==null&&i!==void 0?i:{}).map(([s,l])=>{var a;let c=(a=n.get(o.name))===null||a===void 0?void 0:a.get(s),u=Object.hasOwn(l,"default");return{type:o.name,name:s,attribute:{rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,...c?.attribute,default:l.default,isRequired:!u,validate:l.validate}}})})}var sX={content:"string",marks:"string",group:"string",inline:"boolean",atom:"boolean",selectable:"boolean",draggable:"boolean",code:"boolean",whitespace:["pre","normal"],definingAsContext:"boolean",definingForContent:"boolean",defining:"boolean",isolating:"boolean",linebreakReplacement:"boolean"},lX={inclusive:"boolean",excludes:"string",group:"string",spanning:"boolean",code:"boolean"};function aX(t,e,n){return Object.fromEntries(Object.entries(e).flatMap(([r,o])=>{let i=t[r];if(i===void 0)return[];if(!(typeof o=="string"?typeof i===o:typeof i=="string"&&o.includes(i)))throw new RangeError(`Invalid schemaSpec field '${n}.${r}'`);return[[r,i]]}))}function Pz(t,e,n,r){return{...Object.fromEntries(Object.entries(e).filter(([o])=>o!=="attrs"&&!Object.hasOwn(r,o))),...aX(n,r,t),attrs:n.attrs}}function Hz(t,e,n){for(let r of Object.keys(e))if(!Object.hasOwn(t,r))throw new RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);for(let r of Object.keys(t))if(!Object.hasOwn(e,r))throw new RangeError(`Local ${n} extension '${r}' is not in schemaSpec`)}function cX(t,e){Hz(t.nodes,e.nodes,"node"),Hz(t.marks,e.marks,"mark");let n=e.spec.nodes,r=e.spec.marks;return e.spec.nodes.forEach((o,i)=>{n=n.update(o,Pz(o,t.nodes[o],i,sX))}),e.spec.marks.forEach((o,i)=>{r=r.update(o,Pz(o,t.marks[o],i,lX))}),{topNode:e.topNodeType.name,nodes:n,marks:r}}function pU(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function Ou(t){return{baseExtensions:t.filter(e=>e.type==="extension"),nodeExtensions:t.filter(e=>e.type==="node"),markExtensions:t.filter(e=>e.type==="mark")}}function oE(t){let e=[],{nodeExtensions:n,markExtensions:r}=Ou(t),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(c=>c.name!=="text").map(c=>c.name),l=r.map(c=>c.name),a=[...s,...l];return t.forEach(c=>{let u=B(c,"addGlobalAttributes",{name:c.name,options:c.options,storage:c.storage,extensions:o});u&&u().forEach(d=>{let f;Array.isArray(d.types)?f=d.types:d.types==="*"?f=a:d.types==="nodes"?f=s:d.types==="marks"?f=l:f=[],f.forEach(h=>{Object.entries(d.attributes).forEach(([p,m])=>{e.push({type:h,name:p,attribute:{...i,...m}})})})})}),o.forEach(c=>{let u=B(c,"addAttributes",{name:c.name,options:c.options,storage:c.storage});if(!u)return;let d=u();Object.entries(d).forEach(([f,h])=>{let p={...i,...h};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:c.name,name:f,attribute:p})})}),e}function JC(t){return typeof t=="function"}function be(t,e=void 0,...n){return JC(t)?e?t.bind(e)(...n):t(...n):t}function uX(t={}){return Object.keys(t).length===0&&t.constructor===Object}function dX(t){let e=[],n="",r=!1,o=!1,i=0,s=t.length;for(let l=0;l<s;l+=1){let a=t[l];if(a==="'"&&!o){r=!r,n+=a;continue}if(a==='"'&&!r){o=!o,n+=a;continue}if(!r&&!o){if(a==="("){i+=1,n+=a;continue}if(a===")"&&i>0){i-=1,n+=a;continue}if(a===";"&&i===0){e.push(n),n="";continue}}n+=a}return n&&e.push(n),e}function Vz(t){let e=[],n=dX(t||""),r=n.length;for(let o=0;o<r;o+=1){let i=n[o],s=i.indexOf(":");if(s===-1)continue;let l=i.slice(0,s).trim(),a=i.slice(s+1).trim();l&&a&&e.push([l,a])}return e}function ue(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([o,i])=>{if(o==="__proto__"){Object.defineProperty(r,o,{configurable:!0,enumerable:!0,value:i,writable:!0});return}if(!r[o]){r[o]=i;return}if(o==="class"){let s=i?String(i).split(" "):[],l=r[o]?r[o].split(" "):[],a=s.filter(c=>!l.includes(c));r[o]=[...l,...a].join(" ")}else if(o==="style"){let s=new Map([...Vz(r[o]),...Vz(i)]);r[o]=Array.from(s.entries()).map(([l,a])=>`${l}: ${a}`).join("; ")}else r[o]=i}),r},{})}function al(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)=>ue(n,r),{})}function fX(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function jz(t,e){return"style"in t?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let o=e.reduce((i,s)=>{let l=s.attribute.parseHTML?s.attribute.parseHTML(n):fX(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...r,...o}}}}function Fz(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&uX(n)?!1:n!=null))}function $z(t){var e,n;let 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 Yz(t,e,n=oE(t)){var r;let{nodeExtensions:o,markExtensions:i}=Ou(t);return{topNode:(r=o.find(s=>B(s,"topNode")))===null||r===void 0?void 0:r.name,nodes:Object.fromEntries(o.map(s=>{let l=n.filter(h=>h.type===s.name),a={name:s.name,options:s.options,storage:s.storage,editor:e},c=Fz({...t.reduce((h,p)=>{let m=B(p,"extendNodeSchema",a);return{...h,...m?m(s):{}}},{}),content:be(B(s,"content",a)),marks:be(B(s,"marks",a)),group:be(B(s,"group",a)),inline:be(B(s,"inline",a)),atom:be(B(s,"atom",a)),selectable:be(B(s,"selectable",a)),draggable:be(B(s,"draggable",a)),code:be(B(s,"code",a)),whitespace:be(B(s,"whitespace",a)),linebreakReplacement:be(B(s,"linebreakReplacement",a)),defining:be(B(s,"defining",a)),isolating:be(B(s,"isolating",a)),attrs:Object.fromEntries(l.map($z))}),u=be(B(s,"parseHTML",a));u&&(c.parseDOM=u.map(h=>jz(h,l)));let d=B(s,"renderHTML",a);d&&(c.toDOM=h=>d({node:h,HTMLAttributes:al(h,l)}));let f=B(s,"renderText",a);return f&&(c.toText=f),[s.name,c]})),marks:Object.fromEntries(i.map(s=>{let l=n.filter(f=>f.type===s.name),a={name:s.name,options:s.options,storage:s.storage,editor:e},c=Fz({...t.reduce((f,h)=>{let p=B(h,"extendMarkSchema",a);return{...f,...p?p(s):{}}},{}),inclusive:be(B(s,"inclusive",a)),excludes:be(B(s,"excludes",a)),group:be(B(s,"group",a)),spanning:be(B(s,"spanning",a)),code:be(B(s,"code",a)),attrs:Object.fromEntries(l.map($z))}),u=be(B(s,"parseHTML",a));u&&(c.parseDOM=u.map(f=>jz(f,l)));let d=B(s,"renderHTML",a);return d&&(c.toDOM=f=>d({mark:f,HTMLAttributes:al(f,l)})),[s.name,c]}))}}function hX(t,e,n){if(n===void 0)return new ua(Yz(t,e));let r=pU(t.filter(s=>s.type!=="extension").map(s=>s.name));if(r.length)throw new RangeError(`Duplicate local schema types: ${r.join(", ")}`);let o=new ua(n),i=Yz(t,e,hU(oE(t),o));return new ua(cX(i,o))}function fh(t){return t.sort((n,r)=>{let o=B(n,"priority")||100,i=B(r,"priority")||100;return o>i?-1:o<i?1:0})}function mU(t){let e=fh(nE(t)),n=pU(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 gU(t,e,n){let{from:r,to:o}=e,{blockSeparator:i=`
|
|
59
|
+
|
|
60
|
+
`,textSerializers:s={}}=n||{},l="";return t.nodesBetween(r,o,(a,c,u,d)=>{a.isBlock&&c>r&&(l+=i);let f=s?.[a.type.name];if(f)return u&&(l+=f({node:a,pos:c,parent:u,index:d,range:e})),!1;if(a.isText){var h;l+=a==null||(h=a.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,o-c)}}),l}function pX(t,e){return gU(t,{from:0,to:t.content.size},e)}function yU(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function mX(t,e){let n=Mt(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,l=>{i.push(l)});let s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function iE(t,e){let n=Vy(typeof e=="string"?e:e.name,t.schema);return n==="node"?mX(t,e):n==="mark"?dU(t,e):{}}function gX(t,e=JSON.stringify){let n={};return t.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function yX(t){let e=gX(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,i)=>i!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function Nu(t){let{mapping:e,steps:n}=t,r=[],o=e.invert();return e.maps.forEach((i,s)=>{let l=[];if(i.ranges.length)i.forEach((c,u)=>{l.push({from:c,to:u})});else{let{from:c,to:u}=n[s];if(c===void 0||u===void 0)return;l.push({from:c,to:u})}let a=e.slice(s);l.forEach(({from:c,to:u})=>{let d=a.map(c,-1),f=a.map(u),h=o.map(d,-1),p=o.map(f);r.push({oldRange:{from:h,to:p},newRange:{from:d,to:f}})})}),yX(r)}function hh(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(o=>{let i=eE(n.resolve(t),o.type);i&&r.push({mark:o,...i})}):n.nodesBetween(t,e,(o,i)=>{!o||o?.nodeSize===void 0||r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}var vU=(t,e,n,r=20)=>{let o=t.doc.resolve(n),i=r,s=null;for(;i>0&&s===null;){let l=o.node(i);l?.type.name===e?s=l:i-=1}return[s,i]},bU=t=>{let e=t.depth-1;if(e<0)return null;let n=t.index(e);return n===0?null:t.node(e).child(n-1)};function Eu(t,e){return e.nodes[t]||e.marks[t]||null}function Uy(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}var vX=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,l)=>{var a,c;let u=((a=(c=o.type.spec).toText)===null||a===void 0?void 0:a.call(c,{node:o,pos:i,parent:s,index:l}))||o.textContent||"%leaf%";n+=o.isAtom&&!o.isText?u:u.slice(0,Math.max(0,r-i))}),n};function QC(t,e,n={}){let{empty:r,ranges:o}=t.selection,i=e?$i(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(u=>i?i.name===u.type.name:!0).find(u=>By(u.attrs,n,{strict:!1}));let s=0,l=[];if(o.forEach(({$from:u,$to:d})=>{let f=u.pos,h=d.pos;t.doc.nodesBetween(f,h,(p,m)=>{if(i&&p.inlineContent&&!p.type.allowsMarkType(i))return!1;if(!p.isText&&!p.marks.length)return;let y=Math.max(f,m),g=Math.min(h,m+p.nodeSize),v=g-y;s+=v,l.push(...p.marks.map(b=>({mark:b,from:y,to:g})))})}),s===0)return!1;let a=l.filter(u=>i?i.name===u.mark.type.name:!0).filter(u=>By(u.mark.attrs,n,{strict:!1})).reduce((u,d)=>u+d.to-d.from,0),c=l.filter(u=>i?u.mark.type!==i&&u.mark.type.excludes(i):!0).reduce((u,d)=>u+d.to-d.from,0);return(a>0?a+c:a)>=s}function bX(t,e,n={}){if(!e)return Qo(t,null,n)||QC(t,null,n);let r=Vy(e,t.schema);return r==="node"?Qo(t,e,n):r==="mark"?QC(t,e,n):!1}var wU=(t,e)=>{let{$from:n,$to:r,$anchor:o}=t.selection;if(e){let i=jy(l=>l.type.name===e)(t.selection);if(!i)return!1;let s=t.doc.resolve(i.pos+1);return o.pos+1===s.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},SU=t=>{let{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function qz(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function uh(t,e){let{nodeExtensions:n}=Ou(e),r=n.find(i=>i.name===t);if(!r)return!1;let o=be(B(r,"group",{name:r.name,options:r.options,storage:r.storage}));return typeof o!="string"?!1:o.split(" ").includes("list")}function _u(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 o=!0;return t.content.forEach(i=>{o!==!1&&(_u(i,{ignoreWhitespace:n,checkChildren:e})||(o=!1))}),o}return!1}function Fy(t){return t instanceof V}function wX(t){if(t===null||typeof t!="object")return!1;let e=t;return!(typeof e.apply!="function"||typeof e.getMap!="function"||typeof e.invert!="function"||typeof e.map!="function"||typeof e.merge!="function"||typeof e.toJSON!="function")}function SX(t){if(t===null||typeof t!="object")return!1;let e=t;if(!wX(e))return!1;let n=e.toJSON();return!(n===null||typeof n!="object"||n.stepType!=="replace")}var $y=class xU{constructor(e){this.position=e}static fromJSON(e){return new xU(e.position)}toJSON(){return{position:this.position}}};function sE(t,e){let n=e.mapping.mapResult(t.position);return{position:new $y(n.pos),mapResult:n}}function xX(t){return new $y(t)}function CX(t,e,n){let{selection:r}=e,o=null;if(rU(r)&&(o=r.$cursor),o){var i;let l=(i=t.storedMarks)!==null&&i!==void 0?i:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(a=>a.type.excludes(n)))}let{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let c=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,a.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){let h=!f||f.type.allowsMarkType(n),p=!!n.isInSet(u.marks)||!u.marks.some(m=>m.type.excludes(n));c=h&&p}return!c}),c})}var EX=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=n,{empty:s,ranges:l}=i,a=$i(t,r.schema);if(o)if(s){let c=dU(r,a);n.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{let u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,h)=>{let p=Math.max(h,u),m=Math.min(h+f.nodeSize,d);f.marks.find(y=>y.type===a)?f.marks.forEach(y=>{a===y.type&&n.addMark(p,m,a.create({...y.attrs,...e}))}):n.addMark(p,m,a.create(e))})});return CX(r,n,a)},TX=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),AX=(t,e={})=>({state:n,dispatch:r,chain:o})=>{let i=Mt(t,n.schema),s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:l})=>cC(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>cC(i,{...s,...e})(l,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},kX=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,o=Ta(t,0,r.content.size),i=V.create(r,o);e.setSelection(i)}return!0},MX=(t,e)=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=r,s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),o&&n.doc.nodesBetween(s,l,(a,c)=>{a.isText||n.setNodeMarkup(c,void 0,{...a.attrs,dir:t})}),!0},RX=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=L.atStart(r).from,l=L.atEnd(r).to,a=Ta(o,s,l),c=Ta(i,s,l),u=L.create(r,a,c);e.setSelection(u)}return!0},OX=t=>({state:e,dispatch:n})=>{let r=Mt(t,e.schema);return yL(r)(e,n)};function Kz(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var DX=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{let{selection:i,doc:s}=e,{$from:l,$to:a}=i,c=o.extensionManager.attributes,u=Uy(c,l.node().type.name,l.node().attrs);if(i instanceof V&&i.node.isBlock)return!l.parentOffset||!Jr(s,l.pos)?!1:(r&&(t&&Kz(n,o.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let d=a.parentOffset===a.parent.content.size,f=l.depth===0?void 0:aU(l.node(-1).contentMatchAt(l.indexAfter(-1))),h=d&&f?[{type:f,attrs:u}]:void 0,p=i instanceof L&&!i.empty?ha.create({doc:e.doc,selection:i}).tr.deleteSelection():null,m=p?p.doc:e.doc,y=p?p.mapping.map(l.pos):l.pos,g=Jr(m,y,1,h);if(!h&&!g&&Jr(m,y,1,f?[{type:f}]:void 0)&&(g=!0,h=f?[{type:f,attrs:u}]:void 0),r){if(g){let v=e.steps.length;if(i instanceof L&&e.deleteSelection(),e.split(e.mapping.slice(v).map(l.pos),1,h),f&&!d&&!l.parentOffset&&l.parent.type!==f){let b=e.mapping.slice(v).map(l.before()),w=e.doc.resolve(b);l.node(-1).canReplaceWith(w.index(),w.index()+1,f)&&e.setNodeMarkup(e.mapping.slice(v).map(l.before()),f)}}t&&Kz(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return g},NX=(t,e={})=>({tr:n,state:r,dispatch:o,editor:i})=>{let s=Mt(t,r.schema),{$from:l,$to:a}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(a))return!1;let u=l.node(-1);if(u.type!==s)return!1;let d=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){var f;let w=M.empty,S=l.index(-1)?1:l.index(-2)?2:3;for(let _=l.depth-S;_>=l.depth-3;_-=1)w=M.from(l.node(_).copy(w));let C=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,x={...Uy(d,l.node().type.name,l.node().attrs),...e},E=((f=s.contentMatch.defaultType)===null||f===void 0?void 0:f.createAndFill(x))||void 0;w=w.append(M.from(s.createAndFill(null,E)||void 0));let A=l.before(l.depth-(S-1));n.replace(A,l.after(-C),new N(w,4-S,0));let T=-1;n.doc.nodesBetween(A,n.doc.content.size,(_,z)=>{if(T>-1)return!1;_.isTextblock&&_.content.size===0&&(T=z+1)}),T>-1&&n.setSelection(L.near(n.doc.resolve(T))),n.scrollIntoView()}return!0}let h=a.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...Uy(d,u.type.name,u.attrs),...e},m={...Uy(d,l.node().type.name,l.node().attrs),...e},y=l.parentOffset===0&&l.index(-1)===0,g=l.before(-1);n.delete(l.pos,a.pos);let v=y?u.attrs:p,b=h?[{type:s,attrs:v},{type:h,attrs:m}]:[{type:s,attrs:v}];if(!Jr(n.doc,l.pos,2))return!1;if(o){let{selection:w,storedMarks:S}=r,{splittableMarks:C}=i.extensionManager,x=S||w.$to.parentOffset&&w.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),y&&n.setNodeMarkup(g,void 0,p),!x||!o)return!0;let E=x.filter(A=>C.includes(A.type.name));n.ensureMarks(E)}return!0};function CU(t,e,n){if(!t.validContent(e))return null;try{return t.create(n,e)}catch{return null}}function lE(t,e){if(t.pendingContent.length===0)return!0;let n=CU(e,M.from(t.pendingContent));return n?(t.items.push(n),t.pendingContent=[],!0):!1}function _X(t,e,n){return n.validContent(M.from([...e.pendingContent,t]))?(e.pendingContent.push(t),!0):!lE(e,n)||!n.validContent(M.from(t))?!1:(e.pendingContent.push(t),!0)}function IX(t,e,n,r){let o=r(t,n);if(!o)return!1;let i=CU(n.listType,M.from(o),t.attrs);return i?n.itemType.validContent(M.from([...e.pendingContent,i]))?(e.pendingContent.push(i),!0):lE(e,n.itemType)?(e.items.push(...o),!0):!1:!1}function LX(t,e,n){let r={items:[],pendingContent:[]};for(let o=0;o<t.childCount;o+=1){let i=t.child(o);if(!(e.isListNode(i)?IX(i,r,e,n):_X(i,r,e.itemType)))return null}return lE(r,e.itemType)?r.items:null}function EU(t,e){let n=[];for(let r=0;r<t.childCount;r+=1){let o=LX(t.child(r),e,EU);if(!o)return null;n.push(...o)}return n}function Gz(t,e){let n=null;return t.descendants((r,o)=>r!==e?!0:(n=o,!1)),n}function Xz(t){return!t||t==="1"?null:t}function TU(t,e){return Xz(t)===Xz(e)}var _y=(t,e)=>{let n=jy(i=>i.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let o=t.doc.nodeAt(r);return!(n.node.type===o?.type&&yo(t.doc,n.pos))||!TU(n.node.attrs.type,o?.attrs.type)||t.join(n.pos),!0},Iy=(t,e)=>{let n=jy(i=>i.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let o=t.doc.nodeAt(r);return!(n.node.type===o?.type&&yo(t.doc,r))||!TU(n.node.attrs.type,o?.attrs.type)||t.join(r),!0};function zX(t){let e=t.doc,n=e.firstChild;if(!n)return null;let r=e.resolve(1),o=e.resolve(n.nodeSize-1);return L.between(r,o)}var UX=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:l,chain:a,commands:c,can:u})=>{let{extensions:d,splittableMarks:f}=o.extensionManager,h=Mt(t,s.schema),p=Mt(e,s.schema),{selection:m,storedMarks:y}=s,{$from:g,$to:v}=m,b=g.blockRange(v),w=y||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;let S=jy(I=>uh(I.type.name,d))(m),C=m.from===0&&m.to===s.doc.content.size,x=s.doc.content.content,E=x.length===1?x[0]:null,A=C&&E&&uh(E.type.name,d)?{node:E,pos:0,depth:0}:null,T=S??A,_=!!S&&b.depth>=1&&b.depth-S.depth<=1,z=!!A;if((_||z)&&T){if(T.node.type===h)return C&&z?a().command(({tr:I,dispatch:j})=>{let D=zX(I);return D?(I.setSelection(D),j&&j(I),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(uh(T.node.type.name,d)&&h.validContent(T.node.content))return a().command(()=>(i.setNodeMarkup(T.pos,h),!0)).command(()=>_y(i,h)).command(()=>Iy(i,h)).run();if(uh(T.node.type.name,d)){var $;let I=($=T.node.firstChild)===null||$===void 0?void 0:$.type;if(I&&I!==p){let j=EU(T.node,{listType:h,itemType:p,isListNode:K=>uh(K.type.name,d)}),D=j?M.from(j):null;return!D||!h.validContent(D)?!1:a().command(()=>{let{$anchor:K,$head:U}=i.selection,re=K.parent,Y=U.parent,ke=K.parentOffset,gt=U.parentOffset,Dt;try{Dt=h.create(r,D)}catch{return!1}if(i.replaceWith(T.pos,T.pos+T.node.nodeSize,Dt),re.inlineContent&&Y.inlineContent){let Co=Gz(Dt,re),wn=Gz(Dt,Y);if(Co!==null&&wn!==null){let W=T.pos+Co+2+ke,Eo=T.pos+wn+2+gt;i.setSelection(L.create(i.doc,W,Eo))}}return!0}).command(()=>_y(i,h)).command(()=>Iy(i,h)).run()}}}return!n||!w||!l?a().command(()=>u().wrapInList(h,r)?!0:c.clearNodes()).wrapInList(h,r).command(()=>_y(i,h)).command(()=>Iy(i,h)).run():a().command(()=>{let I=u().wrapInList(h,r),j=w.filter(D=>f.includes(D.type.name));return i.ensureMarks(j),I?!0:c.clearNodes()}).wrapInList(h,r).command(()=>_y(i,h)).command(()=>Iy(i,h)).run()},BX=(t,e={},n={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=n,s=$i(t,r.schema);return QC(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},PX=(t,e,n={})=>({state:r,commands:o})=>{let i=Mt(t,r.schema),s=Mt(e,r.schema),l=Qo(r,i,n),a;return r.selection.$anchor.sameParent(r.selection.$head)&&(a=r.selection.$anchor.parent.attrs),l?o.setNode(s,a):o.setNode(i,{...a,...n})},HX=(t,e={})=>({state:n,commands:r})=>{let o=Mt(t,n.schema);return Qo(n,o,e)?r.lift(o):r.wrapIn(o,e)},VX=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r<n.length;r+=1){let o=n[r],i;if(o.spec.isInputRules&&(i=o.getState(t))){if(e){let s=t.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){let a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},jX=(t={})=>({tr:e,dispatch:n,editor:r})=>{let{ignoreClearable:o=!1}=t,{selection:i}=e,{empty:s,ranges:l}=i;if(s)return!0;let{nonClearableMarks:a}=r.extensionManager;if(n){let c=Object.values(r.schema.marks).filter(u=>o||!a.includes(u.name));l.forEach(u=>{for(let d of c)e.removeMark(u.$from.pos,u.$to.pos,d)})}return!0},FX=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let{extendEmptyMarkRange:i=!1}=e,{selection:s}=n,l=$i(t,r.schema),{$from:a,empty:c,ranges:u}=s;if(!o)return!0;if(c&&i){var d;let{from:f,to:h}=s,p=eE(a,l,(d=a.marks().find(m=>m.type===l))===null||d===void 0?void 0:d.attrs);p&&(f=p.from,h=p.to),n.removeMark(f,h,l)}else u.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},$X=t=>({tr:e,state:n,dispatch:r})=>{let{selection:o}=n,i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=o.from,s=o.to),r&&e.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;let c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},YX=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,l=Vy(typeof t=="string"?t:t.name,r.schema);if(!l)return!1;l==="node"&&(i=Mt(t,r.schema)),l==="mark"&&(s=$i(t,r.schema));let a=!1;return n.selection.ranges.forEach(c=>{let u=c.$from.pos,d=c.$to.pos,f,h,p,m;n.selection.empty?r.doc.nodesBetween(u,d,(y,g)=>{i&&i===y.type&&(a=!0,p=Math.max(g,u),m=Math.min(g+y.nodeSize,d),f=g,h=y)}):r.doc.nodesBetween(u,d,(y,g)=>{g<u&&i&&i===y.type&&(a=!0,p=Math.max(g,u),m=Math.min(g+y.nodeSize,d),f=g,h=y),g>=u&&g<=d&&(i&&i===y.type&&(a=!0,o&&n.setNodeMarkup(g,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,o)){let b=Math.max(g,u),w=Math.min(g+y.nodeSize,d);n.addMark(b,w,s.create({...v.attrs,...e}))}}))}),h&&(f!==void 0&&o&&n.setNodeMarkup(f,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&o&&n.addMark(p,m,s.create({...y.attrs,...e}))}))}),a},Au=new ae("__tiptap_decorations__"),qX=t=>({tr:e,dispatch:n})=>(n&&e.setMeta(Au,{type:"force",name:t}),!0),KX=(t,e={})=>({state:n,dispatch:r})=>{let o=Mt(t,n.schema);return pL(o,e)(n,r)},GX=(t,e={})=>({state:n,dispatch:r})=>{let o=Mt(t,n.schema);return mL(o,e)(n,r)},XX=iI({blur:()=>mG,clearContent:()=>gG,clearNodes:()=>yG,command:()=>vG,createParagraphNear:()=>bG,cut:()=>wG,deleteCurrentNode:()=>SG,deleteNode:()=>xG,deleteRange:()=>CG,deleteSelection:()=>AG,enter:()=>kG,exitCode:()=>MG,extendMarkRange:()=>RG,first:()=>OG,focus:()=>NG,forEach:()=>_G,insertContent:()=>IG,insertContentAt:()=>LG,insertDefaultBlock:()=>zG,joinBackward:()=>PG,joinDown:()=>BG,joinForward:()=>HG,joinItemBackward:()=>VG,joinItemForward:()=>jG,joinTextblockBackward:()=>FG,joinTextblockForward:()=>$G,joinUp:()=>UG,keyboardShortcut:()=>qG,lift:()=>KG,liftEmptyBlock:()=>GG,liftListItem:()=>XG,newlineInCode:()=>WG,resetAttributes:()=>JG,scrollIntoView:()=>QG,selectAll:()=>ZG,selectNodeBackward:()=>eX,selectNodeForward:()=>tX,selectParentNode:()=>nX,selectTextblockEnd:()=>rX,selectTextblockStart:()=>oX,setContent:()=>iX,setMark:()=>EX,setMeta:()=>TX,setNode:()=>AX,setNodeSelection:()=>kX,setTextDirection:()=>MX,setTextSelection:()=>RX,sinkListItem:()=>OX,splitBlock:()=>DX,splitListItem:()=>NX,toggleList:()=>UX,toggleMark:()=>BX,toggleNode:()=>PX,toggleWrap:()=>HX,undoInputRule:()=>VX,unsetAllMarks:()=>jX,unsetMark:()=>FX,unsetTextDirection:()=>$X,updateAttributes:()=>YX,updateDecorations:()=>qX,wrapIn:()=>KX,wrapInList:()=>GX}),ku=new WeakMap;function WX(t,e){var n;ku.set(t,((n=ku.get(t))!==null&&n!==void 0?n:0)+1);try{return e()}finally{var r;let o=((r=ku.get(t))!==null&&r!==void 0?r:1)-1;o>0?ku.set(t,o):ku.delete(t)}}function JX(t){return ku.has(t)}var QX=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){let n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){let n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){let n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},AU=typeof process<"u"&&!1;function ZX(t){return t.kind==="widget"}function kU(t,e){let n=[],r=new Set;for(let o of t)o.kind==="widget"&&ZX(o)&&r.add(o.key),n.push(o.toPMDecoration(e));return{decorations:n,widgetKeys:r}}function eW(t,e,n){let{decorations:r,widgetKeys:o}=kU(e,n);return{set:ce.create(t,r),widgetKeys:o}}function MU({position:t,from:e,to:n,docSize:r}){return t<e?!1:t<n?!0:t===n&&n===r}function tW({decorations:t,from:e,to:n,docSize:r,extensionName:o,warnedExtensions:i}){return t.filter(s=>MU({position:s.anchor,from:e,to:n,docSize:r})?!0:(s.anchor===n||i.has(o)||(i.add(o),console.warn(`[tiptap warn]: Extension "${o}" returned a decoration outside the requested range [${e}, ${n}). It was ignored.`)),!1))}function RU(t){var e;let n=(e=t.spec)===null||e===void 0?void 0:e.key;return typeof n=="string"?n:void 0}function nW(t){let e=new Map,n=new Map;for(let s of t.find()){var r,o,i;let l=RU(s);if(!l)continue;let a=(r=s.spec.extensionName)!==null&&r!==void 0?r:"unknown",c=(o=e.get(l))!==null&&o!==void 0?o:new Set;c.add(a),e.set(l,c),n.set(l,((i=n.get(l))!==null&&i!==void 0?i:0)+1)}return Array.from(e,([s,l])=>({key:s,extensions:l})).filter(({key:s})=>{var l;return((l=n.get(s))!==null&&l!==void 0?l:0)>1})}function OU(t){return t.jsonID==="attr"}function rW(t){let e=!1;if(t.getMap().forEach(()=>{e=!0}),e||OU(t))return!0;let n=t;return typeof n.from=="number"&&typeof n.to=="number"}function oW(t,e){let n=null,r=0,o=0;for(let i=0;i<t.childCount&&!(o>e.to);i+=1){let s=o+t.child(i).nodeSize;s>=e.from&&(n===null&&(n=o),r=s),o=s}return n===null?null:{from:n,to:r}}function iW(t,e){if(t.steps.some(i=>!rW(i)))return{type:"full"};let n=Nu(t).map(({newRange:i})=>i);t.steps.forEach((i,s)=>{if(!OU(i))return;let l=t.mapping.slice(s);n.push({from:l.map(i.pos,-1),to:l.map(i.pos+1)})});let r=[];for(let i of n){let s=oW(e,i);s&&r.push(s)}r.sort((i,s)=>i.from-s.from);let o=[];for(let i of r){let s=o[o.length-1];s&&i.from<=s.to?s.to=Math.max(s.to,i.to):o.push({...i})}return{type:"ranges",ranges:o}}function DU(t,e,n,r){return t.map(e,n,{onRemove:o=>{let i=o?.key;typeof i=="string"&&r.delete(i)}})}function sW(t,e,n){var r,o;let i=(r=e.decorationSetsByExtension[t])!==null&&r!==void 0?r:ce.empty,s=new Set((o=e.widgetKeysByExtension[t])!==null&&o!==void 0?o:[]);return{set:DU(i,n.mapping,n.doc,s),widgetKeys:s}}function Wz(t,e){let n=Object.values(e).flatMap(r=>r.find());return ce.create(t,n)}function Jz(t){let e=new Set;for(let n of Object.values(t))for(let r of n)e.add(r);return e}function lW(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 aW(t,e,n){return n?!0:t.update==="manual"?!1:t.shouldUpdate?t.shouldUpdate(e):e.tr.docChanged}var cW=new Set;var uW=class{constructor(t){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let n=Au.getState(e);n&&this.warnDuplicateWidgetKeys(n)},this.editor=t.editor,this.entries=this.resolveEntries(t.entries),this.entries.forEach(({name:e,spec:n})=>lW(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=Au.getState(this.editor.state))===null||e===void 0?void 0:e.widgetKeys)!==null&&t!==void 0?t:cW}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(t){let e=[];for(let{name:n,addDecorations:r}of t){let o=r();o&&e.push({name:n,spec:o})}return e}createPlugin(){let{editor:t,entries:e}=this;return new G({key:Au,state:{init:(n,r)=>{let o={},i={};for(let{name:l,spec:a}of e){let{set:c,widgetKeys:u}=this.buildFullSet(l,a,r);o[l]=c,i[l]=u}let s={decorationSetsByExtension:o,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(r.doc,o),widgetKeys:Jz(i)};return this.warnDuplicateWidgetKeys(s),s},apply:(n,r,o,i)=>{let s=n.getMeta(Au),l=s?.type==="force"&&!s.name,a=s?.type==="force"?s.name:void 0,c={},u={},d=new Set;return WX(t,()=>{for(let{name:f,spec:h}of e){let p=l||a===f;if(aW(h,{editor:t,tr:n,oldState:o,newState:i},p))if(h.update==="changedRanges"&&n.docChanged&&!p){let m=this.applyChangedRangesRecompute(f,h,r,n,i);c[f]=m.set,u[f]=m.widgetKeys,d.add(f)}else{let{set:m,widgetKeys:y}=this.buildFullSet(f,h,i);c[f]=m,u[f]=y,d.add(f)}else{let m=sW(f,r,n);c[f]=m.set,u[f]=m.widgetKeys}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:c,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:e,previous:r,tr:n,decorationSetsByExtension:c,recomputedNames:d}),widgetKeys:Jz(u)}}},props:{decorations(n){var r,o;return(r=(o=Au.getState(n))===null||o===void 0?void 0:o.mergedDecorationSet)!==null&&r!==void 0?r:ce.empty}}})}applyChangedRangesRecompute(t,e,n,r,o){let i=iW(r,o.doc);return i.type==="full"?this.buildFullSet(t,e,o):this.rebuildRanges(t,e,n,r,o,i.ranges)}rebuildRanges(t,e,n,r,o,i){var s,l;let a=(s=n.decorationSetsByExtension[t])!==null&&s!==void 0?s:ce.empty,c=new Set((l=n.widgetKeysByExtension[t])!==null&&l!==void 0?l:[]),u=DU(a,r.mapping,r.doc,c),d=o.doc.content.size;for(let{from:f,to:h}of i){let p=u.find(f,h).filter(g=>MU({position:g.from,from:f,to:h,docSize:d}));for(let g of p){let v=RU(g);v&&c.delete(v)}u=u.remove(p);let{decorations:m,widgetKeys:y}=kU(tW({decorations:this.runCreate(t,"createInRange",()=>e.createInRange({editor:this.editor,state:o,view:this.mountedView,from:f,to:h})),from:f,to:h,docSize:d,extensionName:t,warnedExtensions:this.warnedOutOfRangeExtensions}),t);u=u.add(o.doc,m);for(let g of y)c.add(g)}return{set:u,widgetKeys:c}}buildFullSet(t,e,n){let r=this.runCreate(t,"create",()=>e.create({editor:this.editor,state:n,view:this.mountedView}));return eW(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){if(!AU)return;if(t.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let e=nW(t.mergedDecorationSet),n=new Set(e.map(({key:r})=>r));for(let{key:r,extensions:o}of e){if(this.warnedWidgetKeys.has(r))continue;let i=Array.from(o).map(s=>`"${s}"`).join(", ");console.warn(`[tiptap warn]: Duplicate widget decoration key "${r}" in extension${o.size===1?"":"s"} ${i}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(t,e){let n=Object.keys(e);return n.length===1?e[n[0]]:Wz(t,e)}mergeAfterApply({entries:t,previous:e,tr:n,decorationSetsByExtension:r,recomputedNames:o}){return t.length===1?r[t[0].name]:o.size===0?e.mergedDecorationSet.map(n.mapping,n.doc):Wz(n.doc,r)}};function NU(t,e){let{selection:n}=t,{$from:r}=n;if(n instanceof V){let i=r.index();return r.parent.canReplaceWith(i,i+1,e)}let o=r.depth;for(;o>=0;){let i=r.index(o);if(r.node(o).contentMatchAt(i).matchType(e))return!0;o-=1}return!1}function dW(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}function fW(t){return typeof t=="number"}function hW(t){return Object.prototype.toString.call(t).slice(8,-1)}function Ly(t){return hW(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function _U(t){return typeof t=="string"&&t.trim().length>0&&!/[;{}]/.test(t)}function pW(t,e){return t.replace(/^[ \t]*/,n=>{let o=0;for(let i of n)o+=i===" "?4-o%4:1;return" ".repeat(Math.max(0,o-e))})}function mW(t,e){let n=`text
|
|
61
|
+
${t}
|
|
62
|
+
`,r=e(n)[0];return(r?.type==="paragraph"||r?.type==="text")&&r.raw===n}function gW(t,e,n){var r;let o=e.split(`
|
|
63
|
+
`),i=(r=n.isParagraphContinuation)!==null&&r!==void 0?r:(l=>mW(l,n.blockTokens)),s=0;for(let l of o){if(!l.trim()||!i(l))break;s+=1}return{mainContent:[t,...o.slice(0,s).map(l=>l.trimStart())].join(`
|
|
64
|
+
`),nestedContent:o.slice(s).join(`
|
|
65
|
+
`)}}function aE(t,e,n){let r=t.split(`
|
|
66
|
+
`),o=[],i="",s=0,l=e.baseIndentSize||2;for(;s<r.length;){let u=r[s],d=u.match(e.itemPattern);if(!d){if(o.length>0)break;if(u.trim()===""){s+=1,i=`${i}${u}
|
|
67
|
+
`;continue}else return}let f=e.extractItemData(d),{indentLevel:h,mainContent:p}=f;i=`${i}${u}
|
|
68
|
+
`;let m=[p];for(s+=1;s<r.length;){var a;let b=r[s];if(b.trim()===""){var c;let w=r.slice(s+1).findIndex(S=>S.trim()!=="");if(w===-1)break;if((((c=r[s+1+w].match(/^(\s*)/))===null||c===void 0||(c=c[1])===null||c===void 0?void 0:c.length)||0)>h){m.push(b),i=`${i}${b}
|
|
69
|
+
`,s+=1;continue}else break}if((((a=b.match(/^(\s*)/))===null||a===void 0||(a=a[1])===null||a===void 0?void 0:a.length)||0)>h)m.push(b),i=`${i}${b}
|
|
70
|
+
`,s+=1;else break}let y,g=m.slice(1);if(g.length>0){let b=gW(p,g.map(S=>pW(S,h+l)).join(`
|
|
71
|
+
`),n);f.mainContent=b.mainContent;let w=b.nestedContent;w.trim()&&(e.customNestedParser?y=e.customNestedParser(w):y=n.blockTokens(w))}let v=e.createToken(f,y);o.push(v)}if(o.length!==0)return{items:o,raw:i.slice(0,t.length)}}var Qz=4;function Zz(t){let e=0;for(let n of t)e=n===" "?e+Qz-e%Qz:e+1;return e}function cE(t,e,n,r,o){if(!t||!Array.isArray(t.content))return"";let i=typeof n=="function"?n(r):n,[s,...l]=t.content,a=e.renderChildren([s]),c=`${i}${o?.indentMainContent?a.split(`
|
|
72
|
+
`).map((u,d)=>d===0?u:e.indent(u)).join(`
|
|
73
|
+
`):a}`;return l&&l.length>0&&l.forEach((u,d)=>{var f,h;let p=(f=(h=e.renderChild)===null||h===void 0?void 0:h.call(e,u,d+1))!==null&&f!==void 0?f:e.renderChildren([u]);if(p!=null){let m=g=>{if(!o?.alignNestedToPrefix)return e.indent(g);let v=e.indent(""),b=Zz(i);return(Zz(v)>=b?v:" ".repeat(b))+g},y=p.split(`
|
|
74
|
+
`).map(g=>m(g||"")).join(`
|
|
75
|
+
`);c+=u.type==="paragraph"?`
|
|
76
|
+
|
|
77
|
+
${y}`:`
|
|
78
|
+
${y}`}}),c}function IU(t,e){let n={...t};return Ly(t)&&Ly(e)&&Object.keys(e).forEach(r=>{Ly(e[r])&&Ly(t[r])?n[r]=IU(t[r],e[r]):n[r]=e[r]}),n}function yW(t,e,n={}){let{state:r}=e,{doc:o,tr:i}=r,s=t;o.descendants((l,a)=>{let c=i.mapping.map(a),u=i.mapping.map(a)+l.nodeSize,d=null;if(l.marks.forEach(h=>{if(h!==s)return!1;d=h}),!d)return;let f=!1;if(Object.keys(n).forEach(h=>{n[h]!==d.attrs[h]&&(f=!0)}),f){let h=t.type.create({...t.attrs,...n});i.removeMark(c,u,t.type),i.addMark(c,u,h)}}),i.docChanged&&e.view.dispatch(i)}var Iu=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!==null&&e!==void 0?e:!0}},vW=(t,e)=>{if(ZC(e))return e.exec(t);let n=e(t);if(!n)return null;let 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 bW(t){let{editor:e,from:n,to:r,text:o,insertText:i}=t;if(!i)return{inputTransaction:null,tr:e.view.state.tr};let s=e.view.state.tr.insertText(o,n,r);return{inputTransaction:s,tr:ha.create({doc:s.doc,selection:s.selection,storedMarks:s.storedMarks}).tr}}function wW(t){let{editor:e,from:n,to:r,text:o,rule:i,match:s,plugin:l,insertText:a}=t,{view:c}=e,{inputTransaction:u,tr:d}=bW({editor:e,from:n,to:r,text:o,insertText:a}),f=u?n+o.length:r,h=Hy({state:c.state,transaction:d}),p={from:n-(s[0].length-o.length),to:f},{commands:m,chain:y,can:g}=new Mu({editor:e,state:h});return i.handler({state:h,range:p,match:s,commands:m,chain:y,can:g})===null||!d.steps.length?!1:(u&&(c.dispatch(u),!c.state.doc.eq(u.doc))||(Dz(d),d.setMeta("inputRule",!0),i.undoable&&d.setMeta(l,{transform:d,from:n,to:f,text:o}),c.dispatch(d)),!0)}function SW(t,e,n){let r=e[0].length-n.length;if(r<=0)return!0;let o=t.parentOffset-r;return o>=0&&t.parent.textBetween(o,t.parentOffset)===e[0].slice(0,r)}function zy(t){var e;let{editor:n,from:r,to:o,text:i,rules:s,plugin:l,insertText:a}=t,{view:c}=n;if(c.composing)return!1;let u=c.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 d=vX(u)+i;for(let f of s){let h=vW(d,f.find);if(!(!h||!SW(u,h,i))&&wW({editor:n,from:r,to:o,text:i,rule:f,match:h,plugin:l,insertText:a}))return!0}return!1}function xW(t){let{editor:e,rules:n}=t,r=new G({state:{init(){return null},apply(o,i,s){let l=o.getMeta(r);if(l)return l;let a=o.getMeta("applyInputRules");return a&&setTimeout(()=>{let{text:c}=a;typeof c=="string"?c=c:c=rE(M.from(c),s.schema);let{from:u}=a,d=u+c.length;zy({editor:e,from:u,to:d,text:c,rules:n,plugin:r})}),o.selectionSet||o.docChanged?null:i}},props:{handleTextInput(o,i,s,l){return zy({editor:e,from:i,to:s,text:l,rules:n,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{let{$cursor:i}=o.state.selection;i&&zy({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;let{$cursor:s}=o.state.selection;return s?zy({editor:e,from:s.pos,to:s.pos,text:`
|
|
79
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var uE=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{...be(B(this,"addOptions",{name:this.name}))}}get storage(){return{...be(B(this,"addStorage",{name:this.name,options:this.options}))}}configure(t={}){let e=this.extend({...this.config,addOptions:()=>IU(this.options,t)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(t={}){let 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}},Rr=class LU extends uE{constructor(...e){super(...e),this.type="mark"}static create(e={}){let n=typeof e=="function"?e():e;return new LU(n)}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){let i=o.marks();if(!i.find(l=>l?.type.name===n.name))return!1;let s=i.find(l=>l?.type.name===n.name);return s&&r.removeStoredMark(s),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},dE=class{constructor(t){this.find=t.find,this.handler=t.handler}},CW=(t,e,n)=>{if(ZC(e))return[...t.matchAll(e)];let r=e(t,n);return r?r.map(o=>{let i=[o.text];return i.index=o.index,i.input=t,i.data=o.data,o.replaceWith&&(o.text.includes(o.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(o.replaceWith)),i}):[]};function EW(t){let{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:a,chain:c,can:u}=new Mu({editor:e,state:n}),d=[];return n.doc.nodesBetween(r,o,(f,h)=>{var p,m,y,g;if(!((p=f.type)===null||p===void 0||(p=p.spec)===null||p===void 0)&&p.code||!(f.isText||f.isTextblock||f.isInline))return;let v=(m=(y=(g=f.content)===null||g===void 0?void 0:g.size)!==null&&y!==void 0?y:f.nodeSize)!==null&&m!==void 0?m:0,b=Math.max(r,h),w=Math.min(o,h+v);if(b>=w)return;let S=f.isText?f.text||"":f.textBetween(b-h,w-h,void 0,"\uFFFC");CW(S,i.find,s).forEach(C=>{if(C.index===void 0)return;let x=b+C.index+1,E=x+C[0].length,A={from:n.tr.mapping.map(x),to:n.tr.mapping.map(E)},T=i.handler({state:n,range:A,match:C,commands:a,chain:c,can:u,pasteEvent:s,dropEvent:l});d.push(T)})}),d.every(f=>f!==null)}var Tu=null,TW=t=>{var e;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)===null||e===void 0||e.setData("text/html",t),n};function AW(t){let{editor:e,rules:n}=t,r=null,o=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}let a=({state:c,from:u,to:d,rule:f,pasteEvt:h})=>{let p=c.tr,m=Hy({state:c,transaction:p});if(!(!EW({editor:e,state:m,from:Math.max(u-1,0),to:d.b-1,rule:f,pasteEvent:h,dropEvent:l})||!p.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,p}};return e.on("destroy",()=>{Tu===e&&(Tu=null)}),n.map(c=>new G({view(u){let d=h=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(h.target)?u.dom.parentElement:null,r&&(Tu=e)},f=()=>{Tu&&(Tu=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",f),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",f)}}},props:{handleDOMEvents:{drop:(u,d)=>{if(i=r===u.dom.parentElement,l=d,!i){let f=Tu;f?.isEditable&&setTimeout(()=>{if(f.isDestroyed)return;let h=f.state.selection;h&&f.commands.deleteRange({from:h.from,to:h.to})},10)}return!1},paste:(u,d)=>{var f;let h=(f=d.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return s=d,o=!!h?.includes("data-pm-slice"),!1}}},appendTransaction:(u,d,f)=>{let h=u[0],p=h.getMeta("uiEvent")==="paste"&&!o,m=h.getMeta("uiEvent")==="drop"&&!i,y=h.getMeta("applyPasteRules"),g=!!y;if(!p&&!m&&!g)return;if(g){let{text:w}=y;typeof w=="string"?w=w:w=rE(M.from(w),f.schema);let{from:S}=y,C=S+w.length,x=TW(w);return a({rule:c,state:f,from:S,to:{b:C},pasteEvt:x})}let v=d.doc.content.findDiffStart(f.doc.content),b=d.doc.content.findDiffEnd(f.doc.content);if(!(!fW(v)||!b||v===b.b))return a({rule:c,state:f,from:v,to:b,pasteEvt:s})}}))}var Yy=class{constructor(t,e){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=e,this.baseExtensions=t,this.extensions=mU(t),this.hasSchemaSpec=e.options.schemaSpec!==void 0,this.schema=hX(this.extensions,e,e.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{let n=B(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Eu(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){let{editor:t}=this,e=fh([...this.extensions].reverse()).flatMap(r=>{let o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:Eu(r.name,this.schema)},i=[],s=B(r,"addKeyboardShortcuts",o),l={};if(r.type==="mark"&&B(r,"exitable",o)&&(l.ArrowRight=()=>Rr.handleExit({editor:t,mark:r})),s){let f=Object.fromEntries(Object.entries(s()).map(([h,p])=>[h,()=>p({editor:t})]));l={...l,...f}}let a=kz(l);i.push(a);let c=B(r,"addInputRules",o);if(qz(r,t.options.enableInputRules)&&c){let f=c();if(f&&f.length){let h=xW({editor:t,rules:f}),p=Array.isArray(h)?h:[h];i.push(...p)}}let u=B(r,"addPasteRules",o);if(qz(r,t.options.enablePasteRules)&&u){let f=u();if(f&&f.length){let h=AW({editor:t,rules:f});i.push(...h)}}let d=B(r,"addProseMirrorPlugins",o);if(d){let f=d();i.push(...f)}return i}),n=this.createDecorationPlugin();return n&&e.push(n),e}createDecorationPlugin(){var t;let{editor:e}=this;(t=this.decorationManager)===null||t===void 0||t.destroy();let n=[];return this.extensions.forEach(r=>{let o=B(r,"addDecorations",{name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Eu(r.name,this.schema)});o&&n.push({name:r.name,addDecorations:o})}),this.decorationManager=new uW({editor:e,entries:n}),this.decorationManager.plugin}get attributes(){let t=oE(this.extensions);return this.hasSchemaSpec?hU(t,this.schema):t}get nodeViews(){let{editor:t}=this,{nodeExtensions:e}=Ou(this.extensions);return Object.fromEntries(e.filter(n=>!!B(n,"addNodeView")).map(n=>{let r=this.attributes.filter(l=>l.type===n.name),o=B(n,"addNodeView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Mt(n.name,this.schema)});if(!o)return[];let i=o();if(!i)return[];let s=(l,a,c,u,d)=>{let f=al(l,r);return i({node:l,view:a,getPos:c,decorations:u,innerDecorations:d,editor:t,extension:n,HTMLAttributes:f})};return[n.name,s]}))}dispatchTransaction(t){let{editor:e}=this;return fh([...this.extensions].reverse()).reduceRight((n,r)=>{let o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Eu(r.name,this.schema)},i=B(r,"dispatchTransaction",o);return i?s=>{i.call(o,{transaction:s,next:n})}:n},t)}transformPastedHTML(t){let{editor:e}=this;return fh([...this.extensions]).reduce((n,r)=>{let o={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Eu(r.name,this.schema)},i=B(r,"transformPastedHTML",o);return i?(s,l)=>{let a=n(s,l);return i.call(o,a)}:n},t||(n=>n))}get markViews(){let{editor:t}=this,{markExtensions:e}=Ou(this.extensions);return Object.fromEntries(e.filter(n=>!!B(n,"addMarkView")).map(n=>{let r=this.attributes.filter(s=>s.type===n.name),o=B(n,"addMarkView",{name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:$i(n.name,this.schema)});if(!o)return[];let i=(s,l,a)=>{let c=al(s,r);return o()({mark:s,view:l,inline:a,editor:t,extension:n,HTMLAttributes:c,updateAttributes:u=>{yW(s,t,u)}})};return[n.name,i]}))}destroy(){var t;(t=this.decorationManager)===null||t===void 0||t.destroy(),this.extensions.forEach(e=>{let n=e;for(;n.parent;){let 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(){let t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{let n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Eu(e.name,this.schema)};if(e.type==="mark"){var r,o;(!((r=be(B(e,"keepOnSplit",n)))!==null&&r!==void 0)||r)&&this.splittableMarks.push(e.name),!((o=be(B(e,"clearable",n)))!==null&&o!==void 0)||o||this.nonClearableMarks.push(e.name)}let i=B(e,"onBeforeCreate",n),s=B(e,"onCreate",n),l=B(e,"onUpdate",n),a=B(e,"onSelectionUpdate",n),c=B(e,"onTransaction",n),u=B(e,"onFocus",n),d=B(e,"onBlur",n),f=B(e,"onDestroy",n);i&&this.editor.on("beforeCreate",i),s&&this.editor.on("create",s),l&&this.editor.on("update",l),a&&this.editor.on("selectionUpdate",a),c&&this.editor.on("transaction",c),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};Yy.resolve=mU;Yy.sort=fh;Yy.flatten=nE;var we=class zU extends uE{constructor(...e){super(...e),this.type="extension"}static create(e={}){let n=typeof e=="function"?e():e;return new zU(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}},kW=we.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new G({key:new ae("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,i=yU(n),{blockSeparator:s}=this.options,l={...s!==void 0?{blockSeparator:s}:{},textSerializers:i};return[...o.ranges].sort((a,c)=>a.$from.pos-c.$from.pos).map(({$from:a,$to:c})=>gU(r,{from:a.pos,to:c.pos},l)).join(s??`
|
|
80
|
+
|
|
81
|
+
`)}}})]}}),MW=we.create({name:"commands",addCommands(){return{...XX}}}),RW=we.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r;let o=()=>{var i,s,l;if((i=(s=this.editor.options.coreExtensionOptions)===null||s===void 0||(s=s.delete)===null||s===void 0||(l=s.filterTransaction)===null||l===void 0?void 0:l.call(s,t))!==null&&i!==void 0?i:t.getMeta("y-sync$"))return;let a=tE(t.before,[t,...e]);Nu(a).forEach(u=>{a.mapping.mapResult(u.oldRange.from).deletedAfter&&a.mapping.mapResult(u.oldRange.to).deletedBefore&&a.before.nodesBetween(u.oldRange.from,u.oldRange.to,(d,f)=>{let h=f+d.nodeSize-2,p=u.oldRange.from<=f&&h<=u.oldRange.to;this.editor.emit("delete",{type:"node",node:d,from:f,to:h,newFrom:a.mapping.map(f),newTo:a.mapping.map(h),deletedRange:u.oldRange,newRange:u.newRange,partial:!p,editor:this.editor,transaction:t,combinedTransform:a})})});let c=a.mapping;a.steps.forEach((u,d)=>{if(u instanceof Zs){var f,h;let p=c.slice(d).map(u.from,-1),m=c.slice(d).map(u.to),y=c.invert().map(p,-1),g=c.invert().map(m),v=p>0?(f=a.doc.nodeAt(p-1))===null||f===void 0?void 0:f.marks.some(w=>w.eq(u.mark)):!1,b=(h=a.doc.nodeAt(m))===null||h===void 0?void 0:h.marks.some(w=>w.eq(u.mark));this.editor.emit("delete",{type:"mark",mark:u.mark,from:u.from,to:u.to,deletedRange:{from:y,to:g},newRange:{from:p,to:m},partial:!!(b||v),editor:this.editor,transaction:t,combinedTransform:a})}})};!((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(o,0):o()}}),OW=we.create({name:"drop",addProseMirrorPlugins(){return[new G({key:new ae("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),DW=we.create({name:"editable",addProseMirrorPlugins(){return[new G({key:new ae("editable"),props:{editable:()=>this.editor.options.editable}})]}}),NW=new ae("focusEvents"),_W=we.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new G({key:NW,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),IW=we.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{let{selection:a,doc:c}=l,{empty:u,$anchor:d}=a,{pos:f,parent:h}=d,p=d.parent.isTextblock&&f>0?l.doc.resolve(f-1):d,m=p.parent.type.spec.isolating,y=d.pos-d.parentOffset,g=m&&p.parent.childCount===1?y===d.pos:H.atStart(c).from===f;return!u||!h.type.isTextblock||h.textContent.length||!g||g&&d.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.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()},o={...r},i={...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 Py()||uU()?i:o},addProseMirrorPlugins(){return[new G({key:new ae("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(h=>h.getMeta("composition")))return;let r=t.some(h=>h.docChanged)&&!e.doc.eq(n.doc),o=t.some(h=>h.getMeta("preventClearDocument"));if(!r||o)return;let{empty:i,from:s,to:l}=e.selection,a=H.atStart(e.doc).from,c=H.atEnd(e.doc).to;if(i||!(s===a&&l===c)||!_u(n.doc))return;let u=n.tr,d=Hy({state:n,transaction:u}),{commands:f}=new Mu({editor:this.editor,state:d});if(f.clearNodes(),!!u.steps.length)return u}})]}}),LW=we.create({name:"paste",addProseMirrorPlugins(){return[new G({key:new ae("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),zW=we.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new G({key:new ae("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"}}}})]}}),UW=we.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:t}=Ou(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let 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 G({key:new ae("textDirection"),props:{attributes:()=>{let t=this.options.direction;return t?{dir:t}:{}}}})]}});var eU=!1;function BW(t){if(eU)return;eU=!0;let e;try{let n=dt.fromJSON(t,{from:0,to:0});if(!SX(n))return;e=n.slice.content}catch{return}e instanceof M||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 PW=class dh{get name(){return this.node.type.name}constructor(e,n,r=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=o}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\u2019t 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;let e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new dh(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 dh(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 dh(e,this.editor)}get children(){let e=[];return this.node.content.forEach((n,r)=>{let o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+(i?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!o&&!s&&a.depth<=this.depth)return;let c=new dh(a,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),e.push(c)}),e}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,o=this.parent;for(;o&&!r;){if(o.node.type.name===e)if(Object.keys(n).length>0){let i=o.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){let a=s[l];if(i[a]!==n[a])break}}else r=o;o=o.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let o=[];if(!this.children||this.children.length===0)return o;let i=Object.keys(n);return this.children.forEach(s=>{r&&o.length>0||(s.node.type.name===e&&i.every(l=>n[l]===s.node.attrs[l])&&o.push(s),!(r&&o.length>0)&&(o=o.concat(s.querySelectorAll(e,n,r))))}),o}setAttribute(e){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},HW=`.ProseMirror {
|
|
82
|
+
position: relative;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.ProseMirror {
|
|
86
|
+
word-wrap: break-word;
|
|
87
|
+
white-space: pre-wrap;
|
|
88
|
+
white-space: break-spaces;
|
|
89
|
+
-webkit-font-variant-ligatures: none;
|
|
90
|
+
font-variant-ligatures: none;
|
|
91
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.ProseMirror [contenteditable="false"] {
|
|
95
|
+
white-space: normal;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
99
|
+
white-space: pre-wrap;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.ProseMirror pre {
|
|
103
|
+
white-space: pre-wrap;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
img.ProseMirror-separator {
|
|
107
|
+
display: inline !important;
|
|
108
|
+
border: none !important;
|
|
109
|
+
margin: 0 !important;
|
|
110
|
+
width: 0 !important;
|
|
111
|
+
height: 0 !important;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.ProseMirror-gapcursor {
|
|
115
|
+
display: none;
|
|
116
|
+
pointer-events: none;
|
|
117
|
+
position: absolute;
|
|
118
|
+
margin: 0;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.ProseMirror-gapcursor:after {
|
|
122
|
+
content: "";
|
|
123
|
+
display: block;
|
|
124
|
+
position: absolute;
|
|
125
|
+
top: -2px;
|
|
126
|
+
width: 20px;
|
|
127
|
+
border-top: 1px solid black;
|
|
128
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
@keyframes ProseMirror-cursor-blink {
|
|
132
|
+
to {
|
|
133
|
+
visibility: hidden;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.ProseMirror-hideselection *::selection {
|
|
138
|
+
background: transparent;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
142
|
+
background: transparent;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.ProseMirror-hideselection * {
|
|
146
|
+
caret-color: transparent;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
150
|
+
display: block;
|
|
151
|
+
}`,UU=class extends QX{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:sE,createMappablePosition:xX},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:o})=>this.options.onDrop(n,r,o)),this.on("paste",({event:n,slice:r})=>this.options.onPaste(n,r)),this.on("delete",this.options.onDelete);let e=this.createDoc();if(!this.editorState){let n=XC(e,this.options.autofocus);this.editorState=ha.create({doc:e,schema:this.schema,selection:n||void 0})}BW(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;let 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():Mu.createFakeChain()}can(){return this.commandManager?this.commandManager.can():Mu.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=dW(HW,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,attributes:this.getEditorViewAttributes()}),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 AU&&!this.hasWarnedStaleDecorationRead&&JX(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){let n=JC(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;let e=this.state.plugins,n=e;if([].concat(t).forEach(o=>{let i=typeof o=="string"?`${o}$`:o.key;n=n.filter(s=>!s.key.startsWith(i))}),e.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;let n=[...this.options.enableCoreExtensions?[DW,kW.configure({blockSeparator:(t=this.options.coreExtensionOptions)===null||t===void 0||(t=t.clipboardTextSerializer)===null||t===void 0?void 0:t.blockSeparator}),MW,_W,IW,zW.configure({value:(e=this.options.coreExtensionOptions)===null||e===void 0||(e=e.tabindex)===null||e===void 0?void 0:e.value}),OW,LW,RW,UW.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 Yy(n,this)}createCommandManager(){this.commandManager=new Mu({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=WC(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;let n=WC(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=ha.create({doc:n,schema:this.schema,selection:XC(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}getEditorViewAttributes(){var t;let e=(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes;return JC(e)?n=>({role:"textbox",...e(n)}):{role:"textbox",...e}}createView(t){let{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=e.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new ih(t,{...e,attributes:this.getEditorViewAttributes(),dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS();let a=this.view.dom;a.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;let 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(c=>{var u;return(u=this.capturedTransaction)===null||u===void 0?void 0:u.step(c)});return}let{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),o=n.includes(t),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!o)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});let s=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),l=s?.getMeta("focus"),a=s?.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),!(t.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return iE(this.state,t)}isActive(t,e){let n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return bX(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return rE(this.state.doc.content,this.schema)}getText(t){let{blockSeparator:e=`
|
|
152
|
+
|
|
153
|
+
`,textSerializers:n={}}=t||{};return pX(this.state.doc,{blockSeparator:e,textSerializers:{...yU(this.schema),...n}})}get isEmpty(){return _u(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){let e=this.state.doc.resolve(t),n=t>0&&e.nodeAfter&&!e.nodeAfter.isText&&e.nodeAfter.isAtom?e.nodeAfter:null;return new PW(e,this,!1,n)}get $doc(){return this.$pos(0)}};function eo(t){return new Iu({find:t.find,handler:({state:e,range:n,match:r})=>{let o=be(t.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=e,s=r[r.length-1],l=r[0];if(s){let a=l.search(/\S/),c=n.from+l.indexOf(s),u=c+s.length;if(hh(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>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+a,c);let d=n.from+a+s.length;i.addMark(n.from+a,d,t.type.create(o||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function qy(t){return new Iu({find:t.find,handler:({state:e,range:n,match:r})=>{let o=be(t.getAttributes,void 0,r)||{},{tr:i}=e,s=n.from,l=n.to,a=t.type.create(o);if(r[1]){let c=s+r[0].lastIndexOf(r[1]);c>l?c=l:l=c+r[1].length;let u=r[0][r[0].length-1];i.insertText(u,s+r[0].length-1),i.replaceWith(c,l,a)}else if(r[0]){let c=t.type.isInline?s:s-1;i.insert(c,t.type.create(o)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:t.undoable})}function ph(t){return new Iu({find:t.find,handler:({state:e,range:n,match:r})=>{let o=e.doc.resolve(n.from),i=be(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,i)},undoable:t.undoable})}function cl(t){return new Iu({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{let i=be(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),a=l&&pu(l,t.type,i);if(!a)return null;if(s.wrap(l,a),t.keepMarks&&t.editor){let{selection:u,storedMarks:d}=e,{splittableMarks:f}=t.editor.extensionManager,h=d||u.$to.parentOffset&&u.$from.marks();if(h){let p=h.filter(m=>f.includes(m.type.name));s.ensureMarks(p)}}if(t.keepAttributes){let u=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(u,i).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&yo(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)},undoable:t.undoable})}var VW=t=>"touches"in t,BU=class{constructor(t){var e,n,r,o,i,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;let a=l.clientX-this.startX,c=l.clientY-this.startY;this.handleResize(a,c)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;let a=l.touches[0];if(!a)return;let c=a.clientX-this.startX,u=a.clientY-this.startY;this.handleResize(c,u)},this.handleMouseUp=()=>{if(!this.isResizing)return;let l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.element.draggable=!1,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,!((e=t.options)===null||e===void 0)&&e.min&&(this.minSize={...this.minSize,...t.options.min}),!((n=t.options)===null||n===void 0)&&n.max&&(this.maxSize=t.options.max),!(t==null||(r=t.options)===null||r===void 0)&&r.directions&&(this.directions=t.options.directions),!((o=t.options)===null||o===void 0)&&o.preserveAspectRatio&&(this.preserveAspectRatio=t.options.preserveAspectRatio),!((i=t.options)===null||i===void 0)&&i.className&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),!((s=t.options)===null||s===void 0)&&s.createCustomHandle&&(this.createCustomHandle=t.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var t;return(t=this.contentElement)!==null&&t!==void 0?t:null}handleEditorUpdate(){let t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type!==this.node.type?!1:(this.node=t,this.onUpdate?this.onUpdate(t,e,n):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){let t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){let t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){let e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){let n=e.includes("top"),r=e.includes("bottom"),o=e.includes("left"),i=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),o&&(t.style.left="0"),i&&(t.style.right="0"),(e==="top"||e==="bottom")&&(t.style.left="0",t.style.right="0"),(e==="left"||e==="right")&&(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;this.createCustomHandle?e=this.createCustomHandle(t):e=this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",n=>this.handleResizeStart(n,t)),e.addEventListener("touchstart",n=>this.handleResizeStart(n,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){let t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,VW(t)?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(t,e){if(!this.activeHandle)return;let n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:o}=this.calculateNewDimensions(this.activeHandle,t,e),i=this.applyConstraints(r,o,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,o=this.startHeight,i=t.includes("right"),s=t.includes("left"),l=t.includes("bottom"),a=t.includes("top");return i?r=this.startWidth+e:s&&(r=this.startWidth-e),l?o=this.startHeight+n:a&&(o=this.startHeight-n),(t==="right"||t==="left")&&(r=this.startWidth+(i?e:-e)),(t==="top"||t==="bottom")&&(o=this.startHeight+(l?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,o,t):{width:r,height:o}}applyConstraints(t,e,n){var r,o;if(!n){var i,s;let c=Math.max(this.minSize.width,t),u=Math.max(this.minSize.height,e);return!((i=this.maxSize)===null||i===void 0)&&i.width&&(c=Math.min(this.maxSize.width,c)),!((s=this.maxSize)===null||s===void 0)&&s.height&&(u=Math.min(this.maxSize.height,u)),{width:c,height:u}}let l=t,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),!((r=this.maxSize)===null||r===void 0)&&r.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),!((o=this.maxSize)===null||o===void 0)&&o.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(t,e,n){let r=n==="left"||n==="right",o=n==="top"||n==="bottom";return r?{width:t,height:t/this.aspectRatio}:o?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};var Ie=class PU extends uE{constructor(...e){super(...e),this.type="node"}static create(e={}){let n=typeof e=="function"?e():e;return new PU(n)}configure(e){return super.configure(e)}extend(e){let n=typeof e=="function"?e():e;return super.extend(n)}};function Or(t){return new dE({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{let i=be(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;let{tr:s}=e,l=r[r.length-1],a=r[0],c=n.to;if(l){let u=a.search(/\S/),d=n.from+a.indexOf(l),f=d+l.length;if(hh(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&&s.delete(f,n.to),d>n.from&&s.delete(n.from+u,d),c=n.from+u+l.length,s.addMark(n.from+u,c,t.type.create(i||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||s.removeStoredMark(t.type)}}})}var Zt=()=>new Map,Ky=t=>{let e=Zt();return t.forEach((n,r)=>{e.set(r,n)}),e},Dr=(t,e,n)=>{let r=t.get(e);return r===void 0&&t.set(e,r=n()),r},HU=(t,e)=>{let n=[];for(let[r,o]of t)n.push(e(o,r));return n},VU=(t,e)=>{for(let[n,r]of t)if(e(r,n))return!0;return!1};var to=()=>new Set;var Xy=t=>t[t.length-1];var jU=(t,e)=>{for(let n=0;n<e.length;n++)t.push(e[n])},bo=Array.from,Wy=(t,e)=>{for(let n=0;n<t.length;n++)if(!e(t[n],n,t))return!1;return!0},mh=(t,e)=>{for(let n=0;n<t.length;n++)if(e(t[n],n,t))return!0;return!1};var FU=(t,e)=>{let n=new Array(t);for(let r=0;r<t;r++)n[r]=e(r,n);return n};var Yi=Array.isArray;var yh=class{constructor(){this._observers=Zt()}on(e,n){return Dr(this._observers,e,to).add(n),n}once(e,n){let r=(...o)=>{this.off(e,r),n(...o)};this.on(e,r)}off(e,n){let r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return bo((this._observers.get(e)||Zt()).values()).forEach(r=>r(...n))}destroy(){this._observers=Zt()}},Jy=class{constructor(){this._observers=Zt()}on(e,n){Dr(this._observers,e,to).add(n)}once(e,n){let r=(...o)=>{this.off(e,r),n(...o)};this.on(e,r)}off(e,n){let r=this._observers.get(e);r!==void 0&&(r.delete(n),r.size===0&&this._observers.delete(e))}emit(e,n){return bo((this._observers.get(e)||Zt()).values()).forEach(r=>r(...n))}destroy(){this._observers=Zt()}};var Vt=Math.floor;var Aa=Math.abs;var Nr=(t,e)=>t<e?t:e,or=(t,e)=>t>e?t:e,ise=Number.isNaN;var Qy=t=>t!==0?t<0:1/t<0;var zu=Number.MAX_SAFE_INTEGER,fE=Number.MIN_SAFE_INTEGER,sse=1<<31;var $U=Number.isInteger||(t=>typeof t=="number"&&isFinite(t)&&Vt(t)===t),lse=Number.isNaN,ase=Number.parseInt;var vh=String.fromCharCode,jW=String.fromCodePoint,cse=vh(65535),FW=t=>t.toLowerCase(),$W=/^\s*/g,YW=t=>t.replace($W,""),qW=/([A-Z])/g,pE=(t,e)=>YW(t.replace(qW,n=>`${e}${FW(n)}`));var KW=t=>{let e=unescape(encodeURIComponent(t)),n=e.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=e.codePointAt(o);return r},Bu=typeof TextEncoder<"u"?new TextEncoder:null,GW=t=>Bu.encode(t),YU=Bu?GW:KW;var Uu=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Uu&&Uu.decode(new Uint8Array).length===1&&(Uu=null);var qU=(t,e)=>FU(e,()=>t).join("");var ka=class{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}},no=()=>new ka,JU=t=>{let e=no();return t(e),tn(e)},gE=t=>{let e=t.cpos;for(let n=0;n<t.bufs.length;n++)e+=t.bufs[n].length;return e};var tn=t=>{let e=new Uint8Array(gE(t)),n=0;for(let r=0;r<t.bufs.length;r++){let o=t.bufs[r];e.set(o,n),n+=o.length}return e.set(new Uint8Array(t.cbuf.buffer,0,t.cpos),n),e},XW=(t,e)=>{let n=t.cbuf.length;n-t.cpos<e&&(t.bufs.push(new Uint8Array(t.cbuf.buffer,0,t.cpos)),t.cbuf=new Uint8Array(or(n,e)*2),t.cpos=0)},en=(t,e)=>{let 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};var e0=en;var J=(t,e)=>{for(;e>127;)en(t,128|127&e),e=Vt(e/128);en(t,127&e)},t0=(t,e)=>{let n=Qy(e);for(n&&(e=-e),en(t,(e>63?128:0)|(n?64:0)|63&e),e=Vt(e/64);e>0;)en(t,(e>127?128:0)|127&e),e=Vt(e/128)},mE=new Uint8Array(3e4),WW=mE.length/3,JW=(t,e)=>{if(e.length<WW){let n=Bu.encodeInto(e,mE).written||0;J(t,n);for(let r=0;r<n;r++)en(t,mE[r])}else Rt(t,YU(e))},QW=(t,e)=>{let n=unescape(encodeURIComponent(e)),r=n.length;J(t,r);for(let o=0;o<r;o++)en(t,n.codePointAt(o))},qi=Bu&&Bu.encodeInto?JW:QW;var Sh=(t,e)=>{let n=t.cbuf.length,r=t.cpos,o=Nr(n-r,e.length),i=e.length-o;t.cbuf.set(e.subarray(0,o),r),t.cpos+=o,i>0&&(t.bufs.push(t.cbuf),t.cbuf=new Uint8Array(or(n*2,i)),t.cbuf.set(e.subarray(o)),t.cpos=i)},Rt=(t,e)=>{J(t,e.byteLength),Sh(t,e)},yE=(t,e)=>{XW(t,e);let n=new DataView(t.cbuf.buffer,t.cpos,e);return t.cpos+=e,n},ZW=(t,e)=>yE(t,4).setFloat32(0,e,!1),eJ=(t,e)=>yE(t,8).setFloat64(0,e,!1),tJ=(t,e)=>yE(t,8).setBigInt64(0,e,!1);var GU=new DataView(new ArrayBuffer(4)),nJ=t=>(GU.setFloat32(0,t),GU.getFloat32(0)===t),dl=(t,e)=>{switch(typeof e){case"string":en(t,119),qi(t,e);break;case"number":$U(e)&&Aa(e)<=2147483647?(en(t,125),t0(t,e)):nJ(e)?(en(t,124),ZW(t,e)):(en(t,123),eJ(t,e));break;case"bigint":en(t,122),tJ(t,e);break;case"object":if(e===null)en(t,126);else if(Yi(e)){en(t,117),J(t,e.length);for(let n=0;n<e.length;n++)dl(t,e[n])}else if(e instanceof Uint8Array)en(t,116),Rt(t,e);else{en(t,118);let n=Object.keys(e);J(t,n.length);for(let r=0;r<n.length;r++){let o=n[r];qi(t,o),dl(t,e[o])}}break;case"boolean":en(t,e?120:121);break;default:en(t,127)}},wh=class extends ka{constructor(e){super(),this.w=e,this.s=null,this.count=0}write(e){this.s===e?this.count++:(this.count>0&&J(this,this.count-1),this.count=1,this.w(this,e),this.s=e)}};var XU=t=>{t.count>0&&(t0(t.encoder,t.count===1?t.s:-t.s),t.count>1&&J(t.encoder,t.count-2))},Ma=class{constructor(){this.encoder=new ka,this.s=0,this.count=0}write(e){this.s===e?this.count++:(XU(this),this.count=1,this.s=e)}toUint8Array(){return XU(this),tn(this.encoder)}};var WU=t=>{if(t.count>0){let e=t.diff*2+(t.count===1?0:1);t0(t.encoder,e),t.count>1&&J(t.encoder,t.count-2)}},Hu=class{constructor(){this.encoder=new ka,this.s=0,this.count=0,this.diff=0}write(e){this.diff===e-this.s?(this.s=e,this.count++):(WU(this),this.count=1,this.diff=e-this.s,this.s=e)}toUint8Array(){return WU(this),tn(this.encoder)}},Zy=class{constructor(){this.sarr=[],this.s="",this.lensE=new Ma}write(e){this.s+=e,this.s.length>19&&(this.sarr.push(this.s),this.s=""),this.lensE.write(e.length)}toUint8Array(){let e=new ka;return this.sarr.push(this.s),this.s="",qi(e,this.sarr.join("")),Sh(e,this.lensE.toUint8Array()),tn(e)}};var _r=t=>new Error(t),$n=()=>{throw _r("Method unimplemented")},ft=()=>{throw _r("Unexpected case")};var o0=_r("Unexpected end of array"),QU=_r("Integer out of Range"),rJ=(t,e,n)=>{if(e<0||n<0||e+n>t.length)throw o0;return new Uint8Array(t.buffer,t.byteOffset+e,n)},oJ=(t,e,n)=>{if(e<0||n<0||e+n>t.length)throw o0;return new DataView(t.buffer,t.byteOffset+e,n)},ju=class{constructor(e){this.arr=e,this.pos=0}},So=t=>new ju(t),ZU=t=>t.pos!==t.arr.length;var iJ=(t,e)=>{let n=rJ(t.arr,t.pos,e);return t.pos+=e,n},jt=t=>iJ(t,Q(t));var Ra=t=>t.arr[t.pos++];var Q=t=>{let e=0,n=1,r=t.arr.length;for(;t.pos<r;){let o=t.arr[t.pos++];if(e=e+(o&127)*n,n*=128,o<128)return e;if(e>zu)throw QU}throw o0},i0=t=>{let e=t.arr[t.pos++],n=e&63,r=64,o=(e&64)>0?-1:1;if((e&128)===0)return o*n;let i=t.arr.length;for(;t.pos<i;){if(e=t.arr[t.pos++],n=n+(e&127)*r,r*=128,e<128)return o*n;if(n>zu)throw QU}throw o0};var sJ=t=>{let e=Q(t);if(e===0)return"";{let n=String.fromCodePoint(Ra(t));if(--e<100)for(;e--;)n+=String.fromCodePoint(Ra(t));else for(;e>0;){let r=e<1e4?e:1e4,o=t.arr.subarray(t.pos,t.pos+r);t.pos+=r,n+=String.fromCodePoint.apply(null,o),e-=r}return decodeURIComponent(escape(n))}},lJ=t=>Uu.decode(jt(t)),wo=Uu?lJ:sJ;var vE=(t,e)=>{let n=oJ(t.arr,t.pos,e);return t.pos+=e,n},aJ=t=>vE(t,4).getFloat32(0,!1),cJ=t=>vE(t,8).getFloat64(0,!1),uJ=t=>vE(t,8).getBigInt64(0,!1);var dJ=[t=>{},t=>null,i0,aJ,cJ,uJ,t=>!1,t=>!0,wo,t=>{let e=Q(t),n={};for(let r=0;r<e;r++){let o=wo(t);n[o]=Fu(t)}return n},t=>{let e=Q(t),n=[];for(let r=0;r<e;r++)n.push(Fu(t));return n},jt],Fu=t=>dJ[127-Ra(t)](t),xh=class extends ju{constructor(e,n){super(e),this.reader=n,this.s=null,this.count=0}read(){return this.count===0&&(this.s=this.reader(this),ZU(this)?this.count=Q(this)+1:this.count=-1),this.count--,this.s}};var Oa=class extends ju{constructor(e){super(e),this.s=0,this.count=0}read(){if(this.count===0){this.s=i0(this);let e=Qy(this.s);this.count=1,e&&(this.s=-this.s,this.count=Q(this)+2)}return this.count--,this.s}};var $u=class extends ju{constructor(e){super(e),this.s=0,this.count=0,this.diff=0}read(){if(this.count===0){let e=i0(this),n=e&1;this.diff=Vt(e/2),this.count=1,n&&(this.count=Q(this)+2)}return this.s+=this.diff,this.count--,this.s}},r0=class{constructor(e){this.decoder=new Oa(e),this.str=wo(this.decoder),this.spos=0}read(){let e=this.spos+this.decoder.read(),n=this.str.slice(this.spos,e);return this.spos=e,n}};var fse=crypto.subtle,eB=crypto.getRandomValues.bind(crypto);var fJ=Math.random,bE=()=>eB(new Uint32Array(1))[0];var tB=t=>t[Vt(fJ()*t.length)],hJ="10000000-1000-4000-8000"+-1e11,nB=()=>hJ.replace(/[018]/g,t=>(t^bE()&15>>t/4).toString(16));var Ki=Date.now;var SE=t=>new Promise(t);var mse=Promise.all.bind(Promise);var xE=t=>t===void 0?null:t;var CE=class{constructor(){this.map=new Map}setItem(e,n){this.map.set(e,n)}getItem(e){return this.map.get(e)}},oB=new CE,gJ=!0;try{typeof localStorage<"u"&&localStorage&&(oB=localStorage,gJ=!1)}catch{}var iB=oB;var Da=Symbol("Equality"),s0=(t,e)=>t===e||!!t?.[Da]?.(e)||!1;var sB=t=>typeof t=="object",lB=Object.assign,TE=Object.keys;var aB=(t,e)=>{for(let n in t)e(t[n],n)};var Eh=t=>TE(t).length;var cB=t=>{for(let e in t)return!1;return!0},Yu=(t,e)=>{for(let n in t)if(!e(t[n],n))return!1;return!0},Th=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),AE=(t,e)=>t===e||Eh(t)===Eh(e)&&Yu(t,(n,r)=>(n!==void 0||Th(e,r))&&s0(e[r],n)),vJ=Object.freeze,kE=t=>{for(let e in t){let n=t[e];(typeof n=="object"||typeof n=="function")&&kE(t[e])}return vJ(t)};var Ah=(t,e,n=0)=>{try{for(;n<t.length;n++)t[n](...e)}finally{n<t.length&&Ah(t,e,n+1)}};var uB=t=>t;var hl=(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[Da]!=null)return t[Da](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(let n of t)if(!e.has(n))return!1;break}case Map:{if(t.size!==e.size)return!1;for(let n of t.keys())if(!e.has(n)||!hl(t.get(n),e.get(n)))return!1;break}case void 0:case Object:if(Eh(t)!==Eh(e))return!1;for(let n in t)if(!Th(t,n)||!hl(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(!hl(t[n],e[n]))return!1;break;default:return!1}return!0},dB=(t,e)=>e.includes(t);var qu=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",Mh=typeof window<"u"&&typeof document<"u"&&!qu,gse=typeof navigator<"u"?/Mac/.test(navigator.platform):!1,Zo,bJ=[],wJ=()=>{if(Zo===void 0)if(qu){Zo=Zt();let t=process.argv,e=null;for(let n=0;n<t.length;n++){let r=t[n];r[0]==="-"?(e!==null&&Zo.set(e,""),e=r):e!==null?(Zo.set(e,r),e=null):bJ.push(r)}e!==null&&Zo.set(e,"")}else typeof location=="object"?(Zo=Zt(),(location.search||"?").slice(1).split("&").forEach(t=>{if(t.length!==0){let[e,n]=t.split("=");Zo.set(`--${pE(e,"-")}`,n),Zo.set(`-${pE(e,"-")}`,n)}})):Zo=Zt();return Zo},ME=t=>wJ().has(t);var kh=t=>qu?xE(process.env[t.toUpperCase().replaceAll("-","_")]):xE(iB.getItem(t));var fB=t=>ME("--"+t)||kh(t)!==null,hB=fB("production"),SJ=qu&&dB(process.env.FORCE_COLOR,["true","1","2"]),pB=SJ||!ME("--no-colors")&&!fB("no-color")&&(!qu||process.stdout.isTTY)&&(!qu||ME("--color")||kh("COLORTERM")!==null||(kh("TERM")||"").includes("color"));var xJ=t=>new Uint8Array(t);var CJ=t=>{let e="";for(let n=0;n<t.byteLength;n++)e+=vh(t[n]);return btoa(e)},EJ=t=>Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("base64");var mB=Mh?CJ:EJ;var gB=t=>{let e=xJ(t.byteLength);return e.set(t),e},yB=t=>JU(e=>dl(e,t));var RE=class{constructor(e,n){this.left=e,this.right=n}},ei=(t,e)=>new RE(t,e);var OE=t=>t.next()>=.5,c0=(t,e,n)=>Vt(t.next()*(n+1-e)+e);var DE=(t,e,n)=>Vt(t.next()*(n+1-e)+e);var NE=(t,e,n)=>DE(t,e,n);var AJ=t=>vh(NE(t,97,122)),bB=(t,e=0,n=20)=>{let r=NE(t,e,n),o="";for(let i=0;i<r;i++)o+=AJ(t);return o};var u0=(t,e)=>e[NE(t,0,e.length-1)];var MJ=Symbol("0schema"),_E=class{constructor(){this._rerrs=[]}extend(e,n,r,o=null){this._rerrs.push({path:e,expected:n,has:r,message:o})}toString(){let e=[];for(let n=this._rerrs.length-1;n>0;n--){let r=this._rerrs[n];e.push(qU(" ",(this._rerrs.length-n)*2)+`${r.path!=null?`[${r.path}] `:""}${r.has} doesn't match ${r.expected}. ${r.message}`)}return e.join(`
|
|
154
|
+
`)}},IE=(t,e)=>t===e?!0:t==null||e==null||t.constructor!==e.constructor?!1:t[Da]?s0(t,e):Yi(t)?Wy(t,n=>mh(e,r=>IE(n,r))):sB(t)?Yu(t,(n,r)=>IE(n,e[r])):!1,bn=class{static _dilutes=!1;extends(e){let[n,r]=[this.shape,e.shape];return this.constructor._dilutes&&([r,n]=[n,r]),IE(n,r)}equals(e){return this.constructor===e.constructor&&hl(this.shape,e.shape)}[MJ](){return!0}[Da](e){return this.equals(e)}validate(e){return this.check(e)}check(e,n){$n()}get nullable(){return Ju(this,x0)}get optional(){return new d0(this)}cast(e){return wB(e,this),e}expect(e){return wB(e,this),e}},Oh=class extends bn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n=void 0){let 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}},Ot=(t,e=null)=>new Oh(t,e),vse=Ot(Oh),Dh=class extends bn{constructor(e){super(),this.shape=e}check(e,n){let r=this.shape(e);return!r&&n?.extend(null,"custom prop",e?.constructor.name,"failed to check custom prop"),r}},Ft=t=>new Dh(t),bse=Ot(Dh),Xu=class extends bn{constructor(e){super(),this.shape=e}check(e,n){let r=this.shape.some(o=>o===e);return!r&&n?.extend(null,this.shape.join(" | "),e.toString()),r}},w0=(...t)=>new Xu(t),SB=Ot(Xu),RJ=RegExp.escape||(t=>t.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),xB=t=>{if(Wu.check(t))return[RJ(t)];if(SB.check(t))return t.shape.map(e=>e+"");if(kB.check(t))return["[+-]?\\d+.?\\d*"];if(MB.check(t))return[".*"];if(v0.check(t))return t.shape.map(xB).flat(1);ft()},LE=class extends bn{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(xB).map(n=>`(${n.join("|")})`).join("")+"$")}check(e,n){let r=this._r.exec(e)!=null;return!r&&n?.extend(null,this._r.toString(),e.toString(),"String doesn't match string template."),r}};var wse=Ot(LE),OJ=Symbol("optional"),d0=class extends bn{constructor(e){super(),this.shape=e}check(e,n){let r=e===void 0||this.shape.check(e);return!r&&n?.extend(null,"undefined (optional)","()"),r}get[OJ](){return!0}},DJ=Ot(d0),f0=class extends bn{check(e,n){return n?.extend(null,"never",typeof e),!1}},Sse=new f0,xse=Ot(f0),h0=class t extends bn{constructor(e,n=!1){super(),this.shape=e,this._isPartial=n}static _dilutes=!0;get partial(){return new t(this.shape,!0)}check(e,n){return e==null?(n?.extend(null,"object","null"),!1):Yu(this.shape,(r,o)=>{let i=this._isPartial&&!Th(e,o)||r.check(e[o],n);return!i&&n?.extend(o.toString(),r.toString(),typeof e[o],"Object property does not match"),i})}},NJ=t=>new h0(t),_J=Ot(h0),IJ=Ft(t=>t!=null&&(t.constructor===Object||t.constructor==null)),p0=class extends bn{constructor(e,n){super(),this.shape={keys:e,values:n}}check(e,n){return e!=null&&Yu(e,(r,o)=>{let i=this.shape.keys.check(o,n);return!i&&n?.extend(o+"","Record",typeof e,i?"Key doesn't match schema":"Value doesn't match value"),i&&this.shape.values.check(r,n)})}},CB=(t,e)=>new p0(t,e),LJ=Ot(p0),m0=class extends bn{constructor(e){super(),this.shape=e}check(e,n){return e!=null&&Yu(this.shape,(r,o)=>{let i=r.check(e[o],n);return!i&&n?.extend(o.toString(),"Tuple",typeof r),i})}},zJ=(...t)=>new m0(t),Cse=Ot(m0),g0=class extends bn{constructor(e){super(),this.shape=e.length===1?e[0]:new Nh(e)}check(e,n){let r=Yi(e)&&Wy(e,o=>this.shape.check(o));return!r&&n?.extend(null,"Array",""),r}},EB=(...t)=>new g0(t),UJ=Ot(g0),BJ=Ft(t=>Yi(t)),y0=class extends bn{constructor(e,n){super(),this.shape=e,this._c=n}check(e,n){let r=e instanceof this.shape&&(this._c==null||this._c(e));return!r&&n?.extend(null,this.shape.name,e?.constructor.name),r}},PJ=(t,e=null)=>new y0(t,e),Ese=Ot(y0),HJ=PJ(bn),zE=class extends bn{constructor(e){super(),this.len=e.length-1,this.args=zJ(...e.slice(-1)),this.res=e[this.len]}check(e,n){let r=e.constructor===Function&&e.length<=this.len;return!r&&n?.extend(null,"function",typeof e),r}};var VJ=Ot(zE),jJ=Ft(t=>typeof t=="function"),UE=class extends bn{constructor(e){super(),this.shape=e}check(e,n){let r=Wy(this.shape,o=>o.check(e,n));return!r&&n?.extend(null,"Intersectinon",typeof e),r}};var Tse=Ot(UE,t=>t.shape.length>0),Nh=class extends bn{static _dilutes=!0;constructor(e){super(),this.shape=e}check(e,n){let r=mh(this.shape,o=>o.check(e,n));return n?.extend(null,"Union",typeof e),r}},Ju=(...t)=>t.findIndex(e=>v0.check(e))>=0?Ju(...t.map(e=>_h(e)).map(e=>v0.check(e)?e.shape:[e]).flat(1)):t.length===1?t[0]:new Nh(t),v0=Ot(Nh),TB=()=>!0,b0=Ft(TB),FJ=Ot(Dh,t=>t.shape===TB),PE=Ft(t=>typeof t=="bigint"),$J=Ft(t=>t===PE),AB=Ft(t=>typeof t=="symbol"),Ase=Ft(t=>t===AB),Gu=Ft(t=>typeof t=="number"),kB=Ft(t=>t===Gu),Wu=Ft(t=>typeof t=="string"),MB=Ft(t=>t===Wu),S0=Ft(t=>typeof t=="boolean"),YJ=Ft(t=>t===S0),RB=w0(void 0),kse=Ot(Xu,t=>t.shape.length===1&&t.shape[0]===void 0),Mse=w0(void 0);var x0=w0(null),qJ=Ot(Xu,t=>t.shape.length===1&&t.shape[0]===null),Rse=Ot(Uint8Array),Ose=Ot(Oh,t=>t.shape===Uint8Array),KJ=Ju(Gu,Wu,x0,RB,PE,S0,AB),Dse=(()=>{let t=EB(b0),e=CB(Wu,b0),n=Ju(Gu,Wu,x0,S0,t,e);return t.shape=n,e.shape.values=n,n})(),_h=t=>{if(HJ.check(t))return t;if(IJ.check(t)){let e={};for(let n in t)e[n]=_h(t[n]);return NJ(e)}else{if(BJ.check(t))return Ju(...t.map(_h));if(KJ.check(t))return w0(t);if(jJ.check(t))return Ot(t)}ft()},wB=hB?()=>{}:(t,e)=>{let n=new _E;if(!e.check(t,n))throw _r(`Expected value to be of type ${e.constructor.name}.
|
|
155
|
+
${n.toString()}`)},BE=class{constructor(e){this.patterns=[],this.$state=e}if(e,n){return this.patterns.push({if:_h(e),h:n}),this}else(e){return this.if(b0,e)}done(){return(e,n)=>{for(let r=0;r<this.patterns.length;r++){let o=this.patterns[r];if(o.if.check(e))return o.h(e,n)}throw _r("Unhandled pattern")}}},GJ=t=>new BE(t),OB=GJ(b0).if(kB,(t,e)=>c0(e,fE,zu)).if(MB,(t,e)=>bB(e)).if(YJ,(t,e)=>OE(e)).if($J,(t,e)=>BigInt(c0(e,fE,zu))).if(v0,(t,e)=>Ku(e,u0(e,t.shape))).if(_J,(t,e)=>{let n={};for(let r in t.shape){let o=t.shape[r];if(DJ.check(o)){if(OE(e))continue;o=o.shape}n[r]=OB(o,e)}return n}).if(UJ,(t,e)=>{let n=[],r=DE(e,0,42);for(let o=0;o<r;o++)n.push(Ku(e,t.shape));return n}).if(SB,(t,e)=>u0(e,t.shape)).if(qJ,(t,e)=>null).if(VJ,(t,e)=>{let n=Ku(e,t.res);return()=>n}).if(FJ,(t,e)=>Ku(e,u0(e,[Gu,Wu,x0,RB,PE,S0,EB(Gu),CB(Ju("a","b","c"),Gu)]))).if(LJ,(t,e)=>{let n={},r=c0(e,0,3);for(let o=0;o<r;o++){let i=Ku(e,t.shape.keys),s=Ku(e,t.shape.values);n[i]=s}return n}).done(),Ku=(t,e)=>OB(_h(e),t);var Gi=typeof document<"u"?document:{};var Nse=Ft(t=>t.nodeType===ZJ);var _se=typeof DOMParser<"u"?new DOMParser:null;var Ise=Ft(t=>t.nodeType===WJ);var Lse=Ft(t=>t.nodeType===JJ);var DB=t=>HU(t,(e,n)=>`${n}:${e};`).join("");var WJ=Gi.ELEMENT_NODE,JJ=Gi.TEXT_NODE,zse=Gi.CDATA_SECTION_NODE,Use=Gi.COMMENT_NODE,QJ=Gi.DOCUMENT_NODE,Bse=Gi.DOCUMENT_TYPE_NODE,ZJ=Gi.DOCUMENT_FRAGMENT_NODE,Pse=Ft(t=>t.nodeType===QJ);var C0=t=>class{constructor(n){this._=n}destroy(){t(this._)}},eQ=C0(clearTimeout),Qu=(t,e)=>new eQ(setTimeout(e,t)),Vse=C0(clearInterval);var jse=C0(t=>typeof requestAnimationFrame<"u"&&cancelAnimationFrame(t));var Fse=C0(t=>typeof cancelIdleCallback<"u"&&cancelIdleCallback(t));var ti=Symbol;var Ih=ti(),Lh=ti(),HE=ti(),VE=ti(),jE=ti(),zh=ti(),FE=ti(),Zu=ti(),$E=ti(),_B=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());let e=[],n=[],r=0;for(;r<t.length;r++){let o=t[r];if(o===void 0)break;if(o.constructor===String||o.constructor===Number)e.push(o);else if(o.constructor===Object)break}for(r>0&&n.push(e.join(""));r<t.length;r++){let o=t[r];o instanceof Symbol||n.push(o)}return n};var $se=Ki();var oQ={[Ih]:ei("font-weight","bold"),[Lh]:ei("font-weight","normal"),[HE]:ei("color","blue"),[jE]:ei("color","green"),[VE]:ei("color","grey"),[zh]:ei("color","red"),[FE]:ei("color","purple"),[Zu]:ei("color","orange"),[$E]:ei("color","black")},iQ=t=>{t.length===1&&t[0]?.constructor===Function&&(t=t[0]());let e=[],n=[],r=Zt(),o=[],i=0;for(;i<t.length;i++){let s=t[i],l=oQ[s];if(l!==void 0)r.set(l.left,l.right);else{if(s===void 0)break;if(s.constructor===String||s.constructor===Number){let a=DB(r);i>0||a.length>0?(e.push("%c"+s),n.push(a)):e.push(s)}else break}}for(i>0&&(o=n,o.unshift(e.join("")));i<t.length;i++){let s=t[i];s instanceof Symbol||o.push(s)}return o},IB=pB?iQ:_B,LB=(...t)=>{console.log(...IB(t)),zB.forEach(e=>e.print(t))},YE=(...t)=>{console.warn(...IB(t)),t.unshift(Zu),zB.forEach(e=>e.print(t))};var zB=to();var UB=t=>({[Symbol.iterator](){return this},next:t}),BB=(t,e)=>UB(()=>{let n;do n=t.next();while(!n.done&&!e(n.value));return n}),E0=(t,e)=>UB(()=>{let{done:n,value:r}=t.next();return{done:n,value:n?void 0:e(r)}});var ed=class{constructor(e,n){this.clock=e,this.len=n}},vl=class{constructor(){this.clients=new Map}},Xi=(t,e,n)=>e.clients.forEach((r,o)=>{let i=t.doc.store.clients.get(o);if(i!=null){let s=i[i.length-1],l=s.id.clock+s.length;for(let a=0,c=r[a];a<r.length&&c.clock<l;c=r[++a])lP(t,i,c.clock,c.len,n)}}),uQ=(t,e)=>{let n=0,r=t.length-1;for(;n<=r;){let o=Vt((n+r)/2),i=t[o],s=i.clock;if(s<=e){if(e<s+i.len)return o;n=o+1}else r=o-1}return null},za=(t,e)=>{let n=t.clients.get(e.client);return n!==void 0&&uQ(n,e.clock)!==null},cT=t=>{t.clients.forEach(e=>{e.sort((o,i)=>o.clock-i.clock);let n,r;for(n=1,r=1;n<e.length;n++){let o=e[r-1],i=e[n];o.clock+o.len>=i.clock?e[r-1]=new ed(o.clock,or(o.len,i.clock+i.len-o.clock)):(r<n&&(e[r]=i),r++)}e.length=r})},KE=t=>{let e=new vl;for(let n=0;n<t.length;n++)t[n].clients.forEach((r,o)=>{if(!e.clients.has(o)){let i=r.slice();for(let s=n+1;s<t.length;s++)jU(i,t[s].clients.get(o)||[]);e.clients.set(o,i)}});return cT(e),e},Bh=(t,e,n,r)=>{Dr(t.clients,e,()=>[]).push(new ed(n,r))},H0=()=>new vl,tP=t=>{let e=H0();return t.clients.forEach((n,r)=>{let o=[];for(let i=0;i<n.length;i++){let s=n[i];if(s.deleted){let l=s.id.clock,a=s.length;if(i+1<n.length)for(let c=n[i+1];i+1<n.length&&c.deleted;c=n[++i+1])a+=c.length;o.push(new ed(l,a))}}o.length>0&&e.clients.set(r,o)}),e},ld=(t,e)=>{J(t.restEncoder,e.clients.size),bo(e.clients.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{t.resetDsCurVal(),J(t.restEncoder,n);let o=r.length;J(t.restEncoder,o);for(let i=0;i<o;i++){let s=r[i];t.writeDsClock(s.clock),t.writeDsLen(s.len)}})},uT=t=>{let e=new vl,n=Q(t.restDecoder);for(let r=0;r<n;r++){t.resetDsCurVal();let o=Q(t.restDecoder),i=Q(t.restDecoder);if(i>0){let s=Dr(e.clients,o,()=>[]);for(let l=0;l<i;l++)s.push(new ed(t.readDsClock(),t.readDsLen()))}}return e},VB=(t,e,n)=>{let r=new vl,o=Q(t.restDecoder);for(let i=0;i<o;i++){t.resetDsCurVal();let s=Q(t.restDecoder),l=Q(t.restDecoder),a=n.clients.get(s)||[],c=at(n,s);for(let u=0;u<l;u++){let d=t.readDsClock(),f=d+t.readDsLen();if(d<c){c<f&&Bh(r,s,c,f-c);let h=ro(a,d),p=a[h];for(!p.deleted&&p.id.clock<d&&(a.splice(h+1,0,P0(e,p,d-p.id.clock)),h++);h<a.length&&(p=a[h++],p.id.clock<f);)p.deleted||(f<p.id.clock+p.length&&a.splice(h,0,P0(e,p,f-p.id.clock)),p.delete(e))}else Bh(r,s,d,f-d)}}if(r.clients.size>0){let i=new Wi;return J(i.restEncoder,0),ld(i,r),i.toUint8Array()}return null};var nP=bE,ur=class t extends yh{constructor({guid:e=nB(),collectionid:n=null,gc:r=!0,gcFilter:o=()=>!0,meta:i=null,autoLoad:s=!1,shouldLoad:l=!0}={}){super(),this.gc=r,this.gcFilter=o,this.clientID=nP(),this.guid=e,this.collectionid=n,this.share=new Map,this.store=new I0,this._transaction=null,this._transactionCleanups=[],this.subdocs=new Set,this._item=null,this.shouldLoad=l,this.autoLoad=s,this.meta=i,this.isLoaded=!1,this.isSynced=!1,this.isDestroyed=!1,this.whenLoaded=SE(c=>{this.on("load",()=>{this.isLoaded=!0,c(this)})});let a=()=>SE(c=>{let u=d=>{(d===void 0||d===!0)&&(this.off("sync",u),c())};this.on("sync",u)});this.on("sync",c=>{c===!1&&this.isSynced&&(this.whenSynced=a()),this.isSynced=c===void 0||c===!0,this.isSynced&&!this.isLoaded&&this.emit("load",[this])}),this.whenSynced=a()}load(){let e=this._item;e!==null&&!this.shouldLoad&&Fe(e.parent.doc,n=>{n.subdocsLoaded.add(this)},null,!0),this.shouldLoad=!0}getSubdocs(){return this.subdocs}getSubdocGuids(){return new Set(bo(this.subdocs).map(e=>e.guid))}transact(e,n=null){return Fe(this,e,n)}get(e,n=Ze){let r=Dr(this.share,e,()=>{let i=new n;return i._integrate(this,null),i}),o=r.constructor;if(n!==Ze&&o!==n)if(o===Ze){let i=new n;i._map=r._map,r._map.forEach(s=>{for(;s!==null;s=s.left)s.parent=i}),i._start=r._start;for(let s=i._start;s!==null;s=s.right)s.parent=i;return i._length=r._length,this.share.set(e,i),i._integrate(this,null),i}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,id)}getText(e=""){return this.get(e,Ir)}getMap(e=""){return this.get(e,Ia)}getXmlElement(e=""){return this.get(e,Ee)}getXmlFragment(e=""){return this.get(e,dr)}toJSON(){let e={};return this.share.forEach((n,r)=>{e[r]=n.toJSON()}),e}destroy(){this.isDestroyed=!0,bo(this.subdocs).forEach(n=>n.destroy());let e=this._item;if(e!==null){this._item=null;let n=e.content;n.doc=new t({guid:this.guid,...n.opts,shouldLoad:!1}),n.doc._item=e,Fe(e.parent.doc,r=>{let o=n.doc;e.deleted||r.subdocsAdded.add(o),r.subdocsRemoved.add(this)},null,!0)}this.emit("destroyed",[!0]),this.emit("destroy",[this]),super.destroy()}},O0=class{constructor(e){this.restDecoder=e}resetDsCurVal(){}readDsClock(){return Q(this.restDecoder)}readDsLen(){return Q(this.restDecoder)}},D0=class extends O0{readLeftID(){return X(Q(this.restDecoder),Q(this.restDecoder))}readRightID(){return X(Q(this.restDecoder),Q(this.restDecoder))}readClient(){return Q(this.restDecoder)}readInfo(){return Ra(this.restDecoder)}readString(){return wo(this.restDecoder)}readParentInfo(){return Q(this.restDecoder)===1}readTypeRef(){return Q(this.restDecoder)}readLen(){return Q(this.restDecoder)}readAny(){return Fu(this.restDecoder)}readBuf(){return gB(jt(this.restDecoder))}readJSON(){return JSON.parse(wo(this.restDecoder))}readKey(){return wo(this.restDecoder)}},GE=class{constructor(e){this.dsCurrVal=0,this.restDecoder=e}resetDsCurVal(){this.dsCurrVal=0}readDsClock(){return this.dsCurrVal+=Q(this.restDecoder),this.dsCurrVal}readDsLen(){let e=Q(this.restDecoder)+1;return this.dsCurrVal+=e,e}},bl=class extends GE{constructor(e){super(e),this.keys=[],Q(e),this.keyClockDecoder=new $u(jt(e)),this.clientDecoder=new Oa(jt(e)),this.leftClockDecoder=new $u(jt(e)),this.rightClockDecoder=new $u(jt(e)),this.infoDecoder=new xh(jt(e),Ra),this.stringDecoder=new r0(jt(e)),this.parentInfoDecoder=new xh(jt(e),Ra),this.typeRefDecoder=new Oa(jt(e)),this.lenDecoder=new Oa(jt(e))}readLeftID(){return new gl(this.clientDecoder.read(),this.leftClockDecoder.read())}readRightID(){return new gl(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 Fu(this.restDecoder)}readBuf(){return jt(this.restDecoder)}readJSON(){return Fu(this.restDecoder)}readKey(){let e=this.keyClockDecoder.read();if(e<this.keys.length)return this.keys[e];{let n=this.stringDecoder.read();return this.keys.push(n),n}}},N0=class{constructor(){this.restEncoder=no()}toUint8Array(){return tn(this.restEncoder)}resetDsCurVal(){}writeDsClock(e){J(this.restEncoder,e)}writeDsLen(e){J(this.restEncoder,e)}},_a=class extends N0{writeLeftID(e){J(this.restEncoder,e.client),J(this.restEncoder,e.clock)}writeRightID(e){J(this.restEncoder,e.client),J(this.restEncoder,e.clock)}writeClient(e){J(this.restEncoder,e)}writeInfo(e){e0(this.restEncoder,e)}writeString(e){qi(this.restEncoder,e)}writeParentInfo(e){J(this.restEncoder,e?1:0)}writeTypeRef(e){J(this.restEncoder,e)}writeLen(e){J(this.restEncoder,e)}writeAny(e){dl(this.restEncoder,e)}writeBuf(e){Rt(this.restEncoder,e)}writeJSON(e){qi(this.restEncoder,JSON.stringify(e))}writeKey(e){qi(this.restEncoder,e)}},_0=class{constructor(){this.restEncoder=no(),this.dsCurrVal=0}toUint8Array(){return tn(this.restEncoder)}resetDsCurVal(){this.dsCurrVal=0}writeDsClock(e){let n=e-this.dsCurrVal;this.dsCurrVal=e,J(this.restEncoder,n)}writeDsLen(e){e===0&&ft(),J(this.restEncoder,e-1),this.dsCurrVal+=e}},Wi=class extends _0{constructor(){super(),this.keyMap=new Map,this.keyClock=0,this.keyClockEncoder=new Hu,this.clientEncoder=new Ma,this.leftClockEncoder=new Hu,this.rightClockEncoder=new Hu,this.infoEncoder=new wh(e0),this.stringEncoder=new Zy,this.parentInfoEncoder=new wh(e0),this.typeRefEncoder=new Ma,this.lenEncoder=new Ma}toUint8Array(){let e=no();return J(e,0),Rt(e,this.keyClockEncoder.toUint8Array()),Rt(e,this.clientEncoder.toUint8Array()),Rt(e,this.leftClockEncoder.toUint8Array()),Rt(e,this.rightClockEncoder.toUint8Array()),Rt(e,tn(this.infoEncoder)),Rt(e,this.stringEncoder.toUint8Array()),Rt(e,tn(this.parentInfoEncoder)),Rt(e,this.typeRefEncoder.toUint8Array()),Rt(e,this.lenEncoder.toUint8Array()),Sh(e,tn(this.restEncoder)),tn(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){dl(this.restEncoder,e)}writeBuf(e){Rt(this.restEncoder,e)}writeJSON(e){dl(this.restEncoder,e)}writeKey(e){let n=this.keyMap.get(e);n===void 0?(this.keyClockEncoder.write(this.keyClock++),this.stringEncoder.write(e)):this.keyClockEncoder.write(n)}},dQ=(t,e,n,r)=>{r=or(r,e[0].id.clock);let o=ro(e,r);J(t.restEncoder,e.length-o),t.writeClient(n),J(t.restEncoder,r);let i=e[o];i.write(t,r-i.id.clock);for(let s=o+1;s<e.length;s++)e[s].write(t,0)},dT=(t,e,n)=>{let r=new Map;n.forEach((o,i)=>{at(e,i)>o&&r.set(i,o)}),Gh(e).forEach((o,i)=>{n.has(i)||r.set(i,0)}),J(t.restEncoder,r.size),bo(r.entries()).sort((o,i)=>i[0]-o[0]).forEach(([o,i])=>{dQ(t,e.clients.get(o),o,i)})},fQ=(t,e)=>{let n=Zt(),r=Q(t.restDecoder);for(let o=0;o<r;o++){let i=Q(t.restDecoder),s=new Array(i),l=t.readClient(),a=Q(t.restDecoder);n.set(l,{i:0,refs:s});for(let c=0;c<i;c++){let u=t.readInfo();switch(31&u){case 0:{let d=t.readLen();s[c]=new lr(X(l,a),d),a+=d;break}case 10:{let d=Q(t.restDecoder);s[c]=new ar(X(l,a),d),a+=d;break}default:{let d=(u&192)===0,f=new Ce(X(l,a),null,(u&128)===128?t.readLeftID():null,null,(u&64)===64?t.readRightID():null,d?t.readParentInfo()?e.get(t.readString()):t.readLeftID():null,d&&(u&32)===32?t.readString():null,kP(t,u));s[c]=f,a+=f.length}}}}return n},hQ=(t,e,n)=>{let r=[],o=bo(n.keys()).sort((h,p)=>h-p);if(o.length===0)return null;let i=()=>{if(o.length===0)return null;let h=n.get(o[o.length-1]);for(;h.refs.length===h.i;)if(o.pop(),o.length>0)h=n.get(o[o.length-1]);else return null;return h},s=i();if(s===null)return null;let l=new I0,a=new Map,c=(h,p)=>{let m=a.get(h);(m==null||m>p)&&a.set(h,p)},u=s.refs[s.i++],d=new Map,f=()=>{for(let h of r){let p=h.id.client,m=n.get(p);m?(m.i--,l.clients.set(p,m.refs.slice(m.i)),n.delete(p),m.i=0,m.refs=[]):l.clients.set(p,[h]),o=o.filter(y=>y!==p)}r.length=0};for(;;){if(u.constructor!==ar){let p=Dr(d,u.id.client,()=>at(e,u.id.client))-u.id.clock;if(p<0)r.push(u),c(u.id.client,u.id.clock-1),f();else{let m=u.getMissing(t,e);if(m!==null){r.push(u);let y=n.get(m)||{refs:[],i:0};if(y.refs.length===y.i)c(m,at(e,m)),f();else{u=y.refs[y.i++];continue}}else(p===0||p<u.length)&&(u.integrate(t,p),d.set(u.id.client,u.id.clock+u.length))}}if(r.length>0)u=r.pop();else if(s!==null&&s.i<s.refs.length)u=s.refs[s.i++];else{if(s=i(),s===null)break;u=s.refs[s.i++]}}if(l.clients.size>0){let h=new Wi;return dT(h,l,new Map),J(h.restEncoder,0),{missing:a,update:h.toUint8Array()}}return null},pQ=(t,e)=>dT(t,e.doc.store,e.beforeState),mQ=(t,e,n,r=new bl(t))=>Fe(e,o=>{o.local=!1;let i=!1,s=o.doc,l=s.store,a=fQ(r,s),c=hQ(o,l,a),u=l.pendingStructs;if(u){for(let[f,h]of u.missing)if(h<at(l,f)){i=!0;break}if(c){for(let[f,h]of c.missing){let p=u.missing.get(f);(p==null||p>h)&&u.missing.set(f,h)}u.update=L0([u.update,c.update])}}else l.pendingStructs=c;let d=VB(r,o,l);if(l.pendingDs){let f=new bl(So(l.pendingDs));Q(f.restDecoder);let h=VB(f,o,l);d&&h?l.pendingDs=L0([d,h]):l.pendingDs=d||h}else l.pendingDs=d;if(i){let f=l.pendingStructs.update;l.pendingStructs=null,Kh(o.doc,f)}},n,!1);var Kh=(t,e,n,r=bl)=>{let o=So(e);mQ(o,t,n,new r(o))},ad=(t,e,n)=>Kh(t,e,n,D0),gQ=(t,e,n=new Map)=>{dT(t,e.store,n),ld(t,tP(e.store))},yQ=(t,e=new Uint8Array([0]),n=new Wi)=>{let r=j0(e);gQ(n,t,r);let o=[n.toUint8Array()];if(t.store.pendingDs&&o.push(t.store.pendingDs),t.store.pendingStructs&&o.push(OQ(t.store.pendingStructs.update,e)),o.length>1){if(n.constructor===_a)return MQ(o.map((i,s)=>s===0?i:NQ(i)));if(n.constructor===Wi)return L0(o)}return o[0]},V0=(t,e)=>yQ(t,e,new _a),vQ=t=>{let e=new Map,n=Q(t.restDecoder);for(let r=0;r<n;r++){let o=Q(t.restDecoder),i=Q(t.restDecoder);e.set(o,i)}return e},j0=t=>vQ(new O0(So(t))),rP=(t,e)=>(J(t.restEncoder,e.size),bo(e.entries()).sort((n,r)=>r[0]-n[0]).forEach(([n,r])=>{J(t.restEncoder,n),J(t.restEncoder,r)}),t),bQ=(t,e)=>rP(t,Gh(e.store)),wQ=(t,e=new _0)=>(t instanceof Map?rP(e,t):bQ(e,t),e.toUint8Array()),F0=t=>wQ(t,new N0),XE=class{constructor(){this.l=[]}},jB=()=>new XE,FB=(t,e)=>t.l.push(e),$B=(t,e)=>{let n=t.l,r=n.length;t.l=n.filter(o=>e!==o),r===t.l.length&&console.error("[yjs] Tried to remove event handler that doesn't exist.")},oP=(t,e,n)=>Ah(t.l,[e,n]),gl=class{constructor(e,n){this.client=e,this.clock=n}},cr=(t,e)=>t===e||t!==null&&e!==null&&t.client===e.client&&t.clock===e.clock,X=(t,e)=>new gl(t,e);var Qi=t=>{for(let[e,n]of t.doc.share.entries())if(n===t)return e;throw ft()},td=(t,e)=>{for(;e!==null;){if(e.parent===t)return!0;e=e.parent._item}return!1};var Ji=class{constructor(e,n,r,o=0){this.type=e,this.tname=n,this.item=r,this.assoc=o}};var cd=t=>new Ji(t.type==null?null:X(t.type.client,t.type.clock),t.tname??null,t.item==null?null:X(t.item.client,t.item.clock),t.assoc==null?0:t.assoc),WE=class{constructor(e,n,r=0){this.type=e,this.index=n,this.assoc=r}},SQ=(t,e,n=0)=>new WE(t,e,n),T0=(t,e,n)=>{let r=null,o=null;return t._item===null?o=Qi(t):r=X(t._item.id.client,t._item.id.clock),new Ji(r,o,e,n)},Ua=(t,e,n=0)=>{let r=t._start;if(n<0){if(e===0)return T0(t,null,n);e--}for(;r!==null;){if(!r.deleted&&r.countable){if(r.length>e)return T0(t,X(r.id.client,r.id.clock+e),n);e-=r.length}if(r.right===null&&n<0)return T0(t,r.lastId,n);r=r.right}return T0(t,null,n)};var xQ=(t,e)=>{let n=yl(t,e),r=e.clock-n.id.clock;return{item:n,diff:r}},fT=(t,e,n=!0)=>{let r=e.store,o=t.item,i=t.type,s=t.tname,l=t.assoc,a=null,c=0;if(o!==null){if(at(r,o.client)<=o.clock)return null;let u=n?lT(r,o):xQ(r,o),d=u.item;if(!(d instanceof Ce))return null;if(a=d.parent,a._item===null||!a._item.deleted){c=d.deleted||!d.countable?0:u.diff+(l>=0?0:1);let f=d.left;for(;f!==null;)!f.deleted&&f.countable&&(c+=f.length),f=f.left}}else{if(s!==null)a=e.get(s);else if(i!==null){if(at(r,i.client)<=i.clock)return null;let{item:u}=n?lT(r,i):{item:yl(r,i)};if(u instanceof Ce&&u.content instanceof nn)a=u.content.type;else return null}else throw ft();l>=0?c=a._length:c=0}return SQ(a,c,t.assoc)},$0=(t,e)=>t===e||t!==null&&e!==null&&t.tname===e.tname&&cr(t.item,e.item)&&cr(t.type,e.type)&&t.assoc===e.assoc,nd=class{constructor(e,n){this.ds=e,this.sv=n}};var Y0=(t,e)=>new nd(t,e),iP=Y0(H0(),new Map),q0=t=>Y0(tP(t.store),Gh(t.store)),Na=(t,e)=>e===void 0?!t.deleted:e.sv.has(t.id.client)&&(e.sv.get(t.id.client)||0)>t.id.clock&&!za(e.ds,t.id),JE=(t,e)=>{let n=Dr(t.meta,JE,to),r=t.doc.store;n.has(e)||(e.sv.forEach((o,i)=>{o<at(r,i)&&sr(t,X(i,o))}),Xi(t,e.ds,o=>{}),n.add(e))};var I0=class{constructor(){this.clients=new Map,this.pendingStructs=null,this.pendingDs=null}},Gh=t=>{let e=new Map;return t.clients.forEach((n,r)=>{let o=n[n.length-1];e.set(r,o.id.clock+o.length)}),e},at=(t,e)=>{let n=t.clients.get(e);if(n===void 0)return 0;let r=n[n.length-1];return r.id.clock+r.length},sP=(t,e)=>{let n=t.clients.get(e.id.client);if(n===void 0)n=[],t.clients.set(e.id.client,n);else{let r=n[n.length-1];if(r.id.clock+r.length!==e.id.clock)throw ft()}n.push(e)},ro=(t,e)=>{let n=0,r=t.length-1,o=t[r],i=o.id.clock;if(i===e)return r;let s=Vt(e/(i+o.length-1)*r);for(;n<=r;){if(o=t[s],i=o.id.clock,i<=e){if(e<i+o.length)return s;n=s+1}else r=s-1;s=Vt((n+r)/2)}throw ft()},CQ=(t,e)=>{let n=t.clients.get(e.client);return n[ro(n,e.clock)]},yl=CQ,QE=(t,e,n)=>{let r=ro(e,n),o=e[r];return o.id.clock<n&&o instanceof Ce?(e.splice(r+1,0,P0(t,o,n-o.id.clock)),r+1):r},sr=(t,e)=>{let n=t.doc.store.clients.get(e.client);return n[QE(t,n,e.clock)]},YB=(t,e,n)=>{let r=e.clients.get(n.client),o=ro(r,n.clock),i=r[o];return n.clock!==i.id.clock+i.length-1&&i.constructor!==lr&&r.splice(o+1,0,P0(t,i,n.clock-i.id.clock+1)),i},EQ=(t,e,n)=>{let r=t.clients.get(e.id.client);r[ro(r,e.id.clock)]=n},lP=(t,e,n,r,o)=>{if(r===0)return;let i=n+r,s=QE(t,e,n),l;do l=e[s++],i<l.id.clock+l.length&&QE(t,e,i),o(l);while(s<e.length&&e[s].id.clock<i)},ZE=class{constructor(e,n,r){this.doc=e,this.deleteSet=new vl,this.beforeState=Gh(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}},qB=(t,e)=>e.deleteSet.clients.size===0&&!VU(e.afterState,(n,r)=>e.beforeState.get(r)!==n)?!1:(cT(e.deleteSet),pQ(t,e),ld(t,e.deleteSet),!0),KB=(t,e,n)=>{let r=e._item;(r===null||r.id.clock<(t.beforeState.get(r.id.client)||0)&&!r.deleted)&&Dr(t.changed,e,to).add(n)},M0=(t,e)=>{let n=t[e],r=t[e-1],o=e;for(;o>0;n=r,r=t[--o-1]){if(r.deleted===n.deleted&&r.constructor===n.constructor&&r.mergeWith(n)){n instanceof Ce&&n.parentSub!==null&&n.parent._map.get(n.parentSub)===n&&n.parent._map.set(n.parentSub,r);continue}break}let i=e-o;return i&&t.splice(e+1-i,i),i},TQ=(t,e,n)=>{for(let[r,o]of t.clients.entries()){let i=e.clients.get(r);for(let s=o.length-1;s>=0;s--){let l=o[s],a=l.clock+l.len;for(let c=ro(i,l.clock),u=i[c];c<i.length&&u.id.clock<a;u=i[++c]){let d=i[c];if(l.clock+l.len<=d.id.clock)break;d instanceof Ce&&d.deleted&&!d.keep&&n(d)&&d.gc(e,!1)}}}},AQ=(t,e)=>{t.clients.forEach((n,r)=>{let o=e.clients.get(r);for(let i=n.length-1;i>=0;i--){let s=n[i],l=Nr(o.length-1,1+ro(o,s.clock+s.len-1));for(let a=l,c=o[a];a>0&&c.id.clock>=s.clock;c=o[a])a-=1+M0(o,a)}})};var aP=(t,e)=>{if(e<t.length){let n=t[e],r=n.doc,o=r.store,i=n.deleteSet,s=n._mergeStructs;try{cT(i),n.afterState=Gh(n.doc.store),r.emit("beforeObserverCalls",[n,r]);let l=[];n.changed.forEach((a,c)=>l.push(()=>{(c._item===null||!c._item.deleted)&&c._callObserver(n,a)})),l.push(()=>{n.changedParentTypes.forEach((a,c)=>{c._dEH.l.length>0&&(c._item===null||!c._item.deleted)&&l.push(()=>{a=a.filter(u=>u.target._item===null||!u.target._item.deleted),a.forEach(u=>{u.currentTarget=c,u._path=null}),a.sort((u,d)=>u.path.length-d.path.length),oP(c._dEH,a,n)})}),l.push(()=>r.emit("afterTransaction",[n,r])),l.push(()=>{n._needFormattingCleanup&&FQ(n)})}),Ah(l,[])}finally{r.gc&&TQ(i,o,r.gcFilter),AQ(i,o),n.afterState.forEach((u,d)=>{let f=n.beforeState.get(d)||0;if(f!==u){let h=o.clients.get(d),p=or(ro(h,f),1);for(let m=h.length-1;m>=p;)m-=1+M0(h,m)}});for(let u=s.length-1;u>=0;u--){let{client:d,clock:f}=s[u].id,h=o.clients.get(d),p=ro(h,f);p+1<h.length&&M0(h,p+1)>1||p>0&&M0(h,p)}if(!n.local&&n.afterState.get(r.clientID)!==n.beforeState.get(r.clientID)&&(LB(Zu,Ih,"[yjs] ",Lh,zh,"Changed the client-id because another client seems to be using it."),r.clientID=nP()),r.emit("afterTransactionCleanup",[n,r]),r._observers.has("update")){let u=new _a;qB(u,n)&&r.emit("update",[u.toUint8Array(),n.origin,r,n])}if(r._observers.has("updateV2")){let u=new Wi;qB(u,n)&&r.emit("updateV2",[u.toUint8Array(),n.origin,r,n])}let{subdocsAdded:l,subdocsLoaded:a,subdocsRemoved:c}=n;(l.size>0||c.size>0||a.size>0)&&(l.forEach(u=>{u.clientID=r.clientID,u.collectionid==null&&(u.collectionid=r.collectionid),r.subdocs.add(u)}),c.forEach(u=>r.subdocs.delete(u)),r.emit("subdocs",[{loaded:a,added:l,removed:c},r,n]),c.forEach(u=>u.destroy())),t.length<=e+1?(r._transactionCleanups=[],r.emit("afterAllTransactions",[r,t])):aP(t,e+1)}}},Fe=(t,e,n=null,r=!0)=>{let o=t._transactionCleanups,i=!1,s=null;t._transaction===null&&(i=!0,t._transaction=new ZE(t,n,r),o.push(t._transaction),o.length===1&&t.emit("beforeAllTransactions",[t]),t.emit("beforeTransaction",[t._transaction,t]));try{s=e(t._transaction)}finally{if(i){let l=t._transaction===o[0];t._transaction=null,l&&aP(o,0)}}return s},eT=class{constructor(e,n){this.insertions=n,this.deletions=e,this.meta=new Map}},GB=(t,e,n)=>{Xi(t,n.deletions,r=>{r instanceof Ce&&e.scope.some(o=>o===t.doc||td(o,r))&&vT(r,!1)})},XB=(t,e,n)=>{let r=null,o=t.doc,i=t.scope;Fe(o,l=>{for(;e.length>0&&t.currStackItem===null;){let a=o.store,c=e.pop(),u=new Set,d=[],f=!1;Xi(l,c.insertions,h=>{if(h instanceof Ce){if(h.redone!==null){let{item:p,diff:m}=lT(a,h.id);m>0&&(p=sr(l,X(p.id.client,p.id.clock+m))),h=p}!h.deleted&&i.some(p=>p===l.doc||td(p,h))&&d.push(h)}}),Xi(l,c.deletions,h=>{h instanceof Ce&&i.some(p=>p===l.doc||td(p,h))&&!za(c.insertions,h.id)&&u.add(h)}),u.forEach(h=>{f=AP(l,h,u,c.insertions,t.ignoreRemoteMapChanges,t)!==null||f});for(let h=d.length-1;h>=0;h--){let p=d[h];t.deleteFilter(p)&&(p.delete(l),f=!0)}t.currStackItem=f?c:null}l.changed.forEach((a,c)=>{a.has(null)&&c._searchMarker&&(c._searchMarker.length=0)}),r=l},t);let s=t.currStackItem;if(s!=null){let l=r.changedParentTypes;t.emit("stack-item-popped",[{stackItem:s,type:n,changedParentTypes:l,origin:t},t]),t.currStackItem=null}return s},rd=class extends yh{constructor(e,{captureTimeout:n=500,captureTransaction:r=a=>!0,deleteFilter:o=()=>!0,trackedOrigins:i=new Set([null]),ignoreRemoteMapChanges:s=!1,doc:l=Yi(e)?e[0].doc:e instanceof ur?e:e.doc}={}){super(),this.scope=[],this.doc=l,this.addToScope(e),this.deleteFilter=o,i.add(this),this.trackedOrigins=i,this.captureTransaction=r,this.undoStack=[],this.redoStack=[],this.undoing=!1,this.redoing=!1,this.currStackItem=null,this.lastChange=0,this.ignoreRemoteMapChanges=s,this.captureTimeout=n,this.afterTransactionHandler=a=>{if(!this.captureTransaction(a)||!this.scope.some(y=>a.changedParentTypes.has(y)||y===this.doc)||!this.trackedOrigins.has(a.origin)&&(!a.origin||!this.trackedOrigins.has(a.origin.constructor)))return;let c=this.undoing,u=this.redoing,d=c?this.redoStack:this.undoStack;c?this.stopCapturing():u||this.clear(!1,!0);let f=new vl;a.afterState.forEach((y,g)=>{let v=a.beforeState.get(g)||0,b=y-v;b>0&&Bh(f,g,v,b)});let h=Ki(),p=!1;if(this.lastChange>0&&h-this.lastChange<this.captureTimeout&&d.length>0&&!c&&!u){let y=d[d.length-1];y.deletions=KE([y.deletions,a.deleteSet]),y.insertions=KE([y.insertions,f])}else d.push(new eT(a.deleteSet,f)),p=!0;!c&&!u&&(this.lastChange=h),Xi(a,a.deleteSet,y=>{y instanceof Ce&&this.scope.some(g=>g===a.doc||td(g,y))&&vT(y,!0)});let m=[{stackItem:d[d.length-1],origin:a.origin,type:c?"redo":"undo",changedParentTypes:a.changedParentTypes},this];p?this.emit("stack-item-added",m):this.emit("stack-item-updated",m)},this.destroy=this.destroy.bind(this),this.doc.on("afterTransaction",this.afterTransactionHandler),this.doc.on("destroy",this.destroy)}addToScope(e){let n=new Set(this.scope);e=Yi(e)?e:[e],e.forEach(r=>{n.has(r)||(n.add(r),(r instanceof Ze?r.doc!==this.doc:r!==this.doc)&&YE("[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(o=>GB(r,this,o)),this.undoStack=[]),n&&(this.redoStack.forEach(o=>GB(r,this,o)),this.redoStack=[]),this.emit("stack-cleared",[{undoStackCleared:e,redoStackCleared:n}])})}stopCapturing(){this.lastChange=0}undo(){this.undoing=!0;let e;try{e=XB(this,this.undoStack,"undo")}finally{this.undoing=!1}return e}redo(){this.redoing=!0;let e;try{e=XB(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),this.doc.off("destroy",this.destroy),super.destroy()}};function*kQ(t){let e=Q(t.restDecoder);for(let n=0;n<e;n++){let r=Q(t.restDecoder),o=t.readClient(),i=Q(t.restDecoder);for(let s=0;s<r;s++){let l=t.readInfo();if(l===10){let a=Q(t.restDecoder);yield new ar(X(o,i),a),i+=a}else if((31&l)!==0){let a=(l&192)===0,c=new Ce(X(o,i),null,(l&128)===128?t.readLeftID():null,null,(l&64)===64?t.readRightID():null,a?t.readParentInfo()?t.readString():t.readLeftID():null,a&&(l&32)===32?t.readString():null,kP(t,l));yield c,i+=c.length}else{let a=t.readLen();yield new lr(X(o,i),a),i+=a}}}}var Ph=class{constructor(e,n){this.gen=kQ(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===ar);return this.curr}};var Hh=class{constructor(e){this.currClient=0,this.startClock=0,this.written=0,this.encoder=e,this.clientStructs=[]}},MQ=t=>L0(t,D0,_a);var RQ=(t,e)=>{if(t.constructor===lr){let{client:n,clock:r}=t.id;return new lr(X(n,r+e),t.length-e)}else if(t.constructor===ar){let{client:n,clock:r}=t.id;return new ar(X(n,r+e),t.length-e)}else{let n=t,{client:r,clock:o}=n.id;return new Ce(X(r,o+e),null,X(r,o+e-1),null,n.rightOrigin,n.parent,n.parentSub,n.content.splice(e))}},L0=(t,e=bl,n=Wi)=>{if(t.length===1)return t[0];let r=t.map(u=>new e(So(u))),o=r.map(u=>new Ph(u,!0)),i=null,s=new n,l=new Hh(s);for(;o=o.filter(f=>f.curr!==null),o.sort((f,h)=>{if(f.curr.id.client===h.curr.id.client){let p=f.curr.id.clock-h.curr.id.clock;return p===0?f.curr.constructor===h.curr.constructor?0:f.curr.constructor===ar?1:-1:p}else return h.curr.id.client-f.curr.id.client}),o.length!==0;){let u=o[0],d=u.curr.id.client;if(i!==null){let f=u.curr,h=!1;for(;f!==null&&f.id.clock+f.length<=i.struct.id.clock+i.struct.length&&f.id.client>=i.struct.id.client;)f=u.next(),h=!0;if(f===null||f.id.client!==d||h&&f.id.clock>i.struct.id.clock+i.struct.length)continue;if(d!==i.struct.id.client)pl(l,i.struct,i.offset),i={struct:f,offset:0},u.next();else if(i.struct.id.clock+i.struct.length<f.id.clock)if(i.struct.constructor===ar)i.struct.length=f.id.clock+f.length-i.struct.id.clock;else{pl(l,i.struct,i.offset);let p=f.id.clock-i.struct.id.clock-i.struct.length;i={struct:new ar(X(d,i.struct.id.clock+i.struct.length),p),offset:0}}else{let p=i.struct.id.clock+i.struct.length-f.id.clock;p>0&&(i.struct.constructor===ar?i.struct.length-=p:f=RQ(f,p)),i.struct.mergeWith(f)||(pl(l,i.struct,i.offset),i={struct:f,offset:0},u.next())}}else i={struct:u.curr,offset:0},u.next();for(let f=u.curr;f!==null&&f.id.client===d&&f.id.clock===i.struct.id.clock+i.struct.length&&f.constructor!==ar;f=u.next())pl(l,i.struct,i.offset),i={struct:f,offset:0}}i!==null&&(pl(l,i.struct,i.offset),i=null),hT(l);let a=r.map(u=>uT(u)),c=KE(a);return ld(s,c),s.toUint8Array()},OQ=(t,e,n=bl,r=Wi)=>{let o=j0(e),i=new r,s=new Hh(i),l=new n(So(t)),a=new Ph(l,!1);for(;a.curr;){let u=a.curr,d=u.id.client,f=o.get(d)||0;if(a.curr.constructor===ar){a.next();continue}if(u.id.clock+u.length>f)for(pl(s,u,or(f-u.id.clock,0)),a.next();a.curr&&a.curr.id.client===d;)pl(s,a.curr,0),a.next();else for(;a.curr&&a.curr.id.client===d&&a.curr.id.clock+a.curr.length<=f;)a.next()}hT(s);let c=uT(l);return ld(i,c),i.toUint8Array()};var cP=t=>{t.written>0&&(t.clientStructs.push({written:t.written,restEncoder:tn(t.encoder.restEncoder)}),t.encoder.restEncoder=no(),t.written=0)},pl=(t,e,n)=>{t.written>0&&t.currClient!==e.id.client&&cP(t),t.written===0&&(t.currClient=e.id.client,t.encoder.writeClient(e.id.client),J(t.encoder.restEncoder,e.id.clock+n)),e.write(t.encoder,n),t.written++},hT=t=>{cP(t);let e=t.encoder.restEncoder;J(e,t.clientStructs.length);for(let n=0;n<t.clientStructs.length;n++){let r=t.clientStructs[n];J(e,r.written),Sh(e,r.restEncoder)}},DQ=(t,e,n,r)=>{let o=new n(So(t)),i=new Ph(o,!1),s=new r,l=new Hh(s);for(let c=i.curr;c!==null;c=i.next())pl(l,e(c),0);hT(l);let a=uT(o);return ld(s,a),s.toUint8Array()};var NQ=t=>DQ(t,uB,bl,_a),WB="You must not compute changes after the event-handler fired.",od=class{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=_Q(this.currentTarget,this.target))}deletes(e){return za(this.transaction.deleteSet,e.id)}get keys(){if(this._keys===null){if(this.transaction.doc._transactionCleanups.length===0)throw _r(WB);let e=new Map,n=this.target;this.transaction.changed.get(n).forEach(o=>{if(o!==null){let i=n._map.get(o),s,l;if(this.adds(i)){let a=i.left;for(;a!==null&&this.adds(a);)a=a.left;if(this.deletes(i))if(a!==null&&this.deletes(a))s="delete",l=Xy(a.content.getContent());else return;else a!==null&&this.deletes(a)?(s="update",l=Xy(a.content.getContent())):(s="add",l=void 0)}else if(this.deletes(i))s="delete",l=Xy(i.content.getContent());else return;e.set(o,{action:s,oldValue:l})}}),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 _r(WB);let n=this.target,r=to(),o=to(),i=[];if(e={added:r,deleted:o,delta:i,keys:this.keys},this.transaction.changed.get(n).has(null)){let l=null,a=()=>{l&&i.push(l)};for(let c=n._start;c!==null;c=c.right)c.deleted?this.deletes(c)&&!this.adds(c)&&((l===null||l.delete===void 0)&&(a(),l={delete:0}),l.delete+=c.length,o.add(c)):this.adds(c)?((l===null||l.insert===void 0)&&(a(),l={insert:[]}),l.insert=l.insert.concat(c.content.getContent()),r.add(c)):((l===null||l.retain===void 0)&&(a(),l={retain:0}),l.retain+=c.length);l!==null&&l.retain===void 0&&a()}this._changes=e}return e}},_Q=(t,e)=>{let n=[];for(;e._item!==null&&e!==t;){if(e._item.parentSub!==null)n.unshift(e._item.parentSub);else{let r=0,o=e._item.parent._start;for(;o!==e._item&&o!==null;)!o.deleted&&o.countable&&(r+=o.length),o=o.right;n.unshift(r)}e=e._item.parent}return n},Dn=()=>{YE("Invalid access: Add Yjs type to a document before reading data.")},uP=80,pT=0,tT=class{constructor(e,n){e.marker=!0,this.p=e,this.index=n,this.timestamp=pT++}},IQ=t=>{t.timestamp=pT++},dP=(t,e,n)=>{t.p.marker=!1,t.p=e,e.marker=!0,t.index=n,t.timestamp=pT++},LQ=(t,e,n)=>{if(t.length>=uP){let r=t.reduce((o,i)=>o.timestamp<i.timestamp?o:i);return dP(r,e,n),r}else{let r=new tT(e,n);return t.push(r),r}},K0=(t,e)=>{if(t._start===null||e===0||t._searchMarker===null)return null;let n=t._searchMarker.length===0?null:t._searchMarker.reduce((i,s)=>Aa(e-i.index)<Aa(e-s.index)?i:s),r=t._start,o=0;for(n!==null&&(r=n.p,o=n.index,IQ(n));r.right!==null&&o<e;){if(!r.deleted&&r.countable){if(e<o+r.length)break;o+=r.length}r=r.right}for(;r.left!==null&&o>e;)r=r.left,!r.deleted&&r.countable&&(o-=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&&(o-=r.length);return n!==null&&Aa(n.index-o)<r.parent.length/uP?(dP(n,r,o),n):LQ(t._searchMarker,r,o)},Vh=(t,e,n)=>{for(let r=t.length-1;r>=0;r--){let o=t[r];if(n>0){let i=o.p;for(i.marker=!1;i&&(i.deleted||!i.countable);)i=i.left,i&&!i.deleted&&i.countable&&(o.index-=i.length);if(i===null||i.marker===!0){t.splice(r,1);continue}o.p=i,i.marker=!0}(e<o.index||n>0&&e===o.index)&&(o.index=or(e,o.index+n))}};var G0=(t,e,n)=>{let r=t,o=e.changedParentTypes;for(;Dr(o,t,()=>[]).push(n),t._item!==null;)t=t._item.parent;oP(r._eH,n,e)},Ze=class{constructor(){this._item=null,this._map=new Map,this._start=null,this.doc=null,this._length=0,this._eH=jB(),this._dEH=jB(),this._searchMarker=null}get parent(){return this._item?this._item.parent:null}_integrate(e,n){this.doc=e,this._item=n}_copy(){throw $n()}clone(){throw $n()}_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){FB(this._eH,e)}observeDeep(e){FB(this._dEH,e)}unobserve(e){$B(this._eH,e)}unobserveDeep(e){$B(this._dEH,e)}toJSON(){}},fP=(t,e,n)=>{t.doc??Dn(),e<0&&(e=t._length+e),n<0&&(n=t._length+n);let r=n-e,o=[],i=t._start;for(;i!==null&&r>0;){if(i.countable&&!i.deleted){let s=i.content.getContent();if(s.length<=e)e-=s.length;else{for(let l=e;l<s.length&&r>0;l++)o.push(s[l]),r--;e=0}}i=i.right}return o},hP=t=>{t.doc??Dn();let e=[],n=t._start;for(;n!==null;){if(n.countable&&!n.deleted){let r=n.content.getContent();for(let o=0;o<r.length;o++)e.push(r[o])}n=n.right}return e},mT=(t,e)=>{let n=[],r=t._start;for(;r!==null;){if(r.countable&&Na(r,e)){let o=r.content.getContent();for(let i=0;i<o.length;i++)n.push(o[i])}r=r.right}return n},jh=(t,e)=>{let n=0,r=t._start;for(t.doc??Dn();r!==null;){if(r.countable&&!r.deleted){let o=r.content.getContent();for(let i=0;i<o.length;i++)e(o[i],n++,t)}r=r.right}},pP=(t,e)=>{let n=[];return jh(t,(r,o)=>{n.push(e(r,o,t))}),n},zQ=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}let o=n[r++];return n.length<=r&&(n=null),{done:!1,value:o}}}},mP=(t,e)=>{t.doc??Dn();let n=K0(t,e),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}},z0=(t,e,n,r)=>{let o=n,i=t.doc,s=i.clientID,l=i.store,a=n===null?e._start:n.right,c=[],u=()=>{c.length>0&&(o=new Ce(X(s,at(l,s)),o,o&&o.lastId,a,a&&a.id,e,null,new sd(c)),o.integrate(t,0),c=[])};r.forEach(d=>{if(d===null)c.push(d);else switch(d.constructor){case Number:case Object:case Boolean:case Array:case String:c.push(d);break;default:switch(u(),d.constructor){case Uint8Array:case ArrayBuffer:o=new Ce(X(s,at(l,s)),o,o&&o.lastId,a,a&&a.id,e,null,new Yh(new Uint8Array(d))),o.integrate(t,0);break;case ur:o=new Ce(X(s,at(l,s)),o,o&&o.lastId,a,a&&a.id,e,null,new qh(d)),o.integrate(t,0);break;default:if(d instanceof Ze)o=new Ce(X(s,at(l,s)),o,o&&o.lastId,a,a&&a.id,e,null,new nn(d)),o.integrate(t,0);else throw new Error("Unexpected content type in insert operation")}}}),u()},gP=()=>_r("Length exceeded!"),yP=(t,e,n,r)=>{if(n>e._length)throw gP();if(n===0)return e._searchMarker&&Vh(e._searchMarker,n,r.length),z0(t,e,null,r);let o=n,i=K0(e,n),s=e._start;for(i!==null&&(s=i.p,n-=i.index,n===0&&(s=s.prev,n+=s&&s.countable&&!s.deleted?s.length:0));s!==null;s=s.right)if(!s.deleted&&s.countable){if(n<=s.length){n<s.length&&sr(t,X(s.id.client,s.id.clock+n));break}n-=s.length}return e._searchMarker&&Vh(e._searchMarker,o,r.length),z0(t,e,s,r)},UQ=(t,e,n)=>{let o=(e._searchMarker||[]).reduce((i,s)=>s.index>i.index?s:i,{index:0,p:e._start}).p;if(o)for(;o.right;)o=o.right;return z0(t,e,o,n)},vP=(t,e,n,r)=>{if(r===0)return;let o=n,i=r,s=K0(e,n),l=e._start;for(s!==null&&(l=s.p,n-=s.index);l!==null&&n>0;l=l.right)!l.deleted&&l.countable&&(n<l.length&&sr(t,X(l.id.client,l.id.clock+n)),n-=l.length);for(;r>0&&l!==null;)l.deleted||(r<l.length&&sr(t,X(l.id.client,l.id.clock+r)),l.delete(t),r-=l.length),l=l.right;if(r>0)throw gP();e._searchMarker&&Vh(e._searchMarker,o,-i+r)},U0=(t,e,n)=>{let r=e._map.get(n);r!==void 0&&r.delete(t)},gT=(t,e,n,r)=>{let o=e._map.get(n)||null,i=t.doc,s=i.clientID,l;if(r==null)l=new sd([r]);else switch(r.constructor){case Number:case Object:case Boolean:case Array:case String:case Date:case BigInt:l=new sd([r]);break;case Uint8Array:l=new Yh(r);break;case ur:l=new qh(r);break;default:if(r instanceof Ze)l=new nn(r);else throw new Error("Unexpected content type")}new Ce(X(s,at(i.store,s)),o,o&&o.lastId,null,null,e,n,l).integrate(t,0)},yT=(t,e)=>{t.doc??Dn();let n=t._map.get(e);return n!==void 0&&!n.deleted?n.content.getContent()[n.length-1]:void 0},bP=t=>{let e={};return t.doc??Dn(),t._map.forEach((n,r)=>{n.deleted||(e[r]=n.content.getContent()[n.length-1])}),e},wP=(t,e)=>{t.doc??Dn();let n=t._map.get(e);return n!==void 0&&!n.deleted};var BQ=(t,e)=>{let n={};return t._map.forEach((r,o)=>{let i=r;for(;i!==null&&(!e.sv.has(i.id.client)||i.id.clock>=(e.sv.get(i.id.client)||0));)i=i.left;i!==null&&Na(i,e)&&(n[o]=i.content.getContent()[i.length-1])}),n},A0=t=>(t.doc??Dn(),BB(t._map.entries(),e=>!e[1].deleted)),nT=class extends od{},id=class t extends Ze{constructor(){super(),this._prelimContent=[],this._searchMarker=[]}static from(e){let n=new t;return n.push(e),n}_integrate(e,n){super._integrate(e,n),this.insert(0,this._prelimContent),this._prelimContent=null}_copy(){return new t}clone(){let e=new t;return e.insert(0,this.toArray().map(n=>n instanceof Ze?n.clone():n)),e}get length(){return this.doc??Dn(),this._length}_callObserver(e,n){super._callObserver(e,n),G0(this,e,new nT(this,e))}insert(e,n){this.doc!==null?Fe(this.doc,r=>{yP(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}push(e){this.doc!==null?Fe(this.doc,n=>{UQ(n,this,e)}):this._prelimContent.push(...e)}unshift(e){this.insert(0,e)}delete(e,n=1){this.doc!==null?Fe(this.doc,r=>{vP(r,this,e,n)}):this._prelimContent.splice(e,n)}get(e){return mP(this,e)}toArray(){return hP(this)}slice(e=0,n=this.length){return fP(this,e,n)}toJSON(){return this.map(e=>e instanceof Ze?e.toJSON():e)}map(e){return pP(this,e)}forEach(e){jh(this,e)}[Symbol.iterator](){return zQ(this)}_write(e){e.writeTypeRef(sZ)}},PQ=t=>new id,rT=class extends od{constructor(e,n,r){super(e,n),this.keysChanged=r}},Ia=class t extends Ze{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,o)=>{this.set(o,r)}),this._prelimContent=null}_copy(){return new t}clone(){let e=new t;return this.forEach((n,r)=>{e.set(r,n instanceof Ze?n.clone():n)}),e}_callObserver(e,n){G0(this,e,new rT(this,e,n))}toJSON(){this.doc??Dn();let e={};return this._map.forEach((n,r)=>{if(!n.deleted){let o=n.content.getContent()[n.length-1];e[r]=o instanceof Ze?o.toJSON():o}}),e}get size(){return[...A0(this)].length}keys(){return E0(A0(this),e=>e[0])}values(){return E0(A0(this),e=>e[1].content.getContent()[e[1].length-1])}entries(){return E0(A0(this),e=>[e[0],e[1].content.getContent()[e[1].length-1]])}forEach(e){this.doc??Dn(),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?Fe(this.doc,n=>{U0(n,this,e)}):this._prelimContent.delete(e)}set(e,n){return this.doc!==null?Fe(this.doc,r=>{gT(r,this,e,n)}):this._prelimContent.set(e,n),n}get(e){return yT(this,e)}has(e){return wP(this,e)}clear(){this.doc!==null?Fe(this.doc,e=>{this.forEach(function(n,r,o){U0(e,o,r)})}):this._prelimContent.clear()}_write(e){e.writeTypeRef(lZ)}},HQ=t=>new Ia,ml=(t,e)=>t===e||typeof t=="object"&&typeof e=="object"&&t&&e&&AE(t,e),Fh=class{constructor(e,n,r,o){this.left=e,this.right=n,this.index=r,this.currentAttributes=o}forward(){this.right===null&&ft(),this.right.content.constructor===wt?this.right.deleted||ud(this.currentAttributes,this.right.content):this.right.deleted||(this.index+=this.right.length),this.left=this.right,this.right=this.right.right}},JB=(t,e,n)=>{for(;e.right!==null&&n>0;)e.right.content.constructor===wt?e.right.deleted||ud(e.currentAttributes,e.right.content):e.right.deleted||(n<e.right.length&&sr(t,X(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},k0=(t,e,n,r)=>{let o=new Map,i=r?K0(e,n):null;if(i){let s=new Fh(i.p.left,i.p,i.index,o);return JB(t,s,n-i.index)}else{let s=new Fh(null,e._start,0,o);return JB(t,s,n)}},SP=(t,e,n,r)=>{for(;n.right!==null&&(n.right.deleted===!0||n.right.content.constructor===wt&&ml(r.get(n.right.content.key),n.right.content.value));)n.right.deleted||r.delete(n.right.content.key),n.forward();let o=t.doc,i=o.clientID;r.forEach((s,l)=>{let a=n.left,c=n.right,u=new Ce(X(i,at(o.store,i)),a,a&&a.lastId,c,c&&c.id,e,null,new wt(l,s));u.integrate(t,0),n.right=u,n.forward()})},ud=(t,e)=>{let{key:n,value:r}=e;r===null?t.delete(n):t.set(n,r)},xP=(t,e)=>{for(;t.right!==null;){if(!(t.right.deleted||t.right.content.constructor===wt&&ml(e[t.right.content.key]??null,t.right.content.value)))break;t.forward()}},CP=(t,e,n,r)=>{let o=t.doc,i=o.clientID,s=new Map;for(let l in r){let a=r[l],c=n.currentAttributes.get(l)??null;if(!ml(c,a)){s.set(l,c);let{left:u,right:d}=n;n.right=new Ce(X(i,at(o.store,i)),u,u&&u.lastId,d,d&&d.id,e,null,new wt(l,a)),n.right.integrate(t,0),n.forward()}}return s},qE=(t,e,n,r,o)=>{n.currentAttributes.forEach((f,h)=>{o[h]===void 0&&(o[h]=null)});let i=t.doc,s=i.clientID;xP(n,o);let l=CP(t,e,n,o),a=r.constructor===String?new Lr(r):r instanceof Ze?new nn(r):new La(r),{left:c,right:u,index:d}=n;e._searchMarker&&Vh(e._searchMarker,n.index,a.getLength()),u=new Ce(X(s,at(i.store,s)),c,c&&c.lastId,u,u&&u.id,e,null,a),u.integrate(t,0),n.right=u,n.index=d,n.forward(),SP(t,e,n,l)},QB=(t,e,n,r,o)=>{let i=t.doc,s=i.clientID;xP(n,o);let l=CP(t,e,n,o);e:for(;n.right!==null&&(r>0||l.size>0&&(n.right.deleted||n.right.content.constructor===wt));){if(!n.right.deleted)switch(n.right.content.constructor){case wt:{let{key:a,value:c}=n.right.content,u=o[a];if(u!==void 0){if(ml(u,c))l.delete(a);else{if(r===0)break e;l.set(a,c)}n.right.delete(t)}else n.currentAttributes.set(a,c);break}default:r<n.right.length&&sr(t,X(n.right.id.client,n.right.id.clock+r)),r-=n.right.length;break}n.forward()}if(r>0){let a="";for(;r>0;r--)a+=`
|
|
156
|
+
`;n.right=new Ce(X(s,at(i.store,s)),n.left,n.left&&n.left.lastId,n.right,n.right&&n.right.id,e,null,new Lr(a)),n.right.integrate(t,0),n.forward()}SP(t,e,n,l)},EP=(t,e,n,r,o)=>{let i=e,s=Zt();for(;i&&(!i.countable||i.deleted);){if(!i.deleted&&i.content.constructor===wt){let c=i.content;s.set(c.key,c)}i=i.right}let l=0,a=!1;for(;e!==i;){if(n===e&&(a=!0),!e.deleted){let c=e.content;if(c.constructor===wt){let{key:u,value:d}=c,f=r.get(u)??null;(s.get(u)!==c||f===d)&&(e.delete(t),l++,!a&&(o.get(u)??null)===d&&f!==d&&(f===null?o.delete(u):o.set(u,f))),!a&&!e.deleted&&ud(o,c)}}e=e.right}return l},VQ=(t,e)=>{for(;e&&e.right&&(e.right.deleted||!e.right.countable);)e=e.right;let n=new Set;for(;e&&(e.deleted||!e.countable);){if(!e.deleted&&e.content.constructor===wt){let r=e.content.key;n.has(r)?e.delete(t):n.add(r)}e=e.left}},jQ=t=>{let e=0;return Fe(t.doc,n=>{let r=t._start,o=t._start,i=Zt(),s=Ky(i);for(;o;)o.deleted===!1&&(o.content.constructor===wt?ud(s,o.content):(e+=EP(n,r,o,i,s),i=Ky(s),r=o)),o=o.right}),e},FQ=t=>{let e=new Set,n=t.doc;for(let[r,o]of t.afterState.entries()){let i=t.beforeState.get(r)||0;o!==i&&lP(t,n.store.clients.get(r),i,o,s=>{!s.deleted&&s.content.constructor===wt&&s.constructor!==lr&&e.add(s.parent)})}Fe(n,r=>{Xi(t,t.deleteSet,o=>{if(o instanceof lr||!o.parent._hasFormatting||e.has(o.parent))return;let i=o.parent;o.content.constructor===wt?e.add(i):VQ(r,o)});for(let o of e)jQ(o)})},ZB=(t,e,n)=>{let r=n,o=Ky(e.currentAttributes),i=e.right;for(;n>0&&e.right!==null;){if(e.right.deleted===!1)switch(e.right.content.constructor){case nn:case La:case Lr:n<e.right.length&&sr(t,X(e.right.id.client,e.right.id.clock+n)),n-=e.right.length,e.right.delete(t);break}e.forward()}i&&EP(t,i,e.right,o,e.currentAttributes);let s=(e.left||e.right).parent;return s._searchMarker&&Vh(s._searchMarker,e.index,-r+n),e},oT=class extends od{constructor(e,n,r){super(e,n),this.childListChanged=!1,this.keysChanged=new Set,r.forEach(o=>{o===null?this.childListChanged=!0:this.keysChanged.add(o)})}get changes(){if(this._changes===null){let 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){let e=this.target.doc,n=[];Fe(e,r=>{let o=new Map,i=new Map,s=this.target._start,l=null,a={},c="",u=0,d=0,f=()=>{if(l!==null){let h=null;switch(l){case"delete":d>0&&(h={delete:d}),d=0;break;case"insert":(typeof c=="object"||c.length>0)&&(h={insert:c},o.size>0&&(h.attributes={},o.forEach((p,m)=>{p!==null&&(h.attributes[m]=p)}))),c="";break;case"retain":u>0&&(h={retain:u},cB(a)||(h.attributes=lB({},a))),u=0;break}h&&n.push(h),l=null}};for(;s!==null;){switch(s.content.constructor){case nn:case La:this.adds(s)?this.deletes(s)||(f(),l="insert",c=s.content.getContent()[0],f()):this.deletes(s)?(l!=="delete"&&(f(),l="delete"),d+=1):s.deleted||(l!=="retain"&&(f(),l="retain"),u+=1);break;case Lr:this.adds(s)?this.deletes(s)||(l!=="insert"&&(f(),l="insert"),c+=s.content.str):this.deletes(s)?(l!=="delete"&&(f(),l="delete"),d+=s.length):s.deleted||(l!=="retain"&&(f(),l="retain"),u+=s.length);break;case wt:{let{key:h,value:p}=s.content;if(this.adds(s)){if(!this.deletes(s)){let m=o.get(h)??null;ml(m,p)?p!==null&&s.delete(r):(l==="retain"&&f(),ml(p,i.get(h)??null)?delete a[h]:a[h]=p)}}else if(this.deletes(s)){i.set(h,p);let m=o.get(h)??null;ml(m,p)||(l==="retain"&&f(),a[h]=m)}else if(!s.deleted){i.set(h,p);let m=a[h];m!==void 0&&(ml(m,p)?m!==null&&s.delete(r):(l==="retain"&&f(),p===null?delete a[h]:a[h]=p))}s.deleted||(l==="insert"&&f(),ud(o,s.content));break}}s=s.right}for(f();n.length>0;){let h=n[n.length-1];if(h.retain!==void 0&&h.attributes===void 0)n.pop();else break}}),this._delta=n}return this._delta}},Ir=class t extends Ze{constructor(e){super(),this._pending=e!==void 0?[()=>this.insert(0,e)]:[],this._searchMarker=[],this._hasFormatting=!1}get length(){return this.doc??Dn(),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 t}clone(){let e=new t;return e.applyDelta(this.toDelta()),e}_callObserver(e,n){super._callObserver(e,n);let r=new oT(this,e,n);G0(this,e,r),!e.local&&this._hasFormatting&&(e._needFormattingCleanup=!0)}toString(){this.doc??Dn();let e="",n=this._start;for(;n!==null;)!n.deleted&&n.countable&&n.content.constructor===Lr&&(e+=n.content.str),n=n.right;return e}toJSON(){return this.toString()}applyDelta(e,{sanitize:n=!0}={}){this.doc!==null?Fe(this.doc,r=>{let o=new Fh(null,this._start,0,new Map);for(let i=0;i<e.length;i++){let s=e[i];if(s.insert!==void 0){let l=!n&&typeof s.insert=="string"&&i===e.length-1&&o.right===null&&s.insert.slice(-1)===`
|
|
157
|
+
`?s.insert.slice(0,-1):s.insert;(typeof l!="string"||l.length>0)&&qE(r,this,o,l,s.attributes||{})}else s.retain!==void 0?QB(r,this,o,s.retain,s.attributes||{}):s.delete!==void 0&&ZB(r,o,s.delete)}}):this._pending.push(()=>this.applyDelta(e))}toDelta(e,n,r){this.doc??Dn();let o=[],i=new Map,s=this.doc,l="",a=this._start;function c(){if(l.length>0){let d={},f=!1;i.forEach((p,m)=>{f=!0,d[m]=p});let h={insert:l};f&&(h.attributes=d),o.push(h),l=""}}let u=()=>{for(;a!==null;){if(Na(a,e)||n!==void 0&&Na(a,n))switch(a.content.constructor){case Lr:{let d=i.get("ychange");e!==void 0&&!Na(a,e)?(d===void 0||d.user!==a.id.client||d.type!=="removed")&&(c(),i.set("ychange",r?r("removed",a.id):{type:"removed"})):n!==void 0&&!Na(a,n)?(d===void 0||d.user!==a.id.client||d.type!=="added")&&(c(),i.set("ychange",r?r("added",a.id):{type:"added"})):d!==void 0&&(c(),i.delete("ychange")),l+=a.content.str;break}case nn:case La:{c();let d={insert:a.content.getContent()[0]};if(i.size>0){let f={};d.attributes=f,i.forEach((h,p)=>{f[p]=h})}o.push(d);break}case wt:Na(a,e)&&(c(),ud(i,a.content));break}a=a.right}c()};return e||n?Fe(s,d=>{e&&JE(d,e),n&&JE(d,n),u()},"cleanup"):u(),o}insert(e,n,r){if(n.length<=0)return;let o=this.doc;o!==null?Fe(o,i=>{let s=k0(i,this,e,!r);r||(r={},s.currentAttributes.forEach((l,a)=>{r[a]=l})),qE(i,this,s,n,r)}):this._pending.push(()=>this.insert(e,n,r))}insertEmbed(e,n,r){let o=this.doc;o!==null?Fe(o,i=>{let s=k0(i,this,e,!r);qE(i,this,s,n,r||{})}):this._pending.push(()=>this.insertEmbed(e,n,r||{}))}delete(e,n){if(n===0)return;let r=this.doc;r!==null?Fe(r,o=>{ZB(o,k0(o,this,e,!0),n)}):this._pending.push(()=>this.delete(e,n))}format(e,n,r){if(n===0)return;let o=this.doc;o!==null?Fe(o,i=>{let s=k0(i,this,e,!1);s.right!==null&&QB(i,this,s,n,r)}):this._pending.push(()=>this.format(e,n,r))}removeAttribute(e){this.doc!==null?Fe(this.doc,n=>{U0(n,this,e)}):this._pending.push(()=>this.removeAttribute(e))}setAttribute(e,n){this.doc!==null?Fe(this.doc,r=>{gT(r,this,e,n)}):this._pending.push(()=>this.setAttribute(e,n))}getAttribute(e){return yT(this,e)}getAttributes(){return bP(this)}_write(e){e.writeTypeRef(aZ)}},$Q=t=>new Ir,Uh=class{constructor(e,n=()=>!0){this._filter=n,this._root=e,this._currentNode=e._start,this._firstCall=!0,e.doc??Dn()}[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===Ee||n.constructor===dr)&&n._start!==null)e=n._start;else for(;e!==null;){let 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})}},dr=class t extends Ze{constructor(){super(),this._prelimContent=[]}get firstChild(){let 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 t}clone(){let e=new t;return e.insert(0,this.toArray().map(n=>n instanceof Ze?n.clone():n)),e}get length(){return this.doc??Dn(),this._prelimContent===null?this._length:this._prelimContent.length}createTreeWalker(e){return new Uh(this,e)}querySelector(e){e=e.toUpperCase();let r=new Uh(this,o=>o.nodeName&&o.nodeName.toUpperCase()===e).next();return r.done?null:r.value}querySelectorAll(e){return e=e.toUpperCase(),bo(new Uh(this,n=>n.nodeName&&n.nodeName.toUpperCase()===e))}_callObserver(e,n){G0(this,e,new iT(this,n,e))}toString(){return pP(this,e=>e.toString()).join("")}toJSON(){return this.toString()}toDOM(e=document,n={},r){let o=e.createDocumentFragment();return r!==void 0&&r._createAssociation(o,this),jh(this,i=>{o.insertBefore(i.toDOM(e,n,r),null)}),o}insert(e,n){this.doc!==null?Fe(this.doc,r=>{yP(r,this,e,n)}):this._prelimContent.splice(e,0,...n)}insertAfter(e,n){if(this.doc!==null)Fe(this.doc,r=>{let o=e&&e instanceof Ze?e._item:e;z0(r,this,o,n)});else{let r=this._prelimContent,o=e===null?0:r.findIndex(i=>i===e)+1;if(o===0&&e!==null)throw _r("Reference item not found");r.splice(o,0,...n)}}delete(e,n=1){this.doc!==null?Fe(this.doc,r=>{vP(r,this,e,n)}):this._prelimContent.splice(e,n)}toArray(){return hP(this)}push(e){this.insert(this.length,e)}unshift(e){this.insert(0,e)}get(e){return mP(this,e)}slice(e=0,n=this.length){return fP(this,e,n)}forEach(e){jh(this,e)}_write(e){e.writeTypeRef(uZ)}},YQ=t=>new dr,Ee=class t extends dr{constructor(e="UNDEFINED"){super(),this.nodeName=e,this._prelimAttrs=new Map}get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_integrate(e,n){super._integrate(e,n),this._prelimAttrs.forEach((r,o)=>{this.setAttribute(o,r)}),this._prelimAttrs=null}_copy(){return new t(this.nodeName)}clone(){let e=new t(this.nodeName),n=this.getAttributes();return aB(n,(r,o)=>{e.setAttribute(o,r)}),e.insert(0,this.toArray().map(r=>r instanceof Ze?r.clone():r)),e}toString(){let e=this.getAttributes(),n=[],r=[];for(let l in e)r.push(l);r.sort();let o=r.length;for(let l=0;l<o;l++){let a=r[l];n.push(a+'="'+e[a]+'"')}let i=this.nodeName.toLocaleLowerCase(),s=n.length>0?" "+n.join(" "):"";return`<${i}${s}>${super.toString()}</${i}>`}removeAttribute(e){this.doc!==null?Fe(this.doc,n=>{U0(n,this,e)}):this._prelimAttrs.delete(e)}setAttribute(e,n){this.doc!==null?Fe(this.doc,r=>{gT(r,this,e,n)}):this._prelimAttrs.set(e,n)}getAttribute(e){return yT(this,e)}hasAttribute(e){return wP(this,e)}getAttributes(e){return e?BQ(this,e):bP(this)}toDOM(e=document,n={},r){let o=e.createElement(this.nodeName),i=this.getAttributes();for(let s in i){let l=i[s];typeof l=="string"&&o.setAttribute(s,l)}return jh(this,s=>{o.appendChild(s.toDOM(e,n,r))}),r!==void 0&&r._createAssociation(o,this),o}_write(e){e.writeTypeRef(cZ),e.writeKey(this.nodeName)}},qQ=t=>new Ee(t.readKey()),iT=class extends od{constructor(e,n,r){super(e,r),this.childListChanged=!1,this.attributesChanged=new Set,n.forEach(o=>{o===null?this.childListChanged=!0:this.attributesChanged.add(o)})}},wl=class t extends Ia{constructor(e){super(),this.hookName=e}_copy(){return new t(this.hookName)}clone(){let e=new t(this.hookName);return this.forEach((n,r)=>{e.set(r,n)}),e}toDOM(e=document,n={},r){let o=n[this.hookName],i;return o!==void 0?i=o.createDom(this):i=document.createElement(this.hookName),i.setAttribute("data-yjs-hook",this.hookName),r!==void 0&&r._createAssociation(i,this),i}_write(e){e.writeTypeRef(dZ),e.writeKey(this.hookName)}},KQ=t=>new wl(t.readKey()),et=class t extends Ir{get nextSibling(){let e=this._item?this._item.next:null;return e?e.content.type:null}get prevSibling(){let e=this._item?this._item.prev:null;return e?e.content.type:null}_copy(){return new t}clone(){let e=new t;return e.applyDelta(this.toDelta()),e}toDOM(e=document,n,r){let o=e.createTextNode(this.toString());return r!==void 0&&r._createAssociation(o,this),o}toString(){return this.toDelta().map(e=>{let n=[];for(let o in e.attributes){let i=[];for(let s in e.attributes[o])i.push({key:s,value:e.attributes[o][s]});i.sort((s,l)=>s.key<l.key?-1:1),n.push({nodeName:o,attrs:i})}n.sort((o,i)=>o.nodeName<i.nodeName?-1:1);let r="";for(let o=0;o<n.length;o++){let i=n[o];r+=`<${i.nodeName}`;for(let s=0;s<i.attrs.length;s++){let l=i.attrs[s];r+=` ${l.key}="${l.value}"`}r+=">"}r+=e.insert;for(let o=n.length-1;o>=0;o--)r+=`</${n[o].nodeName}>`;return r}).join("")}toJSON(){return this.toString()}_write(e){e.writeTypeRef(fZ)}},GQ=t=>new et,$h=class{constructor(e,n){this.id=e,this.length=n}get deleted(){throw $n()}mergeWith(e){return!1}write(e,n,r){throw $n()}integrate(e,n){throw $n()}},XQ=0,lr=class extends $h{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),sP(e.doc.store,this)}write(e,n){e.writeInfo(XQ),e.writeLen(this.length-n)}getMissing(e,n){return null}},Yh=class t{constructor(e){this.content=e}getLength(){return 1}getContent(){return[this.content]}isCountable(){return!0}copy(){return new t(this.content)}splice(e){throw $n()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeBuf(this.content)}getRef(){return 3}},WQ=t=>new Yh(t.readBuf()),B0=class t{constructor(e){this.len=e}getLength(){return this.len}getContent(){return[]}isCountable(){return!1}copy(){return new t(this.len)}splice(e){let n=new t(this.len-e);return this.len=e,n}mergeWith(e){return this.len+=e.len,!0}integrate(e,n){Bh(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}},JQ=t=>new B0(t.readLen()),TP=(t,e)=>new ur({guid:t,...e,shouldLoad:e.shouldLoad||e.autoLoad||!1}),qh=class t{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;let 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 t(TP(this.doc.guid,this.opts))}splice(e){throw $n()}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}},QQ=t=>new qh(TP(t.readString(),t.readAny())),La=class t{constructor(e){this.embed=e}getLength(){return 1}getContent(){return[this.embed]}isCountable(){return!0}copy(){return new t(this.embed)}splice(e){throw $n()}mergeWith(e){return!1}integrate(e,n){}delete(e){}gc(e){}write(e,n){e.writeJSON(this.embed)}getRef(){return 5}},ZQ=t=>new La(t.readJSON()),wt=class t{constructor(e,n){this.key=e,this.value=n}getLength(){return 1}getContent(){return[]}isCountable(){return!1}copy(){return new t(this.key,this.value)}splice(e){throw $n()}mergeWith(e){return!1}integrate(e,n){let 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}},eZ=t=>new wt(t.readKey(),t.readJSON()),sT=class t{constructor(e){this.arr=e}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new t(this.arr)}splice(e){let n=new t(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){let r=this.arr.length;e.writeLen(r-n);for(let o=n;o<r;o++){let i=this.arr[o];e.writeString(i===void 0?"undefined":JSON.stringify(i))}}getRef(){return 2}},tZ=t=>{let e=t.readLen(),n=[];for(let r=0;r<e;r++){let o=t.readString();o==="undefined"?n.push(void 0):n.push(JSON.parse(o))}return new sT(n)},nZ=kh("node_env")==="development",sd=class t{constructor(e){this.arr=e,nZ&&kE(e)}getLength(){return this.arr.length}getContent(){return this.arr}isCountable(){return!0}copy(){return new t(this.arr)}splice(e){let n=new t(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){let r=this.arr.length;e.writeLen(r-n);for(let o=n;o<r;o++){let i=this.arr[o];e.writeAny(i)}}getRef(){return 8}},rZ=t=>{let e=t.readLen(),n=[];for(let r=0;r<e;r++)n.push(t.readAny());return new sd(n)},Lr=class t{constructor(e){this.str=e}getLength(){return this.str.length}getContent(){return this.str.split("")}isCountable(){return!0}copy(){return new t(this.str)}splice(e){let n=new t(this.str.slice(e));this.str=this.str.slice(0,e);let r=this.str.charCodeAt(e-1);return r>=55296&&r<=56319&&(this.str=this.str.slice(0,e-1)+"\uFFFD",n.str="\uFFFD"+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}},oZ=t=>new Lr(t.readString()),iZ=[PQ,HQ,$Q,qQ,YQ,KQ,GQ],sZ=0,lZ=1,aZ=2,cZ=3,uZ=4,dZ=5,fZ=6,nn=class t{constructor(e){this.type=e}getLength(){return 1}getContent(){return[this.type]}isCountable(){return!0}copy(){return new t(this.type._copy())}splice(e){throw $n()}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}},hZ=t=>new nn(iZ[t.readTypeRef()](t)),lT=(t,e)=>{let n=e,r=0,o;do r>0&&(n=X(n.client,n.clock+r)),o=yl(t,n),r=n.clock-o.id.clock,n=o.redone;while(n!==null&&o instanceof Ce);return{item:o,diff:r}},vT=(t,e)=>{for(;t!==null&&t.keep!==e;)t.keep=e,t=t.parent._item},P0=(t,e,n)=>{let{client:r,clock:o}=e.id,i=new Ce(X(r,o+n),e,X(r,o+n-1),e.right,e.rightOrigin,e.parent,e.parentSub,e.content.splice(n));return e.deleted&&i.markDeleted(),e.keep&&(i.keep=!0),e.redone!==null&&(i.redone=X(e.redone.client,e.redone.clock+n)),e.right=i,i.right!==null&&(i.right.left=i),t._mergeStructs.push(i),i.parentSub!==null&&i.right===null&&i.parent._map.set(i.parentSub,i),e.length=n,i},eP=(t,e)=>mh(t,n=>za(n.deletions,e)),AP=(t,e,n,r,o,i)=>{let s=t.doc,l=s.store,a=s.clientID,c=e.redone;if(c!==null)return sr(t,c);let u=e.parent._item,d=null,f;if(u!==null&&u.deleted===!0){if(u.redone===null&&(!n.has(u)||AP(t,u,n,r,o,i)===null))return null;for(;u.redone!==null;)u=sr(t,u.redone)}let h=u===null?e.parent:u.content.type;if(e.parentSub===null){for(d=e.left,f=e;d!==null;){let g=d;for(;g!==null&&g.parent._item!==u;)g=g.redone===null?null:sr(t,g.redone);if(g!==null&&g.parent._item===u){d=g;break}d=d.left}for(;f!==null;){let g=f;for(;g!==null&&g.parent._item!==u;)g=g.redone===null?null:sr(t,g.redone);if(g!==null&&g.parent._item===u){f=g;break}f=f.right}}else{if(f=null,e.right&&!o){for(d=e;d!==null&&d.right!==null&&(d.right.redone||za(r,d.right.id)||eP(i.undoStack,d.right.id)||eP(i.redoStack,d.right.id));)for(d=d.right;d.redone;)d=sr(t,d.redone);if(d&&d.right!==null)return null}else d=h._map.get(e.parentSub)||null;d!==null&&d.parent._item!==u&&(d=h._map.get(e.parentSub)||null)}let p=at(l,a),m=X(a,p),y=new Ce(m,d,d&&d.lastId,f,f&&f.id,h,e.parentSub,e.content.copy());return e.redone=m,vT(y,!0),y.integrate(t,0),y},Ce=class t extends $h{constructor(e,n,r,o,i,s,l,a){super(e,a.getLength()),this.origin=r,this.left=n,this.right=o,this.rightOrigin=i,this.parent=s,this.parentSub=l,this.redone=null,this.content=a,this.info=this.content.isCountable()?2:0}set marker(e){(this.info&8)>0!==e&&(this.info^=8)}get marker(){return(this.info&8)>0}get keep(){return(this.info&1)>0}set keep(e){this.keep!==e&&(this.info^=1)}get countable(){return(this.info&2)>0}get deleted(){return(this.info&4)>0}set deleted(e){this.deleted!==e&&(this.info^=4)}markDeleted(){this.info|=4}getMissing(e,n){if(this.origin&&this.origin.client!==this.id.client&&this.origin.clock>=at(n,this.origin.client))return this.origin.client;if(this.rightOrigin&&this.rightOrigin.client!==this.id.client&&this.rightOrigin.clock>=at(n,this.rightOrigin.client))return this.rightOrigin.client;if(this.parent&&this.parent.constructor===gl&&this.id.client!==this.parent.client&&this.parent.clock>=at(n,this.parent.client))return this.parent.client;if(this.origin&&(this.left=YB(e,n,this.origin),this.origin=this.left.lastId),this.rightOrigin&&(this.right=sr(e,this.rightOrigin),this.rightOrigin=this.right.id),this.left&&this.left.constructor===lr||this.right&&this.right.constructor===lr)this.parent=null;else if(!this.parent)this.left&&this.left.constructor===t?(this.parent=this.left.parent,this.parentSub=this.left.parentSub):this.right&&this.right.constructor===t&&(this.parent=this.right.parent,this.parentSub=this.right.parentSub);else if(this.parent.constructor===gl){let r=yl(n,this.parent);r.constructor===lr?this.parent=null:this.parent=r.content.type}return null}integrate(e,n){if(n>0&&(this.id.clock+=n,this.left=YB(e,e.doc.store,X(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,o;if(r!==null)o=r.right;else if(this.parentSub!==null)for(o=this.parent._map.get(this.parentSub)||null;o!==null&&o.left!==null;)o=o.left;else o=this.parent._start;let i=new Set,s=new Set;for(;o!==null&&o!==this.right;){if(s.add(o),i.add(o),cr(this.origin,o.origin)){if(o.id.client<this.id.client)r=o,i.clear();else if(cr(this.rightOrigin,o.rightOrigin))break}else if(o.origin!==null&&s.has(yl(e.doc.store,o.origin)))i.has(yl(e.doc.store,o.origin))||(r=o,i.clear());else break;o=o.right}this.left=r}if(this.left!==null){let 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),sP(e.doc.store,this),this.content.integrate(e,this),KB(e,this.parent,this.parentSub),(this.parent._item!==null&&this.parent._item.deleted||this.parentSub!==null&&this.right!==null)&&this.delete(e)}else new lr(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:X(this.id.client,this.id.clock+this.length-1)}mergeWith(e){if(this.constructor===e.constructor&&cr(e.origin,this.lastId)&&this.right===e&&cr(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)){let 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){let n=this.parent;this.countable&&this.parentSub===null&&(n._length-=this.length),this.markDeleted(),Bh(e.deleteSet,this.id.client,this.id.clock,this.length),KB(e,n,this.parentSub),this.content.delete(e)}}gc(e,n){if(!this.deleted)throw ft();this.content.gc(e),n?EQ(e,this,new lr(this.id,this.length)):this.content=new B0(this.length)}write(e,n){let r=n>0?X(this.id.client,this.id.clock+n-1):this.origin,o=this.rightOrigin,i=this.parentSub,s=this.content.getRef()&31|(r===null?0:128)|(o===null?0:64)|(i===null?0:32);if(e.writeInfo(s),r!==null&&e.writeLeftID(r),o!==null&&e.writeRightID(o),r===null&&o===null){let l=this.parent;if(l._item!==void 0){let a=l._item;if(a===null){let c=Qi(l);e.writeParentInfo(!0),e.writeString(c)}else e.writeParentInfo(!1),e.writeLeftID(a.id)}else l.constructor===String?(e.writeParentInfo(!0),e.writeString(l)):l.constructor===gl?(e.writeParentInfo(!1),e.writeLeftID(l)):ft();i!==null&&e.writeString(i)}this.content.write(e,n)}},kP=(t,e)=>pZ[e&31](t),pZ=[()=>{ft()},JQ,tZ,WQ,oZ,ZQ,eZ,hZ,rZ,QQ,()=>{ft()}],mZ=10,ar=class extends $h{get deleted(){return!0}delete(){}mergeWith(e){return this.constructor!==e.constructor?!1:(this.length+=e.length,!0)}integrate(e,n){ft()}write(e,n){e.writeInfo(mZ),J(e.restEncoder,this.length-n)}getMissing(e,n){return null}},MP=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:{},RP="__ $YJS$ __";MP[RP]===!0&&console.error("Yjs was already imported. This breaks constructor checks and will lead to issues! - https://github.com/yjs/yjs/issues/438");MP[RP]=!0;var OP=()=>{let t=!0;return(e,n)=>{if(t){t=!1;try{e()}finally{t=!0}}else n!==void 0&&n()}};var ni=(t,e)=>t>>>e|t<<32-e,gZ=t=>ni(t,2)^ni(t,13)^ni(t,22),yZ=t=>ni(t,6)^ni(t,11)^ni(t,25),vZ=t=>ni(t,7)^ni(t,18)^t>>>3,bZ=t=>ni(t,17)^ni(t,19)^t>>>10,wZ=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]),SZ=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),bT=class{constructor(){let e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(SZ),this._W=new Uint32Array(e,64,64)}_updateHash(){let e=this._H,n=this._W;for(let d=16;d<64;d++)n[d]=bZ(n[d-2])+n[d-7]+vZ(n[d-15])+n[d-16];let r=e[0],o=e[1],i=e[2],s=e[3],l=e[4],a=e[5],c=e[6],u=e[7];for(let d=0,f,h;d<64;d++)f=u+yZ(l)+(l&a^~l&c)+wZ[d]+n[d]>>>0,h=gZ(r)+(r&o^r&i^o&i)>>>0,u=c,c=a,a=l,l=s+f>>>0,s=i,i=o,o=r,r=f+h>>>0;e[0]+=r,e[1]+=o,e[2]+=i,e[3]+=s,e[4]+=l,e[5]+=a,e[6]+=c,e[7]+=u}digest(e){let n=0;for(;n+56<=e.length;){let s=0;for(;s<16&&n+3<e.length;s++)this._W[s]=e[n++]<<24|e[n++]<<16|e[n++]<<8|e[n++];if(n%64!==0){for(this._W.fill(0,s,16);n<e.length;)this._W[s]|=e[n]<<(3-n%4)*8,n++;this._W[s]|=128<<(3-n%4)*8}this._updateHash()}let r=n%64!==0;this._W.fill(0,0,16);let o=0;for(;n<e.length;o++)for(let s=3;s>=0&&n<e.length;s--)this._W[o]|=e[n++]<<s*8;r||(this._W[o-(n%4===0?0:1)]|=128<<(3-n%4)*8),this._W[14]=e.byteLength/536870912,this._W[15]=e.byteLength*8,this._updateHash();let i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let l=0;l<4;l++)i[s*4+l]=this._H[s]>>>(3-l)*8;return i}},DP=t=>new bT().digest(t);var CZ=/[\uD800-\uDBFF]/,EZ=/[\uDC00-\uDFFF]/,TZ=(t,e)=>{let n=0,r=0;for(;n<t.length&&n<e.length&&t[n]===e[n];)n++;for(n>0&&CZ.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&&EZ.test(t[t.length-r])&&r--,{index:n,remove:t.length-n-r,insert:e.slice(n,e.length-r)}},NP=TZ;function Sl(t){if(!t||!(t.content instanceof nn))return null;let e=t.content.type;if(!(e instanceof dr||e instanceof Ir||e instanceof wl))throw new Error("Expected a Yjs XML type");return e}function Xh(t){if(t===null)return null;if(!(t.parent instanceof Ze))throw new Error("Expected an integrated Yjs parent");let e=t.parent;if(!(e instanceof dr||e instanceof Ir||e instanceof wl))throw new Error("Expected a Yjs XML type");return e}var AZ=(t,e)=>{let n=null,r=null;return t._item===null?r=Qi(t):n=X(t._item.id.client,t._item.id.clock),new Ji(n,r,e.id)},hd=(t,e,n)=>{if(t===0)return Ua(e,0,-1);let r=Sl(e._first);for(;r!==null&&e!==r;){if(r instanceof et){if(r._length>=t)return Ua(r,t,-1);if(t-=r._length,r._item!==null&&r._item.next!==null)r=Sl(r._item.next);else{do r=Xh(r._item),t--;while(r!==e&&r!==null&&r._item!==null&&r._item.next===null);r!==null&&r!==e&&(r=r._item===null?null:Sl(r._item.next))}}else{let s=n.get(r),l=s instanceof nr?s.nodeSize:0;if(r._first!==null&&t<l)r=Sl(r._first),t--;else{if(t===1&&r._length===0&&l>1)return new Ji(r._item===null?null:r._item.id,r._item===null?Qi(r):null,null);if(t-=l,r._item!==null&&r._item.next!==null)r=Sl(r._item.next);else{var o;if(t===0){if(r=r._item===null?r:Xh(r._item),r===null)throw ft();return new Ji(r._item===null?null:r._item.id,r._item===null?Qi(r):null,null)}do{if(r=Xh(r._item),r===null)throw ft();t--}while(r!==e&&((o=r._item)===null||o===void 0?void 0:o.next)===null);if(r!==e){var i;r=Sl((i=r._item)===null||i===void 0?void 0:i.next)}}}}if(r===null)throw ft();if(t===0&&r.constructor!==et&&r!==e){let s=r._item,l=Xh(s);if(s===null||l===null)throw ft();return AZ(l,s)}}return Ua(e,e._length,-1)},kZ=(t,e)=>{if(!t.docChanged)return!1;if(t.doc.childCount!==e.childCount)return!0;for(let n of t.steps)if(n instanceof dt){if(n.from===0&&n.to===e.content.size)return!0;if(n.slice.content.size>0){let r=!1;if(n.slice.content.forEach(o=>{o.isBlock&&(r=!0)}),r)return!0}else if(n.to>n.from){let r=e.resolve(n.from),o=e.resolve(n.to);if(r.depth===0&&o.depth===0&&r.index()!==o.index())return!0}}return!1};function $P(t,e){if(t instanceof et)return t._length;let n=e.get(t);return n instanceof nr?n.nodeSize:null}function MZ(t,e,n){let r=0,o=t._first;for(;o!==null;){let i=Sl(o);if(i===e)break;let s=o.deleted;if(o=o.right,s)continue;if(i===null)return null;let l=$P(i,n);if(l===null)return null;r+=l}return r}function RZ(t,e,n){let r=0,o=0,i=t._first;for(;o<t._length&&o<e&&i!==null;){let s=i;if(i=i.right,s.deleted)continue;let l=Sl(s);if(l===null)return null;let a=$P(l,n);if(a===null)return null;o++,r+=a}return r}var OZ=(t,e,n)=>{var r;if(n===null)return!1;let o=fT(e,t);return o!==null&&o.type instanceof et&&e.item!==null&&((r=o.type._item)===null||r===void 0?void 0:r.deleted)===!0},TT=t=>{if(!t.doc)throw new Error("The Yjs fragment must belong to a document");let e=t._item?`item:${t._item.id.client}:${t._item.id.clock}`:`root:${Qi(t)}`;return t.doc.getMap(`__tiptap_position_migrations:${e}`)},_P=new WeakMap,DZ=(t,e)=>{var n,r;let o=(n=e.item)!==null&&n!==void 0?n:e.type;if(!o)return[];let i;e.item||(i=e.assoc<0?"start":"end");let s=_P.get(t);if(!s||s.size!==t.size){let a=new Map;t.forEach(c=>c.transfers.forEach(u=>{var d;let f=(d=a.get(u.source.client))!==null&&d!==void 0?d:[];f.push({migration:c,transfer:u}),a.set(u.source.client,f)})),s={size:t.size,clients:a},_P.set(t,s)}let l=((r=s.clients.get(o.client))!==null&&r!==void 0?r:[]).filter(({transfer:a})=>a.source.boundary===i&&a.source.clock<=o.clock&&o.clock<a.source.clock+a.source.length);return l.filter(a=>!l.some(c=>c.migration!==a.migration&&c.migration.seen.some(([u,d])=>u===a.migration.client&&d>a.migration.clock)))},IP=(t,e,n)=>{var r,o;let{source:i,target:s}=t.transfer;return s?new Ji(s.boundary?X(s.client,s.clock):s.type,(r=s.tname)!==null&&r!==void 0?r:null,s.boundary?null:X(s.client,s.clock+e.clock-i.clock),(o=s.assoc)!==null&&o!==void 0?o:n):null},NZ=(t,e,n)=>{let r=IP(t[0],e,n);return!r||t.some(o=>{let i=IP(o,e,n);return!i||!$0(r,i)})?null:r},LP=t=>{var e;let n=(e=t.item)!==null&&e!==void 0?e:t.type;if(!n)return null;let r=t.assoc<0?"start":"end";return t.item&&(r="item"),`${n.client}:${n.clock}:${r}`},ST=(t,e)=>{var n;let r=TT(t),o=new Set,i=e,s=(n=i.item)!==null&&n!==void 0?n:i.type;for(;s;){var l;let a=LP(i);if(o.has(a))return null;o.add(a);let c=DZ(r,i);if(c.length===0)return i;let u=NZ(c,s,i.assoc);if(!u)return null;if(LP(u)===a)return u;i=u,s=(l=u.item)!==null&&l!==void 0?l:u.type}return i},zr=(t,e,n,r)=>{var o;let i=ST(e,n);if(!i)return null;n=i;let s=fT(n,t);if(s===null||s.type!==e&&!td(e,s.type._item))return null;let l=s.type,a=0;if(l.constructor===et)a=s.index;else if(!(!((o=l._item)===null||o===void 0)&&o.deleted)){let d=RZ(l,s.index,r);if(d===null)return null;a=d+1}for(;l!==e&&l._item!==null;){var c;let d=Xh(l._item);if(d===null)return null;if(!((c=d._item)===null||c===void 0)&&c.deleted){l=d;continue}let f=MZ(d,l,r);if(f===null)return null;a+=f+1,l=d}let u=a-1;return OZ(t,n,u)?null:u},Ue=new ae("y-sync"),Qh=new ae("y-undo"),X0=new ae("yjs-cursor"),fd=null;function _Z(){let t=fd;fd=null;let e=[];return t?.forEach((n,r)=>{n.forEach((o,i)=>e.push({view:r,key:i,value:o}))}),e}function YP(t=_Z(),e=!1){let n=!0;for(;t.length>0;){let{view:r,key:o,value:i}=t[0];try{let s=Ue.getState(r.state);s&&s.binding.prosemirrorView!==null&&r.dispatch(r.state.tr.setMeta(o,i))}catch(s){if(!(s instanceof RangeError))throw s;e&&n&&t.shift(),t.length>0&&Qu(0,()=>YP(t,!0));return}n=!1,t.shift()}}function IZ(t,e,n){fd===null&&(fd=new Map,Qu(0,YP));let r=fd.get(t);r||(r=new Map,fd.set(t,r)),r.set(e,n)}var LZ=(t,e,n)=>t!==e,zZ=t=>{let e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${t.color}`);let n=document.createElement("div");n.setAttribute("style",`background-color: ${t.color}`),n.insertBefore(document.createTextNode(t.name),null);let r=document.createTextNode("\u2060"),o=document.createTextNode("\u2060");return e.insertBefore(r,null),e.insertBefore(n,null),e.insertBefore(o,null),e},UZ=t=>({style:`background-color: ${t.color}70`,class:"ProseMirror-yjs-selection"}),BZ=/^#[0-9a-fA-F]{6}$/,PZ=t=>typeof t.name=="string"&&typeof t.color=="string",zP=(t,e,n,r,o)=>{let i=Ue.getState(t);if(i==null||i.doc==null||i.binding==null)return ce.create(t.doc,[]);let s=i.doc,l=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?ce.create(t.doc,[]):(e.getStates().forEach((a,c)=>{if(n(s.clientID,c,a)&&a&&a.cursor!=null){let u={...a.user};if(u.color==null?u.color="#ffa500":BZ.test(u.color)||console.warn("A user uses an unsupported color format",u),u.name==null&&(u.name=`User: ${c}`),!PZ(u))return;let d=zr(s,i.type,cd(a.cursor.anchor),i.binding.mapping),f=zr(s,i.type,cd(a.cursor.head),i.binding.mapping);if(d!==null&&f!==null){let h=or(t.doc.content.size-1,0);d=Nr(d,h),f=Nr(f,h),l.push(ot.widget(f,()=>r(u,c),{key:c+"",side:10}));let p=Nr(d,f),m=or(d,f);l.push(ot.inline(p,m,o(u,c),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),ce.create(t.doc,l))},qP=(t,{awarenessStateFilter:e=LZ,cursorBuilder:n=zZ,selectionBuilder:r=UZ,getSelection:o=s=>s.selection}={},i="cursor")=>new G({key:X0,state:{init(s,l){return zP(l,t,e,n,r)},apply(s,l,a,c){let u=Ue.getState(c),d=s.getMeta(X0),f=u&&u.isChangeOrigin;return s.docChanged&&!f&&kZ(s,a.doc)?ce.empty:f||d&&d.awarenessUpdated?zP(c,t,e,n,r):s.docChanged?l.map(s.mapping,s.doc):l}},props:{decorations:s=>{var l;return(l=X0.getState(s))!==null&&l!==void 0?l:ce.empty}},view:s=>{let l=()=>{s.isDestroyed||IZ(s,X0,{awarenessUpdated:!0})},a=u=>{let d=Ue.getState(u.state);if(!d||!d.binding||d.binding.projectionError!==null)return;let f=t.getLocalState()||{};if(u.hasFocus()){let h=o(u.state),p=hd(h.anchor,d.type,d.binding.mapping),m=hd(h.head,d.type,d.binding.mapping);(f.cursor==null||!$0(cd(f.cursor.anchor),p)||!$0(cd(f.cursor.head),m))&&t.setLocalStateField(i,{anchor:p,head:m})}else f.cursor!=null&&zr(d.doc,d.type,cd(f.cursor.anchor),d.binding.mapping)!==null&&t.setLocalStateField(i,null)},c=()=>a(s);return t.on("change",l),s.dom.addEventListener("focusin",c),s.dom.addEventListener("focusout",c),{update:a,destroy:()=>{s.dom.removeEventListener("focusin",c),s.dom.removeEventListener("focusout",c),t.off("change",l),t.setLocalStateField(i,null)}}}});function Cl(t){let e=Ue.getState(t);if(!e)throw new Error("The editor requires ySyncPlugin");return e}var J0=(t,e)=>{var n;return e===void 0?!t.deleted:e.sv.has(t.id.client)&&((n=e.sv.get(t.id.client))!==null&&n!==void 0?n:0)>t.id.clock&&!za(e.ds,t.id)},HZ=(t,e,n)=>{if(!t.has(n)){if(t.size<e.length){let o=to();t.forEach(i=>o.add(i)),e=e.filter(i=>!o.has(i))}t.set(n,tB(e))}let r=t.get(n);if(!r)throw new Error("At least one snapshot color is required");return r},KP=(t,e)=>{if(t===e)return!0;let n=Object.keys(t);return n.length===Object.keys(e).length&&n.every(r=>t[r]===e[r])},VZ=t=>{let e=t.type.spec.attrs||{};return Object.keys(t.attrs).some(n=>{let r=e[n];return r==null||!Object.prototype.hasOwnProperty.call(r,"default")||r.default!==t.attrs[n]})},AT=(t,e,n)=>{let r=0,o=0;for(;o<t.childCount;o++){let h=t.child(o);if(r+h.nodeSize>n)break;r+=h.nodeSize}if(o>=t.childCount)return null;let i=t.child(o),s=t.resolve(n),l=(h,p)=>{if(s.depth===0){let m=h+(n-r),y=h+1,g=h+p.nodeSize-1;return Math.max(y,Math.min(m,g))}if(s.depth>1){let m=AT(s.node(1),p,s.pos-s.start(1));return m===null?null:h+1+m}return p.isTextblock?h+1+Math.min(s.parentOffset,p.content.size):null},a=(h,p=!1)=>{let m=0;for(let w=0;w<=o;w++)h(t.child(w))&&m++;let y=0,g=-1,v=null,b=0;for(let w=0;w<e.childCount;w++){let S=e.child(w);h(S)&&(y++,y===m&&(g=b,v=S)),b+=S.nodeSize}return v===null||p&&(m!==1||y!==1)?null:l(g,v)},c=h=>h.type===i.type&&KP(h.attrs,i.attrs),u=i.textContent,d=a(h=>c(h)&&h.textContent===u);if(d!==null)return d;let f=a(h=>h.type===i.type&&h.textContent===u);if(f!==null)return f;if(!i.isTextblock||VZ(i)){let h=a(c,!0);if(h!==null)return h}return a(h=>c(h)&&u!==""&&h.textContent!==""&&(u.startsWith(h.textContent)||h.textContent.startsWith(u)),!0)},jZ=(t,e,n,r)=>{if(r===null)return!1;let o=t.resolve(n),i=e.resolve(r);if(!o.parent.isTextblock)return!1;if(!i.parent.isTextblock||o.parent.textContent!==i.parent.textContent||o.parentOffset!==0&&i.parentOffset===0)return!0;let s=o.parentOffset===0&&i.parentOffset===0,l=o.parentOffset!==i.parentOffset||o.parent.type!==i.parent.type||!KP(o.parent.attrs,i.parent.attrs);if(s||l){let a=AT(t,e,n);return a!==null&&a!==r}return!1},UP=(t,e,n,r)=>{if(n==null||n<0||n>e.content.size||!(r===null||n>1&&r<=1||jZ(e,t,n,r)))return r;let o=AT(e,t,n);return o!==null?o:r},FZ=(t,e,n,r)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")t.setSelection(new mn(t.doc));else if(e.type==="node"){let o=zr(n.doc,n.type,e.anchor,n.mapping);o!==null&&t.setSelection($Z(t,o))}else if(e.type==="nodeRange"){let o=zr(n.doc,n.type,e.anchor,n.mapping),i=zr(n.doc,n.type,e.head,n.mapping),s=YZ(t,o,i,e.depth);s!==null&&t.setSelection(s)}else{let o=zr(n.doc,n.type,e.anchor,n.mapping),i=zr(n.doc,n.type,e.head,n.mapping);r!=null&&(ST(n.type,e.anchor)===e.anchor&&(o=UP(t.doc,r,e.absAnchor,o)),ST(n.type,e.head)===e.head&&(i=UP(t.doc,r,e.absHead,i))),o===null&&(o=i),i===null&&(i=o),o!==null&&i!==null&&t.setSelection(L.between(t.doc.resolve(o),t.doc.resolve(i)))}},$Z=(t,e)=>{let n=t.doc.resolve(e);return n.nodeAfter?V.create(t.doc,e):L.near(n)},YZ=(t,e,n,r)=>{if(e===null||n===null)return null;let o=Math.min(Math.max(e,0),t.doc.content.size),i=Math.min(Math.max(n,0),t.doc.content.size);try{let s=H.fromJSON(t.doc,{type:"nodeRange",anchor:o,head:i,depth:r});return s.ranges.length?s:L.near(t.doc.resolve(o))}catch{return L.near(t.doc.resolve(o))}},xT=(t,e)=>{let n=e.selection,r=n.toJSON(),o=typeof r.type=="string"?r.type:"text";return{type:o,depth:o==="nodeRange"&&"depth"in n&&typeof n.depth=="number"?n.depth:void 0,anchor:hd(e.selection.anchor,t.type,t.mapping),head:hd(e.selection.head,t.type,t.mapping),absAnchor:e.selection.anchor,absHead:e.selection.head}},xl=new WeakMap,qZ=/(.*)(--[a-zA-Z0-9+/=]{8})$/,GP=t=>{var e,n;return(e=(n=qZ.exec(t))===null||n===void 0?void 0:n[1])!==null&&e!==void 0?e:t},KZ=(t,e)=>{let n=[];for(let r in t)n.push(e.mark(GP(r),t[r]));return n},GZ=(t,e,n,r,o,i)=>t.toDelta(r,o,i).map(s=>e.text(s.insert,KZ(s.attributes,e))),CT=(t,e,n,r,o,i)=>{var s;let l=n.mapping.get(t);if(l!==void 0&&!Array.isArray(l)&&((s=xl.get(n.mapping))===null||s===void 0?void 0:s.get(t))===l)return l;let a=[],c=h=>{if(h instanceof Ee)a.push(CT(h,e,n,r,o,i));else if(h instanceof et)a.push(...GZ(h,e,n,r,o,i));else throw new Error("Cannot project a Yjs XML hook")};r===void 0||o===void 0?t.toArray().forEach(c):mT(t,new nd(o.ds,r.sv)).forEach(c);let u=t.getAttributes(r);r!==void 0&&t._item&&(J0(t._item,r)?J0(t._item,o)||(u.ychange=i?i("added",t._item.id):{type:"added"}):u.ychange=i?i("removed",t._item.id):{type:"removed"});let d=e.node(t.nodeName,u,a);l!==void 0&&!Array.isArray(l)&&l.eq(d)&&(d=l),n.mapping.set(t,d);let f=xl.get(n.mapping);return f===void 0&&(f=new WeakMap,xl.set(n.mapping,f)),f.set(t,d),d},BP=(t,e)=>{if(t.childCount>0&&!e.topNodeType.validContent(t))throw new RangeError("Shared content does not fit the document schema")},XZ=t=>{for(let n=6;n<t.length;n++)t[n%6]=t[n%6]^t[n];return t.slice(0,6)},WZ=t=>mB(XZ(DP(yB(t)))),XP=(t,e)=>{let n={};return t.forEach(r=>{if(r.type.name!=="ychange"){let o=Dr(e.isOMark,r.type,()=>!r.type.excludes(r.type));n[o?`${r.type.name}--${WZ(r.toJSON())}`:r.type.name]=r.attrs}}),n},JZ=(t,e)=>{let n=new et,r=t.map(o=>{var i;return{insert:(i=o.text)!==null&&i!==void 0?i:"",attributes:XP(o.marks,e)}});return n.applyDelta(r),e.mapping.set(n,t),n},md=t=>{let e=t.content.content,n=[];for(let r=0;r<e.length;r++){let o=e[r];if(o.isText){let i=[];for(let s=e[r];r<e.length&&s.isText;s=e[++r])i.push(s);r--,n.push(i)}else n.push(o)}return n},Wh=(t,e)=>t instanceof Array?JZ(t,e):QZ(t,e),QZ=(t,e)=>{let n=new Ee(t.type.name);for(let r in t.attrs){let o=t.attrs[r];o!==null&&r!=="ychange"&&n.setAttribute(r,o)}return n.insert(0,md(t).map(r=>Wh(r,e))),e.mapping.set(n,t),n},PP=t=>typeof t=="object"&&t!==null,kT=(t,e)=>{let n=Object.keys(t).filter(o=>t[o]!==null),r=n.length===Object.keys(e).filter(o=>e[o]!==null).length;for(let o=0;o<n.length&&r;o++){let i=n[o],s=t[i],l=e[i];r=i==="ychange"||s===l||PP(s)&&PP(l)&&kT(s,l)}return r},MT=(t,e)=>{let n=t.toDelta();return n.length===e.length&&n.every((r,o)=>{var i;return r.insert===e[o].text&&TE(r.attributes||{}).length===e[o].marks.length&&Object.entries((i=r.attributes)!==null&&i!==void 0?i:{}).every(([s,l])=>{let a=GP(s),c=e[o].marks.find(u=>u.type.name===a);return c?kT(l,c.attrs):!1})})},Q0=(t,e)=>!(e instanceof Array)&&t.nodeName===e.type.name,pd=(t,e)=>{if(t instanceof Ee&&!(e instanceof Array)&&Q0(t,e)){let n=md(e);return t._length===n.length&&kT(t.getAttributes(),e.attrs)&&t.toArray().every((r,o)=>pd(r,n[o]))}return t instanceof et&&e instanceof Array&&MT(t,e)},Jh=(t,e)=>t===e||t instanceof Array&&e instanceof Array&&t.length===e.length&&t.every((n,r)=>e[r]===n),ZZ=(t,e,n)=>{let r=new Map;e.forEach((a,c)=>{r.has(a)||r.set(a,c)});let o=[];if(t.forEach((a,c)=>{let u=n.mapping.get(a),d=u===void 0?void 0:r.get(u);d!==void 0&&Jh(u,e[d])&&o.push({yIndex:c,pIndex:d,yChild:a})}),o.length===0)return[];let i=[],s=[];for(let a=0;a<o.length;a++){let c=0,u=s.length;for(;c<u;){let d=c+u>>1;o[s[d]].pIndex<o[a].pIndex?c=d+1:u=d}i[a]=c>0?s[c-1]:-1,s[c]=a}let l=[];for(let a=s[s.length-1];a!==-1;a=i[a])l.push(o[a]);return l.reverse()},eee=t=>{let e="",n=t._start,r={};for(;n!==null;)n.deleted||(n.countable&&n.content instanceof Lr?e+=n.content.str:n.content instanceof wt&&(r[n.content.key]=null)),n=n.right;return{str:e,nAttrs:r}},RT=(t,e,n)=>{n.mapping.set(t,e);let{nAttrs:r,str:o}=eee(t),i=e.map(c=>{var u;return{insert:(u=c.text)!==null&&u!==void 0?u:"",attributes:Object.assign({},r,XP(c.marks,n))}}),{insert:s,remove:l,index:a}=NP(o,i.map(c=>c.insert).join(""));t.delete(a,l),t.insert(a,s),t.applyDelta(i.map(c=>({retain:c.insert.length,attributes:c.attributes})))},WP=(t,e,n,r,o)=>e instanceof et&&n instanceof Array?(MT(e,n)?r.mapping.set(e,n):RT(e,n,r),!0):e instanceof Ee&&!(n instanceof Array)&&Q0(e,n)?(pd(e,n)?r.mapping.set(e,n):o(t,e,n,r),!0):!1,Ba=(t,e)=>{var n;(e instanceof dr||e instanceof Ir||e instanceof wl)&&(t.delete(e),(n=xl.get(t))===null||n===void 0||n.delete(e))},HP=(t,e,n,r)=>{n>0&&(t.slice(e,e+n).forEach(o=>Ba(r.mapping,o)),t.delete(e,n))},VP=(t,e,n,r,o,i)=>{if(r<o){let s=[];for(let l=r;l<o;l++)s.push(Wh(n[l],i));t.insert(e,s)}},jP=(t,e,n,r,o,i,s,l,a,c)=>{let u=Nr(i-o,l-s);for(let d=0;d<u;d++){let f=r[o+d],h=n[s+d];WP(t,f,h,a,c)||(HP(e,s+d,1,a),VP(e,s+d,n,s+d,s+d+1,a))}HP(e,s+u,i-o-u,a),VP(e,s+u,n,s+u,l,a)},tee=(t,e,n,r,o,i)=>{let s=ZZ(r,n,o);if(s.length<2||!s.some(c=>c.yIndex!==c.pIndex)||s.some(c=>{let u=n[c.pIndex];return!(c.yChild instanceof et&&u instanceof Array||c.yChild instanceof Ee&&!(u instanceof Array))}))return!1;let l=0,a=0;for(let c of s){jP(t,e,n,r,l,c.yIndex,a,c.pIndex,o,i);let u=n[c.pIndex];WP(t,c.yChild,u,o,i),l=c.yIndex+1,a=c.pIndex+1}return jP(t,e,n,r,l,r.length,a,n.length,o,i),!0},FP=(t,e,n)=>{let r=t.toArray(),o=md(e),i=o.length,s=r.length,l=Nr(s,i),a=0,c=0,u=!1;for(;a<l;a++){let d=r[a],f=o[a];if(Jh(n.mapping.get(d),f))u=!0;else if(!pd(d,f))break}for(;a+c<l;c++){let d=r[s-c-1],f=o[i-c-1];if(Jh(n.mapping.get(d),f))u=!0;else if(!pd(d,f))break}return{equalityFactor:a+c,foundMappedChild:u}},W0=(t,e,n,r)=>{if(e instanceof Ee&&e.nodeName!==n.type.name)throw new Error("node name mismatch!");if(r.mapping.set(e,n),e instanceof Ee){let f=e.getAttributes(),h=n.attrs;for(let p in h){if(h[p]===null){e.removeAttribute(p);continue}f[p]!==h[p]&&p!=="ychange"&&e.setAttribute(p,h[p])}for(let p in f)h[p]===void 0&&e.removeAttribute(p)}let o=md(n),i=o.length,s=e.toArray(),l=s.length,a=Nr(i,l),c=!1;if(t.transact(()=>{c=tee(t,e,o,s,r,W0)},Ue),c)return;let u=0,d=0;for(;u<a;u++){let f=s[u],h=o[u];if(!Jh(r.mapping.get(f),h)){if(!pd(f,h))break;r.mapping.set(f,h)}}for(;d+u+1<a;d++){let f=s[l-d-1],h=o[i-d-1];if(!Jh(r.mapping.get(f),h)){if(!pd(f,h))break;r.mapping.set(f,h)}}t.transact(()=>{for(;l-u-d>0&&i-u-d>0;){let p=s[u],m=o[u],y=s[l-d-1],g=o[i-d-1];if(p instanceof et&&m instanceof Array){MT(p,m)||RT(p,m,r),u+=1;continue}let v=p instanceof Ee&&Q0(p,m),b=y instanceof Ee&&Q0(y,g);if(v&&b&&p instanceof Ee&&y instanceof Ee&&!Array.isArray(m)&&!Array.isArray(g)){let w=FP(p,m,r),S=FP(y,g,r);w.foundMappedChild&&!S.foundMappedChild?b=!1:!w.foundMappedChild&&S.foundMappedChild||w.equalityFactor<S.equalityFactor?v=!1:b=!1}if(v&&p instanceof Ee&&!Array.isArray(m)){W0(t,p,m,r),u+=1;continue}if(b&&y instanceof Ee&&!Array.isArray(g)){W0(t,y,g,r),d+=1;continue}Ba(r.mapping,e.get(u)),e.delete(u,1),e.insert(u,[Wh(m,r)]),u+=1}let f=l-u-d;if(l===1&&i===0&&s[0]instanceof et?(Ba(r.mapping,s[0]),s[0].delete(0,s[0].length)):f>0&&(e.slice(u,u+f).forEach(p=>Ba(r.mapping,p)),e.delete(u,f)),u+d>=i)return;let h=[];for(let p=u;p<i-d;p++)h.push(Wh(o[p],r));e.insert(u,h)},Ue)},Z0=(t,e=0)=>{let n=[];if(!t._item)throw new Error("Position tracking requires integrated text");for(let r=t._start;r;r=r.right)if(!(r.deleted||!r.countable)){if(!(r.content instanceof Lr))throw new Error("Position tracking requires string text content");for(let o=0;o<r.length;o+=1)n.push({client:r.id.client,clock:r.id.clock+o,text:r.content.str[o],type:t._item.id,position:e+n.length})}return n},nee=(t,e,n)=>{let r=[{current:-1,target:-1}];return t.forEach((o,i)=>{let s=e.get(`${o.client}:${o.clock}`);s!==void 0&&s>r[r.length-1].target&&r.push({current:i,target:s})}),r.push({current:t.length,target:n}),r},ree=(t,e,n,r,o)=>{let i=Z0(t),s=new Map;for(let a=0;a<e.length;a+=1){let c=r.get(n+a);c&&s.set(`${c.client}:${c.clock}`,a)}let l=nee(i,s,e.length);for(let a=l.length-1;a>0;a-=1){let c=l[a-1],u=l[a],d=i.slice(c.current+1,u.current),f=e.slice(c.target+1,u.target);!d.some(h=>o.has(`${h.client}:${h.clock}`))&&d.map(h=>h.text).join("")===f||(t.delete(c.current+1,d.length),t.insert(c.current+1,f))}return Z0(t,n)},oee=(t,e)=>!t.target||!e.target?t.target===e.target:t.target.client===e.target.client&&t.target.assoc===e.target.assoc&&t.target.boundary===e.target.boundary&&t.target.tname===e.target.tname&&t.target.clock+t.source.length===e.target.clock&&cr(t.target.type,e.target.type),iee=t=>{let e=[];return t.forEach(n=>{let r=e[e.length-1];if(r&&r.source.client===n.source.client&&r.source.boundary===n.source.boundary&&r.source.clock+r.source.length===n.source.clock&&oee(r,n)){r.source.length+=n.source.length;return}e.push({...n,source:{...n.source}})}),e},JP=(t,e)=>{let n=t.doc;if(!n||e.length===0)return;let r=at(n.store,n.clientID);t.set(`${n.clientID}:${r}`,{version:1,client:n.clientID,clock:r,seen:[...j0(F0(n))],transfers:iee(e)})},see=(t,e)=>{let n=new Map;t.forEach(o=>{var i;let s=`${o.type.client}:${o.type.clock}`,l=(i=n.get(s))!==null&&i!==void 0?i:[];l.push(o),n.set(s,l)});let r=[];return n.forEach(o=>{let i=o[0],s=o[o.length-1],l=i.position===null?void 0:e.get(i.position),a=s.position===null?void 0:e.get(s.position);(!l||!cr(i.type,l.type))&&r.push({source:{...i.type,length:1,boundary:"start"},target:l?{...l,assoc:0}:null}),(!a||!cr(s.type,a.type))&&r.push({source:{...i.type,length:1,boundary:"end"},target:a?{...a,assoc:-1}:null})}),r},lee=(t,e,n,r)=>{let o=[];t.forEach(s=>{var l;let a=s.position===null?null:(l=e.get(s.position))!==null&&l!==void 0?l:null;a&&cr(s.id,a)||o.push({source:{...s.id,length:1},target:a})});let i=[...t,...r];for(let s of["start","end"]){let l=s==="start"?e:n;i.forEach(a=>{var c;let u=s==="start"?a.position:a.end,d=u===null?null:(c=l.get(u))!==null&&c!==void 0?c:null;d&&cr(a.id,d)||o.push({source:{...a.id,length:1,boundary:s},target:d?{client:d.client,clock:d.clock,type:null,boundary:s}:null})})}return o},aee=(t,e,n,r,o,i)=>{let s=t.get(e);if(!(s instanceof Ee)||!s._item)throw new Error("Position migration requires synchronized elements");let l=o.get(`${s._item.id.client}:${s._item.id.clock}`);if(l&&l.position!==r&&(Ba(i.mapping,s),t.delete(e,1),s=Wh(n,i),t.insert(e,[s])),!(s instanceof Ee)||!s._item)throw new Error("Position migration requires integrated elements");return s},cee=(t,e,n,r)=>{let o=new Map(e.characters.map(f=>[f.position,f])),i=new Set(e.characters.map(f=>`${f.client}:${f.clock}`)),s=new Map,l=new Map(e.nodes.map(f=>[`${f.id.client}:${f.id.clock}`,f])),a=new Map,c=new Map,u=(f,h,p)=>{let m=f.toArray(),y=p;md(h).forEach((g,v)=>{var b,w;let S=m[v];if(Array.isArray(g)){if(!(S instanceof et)||!S._item)throw new Error("Position migration requires integrated text");let A=g.map(z=>{var $;return($=z.text)!==null&&$!==void 0?$:""}).join(""),T=ree(S,A,y,o,i),_=S._item.id;T.forEach(z=>s.set(z.position,{client:z.client,clock:z.clock,type:_})),RT(S,g,n),y+=A.length;return}let C=aee(f,v,g,y,l,n),x=C._item.id,E={client:x.client,clock:x.clock,type:(b=(w=f._item)===null||w===void 0?void 0:w.id)!==null&&b!==void 0?b:null,...f._item?{}:{tname:Qi(f)}};a.set(y,E),c.set(y+g.nodeSize-1,E),g.isLeaf||u(C,g,y+1),y+=g.nodeSize})};u(t,e.doc,0);let d=[];e.characters.forEach(f=>{var h;let p=f.position===null?null:(h=s.get(f.position))!==null&&h!==void 0?h:null;p&&cr(f,p)&&cr(f.type,p.type)||d.push({source:{client:f.client,clock:f.clock,length:1},target:p})}),d.push(...see(e.characters,s)),d.push(...lee(e.nodes,a,c,e.emptyTexts)),JP(r,d)},uee=(t,e)=>{var n;let r=t.doc.content,o=0,i=0;for(;o<r.childCount&&o<e.childCount&&r.child(o)===e.child(o);)i+=r.child(o).nodeSize,o++;let s=r.childCount,l=e.childCount,a=0;for(;s>o&&l>o&&r.child(s-1)===e.child(l-1);)a+=r.child(s-1).nodeSize,s--,l--;if(o===s&&o===l)return t;let c=new N(e.cut(i,e.size-a),0,0),u=da(t.doc,i,r.size-a,c);return u!==null&&(!((n=u.apply(t.doc).doc)===null||n===void 0)&&n.content.eq(e))?t.step(u):t.replace(0,r.size,new N(e,0,0))},dee=class{get projectionError(){return this._projectionError}constructor(t,e=new Map){if(this.prosemirrorView=null,this.mux=OP(),this.isOMark=new Map,this.beforeTransactionSelection=null,this._domSelectionInView=null,this.syncedDoc=null,this._projectionError=null,this.type=t,this.mapping=e,this._observeFunction=this._typeChanged.bind(this),t.doc===null)throw new Error("The Yjs fragment must belong to a document");this.doc=t.doc,this.beforeAllTransactions=()=>{this.projectionError===null&&this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=xT(this,this.view.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null}}get view(){if(!this.prosemirrorView)throw new Error("The binding has no editor view");return this.prosemirrorView}get _tr(){return this.view.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.view.hasFocus()?(Mh&&this._domSelectionInView===null&&(Qu(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){let t=this.view.root,e="getSelection"in t&&typeof t.getSelection=="function"?t.getSelection():this.view.dom.ownerDocument.getSelection();if(e==null||e.anchorNode==null||e.focusNode==null)return!1;let n=this.view.dom.ownerDocument.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);let r=n.getBoundingClientRect(),o=Gi.documentElement;return r.bottom>=0&&r.right>=0&&r.left<=(window.innerWidth||o.clientWidth||0)&&r.top<=(window.innerHeight||o.clientHeight||0)}renderSnapshot(t,e){e||(e=Y0(H0(),new Map)),this.view.dispatch(this._tr.setMeta(Ue,{snapshot:t,prevSnapshot:e}))}createDocumentFragment(){try{let t=this.type.toArray().map(n=>{if(!(n instanceof Ee))throw $n();return CT(n,this.view.state.schema,this)}),e=M.from(t);return BP(e,this.view.state.schema),this._projectionError=null,e}catch(t){return this.handleProjectionError(t),null}}handleProjectionError(t){this._projectionError=t instanceof Error?t:new Error("Cannot project shared content"),this.mapping.clear(),xl.delete(this.mapping),this.beforeTransactionSelection=null,this.view.dispatch(this._tr.setMeta(Ue,{isChangeOrigin:!0}))}createDocumentTransaction(){let t=this.createDocumentFragment();return t===null?null:this._tr.replace(0,this.view.state.doc.content.size,new N(t,0,0))}unrenderSnapshot(){this.mapping.clear(),xl.delete(this.mapping),this.mux(()=>{let t=this.createDocumentTransaction();t!==null&&(t.setMeta(Ue,{snapshot:null,prevSnapshot:null}),this.view.dispatch(t))})}_forceRerender(){this.mapping.clear(),xl.delete(this.mapping),this.mux(()=>{let t=this.beforeTransactionSelection!==null?null:this.view.state.selection,e=this.createDocumentTransaction();if(e!==null){if(t){let n=Nr(or(t.anchor,0),e.doc.content.size),r=Nr(or(t.head,0),e.doc.content.size);e.setSelection(L.create(e.doc,n,r))}this.view.dispatch(e.setMeta(Ue,{isChangeOrigin:!0,binding:this}))}})}_renderSnapshot(t,e,n){var r;let o=this.doc,i=this.type;if(t||(t=q0(this.doc)),t instanceof Uint8Array||e instanceof Uint8Array){if(!(t instanceof Uint8Array)||!(e instanceof Uint8Array))throw ft();if(o=new ur({gc:!1}),Kh(o,e),e=q0(o),Kh(o,t),t=q0(o),i._item===null){let c=Array.from(this.doc.share.keys()).find(u=>Object.is(this.doc.share.get(u),i));i=o.getXmlFragment(c)}else{var s;let c=(s=o.store.clients.get(i._item.id.client))!==null&&s!==void 0?s:[],u=c[ro(c,i._item.id.clock)];if(!(u instanceof Ce&&u.content instanceof nn&&u.content.type instanceof dr))throw ft();i=u.content.type}}let l=t,a=(r=e)!==null&&r!==void 0?r:iP;this.mapping.clear(),xl.delete(this.mapping),this.mux(()=>{try{o.transact(c=>{let u=n.permanentUserData;u&&u.dss.forEach(m=>{Xi(c,m,y=>{})});let d=(m,y)=>{let g=u?m==="added"?u.getUserByClientId(y.client):u.getUserByDeletedId(y):null;return{user:g,type:m,color:HZ(n.colorMapping,n.colors,g)}},f=mT(i,new nd(a.ds,l.sv)).map(m=>!(m instanceof Ee)||!m._item?null:!m._item.deleted||J0(m._item,l)||J0(m._item,a)?CT(m,this.view.state.schema,{mapping:new Map,isOMark:new Map},l,a,d):null).filter(m=>m!==null),h=M.from(f);BP(h,this.view.state.schema);let p=this._tr.replace(0,this.view.state.doc.content.size,new N(h,0,0));this._projectionError=null,this.view.dispatch(p.setMeta(Ue,{isChangeOrigin:!0}))},Ue)}catch(c){this.handleProjectionError(c)}})}_typeChanged(t,e){var n;if(this.prosemirrorView==null)return;let r=Cl(this.view.state);if(t.length===0||r.snapshot!=null||r.prevSnapshot!=null){this.renderSnapshot(r.snapshot,r.prevSnapshot);return}let o=e.origin instanceof rd,i=o?(n=e.origin.currStackItem)===null||n===void 0?void 0:n.meta.get(this):void 0,s=i||this.beforeTransactionSelection,l=i?void 0:this.view.state.doc;this.mux(()=>{let a=(d,f)=>Ba(this.mapping,f);Xi(e,e.deleteSet,d=>{d instanceof Ce&&d.content instanceof nn&&Ba(this.mapping,d.content.type)}),e.changed.forEach(a),e.changedParentTypes.forEach(a);let c=this.createDocumentFragment();if(c===null)return;let u=uee(this._tr,c);FZ(u,s,this,l),u=u.setMeta(Ue,{isChangeOrigin:!0,isUndoRedoOperation:o}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&u.scrollIntoView(),this.view.dispatch(u)})}_prosemirrorChanged(t,e=null){let n=Cl(this.view.state);this.projectionError!==null||n.snapshot!=null||n.prevSnapshot!=null||this.doc.transact(()=>{W0(this.doc,this.type,t,this),e?.doc===t&&cee(this.type,e,this,TT(this.type)),this.syncedDoc=t,this.beforeTransactionSelection=xT(this,this.view.state)},Ue)}initView(t){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=t,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))}},fee=(t,e)=>{let n=[],r=[],o=[];if(t.length===0)return{characters:n,nodes:r,emptyTexts:o};let i=(s,l,a)=>{let c=s.toArray(),u=md(l),d=a;l.content.size===0&&c.forEach(f=>{f instanceof et&&f._item&&o.push({id:f._item.id,position:a-1,end:a})}),u.forEach((f,h)=>{let p=c[h];if(!Array.isArray(f)){if(!(p instanceof Ee)||!p._item)throw new Error("Position tracking requires synchronized editor content");r.push({id:p._item.id,position:d,end:d+f.nodeSize-1}),f.isLeaf||i(p,f,d+1),d+=f.nodeSize;return}if(!(p instanceof et))throw new Error("Position tracking requires synchronized editor text");let m=Z0(p,d);n.push(...m),d+=m.length})};return i(t,e,0),{characters:n,nodes:r,emptyTexts:o}},hee=(t,e,n,r)=>{let o=t.toJSON();if(o.stepType!=="replace"&&o.stepType!=="replaceAround"||r!==o.from&&r!==o.to-1)return!1;let i=e.nodeAt(o.from),s=n.nodeAt(o.from);return!i||!s||i.nodeSize!==o.to-o.from?!1:pee(i,s)},pee=(t,e)=>t.type===e.type&&t.content.eq(e.content)&&!t.sameMarkup(e),mee=(t,e)=>{var n;let r=t.toJSON(),o=(n=r.slice)!==null&&n!==void 0?n:{content:[]};if(r.stepType!=="replace"||o.openStart>0||o.openEnd>0)return!1;let i=e.resolve(r.from),s=e.resolve(r.to);return o.content.every(l=>l.type==="text")&&i.parent.isTextblock&&i.sameParent(s)},gee=t=>{let e=new Map;return t.descendants((n,r)=>{var o;let i=(o=e.get(n))!==null&&o!==void 0?o:[];i.push(r),e.set(n,i)}),e},yee=(t,e,n,r)=>{var o;if(((o=r[n].get(t))===null||o===void 0?void 0:o.length)!==1)return null;for(let i=n+1;i<r.length;i+=1){let s=r[i].get(t);if(s?.length===1)return{position:s[0]+e,step:i}}return null},vee=(t,e,n,r)=>{let o=n[e].resolve(t),i=[],s=n[e].nodeAt(t);s&&!s.isText&&i.push({node:s,offset:0});for(let l=o.depth;l>0;l-=1)i.push({node:o.node(l),offset:t-o.before(l)});for(let l of i){let a=yee(l.node,l.offset,e,r);if(a)return a}return null},wT=(t,e,n,r)=>{for(let o=0;o<e.mapping.maps.length;o+=1){let i=e.mapping.maps[o],s=i.mapResult(t,1),l=i.mapResult(t+1,-1);if(!s.deleted&&!l.deleted&&l.pos===s.pos+1){t=s.pos;continue}if(hee(e.steps[o],n[o],n[o+1],t))continue;let a=vee(t,o,n,r);if(!a)return null;t=a.position,o=a.step-1}return t},bee=(t,e,n)=>{let r=n?.doc===t.before&&n.doc!==e.syncedDoc?n:null;if(!t.docChanged||!e.prosemirrorView||!r&&t.steps.every((c,u)=>mee(c,t.docs[u])))return r;let o=r??fee(e.type,t.before),i=[...t.docs,t.doc],s=i.map(gee),l=o.characters.map(c=>({...c,position:c.position===null?null:wT(c.position,t,i,s)})),a=c=>({...c,position:c.position===null?null:wT(c.position,t,i,s),end:c.end===null?null:wT(c.end,t,i,s)});return{doc:t.doc,characters:l,nodes:o.nodes.map(a),emptyTexts:o.emptyTexts.map(a)}},wee=[{light:"#ecd44433",dark:"#ecd444"}],QP=(t,{colors:e=wee,colorMapping:n=new Map,permanentUserData:r=null,onFirstRender:o=()=>{},mapping:i}={})=>{let s=!1,l=new dee(t,i);return new G({filterTransaction:a=>l.projectionError===null||!a.docChanged,props:{editable:a=>{let c=Cl(a);return l.projectionError===null&&c.snapshot==null&&c.prevSnapshot==null}},key:Ue,state:{init:(a,c)=>({type:t,doc:l.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:n,permanentUserData:r,positionMigration:null}),apply:(a,c)=>{var u;let d=a.getMeta(Ue);return d!==void 0&&(c=Object.assign({},c,d)),a.docChanged&&(c.addToHistory=a.getMeta("addToHistory")!==!1),c.isChangeOrigin=d!==void 0&&!!d.isChangeOrigin,c.isUndoRedoOperation=d!==void 0&&!!d.isChangeOrigin&&!!d.isUndoRedoOperation,c={...c,positionMigration:l.projectionError||c.isChangeOrigin||c.snapshot||c.prevSnapshot||d?.snapshot!==void 0||d?.prevSnapshot!==void 0?null:bee(a,l,(u=c.positionMigration)!==null&&u!==void 0?u:null)},l.prosemirrorView===null||d===void 0||d.snapshot==null&&d.prevSnapshot==null||Qu(0,()=>{if(l.prosemirrorView!=null){if(d.restore==null){l._renderSnapshot(d.snapshot,d.prevSnapshot,c);return}l._renderSnapshot(d.snapshot,d.snapshot,c),l.projectionError===null&&l.mux(()=>{let f=l.prosemirrorView;f&&(f.dispatch(l._tr.setMeta(Ue,{restore:!1,snapshot:null,prevSnapshot:null,isChangeOrigin:!0})),l._prosemirrorChanged(f.state.doc))})}}),c}},view:a=>(l.initView(a),i==null&&l._forceRerender(),o(),{update:()=>{let c=Cl(a.state);if(l.projectionError===null&&c.snapshot==null&&c.prevSnapshot==null){let u=a.state.doc.type.createAndFill();if(!u)throw new Error("The schema cannot create an empty document");if(s||a.state.doc.content.findDiffStart(u.content)!==null){if(s=!0,c.addToHistory===!1&&!c.isChangeOrigin){let d=Qh.getState(a.state),f=d&&d.undoManager;f&&f.stopCapturing()}l.mux(()=>{c.doc.transact(d=>{var f;d.meta.set("addToHistory",c.addToHistory),l._prosemirrorChanged(a.state.doc,(f=c.positionMigration)!==null&&f!==void 0?f:null)},Ue)})}}},destroy:()=>{l.destroy()}})})};function ET(t){let e=Qh.getState(t);if(!e)throw new Error("The editor requires yUndoPlugin");return e}var See=t=>{let e=new Map,n=r=>{r.toArray().forEach(o=>{if(o instanceof Ee){var i,s;let a=o._item.id;e.set(`${a.client}:${a.clock}`,{client:a.client,clock:a.clock,type:(i=(s=r._item)===null||s===void 0?void 0:s.id)!==null&&i!==void 0?i:null,...r._item?{}:{tname:Qi(r)}}),n(o);return}if(!(o instanceof et)||!o._item)return;let l=o._item.id;Z0(o).forEach(a=>{e.set(`${a.client}:${a.clock}`,{client:a.client,clock:a.clock,type:l})})})};return n(t),e},xee=(t,e)=>{let n=t.doc;if(!n)return;let r=See(t),o=new Map,i=new Map,s=(c,u)=>{var d,f;let h=`${c.client}:${c.clock}`,p=`${u.client}:${u.clock}`;o.set(h,c),o.set(p,u);let m=(d=i.get(h))!==null&&d!==void 0?d:new Set,y=(f=i.get(p))!==null&&f!==void 0?f:new Set;m.add(p),y.add(h),i.set(h,m),i.set(p,y)};e.forEach(c=>c.transfers.forEach(({source:u,target:d})=>{if(!(!d||u.boundary))for(let f=0;f<u.length;f+=1)s(X(u.client,u.clock+f),X(d.client,d.clock+f))})),n.store.clients.forEach(c=>c.forEach(u=>{if(!(!(u instanceof Ce)||!u.redone)&&!(!(u.content instanceof Lr)&&!(u.content instanceof nn)))for(let d=0;d<u.length;d+=1)s(X(u.id.client,u.id.clock+d),X(u.redone.client,u.redone.clock+d))}));let l=[],a=new Set;i.forEach((c,u)=>{if(a.has(u))return;let d=[u],f=[],h=[];for(;d.length>0;){var p;let m=d.pop();if(a.has(m))continue;a.add(m),f.push(m);let y=r.get(m);y&&h.push(y),d.push(...(p=i.get(m))!==null&&p!==void 0?p:[])}h.length===1&&f.forEach(m=>{if(r.has(m))return;let y=o.get(m);l.push({source:{client:y.client,clock:y.clock,length:1},target:h[0]});let g=yl(n.store,y);if(g.content instanceof nn&&g.content.type instanceof Ee)for(let v of["start","end"])l.push({source:{client:y.client,clock:y.clock,length:1,boundary:v},target:{client:h[0].client,clock:h[0].clock,type:null,boundary:v}})})}),JP(e,l)},Cee=(t,e,n)=>{let r=TT(t);if(r.size===0)return e[n]();let o=n==="undo"?"undoing":"redoing",i=null,s=({stackItem:l})=>{i=l};e.on("stack-item-popped",s);try{e.doc.transact(()=>{e[n](),e[o]=!0,e.currStackItem=i,i&&xee(t,r)},e)}finally{e.off("stack-item-popped",s),e[o]=!1,e.currStackItem=null}return i},ZP=(t,e)=>{let n=Cl(t);if(n.binding.projectionError!==null||n.snapshot!=null||n.prevSnapshot!=null)return!1;let r=ET(t).undoManager;if(r!=null)return Cee(n.type,r,e),!0},e4=t=>ZP(t,"undo"),t4=t=>ZP(t,"redo"),Eee=new Set(["paragraph"]),Tee=(t,e)=>!(t instanceof Ce)||!(t.content instanceof nn)||!(t.content.type instanceof Ir||t.content.type instanceof Ee&&e.has(t.content.type.nodeName))||t.content.type._length===0,n4=({protectedNodes:t=Eee,trackedOrigins:e=[],undoManager:n=null}={})=>new G({key:Qh,state:{init:(r,o)=>{let i=Cl(o),s=new Set,l=n;if(!l){var a;let c=new Set(i.doc._observers.get("destroy"));l=new rd(i.type,{trackedOrigins:new Set([Ue,...e]),deleteFilter:u=>Tee(u,t),captureTransaction:u=>u.meta.get("addToHistory")!==!1}),((a=i.doc._observers.get("destroy"))!==null&&a!==void 0?a:new Set).forEach(u=>{c.has(u)||s.add(u)})}return{undoManager:l,prevSel:null,hasUndoOps:l.undoStack.length>0,hasRedoOps:l.redoStack.length>0,destroyListeners:s}},apply:(r,o,i,s)=>{let l=Cl(s).binding;return{...o,prevSel:l?xT(l,i):o.prevSel,hasUndoOps:o.undoManager.undoStack.length>0,hasRedoOps:o.undoManager.redoStack.length>0}}},view:r=>{let o=Cl(r.state),{undoManager:i,destroyListeners:s}=ET(r.state);return i.on("stack-item-added",({stackItem:l})=>{let a=o.binding;if(a){let c=i.undoing||i.redoing?a.beforeTransactionSelection:ET(r.state).prevSel;l.meta.set(a,c)}}),{destroy:()=>{i.destroy(),s.forEach(l=>i.doc.off("destroy",l)),s.clear()}}}});function r4(t){return!!t.getMeta(Ue)}function Aee(t,e){if(e===null)return 0;let n=i4(t);return zr(n.doc,n.type,e,n.binding.mapping)||0}function o4(t,e){let n=i4(t);return hd(e,n.type,n.binding.mapping)}function i4(t){let e=Ue.getState(t);if(!e)throw new Error("Collaboration requires the Yjs sync plugin");return e}var tv=class s4 extends $y{constructor(e,n){super(e),this.yRelativePosition=n}static fromJSON(e){return new s4(e.position,e.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function kee(t,e){return new tv(t,o4(e,t))}function Mee(t,e,n){let r=t instanceof tv?t.yRelativePosition:null;if(r4(e)&&r)return{position:new tv(Aee(n,r),r),mapResult:null};let o=sE(t,e),i=o.position.position;return{position:new tv(i,r??o4(n,i)),mapResult:o.mapResult}}function ev(t){let e=Qh.getState(t);if(!e)throw new Error("Collaboration requires the Yjs undo plugin");return e.undoManager}var Ree=we.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(t=>t.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(t,e)=>Mee(t,e,this.editor.state),this.editor.utils.createMappablePosition=t=>kee(t,this.editor.state)},addCommands(){return{undo:()=>({tr:t,state:e,dispatch:n})=>{var r;return t.setMeta("preventDispatch",!0),ev(e).undoStack.length===0?!1:n?(r=e4(e))!==null&&r!==void 0?r:!1:!0},redo:()=>({tr:t,state:e,dispatch:n})=>{var r;return t.setMeta("preventDispatch",!0),ev(e).redoStack.length===0?!1:n?(r=t4(e))!==null&&r!==void 0?r:!1:!0}}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){let t=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),e=n4(this.options.yUndoOptions),n=e.spec.view;e.spec.view=o=>{let i=ev(o.state);i.restore&&(i.restore(),i.restore=()=>{});let s=n?n(o):void 0;return{destroy:()=>{let l=i.trackedOrigins.has(i),a=i._observers;i.restore=()=>{l&&i.trackedOrigins.add(i),i.doc.on("afterTransaction",i.afterTransactionHandler),i._observers=a},s?.destroy&&s.destroy()}}};let r={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender};return[QP(t,r),e,new G({filterTransaction:(o,i)=>(o.getMeta("inputRule")&&ev(i).stopCapturing(),!0)}),this.editor.options.enableContentCheck&&new G({key:new ae("filterInvalidContent"),filterTransaction:o=>{if(!r4(o))return!0;if(this.storage.isDisabled)return!1;if(!o.docChanged)return!0;try{return o.doc.check(),!0}catch(i){return this.storage.isDisabled=!0,this.editor.emit("contentError",{error:i,editor:this.editor,disableCollaboration:()=>{var s;(s=t.doc)===null||s===void 0||s.destroy()}}),!0}}})].filter(o=>o!==!1)}}),l4=Ree;var Oee=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Dee=Ie.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",ue(this.options.HTMLAttributes,t)]},parseMarkdown:(t,e)=>e.createNode("image",{src:t.href,title:t.title,alt:t.text}),renderMarkdown:t=>{var e,n,r,o,i,s;let l=(e=(n=t.attrs)===null||n===void 0?void 0:n.src)!==null&&e!==void 0?e:"",a=(r=(o=t.attrs)===null||o===void 0?void 0:o.alt)!==null&&r!==void 0?r:"",c=(i=(s=t.attrs)===null||s===void 0?void 0:s.title)!==null&&i!==void 0?i:"";return c?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;let{directions:t,minWidth:e,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize,o=new Set(["src","width","height"]);return({node:i,getPos:s,HTMLAttributes:l,editor:a})=>{let c=document.createElement("img");c.draggable=!1;let u=ue(this.options.HTMLAttributes,l);Object.entries(u).forEach(([g,v])=>{if(v!=null)switch(g){case"src":case"width":case"height":break;default:c.setAttribute(g,v)}}),u.src!==null&&(c.src=u.src);let d={...l},f=g=>{if(typeof g=="string"&&g!==""){c.getAttribute("src")!==g&&(c.src=g);return}c.hasAttribute("src")&&c.removeAttribute("src"),c.src!==""&&(c.src="")};f(l.src);let h=g=>{if(g.type!==i.type)return!1;let v=a.extensionManager.attributes.filter(w=>w.type===g.type.name),b=al(g,v);return Object.keys(d).forEach(w=>{!o.has(w)&&!(w in b)&&c.removeAttribute(w)}),Object.entries(b).forEach(([w,S])=>{o.has(w)||(S!=null?c.setAttribute(w,S):c.removeAttribute(w))}),f(b.src),d=b,!0},p=new BU({element:c,editor:a,node:i,getPos:s,onResize:(g,v)=>{c.style.width=`${g}px`,c.style.height=`${v}px`},onCommit:(g,v)=>{let b=s();b!==void 0&&this.editor.chain().setNodeSelection(b).updateAttributes(this.name,{width:g,height:v}).run()},onUpdate:h,options:{directions:t,min:{width:e,height:n},preserveAspectRatio:r===!0}}),m=p.dom,y=()=>{m.style.visibility="",m.style.pointerEvents=""};return m.style.visibility="hidden",m.style.pointerEvents="none",c.complete&&c.naturalWidth>0?y():(c.onload=y,c.onerror=y),p}},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[qy({find:Oee,type:this.type,getAttributes:t=>{let[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),a4=Dee;var Nee="listItem",c4="textStyle",u4=/^\s*([-+*])\s$/,OT=Ie.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",ue(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
158
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Nee,this.editor.getAttributes(c4)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=cl({find:u4,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=cl({find:u4,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(c4),editor:this.editor})),[t]}}),_ee=(t,e,n)=>{let{selection:r}=t;if(!r.empty)return null;let{$from:o}=r;if(!o.parent.isTextblock||o.parentOffset!==o.parent.content.size)return null;let i=-1;for(let h=o.depth;h>0;h-=1)if(o.node(h).type.name===e){i=h;break}if(i<0)return null;let s=o.node(i),l=o.index(i);if(l+1>=s.childCount)return null;let a=s.child(l+1);if(!n.includes(a.type.name))return null;let c=t.schema.nodes[e],u=!1;if(a.forEach(h=>{h.type===c&&h.childCount>1&&(u=!0)}),!u)return null;let d=t.doc.resolve(o.after()).nodeAfter;if(!d||!n.includes(d.type.name))return null;let f=[];return d.forEach(h=>{f.push(h)}),f.length===0?null:{listItemDepth:i,nestedList:d,nestedListPos:o.after(),insertPos:o.after(i),items:f}},Iee=(t,e,n,r)=>{let o=_ee(t,n,r);if(!o)return!1;let{selection:i}=t,{nestedList:s,nestedListPos:l,insertPos:a,items:c}=o,u=t.tr;u.delete(l,l+s.nodeSize);let d=u.mapping.map(a);return u.insert(d,M.from(c)),u.setSelection(i.map(u.doc,u.mapping)),e&&e(u),!0},Lee=(t,e,n)=>Iee(t.state,t.view.dispatch,e,n),b4=(t,e)=>we.create({name:`${t}BranchingDeleteKeymap`,priority:101,addKeyboardShortcuts(){let n=()=>Lee(this.editor,t,e);return{Delete:n,"Mod-Delete":n}}}),w4=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],nv="abcdefghijklmnopqrstuvwxyz",S4=String.raw`\d+|[ivxlcdmIVXLCDM]+|${"[a-zA-Z]{1,2}"}`;function iv(t){let e=t,n="";for(let[r,o]of w4)for(;e>=r;)n+=o,e-=r;return n}function DT(t){return iv(t).toUpperCase()}function x4(t){let e=t.toLowerCase(),n=0,r=0;for(;n<e.length;){let o=!1;for(let[i,s]of w4)if(e.startsWith(s,n)){r+=i,n+=s.length,o=!0;break}if(!o)return 0}return r}function zee(t){if(!/^[ivxlcdmIVXLCDM]+$/.test(t))return!1;let e=x4(t);return e<=0?!1:(t===t.toLowerCase()?iv(e):DT(e))===t}function Uee(t){let e=t.toLowerCase();if(e.length===1)return e.charCodeAt(0)-97+1;if(e.length===2){let n=e.charCodeAt(0)-97,r=e.charCodeAt(1)-97;return(n+1)*26+r+1}return 0}function rv(t){if(t<=26)return nv[t-1];let e=Math.floor((t-1)/26)-1,n=(t-1)%26;return e<0?nv[n]:nv[e]+nv[n]}function sv(t){if(!(!t||/^\d+$/.test(t))){if(zee(t))return t===t.toLowerCase()?"i":"I";if(/^[a-z]{1,2}$/.test(t))return"a";if(/^[A-Z]{1,2}$/.test(t))return"A"}}function NT(t){if(/^\d+$/.test(t))return parseInt(t,10);let e=sv(t);if(e==="i"||e==="I")return x4(t);if(e==="a"||e==="A"){let r=Uee(t);return r>0?r:1}let n=parseInt(t,10);return Number.isNaN(n)?1:n}function Bee(t,e){if(t==="numeric")return String(e);switch(t){case"a":return rv(e);case"A":return rv(e).toUpperCase();case"i":return iv(e);case"I":return DT(e);default:return String(e)}}function Pee(t){var e;if(t.length===0)return!1;let n=(e=sv(t[0]))!==null&&e!==void 0?e:"numeric",r=NT(t[0]);if(r<1)return!1;for(let o=0;o<t.length;o++){let i=Bee(n,r+o);if(t[o]!==i)return!1}return!0}function Hee(t){return{type:sv(t),start:NT(t)}}function Vee(t){let{type:e,start:n}=Hee(t),r={};return e&&(r.type=e),n!==1&&(r.start=n),r}function jee(t,e,n=". "){let r=e+1;if(!t||t==="1")return`${r}${n}`;switch(t){case"a":return`${rv(r)}${n}`;case"A":return`${rv(r).toUpperCase()}${n}`;case"i":return`${iv(r)}${n}`;case"I":return`${DT(r)}${n}`;default:return`${r}${n}`}}function Fee(t){return!t[0]||t[0].type==="paragraph"?t:[{type:"paragraph",content:[]},...t]}function $ee(t){var e,n;let r=(e=t.content)===null||e===void 0?void 0:e[0];return r?.type==="paragraph"&&!(!((n=r.content)===null||n===void 0)&&n.length)}var Yee=" ",d4=1,qee=t=>{var e;return((e=t?.level)!==null&&e!==void 0?e:d4)>d4};function Kee(t){var e,n;let r=(e=t.tokens)===null||e===void 0?void 0:e[0];return!!(t.text&&((n=t.tokens)===null||n===void 0?void 0:n.length)===1&&r?.type==="list"&&r.ordered&&r.raw===t.text)}function Gee(t,e){return e.tokenizeInline?e.parseInline(e.tokenizeInline(t)):e.parseInline([{type:"text",raw:t,text:t}])}var _T=Ie.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",ue(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{var n;if(t.type!=="list_item")return[];let r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren,o=[];if(t.tokens&&t.tokens.length>0){if(Kee(t))return{type:"listItem",content:[{type:"paragraph",content:Gee(t.text||"",e)}]};let[s,...l]=t.tokens;if(s.type==="heading"){var i;return{type:"listItem",content:[{type:"paragraph",content:e.parseInline((i=s.tokens)!==null&&i!==void 0?i:[])},...l.length>0?r(l):[]]}}if(t.tokens.some(a=>a.type==="paragraph"))o=r(t.tokens);else if(s.type==="text"&&s.tokens&&s.tokens.length>0){if(o=[{type:"paragraph",content:e.parseInline(s.tokens)}],t.tokens.length>1){let a=r(t.tokens.slice(1));o.push(...a)}}else o=r(t.tokens)}return o.length===0&&(o=[{type:"paragraph",content:[]}]),{type:"listItem",content:Fee(o)}},renderMarkdown:(t,e,n)=>{let r=s=>{if(s.parentType==="bulletList")return"- ";if(s.parentType==="orderedList"){var l,a;let c=((l=s.meta)===null||l===void 0||(l=l.parentAttrs)===null||l===void 0?void 0:l.start)||1;return jee((a=s.meta)===null||a===void 0||(a=a.parentAttrs)===null||a===void 0?void 0:a.type,c-1+(s.index||0),". ")}return"- "},o=cE(t,e,r,n,{alignNestedToPrefix:n?.parentType==="orderedList"});if(!$ee(t)||!qee(n))return o;let i=r(n);return`${i}${Yee}${o.slice(i.length)}`},addExtensions(){return[b4(this.name,[this.options.bulletListTypeName,this.options.orderedListTypeName])]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),IT=(t,e)=>{let{$from:n}=e.selection,r=Mt(t,e.schema),o=null,i=n.depth,s=n.pos,l=null;for(;i>0&&l===null;)o=n.node(i),o.type===r?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},C4=(t,e)=>{let n=IT(t,e);if(!n)return!1;let[,r]=vU(e,t,n.$pos.pos+4);return r},Xee=(t,e,n)=>{let{$anchor:r}=t.selection,o=Math.max(0,r.pos-2),i=t.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},f4=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!Qo(t.state,e)&&Xee(t.state,e,n)){let{$anchor:i}=t.state.selection,s=t.state.doc.resolve(i.before()-1),l=[];s.node().descendants((u,d)=>{u.type.name===e&&l.push({node:u,pos:d})});let a=l.at(-1);if(!a)return!1;let c=t.state.doc.resolve(s.start()+a.pos+1);return t.chain().command(({tr:u})=>{let d=c.end();return u.delete(i.before(),i.after()).insert(d,i.parent),u.setSelection(L.create(u.doc,d+1)),!0}).command(({state:u,dispatch:d})=>(hy(u,d),!0)).run()}if(!Qo(t.state,e)||!SU(t.state))return!1;let{$from:r}=t.state.selection,o=r.depth-1;return r.node(o).type!==t.schema.nodes[e]||r.index(o)!==0?!1:t.chain().liftListItem(e).run()},Wee=(t,e)=>{let n=C4(t,e),r=IT(t,e);return!r||!n?!1:n>r.depth},Jee=(t,e)=>{let n=C4(t,e),r=IT(t,e);return!r||!n?!1:n<r.depth},h4=(t,e)=>!Qo(t.state,e)||!wU(t.state,e)||!t.state.selection.empty?!1:Wee(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():Jee(e,t.state)?t.commands.command(({state:n,dispatch:r})=>py(n,r)):t.commands.joinItemForward(),Qee=(t,e,n)=>{let{state:r}=t,{selection:o}=r;if(!o.empty)return!1;let{$from:i}=o;if(i.parentOffset!==0||!i.parent.isTextblock||Qo(r,e))return!1;let s=bU(i);if(!s||!n.includes(s.type.name))return!1;let l=s.lastChild;if(!l||l.type.name!==e)return!1;let a=i.parent;if(!l.canReplace(l.childCount,l.childCount,M.from(a)))return!1;let c=i.before(),u=i.after(),d=c-2;return t.commands.command(({tr:f,dispatch:h})=>(h&&(f.delete(c,u).insert(d,M.from(a)),f.setSelection(L.create(f.doc,d+1)),f.scrollIntoView()),!0))};var LT=we.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&h4(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&h4(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&f4(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&f4(t,n,r)&&(e=!0)}),e},Tab:({editor:t})=>{for(let{itemName:e,wrapperNames:n}of this.options.listTypes)if(t.state.schema.nodes[e]!==void 0&&Qee(t,e,n))return!0;return!1}}}}),ov=new RegExp(`^(\\s*)(${S4})([.)])\\s+(.*)$`),Zee=/^\s/,gd={heading:/^#{1,6}(?:\s|$)/,bulletItem:/^[-+*]\s+/,codeFence:/^(?:```|~~~)/,blockMath:/^\$\$/,thematicBreak:/^(?:(?:-[ \t]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})$/};function ete(t){return ov.test(t.trimStart())}function tte(t){let e=t.trimStart();return gd.bulletItem.test(e)||ete(e)||gd.heading.test(e)||gd.thematicBreak.test(e)&&!e.startsWith("-")||/^>\s?/.test(e)||gd.codeFence.test(e)||gd.blockMath.test(e)}function nte(t){return Object.values(gd).some(e=>e.test(t))}function rte(t){let e=[],n=[],r=!1;return t.forEach(o=>{if(r){n.push(o);return}if(o.trim()===""){r=!0,n.push(o);return}if(e.length>0&&tte(o)){r=!0,n.push(o);return}e.push(o)}),{paragraphLines:e,blockLines:n}}function p4(t){let e=[],n=0,r=0;for(;n<t.length;){let o=t[n],i=o.match(ov);if(!i)break;let[,s,l,a,c]=i,u=s.length,d=parseInt(l,10),f=isNaN(d)?sv(l):void 0,h=isNaN(d)?NT(l):d,p=[c],m=n+1,y=[o],g=!1;for(;m<t.length;){let v=t[m];if(v.match(ov))break;if(v.trim()==="")y.push(v),p.push(""),g=!0,m+=1;else if(v.match(Zee)){let b=v.length-v.trimStart().length,w=u+l.length+1;y.push(v),p.push(v.slice(Math.min(b,w))),m+=1}else{if(g||nte(v))break;y.push(v),p.push(v),m+=1}}e.push({indent:u,number:h,type:f,content:p.join(`
|
|
159
|
+
`).trim(),contentLines:p,raw:y.join(`
|
|
160
|
+
`)}),r=m,n=m}return[e,r]}var ote=new RegExp(`^(${S4})([.)])\\s+(.+)$`);function ite(t){let e=t.split(`
|
|
161
|
+
`).filter(r=>r.trim().length>0);if(e.length===0)return null;let n=[];for(let r of e){let o=r.trim().match(ote);if(!o)return null;n.push({marker:o[1],content:o[3]})}return Pee(n.map(r=>r.marker))?{type:"orderedList",attrs:Vee(n[0].marker),content:n.map(r=>({type:"listItem",content:[{type:"paragraph",content:[{type:"text",text:r.content}]}]}))}:null}function E4(t,e,n){let r=[],o=0;for(;o<t.length;){let i=t[o];if(i.indent===e){let{paragraphLines:s,blockLines:l}=rte(i.contentLines),a=s.join(`
|
|
162
|
+
`).trim(),c=[];a&&c.push({type:"paragraph",raw:a,tokens:n.inlineTokens(a)});let u=l.join(`
|
|
163
|
+
`).trim();if(u){let h=n.blockTokens(u);c.push(...h)}let d=o+1,f=[];for(;d<t.length&&t[d].indent>e;)f.push(t[d]),d+=1;if(f.length>0){let h=E4(f,Math.min(...f.map(p=>p.indent)),n);c.push({type:"list",ordered:!0,start:f[0].number,typeMarker:f[0].type,items:h,raw:f.map(p=>p.raw).join(`
|
|
164
|
+
`)})}r.push({type:"list_item",raw:i.raw,tokens:c}),o=d}else o+=1}return r}function ste(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];let r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(o=>{if(o.type==="paragraph"||o.type==="list"||o.type==="blockquote"||o.type==="code")r.push(...e.parseChildren([o]));else if(o.type==="text"&&o.tokens){let i=e.parseChildren([o]);r.push({type:"paragraph",content:i})}else{let i=e.parseChildren([o]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var lte=64;function m4(t,e){let n=[],r=0;for(;n.length<e;){let o=t.indexOf(`
|
|
165
|
+
`,r);if(o===-1)return n.push(t.slice(r)),n;n.push(t.slice(r,o)),r=o+1}return n}function ate(t){let e=t.indexOf(`
|
|
166
|
+
`),n=e===-1?t:t.slice(0,e);if(!ov.test(n))return[[],0,[]];let r=lte,o=m4(t,r),i=p4(o);for(;i[1]===o.length&&o.length===r;)r*=2,o=m4(t,r),i=p4(o);return[i[0],i[1],o]}var cte="listItem",g4="textStyle",y4=/^(\d+)\.\s$/;function v4(t){let e=t.match(/list-style-type\s*:\s*([^;]+)/i);if(!e)return null;switch(e[1].trim().toLowerCase()){case"upper-roman":return"I";case"lower-roman":return"i";case"upper-alpha":case"upper-latin":return"A";case"lower-alpha":case"lower-latin":return"a";default:return null}}var zT=Ie.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>{let e=t.getAttribute("type");if(e)return e;let n=t.getAttribute("style");if(n){let o=v4(n);if(o)return o}let r=t.querySelector("li");if(r){let o=r.getAttribute("style");if(o){let i=v4(o);if(i)return i}}return null}}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){let{start:e,type:n,...r}=t,o=ue(this.options.HTMLAttributes,r);return e!==1&&(o.start=e),n&&n!=="1"&&(o.type=n),["ol",o,0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];let n=t.start||1,r=t.typeMarker,o=t.items?ste(t.items,e):[],i={};return n!==1&&(i.start=n),r&&(i.type=r),Object.keys(i).length>0?{type:"orderedList",attrs:i,content:o}:{type:"orderedList",content:o}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
167
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:()=>-1,tokenize:(t,e,n)=>{var r,o;let[i,s,l]=ate(t);if(i.length===0)return;let a=E4(i,i[0].indent,n);if(a.length!==0)return{type:"list",ordered:!0,start:((r=i[0])===null||r===void 0?void 0:r.number)||1,typeMarker:(o=i[0])===null||o===void 0?void 0:o.type,items:a,raw:l.slice(0,s).join(`
|
|
168
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(cte,this.editor.getAttributes(g4)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addProseMirrorPlugins(){return[new G({props:{handlePaste:(t,e)=>{var n,r;let o=(n=e.clipboardData)===null||n===void 0?void 0:n.getData("text/html");if(o?.trim())return!1;let i=(r=e.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i)return!1;let s=ite(i);if(!s)return!1;try{let l=t.state.schema.nodeFromJSON(s),a=t.state.tr.replaceSelectionWith(l);return t.dispatch(a),!0}catch{return!1}}}})]},addInputRules(){let t=(n,r)=>(!r.attrs.type||r.attrs.type==="1")&&r.childCount+r.attrs.start===+n[1],e=cl({find:y4,type:this.type,getAttributes:n=>({start:+n[1]}),joinPredicate:t});return(this.options.keepMarks||this.options.keepAttributes)&&(e=cl({find:y4,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:n=>({start:+n[1],...this.editor.getAttributes(g4)}),joinPredicate:t,editor:this.editor})),[e]}}),ute=/^\s*(\[([( |x])?\])\s$/,dte="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0",fte=(t,e,n)=>{var r;return(n==null||(r=n.checkboxLabel)===null||r===void 0?void 0:r.call(n,t,e))||`Task item checkbox for ${t.textContent||"empty task item"}`},UT=Ie.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{let e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51,contentElement:t=>{var e;return(e=t.querySelector("div"))!==null&&e!==void 0?e:t}}]},renderHTML({node:t,HTMLAttributes:e}){return["li",ue(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{let n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){let r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;let r=`- [${!((n=t.attrs)===null||n===void 0)&&n.checked?"x":" "}] `;return cE(t,e,r,void 0,{indentMainContent:!0})},addExtensions(){return this.options.nested?[b4(this.name,[this.options.taskListTypeName])]:[]},addKeyboardShortcuts(){let t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{let o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div");s.style.cssText=dte;let c=d=>{let f=fte(d,d.attrs.checked,this.options.a11y);l.setAttribute("aria-label",f),s.textContent=f};c(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",d=>d.preventDefault()),l.addEventListener("change",d=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}let{checked:f}=d.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{let p=n();if(typeof p!="number")return!1;let m=h.doc.nodeAt(p);return h.setNodeMarkup(p,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,f)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([d,f])=>{o.setAttribute(d,f)}),o.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),o.append(i,a),Object.entries(e).forEach(([d,f])=>{o.setAttribute(d,f)});let u=new Set(Object.keys(e));return{dom:o,contentDOM:a,update:d=>{if(d.type!==this.type)return!1;o.dataset.checked=d.attrs.checked,l.checked=d.attrs.checked,c(d);let f=r.extensionManager.attributes,h=al(d,f),p=new Set(Object.keys(h)),m=this.options.HTMLAttributes;return u.forEach(y=>{p.has(y)||(y in m?o.setAttribute(y,m[y]):o.removeAttribute(y))}),Object.entries(h).forEach(([y,g])=>{g==null?y in m?o.setAttribute(y,m[y]):o.removeAttribute(y):o.setAttribute(y,g)}),u=p,!0}}}},addInputRules(){return[cl({find:ute,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),BT=Ie.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",ue(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
169
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;let n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))===null||e===void 0?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){let r=i=>{let s=aE(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:r},n);if(s){let l={type:"taskList",raw:s.raw,items:s.items},a=i.slice(s.raw.length);return a.trim()?[l,...n.blockTokens(a)]:[l]}return n.blockTokens(i)},o=aE(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Ale=we.create({name:"listKit",addExtensions(){let t=[];return this.options.bulletList!==!1&&t.push(OT.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(_T.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(LT.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(zT.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(UT.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(BT.configure(this.options.taskList)),t}});var HT,VT;if(typeof WeakMap<"u"){let t=new WeakMap;HT=e=>t.get(e),VT=(e,n)=>(t.set(e,n),n)}else{let t=[],n=0;HT=r=>{for(let o=0;o<t.length;o+=2)if(t[o]==r)return t[o+1]},VT=(r,o)=>(n==10&&(n=0),t[n++]=r,t[n++]=o)}var ht=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++){let n=this.map[e];if(n!=t)continue;let r=e%this.width,o=e/this.width|0,i=r+1,s=o+1;for(let l=1;i<this.width&&this.map[e+l]==n;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==n;l++)s++;return{left:r,top:o,right:i,bottom:s}}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){let{left:r,right:o,top:i,bottom:s}=this.findCell(t);return e=="horiz"?(n<0?r==0:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?i==0:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(t,e){let{left:n,right:r,top:o,bottom:i}=this.findCell(t),{left:s,right:l,top:a,bottom:c}=this.findCell(e);return{left:Math.min(n,s),top:Math.min(o,a),right:Math.max(r,l),bottom:Math.max(i,c)}}cellsInRect(t){let e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let o=t.left;o<t.right;o++){let i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,!(o==t.left&&o&&this.map[i-1]==s||r==t.top&&r&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(t,e,n){for(let r=0,o=0;;r++){let i=o+n.child(r).nodeSize;if(r==t){let s=e+t*this.width,l=(t+1)*this.width;for(;s<l&&this.map[s]<o;)s++;return s==l?i-1:this.map[s]}o=i}}static get(t){return HT(t)||VT(t,hte(t))}};function hte(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);let e=pte(t),n=t.childCount,r=[],o=0,i=null,s=[];for(let c=0,u=e*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){let d=t.child(c);u++;for(let p=0;;p++){for(;o<r.length&&r[o]!=0;)o++;if(p==d.childCount)break;let m=d.child(p),{colspan:y,rowspan:g,colwidth:v}=m.attrs;for(let b=0;b<g;b++){if(b+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:g-b});break}let w=o+b*e;for(let S=0;S<y;S++){r[w+S]==0?r[w+S]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:y-S});let C=v&&v[S];if(C){let x=(w+S)%e*2,E=s[x];E==null||E!=C&&s[x+1]==1?(s[x]=C,s[x+1]=1):E==C&&s[x+1]++}}}o+=y,u+=m.nodeSize}let f=(c+1)*e,h=0;for(;o<f;)r[o++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:c,n:h}),u++}(e===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});let l=new ht(e,n,r,i),a=!1;for(let c=0;!a&&c<s.length;c+=2)s[c]!=null&&s[c+1]<n&&(a=!0);return a&&mte(l,s,t),l}function pte(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){let o=t.child(r),i=0;if(n)for(let s=0;s<r;s++){let l=t.child(s);for(let a=0;a<l.childCount;a++){let c=l.child(a);s+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let s=0;s<o.childCount;s++){let l=o.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function mte(t,e,n){t.problems||(t.problems=[]);let r={};for(let o=0;o<t.map.length;o++){let i=t.map[o];if(r[i])continue;r[i]=!0;let s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null,a=s.attrs;for(let c=0;c<a.colspan;c++){let u=e[(o+c)%t.width*2];u!=null&&(!a.colwidth||a.colwidth[c]!=u)&&((l||(l=gte(a)))[c]=u)}l&&t.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function gte(t){if(t.colwidth)return t.colwidth.slice();let e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Nn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(let n in t.nodes){let r=t.nodes[n],o=r.spec.tableRole;o&&(e[o]=r)}}return e}var El=new ae("selectingCells");function Pa(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 yte(t){for(let e=t.depth;e>0;e--){let n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function xo(t){let 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 fv(t){let 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;let n=Pa(e.$head)||vte(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function vte(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){let 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--){let r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function jT(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function bte(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function YT(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function I4(t,e,n){let r=t.node(-1),o=ht.get(r),i=t.start(-1),s=o.nextCell(t.pos-i,e,n);return s==null?null:t.node(0).resolve(i+s)}function Ha(t,e,n=1){let r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(o=>o>0)||(r.colwidth=null)),r}function L4(t,e,n=1){let r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let o=0;o<n;o++)r.colwidth.splice(e,0,0)}return r}function wte(t,e,n){let r=Nn(e.type.schema).header_cell;for(let o=0;o<t.height;o++)if(e.nodeAt(t.map[n+o*t.width]).type!=r)return!1;return!0}var $e=class Zi extends H{constructor(e,n=e){let r=e.node(-1),o=ht.get(r),i=e.start(-1),s=o.rectBetween(e.pos-i,n.pos-i),l=e.node(0),a=o.cellsInRect(s).filter(u=>u!=n.pos-i);a.unshift(n.pos-i);let c=a.map(u=>{let d=r.nodeAt(u);if(!d)throw new RangeError(`No cell with offset ${u} found`);let f=i+u+1;return new yu(l.resolve(f),l.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){let r=e.resolve(n.map(this.$anchorCell.pos)),o=e.resolve(n.map(this.$headCell.pos));if(jT(r)&&jT(o)&&YT(r,o)){let i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Zi.rowSelection(r,o):i&&this.isColSelection()?Zi.colSelection(r,o):new Zi(r,o)}return L.between(r,o)}content(){let e=this.$anchorCell.node(-1),n=ht.get(e),r=this.$anchorCell.start(-1),o=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},s=[];for(let a=o.top;a<o.bottom;a++){let c=[];for(let u=a*n.width+o.left,d=o.left;d<o.right;d++,u++){let f=n.map[u];if(i[f])continue;i[f]=!0;let h=n.findCell(f),p=e.nodeAt(f);if(!p)throw new RangeError(`No cell with offset ${f} found`);let m=o.left-h.left,y=h.right-o.right;if(m>0||y>0){let g=p.attrs;if(m>0&&(g=Ha(g,0,m)),y>0&&(g=Ha(g,g.colspan-y,y)),h.left<o.left){if(p=p.type.createAndFill(g),!p)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(g)}`)}else p=p.type.create(g,p.content)}if(h.top<o.top||h.bottom>o.bottom){let g={...p.attrs,rowspan:Math.min(h.bottom,o.bottom)-Math.max(h.top,o.top)};h.top<o.top?p=p.type.createAndFill(g):p=p.type.create(g,p.content)}c.push(p)}s.push(e.child(a).copy(M.from(c)))}let l=this.isColSelection()&&this.isRowSelection()?e:s;return new N(M.from(l),1,1)}replace(e,n=N.empty){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(a.pos),s?N.empty:n)}let i=H.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,n){this.replace(e,new N(M.from(n),0,0))}forEachCell(e){let n=this.$anchorCell.node(-1),r=ht.get(n),o=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o));for(let s=0;s<i.length;s++)e(n.nodeAt(i[s]),o+i[s])}isColSelection(){let e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;let r=e+this.$anchorCell.nodeAfter.attrs.rowspan,o=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){let r=e.node(-1),o=ht.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(n.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+o.map[s.left])),l.bottom<o.height&&(n=a.resolve(i+o.map[o.width*(o.height-1)+l.right-1]))):(l.top>0&&(n=a.resolve(i+o.map[l.left])),s.bottom<o.height&&(e=a.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new Zi(e,n)}isRowSelection(){let e=this.$anchorCell.node(-1),n=ht.get(e),r=this.$anchorCell.start(-1),o=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(o,i)>0)return!1;let s=o+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==n.width}eq(e){return e instanceof Zi&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){let r=e.node(-1),o=ht.get(r),i=e.start(-1),s=o.findCell(e.pos-i),l=o.findCell(n.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+o.map[s.top*o.width])),l.right<o.width&&(n=a.resolve(i+o.map[o.width*(l.top+1)-1]))):(l.left>0&&(n=a.resolve(i+o.map[l.top*o.width])),s.right<o.width&&(e=a.resolve(i+o.map[o.width*(s.top+1)-1]))),new Zi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Zi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Zi(e.resolve(n),e.resolve(r))}getBookmark(){return new Ste(this.$anchorCell.pos,this.$headCell.pos)}};$e.prototype.visible=!1;H.jsonID("cell",$e);var Ste=class z4{constructor(e,n){this.anchor=e,this.head=n}map(e){return new z4(e.map(this.anchor),e.map(this.head))}resolve(e){let 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&&YT(n,r)?new $e(n,r):H.near(r,1)}};function xte(t){if(!(t.selection instanceof $e))return null;let e=[];return t.selection.forEachCell((n,r)=>{e.push(ot.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ce.create(t.doc,e)}function Cte({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,o=t.depth;for(;o>=0&&!(t.after(o+1)<t.end(o));o--,n++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,r--);return n==r&&/row|table/.test(t.node(o).type.spec.tableRole)}function Ete({$from:t,$to:e}){let n,r;for(let o=t.depth;o>0;o--){let i=t.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let o=e.depth;o>0;o--){let i=e.node(o);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&e.parentOffset===0}function Tte(t,e,n){let r=(e||t).selection,o=(e||t).doc,i,s;if(r instanceof V&&(s=r.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=$e.create(o,r.from);else if(s=="row"){let l=o.resolve(r.from+1);i=$e.rowSelection(l,l)}else if(!n){let l=ht.get(r.node),a=r.from+1,c=a+l.map[l.width*l.height-1];i=$e.create(o,a+1,c)}}else r instanceof L&&Cte(r)?i=L.create(o,r.from):r instanceof L&&Ete(r)&&(i=L.create(o,r.$from.start(),r.$from.end()));return i&&(e||(e=t.tr)).setSelection(i),e}var Ate=new ae("fix-tables");function U4(t,e,n,r){let o=t.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){let a=e.child(s);for(let c=l,u=Math.min(o,s+3);c<u;c++)if(t.child(c)==a){l=c+1,n+=a.nodeSize;continue e}r(a,n),l<o&&t.child(l).sameMarkup(a)?U4(t.child(l),a,n+1,r):a.nodesBetween(0,a.content.size,r,n+1),n+=a.nodeSize}}function qT(t,e){let n,r=(o,i)=>{o.type.spec.tableRole=="table"&&(n=kte(t,o,i,n))};return e?e.doc!=t.doc&&U4(e.doc,t.doc,0,r):t.doc.descendants(r),n}function kte(t,e,n,r){let o=ht.get(e);if(!o.problems)return r;r||(r=t.tr);let i=[];for(let a=0;a<o.height;a++)i.push(0);for(let a=0;a<o.problems.length;a++){let c=o.problems[a];if(c.type=="collision"){let u=e.nodeAt(c.pos);if(!u)continue;let d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Ha(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){let u=e.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){let u=r.mapping.map(n);r.delete(u,u+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,c=n+1;a<o.height;a++){let u=e.child(a),d=c+u.nodeSize,f=i[a];if(f>0){let h="cell";u.firstChild&&(h=u.firstChild.type.spec.tableRole);let p=[];for(let y=0;y<f;y++){let g=Nn(t.schema)[h].createAndFill();g&&p.push(g)}let m=(a==0||s==a-1)&&l==a?c+1:d-1;r.insert(r.mapping.map(m),p)}c=d}return r.setMeta(Ate,{fixTables:!0})}function ri(t){let e=t.selection,n=fv(t),r=n.node(-1),o=n.start(-1),i=ht.get(r);return{...e instanceof $e?i.rectBetween(e.$anchorCell.pos-o,e.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function B4(t,{map:e,tableStart:n,table:r},o){let i=o>0?-1:0;wte(e,r,o+i)&&(i=o==0||o==e.width?null:0);for(let s=0;s<e.height;s++){let l=s*e.width+o;if(o>0&&o<e.width&&e.map[l-1]==e.map[l]){let a=e.map[l],c=r.nodeAt(a);t.setNodeMarkup(t.mapping.map(n+a),null,L4(c.attrs,o-e.colCount(a))),s+=c.attrs.rowspan-1}else{let a=i==null?Nn(r.type.schema).cell:r.nodeAt(e.map[l+i]).type,c=e.positionAt(s,o,r);t.insert(t.mapping.map(n+c),a.createAndFill())}}return t}function P4(t,e){if(!xo(t))return!1;if(e){let n=ri(t);e(B4(t.tr,n,n.left))}return!0}function H4(t,e){if(!xo(t))return!1;if(e){let n=ri(t);e(B4(t.tr,n,n.right))}return!0}function Mte(t,{map:e,table:n,tableStart:r},o){let i=t.mapping.maps.length;for(let s=0;s<e.height;){let l=s*e.width+o,a=e.map[l],c=n.nodeAt(a),u=c.attrs;if(o>0&&e.map[l-1]==a||o<e.width-1&&e.map[l+1]==a)t.setNodeMarkup(t.mapping.slice(i).map(r+a),null,Ha(u,o-e.colCount(a)));else{let d=t.mapping.slice(i).map(r+a);t.delete(d,d+c.nodeSize)}s+=u.rowspan}}function V4(t,e){if(!xo(t))return!1;if(e){let n=ri(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let o=n.right-1;Mte(r,n,o),o!=n.left;o--){let i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=ht.get(i)}e(r)}return!0}function Rte(t,e,n){var r;let o=Nn(e.type.schema).header_cell;for(let i=0;i<t.width;i++)if(((r=e.nodeAt(t.map[i+n*t.width]))===null||r===void 0?void 0:r.type)!=o)return!1;return!0}function j4(t,{map:e,tableStart:n,table:r},o){let i=n;for(let c=0;c<o;c++)i+=r.child(c).nodeSize;let s=[],l=o>0?-1:0;Rte(e,r,o+l)&&(l=o==0||o==e.height?null:0);for(let c=0,u=e.width*o;c<e.width;c++,u++)if(o>0&&o<e.height&&e.map[u]==e.map[u-e.width]){let d=e.map[u],f=r.nodeAt(d).attrs;t.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{var a;let d=l==null?Nn(r.type.schema).cell:(a=r.nodeAt(e.map[u+l*e.width]))===null||a===void 0?void 0:a.type,f=d?.createAndFill();f&&s.push(f)}return t.insert(i,Nn(r.type.schema).row.create(null,s)),t}function F4(t,e){if(!xo(t))return!1;if(e){let n=ri(t);e(j4(t.tr,n,n.top))}return!0}function $4(t,e){if(!xo(t))return!1;if(e){let n=ri(t);e(j4(t.tr,n,n.bottom))}return!0}function Ote(t,{map:e,table:n,tableStart:r},o){let i=0;for(let c=0;c<o;c++)i+=n.child(c).nodeSize;let s=i+n.child(o).nodeSize,l=t.mapping.maps.length;t.delete(i+r,s+r);let a=new Set;for(let c=0,u=o*e.width;c<e.width;c++,u++){let d=e.map[u];if(!a.has(d)){if(a.add(d),o>0&&d==e.map[u-e.width]){let f=n.nodeAt(d).attrs;t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(o<e.height&&d==e.map[u+e.width]){let f=n.nodeAt(d),h=f.attrs,p=f.type.create({...h,rowspan:f.attrs.rowspan-1},f.content),m=e.positionAt(o+1,c,n);t.insert(t.mapping.slice(l).map(r+m),p),c+=h.colspan-1}}}}function Y4(t,e){if(!xo(t))return!1;if(e){let n=ri(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let o=n.bottom-1;Ote(r,n,o),o!=n.top;o--){let i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw new RangeError("No table found");n.table=i,n.map=ht.get(n.table)}e(r)}return!0}function T4(t){let e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Dte({width:t,height:e,map:n},r){let o=r.top*t+r.left,i=o,s=(r.bottom-1)*t+r.left,l=o+(r.right-r.left-1);for(let a=r.top;a<r.bottom;a++){if(r.left>0&&n[i]==n[i-1]||r.right<t&&n[l]==n[l+1])return!0;i+=t,l+=t}for(let a=r.left;a<r.right;a++){if(r.top>0&&n[o]==n[o-t]||r.bottom<e&&n[s]==n[s+t])return!0;o++,s++}return!1}function KT(t,e){let n=t.selection;if(!(n instanceof $e)||n.$anchorCell.pos==n.$headCell.pos)return!1;let r=ri(t),{map:o}=r;if(Dte(o,r))return!1;if(e){let i=t.tr,s={},l=M.empty,a,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){let f=o.map[u*o.width+d],h=r.table.nodeAt(f);if(!(s[f]||!h))if(s[f]=!0,a==null)a=f,c=h;else{T4(h)||(l=l.append(h.content));let p=i.mapping.map(f+r.tableStart);i.delete(p,p+h.nodeSize)}}if(a==null||c==null)return!0;if(i.setNodeMarkup(a+r.tableStart,null,{...L4(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size>0){let u=a+1+c.content.size,d=T4(c)?a+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,l)}i.setSelection(new $e(i.doc.resolve(a+r.tableStart))),e(i)}return!0}function GT(t,e){let n=Nn(t.schema);return Nte(({node:r})=>n[r.type.spec.tableRole])(t,e)}function Nte(t){return(e,n)=>{let r=e.selection,o,i;if(r instanceof $e){if(r.$anchorCell.pos!=r.$headCell.pos)return!1;o=r.$anchorCell.nodeAfter,i=r.$anchorCell.pos}else{var s;if(o=yte(r.$from),!o)return!1;i=(s=Pa(r.$from))===null||s===void 0?void 0:s.pos}if(o==null||i==null||o.attrs.colspan==1&&o.attrs.rowspan==1)return!1;if(n){let l=o.attrs,a=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});let u=ri(e),d=e.tr;for(let h=0;h<u.right-u.left;h++)a.push(c?{...l,colwidth:c&&c[h]?[c[h]]:null}:l);let f;for(let h=u.top;h<u.bottom;h++){let p=u.map.positionAt(h,u.left,u.table);h==u.top&&(p+=o.nodeSize);for(let m=u.left,y=0;m<u.right;m++,y++)m==u.left&&h==u.top||d.insert(f=d.mapping.map(p+u.tableStart,1),t({node:o,row:h,col:m}).createAndFill(a[y]))}d.setNodeMarkup(i,t({node:o,row:u.top,col:u.left}),a[0]),r instanceof $e&&d.setSelection(new $e(d.doc.resolve(r.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function q4(t,e){return function(n,r){if(!xo(n))return!1;let o=fv(n);if(o.nodeAfter.attrs[t]===e)return!1;if(r){let i=n.tr;n.selection instanceof $e?n.selection.forEachCell((s,l)=>{s.attrs[t]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[t]:e})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[t]:e}),r(i)}return!0}}function _te(t){return function(e,n){if(!xo(e))return!1;if(n){let r=Nn(e.schema),o=ri(e),i=e.tr,s=o.map.cellsInRect(t=="column"?{left:o.left,top:0,right:o.right,bottom:o.map.height}:t=="row"?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),l=s.map(a=>o.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[a],r.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(o.tableStart+s[a],r.header_cell,l[a].attrs);n(i)}return!0}}function A4(t,e,n){let r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let o=0;o<r.length;o++){let i=e.table.nodeAt(r[o]);if(i&&i.type!==n.header_cell)return!1}return!0}function yd(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?_te(t):function(n,r){if(!xo(n))return!1;if(r){let o=Nn(n.schema),i=ri(n),s=n.tr,l=A4("row",i,o),a=A4("column",i,o),c=(t==="column"?l:t==="row"&&a)?1:0,u=t=="column"?{left:0,top:c,right:1,bottom:i.map.height}:t=="row"?{left:c,top:0,right:i.map.width,bottom:1}:i,d=t=="column"?a?o.cell:o.header_cell:t=="row"?l?o.cell:o.header_cell:o.cell;i.map.cellsInRect(u).forEach(f=>{let h=f+i.tableStart,p=s.doc.nodeAt(h);p&&s.setNodeMarkup(h,d,p.attrs)}),r(s)}return!0}}var _le=yd("row",{useDeprecatedLogic:!0}),Ile=yd("column",{useDeprecatedLogic:!0}),K4=yd("cell",{useDeprecatedLogic:!0});function Ite(t,e){if(e<0){let n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,o=t.before();r>=0;r--){let i=t.node(-1).child(r),s=i.lastChild;if(s)return o-1-s.nodeSize;o-=i.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;let n=t.node(-1);for(let r=t.indexAfter(-1),o=t.after();r<n.childCount;r++){let i=n.child(r);if(i.childCount)return o+1;o+=i.nodeSize}}return null}function XT(t){return function(e,n){if(!xo(e))return!1;let r=Ite(fv(e),t);if(r==null)return!1;if(n){let o=e.doc.resolve(r);n(e.tr.setSelection(L.between(o,bte(o))).scrollIntoView())}return!0}}function G4(t,e){let n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function lv(t,e){let n=t.selection;if(!(n instanceof $e))return!1;if(e){let r=t.tr,o=Nn(t.schema).cell.createAndFill().content;n.forEachCell((i,s)=>{i.content.eq(o)||r.replace(r.mapping.map(s+1),r.mapping.map(s+i.nodeSize-1),new N(o,0,0))}),r.docChanged&&e(r)}return!0}function Lte(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;let o=e.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let c=e.child(a).content,u=a?0:Math.max(0,n-1),d=a<e.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=FT(Nn(s).row,new N(c,u,d)).content),l.push(c)}else if(i=="cell"||i=="header_cell")l.push(n||r?FT(Nn(s).row,new N(e,n,r)).content:e);else return null;return zte(s,l)}function zte(t,e){let n=[];for(let o=0;o<e.length;o++){let i=e[o];for(let s=i.childCount-1;s>=0;s--){let{rowspan:l,colspan:a}=i.child(s).attrs;for(let c=o;c<o+l;c++)n[c]=(n[c]||0)+a}}let r=0;for(let o=0;o<n.length;o++)r=Math.max(r,n[o]);for(let o=0;o<n.length;o++)if(o>=e.length&&e.push(M.empty),n[o]<r){let i=Nn(t).cell.createAndFill(),s=[];for(let l=n[o];l<r;l++)s.push(i);e[o]=e[o].append(M.from(s))}return{height:e.length,width:r,rows:e}}function FT(t,e){let n=t.createAndFill();return new el(n).replace(0,n.content.size,e).doc}function Ute({width:t,height:e,rows:n},r,o){if(t!=r){let i=[],s=[];for(let l=0;l<n.length;l++){let a=n[l],c=[];for(let u=i[l]||0,d=0;u<r;d++){let f=a.child(d%a.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Ha(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let h=1;h<f.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+f.attrs.colspan}s.push(M.from(c))}n=s,t=r}if(e!=o){let i=[];for(let s=0,l=0;s<o;s++,l++){let a=[],c=n[l%e];for(let u=0;u<c.childCount;u++){let d=c.child(u);s+d.attrs.rowspan>o&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,o-d.attrs.rowspan)},d.content)),a.push(d)}i.push(M.from(a))}n=i,e=o}return{width:t,height:e,rows:n}}function Bte(t,e,n,r,o,i,s){let l=t.doc.type.schema,a=Nn(l),c,u;if(o>e.width)for(let d=0,f=0;d<e.height;d++){let h=n.child(d);f+=h.nodeSize;let p=[],m;h.lastChild==null||h.lastChild.type==a.cell?m=c||(c=a.cell.createAndFill()):m=u||(u=a.header_cell.createAndFill());for(let y=e.width;y<o;y++)p.push(m);t.insert(t.mapping.slice(s).map(f-1+r),p)}if(i>e.height){let d=[];for(let p=0,m=(e.height-1)*e.width;p<Math.max(e.width,o);p++){let y=p>=e.width?!1:n.nodeAt(e.map[m+p]).type==a.header_cell;d.push(y?u||(u=a.header_cell.createAndFill()):c||(c=a.cell.createAndFill()))}let f=a.row.create(null,M.from(d)),h=[];for(let p=e.height;p<i;p++)h.push(f);t.insert(t.mapping.slice(s).map(r+n.nodeSize-2),h)}return!!(c||u)}function k4(t,e,n,r,o,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let c=o;c<i;c++){let u=s*e.width+c,d=e.map[u];if(e.map[u-e.width]==d){a=!0;let f=n.nodeAt(d),{top:h,left:p}=e.findCell(d);t.setNodeMarkup(t.mapping.slice(l).map(d+r),null,{...f.attrs,rowspan:s-h}),t.insert(t.mapping.slice(l).map(e.positionAt(s,p,n)),f.type.createAndFill({...f.attrs,rowspan:h+f.attrs.rowspan-s})),c+=f.attrs.colspan-1}}return a}function M4(t,e,n,r,o,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let c=o;c<i;c++){let u=c*e.width+s,d=e.map[u];if(e.map[u-1]==d){a=!0;let f=n.nodeAt(d),h=e.colCount(d),p=t.mapping.slice(l).map(d+r);t.setNodeMarkup(p,null,Ha(f.attrs,s-h,f.attrs.colspan-(s-h))),t.insert(p+f.nodeSize,f.type.createAndFill(Ha(f.attrs,0,s-h))),c+=f.attrs.rowspan-1}}return a}function R4(t,e,n,r,o){let i=n?t.doc.nodeAt(n-1):t.doc;if(!i)throw new Error("No table found");let s=ht.get(i),{top:l,left:a}=r,c=a+o.width,u=l+o.height,d=t.tr,f=0;function h(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");s=ht.get(i),f=d.mapping.maps.length}Bte(d,s,i,n,c,u,f)&&h(),k4(d,s,i,n,a,c,l,f)&&h(),k4(d,s,i,n,a,c,u,f)&&h(),M4(d,s,i,n,l,u,a,f)&&h(),M4(d,s,i,n,l,u,c,f)&&h();for(let p=l;p<u;p++){let m=s.positionAt(p,a,i),y=s.positionAt(p,c,i);d.replace(d.mapping.slice(f).map(m+n),d.mapping.slice(f).map(y+n),new N(o.rows[p-l],0,0))}h(),d.setSelection(new $e(d.doc.resolve(n+s.positionAt(l,a,i)),d.doc.resolve(n+s.positionAt(u-1,c-1,i)))),e(d)}var Pte=ch({ArrowLeft:av("horiz",-1),ArrowRight:av("horiz",1),ArrowUp:av("vert",-1),ArrowDown:av("vert",1),"Shift-ArrowLeft":cv("horiz",-1),"Shift-ArrowRight":cv("horiz",1),"Shift-ArrowUp":cv("vert",-1),"Shift-ArrowDown":cv("vert",1),Backspace:lv,"Mod-Backspace":lv,Delete:lv,"Mod-Delete":lv});function uv(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function av(t,e){return(n,r,o)=>{if(!o)return!1;let i=n.selection;if(i instanceof $e)return uv(n,r,H.near(i.$headCell,e));if(t!="horiz"&&!i.empty)return!1;let s=X4(o,t,e);if(s==null)return!1;if(t=="horiz")return uv(n,r,H.near(n.doc.resolve(i.head+e),e));{let l=n.doc.resolve(s),a=I4(l,t,e),c;return a?c=H.near(a,1):e<0?c=H.near(n.doc.resolve(l.before(-1)),-1):c=H.near(n.doc.resolve(l.after(-1)),1),uv(n,r,c)}}}function cv(t,e){return(n,r,o)=>{if(!o)return!1;let i=n.selection,s;if(i instanceof $e)s=i;else{let a=X4(o,t,e);if(a==null)return!1;s=new $e(n.doc.resolve(a))}let l=I4(s.$headCell,t,e);return l?uv(n,r,new $e(s.$anchorCell,l)):!1}}function Hte(t,e){let n=t.state.doc,r=Pa(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new $e(r))),!0):!1}function Vte(t,e,n){if(!xo(t.state))return!1;let r=Lte(n),o=t.state.selection;if(o instanceof $e){r||(r={width:1,height:1,rows:[M.from(FT(Nn(t.state.schema).cell,n))]});let i=o.$anchorCell.node(-1),s=o.$anchorCell.start(-1),l=ht.get(i).rectBetween(o.$anchorCell.pos-s,o.$headCell.pos-s);return r=Ute(r,l.right-l.left,l.bottom-l.top),R4(t.state,t.dispatch,s,l,r),!0}else if(r){let i=fv(t.state),s=i.start(-1);return R4(t.state,t.dispatch,s,ht.get(i.node(-1)).findCell(i.pos-s),r),!0}else return!1}function jte(t,e){var n;if(e.button!=0||e.ctrlKey||e.metaKey)return;let r=O4(t,e.target),o;if(e.shiftKey&&t.state.selection instanceof $e)i(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(o=Pa(t.state.selection.$anchor))!=null&&((n=PT(t,e))===null||n===void 0?void 0:n.pos)!=o.pos)i(o,e),e.preventDefault();else if(!r)return;function i(a,c){let u=PT(t,c),d=El.getState(t.state)==null;if(!u||!YT(a,u))if(d)u=a;else return;let f=new $e(a,u);if(d||!t.state.selection.eq(f)){let h=t.state.tr.setSelection(f);d&&h.setMeta(El,a.pos),t.dispatch(h)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",l),El.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(El,-1))}function l(a){let c=a,u=El.getState(t.state),d;if(u!=null)d=t.state.doc.resolve(u);else if(O4(t,c.target)!=r&&(d=PT(t,e),!d))return s();d&&i(d,c)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",l)}function X4(t,e,n){if(!(t.state.selection instanceof L))return null;let{$head:r}=t.state.selection;for(let o=r.depth-1;o>=0;o--){let i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){let s=r.before(o),l=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(l)?s:null}}return null}function O4(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function PT(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&Pa(t.state.doc.resolve(r))||Pa(t.state.doc.resolve(o))}var Fte=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")),$T(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,$T(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function $T(t,e,n,r,o,i){let s=0,l=!0,a=e.firstChild,c=t.firstChild;if(c){for(let d=0,f=0;d<c.childCount;d++){let{colspan:h,colwidth:p}=c.child(d).attrs;for(let m=0;m<h;m++,f++){let y=o==f?i:p&&p[m],g=y?y+"px":"";if(s+=y||r,y||(l=!1),a)a.style.width!=g&&(a.style.width=g),a=a.nextSibling;else{let v=document.createElement("col");v.style.width=g,e.appendChild(v)}}}for(;a;){var u;let d=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=d}l?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}var Ur=new ae("tableColumnResizing");function W4({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=Fte,lastColumnResizable:o=!0}={}){let i=new G({key:Ur,state:{init(s,l){var a;let c=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,u=Nn(l.schema).table.name;return r&&c&&(c[u]=(d,f)=>new r(d,n,f)),new $te(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{let l=Ur.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{Yte(s,l,t,o)},mouseleave:s=>{qte(s)},mousedown:(s,l)=>{Kte(s,l,e,n)}},decorations:s=>{let l=Ur.getState(s);if(l&&l.activeHandle>-1)return Qte(s,l.activeHandle)},nodeViews:{}}});return i}var $te=class dv{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){let n=this,r=e.getMeta(Ur);if(r&&r.setHandle!=null)return new dv(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new dv(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return jT(e.doc.resolve(o))||(o=-1),new dv(o,n.dragging)}return n}};function Yte(t,e,n,r){if(!t.editable)return;let o=Ur.getState(t.state);if(o&&!o.dragging){let i=Xte(e.target),s=-1;if(i){let{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=n?s=D4(t,e,"left",n):a-e.clientX<=n&&(s=D4(t,e,"right",n))}if(s!=o.activeHandle){if(!r&&s!==-1){let l=t.state.doc.resolve(s),a=l.node(-1),c=ht.get(a),u=l.start(-1);if(c.colCount(l.pos-u)+l.nodeAfter.attrs.colspan-1==c.width-1)return}J4(t,s)}}}function qte(t){if(!t.editable)return;let e=Ur.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&J4(t,-1)}function Kte(t,e,n,r){var o;if(!t.editable)return!1;let i=(o=t.dom.ownerDocument.defaultView)!==null&&o!==void 0?o:window,s=Ur.getState(t.state);if(!s||s.activeHandle==-1||s.dragging)return!1;let l=t.state.doc.nodeAt(s.activeHandle),a=Gte(t,s.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Ur,{setDragging:{startX:e.clientX,startWidth:a}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);let f=Ur.getState(t.state);f?.dragging&&(Wte(t,f.activeHandle,N4(f.dragging,d,n)),t.dispatch(t.state.tr.setMeta(Ur,{setDragging:null})))}function u(d){if(!d.which)return c(d);let f=Ur.getState(t.state);if(f&&f.dragging){let h=N4(f.dragging,d,n);_4(t,f.activeHandle,h,r)}}return _4(t,s.activeHandle,a,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),e.preventDefault(),!0}function Gte(t,e,{colspan:n,colwidth:r}){let o=r&&r[r.length-1];if(o)return o;let i=t.domAtPos(e),s=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let a=0;a<n;a++)r[a]&&(s-=r[a],l--);return s/l}function Xte(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function D4(t,e,n,r){let o=n=="right"?-r:r,i=t.posAtCoords({left:e.clientX+o,top:e.clientY});if(!i)return-1;let{pos:s}=i,l=Pa(t.state.doc.resolve(s));if(!l)return-1;if(n=="right")return l.pos;let a=ht.get(l.node(-1)),c=l.start(-1),u=a.map.indexOf(l.pos-c);return u%a.width==0?-1:c+a.map[u-1]}function N4(t,e,n){let r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function J4(t,e){t.dispatch(t.state.tr.setMeta(Ur,{setHandle:e}))}function Wte(t,e,n){let r=t.state.doc.resolve(e),o=r.node(-1),i=ht.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,a=t.state.tr;for(let c=0;c<i.height;c++){let u=c*i.width+l;if(c&&i.map[u]==i.map[u-i.width])continue;let d=i.map[u],f=o.nodeAt(d).attrs,h=f.colspan==1?0:l-i.colCount(d);if(f.colwidth&&f.colwidth[h]==n)continue;let p=f.colwidth?f.colwidth.slice():Jte(f.colspan);p[h]=n,a.setNodeMarkup(s+d,null,{...f,colwidth:p})}a.docChanged&&t.dispatch(a)}function _4(t,e,n,r){let o=t.state.doc.resolve(e),i=o.node(-1),s=o.start(-1),l=ht.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=t.domAtPos(o.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&$T(i,a.firstChild,a,r,l,n)}function Jte(t){return Array(t).fill(0)}function Qte(t,e){let n=[],r=t.doc.resolve(e),o=r.node(-1);if(!o)return ce.empty;let i=ht.get(o),s=r.start(-1),l=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let c=0;c<i.height;c++){let u=l+c*i.width;if((l==i.width-1||i.map[u]!=i.map[u+1])&&(c==0||i.map[u]!=i.map[u-i.width])){var a;let d=i.map[u],f=s+d+o.nodeAt(d).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=Ur.getState(t))===null||a===void 0)&&a.dragging&&n.push(ot.node(s+d,s+d+o.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),n.push(ot.widget(f,h))}}return ce.create(t.doc,n)}function Q4({allowTableNodeSelection:t=!1}={}){return new G({key:El,state:{init(){return null},apply(e,n){let r=e.getMeta(El);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;let{deleted:o,pos:i}=e.mapping.mapResult(n);return o?null:i}},props:{decorations:xte,handleDOMEvents:{mousedown:jte},createSelectionBetween(e){return El.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Hte,handleKeyDown:Pte,handlePaste:Vte},appendTransaction(e,n,r){return Tte(r,qT(r,n),t)}})}function Zh(t){return t==="left"||t==="right"||t==="center"?t:null}function Zte(t){let e=(t.style.textAlign||"").trim().toLowerCase(),n=(t.getAttribute("align")||"").trim().toLowerCase();return Zh(e||n)}function ene(t){return Zh(t?.align)}function r5(){return{default:null,parseHTML:t=>Zte(t),renderHTML:t=>{let e=Zh(t.align);return _U(e)?{style:`text-align: ${e}`}:{}}}}function tne(t){var e;let n=t.parentElement,r=t.closest("table");if(!n||!r)return null;let o=Array.from(n.children).indexOf(t),i=(e=r.querySelectorAll("colgroup > col")[o])===null||e===void 0?void 0:e.getAttribute("width");return i?[parseInt(i,10)]:null}function o5(t){let e=t.getAttribute("colwidth");return e?e.split(",").map(n=>parseInt(n,10)):tne(t)}var nne=/[ \t\r\n\f]+/g;function i5(t){var e;return t.children.length>0?!1:((e=t.textContent)!==null&&e!==void 0?e:"").replace(nne,"")===""}function s5(t){let e=t.createAndFill();if(!e)throw new Error(`[tiptap error]: "${t.name}" has no default content to backfill.`);return e.content}function pv(t,e,n){if(!(n in e))return;let r=e[n];(r===1||r==="1"||r===null||r===void 0)&&delete t[n]}var JT=Ie.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:o5},align:r5()}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td",getAttrs:t=>i5(t)?{}:!1,getContent:(t,e)=>s5(e.nodes[this.name])},{tag:"td"}]},renderHTML({HTMLAttributes:t}){let e=ue(this.options.HTMLAttributes,t);return pv(e,t,"colspan"),pv(e,t,"rowspan"),["td",e,0]}}),QT=Ie.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:o5},align:r5()}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th",getAttrs:t=>i5(t)?{}:!1,getContent:(t,e)=>s5(e.nodes[this.name])},{tag:"th"}]},renderHTML({HTMLAttributes:t}){let e=ue(this.options.HTMLAttributes,t);return pv(e,t,"colspan"),pv(e,t,"rowspan"),["th",e,0]}}),ZT=Ie.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",ue(this.options.HTMLAttributes,t),0]}});function WT(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Z4(t,e,n,r,o,i){let s=0,l=!0,a=e.firstChild,c=t.firstChild;if(c!==null)for(let f=0,h=0;f<c.childCount;f+=1){let{colspan:p,colwidth:m}=c.child(f).attrs;for(let y=0;y<p;y+=1,h+=1){let g=o===h?i:m&&m[y],v=g?`${g}px`:"";if(s+=g||r,g||(l=!1),a){if(a.style.width!==v){let[b,w]=WT(r,g);a.style.setProperty(b,w)}a=a.nextSibling}else{let b=document.createElement("col"),[w,S]=WT(r,g);b.style.setProperty(w,S),e.appendChild(b)}}}for(;a;){var u;let f=a.nextSibling;(u=a.parentNode)===null||u===void 0||u.removeChild(a),a=f}let d=t.attrs.style&&typeof t.attrs.style=="string"&&/\bwidth\s*:/i.test(t.attrs.style);l&&!d?(n.style.width=`${s}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${s}px`)}var rne=class{constructor(t,e,n,r={}){this.node=t,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table"));for(let[o,i]of Object.entries(r))i!=null&&(o==="style"?this.table.style.cssText=String(i):this.table.setAttribute(o,String(i)));t.attrs.style&&(this.table.style.cssText=t.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Z4(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.sameMarkup(this.node)?(this.node=t,Z4(t,this.colgroup,this.table,this.cellMinWidth),!0):!1}ignoreMutation(t){let e=t.target,n=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(n&&!r&&(t.type==="attributes"||t.type==="childList"||t.type==="characterData"))}};function one(t,e,n,r){let o=0,i=!0,s=[],l=t.firstChild;if(!l)return{};for(let u=0,d=0;u<l.childCount;u+=1){let{colspan:f,colwidth:h}=l.child(u).attrs;for(let p=0;p<f;p+=1,d+=1){let m=n===d?r:h&&h[p];o+=m||e,m||(i=!1);let[y,g]=WT(e,m);s.push(["col",{style:`${y}: ${g}`}])}}let a=i?`${o}px`:"",c=i?"":`${o}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:c}}function e5(t,e){return e?t.createChecked(null,e):t.createAndFill()}function ine(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;let e={};return Object.keys(t.nodes).forEach(n=>{let r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function sne(t,e,n,r,o){let i=ine(t),s=[],l=[];for(let c=0;c<n;c+=1){let u=e5(i.cell,o);if(u&&l.push(u),r){let d=e5(i.header_cell,o);d&&s.push(d)}}let a=[];for(let c=0;c<e;c+=1)a.push(i.row.createChecked(null,r&&c===0?s:l));return i.table.createChecked(null,a)}function l5(t){return t instanceof $e}var hv=({editor:t})=>{let{selection:e}=t.state;if(!l5(e))return!1;let n=0,r=Du(e.ranges[0].$from,o=>o.type.name==="table");return r?.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n!==e.ranges.length?!1:(t.commands.deleteTable(),!0)};function t5(t,e){let n=t.mapping.map(e),r=Du(t.selection.$from,s=>s.type.name==="table");if(r?.pos===n)return;let o=t.doc.nodeAt(n);if(!o)return;let i=n+o.nodeSize-1;t.setSelection(L.near(t.doc.resolve(i),-1))}function lne(t){let e="",n=0;for(;n<t.length;){if(t[n]==="\\"&&n+1<t.length){e+=t[n]+t[n+1],n+=2;continue}if(t[n]!=="`"){e+=t[n++];continue}let r=0;for(;n+r<t.length&&t[n+r]==="`";)r+=1;let o=n+r,i=!1;for(;o<t.length;){if(t[o]!=="`"){o+=1;continue}let s=0;for(;o+s<t.length&&t[o+s]==="`";)s+=1;if(s===r){let l=t.slice(n+r,o);e+=t.slice(n,n+r)+l.replace(/\\\||\|/g,a=>a==="|"?"\\|":a)+t.slice(o,o+r),n=o+r,i=!0;break}o+=s}i||(e+=t.slice(n,n+r),n+=r)}return e}function ane(t){return t.split(`
|
|
170
|
+
`).map(e=>!e.includes("|")||!e.includes("`")?e:lne(e)).join(`
|
|
171
|
+
`)}function cne(t){return(t||"").replaceAll(""," ").replace(/\s+/g," ").trim()}function n5(t,e){return e?t.split(e).join(`
|
|
172
|
+
`):t}function une(t){return t.replace(/\\.|\|/g,e=>e==="|"?"\\|":e)}function dne(t,e,n={}){if(!t||!t.content||t.content.length===0)return"";let r=[];t.content.forEach(f=>{let h=[];f.content&&f.content.forEach(p=>{let m="";p.content&&Array.isArray(p.content)&&p.content.length>1?m=p.content.map(b=>n5(e.renderChildren(b),n.cellLineSeparator)).join(`
|
|
173
|
+
`):m=n5(p.content?e.renderChildren(p.content):"",n.cellLineSeparator);let y=une(cne(m.replace(/[ \t]*\r?\n[ \t]*/g,"<br>"))),g=p.type==="tableHeader",v=ene(p.attrs);h.push({text:y,isHeader:g,align:v})}),r.push(h)});let o=r.reduce((f,h)=>Math.max(f,h.length),0);if(o===0)return"";let i=Array.from({length:o}).fill(0);r.forEach(f=>{for(let p=0;p<o;p+=1){var h;let m=(((h=f[p])===null||h===void 0?void 0:h.text)||"").length;m>i[p]&&(i[p]=m),i[p]<3&&(i[p]=3)}});let s=(f,h)=>f+" ".repeat(Math.max(0,h-f.length)),l=r[0],a=l.some(f=>f.isHeader),c=Array.from({length:o}).fill(null);r.forEach(f=>{for(let p=0;p<o;p+=1){var h;!c[p]&&(!((h=f[p])===null||h===void 0)&&h.align)&&(c[p]=f[p].align)}});let u=`
|
|
174
|
+
`,d=Array.from({length:o}).map((f,h)=>a&&l[h]&&l[h].text||"");return u+=`| ${d.map((f,h)=>s(f,i[h])).join(" | ")} |
|
|
175
|
+
`,u+=`| ${i.map((f,h)=>{let p=Math.max(3,f),m=c[h];return m==="left"?`:${"-".repeat(p)}`:m==="right"?`${"-".repeat(p)}:`:m==="center"?`:${"-".repeat(p)}:`:"-".repeat(p)}).join(" | ")} |
|
|
176
|
+
`,(a?r.slice(1):r).forEach(f=>{u+=`| ${Array.from({length:o}).fill(0).map((h,p)=>s(f[p]&&f[p].text||"",i[p])).join(" | ")} |
|
|
177
|
+
`}),u}var fne=new ae("preserveCellSelectionOnContextMenu");function hne(t,e){let n=t.posAtCoords({left:e.clientX,top:e.clientY});if(n)return n.pos;if(!(e.target instanceof Node))return null;try{return t.posAtDOM(e.target,0)}catch{return null}}function pne(t,e){let n=!1;return t.forEachCell((r,o)=>{e>=o&&e<o+r.nodeSize&&(n=!0)}),n}function mne(){return new G({key:fne,props:{handleDOMEvents:{mousedown(t,e){if(e.button!==2)return!1;let{selection:n}=t.state;if(!l5(n)||n.ranges.length<2)return!1;let r=hne(t,e);return r==null||!pne(n,r)?!1:(e.preventDefault(),!0)}}}})}var eA=Ie.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:rne,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){let{colgroup:n,tableWidth:r,tableMinWidth:o}=one(t,this.options.cellMinWidth),i=e.style;function s(){return i||(r?`width: ${r}`:`min-width: ${o}`)}let l=["table",ue(this.options.HTMLAttributes,e,{style:s()}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(t,e)=>{let n=[],r=Array.isArray(t.align)?t.align:[];if(t.header){let o=[];t.header.forEach((i,s)=>{var l;let a=Zh((l=r[s])!==null&&l!==void 0?l:i.align),c=a?{align:a}:{};o.push(e.createNode("tableHeader",c,[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),n.push(e.createNode("tableRow",{},o))}return t.rows&&t.rows.forEach(o=>{let i=[];o.forEach((s,l)=>{var a;let c=Zh((a=r[l])!==null&&a!==void 0?a:s.align),u=c?{align:c}:{};i.push(e.createNode("tableCell",u,[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),n.push(e.createNode("tableRow",{},i))}),e.createNode("table",void 0,n)},renderMarkdown:(t,e)=>dne(t,e),markdownTokenizer:{name:"table",level:"block",start:t=>{let e=t.split(`
|
|
178
|
+
`);if(e.length<2)return-1;let n=e[1];return!/^[ \t|:]*-[ \t|:-]*$/.test(n)||!n.includes("|")?-1:e[0].includes("|")?0:-1},tokenize(t,e,n){let r=t.indexOf(`
|
|
179
|
+
|
|
180
|
+
`),o=r>=0?t.slice(0,r):t,i=o.split(`
|
|
181
|
+
`);if(i.length<2)return;let s=i[1];if(!/^[ \t|:]*-[ \t|:-]*$/.test(s)||!s.includes("|"))return;let l=ane(o);if(l===o)return;let a=n.blockTokens(l)[0];if(a?.type!=="table"||!a.raw)return;let c=a.raw.split(`
|
|
182
|
+
`).length,u=t.split(`
|
|
183
|
+
`).slice(0,c).join(`
|
|
184
|
+
`);return{...a,raw:u}}},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:i})=>{let s=sne(i.schema,t,e,n);if(o){let l=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(L.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>P4(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>H4(t,e),deleteColumn:()=>({state:t,dispatch:e})=>{let n=Du(t.selection.$from,r=>r.type.name==="table");return V4(t,e&&(r=>{n&&t5(r,n.pos),e(r)}))},addRowBefore:()=>({state:t,dispatch:e})=>F4(t,e),addRowAfter:()=>({state:t,dispatch:e})=>$4(t,e),deleteRow:()=>({state:t,dispatch:e})=>{let n=Du(t.selection.$from,r=>r.type.name==="table");return Y4(t,e&&(r=>{n&&t5(r,n.pos),e(r)}))},deleteTable:()=>({state:t,dispatch:e})=>G4(t,e),mergeCells:()=>({state:t,dispatch:e})=>KT(t,e),splitCell:()=>({state:t,dispatch:e})=>GT(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>yd("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>yd("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>K4(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>KT(t,e)?!0:GT(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>q4(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>XT(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>XT(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&qT(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){let r=$e.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:hv,"Mod-Backspace":hv,Delete:hv,"Mod-Delete":hv}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[W4({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:null,lastColumnResizable:this.options.lastColumnResizable})]:[],Q4({allowTableNodeSelection:this.options.allowTableNodeSelection}),mne()]},addNodeView(){let t=this.options.View;return t?({node:e,view:n,HTMLAttributes:r})=>{let o=ue(this.options.HTMLAttributes,r);return new t(e,this.options.cellMinWidth,n,o)}:null},extendNodeSchema(t){let e={name:t.name,options:t.options,storage:t.storage};return{tableRole:be(B(t,"tableRole",e))}}}),Fle=we.create({name:"tableKit",addExtensions(){let t=[];return this.options.table!==!1&&t.push(eA.configure(this.options.table)),this.options.tableCell!==!1&&t.push(JT.configure(this.options.tableCell)),this.options.tableHeader!==!1&&t.push(QT.configure(this.options.tableHeader)),this.options.tableRow!==!1&&t.push(ZT.configure(this.options.tableRow)),t}});var a5=new WeakSet,c5=new WeakSet;function Va(t){let e=t;return a5.add(e),e}function tA(t){return Array.isArray(t)&&a5.has(t)}function u5(t){return t.flatMap(e=>e==null?[]:Array.isArray(e)&&c5.has(e)&&!tA(e)?u5(e):[e])}function gne(t,e){if(t==="slot")return 0;if(t instanceof Function){let o=t(e);return Array.isArray(o)&&!tA(o)&&!c5.has(o)?Va(o):o}let{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(tA(n))return Va([t,r,n]);if(n.length===0)return Va([t,r]);let o=u5(n);return o.length===0?Va([t,r]):Va([t,r,...o])}return n!=null?Va([t,r,n]):Va([t,r])}var vd=(t,e)=>gne(t,e);var yne=(t,e)=>{var n;let{state:r}=t,{selection:o}=r;if(!o.empty)return!1;let{$from:i}=o;if(i.parentOffset!==0)return!1;let s=i.depth-1;if(s<0)return!1;let l=i.node(s),a=i.index(s);if(a===0)return!1;if(l.type===e)return t.commands.lift(e.name);let c=l.child(a-1);if(c.type!==e||!(!((n=c.lastChild)===null||n===void 0)&&n.isTextblock))return!1;let u=i.before()-1-1;return t.commands.command(({tr:d,dispatch:f})=>{if(!f)return!0;let h=i.parent.content,p=new N(h,0,0);return d.replace(u,i.after(),p),d.setSelection(L.create(d.doc,u+h.size)),d.scrollIntoView(),f(d),!0})},vne=/^\s*>\s$/,d5=Ie.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return vd("blockquote",{...ue(this.options.HTMLAttributes,t),children:vd("slot",{})})},parseMarkdown:(t,e)=>{var n;let r=(n=e.parseBlockChildren)!==null&&n!==void 0?n:e.parseChildren;return e.createNode("blockquote",void 0,r(t.tokens||[]))},renderMarkdown:(t,e)=>{if(!t.content)return"";let n=">",r=[];return t.content.forEach((o,i)=>{var s,l;let a=((s=(l=e.renderChild)===null||l===void 0?void 0:l.call(e,o,i))!==null&&s!==void 0?s:e.renderChildren([o])).split(`
|
|
185
|
+
`).map(c=>c.trim()===""?n:`${n} ${c}`);r.push(a.join(`
|
|
186
|
+
`))}),r.join(`
|
|
187
|
+
${n}
|
|
188
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote(),Backspace:()=>yne(this.editor,this.type)}},addInputRules(){return[cl({find:vne,type:this.type})]}});var bne=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,wne=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,Sne=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,xne=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,f5=Rr.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 vd("strong",{...ue(this.options.HTMLAttributes,t),children:vd("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[eo({find:bne,type:this.type}),eo({find:Sne,type:this.type})]},addPasteRules(){return[Or({find:wne,type:this.type}),Or({find:xne,type:this.type})]}});var Cne=t=>{let e=/`([^`]+)`(?!`)$/.exec(t);return!e||e.index>0&&t[e.index-1]==="`"?null:{index:e.index,text:e[0],replaceWith:e[1]}},Ene=t=>{let e=/`([^`]+)`(?!`)/g,n=[],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};function Tne(t){let e=new Set((t.match(/`+/g)||[]).map(r=>r.length)),n=1;for(;e.has(n);)n+=1;return n}var h5=Rr.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",ue(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e,n)=>{var r;if(!t.content)return"";let o=typeof(n==null||(r=n.meta)===null||r===void 0?void 0:r.markText)=="string"?n.meta.markText:"",i="`".repeat(Tne(o)),s=o.startsWith("`")||o.endsWith("`")?" ":"";return`${i}${s}${e.renderChildren(t.content)}${s}${i}`},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[eo({find:Cne,type:this.type})]},addPasteRules(){return[Or({find:Ene,type:this.type})]}});var nA=4,Ane=/^```([a-z]+)?[\s\n]$/,kne=/^~~~([a-z]+)?[\s\n]$/,p5=Ie.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,exitOnArrowUp:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:nA,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;let{languageClassPrefix:n}=this.options;if(!n)return null;let r=[...((e=t.firstElementChild)===null||e===void 0?void 0:e.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return r||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",ue(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n,r;return((n=t.raw)===null||n===void 0?void 0:n.startsWith("```"))===!1&&((r=t.raw)===null||r===void 0?void 0:r.startsWith("~~~"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="",o=((n=t.attrs)===null||n===void 0?void 0:n.language)||"";return t.content?r=[`\`\`\`${o}`,e.renderChildren(t.content),"```"].join(`
|
|
189
|
+
`):r=`\`\`\`${o}
|
|
190
|
+
|
|
191
|
+
\`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;let n=(e=this.options.tabSize)!==null&&e!==void 0?e:nA,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;let l=" ".repeat(n);return s?t.commands.insertContent(l):t.commands.command(({tr:a})=>{let{from:c,to:u}=o,d=r.doc.textBetween(c,u,`
|
|
192
|
+
`,`
|
|
193
|
+
`).split(`
|
|
194
|
+
`).map(f=>l+f).join(`
|
|
195
|
+
`);return a.replaceWith(c,u,r.schema.text(d)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;let n=(e=this.options.tabSize)!==null&&e!==void 0?e:nA,{state:r}=t,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type!==this.type?!1:s?t.commands.command(({tr:l})=>{var a;let{pos:c}=i,u=i.start(),d=i.end(),f=r.doc.textBetween(u,d,`
|
|
196
|
+
`,`
|
|
197
|
+
`).split(`
|
|
198
|
+
`),h=0,p=0,m=c-u;for(let b=0;b<f.length;b+=1){if(p+f[b].length>=m){h=b;break}p+=f[b].length+1}let y=((a=f[h].match(/^ */))===null||a===void 0?void 0:a[0])||"",g=Math.min(y.length,n);if(g===0)return!0;let v=u;for(let b=0;b<h;b+=1)v+=f[b].length+1;return l.delete(v,v+g),c-v<=g&&l.setSelection(L.create(l.doc,v)),!0}):t.commands.command(({tr:l})=>{let{from:a,to:c}=o,u=r.doc.textBetween(a,c,`
|
|
199
|
+
`,`
|
|
200
|
+
`).split(`
|
|
201
|
+
`).map(d=>{var f;let h=((f=d.match(/^ */))===null||f===void 0?void 0:f[0])||"",p=Math.min(h.length,n);return d.slice(p)}).join(`
|
|
202
|
+
`);return l.replaceWith(a,c,r.schema.text(u)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;let i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
|
|
203
|
+
|
|
204
|
+
`);return!i||!s?!1:t.chain().command(({tr:l})=>(l.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowUp:({editor:t})=>{if(!this.options.exitOnArrowUp)return!1;let{state:e}=t,{selection:n}=e,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type||r.parentOffset!==0)return!1;let i=r.before();return i>0?!1:t.commands.insertDefaultBlock({pos:i})},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;let{state:e}=t,{selection:n,doc:r}=e,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type||o.parentOffset!==o.parent.nodeSize-2)return!1;let s=o.after();return s===void 0?!1:r.nodeAt(s)?t.commands.command(({tr:l})=>(l.setSelection(H.near(r.resolve(s))),!0)):t.commands.exitCode()}}},addInputRules(){return[ph({find:Ane,type:this.type,getAttributes:t=>({language:t[1]})}),ph({find:kne,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new G({key:new ae("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;let n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=o?.mode;if(!n||!i)return!1;let{tr:s,schema:l}=t.state,a=l.text(n.replace(/\r\n?/g,`
|
|
205
|
+
`));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(L.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),t.dispatch(s),!0}}})]}});var m5=Ie.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
|
|
206
|
+
|
|
207
|
+
`):""});var g5=Ie.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",ue(this.options.HTMLAttributes,t)]},renderText(){return`
|
|
208
|
+
`},renderMarkdown:()=>`
|
|
209
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{let{selection:o,storedMarks:i}=n;if(o.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:l}=r.extensionManager,a=i||o.$to.parentOffset&&o.$from.marks();return e().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&a&&s){let d=a.filter(f=>l.includes(f.type.name));c.ensureMarks(d)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var y5=Ie.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,ue(this.options.HTMLAttributes,e),0]},parseMarkdown(t,e){let n=t.depth||1;return this.options.levels.includes(n)?e.createNode("heading",{level:n},e.parseInline(t.tokens||[])):e.createNode("paragraph",void 0,e.parseInline(t.tokens||[]))},renderMarkdown:(t,e)=>{var n;let r=!((n=t.attrs)===null||n===void 0)&&n.level?parseInt(t.attrs.level,10):1,o="#".repeat(r);return t.content?`${o} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ph({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var v5=Ie.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",ue(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!NU(e,e.schema.nodes[this.name]))return!1;let{selection:n}=e,{$to:r}=n,o=t();return Fy(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:i,tr:s,dispatch:l})=>{if(l){let{$to:a}=s.selection,c=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(L.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(V.create(s.doc,a.pos)):s.setSelection(L.create(s.doc,a.pos));else{let u=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,d=u?.create();d&&(s.insert(c,d),s.setSelection(L.create(s.doc,c+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[qy({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var Mne=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Rne=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,One=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Dne=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,b5=Rr.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",ue(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[eo({find:Mne,type:this.type}),eo({find:One,type:this.type})]},addPasteRules(){return[Or({find:Rne,type:this.type}),Or({find:Dne,type:this.type})]}});var Nne="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2odyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos6kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rck0msd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12b0cam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2oodside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",_ne="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",aA="numeric",cA="ascii",uA="alpha",tp="asciinumeric",ep="alphanumeric",dA="domain",T5="emoji",Ine="scheme",Lne="slashscheme",rA="whitespace";function zne(t,e){return t in e||(e[t]=[]),e[t]}function Fa(t,e,n){e[aA]&&(e[tp]=!0,e[ep]=!0),e[cA]&&(e[tp]=!0,e[uA]=!0),e[tp]&&(e[ep]=!0),e[uA]&&(e[ep]=!0),e[ep]&&(e[dA]=!0),e[T5]&&(e[dA]=!0);for(let r in e){let o=zne(r,n);o.indexOf(t)<0&&o.push(t)}}function Une(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function fr(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}fr.groups={};fr.prototype={accepts(){return!!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){let o=e.jr[r][0],i=e.jr[r][1];if(i&&o.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let o=0;o<t.length;o++)this.tt(t[o],e,n,r)},tr(t,e,n,r){r=r||fr.groups;let o;return e&&e.j?o=e:(o=new fr(e),n&&r&&Fa(e,n,r)),this.jr.push([t,o]),o},ts(t,e,n,r){let o=this,i=t.length;if(!i)return o;for(let s=0;s<i-1;s++)o=o.tt(t[s]);return o.tt(t[i-1],e,n,r)},tt(t,e,n,r){r=r||fr.groups;let o=this;if(e&&e.j)return o.j[t]=e,e;let i=e,s,l=o.go(t);if(l?(s=new fr,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new fr,i){if(r)if(s.t&&typeof s.t=="string"){let a=Object.assign(Une(s.t,r),n);Fa(i,a,r)}else n&&Fa(i,n,r);s.t=i}return o.j[t]=s,s}};var fe=(t,e,n,r,o)=>t.ta(e,n,r,o),pt=(t,e,n,r,o)=>t.tr(e,n,r,o),w5=(t,e,n,r,o)=>t.ts(e,n,r,o),O=(t,e,n,r,o)=>t.tt(e,n,r,o),ns="WORD",fA="UWORD",A5="ASCIINUMERICAL",k5="ALPHANUMERICAL",sp="LOCALHOST",hA="TLD",pA="UTLD",vv="SCHEME",bd="SLASH_SCHEME",gA="NUM",mA="WS",yA="NL",np="OPENBRACE",rp="CLOSEBRACE",wv="OPENBRACKET",Sv="CLOSEBRACKET",xv="OPENPAREN",Cv="CLOSEPAREN",Ev="OPENANGLEBRACKET",Tv="CLOSEANGLEBRACKET",Av="FULLWIDTHLEFTPAREN",kv="FULLWIDTHRIGHTPAREN",Mv="LEFTCORNERBRACKET",Rv="RIGHTCORNERBRACKET",Ov="LEFTWHITECORNERBRACKET",Dv="RIGHTWHITECORNERBRACKET",Nv="FULLWIDTHLESSTHAN",_v="FULLWIDTHGREATERTHAN",Iv="AMPERSAND",Lv="APOSTROPHE",zv="ASTERISK",Al="AT",Uv="BACKSLASH",Bv="BACKTICK",Pv="CARET",$a="COLON",vA="COMMA",Hv="DOLLAR",oi="DOT",Vv="EQUALS",bA="EXCLAMATION",io="HYPHEN",op="PERCENT",jv="PIPE",Fv="PLUS",Sd="POUND",ja="QUERY",wA="QUOTE",M5="FULLWIDTHMIDDLEDOT",SA="SEMI",ii="SLASH",ip="TILDE",$v="UNDERSCORE",R5="EMOJI",Yv="SYM",O5=Object.freeze({__proto__:null,ALPHANUMERICAL:k5,AMPERSAND:Iv,APOSTROPHE:Lv,ASCIINUMERICAL:A5,ASTERISK:zv,AT:Al,BACKSLASH:Uv,BACKTICK:Bv,CARET:Pv,CLOSEANGLEBRACKET:Tv,CLOSEBRACE:rp,CLOSEBRACKET:Sv,CLOSEPAREN:Cv,COLON:$a,COMMA:vA,DOLLAR:Hv,DOT:oi,EMOJI:R5,EQUALS:Vv,EXCLAMATION:bA,FULLWIDTHGREATERTHAN:_v,FULLWIDTHLEFTPAREN:Av,FULLWIDTHLESSTHAN:Nv,FULLWIDTHMIDDLEDOT:M5,FULLWIDTHRIGHTPAREN:kv,HYPHEN:io,LEFTCORNERBRACKET:Mv,LEFTWHITECORNERBRACKET:Ov,LOCALHOST:sp,NL:yA,NUM:gA,OPENANGLEBRACKET:Ev,OPENBRACE:np,OPENBRACKET:wv,OPENPAREN:xv,PERCENT:op,PIPE:jv,PLUS:Fv,POUND:Sd,QUERY:ja,QUOTE:wA,RIGHTCORNERBRACKET:Rv,RIGHTWHITECORNERBRACKET:Dv,SCHEME:vv,SEMI:SA,SLASH:ii,SLASH_SCHEME:bd,SYM:Yv,TILDE:ip,TLD:hA,UNDERSCORE:$v,UTLD:pA,UWORD:fA,WORD:ns,WS:mA}),es=/[a-z]/,wd=/[a-z]/i,bv=/[\u{1F000}-\u{1FAFF}\u{2600}-\u{27BF}]|\u{FE0F}/u;try{wd=new RegExp("\\p{L}","u"),bv=new RegExp("\\p{Emoji}","u")}catch{}var ts=/\d/,oA=/\s/;var S5="\r",iA=`
|
|
210
|
+
`,Bne="\uFE0F",Pne="\u200D",sA="\uFFFC",mv=null,gv=null;function Hne(t=[]){let e={};fr.groups=e;let n=new fr;mv==null&&(mv=x5(Nne)),gv==null&&(gv=x5(_ne)),O(n,"'",Lv),O(n,"{",np),O(n,"}",rp),O(n,"[",wv),O(n,"]",Sv),O(n,"(",xv),O(n,")",Cv),O(n,"<",Ev),O(n,">",Tv),O(n,"\uFF08",Av),O(n,"\uFF09",kv),O(n,"\u300C",Mv),O(n,"\u300D",Rv),O(n,"\u300E",Ov),O(n,"\u300F",Dv),O(n,"\uFF1C",Nv),O(n,"\uFF1E",_v),O(n,"&",Iv),O(n,"*",zv),O(n,"@",Al),O(n,"`",Bv),O(n,"^",Pv),O(n,":",$a),O(n,",",vA),O(n,"$",Hv),O(n,".",oi),O(n,"=",Vv),O(n,"!",bA),O(n,"-",io),O(n,"%",op),O(n,"|",jv),O(n,"+",Fv),O(n,"#",Sd),O(n,"?",ja),O(n,'"',wA),O(n,"/",ii),O(n,";",SA),O(n,"~",ip),O(n,"_",$v),O(n,"\\",Uv),O(n,"\u30FB",M5);let r=pt(n,ts,gA,{[aA]:!0});pt(r,ts,r);let o=pt(r,es,A5,{[tp]:!0}),i=pt(r,wd,k5,{[ep]:!0}),s=pt(n,es,ns,{[cA]:!0});pt(s,ts,o),pt(s,es,s),pt(o,ts,o),pt(o,es,o);let l=pt(n,wd,fA,{[uA]:!0});pt(l,es),pt(l,ts,i),pt(l,wd,l),pt(i,ts,i),pt(i,es),pt(i,wd,i);let a=O(n,iA,yA,{[rA]:!0}),c=O(n,S5,mA,{[rA]:!0}),u=pt(n,oA,mA,{[rA]:!0});O(n,sA,u),O(c,iA,a),O(c,sA,u),pt(c,oA,u),O(u,S5),O(u,iA),pt(u,oA,u),O(u,sA,u);let d=pt(n,bv,R5,{[T5]:!0});O(d,"#"),pt(d,bv,d),O(d,Bne,d);let f=O(d,Pne);O(f,"#"),pt(f,bv,d);let h=[[es,s],[ts,o]],p=[[es,null],[wd,l],[ts,i]];for(let m=0;m<mv.length;m++)Tl(n,mv[m],hA,ns,h);for(let m=0;m<gv.length;m++)Tl(n,gv[m],pA,fA,p);Fa(hA,{tld:!0,ascii:!0},e),Fa(pA,{utld:!0,alpha:!0},e),Tl(n,"file",vv,ns,h),Tl(n,"mailto",vv,ns,h),Tl(n,"http",bd,ns,h),Tl(n,"https",bd,ns,h),Tl(n,"ftp",bd,ns,h),Tl(n,"ftps",bd,ns,h),Fa(vv,{scheme:!0,ascii:!0},e),Fa(bd,{slashscheme:!0,ascii:!0},e),t=t.sort((m,y)=>m[0]>y[0]?1:-1);for(let m=0;m<t.length;m++){let y=t[m][0],v=t[m][1]?{[Ine]:!0}:{[Lne]:!0};y.indexOf("-")>=0?v[dA]=!0:es.test(y)?ts.test(y)?v[tp]=!0:v[cA]=!0:v[aA]=!0,w5(n,y,y,v)}return w5(n,"localhost",sp,{ascii:!0}),n.jd=new fr(Yv),{start:n,tokens:Object.assign({groups:e},O5)}}function D5(t,e){let n=Vne(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=n.length,o=[],i=0,s=0;for(;s<r;){let l=t,a=null,c=0,u=null,d=-1,f=-1;for(;s<r&&(a=l.go(n[s]));)l=a,l.accepts()?(d=0,f=0,u=l):d>=0&&(d+=n[s].length,f++),c+=n[s].length,i+=n[s].length,s++;i-=d,s-=f,c-=d,o.push({t:u.t,v:e.slice(i-c,i),s:i-c,e:i})}return o}function Vne(t){let e=[],n=t.length,r=0;for(;r<n;){let o=t.charCodeAt(r),i,s=o<55296||o>56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function Tl(t,e,n,r,o){let i,s=e.length;for(let l=0;l<s-1;l++){let a=e[l];t.j[a]?i=t.j[a]:(i=new fr(r),i.jr=o.slice(),t.j[a]=i),t=i}return i=new fr(n),i.jr=o.slice(),t.j[e[s-1]]=i,i}function x5(t){let e=[],n=[],r=0,o="0123456789";for(;r<t.length;){let i=0;for(;o.indexOf(t[r+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}var lp={defaultProtocol:"http",events:null,format:C5,formatHref:C5,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],ignoreClasses:[],render:null};function xA(t,e=null){let n=Object.assign({},lp);t&&(n=Object.assign(n,t instanceof xA?t.o:t));let r=n.ignoreTags,o=[];for(let i=0;i<r.length;i++)o.push(r[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=o,this.ignoreClasses=n.ignoreClasses.slice()}xA.prototype={o:lp,ignoreTags:[],ignoreClasses:[],isIgnoredClass(t){if(typeof t!="string"||this.ignoreClasses.length===0)return!1;let e=t.split(/\s+/);for(let n=0;n<e.length;n++)if(this.ignoreClasses.indexOf(e[n])>=0)return!0;return!1},defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){let r=e!=null,o=this.o[t];return o&&(typeof o=="object"?(o=n.t in o?o[n.t]:lp[t],typeof o=="function"&&r&&(o=o(e,n))):typeof o=="function"&&r&&(o=o(e,n.t,n)),o)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){let e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function C5(t){return t}function N5(t,e){this.t="token",this.v=t,this.tk=e}N5.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){let e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"\u2026":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=lp.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),a=t.get("target",n,e),c=t.get("rel",n,e),u=t.getObj("attributes",n,e),d=t.getObj("events",n,e);return s.href=r,l&&(s.class=l),a&&(s.target=a),c&&(s.rel=c),u&&Object.assign(s,u),{tagName:o,attributes:s,content:i,eventListeners:d}}};function qv(t,e){class n extends N5{constructor(o,i){super(o,i),this.t=t}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var jne=qv("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),E5=qv("text"),Fne=qv("nl"),yv=qv("url",{isLink:!0,toHref(t=lp.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==sp&&t[1].t===$a}});var oo=t=>new fr(t);function $ne({groups:t}){let e=t.domain.concat([Iv,zv,Al,Uv,Bv,Pv,Hv,Vv,io,gA,op,jv,Fv,Sd,ii,Yv,ip,$v]),n=[Lv,$a,vA,oi,bA,op,ja,wA,SA,Ev,Tv,np,rp,Sv,wv,xv,Cv,Av,kv,Mv,Rv,Ov,Dv,Nv,_v],r=[Iv,Lv,zv,Uv,Bv,Pv,Hv,Vv,io,np,rp,op,jv,Fv,Sd,ja,ii,Yv,ip,$v],o=oo(),i=O(o,ip);fe(i,r,i),fe(i,t.domain,i);let s=oo(),l=oo(),a=oo();fe(o,t.domain,s),fe(o,t.scheme,l),fe(o,t.slashscheme,a),fe(s,r,i),fe(s,t.domain,s);let c=O(s,Al);O(i,Al,c),O(l,Al,c),O(a,Al,c);let u=O(i,oi);fe(u,r,i),fe(u,t.domain,i);let d=oo();fe(c,t.domain,d),fe(d,t.domain,d);let f=O(d,oi);fe(f,t.domain,d);let h=oo(jne);fe(f,t.tld,h),fe(f,t.utld,h),O(c,sp,h);let p=O(d,io);O(p,io,p),fe(p,t.domain,d),fe(h,t.domain,d),O(h,oi,f),O(h,io,p);let m=O(s,io),y=O(s,oi);O(m,io,m),fe(m,t.domain,s),fe(y,r,i),fe(y,t.domain,s);let g=oo(yv);fe(y,t.tld,g),fe(y,t.utld,g),fe(g,t.domain,s),fe(g,r,i),O(g,oi,y),O(g,io,m),O(g,Al,c);let v=O(g,$a),b=oo(yv);fe(v,t.numeric,b);let w=oo(yv),S=oo();fe(w,e,w),fe(w,n,S),fe(S,e,w),fe(S,n,S),O(g,ii,w),O(b,ii,w),O(g,ja,S),O(g,Sd,w),O(b,ja,S),O(b,Sd,w);let C=O(l,$a),x=O(a,$a),E=O(x,ii),A=O(E,ii);fe(l,t.domain,s),O(l,oi,y),O(l,io,m),fe(a,t.domain,s),O(a,oi,y),O(a,io,m),fe(C,t.domain,w),O(C,ii,w),O(C,ja,w),fe(A,t.domain,w),fe(A,e,w),O(A,ii,w);let T=[[np,rp],[wv,Sv],[xv,Cv],[Ev,Tv],[Av,kv],[Mv,Rv],[Ov,Dv],[Nv,_v]];for(let _=0;_<T.length;_++){let[z,$]=T[_],I=O(w,z);O(S,z,I);let j=oo(yv);fe(I,e,j);let D=oo();fe(I,n,D),O(I,$,w),fe(j,e,j),fe(j,n,D),fe(D,e,j),fe(D,n,D),O(j,$,w),O(D,$,w)}return O(o,sp,g),O(o,yA,Fne),{start:o,tokens:O5}}function Yne(t,e,n){let r=n.length,o=0,i=[],s=[],l=[];for(;o<r;){let a=t,c=null,u=null,d=0,f=null,h=-1,p=[];for(;o<r&&!(c=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(u=c||a.go(n[o].t));)if(c=null,a=u,o++,d++,a.accepts())h=0,f=a,p=[];else if(h>=0&&h++,p.push(a),l[o]&&l[o].has(a))break;for(let m=0,y=o-p.length+1;m<p.length;m++,y++)(l[y]||(l[y]=new Set)).add(p[m]);if(h<0)o-=d,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(lA(E5,e,s)),s=[]),o-=h,d-=h;let m=f.t,y=n.slice(o-d,o);i.push(lA(m,e,y))}}return s.length>0&&i.push(lA(E5,e,s)),i}function lA(t,e,n){let r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}var qne=typeof console<"u"&&console&&console.warn||(()=>{}),Kne="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",tt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function _5(){return fr.groups={},tt.scanner=null,tt.parser=null,tt.tokenQueue=[],tt.pluginQueue=[],tt.customSchemes=[],tt.initialized=!1,tt}function CA(t,e=!1){if(tt.initialized&&qne(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Kne}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
|
|
211
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
212
|
+
2. Cannot start or end with "-"
|
|
213
|
+
3. "-" cannot repeat`);tt.customSchemes.push([t,e])}function Gne(){tt.scanner=Hne(tt.customSchemes);for(let t=0;t<tt.tokenQueue.length;t++)tt.tokenQueue[t][1]({scanner:tt.scanner});tt.parser=$ne(tt.scanner.tokens);for(let t=0;t<tt.pluginQueue.length;t++)tt.pluginQueue[t][1]({scanner:tt.scanner,parser:tt.parser});return tt.initialized=!0,tt}function Kv(t){return tt.initialized||Gne(),Yne(tt.parser.start,t,D5(tt.scanner.start,t))}Kv.scan=D5;function EA(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}let r=new xA(n),o=Kv(t),i=[];for(let s=0;s<o.length;s++){let l=o[s];l.isLink&&(!e||l.t===e)&&r.check(l)&&i.push(l.toFormattedObject(r))}return i}var Gv="[\0- \xA0\u1680\u180E\u2000-\u2029\u205F\u3000]",Xne=new RegExp(Gv),Wne=new RegExp(`${Gv}$`),Jne=new RegExp(`${Gv}+$`),Qne=new RegExp(Gv,"g");function Zne(t,e,n){var r,o;let i=t.doc.resolve(e.to);if(!(!((r=i.nodeBefore)===null||r===void 0)&&r.isText))return;let s=(o=t.doc.textBetween(e.from,e.to,"\uFFFC","\uFFFC").match(Jne))===null||o===void 0?void 0:o[0];if(!s)return;let l=e.to-s.length,a=hh(l,e.to,t.doc).filter(d=>d.mark.type===n);if(!a.length)return;let{nodeAfter:c}=i;if(c&&a.some(d=>d.mark.isInSet(c.marks)))return;let u=t.storedMarks;t.removeMark(l,e.to,n),t.setStoredMarks(u),t.selection.empty&&t.selection.from===e.to&&t.removeStoredMark(n)}function ere(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function tre(t){return new G({key:new ae("autolink"),appendTransaction:(e,n,r)=>{let o=e.some(a=>a.docChanged)&&!n.doc.eq(r.doc),i=e.some(a=>a.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,l=tE(n.doc,[...e]);if(!e.some(Iz)){let a=[];l.steps.forEach((c,u)=>{if(!(c instanceof dt)||!c.slice.size)return;let d=l.mapping.slice(u+1),f=d.map(c.from,1),h=d.map(c.from+c.slice.size,-1);f<h&&a.push({from:f,to:h})}),a.sort((c,u)=>u.to-c.to),a.forEach(c=>Zne(s,c,t.type))}if(Nu(l).forEach(({newRange:a})=>{let c=fU(r.doc,a,f=>f.isTextblock),u,d;if(c.length>1)u=c[0],d=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(c.length){let f=r.doc.textBetween(a.from,a.to," "," ");if(!Wne.test(f))return;u=c[0],d=r.doc.textBetween(u.pos,a.to,void 0," ")}if(u&&d){let f=d.split(Xne).filter(Boolean);if(f.length<=0)return!1;let h=f[f.length-1],p=u.pos+d.lastIndexOf(h);if(!h)return!1;let m=Kv(h).map(y=>y.toObject(t.defaultProtocol));if(!ere(m))return!1;m.filter(y=>y.isLink).map(y=>({...y,from:p+y.start+1,to:p+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>t.validate(y.value)).filter(y=>t.shouldAutoLink(y.value)).forEach(y=>{hh(y.from,y.to,r.doc).some(g=>g.mark.type===t.type)||s.addMark(y.from,y.to,t.type.create({href:y.href}))})}}),!!s.steps.length)return s}})}function nre(t){return new G({key:new ae("handleClickLink"),props:{handleClick:(e,n,r)=>{if(r.button!==0||!e.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let a=r.target;if(!a)return!1;let c=t.editor.view.dom;o=a.closest("a"),o&&!c.contains(o)&&(o=null)}if(!o)return!1;let i=!1;if(t.enableClickSelection&&(i=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){var s,l;let a=iE(e.state,t.type.name),c=(s=o.href)!==null&&s!==void 0?s:a.href,u=(l=o.target)!==null&&l!==void 0?l:a.target;c&&(window.open(c,u),i=!0)}return i}}})}var rre=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)$/,ore=/\[([^[\]]+)\]\(((?:[^\s()]|\([^\s()]*\))+)(?:\s+(?:(["'])(.*?)\3|“(.*?)”|‘(.*?)’))?\)/g;function I5(t,e){let n=0;for(let r=e-1;r>=0&&t[r]==="\\";r-=1)n+=1;return n%2===1}function ire(t,e){let n=0,r=0;for(;r<e;){if(t[r]!=="`"){r+=1;continue}if(n===0&&I5(t,r)){r+=1;continue}let o=0;for(;r<e&&t[r]==="`";)o+=1,r+=1;n===0?n=o:o===n&&(n=0)}return n>0}function L5(t,e,n){var r,o;let[,i,s]=e;return(e.index?t[e.index-1]:void 0)==="!"||I5(t,(r=e.index)!==null&&r!==void 0?r:0)||ire(t,(o=e.index)!==null&&o!==void 0?o:0)?!1:!!i.trim()&&n(s)}function z5(t){var e,n;let[r,o,i,,s,l,a]=t,c=(e=s??l)!==null&&e!==void 0?e:a;return{index:(n=t.index)!==null&&n!==void 0?n:0,text:r,replaceWith:o,data:{href:i,title:c||null,markdown:!0}}}function sre(t,e){return t.index<e.index+e.text.length&&e.index<t.index+t.text.length}function U5(t){var e,n,r;return{href:(e=t.data)===null||e===void 0?void 0:e.href,title:(n=(r=t.data)===null||r===void 0?void 0:r.title)!==null&&n!==void 0?n:null}}function lre(t){let e=eo({find:n=>{let r=rre.exec(n);return!r||!L5(n,r,t.isAllowedHref)?null:z5(r)},type:t.type,getAttributes:U5});return new Iu({find:e.find,handler:n=>{let r=e.handler(n);return r!==null&&n.state.tr.steps.length&&n.state.tr.setMeta("preventAutolink",!0),r}})}function are(t){let e=Or({find:n=>{var r,o;let i=[];for(let l of n.matchAll(ore))L5(n,l,t.isAllowedHref)&&i.push(z5(l));let s=((r=(o=t.findPlainUrls)===null||o===void 0?void 0:o.call(t,n))!==null&&r!==void 0?r:[]).filter(l=>!i.some(a=>sre(a,l)));return[...i,...s]},type:t.type,getAttributes:U5});return new dE({find:e.find,handler:n=>{var r;let o=e.handler(n);return o!==null&&n.state.tr.steps.length&&(!((r=n.match.data)===null||r===void 0)&&r.markdown)&&n.state.tr.setMeta("preventAutolink",!0),o}})}function cre(t){return new G({key:new ae("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{shouldAutoLink:o}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});let c=EA(a,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===a);return!a||!c||o!==void 0&&!o(c.value)?!1:t.editor.commands.setMark(t.type,{href:c.href})}}})}function rs(t,e){let n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{let o=typeof r=="string"?r:r.scheme;o&&n.push(o)}),!t||t.replace(Qne,"").match(new RegExp(`^(?:(?:${n.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join("|")}):|[^a-z]|[a-z0-9+.\\-]+(?:[^a-z+.\\-:]|$))`,"i"))}var B5=Rr.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){CA(t);return}CA(t.scheme,t.optionalSlashes)})},onDestroy(){_5()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,markdownLinks:!1,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!rs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{let e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;let r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){var t,e,n;return{href:{default:null,parseHTML(r){return r.getAttribute("href")}},target:{default:(t=this.options.HTMLAttributes.target)!==null&&t!==void 0?t:null},rel:{default:(e=this.options.HTMLAttributes.rel)!==null&&e!==void 0?e:null},class:{default:(n=this.options.HTMLAttributes.class)!==null&&n!==void 0?n:null},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{let e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!rs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!rs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",ue(this.options.HTMLAttributes,t),0]:["a",ue(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,o,i;let s=(n=(r=t.attrs)===null||r===void 0?void 0:r.href)!==null&&n!==void 0?n:"",l=(o=(i=t.attrs)===null||i===void 0?void 0:i.title)!==null&&o!==void 0?o:"",a=e.renderChildren(t);return l?`[${a}](${s} "${l}")`:`[${a}](${s})`},addCommands(){return{setLink:t=>({chain:e})=>{let{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!rs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{let{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!rs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addInputRules(){return this.options.markdownLinks?[lre({type:this.type,isAllowedHref:t=>this.options.isAllowedUri(t,{defaultValidate:e=>!!rs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})})]:[]},addPasteRules(){let t=e=>{let n=[];if(e){let{protocols:r,defaultProtocol:o}=this.options;EA(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!rs(s,r),protocols:r,defaultProtocol:o})).forEach(i=>{this.options.shouldAutoLink(i.value)&&n.push({text:i.value,data:{href:i.href},index:i.start})})}return n};return this.options.markdownLinks?[are({type:this.type,isAllowedHref:e=>this.options.isAllowedUri(e,{defaultValidate:n=>!!rs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}),findPlainUrls:t})]:[Or({find:t,type:this.type,getAttributes:e=>{var n;return{href:(n=e.data)===null||n===void 0?void 0:n.href}}})]},addProseMirrorPlugins(){let t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(tre({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!rs(o,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(nre({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(cre({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}});var Xv=" ",TA="\xA0",P5=Ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",ue(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{let n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);let r=e.parseInline(n);return n.length===1&&n[0].type==="text"&&(n[0].raw===Xv||n[0].text===Xv||n[0].raw===TA||n[0].text===TA)&&r.length===1&&r[0].type==="text"&&(r[0].text===Xv||r[0].text===TA)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e,n)=>{if(!t)return"";let r=Array.isArray(t.content)?t.content:[];if(r.length===0){var o,i;let s=Array.isArray(n==null||(o=n.previousNode)===null||o===void 0?void 0:o.content)?n.previousNode.content:[];return(n==null||(i=n.previousNode)===null||i===void 0?void 0:i.type)==="paragraph"&&s.length===0?Xv:""}return e.renderChildren(r)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var ure=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,dre=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,H5=Rr.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",ue(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[eo({find:ure,type:this.type})]},addPasteRules(){return[Or({find:dre,type:this.type})]}});var V5=Ie.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""});var j5=Rr.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",ue(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`<u>${e.renderChildren(t)}</u>`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.toLowerCase().indexOf("<u>")},tokenize(t,e,n){if(!/^<u>/i.test(t))return;let r=/\\[\s\S]|`+|<\/u>/gi;r.lastIndex=3;let o=r.exec(t);for(;o;){if(o[0].startsWith("`")){let i=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/.exec(t.slice(o.index));i&&(r.lastIndex=o.index+i[0].length)}else if(!o[0].startsWith("\\")){let i=t.slice(3,o.index);return i?{type:"underline",raw:t.slice(0,r.lastIndex),text:i,tokens:n.inlineTokens(i)}:void 0}o=r.exec(t)}}},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()}}});function F5(t={}){return new G({view(e){return new AA(e,t)}})}var AA=class{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(o=>{let i=s=>{this[o](s)};return e.dom.addEventListener(o,i),{name:o,handler:i}})}destroy(){this.setCursor(null),this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){if(this.cursorPos!=null&&n.doc!=e.state.doc)if(this.lastDragEvent){let r=this.computeTarget(this.lastDragEvent);r==this.cursorPos?this.updateOverlay():this.setCursor(r)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,o=this.editorView.dom,i=o.getBoundingClientRect(),s=i.width/o.offsetWidth,l=i.height/o.offsetHeight;if(n){let d=e.nodeBefore,f=e.nodeAfter;if(d||f){let h=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(h){let p=h.getBoundingClientRect(),m=d?p.bottom:p.top;d&&f&&(m=(m+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;r={left:p.left,right:p.right,top:m-y,bottom:m+y}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*s;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!a||a==document.body&&getComputedStyle(a).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=a.getBoundingClientRect(),f=d.width/a.offsetWidth,h=d.height/a.offsetHeight;c=d.left-a.scrollLeft*f,u=d.top-a.scrollTop*h}this.element.style.left=(r.left-c)/s+"px",this.element.style.top=(r.top-u)/l+"px",this.element.style.width=(r.right-r.left)/s+"px",this.element.style.height=(r.bottom-r.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),o=r&&r.type.spec.disableDropCursor,i=typeof o=="function"?o(this.editorView,n,e):o;if(!n||i)return null;let s=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=uy(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}return s}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let n=this.computeTarget(e);n!=null&&(this.setCursor(n),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}};var _n=class t extends H{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return t.valid(r)?new t(r):H.near(r)}content(){return N.empty}eq(e){return e instanceof t&&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 t(e.resolve(n.pos))}getBookmark(){return new kA(this.anchor)}static valid(e){let n=e.parent;if(n.inlineContent||!fre(e)||!hre(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let o=n.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&t.valid(e))return e;let o=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(n>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(n>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;o+=n;let a=e.doc.resolve(o);if(t.valid(a))return a}for(;;){let s=n>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!V.isSelectable(i)){e=e.doc.resolve(o+i.nodeSize*n),r=!1;continue e}break}i=s,o+=n;let l=e.doc.resolve(o);if(t.valid(l))return l}return null}}};_n.prototype.visible=!1;_n.findFrom=_n.findGapCursorFrom;H.jsonID("gapcursor",_n);var kA=class t{constructor(e){this.pos=e}map(e){return new t(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return _n.valid(n)?new _n(n):H.near(n)}};function $5(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function fre(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 o=r.child(n-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||$5(o.type))return!0;if(o.inlineContent)return!1}}return!0}function hre(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 o=r.child(n);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||$5(o.type))return!0;if(o.inlineContent)return!1}}return!0}function Y5(){return new G({props:{decorations:yre,createSelectionBetween(t,e,n){return e.pos==n.pos&&_n.valid(n)?new _n(n):null},handleClick:mre,handleKeyDown:pre,handleDOMEvents:{beforeinput:gre}}})}var pre=ch({ArrowLeft:Wv("horiz",-1),ArrowRight:Wv("horiz",1),ArrowUp:Wv("vert",-1),ArrowDown:Wv("vert",1)});function Wv(t,e){let n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,i){let s=r.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof L){if(!i.endOfTextblock(n)||l.depth==0)return!1;a=!1,l=r.doc.resolve(e>0?l.after():l.before())}let c=_n.findGapCursorFrom(l,e,a);return c?(o&&o(r.tr.setSelection(new _n(c))),!0):!1}}function mre(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!_n.valid(r))return!1;let o=t.posAtCoords({left:n.clientX,top:n.clientY});return o&&o.inside>-1&&V.isSelectable(t.state.doc.nodeAt(o.inside))?!1:(t.dispatch(t.state.tr.setSelection(new _n(r))),!0)}function gre(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof _n))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 o=M.empty;for(let s=r.length-1;s>=0;s--)o=M.from(r[s].createAndFill(null,o));let i=t.state.tr.replace(n.pos,n.pos,new N(o,0,0));return i.setSelection(L.near(i.doc.resolve(n.pos+1))),t.dispatch(i),!1}function yre(t){if(!(t.selection instanceof _n))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",ce.create(t.doc,[ot.widget(t.selection.head,e,{key:"gapcursor"})])}var Wae=we.create({name:"characterCount",addOptions(){return{limit:null,autoTrim:!0,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{let e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){let n=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(n)}return e.nodeSize},this.storage.words=t=>{let e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new G({key:new ae("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;let o=this.options.limit,i=this.options.autoTrim;if(o==null||o===0||i===!1){t=!0;return}let s=this.storage.characters({node:r.doc});if(s>o){let l=s-o,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);let u=r.tr.deleteRange(a,c);return t=!0,u}t=!0},filterTransaction:(e,n)=>{let r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;let o=this.storage.characters({node:n.doc}),i=this.storage.characters({node:e.doc});if(i<=r||o>r&&i>r&&i<=o)return!0;if(o>r&&i>r&&i>o||!e.getMeta("paste"))return!1;let s=e.selection.$head.pos,l=s-(i-r),a=s;return e.deleteRange(l,a),!(this.storage.characters({node:e.doc})>r)}})]}}),G5=we.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[F5(this.options)]}}),Jae=we.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new G({key:new ae("focus"),props:{decorations:({doc:t,selection:e})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:o}=e,i=[];if(!n||!r)return ce.create(t,[]);let s=0;this.options.mode==="deepest"&&t.descendants((a,c)=>{if(!a.isText){if(!(o>=c&&o<=c+a.nodeSize-1))return!1;s+=1}});let l=0;return t.descendants((a,c)=>{if(a.isText||!(o>=c&&o<=c+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(ot.node(c,c+a.nodeSize,{class:this.options.className}))}),ce.create(t,i)}}})]}}),X5=we.create({name:"gapCursor",addProseMirrorPlugins(){return[Y5()]},extendNodeSchema(t){var e;let n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=be(B(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),W5="placeholder",q5=new ae("tiptap__placeholder");function J5(t){let{editor:e,placeholder:n,dataAttribute:r,pos:o,node:i,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=t,u=[a];return s&&u.push(c),ot.node(o,o+i.nodeSize,{class:u.join(" "),[r]:typeof n=="function"?n({editor:e,node:i,pos:o,hasAnchor:l}):n})}function Q5(t,e){return typeof t=="function"?t(e):t}function Z5({editor:t,options:e,dataAttribute:n,doc:r,selection:o,from:i,to:s}){let{anchor:l}=o,a=[],c=t.isEmpty;return r.nodesBetween(i,s,(u,d)=>{let f=l>=d&&l<=d+u.nodeSize,h=!u.isLeaf&&_u(u);return u.type.isTextblock&&(f||!e.showOnlyCurrent)&&h&&a.push(J5({editor:t,isEmptyDoc:c,dataAttribute:n,hasAnchor:f,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Q5(e.emptyNodeClass,{editor:t,node:u,pos:d,hasAnchor:f})},node:u,pos:d})),e.includeChildren}),a}function e8({editor:t,options:e,dataAttribute:n,doc:r,selection:o}){if(!(t.isEditable||!e.showOnlyWhenEditable))return null;let{anchor:i}=o,s=[],l=t.isEmpty;if(e.showOnlyCurrent&&!e.includeChildren){let a=r.resolve(i),c=a.depth>0?a.node(1):a.nodeAfter,u=a.depth>0?a.before(1):i;if(c&&c.type.isTextblock&&_u(c)){let d=i>=u&&i<=u+c.nodeSize;s.push(J5({editor:t,isEmptyDoc:l,dataAttribute:n,hasAnchor:d,placeholder:e.placeholder,classes:{emptyEditor:e.emptyEditorClass,emptyNode:Q5(e.emptyNodeClass,{editor:t,node:c,pos:u,hasAnchor:d})},node:c,pos:u}))}}else s.push(...Z5({editor:t,options:e,dataAttribute:n,doc:r,selection:o,from:0,to:r.content.size}));return ce.create(r,s)}function ap(t,e){let n=t.resolve(e);if(n.depth===0){var r;let i=(r=n.nodeAfter)!==null&&r!==void 0?r:n.nodeBefore;if(!i)return{from:e,to:e};let s=n.nodeAfter?e:e-i.nodeSize;return{from:s,to:s+i.nodeSize}}let o=n.before(1);return{from:o,to:o+n.node(1).nodeSize}}function cp(t,e){return{from:Math.max(0,e.from-1),to:Math.min(t.content.size,e.to-1)}}function vre(t,e,n){let r=[];return t.forEach((o,i)=>{let s=i,l=s+o.nodeSize,a=s+1,c=l+1;a<n&&c>e&&r.push({from:s,to:l})}),r}function bre(t){if(t.length===0)return[];let e=[...t].sort((r,o)=>r.from-o.from),n=[{...e[0]}];for(let r=1;r<e.length;r+=1){let o=n[n.length-1],i=e[r];i.from<=o.to?o.to=Math.max(o.to,i.to):n.push({...i})}return n}function wre(t,e){let n=vre(t,e.from,e.to);return n.push(cp(t,ap(t,e.from))),e.to>e.from?n.push(cp(t,ap(t,Math.min(e.to,t.content.size+1)-1))):e.from<t.content.size+1&&n.push(cp(t,ap(t,Math.min(e.from+1,t.content.size)))),n}function Sre(t,e,n){let r=[];if(t.docChanged){let o=Nu(t);for(let i of o)r.push(...wre(n.doc,i.newRange))}return t.selectionSet&&(r.push(cp(n.doc,ap(n.doc,t.mapping.map(e.selection.anchor)))),r.push(cp(n.doc,ap(n.doc,n.selection.anchor)))),bre(r)}function xre(t,e,n){let r=Math.max(0,Math.min(t,n.content.size));return{from:r,to:Math.max(r,Math.min(e,n.content.size))}}function Cre({decorations:t,ranges:e,editor:n,options:r,dataAttribute:o,doc:i,selection:s}){let l=t;for(let a of e){let{from:c,to:u}=xre(a.from,a.to,i),d=l.find(c,u).filter(h=>h.from>=c&&h.to<=u);d.length&&(l=l.remove(d));let f=Z5({editor:n,options:r,dataAttribute:o,doc:i,selection:s,from:c,to:u});f.length&&(l=l.add(i,f))}return l}function Ere({editor:t,options:e,dataAttribute:n}){return{init(r,o){let i=e8({editor:t,options:e,dataAttribute:n,doc:o.doc,selection:o.selection});return i??ce.empty},apply(r,o,i,s){return!r.docChanged&&!r.selectionSet?o:Cre({decorations:o.map(r.mapping,r.doc),ranges:Sre(r,i,s),editor:t,options:e,dataAttribute:n,doc:s.doc,selection:s.selection})}}}function Tre(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}function Are({editor:t,options:e}){let n=e.dataAttribute?`data-${Tre(e.dataAttribute)}`:`data-${W5}`,r=e.showOnlyCurrent&&!e.includeChildren;return new G({key:q5,...r?{}:{state:Ere({editor:t,options:e,dataAttribute:n})},props:{decorations:r?({doc:o,selection:i})=>e8({editor:t,options:e,dataAttribute:n,doc:o,selection:i}):o=>{var i;return e.showOnlyWhenEditable&&!t.isEditable?ce.empty:(i=q5.getState(o))!==null&&i!==void 0?i:ce.empty}}})}var Qae=we.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:W5,placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[Are({editor:this.editor,options:this.options})]}});function MA(t,e){return!t.selection.empty&&!Fy(t.selection)&&e.isEditable}function kre(t,e){return MA(t,e)&&!e.isFocused&&!e.view.dragging}function Mre(){var t;(t=window.getSelection())===null||t===void 0||t.removeAllRanges()}function Rre(t){t.focus()}var Zae=we.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){let{editor:t,options:e}=this;return[new G({key:new ae("selection"),props:{decorations(n){return kre(n,t)?ce.create(n.doc,[ot.inline(n.selection.from,n.selection.to,{class:e.className})]):null},handleDOMEvents:{blur(n){return MA(n.state,t)&&Mre(),!1},focus(n){return MA(n.state,t)&&requestAnimationFrame(()=>{!t.isDestroyed&&n.hasFocus()&&Rre(n)}),!1}}}})]}});function K5({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var t8=we.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;let e=new ae(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)===null||t===void 0?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,o])=>o).filter(o=>(this.options.notAfter||[]).concat(n).includes(o.name));return[new G({key:e,appendTransaction:(o,i,s)=>{let{doc:l,tr:a,schema:c}=s,u=e.getState(s),d=l.content.size,f=c.nodes[n];if(!o.some(h=>h.getMeta("skipTrailingNode"))&&u)return a.insert(d,f.create())},state:{init:(o,i)=>{let s=i.tr.doc.lastChild;return!K5({node:s,types:r})},apply:(o,i)=>{if(!o.docChanged||o.getMeta("__uniqueIDTransaction"))return i;let s=o.doc.lastChild;return!K5({node:s,types:r})}}})]}}),n8=we.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>KC(t,e),redo:()=>({state:t,dispatch:e})=>GC(t,e)}},addProseMirrorPlugins(){return[_z(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var Ore=we.create({name:"starterKit",addExtensions(){let t=[];if(this.options.bold!==!1&&t.push(f5.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(d5.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(OT.configure(this.options.bulletList)),this.options.code!==!1&&t.push(h5.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(p5.configure(this.options.codeBlock)),this.options.document!==!1&&t.push(m5.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(G5.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(X5.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(g5.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(y5.configure(this.options.heading)),this.options.undoRedo!==!1&&t.push(n8.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&t.push(v5.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(b5.configure(this.options.italic)),this.options.listItem!==!1&&t.push(_T.configure(this.options.listItem)),this.options.listKeymap!==!1){var e;t.push(LT.configure((e=this.options)===null||e===void 0?void 0:e.listKeymap))}if(this.options.link!==!1){var n;t.push(B5.configure((n=this.options)===null||n===void 0?void 0:n.link))}if(this.options.orderedList!==!1&&t.push(zT.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(P5.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(H5.configure(this.options.strike)),this.options.text!==!1&&t.push(V5.configure(this.options.text)),this.options.underline!==!1){var r;t.push(j5.configure((r=this.options)===null||r===void 0?void 0:r.underline))}if(this.options.trailingNode!==!1){var o;t.push(t8.configure((o=this.options)===null||o===void 0?void 0:o.trailingNode))}return t}}),r8=Ore;var it=R(P(),1);var Jv=R(P(),1),i8=R(le(),1),RA=!1,o8=()=>{RA=!0};function Qv({children:t}){let e=(0,Jv.useRef)(null);return(0,Jv.useEffect)(()=>{RA&&(RA=!1,e.current?.focus({preventScroll:!0}))},[]),(0,i8.jsx)("h1",{ref:e,tabIndex:-1,children:t})}var hr=R(P(),1);var Ye=R(le(),1);function OA({title:t,description:e,submit:n,danger:r,action:o,children:i,onDone:s,...l}){let[a,c]=(0,hr.useState)(),[u,d]=(0,hr.useState)(!1);(0,hr.useEffect)(()=>{l.open&&c(void 0)},[l.open]);async function f(h){h.preventDefault(),d(!0),c(void 0);try{await o(),s()}catch(p){c(_i(p))}finally{d(!1)}}return(0,Ye.jsx)(Bf,{...l,title:t,description:e,children:(0,Ye.jsxs)("form",{onSubmit:f,className:"form",children:[i,a&&(0,Ye.jsx)("p",{role:"alert",className:"form-error",children:a}),(0,Ye.jsxs)("div",{className:"form-actions",children:[(0,Ye.jsx)(Kg,{asChild:!0,children:(0,Ye.jsx)(Pt,{type:"button",variant:"secondary",children:"Cancel"})}),(0,Ye.jsx)(Pt,{type:"submit",variant:r?"danger":"primary",loading:u,children:n})]})]})})}var Dre=t=>`${t.toLowerCase().normalize("NFKD").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)||"doc"}-${crypto.randomUUID().slice(0,6)}`;function s8({open:t,onOpenChange:e,onCreated:n}){let{api:r}=Go(),[o,i]=(0,hr.useState)(""),s=(0,hr.useRef)(void 0);return(0,hr.useEffect)(()=>{t&&(i(""),s.current=void 0)},[t]),(0,Ye.jsx)(OA,{open:t,onOpenChange:e,title:"New document",submit:"Create",onDone:()=>e?.(!1),action:async()=>{let l=s.current!==void 0,a=s.current??=Dre(o);await r.create({id:a}).catch(c=>{if(!(l&&c instanceof Ko&&c.code==="DOCUMENT_EXISTS"))return s.current=void 0,Promise.reject(c)}),o.trim()&&await r.rename(a,{title:o}),n(a)},children:(0,Ye.jsx)(Ws,{label:"Title",value:o,onChange:l=>i(l.target.value),maxLength:120,autoComplete:"off",hint:"You can change it later."})})}function Zv({id:t,current:e,open:n,onOpenChange:r,onDone:o}){let{api:i}=Go(),[s,l]=(0,hr.useState)(e);return(0,hr.useEffect)(()=>{n&&l(e)},[n,e]),(0,Ye.jsx)(OA,{open:n,onOpenChange:r,title:"Rename document",submit:"Rename",onDone:()=>(r?.(!1),o()),action:()=>i.rename(t,{title:s}).then(()=>{}),children:(0,Ye.jsx)(Ws,{label:"Title",value:s,onChange:a=>l(a.target.value),maxLength:120,autoComplete:"off"})})}function eb({id:t,name:e,open:n,onOpenChange:r,onDone:o}){let{api:i}=Go();return(0,Ye.jsx)(OA,{open:n,onOpenChange:r,danger:!0,title:"Delete document",description:`Delete "${e}" for everyone? This cannot be undone.`,submit:"Delete",onDone:()=>(r?.(!1),o()),action:()=>i.remove(t).then(()=>{})})}function l8({id:t,open:e,onOpenChange:n}){let{api:r}=Go(),[o,i]=(0,hr.useState)(),[s,l]=(0,hr.useState)(!1);(0,hr.useEffect)(()=>{e&&(l(!1),r.room(t).then(({contributors:c})=>i(c.map(u=>({id:`${u.kind}:${u.name}`,name:u.name,kind:uu(u.kind)?"agent":"person"}))),()=>i([])))},[e,r,t]);let a=`${location.origin}/#/d/${encodeURIComponent(t)}`;return(0,Ye.jsx)(Bf,{open:e,onOpenChange:n,title:"Share document",description:"Anyone with an access token for this server can open this link.",children:(0,Ye.jsxs)("div",{className:"form",children:[(0,Ye.jsx)(Ws,{label:"Link",readOnly:!0,value:a,onFocus:c=>c.currentTarget.select()}),(0,Ye.jsxs)("div",{className:"form-actions",children:[(0,Ye.jsx)(Pt,{type:"button",onClick:()=>navigator.clipboard.writeText(a).then(()=>l(!0),()=>l(!1)),children:"Copy link"}),(0,Ye.jsx)("span",{role:"status",children:s?"Link copied.":""})]}),(0,Ye.jsx)("h3",{className:"section-title",children:"Who has changed this document"}),o===void 0?(0,Ye.jsx)("p",{role:"status",children:"Loading\u2026"}):o.length===0?(0,Ye.jsx)("p",{children:"Nobody has edited it in a live room yet."}):(0,Ye.jsx)("ul",{className:"people",children:o.map(c=>(0,Ye.jsx)("li",{children:(0,Ye.jsx)(Tx,{entry:c})},c.id))}),(0,Ye.jsx)("p",{className:"muted",children:"Roles, invites, and expiring links are not available yet."})]})})}var Nre=0;var a8=(t,e,n)=>{Q(t)===Nre&&n(e,wo(t))};var DA=0,up=1,NA=2,u8=(t,e)=>{J(t,DA);let n=F0(e);Rt(t,n)},_re=(t,e,n)=>{J(t,up),Rt(t,V0(e,n))},d8=(t,e,n)=>_re(e,n,jt(t)),f8=(t,e,n,r)=>{try{ad(e,jt(t),n)}catch(o){r?.(o),console.error("Caught error while handling a Yjs update",o)}},h8=(t,e)=>{J(t,NA),Rt(t,e)},Ire=f8,p8=(t,e,n,r,o)=>{let i=Q(t);switch(i){case DA:d8(t,e,n);break;case up:f8(t,n,r,o);break;case NA:Ire(t,n,r,o);break;default:throw new Error("Unknown message type")}return i};var dp=0,_A=1,y8=2;function IA(t,e){let n=no();return J(n,t),e(n),tn(n)}var v8=t=>IA(dp,e=>u8(e,t)),b8=t=>IA(dp,e=>h8(e,t)),w8=t=>IA(_A,e=>Rt(e,t));var Lre=[4,5,6];function zre(t){if(t instanceof dr)return"xml";if(t instanceof Ir)return"text";if(t instanceof Ia)return"map";if(t instanceof id)return"array";if(t._start===null)return t._map.size>0?"map":"array";let e=t._start;for(;e?.deleted;)e=e.right;if(e===null)return"array";if(Lre.includes(e.content.getRef()))return"text";let n=e.content.type;return n instanceof Ee||n instanceof et?"xml":"array"}var g8=t=>t instanceof Ze?t.clone():t;function S8(t,e,n){let r=new ur;ad(r,e),t.transact(()=>{for(let o of new Set([...t.share.keys(),...r.share.keys()])){let i=t.share.get(o),s=zre(i&&i.constructor!==Ze?i:r.share.get(o)??i);if(s==="text"){let l=t.getText(o);l.delete(0,l.length),l.applyDelta(r.getText(o).toDelta())}else if(s==="map"){let l=t.getMap(o),a=r.getMap(o);for(let c of[...l.keys()])a.has(c)||l.delete(c);for(let[c,u]of a)l.set(c,g8(u))}else if(s==="array"){let l=t.getArray(o);l.delete(0,l.length),l.insert(0,r.getArray(o).toArray().map(g8))}else{let l=t.getXmlFragment(o);l.delete(0,l.length),l.insert(0,r.getXmlFragment(o).toArray().map(a=>a.clone()))}}},n)}function x8(t){return t!=="human"}var LA=3e4,tb=class extends Jy{constructor(e){super(),this.doc=e,this.clientID=e.clientID,this.states=new Map,this.meta=new Map,this._checkInterval=setInterval(()=>{let n=Ki();this.getLocalState()!==null&&LA/2<=n-this.meta.get(this.clientID).lastUpdated&&this.setLocalState(this.getLocalState());let r=[];this.meta.forEach((o,i)=>{i!==this.clientID&&LA<=n-o.lastUpdated&&this.states.has(i)&&r.push(i)}),r.length>0&&zA(this,r,"timeout")},Vt(LA/10)),e.on("destroy",()=>{this.destroy()}),this.setLocalState({})}destroy(){this.emit("destroy",[this]),this.setLocalState(null),super.destroy(),clearInterval(this._checkInterval)}getLocalState(){return this.states.get(this.clientID)||null}setLocalState(e){let n=this.clientID,r=this.meta.get(n),o=r===void 0?0:r.clock+1,i=this.states.get(n);e===null?this.states.delete(n):this.states.set(n,e),this.meta.set(n,{clock:o,lastUpdated:Ki()});let s=[],l=[],a=[],c=[];e===null?c.push(n):i==null?e!=null&&s.push(n):(l.push(n),hl(i,e)||a.push(n)),(s.length>0||a.length>0||c.length>0)&&this.emit("change",[{added:s,updated:a,removed:c},"local"]),this.emit("update",[{added:s,updated:l,removed:c},"local"])}setLocalStateField(e,n){let r=this.getLocalState();r!==null&&this.setLocalState({...r,[e]:n})}getStates(){return this.states}},zA=(t,e,n)=>{let r=[];for(let o=0;o<e.length;o++){let i=e[o];if(t.states.has(i)){if(t.states.delete(i),i===t.clientID){let s=t.meta.get(i);t.meta.set(i,{clock:s.clock+1,lastUpdated:Ki()})}r.push(i)}}r.length>0&&(t.emit("change",[{added:[],updated:[],removed:r},n]),t.emit("update",[{added:[],updated:[],removed:r},n]))},C8=(t,e,n=t.states)=>{let r=e.length,o=no();J(o,r);for(let i=0;i<r;i++){let s=e[i],l=n.get(s)||null,a=t.meta.get(s).clock;J(o,s),J(o,a),qi(o,JSON.stringify(l))}return tn(o)};var E8=(t,e,n)=>{let r=So(e),o=Ki(),i=[],s=[],l=[],a=[],c=Q(r);for(let u=0;u<c;u++){let d=Q(r),f=Q(r),h=JSON.parse(wo(r)),p=t.meta.get(d),m=t.states.get(d),y=p===void 0?0:p.clock;(y<f||y===f&&h===null&&t.states.has(d))&&(h===null?d===t.clientID&&t.getLocalState()!=null?f++:t.states.delete(d):t.states.set(d,h),t.meta.set(d,{clock:f,lastUpdated:o}),p===void 0&&h!==null?i.push(d):p!==void 0&&h===null?a.push(d):h!==null&&(hl(h,m)||l.push(d),s.push(d)))}(i.length>0||l.length>0||a.length>0)&&t.emit("change",[{added:i,updated:l,removed:a},n]),(i.length>0||s.length>0||a.length>0)&&t.emit("update",[{added:i,updated:s,removed:a},n])};function Bre(t){let e=0;for(let n of t)e=(e*31+n.charCodeAt(0))%360;return`hsl(${e} 70% 45%)`}var BA=class UA{doc;awareness;denied=[];socket;options;barriers=[];waiting=[];timeoutMs;synced=!1;stopped=!1;delayMs;retry;resolveClosed;closed=new Promise(e=>this.resolveClosed=e);opened;constructor(e){if(this.options=e,this.doc=e.doc??new ur,this.timeoutMs=e.timeoutMs??1e4,this.delayMs=e.reconnect?.initialMs??500,this.awareness=new tb(this.doc),this.doc.on("update",(n,r)=>{r!==this&&this.send(b8(n))}),this.awareness.on("update",({added:n,updated:r,removed:o},i)=>{i!==this&&this.sendPresence([...n,...r,...o])}),e.presence){let{name:n,color:r=Bre(n),cursor:o=null}=e.presence;this.awareness.setLocalState({name:n,color:r,cursor:o})}this.open()}open(){let e=this.options.WebSocket??WebSocket,n=this.options.headers?new e(this.options.url,{headers:this.options.headers}):new e(this.options.url);this.socket=n,n.binaryType="arraybuffer",this.options.onStatus?.("connecting"),this.opened=new Promise((i,s)=>{n.onopen=()=>{this.delayMs=this.options.reconnect?.initialMs??500,this.options.onStatus?.("connected"),this.awareness.getLocalState()!==null&&this.sendPresence([this.doc.clientID]),this.flush().then(()=>{this.synced=!0,this.waiting.splice(0).forEach(l=>l.resolve())},l=>{n.readyState===1&&this.waiting.splice(0).forEach(a=>a.reject(l))}),i()},n.onerror=()=>{s(new Error("could not connect")),o()}}),this.opened.catch(()=>{}),n.onmessage=i=>this.receive(new Uint8Array(i.data));let r=!1,o=()=>{if(!r){if(r=!0,n.close(),this.synced=!1,this.barriers.splice(0).forEach(i=>i.reject(new Error("connection closed"))),this.options.onStatus?.("disconnected"),this.stopped||!this.options.reconnect){this.waiting.splice(0).forEach(i=>i.reject(new Error("connection closed"))),this.resolveClosed();return}this.retry=setTimeout(()=>this.open(),this.delayMs),this.delayMs=Math.min(this.delayMs*2,this.options.reconnect.maxMs??3e4)}};n.onclose=o}static open(e){return new UA(e)}static async connect(e){let n=new UA(e);try{await n.opened,await n.whenSynced()}catch(r){throw n.disconnect(),r}return n}whenSynced(){return this.synced?Promise.resolve():new Promise((e,n)=>this.waiting.push({resolve:e,reject:n}))}sendPresence(e){this.send(w8(C8(this.awareness,e)))}send(e){this.socket?.readyState===1&&this.socket.send(e)}receive(e){let n=So(e);switch(Q(n)){case dp:{let r=no();J(r,dp);let o=p8(n,r,this.doc,this);gE(r)>1&&this.send(tn(r)),o===up&&this.barriers.shift()?.resolve();break}case y8:a8(n,this.doc,(r,o)=>this.denied.push(o));break;case _A:E8(this.awareness,jt(n),this);break}}flush(){return new Promise((e,n)=>{let r=setTimeout(()=>n(new Error(`no answer from the server in ${this.timeoutMs} ms`)),this.timeoutMs);this.barriers.push({resolve:()=>(clearTimeout(r),e()),reject:o=>(clearTimeout(r),n(o))}),this.send(v8(this.doc))})}async edit(e){this.doc.transact(()=>e(this.doc)),await this.flush()}get peers(){return[...this.awareness.getStates()].filter(([e])=>e!==this.doc.clientID).map(([e,n])=>{let r=n;return{clientId:e,...r,machine:x8(r.kind)}})}onPeers(e){let n=()=>e(this.peers);return this.awareness.on("change",n),()=>this.awareness.off("change",n)}setPresence(e){this.awareness.setLocalState({...this.awareness.getLocalState(),...e})}async api(e,n={}){let r=new URL(this.options.url);r.protocol=r.protocol==="wss:"?"https:":"http:",r.pathname=r.pathname.replace(/\/ws$/,"")+e;let o={...this.options.headers,...n.body?{"content-type":"application/json"}:{}},i=await fetch(r,{...n,headers:o});if(!i.ok)throw new Error(`request failed: ${i.status}`);return i}async snapshot(e){await this.flush();let n=JSON.stringify({name:e});return await(await this.api("/snapshots",{method:"POST",body:n})).json()}async snapshots(){return await(await this.api("/snapshots")).json()}async restore(e){let n=await this.api(`/snapshots/${encodeURIComponent(e)}`);S8(this.doc,new Uint8Array(await n.arrayBuffer())),await this.flush()}async disconnect(){this.stopped=!0,clearTimeout(this.retry),zA(this.awareness,[this.doc.clientID],"disconnect"),this.awareness.destroy(),this.socket.readyState===3?this.resolveClosed():this.socket.close(1e3),await this.closed}};var Pre=t=>btoa(String.fromCharCode(...new TextEncoder().encode(t))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),PA=class extends WebSocket{constructor(e,n){let r=/^Bearer (.+)$/.exec(n?.headers?.authorization??"")?.[1];super(e,r?["agentic-docs",`agentic-docs.bearer.${Pre(r)}`]:void 0)}};async function T8(t,e,n,r){let o="connecting",i=new Set,s=new ur;ad(s,await t.state(n));let l=new URL(`/api/v1/docs/${encodeURIComponent(n)}/ws`,location.href);l.protocol=l.protocol==="https:"?"wss:":"ws:";let a=await BA.connect({url:l.toString(),headers:{authorization:`Bearer ${e}`},WebSocket:PA,doc:s,presence:{name:r},reconnect:{},onStatus:f=>{o=f;for(let h of i)h(f)}});await a.whenSynced().catch(()=>{});let c=0,u=0;return{sync:a,doc:s,status:()=>o,onStatus:f=>(i.add(f),()=>{i.delete(f)}),get dirty(){return c!==u},touch:()=>{c++},async save(){let f=c;await a.flush(),await t.checkpoint(n,V0(s),{create:!1}),u=f},close:()=>a.disconnect()}}function Hre(t){let e=new Set;for(let o of t.getArray("edits").toArray())typeof o!="object"||o===null||typeof o.client=="number"&&o.author?.kind!==void 0&&o.author.kind!=="human"&&e.add(o.client);let n=[];if(e.size===0)return n;let r=o=>{for(let i of o.toArray())if(i instanceof Ee)r(i);else if(i instanceof et){let s=0;for(let l=i._start;l;l=l.right)l.deleted||!l.countable||(e.has(l.id.client)&&n.push({text:i,from:s,to:s+l.length}),s+=l.length)}};return r(t.getXmlFragment("default")),n}var nb=new ae("agentText"),A8=we.create({name:"agentText",addProseMirrorPlugins(){return[new G({key:nb,state:{init:()=>ce.empty,apply:(t,e)=>t.getMeta(nb)??e.map(t.mapping,t.doc)},props:{decorations:t=>nb.getState(t)},view(t){let e=Ue.getState(t.state);if(!e)return{};let n,r="",o=()=>{n=void 0;try{let s=Ue.getState(t.state).binding?.mapping;if(!s)return;let l=t.state.doc.content.size,a=[];for(let{text:u,from:d,to:f}of Hre(e.doc)){let h=zr(e.doc,e.type,Ua(u,d),s),p=zr(e.doc,e.type,Ua(u,f),s);h!==null&&p!==null&&h<p&&p<=l&&a.push(ot.inline(h,p,{class:"agent-text",title:"Written by an agent"}))}let c=a.map(u=>`${u.from}-${u.to}`).join(",");if(c===r)return;r=c,t.dispatch(t.state.tr.setMeta(nb,ce.create(t.state.doc,a)).setMeta("addToHistory",!1))}catch{}},i=()=>{n??=setTimeout(o,60)};return e.doc.on("update",i),i(),{destroy(){e.doc.off("update",i),n&&clearTimeout(n)}}}})]}});var q=R(le(),1),Vre=1500,jre=t=>({id:String(t.clientId),name:au(t.name)??"Unnamed",kind:t.machine?"agent":"person"});function Fre(t){return we.create({name:"remoteCarets",addProseMirrorPlugins:()=>[qP(t.sync.awareness,{cursorBuilder:(e,n)=>{let r=document.createElement("span"),o=t.sync.peers.find(s=>s.clientId===n);if(!o)return r;r.className=`caret${o.machine?" caret--agent":""}`;let i=document.createElement("span");return i.className="caret__tag",i.textContent=`${au(o.name)??"Unnamed"}${o.machine?" \xB7 Agent":""}`,r.append(i),r},selectionBuilder:()=>({})})]})}var HA=class extends it.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}render(){return this.state.failed?(0,q.jsx)("div",{role:"alert",className:"notice",children:(0,q.jsx)(cu,{title:"The editor stopped",description:"The document has content this page cannot show. Reload to try again."})}):this.props.children}};function k8({id:t,go:e}){let{api:n,token:r,me:o}=Go(),[i,s]=(0,it.useState)({state:"loading"}),[l,a]=(0,it.useState)(),[c,u]=(0,it.useState)(0),d=(0,it.useRef)(!1);if((0,it.useEffect)(()=>{let p=!1,m;return s({state:"loading"}),(async()=>{try{let y=await n.list(),g=await T8(n,r,t,o.name);if(m=g,p)return void await g.close();s({state:"ready",live:g,title:y.find(v=>v.id===t)?.title??t})}catch(y){p||s({state:"error",message:_i(y)})}})(),()=>{p=!0,m&&(d.current||o.role==="viewer"||!m.dirty?Promise.resolve():m.save().catch(()=>{})).finally(()=>m?.close())}},[n,r,t,o.name,o.role,c]),i.state==="loading")return(0,q.jsx)("p",{role:"status",className:"muted",children:"Opening document\u2026"});if(i.state==="error")return(0,q.jsx)("div",{role:"alert",className:"notice",children:(0,q.jsx)(cu,{title:"Could not open this document",description:i.message,action:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Pt,{onClick:()=>u(c+1),children:"Try again"})," ",(0,q.jsx)(Pt,{variant:"secondary",onClick:()=>e("#/"),children:"Back to documents"})]})})});let{live:f,title:h}=i;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)("div",{className:"page-head",children:[(0,q.jsx)(Qv,{children:h}),(0,q.jsxs)("div",{className:"page-actions",children:[o.role==="editor"&&(0,q.jsx)(Pt,{variant:"secondary",onClick:()=>a("rename"),children:"Rename"}),(0,q.jsx)(Pt,{onClick:()=>a("share"),children:"Share"}),o.role==="editor"&&(0,q.jsx)(Pt,{variant:"danger",onClick:()=>a("delete"),children:"Delete"})]})]}),(0,q.jsx)(HA,{children:(0,q.jsx)($re,{live:f,editable:o.role==="editor"})}),(0,q.jsx)(Zv,{id:t,current:h,open:l==="rename",onOpenChange:p=>!p&&a(void 0),onDone:()=>{n.list().then(p=>s(m=>m.state==="ready"?{...m,title:p.find(y=>y.id===t)?.title??t}:m))}}),(0,q.jsx)(eb,{id:t,name:h,open:l==="delete",onOpenChange:p=>!p&&a(void 0),onDone:()=>(d.current=!0,e("#/"))}),(0,q.jsx)(l8,{id:t,open:l==="share",onOpenChange:p=>!p&&a(void 0)})]})}function $re({live:t,editable:e}){let{me:n}=Go(),r=(0,it.useRef)(null),[o,i]=(0,it.useState)(),[,s]=(0,it.useReducer)(I=>I+1,0),[l,a]=(0,it.useState)([]),[c,u]=(0,it.useState)("saved"),[d,f]=(0,it.useState)("connecting"),[h,p]=(0,it.useState)(!1),[m,y]=(0,it.useState)(!1),[g,v]=(0,it.useState)(""),[b,w]=(0,it.useState)(),S=(0,it.useRef)(!1);(0,it.useEffect)(()=>{let I=new UU({element:r.current,editable:e,extensions:[r8.configure({undoRedo:!1,underline:!1,link:{openOnClick:!1,autolink:!0,defaultProtocol:"https",isAllowedUri:gt=>/^(https?:\/\/|mailto:)\S+$/i.test(gt)}}),a4,BT,UT,eA,ZT,JT,QT,l4.configure({document:t.doc,field:"default"}),Fre(t),A8],editorProps:{attributes:{role:"textbox","aria-multiline":"true","aria-label":"Document text",class:"prose"}}});i(I),I.on("transaction",()=>(p(r.current?.querySelector(".agent-text")!=null),s()));let j=t.sync.onPeers(a);a(t.sync.peers);let D,K=!1,U=!1,re=()=>{D=void 0,u("saving"),t.save().then(()=>!K&&u("saved"),gt=>{if(!K){if(gt instanceof Ko&>.code==="NO_DOCUMENT")return U=!0,I.setEditable(!1),u("removed");u("failed"),D=setTimeout(re,5e3)}})},Y=(gt,Dt)=>{e&&!U&&Dt===Ue&&(t.touch(),u("saving"),clearTimeout(D),D=setTimeout(re,Vre))};t.doc.on("update",Y),f(t.status());let ke=t.onStatus(f);return()=>{K=!0,t.doc.off("update",Y),ke(),D&&clearTimeout(D),j(),I.destroy()}},[t,e,n.name]);let C=[{id:"me",name:n.name,kind:uu(n.kind)?"agent":"person"},...l.map(jre)],x=(I,j)=>o?.isActive(I,j)??!1,E=()=>(o.view.focus(),o.chain().focus()),A=(I,j)=>(0,q.jsx)("span",{"aria-hidden":"true",className:`glyph glyph--${j??"plain"}`,children:I}),T=I=>(0,q.jsxs)("svg",{"aria-hidden":"true",focusable:"false",viewBox:"0 0 20 20",width:"1.25em",height:"1.25em",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",children:[(0,q.jsx)("path",{d:"M8 5h9M8 10h9M8 15h9"}),I?(0,q.jsx)("path",{d:"M3 4.5l1-.5v4M3 11.5h2l-2 2.5h2.2",strokeLinejoin:"round"}):(0,q.jsx)("path",{d:"M3.5 5h.01M3.5 10h.01M3.5 15h.01",strokeWidth:"2.6"})]}),_=(I,j,D,K)=>(0,q.jsx)(K3,{label:I,icon:j,pressed:D,onClick:K,disabled:!e});function z(){v(o?.getAttributes("link").href??""),w(void 0),y(!0)}function $(){let I=g.trim();if(I==="")E().extendMarkRange("link").unsetLink().run();else if(/^(https?:\/\/|mailto:)\S+$/i.test(I))E().extendMarkRange("link").setLink({href:I}).run();else return w("Use a web address that starts with https:// or http://, or a mailto: address.");o&&!o.state.selection.empty&&o.chain().setTextSelection(o.state.selection.to).unsetMark("link").run(),S.current=!0,y(!1)}return(0,it.useEffect)(()=>{if(m||!S.current)return;S.current=!1;let I=0,j=setInterval(()=>{if(o?.isFocused||++I>10)return clearInterval(j);o?.view.focus()},40);return()=>clearInterval(j)},[m,o]),(0,q.jsxs)("section",{"aria-label":"Editor",children:[(0,q.jsxs)("div",{className:"editor-bar",children:[(0,q.jsxs)(q3,{label:"Formatting",children:[_("Bold",A("B","b"),x("bold"),()=>E().toggleBold().run()),_("Italic",A("I","i"),x("italic"),()=>E().toggleItalic().run()),(0,q.jsx)(Xg,{}),_("H1 heading",A("H1"),x("heading",{level:1}),()=>E().toggleHeading({level:1}).run()),_("H2 heading",A("H2"),x("heading",{level:2}),()=>E().toggleHeading({level:2}).run()),(0,q.jsx)(Xg,{}),_("Bulleted list",T(!1),x("bulletList"),()=>E().toggleBulletList().run()),_("Numbered list",T(!0),x("orderedList"),()=>E().toggleOrderedList().run()),(0,q.jsx)(Xg,{}),_("Link",A("\u2197"),x("link"),z)]}),(0,q.jsxs)("div",{className:"editor-meta",children:[(0,q.jsx)(Q3,{entries:C,label:"People and agents here"}),(0,q.jsxs)("span",{role:"status",className:"muted",children:[e?"":"Read only. ",d==="disconnected"?"Offline: changes are kept and sync when you are back. ":"",c==="saving"?"Saving\u2026":c==="failed"?"Not saved. Will try again.":c==="removed"?"This document was removed. Your changes are not saved.":"Saved"]})]})]}),(0,q.jsx)("div",{ref:r,className:"editor-host"}),(0,q.jsx)("p",{className:"muted legend",children:h?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("span",{className:"agent-text",children:"Dotted text"})," was written by an agent."]}):"Text that an agent writes shows with a dotted underline."}),(0,q.jsx)(Bf,{open:m,onOpenChange:y,title:"Link",description:"Leave it empty to remove the link.",children:(0,q.jsxs)("form",{className:"form",onSubmit:I=>(I.preventDefault(),$()),children:[(0,q.jsx)(Ws,{label:"Address",value:g,onChange:I=>v(I.target.value),error:b,placeholder:"https://",autoComplete:"off"}),(0,q.jsxs)("div",{className:"form-actions",children:[(0,q.jsx)(Kg,{asChild:!0,children:(0,q.jsx)(Pt,{type:"button",variant:"secondary",children:"Cancel"})}),(0,q.jsx)(Pt,{type:"submit",children:"Apply"})]})]})})]})}var is=R(P(),1);var mt=R(le(),1);function M8({go:t}){let{api:e,me:n}=Go(),[r,o]=(0,is.useState)({state:"loading"}),[i,s]=(0,is.useState)(!1),[l,a]=(0,is.useState)(),[c,u]=(0,is.useState)(),d=n.role==="editor",f=(0,is.useCallback)((m=!1)=>(m||o({state:"loading"}),e.list().then(y=>o({state:"ready",docs:y.sort((g,v)=>v.updatedAt-g.updatedAt)}),y=>o({state:"error",message:_i(y)}))),[e]);(0,is.useEffect)(()=>{f()},[f]);let h=()=>{f(!0).then(()=>document.querySelector("h1")?.focus())},p=d?(0,mt.jsxs)(Pt,{onClick:()=>s(!0),children:[(0,mt.jsx)(E_,{"aria-hidden":!0})," New document"]}):void 0;return(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsxs)("div",{className:"page-head",children:[(0,mt.jsx)(Qv,{children:"Documents"}),r.state==="ready"&&r.docs.length>0&&p]}),r.state==="loading"&&(0,mt.jsx)("p",{role:"status",className:"muted",children:"Loading documents\u2026"}),r.state==="error"&&(0,mt.jsx)("div",{role:"alert",className:"notice",children:(0,mt.jsx)(cu,{title:"Could not load documents",description:r.message,action:(0,mt.jsx)(Pt,{onClick:()=>{f()},children:"Try again"})})}),r.state==="ready"&&r.docs.length===0&&(0,mt.jsx)(cu,{title:"No documents yet",description:d?"Make one to start writing, with people and agents.":"Nothing has been shared with this token.",action:p}),r.state==="ready"&&r.docs.length>0&&(0,mt.jsx)(Z3,{label:"Documents",children:r.docs.map(m=>(0,mt.jsx)(eI,{name:m.title,href:`#/d/${encodeURIComponent(m.id)}`,modified:new Date(m.updatedAt),editedBy:{id:`${m.updatedBy.kind}:${m.updatedBy.name}`,name:m.updatedBy.name,kind:uu(m.updatedBy.kind)?"agent":"person"},actions:d&&(0,mt.jsx)(_3,{align:"end",trigger:(0,mt.jsx)(ra,{label:`Actions for ${m.title}`,icon:(0,mt.jsx)(T_,{"aria-hidden":!0}),variant:"ghost"}),items:[{label:"Rename",onSelect:()=>a(m)},"separator",{label:"Delete",danger:!0,onSelect:()=>u(m)}]})},m.id))}),(0,mt.jsx)(s8,{open:i,onOpenChange:s,onCreated:m=>t(`#/d/${encodeURIComponent(m)}`)}),(0,mt.jsx)(Zv,{id:l?.id??"",current:l?.title??"",open:l!==void 0,onOpenChange:m=>!m&&a(void 0),onDone:h}),(0,mt.jsx)(eb,{id:c?.id??"",name:c?.title??"",open:c!==void 0,onOpenChange:m=>!m&&u(void 0),onDone:h})]})}var ye=R(le(),1),Yre=()=>{let[t,e]=(0,In.useState)(location.hash||"#/");return(0,In.useEffect)(()=>{let n=()=>(o8(),e(location.hash||"#/"));return window.addEventListener("hashchange",n),()=>window.removeEventListener("hashchange",n)},[]),[t,n=>location.hash=n]};function qre({onSignedIn:t}){let[e,n]=(0,In.useState)(""),[r,o]=(0,In.useState)(),[i,s]=(0,In.useState)(!1);async function l(a){a.preventDefault(),s(!0),o(void 0);try{t(e.trim(),await Jg(e.trim()).me())}catch(c){o(_i(c))}finally{s(!1)}}return(0,ye.jsxs)("main",{className:"signin",children:[(0,ye.jsx)("h1",{children:"Sign in"}),(0,ye.jsx)("p",{className:"muted",children:"Paste an access token for this server. The token stays in this tab."}),(0,ye.jsxs)("form",{onSubmit:l,className:"form",children:[(0,ye.jsx)(Ws,{label:"Access token",type:"password",value:e,onChange:a=>n(a.target.value),error:r,autoComplete:"off",required:!0}),(0,ye.jsx)(Pt,{type:"submit",loading:i,children:"Sign in"})]})]})}function Kre(){let{preference:t,setPreference:e}=e2();return(0,ye.jsxs)(A_,{label:"Theme",hideLabel:!0,value:t,onChange:n=>e(n.target.value),children:[(0,ye.jsx)("option",{value:"system",children:"Theme: System"}),(0,ye.jsx)("option",{value:"light",children:"Theme: Light"}),(0,ye.jsx)("option",{value:"dark",children:"Theme: Dark"})]})}function Gre({session:t}){let[e,n]=Yre(),r=/^#\/d\/([^/]+)$/.exec(e),o=r?decodeURIComponent(r[1]):void 0;return(0,ye.jsx)(Ox.Provider,{value:t,children:(0,ye.jsx)(z3,{brand:"Documents",sidebar:(0,ye.jsx)(U3,{label:"Main",items:[{href:"#/",label:"Documents",current:o===void 0}]}),topbar:(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)(Kre,{}),(0,ye.jsxs)("span",{className:"muted",children:[t.me.name,t.me.role==="viewer"?" (viewer)":""]}),(0,ye.jsx)(Pt,{variant:"secondary",size:"sm",onClick:t.signOut,children:"Sign out"})]}),children:o===void 0?(0,ye.jsx)(M8,{go:n}):(0,ye.jsx)(k8,{id:o,go:n},o)})})}function Xre(){let[t,e]=(0,In.useState)(Mx()?"checking":null),[n,r]=(0,In.useState)();(0,In.useEffect)(()=>{let s=Mx();s&&Jg(s).me().then(l=>e({token:s,me:l}),l=>(Rx(),r(_i(l)),e(null)))},[]);let o=(0,In.useCallback)(()=>(Rx(),e(null),location.hash="#/"),[]),i=(0,In.useMemo)(()=>t&&t!=="checking"?{api:Jg(t.token),token:t.token,me:t.me,signOut:o}:null,[t,o]);return t==="checking"?(0,ye.jsx)("p",{role:"status",className:"signin muted",children:"Checking your token\u2026"}):i?(0,ye.jsx)(Gre,{session:i}):(0,ye.jsxs)(ye.Fragment,{children:[n&&(0,ye.jsx)("p",{role:"alert",className:"signin form-error",children:n}),(0,ye.jsx)(qre,{onSignedIn:(s,l)=>(rI(s),e({token:s,me:l}))})]})}(0,R8.createRoot)(document.getElementById("root")).render((0,ye.jsx)(In.StrictMode,{children:(0,ye.jsx)(ZN,{children:(0,ye.jsx)(ax,{children:(0,ye.jsx)(I3,{children:(0,ye.jsx)(Xre,{})})})})}));
|
|
214
|
+
/*! Bundled license information:
|
|
215
|
+
|
|
216
|
+
react/cjs/react.production.js:
|
|
217
|
+
(**
|
|
218
|
+
* @license React
|
|
219
|
+
* react.production.js
|
|
220
|
+
*
|
|
221
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
222
|
+
*
|
|
223
|
+
* This source code is licensed under the MIT license found in the
|
|
224
|
+
* LICENSE file in the root directory of this source tree.
|
|
225
|
+
*)
|
|
226
|
+
|
|
227
|
+
scheduler/cjs/scheduler.production.js:
|
|
228
|
+
(**
|
|
229
|
+
* @license React
|
|
230
|
+
* scheduler.production.js
|
|
231
|
+
*
|
|
232
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
233
|
+
*
|
|
234
|
+
* This source code is licensed under the MIT license found in the
|
|
235
|
+
* LICENSE file in the root directory of this source tree.
|
|
236
|
+
*)
|
|
237
|
+
|
|
238
|
+
react-dom/cjs/react-dom.production.js:
|
|
239
|
+
(**
|
|
240
|
+
* @license React
|
|
241
|
+
* react-dom.production.js
|
|
242
|
+
*
|
|
243
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
244
|
+
*
|
|
245
|
+
* This source code is licensed under the MIT license found in the
|
|
246
|
+
* LICENSE file in the root directory of this source tree.
|
|
247
|
+
*)
|
|
248
|
+
|
|
249
|
+
react-dom/cjs/react-dom-client.production.js:
|
|
250
|
+
(**
|
|
251
|
+
* @license React
|
|
252
|
+
* react-dom-client.production.js
|
|
253
|
+
*
|
|
254
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
255
|
+
*
|
|
256
|
+
* This source code is licensed under the MIT license found in the
|
|
257
|
+
* LICENSE file in the root directory of this source tree.
|
|
258
|
+
*)
|
|
259
|
+
|
|
260
|
+
react/cjs/react-jsx-runtime.production.js:
|
|
261
|
+
(**
|
|
262
|
+
* @license React
|
|
263
|
+
* react-jsx-runtime.production.js
|
|
264
|
+
*
|
|
265
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
266
|
+
*
|
|
267
|
+
* This source code is licensed under the MIT license found in the
|
|
268
|
+
* LICENSE file in the root directory of this source tree.
|
|
269
|
+
*)
|
|
270
|
+
*/
|