@oliverflint/dataverse-dev-proxy-pptb 0.0.0-stage → 1.0.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.
@@ -0,0 +1,33 @@
1
+ (function(){"use strict";var Pa={exports:{}},$r={},Ra={exports:{}},xe={};var xf;function Sv(){if(xf)return xe;xf=1;var s=Symbol.for("react.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),a=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),y=Symbol.iterator;function v(M){return M===null||typeof M!="object"?null:(M=y&&M[y]||M["@@iterator"],typeof M=="function"?M:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},x=Object.assign,S={};function T(M,N,R){this.props=M,this.context=N,this.refs=S,this.updater=R||k}T.prototype.isReactComponent={},T.prototype.setState=function(M,N){if(typeof M!="object"&&typeof M!="function"&&M!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,M,N,"setState")},T.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function D(){}D.prototype=T.prototype;function q(M,N,R){this.props=M,this.context=N,this.refs=S,this.updater=R||k}var L=q.prototype=new D;L.constructor=q,x(L,T.prototype),L.isPureReactComponent=!0;var _=Array.isArray,K=Object.prototype.hasOwnProperty,I={current:null},F={key:!0,ref:!0,__self:!0,__source:!0};function ee(M,N,R){var z,X={},$=null,oe=null;if(N!=null)for(z in N.ref!==void 0&&(oe=N.ref),N.key!==void 0&&($=""+N.key),N)K.call(N,z)&&!F.hasOwnProperty(z)&&(X[z]=N[z]);var ce=arguments.length-2;if(ce===1)X.children=R;else if(1<ce){for(var Ae=Array(ce),$e=0;$e<ce;$e++)Ae[$e]=arguments[$e+2];X.children=Ae}if(M&&M.defaultProps)for(z in ce=M.defaultProps,ce)X[z]===void 0&&(X[z]=ce[z]);return{$$typeof:s,type:M,key:$,ref:oe,props:X,_owner:I.current}}function ge(M,N){return{$$typeof:s,type:M.type,key:N,ref:M.ref,props:M.props,_owner:M._owner}}function pe(M){return typeof M=="object"&&M!==null&&M.$$typeof===s}function me(M){var N={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(R){return N[R]})}var ae=/\/+/g;function we(M,N){return typeof M=="object"&&M!==null&&M.key!=null?me(""+M.key):N.toString(36)}function ve(M,N,R,z,X){var $=typeof M;($==="undefined"||$==="boolean")&&(M=null);var oe=!1;if(M===null)oe=!0;else switch($){case"string":case"number":oe=!0;break;case"object":switch(M.$$typeof){case s:case e:oe=!0}}if(oe)return oe=M,X=X(oe),M=z===""?"."+we(oe,0):z,_(X)?(R="",M!=null&&(R=M.replace(ae,"$&/")+"/"),ve(X,N,R,"",function($e){return $e})):X!=null&&(pe(X)&&(X=ge(X,R+(!X.key||oe&&oe.key===X.key?"":(""+X.key).replace(ae,"$&/")+"/")+M)),N.push(X)),1;if(oe=0,z=z===""?".":z+":",_(M))for(var ce=0;ce<M.length;ce++){$=M[ce];var Ae=z+we($,ce);oe+=ve($,N,R,Ae,X)}else if(Ae=v(M),typeof Ae=="function")for(M=Ae.call(M),ce=0;!($=M.next()).done;)$=$.value,Ae=z+we($,ce++),oe+=ve($,N,R,Ae,X);else if($==="object")throw N=String(M),Error("Objects are not valid as a React child (found: "+(N==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":N)+"). If you meant to render a collection of children, use an array instead.");return oe}function Se(M,N,R){if(M==null)return M;var z=[],X=0;return ve(M,z,"","",function($){return N.call(R,$,X++)}),z}function ze(M){if(M._status===-1){var N=M._result;N=N(),N.then(function(R){(M._status===0||M._status===-1)&&(M._status=1,M._result=R)},function(R){(M._status===0||M._status===-1)&&(M._status=2,M._result=R)}),M._status===-1&&(M._status=0,M._result=N)}if(M._status===1)return M._result.default;throw M._result}var Ce={current:null},Q={transition:null},se={ReactCurrentDispatcher:Ce,ReactCurrentBatchConfig:Q,ReactCurrentOwner:I};function J(){throw Error("act(...) is not supported in production builds of React.")}return xe.Children={map:Se,forEach:function(M,N,R){Se(M,function(){N.apply(this,arguments)},R)},count:function(M){var N=0;return Se(M,function(){N++}),N},toArray:function(M){return Se(M,function(N){return N})||[]},only:function(M){if(!pe(M))throw Error("React.Children.only expected to receive a single React element child.");return M}},xe.Component=T,xe.Fragment=t,xe.Profiler=r,xe.PureComponent=q,xe.StrictMode=n,xe.Suspense=c,xe.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=se,xe.act=J,xe.cloneElement=function(M,N,R){if(M==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+M+".");var z=x({},M.props),X=M.key,$=M.ref,oe=M._owner;if(N!=null){if(N.ref!==void 0&&($=N.ref,oe=I.current),N.key!==void 0&&(X=""+N.key),M.type&&M.type.defaultProps)var ce=M.type.defaultProps;for(Ae in N)K.call(N,Ae)&&!F.hasOwnProperty(Ae)&&(z[Ae]=N[Ae]===void 0&&ce!==void 0?ce[Ae]:N[Ae])}var Ae=arguments.length-2;if(Ae===1)z.children=R;else if(1<Ae){ce=Array(Ae);for(var $e=0;$e<Ae;$e++)ce[$e]=arguments[$e+2];z.children=ce}return{$$typeof:s,type:M.type,key:X,ref:$,props:z,_owner:oe}},xe.createContext=function(M){return M={$$typeof:a,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},M.Provider={$$typeof:l,_context:M},M.Consumer=M},xe.createElement=ee,xe.createFactory=function(M){var N=ee.bind(null,M);return N.type=M,N},xe.createRef=function(){return{current:null}},xe.forwardRef=function(M){return{$$typeof:h,render:M}},xe.isValidElement=pe,xe.lazy=function(M){return{$$typeof:m,_payload:{_status:-1,_result:M},_init:ze}},xe.memo=function(M,N){return{$$typeof:d,type:M,compare:N===void 0?null:N}},xe.startTransition=function(M){var N=Q.transition;Q.transition={};try{M()}finally{Q.transition=N}},xe.unstable_act=J,xe.useCallback=function(M,N){return Ce.current.useCallback(M,N)},xe.useContext=function(M){return Ce.current.useContext(M)},xe.useDebugValue=function(){},xe.useDeferredValue=function(M){return Ce.current.useDeferredValue(M)},xe.useEffect=function(M,N){return Ce.current.useEffect(M,N)},xe.useId=function(){return Ce.current.useId()},xe.useImperativeHandle=function(M,N,R){return Ce.current.useImperativeHandle(M,N,R)},xe.useInsertionEffect=function(M,N){return Ce.current.useInsertionEffect(M,N)},xe.useLayoutEffect=function(M,N){return Ce.current.useLayoutEffect(M,N)},xe.useMemo=function(M,N){return Ce.current.useMemo(M,N)},xe.useReducer=function(M,N,R){return Ce.current.useReducer(M,N,R)},xe.useRef=function(M){return Ce.current.useRef(M)},xe.useState=function(M){return Ce.current.useState(M)},xe.useSyncExternalStore=function(M,N,R){return Ce.current.useSyncExternalStore(M,N,R)},xe.useTransition=function(){return Ce.current.useTransition()},xe.version="18.3.1",xe}var Sf;function Da(){return Sf||(Sf=1,Ra.exports=Sv()),Ra.exports}var Cf;function Cv(){if(Cf)return $r;Cf=1;var s=Da(),e=Symbol.for("react.element"),t=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,r=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function a(h,c,d){var m,y={},v=null,k=null;d!==void 0&&(v=""+d),c.key!==void 0&&(v=""+c.key),c.ref!==void 0&&(k=c.ref);for(m in c)n.call(c,m)&&!l.hasOwnProperty(m)&&(y[m]=c[m]);if(h&&h.defaultProps)for(m in c=h.defaultProps,c)y[m]===void 0&&(y[m]=c[m]);return{$$typeof:e,type:h,key:v,ref:k,props:y,_owner:r.current}}return $r.Fragment=t,$r.jsx=a,$r.jsxs=a,$r}var bf;function bv(){return bf||(bf=1,Pa.exports=Cv()),Pa.exports}var B=bv(),Te=Da(),uo={},La={exports:{}},bt={},Na={exports:{}},Ba={};var Af;function Av(){return Af||(Af=1,(function(s){function e(Q,se){var J=Q.length;Q.push(se);e:for(;0<J;){var M=J-1>>>1,N=Q[M];if(0<r(N,se))Q[M]=se,Q[J]=N,J=M;else break e}}function t(Q){return Q.length===0?null:Q[0]}function n(Q){if(Q.length===0)return null;var se=Q[0],J=Q.pop();if(J!==se){Q[0]=J;e:for(var M=0,N=Q.length,R=N>>>1;M<R;){var z=2*(M+1)-1,X=Q[z],$=z+1,oe=Q[$];if(0>r(X,J))$<N&&0>r(oe,X)?(Q[M]=oe,Q[$]=J,M=$):(Q[M]=X,Q[z]=J,M=z);else if($<N&&0>r(oe,J))Q[M]=oe,Q[$]=J,M=$;else break e}}return se}function r(Q,se){var J=Q.sortIndex-se.sortIndex;return J!==0?J:Q.id-se.id}if(typeof performance=="object"&&typeof performance.now=="function"){var l=performance;s.unstable_now=function(){return l.now()}}else{var a=Date,h=a.now();s.unstable_now=function(){return a.now()-h}}var c=[],d=[],m=1,y=null,v=3,k=!1,x=!1,S=!1,T=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function L(Q){for(var se=t(d);se!==null;){if(se.callback===null)n(d);else if(se.startTime<=Q)n(d),se.sortIndex=se.expirationTime,e(c,se);else break;se=t(d)}}function _(Q){if(S=!1,L(Q),!x)if(t(c)!==null)x=!0,ze(K);else{var se=t(d);se!==null&&Ce(_,se.startTime-Q)}}function K(Q,se){x=!1,S&&(S=!1,D(ee),ee=-1),k=!0;var J=v;try{for(L(se),y=t(c);y!==null&&(!(y.expirationTime>se)||Q&&!me());){var M=y.callback;if(typeof M=="function"){y.callback=null,v=y.priorityLevel;var N=M(y.expirationTime<=se);se=s.unstable_now(),typeof N=="function"?y.callback=N:y===t(c)&&n(c),L(se)}else n(c);y=t(c)}if(y!==null)var R=!0;else{var z=t(d);z!==null&&Ce(_,z.startTime-se),R=!1}return R}finally{y=null,v=J,k=!1}}var I=!1,F=null,ee=-1,ge=5,pe=-1;function me(){return!(s.unstable_now()-pe<ge)}function ae(){if(F!==null){var Q=s.unstable_now();pe=Q;var se=!0;try{se=F(!0,Q)}finally{se?we():(I=!1,F=null)}}else I=!1}var we;if(typeof q=="function")we=function(){q(ae)};else if(typeof MessageChannel<"u"){var ve=new MessageChannel,Se=ve.port2;ve.port1.onmessage=ae,we=function(){Se.postMessage(null)}}else we=function(){T(ae,0)};function ze(Q){F=Q,I||(I=!0,we())}function Ce(Q,se){ee=T(function(){Q(s.unstable_now())},se)}s.unstable_IdlePriority=5,s.unstable_ImmediatePriority=1,s.unstable_LowPriority=4,s.unstable_NormalPriority=3,s.unstable_Profiling=null,s.unstable_UserBlockingPriority=2,s.unstable_cancelCallback=function(Q){Q.callback=null},s.unstable_continueExecution=function(){x||k||(x=!0,ze(K))},s.unstable_forceFrameRate=function(Q){0>Q||125<Q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):ge=0<Q?Math.floor(1e3/Q):5},s.unstable_getCurrentPriorityLevel=function(){return v},s.unstable_getFirstCallbackNode=function(){return t(c)},s.unstable_next=function(Q){switch(v){case 1:case 2:case 3:var se=3;break;default:se=v}var J=v;v=se;try{return Q()}finally{v=J}},s.unstable_pauseExecution=function(){},s.unstable_requestPaint=function(){},s.unstable_runWithPriority=function(Q,se){switch(Q){case 1:case 2:case 3:case 4:case 5:break;default:Q=3}var J=v;v=Q;try{return se()}finally{v=J}},s.unstable_scheduleCallback=function(Q,se,J){var M=s.unstable_now();switch(typeof J=="object"&&J!==null?(J=J.delay,J=typeof J=="number"&&0<J?M+J:M):J=M,Q){case 1:var N=-1;break;case 2:N=250;break;case 5:N=1073741823;break;case 4:N=1e4;break;default:N=5e3}return N=J+N,Q={id:m++,callback:se,priorityLevel:Q,startTime:J,expirationTime:N,sortIndex:-1},J>M?(Q.sortIndex=J,e(d,Q),t(c)===null&&Q===t(d)&&(S?(D(ee),ee=-1):S=!0,Ce(_,J-M))):(Q.sortIndex=N,e(c,Q),x||k||(x=!0,ze(K))),Q},s.unstable_shouldYield=me,s.unstable_wrapCallback=function(Q){var se=v;return function(){var J=v;v=se;try{return Q.apply(this,arguments)}finally{v=J}}}})(Ba)),Ba}var Tf;function Tv(){return Tf||(Tf=1,Na.exports=Av()),Na.exports}var Mf;function Mv(){if(Mf)return bt;Mf=1;var s=Da(),e=Tv();function t(i){for(var o="https://reactjs.org/docs/error-decoder.html?invariant="+i,u=1;u<arguments.length;u++)o+="&args[]="+encodeURIComponent(arguments[u]);return"Minified React error #"+i+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var n=new Set,r={};function l(i,o){a(i,o),a(i+"Capture",o)}function a(i,o){for(r[i]=o,i=0;i<o.length;i++)n.add(o[i])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),c=Object.prototype.hasOwnProperty,d=/^[: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]*$/,m={},y={};function v(i){return c.call(y,i)?!0:c.call(m,i)?!1:d.test(i)?y[i]=!0:(m[i]=!0,!1)}function k(i,o,u,f){if(u!==null&&u.type===0)return!1;switch(typeof o){case"function":case"symbol":return!0;case"boolean":return f?!1:u!==null?!u.acceptsBooleans:(i=i.toLowerCase().slice(0,5),i!=="data-"&&i!=="aria-");default:return!1}}function x(i,o,u,f){if(o===null||typeof o>"u"||k(i,o,u,f))return!0;if(f)return!1;if(u!==null)switch(u.type){case 3:return!o;case 4:return o===!1;case 5:return isNaN(o);case 6:return isNaN(o)||1>o}return!1}function S(i,o,u,f,p,g,w){this.acceptsBooleans=o===2||o===3||o===4,this.attributeName=f,this.attributeNamespace=p,this.mustUseProperty=u,this.propertyName=i,this.type=o,this.sanitizeURL=g,this.removeEmptyString=w}var T={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(i){T[i]=new S(i,0,!1,i,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(i){var o=i[0];T[o]=new S(o,1,!1,i[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(i){T[i]=new S(i,2,!1,i.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(i){T[i]=new S(i,2,!1,i,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(i){T[i]=new S(i,3,!1,i.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(i){T[i]=new S(i,3,!0,i,null,!1,!1)}),["capture","download"].forEach(function(i){T[i]=new S(i,4,!1,i,null,!1,!1)}),["cols","rows","size","span"].forEach(function(i){T[i]=new S(i,6,!1,i,null,!1,!1)}),["rowSpan","start"].forEach(function(i){T[i]=new S(i,5,!1,i.toLowerCase(),null,!1,!1)});var D=/[\-:]([a-z])/g;function q(i){return i[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(i){var o=i.replace(D,q);T[o]=new S(o,1,!1,i,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(i){var o=i.replace(D,q);T[o]=new S(o,1,!1,i,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(i){var o=i.replace(D,q);T[o]=new S(o,1,!1,i,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(i){T[i]=new S(i,1,!1,i.toLowerCase(),null,!1,!1)}),T.xlinkHref=new S("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(i){T[i]=new S(i,1,!1,i.toLowerCase(),null,!0,!0)});function L(i,o,u,f){var p=T.hasOwnProperty(o)?T[o]:null;(p!==null?p.type!==0:f||!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(x(o,u,p,f)&&(u=null),f||p===null?v(o)&&(u===null?i.removeAttribute(o):i.setAttribute(o,""+u)):p.mustUseProperty?i[p.propertyName]=u===null?p.type===3?!1:"":u:(o=p.attributeName,f=p.attributeNamespace,u===null?i.removeAttribute(o):(p=p.type,u=p===3||p===4&&u===!0?"":""+u,f?i.setAttributeNS(f,o,u):i.setAttribute(o,u))))}var _=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,K=Symbol.for("react.element"),I=Symbol.for("react.portal"),F=Symbol.for("react.fragment"),ee=Symbol.for("react.strict_mode"),ge=Symbol.for("react.profiler"),pe=Symbol.for("react.provider"),me=Symbol.for("react.context"),ae=Symbol.for("react.forward_ref"),we=Symbol.for("react.suspense"),ve=Symbol.for("react.suspense_list"),Se=Symbol.for("react.memo"),ze=Symbol.for("react.lazy"),Ce=Symbol.for("react.offscreen"),Q=Symbol.iterator;function se(i){return i===null||typeof i!="object"?null:(i=Q&&i[Q]||i["@@iterator"],typeof i=="function"?i:null)}var J=Object.assign,M;function N(i){if(M===void 0)try{throw Error()}catch(u){var o=u.stack.trim().match(/\n( *(at )?)/);M=o&&o[1]||""}return`
2
+ `+M+i}var R=!1;function z(i,o){if(!i||R)return"";R=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(o)if(o=function(){throw Error()},Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(P){var f=P}Reflect.construct(i,[],o)}else{try{o.call()}catch(P){f=P}i.call(o.prototype)}else{try{throw Error()}catch(P){f=P}i()}}catch(P){if(P&&f&&typeof P.stack=="string"){for(var p=P.stack.split(`
3
+ `),g=f.stack.split(`
4
+ `),w=p.length-1,C=g.length-1;1<=w&&0<=C&&p[w]!==g[C];)C--;for(;1<=w&&0<=C;w--,C--)if(p[w]!==g[C]){if(w!==1||C!==1)do if(w--,C--,0>C||p[w]!==g[C]){var b=`
5
+ `+p[w].replace(" at new "," at ");return i.displayName&&b.includes("<anonymous>")&&(b=b.replace("<anonymous>",i.displayName)),b}while(1<=w&&0<=C);break}}}finally{R=!1,Error.prepareStackTrace=u}return(i=i?i.displayName||i.name:"")?N(i):""}function X(i){switch(i.tag){case 5:return N(i.type);case 16:return N("Lazy");case 13:return N("Suspense");case 19:return N("SuspenseList");case 0:case 2:case 15:return i=z(i.type,!1),i;case 11:return i=z(i.type.render,!1),i;case 1:return i=z(i.type,!0),i;default:return""}}function $(i){if(i==null)return null;if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case F:return"Fragment";case I:return"Portal";case ge:return"Profiler";case ee:return"StrictMode";case we:return"Suspense";case ve:return"SuspenseList"}if(typeof i=="object")switch(i.$$typeof){case me:return(i.displayName||"Context")+".Consumer";case pe:return(i._context.displayName||"Context")+".Provider";case ae:var o=i.render;return i=i.displayName,i||(i=o.displayName||o.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case Se:return o=i.displayName||null,o!==null?o:$(i.type)||"Memo";case ze:o=i._payload,i=i._init;try{return $(i(o))}catch{}}return null}function oe(i){var o=i.type;switch(i.tag){case 24:return"Cache";case 9:return(o.displayName||"Context")+".Consumer";case 10:return(o._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return i=o.render,i=i.displayName||i.name||"",o.displayName||(i!==""?"ForwardRef("+i+")":"ForwardRef");case 7:return"Fragment";case 5:return o;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return $(o);case 8:return o===ee?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o}return null}function ce(i){switch(typeof i){case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Ae(i){var o=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function $e(i){var o=Ae(i)?"checked":"value",u=Object.getOwnPropertyDescriptor(i.constructor.prototype,o),f=""+i[o];if(!i.hasOwnProperty(o)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var p=u.get,g=u.set;return Object.defineProperty(i,o,{configurable:!0,get:function(){return p.call(this)},set:function(w){f=""+w,g.call(this,w)}}),Object.defineProperty(i,o,{enumerable:u.enumerable}),{getValue:function(){return f},setValue:function(w){f=""+w},stopTracking:function(){i._valueTracker=null,delete i[o]}}}}function ai(i){i._valueTracker||(i._valueTracker=$e(i))}function mt(i){if(!i)return!1;var o=i._valueTracker;if(!o)return!0;var u=o.getValue(),f="";return i&&(f=Ae(i)?i.checked?"true":"false":i.value),i=f,i!==u?(o.setValue(i),!0):!1}function qt(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}function _i(i,o){var u=o.checked;return J({},o,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:u??i._wrapperState.initialChecked})}function xl(i,o){var u=o.defaultValue==null?"":o.defaultValue,f=o.checked!=null?o.checked:o.defaultChecked;u=ce(o.value!=null?o.value:u),i._wrapperState={initialChecked:f,initialValue:u,controlled:o.type==="checkbox"||o.type==="radio"?o.checked!=null:o.value!=null}}function Eg(i,o){o=o.checked,o!=null&&L(i,"checked",o,!1)}function Oh(i,o){Eg(i,o);var u=ce(o.value),f=o.type;if(u!=null)f==="number"?(u===0&&i.value===""||i.value!=u)&&(i.value=""+u):i.value!==""+u&&(i.value=""+u);else if(f==="submit"||f==="reset"){i.removeAttribute("value");return}o.hasOwnProperty("value")?Eh(i,o.type,u):o.hasOwnProperty("defaultValue")&&Eh(i,o.type,ce(o.defaultValue)),o.checked==null&&o.defaultChecked!=null&&(i.defaultChecked=!!o.defaultChecked)}function Pg(i,o,u){if(o.hasOwnProperty("value")||o.hasOwnProperty("defaultValue")){var f=o.type;if(!(f!=="submit"&&f!=="reset"||o.value!==void 0&&o.value!==null))return;o=""+i._wrapperState.initialValue,u||o===i.value||(i.value=o),i.defaultValue=o}u=i.name,u!==""&&(i.name=""),i.defaultChecked=!!i._wrapperState.initialChecked,u!==""&&(i.name=u)}function Eh(i,o,u){(o!=="number"||qt(i.ownerDocument)!==i)&&(u==null?i.defaultValue=""+i._wrapperState.initialValue:i.defaultValue!==""+u&&(i.defaultValue=""+u))}var bs=Array.isArray;function kr(i,o,u,f){if(i=i.options,o){o={};for(var p=0;p<u.length;p++)o["$"+u[p]]=!0;for(u=0;u<i.length;u++)p=o.hasOwnProperty("$"+i[u].value),i[u].selected!==p&&(i[u].selected=p),p&&f&&(i[u].defaultSelected=!0)}else{for(u=""+ce(u),o=null,p=0;p<i.length;p++){if(i[p].value===u){i[p].selected=!0,f&&(i[p].defaultSelected=!0);return}o!==null||i[p].disabled||(o=i[p])}o!==null&&(o.selected=!0)}}function Ph(i,o){if(o.dangerouslySetInnerHTML!=null)throw Error(t(91));return J({},o,{value:void 0,defaultValue:void 0,children:""+i._wrapperState.initialValue})}function Rg(i,o){var u=o.value;if(u==null){if(u=o.children,o=o.defaultValue,u!=null){if(o!=null)throw Error(t(92));if(bs(u)){if(1<u.length)throw Error(t(93));u=u[0]}o=u}o==null&&(o=""),u=o}i._wrapperState={initialValue:ce(u)}}function Dg(i,o){var u=ce(o.value),f=ce(o.defaultValue);u!=null&&(u=""+u,u!==i.value&&(i.value=u),o.defaultValue==null&&i.defaultValue!==u&&(i.defaultValue=u)),f!=null&&(i.defaultValue=""+f)}function Lg(i){var o=i.textContent;o===i._wrapperState.initialValue&&o!==""&&o!==null&&(i.value=o)}function Ng(i){switch(i){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function Rh(i,o){return i==null||i==="http://www.w3.org/1999/xhtml"?Ng(o):i==="http://www.w3.org/2000/svg"&&o==="foreignObject"?"http://www.w3.org/1999/xhtml":i}var Sl,Bg=(function(i){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(o,u,f,p){MSApp.execUnsafeLocalFunction(function(){return i(o,u,f,p)})}:i})(function(i,o){if(i.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in i)i.innerHTML=o;else{for(Sl=Sl||document.createElement("div"),Sl.innerHTML="<svg>"+o.valueOf().toString()+"</svg>",o=Sl.firstChild;i.firstChild;)i.removeChild(i.firstChild);for(;o.firstChild;)i.appendChild(o.firstChild)}});function As(i,o){if(o){var u=i.firstChild;if(u&&u===i.lastChild&&u.nodeType===3){u.nodeValue=o;return}}i.textContent=o}var Ts={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},hC=["Webkit","ms","Moz","O"];Object.keys(Ts).forEach(function(i){hC.forEach(function(o){o=o+i.charAt(0).toUpperCase()+i.substring(1),Ts[o]=Ts[i]})});function Ig(i,o,u){return o==null||typeof o=="boolean"||o===""?"":u||typeof o!="number"||o===0||Ts.hasOwnProperty(i)&&Ts[i]?(""+o).trim():o+"px"}function zg(i,o){i=i.style;for(var u in o)if(o.hasOwnProperty(u)){var f=u.indexOf("--")===0,p=Ig(u,o[u],f);u==="float"&&(u="cssFloat"),f?i.setProperty(u,p):i[u]=p}}var cC=J({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Dh(i,o){if(o){if(cC[i]&&(o.children!=null||o.dangerouslySetInnerHTML!=null))throw Error(t(137,i));if(o.dangerouslySetInnerHTML!=null){if(o.children!=null)throw Error(t(60));if(typeof o.dangerouslySetInnerHTML!="object"||!("__html"in o.dangerouslySetInnerHTML))throw Error(t(61))}if(o.style!=null&&typeof o.style!="object")throw Error(t(62))}}function Lh(i,o){if(i.indexOf("-")===-1)return typeof o.is=="string";switch(i){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=null;function Bh(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Ih=null,xr=null,Sr=null;function Fg(i){if(i=Gs(i)){if(typeof Ih!="function")throw Error(t(280));var o=i.stateNode;o&&(o=$l(o),Ih(i.stateNode,i.type,o))}}function _g(i){xr?Sr?Sr.push(i):Sr=[i]:xr=i}function jg(){if(xr){var i=xr,o=Sr;if(Sr=xr=null,Fg(i),o)for(i=0;i<o.length;i++)Fg(o[i])}}function Vg(i,o){return i(o)}function Hg(){}var zh=!1;function Wg(i,o,u){if(zh)return i(o,u);zh=!0;try{return Vg(i,o,u)}finally{zh=!1,(xr!==null||Sr!==null)&&(Hg(),jg())}}function Ms(i,o){var u=i.stateNode;if(u===null)return null;var f=$l(u);if(f===null)return null;u=f[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break e;default:i=!1}if(i)return null;if(u&&typeof u!="function")throw Error(t(231,o,typeof u));return u}var Fh=!1;if(h)try{var Os={};Object.defineProperty(Os,"passive",{get:function(){Fh=!0}}),window.addEventListener("test",Os,Os),window.removeEventListener("test",Os,Os)}catch{Fh=!1}function fC(i,o,u,f,p,g,w,C,b){var P=Array.prototype.slice.call(arguments,3);try{o.apply(u,P)}catch(V){this.onError(V)}}var Es=!1,Cl=null,bl=!1,_h=null,dC={onError:function(i){Es=!0,Cl=i}};function pC(i,o,u,f,p,g,w,C,b){Es=!1,Cl=null,fC.apply(dC,arguments)}function mC(i,o,u,f,p,g,w,C,b){if(pC.apply(this,arguments),Es){if(Es){var P=Cl;Es=!1,Cl=null}else throw Error(t(198));bl||(bl=!0,_h=P)}}function ji(i){var o=i,u=i;if(i.alternate)for(;o.return;)o=o.return;else{i=o;do o=i,(o.flags&4098)!==0&&(u=o.return),i=o.return;while(i)}return o.tag===3?u:null}function Ug(i){if(i.tag===13){var o=i.memoizedState;if(o===null&&(i=i.alternate,i!==null&&(o=i.memoizedState)),o!==null)return o.dehydrated}return null}function $g(i){if(ji(i)!==i)throw Error(t(188))}function gC(i){var o=i.alternate;if(!o){if(o=ji(i),o===null)throw Error(t(188));return o!==i?null:i}for(var u=i,f=o;;){var p=u.return;if(p===null)break;var g=p.alternate;if(g===null){if(f=p.return,f!==null){u=f;continue}break}if(p.child===g.child){for(g=p.child;g;){if(g===u)return $g(p),i;if(g===f)return $g(p),o;g=g.sibling}throw Error(t(188))}if(u.return!==f.return)u=p,f=g;else{for(var w=!1,C=p.child;C;){if(C===u){w=!0,u=p,f=g;break}if(C===f){w=!0,f=p,u=g;break}C=C.sibling}if(!w){for(C=g.child;C;){if(C===u){w=!0,u=g,f=p;break}if(C===f){w=!0,f=g,u=p;break}C=C.sibling}if(!w)throw Error(t(189))}}if(u.alternate!==f)throw Error(t(190))}if(u.tag!==3)throw Error(t(188));return u.stateNode.current===u?i:o}function Kg(i){return i=gC(i),i!==null?Qg(i):null}function Qg(i){if(i.tag===5||i.tag===6)return i;for(i=i.child;i!==null;){var o=Qg(i);if(o!==null)return o;i=i.sibling}return null}var Gg=e.unstable_scheduleCallback,qg=e.unstable_cancelCallback,yC=e.unstable_shouldYield,vC=e.unstable_requestPaint,Ye=e.unstable_now,wC=e.unstable_getCurrentPriorityLevel,jh=e.unstable_ImmediatePriority,Yg=e.unstable_UserBlockingPriority,Al=e.unstable_NormalPriority,kC=e.unstable_LowPriority,Xg=e.unstable_IdlePriority,Tl=null,Pn=null;function xC(i){if(Pn&&typeof Pn.onCommitFiberRoot=="function")try{Pn.onCommitFiberRoot(Tl,i,void 0,(i.current.flags&128)===128)}catch{}}var hn=Math.clz32?Math.clz32:bC,SC=Math.log,CC=Math.LN2;function bC(i){return i>>>=0,i===0?32:31-(SC(i)/CC|0)|0}var Ml=64,Ol=4194304;function Ps(i){switch(i&-i){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: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 i&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return i&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return i}}function El(i,o){var u=i.pendingLanes;if(u===0)return 0;var f=0,p=i.suspendedLanes,g=i.pingedLanes,w=u&268435455;if(w!==0){var C=w&~p;C!==0?f=Ps(C):(g&=w,g!==0&&(f=Ps(g)))}else w=u&~p,w!==0?f=Ps(w):g!==0&&(f=Ps(g));if(f===0)return 0;if(o!==0&&o!==f&&(o&p)===0&&(p=f&-f,g=o&-o,p>=g||p===16&&(g&4194240)!==0))return o;if((f&4)!==0&&(f|=u&16),o=i.entangledLanes,o!==0)for(i=i.entanglements,o&=f;0<o;)u=31-hn(o),p=1<<u,f|=i[u],o&=~p;return f}function AC(i,o){switch(i){case 1:case 2:case 4:return o+250;case 8:case 16:case 32:case 64: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 o+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function TC(i,o){for(var u=i.suspendedLanes,f=i.pingedLanes,p=i.expirationTimes,g=i.pendingLanes;0<g;){var w=31-hn(g),C=1<<w,b=p[w];b===-1?((C&u)===0||(C&f)!==0)&&(p[w]=AC(C,o)):b<=o&&(i.expiredLanes|=C),g&=~C}}function Vh(i){return i=i.pendingLanes&-1073741825,i!==0?i:i&1073741824?1073741824:0}function Jg(){var i=Ml;return Ml<<=1,(Ml&4194240)===0&&(Ml=64),i}function Hh(i){for(var o=[],u=0;31>u;u++)o.push(i);return o}function Rs(i,o,u){i.pendingLanes|=o,o!==536870912&&(i.suspendedLanes=0,i.pingedLanes=0),i=i.eventTimes,o=31-hn(o),i[o]=u}function MC(i,o){var u=i.pendingLanes&~o;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.expiredLanes&=o,i.mutableReadLanes&=o,i.entangledLanes&=o,o=i.entanglements;var f=i.eventTimes;for(i=i.expirationTimes;0<u;){var p=31-hn(u),g=1<<p;o[p]=0,f[p]=-1,i[p]=-1,u&=~g}}function Wh(i,o){var u=i.entangledLanes|=o;for(i=i.entanglements;u;){var f=31-hn(u),p=1<<f;p&o|i[f]&o&&(i[f]|=o),u&=~p}}var De=0;function Zg(i){return i&=-i,1<i?4<i?(i&268435455)!==0?16:536870912:4:1}var e0,Uh,t0,n0,i0,$h=!1,Pl=[],ui=null,hi=null,ci=null,Ds=new Map,Ls=new Map,fi=[],OC="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 submit".split(" ");function r0(i,o){switch(i){case"focusin":case"focusout":ui=null;break;case"dragenter":case"dragleave":hi=null;break;case"mouseover":case"mouseout":ci=null;break;case"pointerover":case"pointerout":Ds.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ls.delete(o.pointerId)}}function Ns(i,o,u,f,p,g){return i===null||i.nativeEvent!==g?(i={blockedOn:o,domEventName:u,eventSystemFlags:f,nativeEvent:g,targetContainers:[p]},o!==null&&(o=Gs(o),o!==null&&Uh(o)),i):(i.eventSystemFlags|=f,o=i.targetContainers,p!==null&&o.indexOf(p)===-1&&o.push(p),i)}function EC(i,o,u,f,p){switch(o){case"focusin":return ui=Ns(ui,i,o,u,f,p),!0;case"dragenter":return hi=Ns(hi,i,o,u,f,p),!0;case"mouseover":return ci=Ns(ci,i,o,u,f,p),!0;case"pointerover":var g=p.pointerId;return Ds.set(g,Ns(Ds.get(g)||null,i,o,u,f,p)),!0;case"gotpointercapture":return g=p.pointerId,Ls.set(g,Ns(Ls.get(g)||null,i,o,u,f,p)),!0}return!1}function s0(i){var o=Vi(i.target);if(o!==null){var u=ji(o);if(u!==null){if(o=u.tag,o===13){if(o=Ug(u),o!==null){i.blockedOn=o,i0(i.priority,function(){t0(u)});return}}else if(o===3&&u.stateNode.current.memoizedState.isDehydrated){i.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Rl(i){if(i.blockedOn!==null)return!1;for(var o=i.targetContainers;0<o.length;){var u=Qh(i.domEventName,i.eventSystemFlags,o[0],i.nativeEvent);if(u===null){u=i.nativeEvent;var f=new u.constructor(u.type,u);Nh=f,u.target.dispatchEvent(f),Nh=null}else return o=Gs(u),o!==null&&Uh(o),i.blockedOn=u,!1;o.shift()}return!0}function o0(i,o,u){Rl(i)&&u.delete(o)}function PC(){$h=!1,ui!==null&&Rl(ui)&&(ui=null),hi!==null&&Rl(hi)&&(hi=null),ci!==null&&Rl(ci)&&(ci=null),Ds.forEach(o0),Ls.forEach(o0)}function Bs(i,o){i.blockedOn===o&&(i.blockedOn=null,$h||($h=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,PC)))}function Is(i){function o(p){return Bs(p,i)}if(0<Pl.length){Bs(Pl[0],i);for(var u=1;u<Pl.length;u++){var f=Pl[u];f.blockedOn===i&&(f.blockedOn=null)}}for(ui!==null&&Bs(ui,i),hi!==null&&Bs(hi,i),ci!==null&&Bs(ci,i),Ds.forEach(o),Ls.forEach(o),u=0;u<fi.length;u++)f=fi[u],f.blockedOn===i&&(f.blockedOn=null);for(;0<fi.length&&(u=fi[0],u.blockedOn===null);)s0(u),u.blockedOn===null&&fi.shift()}var Cr=_.ReactCurrentBatchConfig,Dl=!0;function RC(i,o,u,f){var p=De,g=Cr.transition;Cr.transition=null;try{De=1,Kh(i,o,u,f)}finally{De=p,Cr.transition=g}}function DC(i,o,u,f){var p=De,g=Cr.transition;Cr.transition=null;try{De=4,Kh(i,o,u,f)}finally{De=p,Cr.transition=g}}function Kh(i,o,u,f){if(Dl){var p=Qh(i,o,u,f);if(p===null)hc(i,o,f,Ll,u),r0(i,f);else if(EC(p,i,o,u,f))f.stopPropagation();else if(r0(i,f),o&4&&-1<OC.indexOf(i)){for(;p!==null;){var g=Gs(p);if(g!==null&&e0(g),g=Qh(i,o,u,f),g===null&&hc(i,o,f,Ll,u),g===p)break;p=g}p!==null&&f.stopPropagation()}else hc(i,o,f,null,u)}}var Ll=null;function Qh(i,o,u,f){if(Ll=null,i=Bh(f),i=Vi(i),i!==null)if(o=ji(i),o===null)i=null;else if(u=o.tag,u===13){if(i=Ug(o),i!==null)return i;i=null}else if(u===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;i=null}else o!==i&&(i=null);return Ll=i,null}function l0(i){switch(i){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"resize":case"seeked":case"submit":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"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(wC()){case jh:return 1;case Yg:return 4;case Al:case kC:return 16;case Xg:return 536870912;default:return 16}default:return 16}}var di=null,Gh=null,Nl=null;function a0(){if(Nl)return Nl;var i,o=Gh,u=o.length,f,p="value"in di?di.value:di.textContent,g=p.length;for(i=0;i<u&&o[i]===p[i];i++);var w=u-i;for(f=1;f<=w&&o[u-f]===p[g-f];f++);return Nl=p.slice(i,1<f?1-f:void 0)}function Bl(i){var o=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&o===13&&(i=13)):i=o,i===10&&(i=13),32<=i||i===13?i:0}function Il(){return!0}function u0(){return!1}function Ft(i){function o(u,f,p,g,w){this._reactName=u,this._targetInst=p,this.type=f,this.nativeEvent=g,this.target=w,this.currentTarget=null;for(var C in i)i.hasOwnProperty(C)&&(u=i[C],this[C]=u?u(g):g[C]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?Il:u0,this.isPropagationStopped=u0,this}return J(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Il)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Il)},persist:function(){},isPersistent:Il}),o}var br={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qh=Ft(br),zs=J({},br,{view:0,detail:0}),LC=Ft(zs),Yh,Xh,Fs,zl=J({},zs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Zh,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Fs&&(Fs&&i.type==="mousemove"?(Yh=i.screenX-Fs.screenX,Xh=i.screenY-Fs.screenY):Xh=Yh=0,Fs=i),Yh)},movementY:function(i){return"movementY"in i?i.movementY:Xh}}),h0=Ft(zl),NC=J({},zl,{dataTransfer:0}),BC=Ft(NC),IC=J({},zs,{relatedTarget:0}),Jh=Ft(IC),zC=J({},br,{animationName:0,elapsedTime:0,pseudoElement:0}),FC=Ft(zC),_C=J({},br,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),jC=Ft(_C),VC=J({},br,{data:0}),c0=Ft(VC),HC={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},WC={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"},UC={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function $C(i){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(i):(i=UC[i])?!!o[i]:!1}function Zh(){return $C}var KC=J({},zs,{key:function(i){if(i.key){var o=HC[i.key]||i.key;if(o!=="Unidentified")return o}return i.type==="keypress"?(i=Bl(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?WC[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Zh,charCode:function(i){return i.type==="keypress"?Bl(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Bl(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),QC=Ft(KC),GC=J({},zl,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),f0=Ft(GC),qC=J({},zs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Zh}),YC=Ft(qC),XC=J({},br,{propertyName:0,elapsedTime:0,pseudoElement:0}),JC=Ft(XC),ZC=J({},zl,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),eb=Ft(ZC),tb=[9,13,27,32],ec=h&&"CompositionEvent"in window,_s=null;h&&"documentMode"in document&&(_s=document.documentMode);var nb=h&&"TextEvent"in window&&!_s,d0=h&&(!ec||_s&&8<_s&&11>=_s),p0=" ",m0=!1;function g0(i,o){switch(i){case"keyup":return tb.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function y0(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var Ar=!1;function ib(i,o){switch(i){case"compositionend":return y0(o);case"keypress":return o.which!==32?null:(m0=!0,p0);case"textInput":return i=o.data,i===p0&&m0?null:i;default:return null}}function rb(i,o){if(Ar)return i==="compositionend"||!ec&&g0(i,o)?(i=a0(),Nl=Gh=di=null,Ar=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return d0&&o.locale!=="ko"?null:o.data;default:return null}}var sb={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 v0(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o==="input"?!!sb[i.type]:o==="textarea"}function w0(i,o,u,f){_g(f),o=Hl(o,"onChange"),0<o.length&&(u=new qh("onChange","change",null,u,f),i.push({event:u,listeners:o}))}var js=null,Vs=null;function ob(i){z0(i,0)}function Fl(i){var o=Pr(i);if(mt(o))return i}function lb(i,o){if(i==="change")return o}var k0=!1;if(h){var tc;if(h){var nc="oninput"in document;if(!nc){var x0=document.createElement("div");x0.setAttribute("oninput","return;"),nc=typeof x0.oninput=="function"}tc=nc}else tc=!1;k0=tc&&(!document.documentMode||9<document.documentMode)}function S0(){js&&(js.detachEvent("onpropertychange",C0),Vs=js=null)}function C0(i){if(i.propertyName==="value"&&Fl(Vs)){var o=[];w0(o,Vs,i,Bh(i)),Wg(ob,o)}}function ab(i,o,u){i==="focusin"?(S0(),js=o,Vs=u,js.attachEvent("onpropertychange",C0)):i==="focusout"&&S0()}function ub(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Fl(Vs)}function hb(i,o){if(i==="click")return Fl(o)}function cb(i,o){if(i==="input"||i==="change")return Fl(o)}function fb(i,o){return i===o&&(i!==0||1/i===1/o)||i!==i&&o!==o}var cn=typeof Object.is=="function"?Object.is:fb;function Hs(i,o){if(cn(i,o))return!0;if(typeof i!="object"||i===null||typeof o!="object"||o===null)return!1;var u=Object.keys(i),f=Object.keys(o);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var p=u[f];if(!c.call(o,p)||!cn(i[p],o[p]))return!1}return!0}function b0(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function A0(i,o){var u=b0(i);i=0;for(var f;u;){if(u.nodeType===3){if(f=i+u.textContent.length,i<=o&&f>=o)return{node:u,offset:o-i};i=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=b0(u)}}function T0(i,o){return i&&o?i===o?!0:i&&i.nodeType===3?!1:o&&o.nodeType===3?T0(i,o.parentNode):"contains"in i?i.contains(o):i.compareDocumentPosition?!!(i.compareDocumentPosition(o)&16):!1:!1}function M0(){for(var i=window,o=qt();o instanceof i.HTMLIFrameElement;){try{var u=typeof o.contentWindow.location.href=="string"}catch{u=!1}if(u)i=o.contentWindow;else break;o=qt(i.document)}return o}function ic(i){var o=i&&i.nodeName&&i.nodeName.toLowerCase();return o&&(o==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||o==="textarea"||i.contentEditable==="true")}function db(i){var o=M0(),u=i.focusedElem,f=i.selectionRange;if(o!==u&&u&&u.ownerDocument&&T0(u.ownerDocument.documentElement,u)){if(f!==null&&ic(u)){if(o=f.start,i=f.end,i===void 0&&(i=o),"selectionStart"in u)u.selectionStart=o,u.selectionEnd=Math.min(i,u.value.length);else if(i=(o=u.ownerDocument||document)&&o.defaultView||window,i.getSelection){i=i.getSelection();var p=u.textContent.length,g=Math.min(f.start,p);f=f.end===void 0?g:Math.min(f.end,p),!i.extend&&g>f&&(p=f,f=g,g=p),p=A0(u,g);var w=A0(u,f);p&&w&&(i.rangeCount!==1||i.anchorNode!==p.node||i.anchorOffset!==p.offset||i.focusNode!==w.node||i.focusOffset!==w.offset)&&(o=o.createRange(),o.setStart(p.node,p.offset),i.removeAllRanges(),g>f?(i.addRange(o),i.extend(w.node,w.offset)):(o.setEnd(w.node,w.offset),i.addRange(o)))}}for(o=[],i=u;i=i.parentNode;)i.nodeType===1&&o.push({element:i,left:i.scrollLeft,top:i.scrollTop});for(typeof u.focus=="function"&&u.focus(),u=0;u<o.length;u++)i=o[u],i.element.scrollLeft=i.left,i.element.scrollTop=i.top}}var pb=h&&"documentMode"in document&&11>=document.documentMode,Tr=null,rc=null,Ws=null,sc=!1;function O0(i,o,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;sc||Tr==null||Tr!==qt(f)||(f=Tr,"selectionStart"in f&&ic(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Ws&&Hs(Ws,f)||(Ws=f,f=Hl(rc,"onSelect"),0<f.length&&(o=new qh("onSelect","select",null,o,u),i.push({event:o,listeners:f}),o.target=Tr)))}function _l(i,o){var u={};return u[i.toLowerCase()]=o.toLowerCase(),u["Webkit"+i]="webkit"+o,u["Moz"+i]="moz"+o,u}var Mr={animationend:_l("Animation","AnimationEnd"),animationiteration:_l("Animation","AnimationIteration"),animationstart:_l("Animation","AnimationStart"),transitionend:_l("Transition","TransitionEnd")},oc={},E0={};h&&(E0=document.createElement("div").style,"AnimationEvent"in window||(delete Mr.animationend.animation,delete Mr.animationiteration.animation,delete Mr.animationstart.animation),"TransitionEvent"in window||delete Mr.transitionend.transition);function jl(i){if(oc[i])return oc[i];if(!Mr[i])return i;var o=Mr[i],u;for(u in o)if(o.hasOwnProperty(u)&&u in E0)return oc[i]=o[u];return i}var P0=jl("animationend"),R0=jl("animationiteration"),D0=jl("animationstart"),L0=jl("transitionend"),N0=new Map,B0="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error 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(" ");function pi(i,o){N0.set(i,o),l(o,[i])}for(var lc=0;lc<B0.length;lc++){var ac=B0[lc],mb=ac.toLowerCase(),gb=ac[0].toUpperCase()+ac.slice(1);pi(mb,"on"+gb)}pi(P0,"onAnimationEnd"),pi(R0,"onAnimationIteration"),pi(D0,"onAnimationStart"),pi("dblclick","onDoubleClick"),pi("focusin","onFocus"),pi("focusout","onBlur"),pi(L0,"onTransitionEnd"),a("onMouseEnter",["mouseout","mouseover"]),a("onMouseLeave",["mouseout","mouseover"]),a("onPointerEnter",["pointerout","pointerover"]),a("onPointerLeave",["pointerout","pointerover"]),l("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),l("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),l("onBeforeInput",["compositionend","keypress","textInput","paste"]),l("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),l("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Us="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(" "),yb=new Set("cancel close invalid load scroll toggle".split(" ").concat(Us));function I0(i,o,u){var f=i.type||"unknown-event";i.currentTarget=u,mC(f,o,void 0,i),i.currentTarget=null}function z0(i,o){o=(o&4)!==0;for(var u=0;u<i.length;u++){var f=i[u],p=f.event;f=f.listeners;e:{var g=void 0;if(o)for(var w=f.length-1;0<=w;w--){var C=f[w],b=C.instance,P=C.currentTarget;if(C=C.listener,b!==g&&p.isPropagationStopped())break e;I0(p,C,P),g=b}else for(w=0;w<f.length;w++){if(C=f[w],b=C.instance,P=C.currentTarget,C=C.listener,b!==g&&p.isPropagationStopped())break e;I0(p,C,P),g=b}}}if(bl)throw i=_h,bl=!1,_h=null,i}function Fe(i,o){var u=o[gc];u===void 0&&(u=o[gc]=new Set);var f=i+"__bubble";u.has(f)||(F0(o,i,2,!1),u.add(f))}function uc(i,o,u){var f=0;o&&(f|=4),F0(u,i,f,o)}var Vl="_reactListening"+Math.random().toString(36).slice(2);function $s(i){if(!i[Vl]){i[Vl]=!0,n.forEach(function(u){u!=="selectionchange"&&(yb.has(u)||uc(u,!1,i),uc(u,!0,i))});var o=i.nodeType===9?i:i.ownerDocument;o===null||o[Vl]||(o[Vl]=!0,uc("selectionchange",!1,o))}}function F0(i,o,u,f){switch(l0(o)){case 1:var p=RC;break;case 4:p=DC;break;default:p=Kh}u=p.bind(null,o,u,i),p=void 0,!Fh||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(p=!0),f?p!==void 0?i.addEventListener(o,u,{capture:!0,passive:p}):i.addEventListener(o,u,!0):p!==void 0?i.addEventListener(o,u,{passive:p}):i.addEventListener(o,u,!1)}function hc(i,o,u,f,p){var g=f;if((o&1)===0&&(o&2)===0&&f!==null)e:for(;;){if(f===null)return;var w=f.tag;if(w===3||w===4){var C=f.stateNode.containerInfo;if(C===p||C.nodeType===8&&C.parentNode===p)break;if(w===4)for(w=f.return;w!==null;){var b=w.tag;if((b===3||b===4)&&(b=w.stateNode.containerInfo,b===p||b.nodeType===8&&b.parentNode===p))return;w=w.return}for(;C!==null;){if(w=Vi(C),w===null)return;if(b=w.tag,b===5||b===6){f=g=w;continue e}C=C.parentNode}}f=f.return}Wg(function(){var P=g,V=Bh(u),W=[];e:{var j=N0.get(i);if(j!==void 0){var Z=qh,ie=i;switch(i){case"keypress":if(Bl(u)===0)break e;case"keydown":case"keyup":Z=QC;break;case"focusin":ie="focus",Z=Jh;break;case"focusout":ie="blur",Z=Jh;break;case"beforeblur":case"afterblur":Z=Jh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Z=h0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Z=BC;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Z=YC;break;case P0:case R0:case D0:Z=FC;break;case L0:Z=JC;break;case"scroll":Z=LC;break;case"wheel":Z=eb;break;case"copy":case"cut":case"paste":Z=jC;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Z=f0}var re=(o&4)!==0,Xe=!re&&i==="scroll",O=re?j!==null?j+"Capture":null:j;re=[];for(var A=P,E;A!==null;){E=A;var U=E.stateNode;if(E.tag===5&&U!==null&&(E=U,O!==null&&(U=Ms(A,O),U!=null&&re.push(Ks(A,U,E)))),Xe)break;A=A.return}0<re.length&&(j=new Z(j,ie,null,u,V),W.push({event:j,listeners:re}))}}if((o&7)===0){e:{if(j=i==="mouseover"||i==="pointerover",Z=i==="mouseout"||i==="pointerout",j&&u!==Nh&&(ie=u.relatedTarget||u.fromElement)&&(Vi(ie)||ie[Vn]))break e;if((Z||j)&&(j=V.window===V?V:(j=V.ownerDocument)?j.defaultView||j.parentWindow:window,Z?(ie=u.relatedTarget||u.toElement,Z=P,ie=ie?Vi(ie):null,ie!==null&&(Xe=ji(ie),ie!==Xe||ie.tag!==5&&ie.tag!==6)&&(ie=null)):(Z=null,ie=P),Z!==ie)){if(re=h0,U="onMouseLeave",O="onMouseEnter",A="mouse",(i==="pointerout"||i==="pointerover")&&(re=f0,U="onPointerLeave",O="onPointerEnter",A="pointer"),Xe=Z==null?j:Pr(Z),E=ie==null?j:Pr(ie),j=new re(U,A+"leave",Z,u,V),j.target=Xe,j.relatedTarget=E,U=null,Vi(V)===P&&(re=new re(O,A+"enter",ie,u,V),re.target=E,re.relatedTarget=Xe,U=re),Xe=U,Z&&ie)t:{for(re=Z,O=ie,A=0,E=re;E;E=Or(E))A++;for(E=0,U=O;U;U=Or(U))E++;for(;0<A-E;)re=Or(re),A--;for(;0<E-A;)O=Or(O),E--;for(;A--;){if(re===O||O!==null&&re===O.alternate)break t;re=Or(re),O=Or(O)}re=null}else re=null;Z!==null&&_0(W,j,Z,re,!1),ie!==null&&Xe!==null&&_0(W,Xe,ie,re,!0)}}e:{if(j=P?Pr(P):window,Z=j.nodeName&&j.nodeName.toLowerCase(),Z==="select"||Z==="input"&&j.type==="file")var le=lb;else if(v0(j))if(k0)le=cb;else{le=ub;var fe=ab}else(Z=j.nodeName)&&Z.toLowerCase()==="input"&&(j.type==="checkbox"||j.type==="radio")&&(le=hb);if(le&&(le=le(i,P))){w0(W,le,u,V);break e}fe&&fe(i,j,P),i==="focusout"&&(fe=j._wrapperState)&&fe.controlled&&j.type==="number"&&Eh(j,"number",j.value)}switch(fe=P?Pr(P):window,i){case"focusin":(v0(fe)||fe.contentEditable==="true")&&(Tr=fe,rc=P,Ws=null);break;case"focusout":Ws=rc=Tr=null;break;case"mousedown":sc=!0;break;case"contextmenu":case"mouseup":case"dragend":sc=!1,O0(W,u,V);break;case"selectionchange":if(pb)break;case"keydown":case"keyup":O0(W,u,V)}var de;if(ec)e:{switch(i){case"compositionstart":var ye="onCompositionStart";break e;case"compositionend":ye="onCompositionEnd";break e;case"compositionupdate":ye="onCompositionUpdate";break e}ye=void 0}else Ar?g0(i,u)&&(ye="onCompositionEnd"):i==="keydown"&&u.keyCode===229&&(ye="onCompositionStart");ye&&(d0&&u.locale!=="ko"&&(Ar||ye!=="onCompositionStart"?ye==="onCompositionEnd"&&Ar&&(de=a0()):(di=V,Gh="value"in di?di.value:di.textContent,Ar=!0)),fe=Hl(P,ye),0<fe.length&&(ye=new c0(ye,i,null,u,V),W.push({event:ye,listeners:fe}),de?ye.data=de:(de=y0(u),de!==null&&(ye.data=de)))),(de=nb?ib(i,u):rb(i,u))&&(P=Hl(P,"onBeforeInput"),0<P.length&&(V=new c0("onBeforeInput","beforeinput",null,u,V),W.push({event:V,listeners:P}),V.data=de))}z0(W,o)})}function Ks(i,o,u){return{instance:i,listener:o,currentTarget:u}}function Hl(i,o){for(var u=o+"Capture",f=[];i!==null;){var p=i,g=p.stateNode;p.tag===5&&g!==null&&(p=g,g=Ms(i,u),g!=null&&f.unshift(Ks(i,g,p)),g=Ms(i,o),g!=null&&f.push(Ks(i,g,p))),i=i.return}return f}function Or(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5);return i||null}function _0(i,o,u,f,p){for(var g=o._reactName,w=[];u!==null&&u!==f;){var C=u,b=C.alternate,P=C.stateNode;if(b!==null&&b===f)break;C.tag===5&&P!==null&&(C=P,p?(b=Ms(u,g),b!=null&&w.unshift(Ks(u,b,C))):p||(b=Ms(u,g),b!=null&&w.push(Ks(u,b,C)))),u=u.return}w.length!==0&&i.push({event:o,listeners:w})}var vb=/\r\n?/g,wb=/\u0000|\uFFFD/g;function j0(i){return(typeof i=="string"?i:""+i).replace(vb,`
6
+ `).replace(wb,"")}function Wl(i,o,u){if(o=j0(o),j0(i)!==o&&u)throw Error(t(425))}function Ul(){}var cc=null,fc=null;function dc(i,o){return i==="textarea"||i==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var pc=typeof setTimeout=="function"?setTimeout:void 0,kb=typeof clearTimeout=="function"?clearTimeout:void 0,V0=typeof Promise=="function"?Promise:void 0,xb=typeof queueMicrotask=="function"?queueMicrotask:typeof V0<"u"?function(i){return V0.resolve(null).then(i).catch(Sb)}:pc;function Sb(i){setTimeout(function(){throw i})}function mc(i,o){var u=o,f=0;do{var p=u.nextSibling;if(i.removeChild(u),p&&p.nodeType===8)if(u=p.data,u==="/$"){if(f===0){i.removeChild(p),Is(o);return}f--}else u!=="$"&&u!=="$?"&&u!=="$!"||f++;u=p}while(u);Is(o)}function mi(i){for(;i!=null;i=i.nextSibling){var o=i.nodeType;if(o===1||o===3)break;if(o===8){if(o=i.data,o==="$"||o==="$!"||o==="$?")break;if(o==="/$")return null}}return i}function H0(i){i=i.previousSibling;for(var o=0;i;){if(i.nodeType===8){var u=i.data;if(u==="$"||u==="$!"||u==="$?"){if(o===0)return i;o--}else u==="/$"&&o++}i=i.previousSibling}return null}var Er=Math.random().toString(36).slice(2),Rn="__reactFiber$"+Er,Qs="__reactProps$"+Er,Vn="__reactContainer$"+Er,gc="__reactEvents$"+Er,Cb="__reactListeners$"+Er,bb="__reactHandles$"+Er;function Vi(i){var o=i[Rn];if(o)return o;for(var u=i.parentNode;u;){if(o=u[Vn]||u[Rn]){if(u=o.alternate,o.child!==null||u!==null&&u.child!==null)for(i=H0(i);i!==null;){if(u=i[Rn])return u;i=H0(i)}return o}i=u,u=i.parentNode}return null}function Gs(i){return i=i[Rn]||i[Vn],!i||i.tag!==5&&i.tag!==6&&i.tag!==13&&i.tag!==3?null:i}function Pr(i){if(i.tag===5||i.tag===6)return i.stateNode;throw Error(t(33))}function $l(i){return i[Qs]||null}var yc=[],Rr=-1;function gi(i){return{current:i}}function _e(i){0>Rr||(i.current=yc[Rr],yc[Rr]=null,Rr--)}function Ie(i,o){Rr++,yc[Rr]=i.current,i.current=o}var yi={},gt=gi(yi),Rt=gi(!1),Hi=yi;function Dr(i,o){var u=i.type.contextTypes;if(!u)return yi;var f=i.stateNode;if(f&&f.__reactInternalMemoizedUnmaskedChildContext===o)return f.__reactInternalMemoizedMaskedChildContext;var p={},g;for(g in u)p[g]=o[g];return f&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=o,i.__reactInternalMemoizedMaskedChildContext=p),p}function Dt(i){return i=i.childContextTypes,i!=null}function Kl(){_e(Rt),_e(gt)}function W0(i,o,u){if(gt.current!==yi)throw Error(t(168));Ie(gt,o),Ie(Rt,u)}function U0(i,o,u){var f=i.stateNode;if(o=o.childContextTypes,typeof f.getChildContext!="function")return u;f=f.getChildContext();for(var p in f)if(!(p in o))throw Error(t(108,oe(i)||"Unknown",p));return J({},u,f)}function Ql(i){return i=(i=i.stateNode)&&i.__reactInternalMemoizedMergedChildContext||yi,Hi=gt.current,Ie(gt,i),Ie(Rt,Rt.current),!0}function $0(i,o,u){var f=i.stateNode;if(!f)throw Error(t(169));u?(i=U0(i,o,Hi),f.__reactInternalMemoizedMergedChildContext=i,_e(Rt),_e(gt),Ie(gt,i)):_e(Rt),Ie(Rt,u)}var Hn=null,Gl=!1,vc=!1;function K0(i){Hn===null?Hn=[i]:Hn.push(i)}function Ab(i){Gl=!0,K0(i)}function vi(){if(!vc&&Hn!==null){vc=!0;var i=0,o=De;try{var u=Hn;for(De=1;i<u.length;i++){var f=u[i];do f=f(!0);while(f!==null)}Hn=null,Gl=!1}catch(p){throw Hn!==null&&(Hn=Hn.slice(i+1)),Gg(jh,vi),p}finally{De=o,vc=!1}}return null}var Lr=[],Nr=0,ql=null,Yl=0,Yt=[],Xt=0,Wi=null,Wn=1,Un="";function Ui(i,o){Lr[Nr++]=Yl,Lr[Nr++]=ql,ql=i,Yl=o}function Q0(i,o,u){Yt[Xt++]=Wn,Yt[Xt++]=Un,Yt[Xt++]=Wi,Wi=i;var f=Wn;i=Un;var p=32-hn(f)-1;f&=~(1<<p),u+=1;var g=32-hn(o)+p;if(30<g){var w=p-p%5;g=(f&(1<<w)-1).toString(32),f>>=w,p-=w,Wn=1<<32-hn(o)+p|u<<p|f,Un=g+i}else Wn=1<<g|u<<p|f,Un=i}function wc(i){i.return!==null&&(Ui(i,1),Q0(i,1,0))}function kc(i){for(;i===ql;)ql=Lr[--Nr],Lr[Nr]=null,Yl=Lr[--Nr],Lr[Nr]=null;for(;i===Wi;)Wi=Yt[--Xt],Yt[Xt]=null,Un=Yt[--Xt],Yt[Xt]=null,Wn=Yt[--Xt],Yt[Xt]=null}var _t=null,jt=null,Ve=!1,fn=null;function G0(i,o){var u=tn(5,null,null,0);u.elementType="DELETED",u.stateNode=o,u.return=i,o=i.deletions,o===null?(i.deletions=[u],i.flags|=16):o.push(u)}function q0(i,o){switch(i.tag){case 5:var u=i.type;return o=o.nodeType!==1||u.toLowerCase()!==o.nodeName.toLowerCase()?null:o,o!==null?(i.stateNode=o,_t=i,jt=mi(o.firstChild),!0):!1;case 6:return o=i.pendingProps===""||o.nodeType!==3?null:o,o!==null?(i.stateNode=o,_t=i,jt=null,!0):!1;case 13:return o=o.nodeType!==8?null:o,o!==null?(u=Wi!==null?{id:Wn,overflow:Un}:null,i.memoizedState={dehydrated:o,treeContext:u,retryLane:1073741824},u=tn(18,null,null,0),u.stateNode=o,u.return=i,i.child=u,_t=i,jt=null,!0):!1;default:return!1}}function xc(i){return(i.mode&1)!==0&&(i.flags&128)===0}function Sc(i){if(Ve){var o=jt;if(o){var u=o;if(!q0(i,o)){if(xc(i))throw Error(t(418));o=mi(u.nextSibling);var f=_t;o&&q0(i,o)?G0(f,u):(i.flags=i.flags&-4097|2,Ve=!1,_t=i)}}else{if(xc(i))throw Error(t(418));i.flags=i.flags&-4097|2,Ve=!1,_t=i}}}function Y0(i){for(i=i.return;i!==null&&i.tag!==5&&i.tag!==3&&i.tag!==13;)i=i.return;_t=i}function Xl(i){if(i!==_t)return!1;if(!Ve)return Y0(i),Ve=!0,!1;var o;if((o=i.tag!==3)&&!(o=i.tag!==5)&&(o=i.type,o=o!=="head"&&o!=="body"&&!dc(i.type,i.memoizedProps)),o&&(o=jt)){if(xc(i))throw X0(),Error(t(418));for(;o;)G0(i,o),o=mi(o.nextSibling)}if(Y0(i),i.tag===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(t(317));e:{for(i=i.nextSibling,o=0;i;){if(i.nodeType===8){var u=i.data;if(u==="/$"){if(o===0){jt=mi(i.nextSibling);break e}o--}else u!=="$"&&u!=="$!"&&u!=="$?"||o++}i=i.nextSibling}jt=null}}else jt=_t?mi(i.stateNode.nextSibling):null;return!0}function X0(){for(var i=jt;i;)i=mi(i.nextSibling)}function Br(){jt=_t=null,Ve=!1}function Cc(i){fn===null?fn=[i]:fn.push(i)}var Tb=_.ReactCurrentBatchConfig;function qs(i,o,u){if(i=u.ref,i!==null&&typeof i!="function"&&typeof i!="object"){if(u._owner){if(u=u._owner,u){if(u.tag!==1)throw Error(t(309));var f=u.stateNode}if(!f)throw Error(t(147,i));var p=f,g=""+i;return o!==null&&o.ref!==null&&typeof o.ref=="function"&&o.ref._stringRef===g?o.ref:(o=function(w){var C=p.refs;w===null?delete C[g]:C[g]=w},o._stringRef=g,o)}if(typeof i!="string")throw Error(t(284));if(!u._owner)throw Error(t(290,i))}return i}function Jl(i,o){throw i=Object.prototype.toString.call(o),Error(t(31,i==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":i))}function J0(i){var o=i._init;return o(i._payload)}function Z0(i){function o(O,A){if(i){var E=O.deletions;E===null?(O.deletions=[A],O.flags|=16):E.push(A)}}function u(O,A){if(!i)return null;for(;A!==null;)o(O,A),A=A.sibling;return null}function f(O,A){for(O=new Map;A!==null;)A.key!==null?O.set(A.key,A):O.set(A.index,A),A=A.sibling;return O}function p(O,A){return O=Ti(O,A),O.index=0,O.sibling=null,O}function g(O,A,E){return O.index=E,i?(E=O.alternate,E!==null?(E=E.index,E<A?(O.flags|=2,A):E):(O.flags|=2,A)):(O.flags|=1048576,A)}function w(O){return i&&O.alternate===null&&(O.flags|=2),O}function C(O,A,E,U){return A===null||A.tag!==6?(A=mf(E,O.mode,U),A.return=O,A):(A=p(A,E),A.return=O,A)}function b(O,A,E,U){var le=E.type;return le===F?V(O,A,E.props.children,U,E.key):A!==null&&(A.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===ze&&J0(le)===A.type)?(U=p(A,E.props),U.ref=qs(O,A,E),U.return=O,U):(U=Sa(E.type,E.key,E.props,null,O.mode,U),U.ref=qs(O,A,E),U.return=O,U)}function P(O,A,E,U){return A===null||A.tag!==4||A.stateNode.containerInfo!==E.containerInfo||A.stateNode.implementation!==E.implementation?(A=gf(E,O.mode,U),A.return=O,A):(A=p(A,E.children||[]),A.return=O,A)}function V(O,A,E,U,le){return A===null||A.tag!==7?(A=Ji(E,O.mode,U,le),A.return=O,A):(A=p(A,E),A.return=O,A)}function W(O,A,E){if(typeof A=="string"&&A!==""||typeof A=="number")return A=mf(""+A,O.mode,E),A.return=O,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case K:return E=Sa(A.type,A.key,A.props,null,O.mode,E),E.ref=qs(O,null,A),E.return=O,E;case I:return A=gf(A,O.mode,E),A.return=O,A;case ze:var U=A._init;return W(O,U(A._payload),E)}if(bs(A)||se(A))return A=Ji(A,O.mode,E,null),A.return=O,A;Jl(O,A)}return null}function j(O,A,E,U){var le=A!==null?A.key:null;if(typeof E=="string"&&E!==""||typeof E=="number")return le!==null?null:C(O,A,""+E,U);if(typeof E=="object"&&E!==null){switch(E.$$typeof){case K:return E.key===le?b(O,A,E,U):null;case I:return E.key===le?P(O,A,E,U):null;case ze:return le=E._init,j(O,A,le(E._payload),U)}if(bs(E)||se(E))return le!==null?null:V(O,A,E,U,null);Jl(O,E)}return null}function Z(O,A,E,U,le){if(typeof U=="string"&&U!==""||typeof U=="number")return O=O.get(E)||null,C(A,O,""+U,le);if(typeof U=="object"&&U!==null){switch(U.$$typeof){case K:return O=O.get(U.key===null?E:U.key)||null,b(A,O,U,le);case I:return O=O.get(U.key===null?E:U.key)||null,P(A,O,U,le);case ze:var fe=U._init;return Z(O,A,E,fe(U._payload),le)}if(bs(U)||se(U))return O=O.get(E)||null,V(A,O,U,le,null);Jl(A,U)}return null}function ie(O,A,E,U){for(var le=null,fe=null,de=A,ye=A=0,ot=null;de!==null&&ye<E.length;ye++){de.index>ye?(ot=de,de=null):ot=de.sibling;var Pe=j(O,de,E[ye],U);if(Pe===null){de===null&&(de=ot);break}i&&de&&Pe.alternate===null&&o(O,de),A=g(Pe,A,ye),fe===null?le=Pe:fe.sibling=Pe,fe=Pe,de=ot}if(ye===E.length)return u(O,de),Ve&&Ui(O,ye),le;if(de===null){for(;ye<E.length;ye++)de=W(O,E[ye],U),de!==null&&(A=g(de,A,ye),fe===null?le=de:fe.sibling=de,fe=de);return Ve&&Ui(O,ye),le}for(de=f(O,de);ye<E.length;ye++)ot=Z(de,O,ye,E[ye],U),ot!==null&&(i&&ot.alternate!==null&&de.delete(ot.key===null?ye:ot.key),A=g(ot,A,ye),fe===null?le=ot:fe.sibling=ot,fe=ot);return i&&de.forEach(function(Mi){return o(O,Mi)}),Ve&&Ui(O,ye),le}function re(O,A,E,U){var le=se(E);if(typeof le!="function")throw Error(t(150));if(E=le.call(E),E==null)throw Error(t(151));for(var fe=le=null,de=A,ye=A=0,ot=null,Pe=E.next();de!==null&&!Pe.done;ye++,Pe=E.next()){de.index>ye?(ot=de,de=null):ot=de.sibling;var Mi=j(O,de,Pe.value,U);if(Mi===null){de===null&&(de=ot);break}i&&de&&Mi.alternate===null&&o(O,de),A=g(Mi,A,ye),fe===null?le=Mi:fe.sibling=Mi,fe=Mi,de=ot}if(Pe.done)return u(O,de),Ve&&Ui(O,ye),le;if(de===null){for(;!Pe.done;ye++,Pe=E.next())Pe=W(O,Pe.value,U),Pe!==null&&(A=g(Pe,A,ye),fe===null?le=Pe:fe.sibling=Pe,fe=Pe);return Ve&&Ui(O,ye),le}for(de=f(O,de);!Pe.done;ye++,Pe=E.next())Pe=Z(de,O,ye,Pe.value,U),Pe!==null&&(i&&Pe.alternate!==null&&de.delete(Pe.key===null?ye:Pe.key),A=g(Pe,A,ye),fe===null?le=Pe:fe.sibling=Pe,fe=Pe);return i&&de.forEach(function(s2){return o(O,s2)}),Ve&&Ui(O,ye),le}function Xe(O,A,E,U){if(typeof E=="object"&&E!==null&&E.type===F&&E.key===null&&(E=E.props.children),typeof E=="object"&&E!==null){switch(E.$$typeof){case K:e:{for(var le=E.key,fe=A;fe!==null;){if(fe.key===le){if(le=E.type,le===F){if(fe.tag===7){u(O,fe.sibling),A=p(fe,E.props.children),A.return=O,O=A;break e}}else if(fe.elementType===le||typeof le=="object"&&le!==null&&le.$$typeof===ze&&J0(le)===fe.type){u(O,fe.sibling),A=p(fe,E.props),A.ref=qs(O,fe,E),A.return=O,O=A;break e}u(O,fe);break}else o(O,fe);fe=fe.sibling}E.type===F?(A=Ji(E.props.children,O.mode,U,E.key),A.return=O,O=A):(U=Sa(E.type,E.key,E.props,null,O.mode,U),U.ref=qs(O,A,E),U.return=O,O=U)}return w(O);case I:e:{for(fe=E.key;A!==null;){if(A.key===fe)if(A.tag===4&&A.stateNode.containerInfo===E.containerInfo&&A.stateNode.implementation===E.implementation){u(O,A.sibling),A=p(A,E.children||[]),A.return=O,O=A;break e}else{u(O,A);break}else o(O,A);A=A.sibling}A=gf(E,O.mode,U),A.return=O,O=A}return w(O);case ze:return fe=E._init,Xe(O,A,fe(E._payload),U)}if(bs(E))return ie(O,A,E,U);if(se(E))return re(O,A,E,U);Jl(O,E)}return typeof E=="string"&&E!==""||typeof E=="number"?(E=""+E,A!==null&&A.tag===6?(u(O,A.sibling),A=p(A,E),A.return=O,O=A):(u(O,A),A=mf(E,O.mode,U),A.return=O,O=A),w(O)):u(O,A)}return Xe}var Ir=Z0(!0),ey=Z0(!1),Zl=gi(null),ea=null,zr=null,bc=null;function Ac(){bc=zr=ea=null}function Tc(i){var o=Zl.current;_e(Zl),i._currentValue=o}function Mc(i,o,u){for(;i!==null;){var f=i.alternate;if((i.childLanes&o)!==o?(i.childLanes|=o,f!==null&&(f.childLanes|=o)):f!==null&&(f.childLanes&o)!==o&&(f.childLanes|=o),i===u)break;i=i.return}}function Fr(i,o){ea=i,bc=zr=null,i=i.dependencies,i!==null&&i.firstContext!==null&&((i.lanes&o)!==0&&(Lt=!0),i.firstContext=null)}function Jt(i){var o=i._currentValue;if(bc!==i)if(i={context:i,memoizedValue:o,next:null},zr===null){if(ea===null)throw Error(t(308));zr=i,ea.dependencies={lanes:0,firstContext:i}}else zr=zr.next=i;return o}var $i=null;function Oc(i){$i===null?$i=[i]:$i.push(i)}function ty(i,o,u,f){var p=o.interleaved;return p===null?(u.next=u,Oc(o)):(u.next=p.next,p.next=u),o.interleaved=u,$n(i,f)}function $n(i,o){i.lanes|=o;var u=i.alternate;for(u!==null&&(u.lanes|=o),u=i,i=i.return;i!==null;)i.childLanes|=o,u=i.alternate,u!==null&&(u.childLanes|=o),u=i,i=i.return;return u.tag===3?u.stateNode:null}var wi=!1;function Ec(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function ny(i,o){i=i.updateQueue,o.updateQueue===i&&(o.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,effects:i.effects})}function Kn(i,o){return{eventTime:i,lane:o,tag:0,payload:null,callback:null,next:null}}function ki(i,o,u){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(Ee&2)!==0){var p=f.pending;return p===null?o.next=o:(o.next=p.next,p.next=o),f.pending=o,$n(i,u)}return p=f.interleaved,p===null?(o.next=o,Oc(f)):(o.next=p.next,p.next=o),f.interleaved=o,$n(i,u)}function ta(i,o,u){if(o=o.updateQueue,o!==null&&(o=o.shared,(u&4194240)!==0)){var f=o.lanes;f&=i.pendingLanes,u|=f,o.lanes=u,Wh(i,u)}}function iy(i,o){var u=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var p=null,g=null;if(u=u.firstBaseUpdate,u!==null){do{var w={eventTime:u.eventTime,lane:u.lane,tag:u.tag,payload:u.payload,callback:u.callback,next:null};g===null?p=g=w:g=g.next=w,u=u.next}while(u!==null);g===null?p=g=o:g=g.next=o}else p=g=o;u={baseState:f.baseState,firstBaseUpdate:p,lastBaseUpdate:g,shared:f.shared,effects:f.effects},i.updateQueue=u;return}i=u.lastBaseUpdate,i===null?u.firstBaseUpdate=o:i.next=o,u.lastBaseUpdate=o}function na(i,o,u,f){var p=i.updateQueue;wi=!1;var g=p.firstBaseUpdate,w=p.lastBaseUpdate,C=p.shared.pending;if(C!==null){p.shared.pending=null;var b=C,P=b.next;b.next=null,w===null?g=P:w.next=P,w=b;var V=i.alternate;V!==null&&(V=V.updateQueue,C=V.lastBaseUpdate,C!==w&&(C===null?V.firstBaseUpdate=P:C.next=P,V.lastBaseUpdate=b))}if(g!==null){var W=p.baseState;w=0,V=P=b=null,C=g;do{var j=C.lane,Z=C.eventTime;if((f&j)===j){V!==null&&(V=V.next={eventTime:Z,lane:0,tag:C.tag,payload:C.payload,callback:C.callback,next:null});e:{var ie=i,re=C;switch(j=o,Z=u,re.tag){case 1:if(ie=re.payload,typeof ie=="function"){W=ie.call(Z,W,j);break e}W=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=re.payload,j=typeof ie=="function"?ie.call(Z,W,j):ie,j==null)break e;W=J({},W,j);break e;case 2:wi=!0}}C.callback!==null&&C.lane!==0&&(i.flags|=64,j=p.effects,j===null?p.effects=[C]:j.push(C))}else Z={eventTime:Z,lane:j,tag:C.tag,payload:C.payload,callback:C.callback,next:null},V===null?(P=V=Z,b=W):V=V.next=Z,w|=j;if(C=C.next,C===null){if(C=p.shared.pending,C===null)break;j=C,C=j.next,j.next=null,p.lastBaseUpdate=j,p.shared.pending=null}}while(!0);if(V===null&&(b=W),p.baseState=b,p.firstBaseUpdate=P,p.lastBaseUpdate=V,o=p.shared.interleaved,o!==null){p=o;do w|=p.lane,p=p.next;while(p!==o)}else g===null&&(p.shared.lanes=0);Gi|=w,i.lanes=w,i.memoizedState=W}}function ry(i,o,u){if(i=o.effects,o.effects=null,i!==null)for(o=0;o<i.length;o++){var f=i[o],p=f.callback;if(p!==null){if(f.callback=null,f=u,typeof p!="function")throw Error(t(191,p));p.call(f)}}}var Ys={},Dn=gi(Ys),Xs=gi(Ys),Js=gi(Ys);function Ki(i){if(i===Ys)throw Error(t(174));return i}function Pc(i,o){switch(Ie(Js,o),Ie(Xs,i),Ie(Dn,Ys),i=o.nodeType,i){case 9:case 11:o=(o=o.documentElement)?o.namespaceURI:Rh(null,"");break;default:i=i===8?o.parentNode:o,o=i.namespaceURI||null,i=i.tagName,o=Rh(o,i)}_e(Dn),Ie(Dn,o)}function _r(){_e(Dn),_e(Xs),_e(Js)}function sy(i){Ki(Js.current);var o=Ki(Dn.current),u=Rh(o,i.type);o!==u&&(Ie(Xs,i),Ie(Dn,u))}function Rc(i){Xs.current===i&&(_e(Dn),_e(Xs))}var He=gi(0);function ia(i){for(var o=i;o!==null;){if(o.tag===13){var u=o.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||u.data==="$!"))return o}else if(o.tag===19&&o.memoizedProps.revealOrder!==void 0){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Dc=[];function Lc(){for(var i=0;i<Dc.length;i++)Dc[i]._workInProgressVersionPrimary=null;Dc.length=0}var ra=_.ReactCurrentDispatcher,Nc=_.ReactCurrentBatchConfig,Qi=0,We=null,tt=null,rt=null,sa=!1,Zs=!1,eo=0,Mb=0;function yt(){throw Error(t(321))}function Bc(i,o){if(o===null)return!1;for(var u=0;u<o.length&&u<i.length;u++)if(!cn(i[u],o[u]))return!1;return!0}function Ic(i,o,u,f,p,g){if(Qi=g,We=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,ra.current=i===null||i.memoizedState===null?Rb:Db,i=u(f,p),Zs){g=0;do{if(Zs=!1,eo=0,25<=g)throw Error(t(301));g+=1,rt=tt=null,o.updateQueue=null,ra.current=Lb,i=u(f,p)}while(Zs)}if(ra.current=aa,o=tt!==null&&tt.next!==null,Qi=0,rt=tt=We=null,sa=!1,o)throw Error(t(300));return i}function zc(){var i=eo!==0;return eo=0,i}function Ln(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?We.memoizedState=rt=i:rt=rt.next=i,rt}function Zt(){if(tt===null){var i=We.alternate;i=i!==null?i.memoizedState:null}else i=tt.next;var o=rt===null?We.memoizedState:rt.next;if(o!==null)rt=o,tt=i;else{if(i===null)throw Error(t(310));tt=i,i={memoizedState:tt.memoizedState,baseState:tt.baseState,baseQueue:tt.baseQueue,queue:tt.queue,next:null},rt===null?We.memoizedState=rt=i:rt=rt.next=i}return rt}function to(i,o){return typeof o=="function"?o(i):o}function Fc(i){var o=Zt(),u=o.queue;if(u===null)throw Error(t(311));u.lastRenderedReducer=i;var f=tt,p=f.baseQueue,g=u.pending;if(g!==null){if(p!==null){var w=p.next;p.next=g.next,g.next=w}f.baseQueue=p=g,u.pending=null}if(p!==null){g=p.next,f=f.baseState;var C=w=null,b=null,P=g;do{var V=P.lane;if((Qi&V)===V)b!==null&&(b=b.next={lane:0,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null}),f=P.hasEagerState?P.eagerState:i(f,P.action);else{var W={lane:V,action:P.action,hasEagerState:P.hasEagerState,eagerState:P.eagerState,next:null};b===null?(C=b=W,w=f):b=b.next=W,We.lanes|=V,Gi|=V}P=P.next}while(P!==null&&P!==g);b===null?w=f:b.next=C,cn(f,o.memoizedState)||(Lt=!0),o.memoizedState=f,o.baseState=w,o.baseQueue=b,u.lastRenderedState=f}if(i=u.interleaved,i!==null){p=i;do g=p.lane,We.lanes|=g,Gi|=g,p=p.next;while(p!==i)}else p===null&&(u.lanes=0);return[o.memoizedState,u.dispatch]}function _c(i){var o=Zt(),u=o.queue;if(u===null)throw Error(t(311));u.lastRenderedReducer=i;var f=u.dispatch,p=u.pending,g=o.memoizedState;if(p!==null){u.pending=null;var w=p=p.next;do g=i(g,w.action),w=w.next;while(w!==p);cn(g,o.memoizedState)||(Lt=!0),o.memoizedState=g,o.baseQueue===null&&(o.baseState=g),u.lastRenderedState=g}return[g,f]}function oy(){}function ly(i,o){var u=We,f=Zt(),p=o(),g=!cn(f.memoizedState,p);if(g&&(f.memoizedState=p,Lt=!0),f=f.queue,jc(hy.bind(null,u,f,i),[i]),f.getSnapshot!==o||g||rt!==null&&rt.memoizedState.tag&1){if(u.flags|=2048,no(9,uy.bind(null,u,f,p,o),void 0,null),st===null)throw Error(t(349));(Qi&30)!==0||ay(u,o,p)}return p}function ay(i,o,u){i.flags|=16384,i={getSnapshot:o,value:u},o=We.updateQueue,o===null?(o={lastEffect:null,stores:null},We.updateQueue=o,o.stores=[i]):(u=o.stores,u===null?o.stores=[i]:u.push(i))}function uy(i,o,u,f){o.value=u,o.getSnapshot=f,cy(o)&&fy(i)}function hy(i,o,u){return u(function(){cy(o)&&fy(i)})}function cy(i){var o=i.getSnapshot;i=i.value;try{var u=o();return!cn(i,u)}catch{return!0}}function fy(i){var o=$n(i,1);o!==null&&gn(o,i,1,-1)}function dy(i){var o=Ln();return typeof i=="function"&&(i=i()),o.memoizedState=o.baseState=i,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:to,lastRenderedState:i},o.queue=i,i=i.dispatch=Pb.bind(null,We,i),[o.memoizedState,i]}function no(i,o,u,f){return i={tag:i,create:o,destroy:u,deps:f,next:null},o=We.updateQueue,o===null?(o={lastEffect:null,stores:null},We.updateQueue=o,o.lastEffect=i.next=i):(u=o.lastEffect,u===null?o.lastEffect=i.next=i:(f=u.next,u.next=i,i.next=f,o.lastEffect=i)),i}function py(){return Zt().memoizedState}function oa(i,o,u,f){var p=Ln();We.flags|=i,p.memoizedState=no(1|o,u,void 0,f===void 0?null:f)}function la(i,o,u,f){var p=Zt();f=f===void 0?null:f;var g=void 0;if(tt!==null){var w=tt.memoizedState;if(g=w.destroy,f!==null&&Bc(f,w.deps)){p.memoizedState=no(o,u,g,f);return}}We.flags|=i,p.memoizedState=no(1|o,u,g,f)}function my(i,o){return oa(8390656,8,i,o)}function jc(i,o){return la(2048,8,i,o)}function gy(i,o){return la(4,2,i,o)}function yy(i,o){return la(4,4,i,o)}function vy(i,o){if(typeof o=="function")return i=i(),o(i),function(){o(null)};if(o!=null)return i=i(),o.current=i,function(){o.current=null}}function wy(i,o,u){return u=u!=null?u.concat([i]):null,la(4,4,vy.bind(null,o,i),u)}function Vc(){}function ky(i,o){var u=Zt();o=o===void 0?null:o;var f=u.memoizedState;return f!==null&&o!==null&&Bc(o,f[1])?f[0]:(u.memoizedState=[i,o],i)}function xy(i,o){var u=Zt();o=o===void 0?null:o;var f=u.memoizedState;return f!==null&&o!==null&&Bc(o,f[1])?f[0]:(i=i(),u.memoizedState=[i,o],i)}function Sy(i,o,u){return(Qi&21)===0?(i.baseState&&(i.baseState=!1,Lt=!0),i.memoizedState=u):(cn(u,o)||(u=Jg(),We.lanes|=u,Gi|=u,i.baseState=!0),o)}function Ob(i,o){var u=De;De=u!==0&&4>u?u:4,i(!0);var f=Nc.transition;Nc.transition={};try{i(!1),o()}finally{De=u,Nc.transition=f}}function Cy(){return Zt().memoizedState}function Eb(i,o,u){var f=bi(i);if(u={lane:f,action:u,hasEagerState:!1,eagerState:null,next:null},by(i))Ay(o,u);else if(u=ty(i,o,u,f),u!==null){var p=Ct();gn(u,i,f,p),Ty(u,o,f)}}function Pb(i,o,u){var f=bi(i),p={lane:f,action:u,hasEagerState:!1,eagerState:null,next:null};if(by(i))Ay(o,p);else{var g=i.alternate;if(i.lanes===0&&(g===null||g.lanes===0)&&(g=o.lastRenderedReducer,g!==null))try{var w=o.lastRenderedState,C=g(w,u);if(p.hasEagerState=!0,p.eagerState=C,cn(C,w)){var b=o.interleaved;b===null?(p.next=p,Oc(o)):(p.next=b.next,b.next=p),o.interleaved=p;return}}catch{}u=ty(i,o,p,f),u!==null&&(p=Ct(),gn(u,i,f,p),Ty(u,o,f))}}function by(i){var o=i.alternate;return i===We||o!==null&&o===We}function Ay(i,o){Zs=sa=!0;var u=i.pending;u===null?o.next=o:(o.next=u.next,u.next=o),i.pending=o}function Ty(i,o,u){if((u&4194240)!==0){var f=o.lanes;f&=i.pendingLanes,u|=f,o.lanes=u,Wh(i,u)}}var aa={readContext:Jt,useCallback:yt,useContext:yt,useEffect:yt,useImperativeHandle:yt,useInsertionEffect:yt,useLayoutEffect:yt,useMemo:yt,useReducer:yt,useRef:yt,useState:yt,useDebugValue:yt,useDeferredValue:yt,useTransition:yt,useMutableSource:yt,useSyncExternalStore:yt,useId:yt,unstable_isNewReconciler:!1},Rb={readContext:Jt,useCallback:function(i,o){return Ln().memoizedState=[i,o===void 0?null:o],i},useContext:Jt,useEffect:my,useImperativeHandle:function(i,o,u){return u=u!=null?u.concat([i]):null,oa(4194308,4,vy.bind(null,o,i),u)},useLayoutEffect:function(i,o){return oa(4194308,4,i,o)},useInsertionEffect:function(i,o){return oa(4,2,i,o)},useMemo:function(i,o){var u=Ln();return o=o===void 0?null:o,i=i(),u.memoizedState=[i,o],i},useReducer:function(i,o,u){var f=Ln();return o=u!==void 0?u(o):o,f.memoizedState=f.baseState=o,i={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:o},f.queue=i,i=i.dispatch=Eb.bind(null,We,i),[f.memoizedState,i]},useRef:function(i){var o=Ln();return i={current:i},o.memoizedState=i},useState:dy,useDebugValue:Vc,useDeferredValue:function(i){return Ln().memoizedState=i},useTransition:function(){var i=dy(!1),o=i[0];return i=Ob.bind(null,i[1]),Ln().memoizedState=i,[o,i]},useMutableSource:function(){},useSyncExternalStore:function(i,o,u){var f=We,p=Ln();if(Ve){if(u===void 0)throw Error(t(407));u=u()}else{if(u=o(),st===null)throw Error(t(349));(Qi&30)!==0||ay(f,o,u)}p.memoizedState=u;var g={value:u,getSnapshot:o};return p.queue=g,my(hy.bind(null,f,g,i),[i]),f.flags|=2048,no(9,uy.bind(null,f,g,u,o),void 0,null),u},useId:function(){var i=Ln(),o=st.identifierPrefix;if(Ve){var u=Un,f=Wn;u=(f&~(1<<32-hn(f)-1)).toString(32)+u,o=":"+o+"R"+u,u=eo++,0<u&&(o+="H"+u.toString(32)),o+=":"}else u=Mb++,o=":"+o+"r"+u.toString(32)+":";return i.memoizedState=o},unstable_isNewReconciler:!1},Db={readContext:Jt,useCallback:ky,useContext:Jt,useEffect:jc,useImperativeHandle:wy,useInsertionEffect:gy,useLayoutEffect:yy,useMemo:xy,useReducer:Fc,useRef:py,useState:function(){return Fc(to)},useDebugValue:Vc,useDeferredValue:function(i){var o=Zt();return Sy(o,tt.memoizedState,i)},useTransition:function(){var i=Fc(to)[0],o=Zt().memoizedState;return[i,o]},useMutableSource:oy,useSyncExternalStore:ly,useId:Cy,unstable_isNewReconciler:!1},Lb={readContext:Jt,useCallback:ky,useContext:Jt,useEffect:jc,useImperativeHandle:wy,useInsertionEffect:gy,useLayoutEffect:yy,useMemo:xy,useReducer:_c,useRef:py,useState:function(){return _c(to)},useDebugValue:Vc,useDeferredValue:function(i){var o=Zt();return tt===null?o.memoizedState=i:Sy(o,tt.memoizedState,i)},useTransition:function(){var i=_c(to)[0],o=Zt().memoizedState;return[i,o]},useMutableSource:oy,useSyncExternalStore:ly,useId:Cy,unstable_isNewReconciler:!1};function dn(i,o){if(i&&i.defaultProps){o=J({},o),i=i.defaultProps;for(var u in i)o[u]===void 0&&(o[u]=i[u]);return o}return o}function Hc(i,o,u,f){o=i.memoizedState,u=u(f,o),u=u==null?o:J({},o,u),i.memoizedState=u,i.lanes===0&&(i.updateQueue.baseState=u)}var ua={isMounted:function(i){return(i=i._reactInternals)?ji(i)===i:!1},enqueueSetState:function(i,o,u){i=i._reactInternals;var f=Ct(),p=bi(i),g=Kn(f,p);g.payload=o,u!=null&&(g.callback=u),o=ki(i,g,p),o!==null&&(gn(o,i,p,f),ta(o,i,p))},enqueueReplaceState:function(i,o,u){i=i._reactInternals;var f=Ct(),p=bi(i),g=Kn(f,p);g.tag=1,g.payload=o,u!=null&&(g.callback=u),o=ki(i,g,p),o!==null&&(gn(o,i,p,f),ta(o,i,p))},enqueueForceUpdate:function(i,o){i=i._reactInternals;var u=Ct(),f=bi(i),p=Kn(u,f);p.tag=2,o!=null&&(p.callback=o),o=ki(i,p,f),o!==null&&(gn(o,i,f,u),ta(o,i,f))}};function My(i,o,u,f,p,g,w){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,g,w):o.prototype&&o.prototype.isPureReactComponent?!Hs(u,f)||!Hs(p,g):!0}function Oy(i,o,u){var f=!1,p=yi,g=o.contextType;return typeof g=="object"&&g!==null?g=Jt(g):(p=Dt(o)?Hi:gt.current,f=o.contextTypes,g=(f=f!=null)?Dr(i,p):yi),o=new o(u,g),i.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,o.updater=ua,i.stateNode=o,o._reactInternals=i,f&&(i=i.stateNode,i.__reactInternalMemoizedUnmaskedChildContext=p,i.__reactInternalMemoizedMaskedChildContext=g),o}function Ey(i,o,u,f){i=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(u,f),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(u,f),o.state!==i&&ua.enqueueReplaceState(o,o.state,null)}function Wc(i,o,u,f){var p=i.stateNode;p.props=u,p.state=i.memoizedState,p.refs={},Ec(i);var g=o.contextType;typeof g=="object"&&g!==null?p.context=Jt(g):(g=Dt(o)?Hi:gt.current,p.context=Dr(i,g)),p.state=i.memoizedState,g=o.getDerivedStateFromProps,typeof g=="function"&&(Hc(i,o,g,u),p.state=i.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof p.getSnapshotBeforeUpdate=="function"||typeof p.UNSAFE_componentWillMount!="function"&&typeof p.componentWillMount!="function"||(o=p.state,typeof p.componentWillMount=="function"&&p.componentWillMount(),typeof p.UNSAFE_componentWillMount=="function"&&p.UNSAFE_componentWillMount(),o!==p.state&&ua.enqueueReplaceState(p,p.state,null),na(i,u,p,f),p.state=i.memoizedState),typeof p.componentDidMount=="function"&&(i.flags|=4194308)}function jr(i,o){try{var u="",f=o;do u+=X(f),f=f.return;while(f);var p=u}catch(g){p=`
7
+ Error generating stack: `+g.message+`
8
+ `+g.stack}return{value:i,source:o,stack:p,digest:null}}function Uc(i,o,u){return{value:i,source:null,stack:u??null,digest:o??null}}function $c(i,o){try{console.error(o.value)}catch(u){setTimeout(function(){throw u})}}var Nb=typeof WeakMap=="function"?WeakMap:Map;function Py(i,o,u){u=Kn(-1,u),u.tag=3,u.payload={element:null};var f=o.value;return u.callback=function(){ga||(ga=!0,lf=f),$c(i,o)},u}function Ry(i,o,u){u=Kn(-1,u),u.tag=3;var f=i.type.getDerivedStateFromError;if(typeof f=="function"){var p=o.value;u.payload=function(){return f(p)},u.callback=function(){$c(i,o)}}var g=i.stateNode;return g!==null&&typeof g.componentDidCatch=="function"&&(u.callback=function(){$c(i,o),typeof f!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var w=o.stack;this.componentDidCatch(o.value,{componentStack:w!==null?w:""})}),u}function Dy(i,o,u){var f=i.pingCache;if(f===null){f=i.pingCache=new Nb;var p=new Set;f.set(o,p)}else p=f.get(o),p===void 0&&(p=new Set,f.set(o,p));p.has(u)||(p.add(u),i=Gb.bind(null,i,o,u),o.then(i,i))}function Ly(i){do{var o;if((o=i.tag===13)&&(o=i.memoizedState,o=o!==null?o.dehydrated!==null:!0),o)return i;i=i.return}while(i!==null);return null}function Ny(i,o,u,f,p){return(i.mode&1)===0?(i===o?i.flags|=65536:(i.flags|=128,u.flags|=131072,u.flags&=-52805,u.tag===1&&(u.alternate===null?u.tag=17:(o=Kn(-1,1),o.tag=2,ki(u,o,1))),u.lanes|=1),i):(i.flags|=65536,i.lanes=p,i)}var Bb=_.ReactCurrentOwner,Lt=!1;function St(i,o,u,f){o.child=i===null?ey(o,null,u,f):Ir(o,i.child,u,f)}function By(i,o,u,f,p){u=u.render;var g=o.ref;return Fr(o,p),f=Ic(i,o,u,f,g,p),u=zc(),i!==null&&!Lt?(o.updateQueue=i.updateQueue,o.flags&=-2053,i.lanes&=~p,Qn(i,o,p)):(Ve&&u&&wc(o),o.flags|=1,St(i,o,f,p),o.child)}function Iy(i,o,u,f,p){if(i===null){var g=u.type;return typeof g=="function"&&!pf(g)&&g.defaultProps===void 0&&u.compare===null&&u.defaultProps===void 0?(o.tag=15,o.type=g,zy(i,o,g,f,p)):(i=Sa(u.type,null,f,o,o.mode,p),i.ref=o.ref,i.return=o,o.child=i)}if(g=i.child,(i.lanes&p)===0){var w=g.memoizedProps;if(u=u.compare,u=u!==null?u:Hs,u(w,f)&&i.ref===o.ref)return Qn(i,o,p)}return o.flags|=1,i=Ti(g,f),i.ref=o.ref,i.return=o,o.child=i}function zy(i,o,u,f,p){if(i!==null){var g=i.memoizedProps;if(Hs(g,f)&&i.ref===o.ref)if(Lt=!1,o.pendingProps=f=g,(i.lanes&p)!==0)(i.flags&131072)!==0&&(Lt=!0);else return o.lanes=i.lanes,Qn(i,o,p)}return Kc(i,o,u,f,p)}function Fy(i,o,u){var f=o.pendingProps,p=f.children,g=i!==null?i.memoizedState:null;if(f.mode==="hidden")if((o.mode&1)===0)o.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ie(Hr,Vt),Vt|=u;else{if((u&1073741824)===0)return i=g!==null?g.baseLanes|u:u,o.lanes=o.childLanes=1073741824,o.memoizedState={baseLanes:i,cachePool:null,transitions:null},o.updateQueue=null,Ie(Hr,Vt),Vt|=i,null;o.memoizedState={baseLanes:0,cachePool:null,transitions:null},f=g!==null?g.baseLanes:u,Ie(Hr,Vt),Vt|=f}else g!==null?(f=g.baseLanes|u,o.memoizedState=null):f=u,Ie(Hr,Vt),Vt|=f;return St(i,o,p,u),o.child}function _y(i,o){var u=o.ref;(i===null&&u!==null||i!==null&&i.ref!==u)&&(o.flags|=512,o.flags|=2097152)}function Kc(i,o,u,f,p){var g=Dt(u)?Hi:gt.current;return g=Dr(o,g),Fr(o,p),u=Ic(i,o,u,f,g,p),f=zc(),i!==null&&!Lt?(o.updateQueue=i.updateQueue,o.flags&=-2053,i.lanes&=~p,Qn(i,o,p)):(Ve&&f&&wc(o),o.flags|=1,St(i,o,u,p),o.child)}function jy(i,o,u,f,p){if(Dt(u)){var g=!0;Ql(o)}else g=!1;if(Fr(o,p),o.stateNode===null)ca(i,o),Oy(o,u,f),Wc(o,u,f,p),f=!0;else if(i===null){var w=o.stateNode,C=o.memoizedProps;w.props=C;var b=w.context,P=u.contextType;typeof P=="object"&&P!==null?P=Jt(P):(P=Dt(u)?Hi:gt.current,P=Dr(o,P));var V=u.getDerivedStateFromProps,W=typeof V=="function"||typeof w.getSnapshotBeforeUpdate=="function";W||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(C!==f||b!==P)&&Ey(o,w,f,P),wi=!1;var j=o.memoizedState;w.state=j,na(o,f,w,p),b=o.memoizedState,C!==f||j!==b||Rt.current||wi?(typeof V=="function"&&(Hc(o,u,V,f),b=o.memoizedState),(C=wi||My(o,u,C,f,j,b,P))?(W||typeof w.UNSAFE_componentWillMount!="function"&&typeof w.componentWillMount!="function"||(typeof w.componentWillMount=="function"&&w.componentWillMount(),typeof w.UNSAFE_componentWillMount=="function"&&w.UNSAFE_componentWillMount()),typeof w.componentDidMount=="function"&&(o.flags|=4194308)):(typeof w.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=f,o.memoizedState=b),w.props=f,w.state=b,w.context=P,f=C):(typeof w.componentDidMount=="function"&&(o.flags|=4194308),f=!1)}else{w=o.stateNode,ny(i,o),C=o.memoizedProps,P=o.type===o.elementType?C:dn(o.type,C),w.props=P,W=o.pendingProps,j=w.context,b=u.contextType,typeof b=="object"&&b!==null?b=Jt(b):(b=Dt(u)?Hi:gt.current,b=Dr(o,b));var Z=u.getDerivedStateFromProps;(V=typeof Z=="function"||typeof w.getSnapshotBeforeUpdate=="function")||typeof w.UNSAFE_componentWillReceiveProps!="function"&&typeof w.componentWillReceiveProps!="function"||(C!==W||j!==b)&&Ey(o,w,f,b),wi=!1,j=o.memoizedState,w.state=j,na(o,f,w,p);var ie=o.memoizedState;C!==W||j!==ie||Rt.current||wi?(typeof Z=="function"&&(Hc(o,u,Z,f),ie=o.memoizedState),(P=wi||My(o,u,P,f,j,ie,b)||!1)?(V||typeof w.UNSAFE_componentWillUpdate!="function"&&typeof w.componentWillUpdate!="function"||(typeof w.componentWillUpdate=="function"&&w.componentWillUpdate(f,ie,b),typeof w.UNSAFE_componentWillUpdate=="function"&&w.UNSAFE_componentWillUpdate(f,ie,b)),typeof w.componentDidUpdate=="function"&&(o.flags|=4),typeof w.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof w.componentDidUpdate!="function"||C===i.memoizedProps&&j===i.memoizedState||(o.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||C===i.memoizedProps&&j===i.memoizedState||(o.flags|=1024),o.memoizedProps=f,o.memoizedState=ie),w.props=f,w.state=ie,w.context=b,f=P):(typeof w.componentDidUpdate!="function"||C===i.memoizedProps&&j===i.memoizedState||(o.flags|=4),typeof w.getSnapshotBeforeUpdate!="function"||C===i.memoizedProps&&j===i.memoizedState||(o.flags|=1024),f=!1)}return Qc(i,o,u,f,g,p)}function Qc(i,o,u,f,p,g){_y(i,o);var w=(o.flags&128)!==0;if(!f&&!w)return p&&$0(o,u,!1),Qn(i,o,g);f=o.stateNode,Bb.current=o;var C=w&&typeof u.getDerivedStateFromError!="function"?null:f.render();return o.flags|=1,i!==null&&w?(o.child=Ir(o,i.child,null,g),o.child=Ir(o,null,C,g)):St(i,o,C,g),o.memoizedState=f.state,p&&$0(o,u,!0),o.child}function Vy(i){var o=i.stateNode;o.pendingContext?W0(i,o.pendingContext,o.pendingContext!==o.context):o.context&&W0(i,o.context,!1),Pc(i,o.containerInfo)}function Hy(i,o,u,f,p){return Br(),Cc(p),o.flags|=256,St(i,o,u,f),o.child}var Gc={dehydrated:null,treeContext:null,retryLane:0};function qc(i){return{baseLanes:i,cachePool:null,transitions:null}}function Wy(i,o,u){var f=o.pendingProps,p=He.current,g=!1,w=(o.flags&128)!==0,C;if((C=w)||(C=i!==null&&i.memoizedState===null?!1:(p&2)!==0),C?(g=!0,o.flags&=-129):(i===null||i.memoizedState!==null)&&(p|=1),Ie(He,p&1),i===null)return Sc(o),i=o.memoizedState,i!==null&&(i=i.dehydrated,i!==null)?((o.mode&1)===0?o.lanes=1:i.data==="$!"?o.lanes=8:o.lanes=1073741824,null):(w=f.children,i=f.fallback,g?(f=o.mode,g=o.child,w={mode:"hidden",children:w},(f&1)===0&&g!==null?(g.childLanes=0,g.pendingProps=w):g=Ca(w,f,0,null),i=Ji(i,f,u,null),g.return=o,i.return=o,g.sibling=i,o.child=g,o.child.memoizedState=qc(u),o.memoizedState=Gc,i):Yc(o,w));if(p=i.memoizedState,p!==null&&(C=p.dehydrated,C!==null))return Ib(i,o,w,f,C,p,u);if(g){g=f.fallback,w=o.mode,p=i.child,C=p.sibling;var b={mode:"hidden",children:f.children};return(w&1)===0&&o.child!==p?(f=o.child,f.childLanes=0,f.pendingProps=b,o.deletions=null):(f=Ti(p,b),f.subtreeFlags=p.subtreeFlags&14680064),C!==null?g=Ti(C,g):(g=Ji(g,w,u,null),g.flags|=2),g.return=o,f.return=o,f.sibling=g,o.child=f,f=g,g=o.child,w=i.child.memoizedState,w=w===null?qc(u):{baseLanes:w.baseLanes|u,cachePool:null,transitions:w.transitions},g.memoizedState=w,g.childLanes=i.childLanes&~u,o.memoizedState=Gc,f}return g=i.child,i=g.sibling,f=Ti(g,{mode:"visible",children:f.children}),(o.mode&1)===0&&(f.lanes=u),f.return=o,f.sibling=null,i!==null&&(u=o.deletions,u===null?(o.deletions=[i],o.flags|=16):u.push(i)),o.child=f,o.memoizedState=null,f}function Yc(i,o){return o=Ca({mode:"visible",children:o},i.mode,0,null),o.return=i,i.child=o}function ha(i,o,u,f){return f!==null&&Cc(f),Ir(o,i.child,null,u),i=Yc(o,o.pendingProps.children),i.flags|=2,o.memoizedState=null,i}function Ib(i,o,u,f,p,g,w){if(u)return o.flags&256?(o.flags&=-257,f=Uc(Error(t(422))),ha(i,o,w,f)):o.memoizedState!==null?(o.child=i.child,o.flags|=128,null):(g=f.fallback,p=o.mode,f=Ca({mode:"visible",children:f.children},p,0,null),g=Ji(g,p,w,null),g.flags|=2,f.return=o,g.return=o,f.sibling=g,o.child=f,(o.mode&1)!==0&&Ir(o,i.child,null,w),o.child.memoizedState=qc(w),o.memoizedState=Gc,g);if((o.mode&1)===0)return ha(i,o,w,null);if(p.data==="$!"){if(f=p.nextSibling&&p.nextSibling.dataset,f)var C=f.dgst;return f=C,g=Error(t(419)),f=Uc(g,f,void 0),ha(i,o,w,f)}if(C=(w&i.childLanes)!==0,Lt||C){if(f=st,f!==null){switch(w&-w){case 4:p=2;break;case 16:p=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:p=32;break;case 536870912:p=268435456;break;default:p=0}p=(p&(f.suspendedLanes|w))!==0?0:p,p!==0&&p!==g.retryLane&&(g.retryLane=p,$n(i,p),gn(f,i,p,-1))}return df(),f=Uc(Error(t(421))),ha(i,o,w,f)}return p.data==="$?"?(o.flags|=128,o.child=i.child,o=qb.bind(null,i),p._reactRetry=o,null):(i=g.treeContext,jt=mi(p.nextSibling),_t=o,Ve=!0,fn=null,i!==null&&(Yt[Xt++]=Wn,Yt[Xt++]=Un,Yt[Xt++]=Wi,Wn=i.id,Un=i.overflow,Wi=o),o=Yc(o,f.children),o.flags|=4096,o)}function Uy(i,o,u){i.lanes|=o;var f=i.alternate;f!==null&&(f.lanes|=o),Mc(i.return,o,u)}function Xc(i,o,u,f,p){var g=i.memoizedState;g===null?i.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:p}:(g.isBackwards=o,g.rendering=null,g.renderingStartTime=0,g.last=f,g.tail=u,g.tailMode=p)}function $y(i,o,u){var f=o.pendingProps,p=f.revealOrder,g=f.tail;if(St(i,o,f.children,u),f=He.current,(f&2)!==0)f=f&1|2,o.flags|=128;else{if(i!==null&&(i.flags&128)!==0)e:for(i=o.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&Uy(i,u,o);else if(i.tag===19)Uy(i,u,o);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===o)break e;for(;i.sibling===null;){if(i.return===null||i.return===o)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}f&=1}if(Ie(He,f),(o.mode&1)===0)o.memoizedState=null;else switch(p){case"forwards":for(u=o.child,p=null;u!==null;)i=u.alternate,i!==null&&ia(i)===null&&(p=u),u=u.sibling;u=p,u===null?(p=o.child,o.child=null):(p=u.sibling,u.sibling=null),Xc(o,!1,p,u,g);break;case"backwards":for(u=null,p=o.child,o.child=null;p!==null;){if(i=p.alternate,i!==null&&ia(i)===null){o.child=p;break}i=p.sibling,p.sibling=u,u=p,p=i}Xc(o,!0,u,null,g);break;case"together":Xc(o,!1,null,null,void 0);break;default:o.memoizedState=null}return o.child}function ca(i,o){(o.mode&1)===0&&i!==null&&(i.alternate=null,o.alternate=null,o.flags|=2)}function Qn(i,o,u){if(i!==null&&(o.dependencies=i.dependencies),Gi|=o.lanes,(u&o.childLanes)===0)return null;if(i!==null&&o.child!==i.child)throw Error(t(153));if(o.child!==null){for(i=o.child,u=Ti(i,i.pendingProps),o.child=u,u.return=o;i.sibling!==null;)i=i.sibling,u=u.sibling=Ti(i,i.pendingProps),u.return=o;u.sibling=null}return o.child}function zb(i,o,u){switch(o.tag){case 3:Vy(o),Br();break;case 5:sy(o);break;case 1:Dt(o.type)&&Ql(o);break;case 4:Pc(o,o.stateNode.containerInfo);break;case 10:var f=o.type._context,p=o.memoizedProps.value;Ie(Zl,f._currentValue),f._currentValue=p;break;case 13:if(f=o.memoizedState,f!==null)return f.dehydrated!==null?(Ie(He,He.current&1),o.flags|=128,null):(u&o.child.childLanes)!==0?Wy(i,o,u):(Ie(He,He.current&1),i=Qn(i,o,u),i!==null?i.sibling:null);Ie(He,He.current&1);break;case 19:if(f=(u&o.childLanes)!==0,(i.flags&128)!==0){if(f)return $y(i,o,u);o.flags|=128}if(p=o.memoizedState,p!==null&&(p.rendering=null,p.tail=null,p.lastEffect=null),Ie(He,He.current),f)break;return null;case 22:case 23:return o.lanes=0,Fy(i,o,u)}return Qn(i,o,u)}var Ky,Jc,Qy,Gy;Ky=function(i,o){for(var u=o.child;u!==null;){if(u.tag===5||u.tag===6)i.appendChild(u.stateNode);else if(u.tag!==4&&u.child!==null){u.child.return=u,u=u.child;continue}if(u===o)break;for(;u.sibling===null;){if(u.return===null||u.return===o)return;u=u.return}u.sibling.return=u.return,u=u.sibling}},Jc=function(){},Qy=function(i,o,u,f){var p=i.memoizedProps;if(p!==f){i=o.stateNode,Ki(Dn.current);var g=null;switch(u){case"input":p=_i(i,p),f=_i(i,f),g=[];break;case"select":p=J({},p,{value:void 0}),f=J({},f,{value:void 0}),g=[];break;case"textarea":p=Ph(i,p),f=Ph(i,f),g=[];break;default:typeof p.onClick!="function"&&typeof f.onClick=="function"&&(i.onclick=Ul)}Dh(u,f);var w;u=null;for(P in p)if(!f.hasOwnProperty(P)&&p.hasOwnProperty(P)&&p[P]!=null)if(P==="style"){var C=p[P];for(w in C)C.hasOwnProperty(w)&&(u||(u={}),u[w]="")}else P!=="dangerouslySetInnerHTML"&&P!=="children"&&P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&P!=="autoFocus"&&(r.hasOwnProperty(P)?g||(g=[]):(g=g||[]).push(P,null));for(P in f){var b=f[P];if(C=p?.[P],f.hasOwnProperty(P)&&b!==C&&(b!=null||C!=null))if(P==="style")if(C){for(w in C)!C.hasOwnProperty(w)||b&&b.hasOwnProperty(w)||(u||(u={}),u[w]="");for(w in b)b.hasOwnProperty(w)&&C[w]!==b[w]&&(u||(u={}),u[w]=b[w])}else u||(g||(g=[]),g.push(P,u)),u=b;else P==="dangerouslySetInnerHTML"?(b=b?b.__html:void 0,C=C?C.__html:void 0,b!=null&&C!==b&&(g=g||[]).push(P,b)):P==="children"?typeof b!="string"&&typeof b!="number"||(g=g||[]).push(P,""+b):P!=="suppressContentEditableWarning"&&P!=="suppressHydrationWarning"&&(r.hasOwnProperty(P)?(b!=null&&P==="onScroll"&&Fe("scroll",i),g||C===b||(g=[])):(g=g||[]).push(P,b))}u&&(g=g||[]).push("style",u);var P=g;(o.updateQueue=P)&&(o.flags|=4)}},Gy=function(i,o,u,f){u!==f&&(o.flags|=4)};function io(i,o){if(!Ve)switch(i.tailMode){case"hidden":o=i.tail;for(var u=null;o!==null;)o.alternate!==null&&(u=o),o=o.sibling;u===null?i.tail=null:u.sibling=null;break;case"collapsed":u=i.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?o||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function vt(i){var o=i.alternate!==null&&i.alternate.child===i.child,u=0,f=0;if(o)for(var p=i.child;p!==null;)u|=p.lanes|p.childLanes,f|=p.subtreeFlags&14680064,f|=p.flags&14680064,p.return=i,p=p.sibling;else for(p=i.child;p!==null;)u|=p.lanes|p.childLanes,f|=p.subtreeFlags,f|=p.flags,p.return=i,p=p.sibling;return i.subtreeFlags|=f,i.childLanes=u,o}function Fb(i,o,u){var f=o.pendingProps;switch(kc(o),o.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return vt(o),null;case 1:return Dt(o.type)&&Kl(),vt(o),null;case 3:return f=o.stateNode,_r(),_e(Rt),_e(gt),Lc(),f.pendingContext&&(f.context=f.pendingContext,f.pendingContext=null),(i===null||i.child===null)&&(Xl(o)?o.flags|=4:i===null||i.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,fn!==null&&(hf(fn),fn=null))),Jc(i,o),vt(o),null;case 5:Rc(o);var p=Ki(Js.current);if(u=o.type,i!==null&&o.stateNode!=null)Qy(i,o,u,f,p),i.ref!==o.ref&&(o.flags|=512,o.flags|=2097152);else{if(!f){if(o.stateNode===null)throw Error(t(166));return vt(o),null}if(i=Ki(Dn.current),Xl(o)){f=o.stateNode,u=o.type;var g=o.memoizedProps;switch(f[Rn]=o,f[Qs]=g,i=(o.mode&1)!==0,u){case"dialog":Fe("cancel",f),Fe("close",f);break;case"iframe":case"object":case"embed":Fe("load",f);break;case"video":case"audio":for(p=0;p<Us.length;p++)Fe(Us[p],f);break;case"source":Fe("error",f);break;case"img":case"image":case"link":Fe("error",f),Fe("load",f);break;case"details":Fe("toggle",f);break;case"input":xl(f,g),Fe("invalid",f);break;case"select":f._wrapperState={wasMultiple:!!g.multiple},Fe("invalid",f);break;case"textarea":Rg(f,g),Fe("invalid",f)}Dh(u,g),p=null;for(var w in g)if(g.hasOwnProperty(w)){var C=g[w];w==="children"?typeof C=="string"?f.textContent!==C&&(g.suppressHydrationWarning!==!0&&Wl(f.textContent,C,i),p=["children",C]):typeof C=="number"&&f.textContent!==""+C&&(g.suppressHydrationWarning!==!0&&Wl(f.textContent,C,i),p=["children",""+C]):r.hasOwnProperty(w)&&C!=null&&w==="onScroll"&&Fe("scroll",f)}switch(u){case"input":ai(f),Pg(f,g,!0);break;case"textarea":ai(f),Lg(f);break;case"select":case"option":break;default:typeof g.onClick=="function"&&(f.onclick=Ul)}f=p,o.updateQueue=f,f!==null&&(o.flags|=4)}else{w=p.nodeType===9?p:p.ownerDocument,i==="http://www.w3.org/1999/xhtml"&&(i=Ng(u)),i==="http://www.w3.org/1999/xhtml"?u==="script"?(i=w.createElement("div"),i.innerHTML="<script><\/script>",i=i.removeChild(i.firstChild)):typeof f.is=="string"?i=w.createElement(u,{is:f.is}):(i=w.createElement(u),u==="select"&&(w=i,f.multiple?w.multiple=!0:f.size&&(w.size=f.size))):i=w.createElementNS(i,u),i[Rn]=o,i[Qs]=f,Ky(i,o,!1,!1),o.stateNode=i;e:{switch(w=Lh(u,f),u){case"dialog":Fe("cancel",i),Fe("close",i),p=f;break;case"iframe":case"object":case"embed":Fe("load",i),p=f;break;case"video":case"audio":for(p=0;p<Us.length;p++)Fe(Us[p],i);p=f;break;case"source":Fe("error",i),p=f;break;case"img":case"image":case"link":Fe("error",i),Fe("load",i),p=f;break;case"details":Fe("toggle",i),p=f;break;case"input":xl(i,f),p=_i(i,f),Fe("invalid",i);break;case"option":p=f;break;case"select":i._wrapperState={wasMultiple:!!f.multiple},p=J({},f,{value:void 0}),Fe("invalid",i);break;case"textarea":Rg(i,f),p=Ph(i,f),Fe("invalid",i);break;default:p=f}Dh(u,p),C=p;for(g in C)if(C.hasOwnProperty(g)){var b=C[g];g==="style"?zg(i,b):g==="dangerouslySetInnerHTML"?(b=b?b.__html:void 0,b!=null&&Bg(i,b)):g==="children"?typeof b=="string"?(u!=="textarea"||b!=="")&&As(i,b):typeof b=="number"&&As(i,""+b):g!=="suppressContentEditableWarning"&&g!=="suppressHydrationWarning"&&g!=="autoFocus"&&(r.hasOwnProperty(g)?b!=null&&g==="onScroll"&&Fe("scroll",i):b!=null&&L(i,g,b,w))}switch(u){case"input":ai(i),Pg(i,f,!1);break;case"textarea":ai(i),Lg(i);break;case"option":f.value!=null&&i.setAttribute("value",""+ce(f.value));break;case"select":i.multiple=!!f.multiple,g=f.value,g!=null?kr(i,!!f.multiple,g,!1):f.defaultValue!=null&&kr(i,!!f.multiple,f.defaultValue,!0);break;default:typeof p.onClick=="function"&&(i.onclick=Ul)}switch(u){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break e;case"img":f=!0;break e;default:f=!1}}f&&(o.flags|=4)}o.ref!==null&&(o.flags|=512,o.flags|=2097152)}return vt(o),null;case 6:if(i&&o.stateNode!=null)Gy(i,o,i.memoizedProps,f);else{if(typeof f!="string"&&o.stateNode===null)throw Error(t(166));if(u=Ki(Js.current),Ki(Dn.current),Xl(o)){if(f=o.stateNode,u=o.memoizedProps,f[Rn]=o,(g=f.nodeValue!==u)&&(i=_t,i!==null))switch(i.tag){case 3:Wl(f.nodeValue,u,(i.mode&1)!==0);break;case 5:i.memoizedProps.suppressHydrationWarning!==!0&&Wl(f.nodeValue,u,(i.mode&1)!==0)}g&&(o.flags|=4)}else f=(u.nodeType===9?u:u.ownerDocument).createTextNode(f),f[Rn]=o,o.stateNode=f}return vt(o),null;case 13:if(_e(He),f=o.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(Ve&&jt!==null&&(o.mode&1)!==0&&(o.flags&128)===0)X0(),Br(),o.flags|=98560,g=!1;else if(g=Xl(o),f!==null&&f.dehydrated!==null){if(i===null){if(!g)throw Error(t(318));if(g=o.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(t(317));g[Rn]=o}else Br(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;vt(o),g=!1}else fn!==null&&(hf(fn),fn=null),g=!0;if(!g)return o.flags&65536?o:null}return(o.flags&128)!==0?(o.lanes=u,o):(f=f!==null,f!==(i!==null&&i.memoizedState!==null)&&f&&(o.child.flags|=8192,(o.mode&1)!==0&&(i===null||(He.current&1)!==0?nt===0&&(nt=3):df())),o.updateQueue!==null&&(o.flags|=4),vt(o),null);case 4:return _r(),Jc(i,o),i===null&&$s(o.stateNode.containerInfo),vt(o),null;case 10:return Tc(o.type._context),vt(o),null;case 17:return Dt(o.type)&&Kl(),vt(o),null;case 19:if(_e(He),g=o.memoizedState,g===null)return vt(o),null;if(f=(o.flags&128)!==0,w=g.rendering,w===null)if(f)io(g,!1);else{if(nt!==0||i!==null&&(i.flags&128)!==0)for(i=o.child;i!==null;){if(w=ia(i),w!==null){for(o.flags|=128,io(g,!1),f=w.updateQueue,f!==null&&(o.updateQueue=f,o.flags|=4),o.subtreeFlags=0,f=u,u=o.child;u!==null;)g=u,i=f,g.flags&=14680066,w=g.alternate,w===null?(g.childLanes=0,g.lanes=i,g.child=null,g.subtreeFlags=0,g.memoizedProps=null,g.memoizedState=null,g.updateQueue=null,g.dependencies=null,g.stateNode=null):(g.childLanes=w.childLanes,g.lanes=w.lanes,g.child=w.child,g.subtreeFlags=0,g.deletions=null,g.memoizedProps=w.memoizedProps,g.memoizedState=w.memoizedState,g.updateQueue=w.updateQueue,g.type=w.type,i=w.dependencies,g.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),u=u.sibling;return Ie(He,He.current&1|2),o.child}i=i.sibling}g.tail!==null&&Ye()>Wr&&(o.flags|=128,f=!0,io(g,!1),o.lanes=4194304)}else{if(!f)if(i=ia(w),i!==null){if(o.flags|=128,f=!0,u=i.updateQueue,u!==null&&(o.updateQueue=u,o.flags|=4),io(g,!0),g.tail===null&&g.tailMode==="hidden"&&!w.alternate&&!Ve)return vt(o),null}else 2*Ye()-g.renderingStartTime>Wr&&u!==1073741824&&(o.flags|=128,f=!0,io(g,!1),o.lanes=4194304);g.isBackwards?(w.sibling=o.child,o.child=w):(u=g.last,u!==null?u.sibling=w:o.child=w,g.last=w)}return g.tail!==null?(o=g.tail,g.rendering=o,g.tail=o.sibling,g.renderingStartTime=Ye(),o.sibling=null,u=He.current,Ie(He,f?u&1|2:u&1),o):(vt(o),null);case 22:case 23:return ff(),f=o.memoizedState!==null,i!==null&&i.memoizedState!==null!==f&&(o.flags|=8192),f&&(o.mode&1)!==0?(Vt&1073741824)!==0&&(vt(o),o.subtreeFlags&6&&(o.flags|=8192)):vt(o),null;case 24:return null;case 25:return null}throw Error(t(156,o.tag))}function _b(i,o){switch(kc(o),o.tag){case 1:return Dt(o.type)&&Kl(),i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 3:return _r(),_e(Rt),_e(gt),Lc(),i=o.flags,(i&65536)!==0&&(i&128)===0?(o.flags=i&-65537|128,o):null;case 5:return Rc(o),null;case 13:if(_e(He),i=o.memoizedState,i!==null&&i.dehydrated!==null){if(o.alternate===null)throw Error(t(340));Br()}return i=o.flags,i&65536?(o.flags=i&-65537|128,o):null;case 19:return _e(He),null;case 4:return _r(),null;case 10:return Tc(o.type._context),null;case 22:case 23:return ff(),null;case 24:return null;default:return null}}var fa=!1,wt=!1,jb=typeof WeakSet=="function"?WeakSet:Set,ne=null;function Vr(i,o){var u=i.ref;if(u!==null)if(typeof u=="function")try{u(null)}catch(f){Ke(i,o,f)}else u.current=null}function Zc(i,o,u){try{u()}catch(f){Ke(i,o,f)}}var qy=!1;function Vb(i,o){if(cc=Dl,i=M0(),ic(i)){if("selectionStart"in i)var u={start:i.selectionStart,end:i.selectionEnd};else e:{u=(u=i.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var p=f.anchorOffset,g=f.focusNode;f=f.focusOffset;try{u.nodeType,g.nodeType}catch{u=null;break e}var w=0,C=-1,b=-1,P=0,V=0,W=i,j=null;t:for(;;){for(var Z;W!==u||p!==0&&W.nodeType!==3||(C=w+p),W!==g||f!==0&&W.nodeType!==3||(b=w+f),W.nodeType===3&&(w+=W.nodeValue.length),(Z=W.firstChild)!==null;)j=W,W=Z;for(;;){if(W===i)break t;if(j===u&&++P===p&&(C=w),j===g&&++V===f&&(b=w),(Z=W.nextSibling)!==null)break;W=j,j=W.parentNode}W=Z}u=C===-1||b===-1?null:{start:C,end:b}}else u=null}u=u||{start:0,end:0}}else u=null;for(fc={focusedElem:i,selectionRange:u},Dl=!1,ne=o;ne!==null;)if(o=ne,i=o.child,(o.subtreeFlags&1028)!==0&&i!==null)i.return=o,ne=i;else for(;ne!==null;){o=ne;try{var ie=o.alternate;if((o.flags&1024)!==0)switch(o.tag){case 0:case 11:case 15:break;case 1:if(ie!==null){var re=ie.memoizedProps,Xe=ie.memoizedState,O=o.stateNode,A=O.getSnapshotBeforeUpdate(o.elementType===o.type?re:dn(o.type,re),Xe);O.__reactInternalSnapshotBeforeUpdate=A}break;case 3:var E=o.stateNode.containerInfo;E.nodeType===1?E.textContent="":E.nodeType===9&&E.documentElement&&E.removeChild(E.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(t(163))}}catch(U){Ke(o,o.return,U)}if(i=o.sibling,i!==null){i.return=o.return,ne=i;break}ne=o.return}return ie=qy,qy=!1,ie}function ro(i,o,u){var f=o.updateQueue;if(f=f!==null?f.lastEffect:null,f!==null){var p=f=f.next;do{if((p.tag&i)===i){var g=p.destroy;p.destroy=void 0,g!==void 0&&Zc(o,u,g)}p=p.next}while(p!==f)}}function da(i,o){if(o=o.updateQueue,o=o!==null?o.lastEffect:null,o!==null){var u=o=o.next;do{if((u.tag&i)===i){var f=u.create;u.destroy=f()}u=u.next}while(u!==o)}}function ef(i){var o=i.ref;if(o!==null){var u=i.stateNode;i.tag,i=u,typeof o=="function"?o(i):o.current=i}}function Yy(i){var o=i.alternate;o!==null&&(i.alternate=null,Yy(o)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(o=i.stateNode,o!==null&&(delete o[Rn],delete o[Qs],delete o[gc],delete o[Cb],delete o[bb])),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}function Xy(i){return i.tag===5||i.tag===3||i.tag===4}function Jy(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||Xy(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.flags&2||i.child===null||i.tag===4)continue e;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function tf(i,o,u){var f=i.tag;if(f===5||f===6)i=i.stateNode,o?u.nodeType===8?u.parentNode.insertBefore(i,o):u.insertBefore(i,o):(u.nodeType===8?(o=u.parentNode,o.insertBefore(i,u)):(o=u,o.appendChild(i)),u=u._reactRootContainer,u!=null||o.onclick!==null||(o.onclick=Ul));else if(f!==4&&(i=i.child,i!==null))for(tf(i,o,u),i=i.sibling;i!==null;)tf(i,o,u),i=i.sibling}function nf(i,o,u){var f=i.tag;if(f===5||f===6)i=i.stateNode,o?u.insertBefore(i,o):u.appendChild(i);else if(f!==4&&(i=i.child,i!==null))for(nf(i,o,u),i=i.sibling;i!==null;)nf(i,o,u),i=i.sibling}var ut=null,pn=!1;function xi(i,o,u){for(u=u.child;u!==null;)Zy(i,o,u),u=u.sibling}function Zy(i,o,u){if(Pn&&typeof Pn.onCommitFiberUnmount=="function")try{Pn.onCommitFiberUnmount(Tl,u)}catch{}switch(u.tag){case 5:wt||Vr(u,o);case 6:var f=ut,p=pn;ut=null,xi(i,o,u),ut=f,pn=p,ut!==null&&(pn?(i=ut,u=u.stateNode,i.nodeType===8?i.parentNode.removeChild(u):i.removeChild(u)):ut.removeChild(u.stateNode));break;case 18:ut!==null&&(pn?(i=ut,u=u.stateNode,i.nodeType===8?mc(i.parentNode,u):i.nodeType===1&&mc(i,u),Is(i)):mc(ut,u.stateNode));break;case 4:f=ut,p=pn,ut=u.stateNode.containerInfo,pn=!0,xi(i,o,u),ut=f,pn=p;break;case 0:case 11:case 14:case 15:if(!wt&&(f=u.updateQueue,f!==null&&(f=f.lastEffect,f!==null))){p=f=f.next;do{var g=p,w=g.destroy;g=g.tag,w!==void 0&&((g&2)!==0||(g&4)!==0)&&Zc(u,o,w),p=p.next}while(p!==f)}xi(i,o,u);break;case 1:if(!wt&&(Vr(u,o),f=u.stateNode,typeof f.componentWillUnmount=="function"))try{f.props=u.memoizedProps,f.state=u.memoizedState,f.componentWillUnmount()}catch(C){Ke(u,o,C)}xi(i,o,u);break;case 21:xi(i,o,u);break;case 22:u.mode&1?(wt=(f=wt)||u.memoizedState!==null,xi(i,o,u),wt=f):xi(i,o,u);break;default:xi(i,o,u)}}function ev(i){var o=i.updateQueue;if(o!==null){i.updateQueue=null;var u=i.stateNode;u===null&&(u=i.stateNode=new jb),o.forEach(function(f){var p=Yb.bind(null,i,f);u.has(f)||(u.add(f),f.then(p,p))})}}function mn(i,o){var u=o.deletions;if(u!==null)for(var f=0;f<u.length;f++){var p=u[f];try{var g=i,w=o,C=w;e:for(;C!==null;){switch(C.tag){case 5:ut=C.stateNode,pn=!1;break e;case 3:ut=C.stateNode.containerInfo,pn=!0;break e;case 4:ut=C.stateNode.containerInfo,pn=!0;break e}C=C.return}if(ut===null)throw Error(t(160));Zy(g,w,p),ut=null,pn=!1;var b=p.alternate;b!==null&&(b.return=null),p.return=null}catch(P){Ke(p,o,P)}}if(o.subtreeFlags&12854)for(o=o.child;o!==null;)tv(o,i),o=o.sibling}function tv(i,o){var u=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:if(mn(o,i),Nn(i),f&4){try{ro(3,i,i.return),da(3,i)}catch(re){Ke(i,i.return,re)}try{ro(5,i,i.return)}catch(re){Ke(i,i.return,re)}}break;case 1:mn(o,i),Nn(i),f&512&&u!==null&&Vr(u,u.return);break;case 5:if(mn(o,i),Nn(i),f&512&&u!==null&&Vr(u,u.return),i.flags&32){var p=i.stateNode;try{As(p,"")}catch(re){Ke(i,i.return,re)}}if(f&4&&(p=i.stateNode,p!=null)){var g=i.memoizedProps,w=u!==null?u.memoizedProps:g,C=i.type,b=i.updateQueue;if(i.updateQueue=null,b!==null)try{C==="input"&&g.type==="radio"&&g.name!=null&&Eg(p,g),Lh(C,w);var P=Lh(C,g);for(w=0;w<b.length;w+=2){var V=b[w],W=b[w+1];V==="style"?zg(p,W):V==="dangerouslySetInnerHTML"?Bg(p,W):V==="children"?As(p,W):L(p,V,W,P)}switch(C){case"input":Oh(p,g);break;case"textarea":Dg(p,g);break;case"select":var j=p._wrapperState.wasMultiple;p._wrapperState.wasMultiple=!!g.multiple;var Z=g.value;Z!=null?kr(p,!!g.multiple,Z,!1):j!==!!g.multiple&&(g.defaultValue!=null?kr(p,!!g.multiple,g.defaultValue,!0):kr(p,!!g.multiple,g.multiple?[]:"",!1))}p[Qs]=g}catch(re){Ke(i,i.return,re)}}break;case 6:if(mn(o,i),Nn(i),f&4){if(i.stateNode===null)throw Error(t(162));p=i.stateNode,g=i.memoizedProps;try{p.nodeValue=g}catch(re){Ke(i,i.return,re)}}break;case 3:if(mn(o,i),Nn(i),f&4&&u!==null&&u.memoizedState.isDehydrated)try{Is(o.containerInfo)}catch(re){Ke(i,i.return,re)}break;case 4:mn(o,i),Nn(i);break;case 13:mn(o,i),Nn(i),p=i.child,p.flags&8192&&(g=p.memoizedState!==null,p.stateNode.isHidden=g,!g||p.alternate!==null&&p.alternate.memoizedState!==null||(of=Ye())),f&4&&ev(i);break;case 22:if(V=u!==null&&u.memoizedState!==null,i.mode&1?(wt=(P=wt)||V,mn(o,i),wt=P):mn(o,i),Nn(i),f&8192){if(P=i.memoizedState!==null,(i.stateNode.isHidden=P)&&!V&&(i.mode&1)!==0)for(ne=i,V=i.child;V!==null;){for(W=ne=V;ne!==null;){switch(j=ne,Z=j.child,j.tag){case 0:case 11:case 14:case 15:ro(4,j,j.return);break;case 1:Vr(j,j.return);var ie=j.stateNode;if(typeof ie.componentWillUnmount=="function"){f=j,u=j.return;try{o=f,ie.props=o.memoizedProps,ie.state=o.memoizedState,ie.componentWillUnmount()}catch(re){Ke(f,u,re)}}break;case 5:Vr(j,j.return);break;case 22:if(j.memoizedState!==null){rv(W);continue}}Z!==null?(Z.return=j,ne=Z):rv(W)}V=V.sibling}e:for(V=null,W=i;;){if(W.tag===5){if(V===null){V=W;try{p=W.stateNode,P?(g=p.style,typeof g.setProperty=="function"?g.setProperty("display","none","important"):g.display="none"):(C=W.stateNode,b=W.memoizedProps.style,w=b!=null&&b.hasOwnProperty("display")?b.display:null,C.style.display=Ig("display",w))}catch(re){Ke(i,i.return,re)}}}else if(W.tag===6){if(V===null)try{W.stateNode.nodeValue=P?"":W.memoizedProps}catch(re){Ke(i,i.return,re)}}else if((W.tag!==22&&W.tag!==23||W.memoizedState===null||W===i)&&W.child!==null){W.child.return=W,W=W.child;continue}if(W===i)break e;for(;W.sibling===null;){if(W.return===null||W.return===i)break e;V===W&&(V=null),W=W.return}V===W&&(V=null),W.sibling.return=W.return,W=W.sibling}}break;case 19:mn(o,i),Nn(i),f&4&&ev(i);break;case 21:break;default:mn(o,i),Nn(i)}}function Nn(i){var o=i.flags;if(o&2){try{e:{for(var u=i.return;u!==null;){if(Xy(u)){var f=u;break e}u=u.return}throw Error(t(160))}switch(f.tag){case 5:var p=f.stateNode;f.flags&32&&(As(p,""),f.flags&=-33);var g=Jy(i);nf(i,g,p);break;case 3:case 4:var w=f.stateNode.containerInfo,C=Jy(i);tf(i,C,w);break;default:throw Error(t(161))}}catch(b){Ke(i,i.return,b)}i.flags&=-3}o&4096&&(i.flags&=-4097)}function Hb(i,o,u){ne=i,nv(i)}function nv(i,o,u){for(var f=(i.mode&1)!==0;ne!==null;){var p=ne,g=p.child;if(p.tag===22&&f){var w=p.memoizedState!==null||fa;if(!w){var C=p.alternate,b=C!==null&&C.memoizedState!==null||wt;C=fa;var P=wt;if(fa=w,(wt=b)&&!P)for(ne=p;ne!==null;)w=ne,b=w.child,w.tag===22&&w.memoizedState!==null?sv(p):b!==null?(b.return=w,ne=b):sv(p);for(;g!==null;)ne=g,nv(g),g=g.sibling;ne=p,fa=C,wt=P}iv(i)}else(p.subtreeFlags&8772)!==0&&g!==null?(g.return=p,ne=g):iv(i)}}function iv(i){for(;ne!==null;){var o=ne;if((o.flags&8772)!==0){var u=o.alternate;try{if((o.flags&8772)!==0)switch(o.tag){case 0:case 11:case 15:wt||da(5,o);break;case 1:var f=o.stateNode;if(o.flags&4&&!wt)if(u===null)f.componentDidMount();else{var p=o.elementType===o.type?u.memoizedProps:dn(o.type,u.memoizedProps);f.componentDidUpdate(p,u.memoizedState,f.__reactInternalSnapshotBeforeUpdate)}var g=o.updateQueue;g!==null&&ry(o,g,f);break;case 3:var w=o.updateQueue;if(w!==null){if(u=null,o.child!==null)switch(o.child.tag){case 5:u=o.child.stateNode;break;case 1:u=o.child.stateNode}ry(o,w,u)}break;case 5:var C=o.stateNode;if(u===null&&o.flags&4){u=C;var b=o.memoizedProps;switch(o.type){case"button":case"input":case"select":case"textarea":b.autoFocus&&u.focus();break;case"img":b.src&&(u.src=b.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(o.memoizedState===null){var P=o.alternate;if(P!==null){var V=P.memoizedState;if(V!==null){var W=V.dehydrated;W!==null&&Is(W)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(t(163))}wt||o.flags&512&&ef(o)}catch(j){Ke(o,o.return,j)}}if(o===i){ne=null;break}if(u=o.sibling,u!==null){u.return=o.return,ne=u;break}ne=o.return}}function rv(i){for(;ne!==null;){var o=ne;if(o===i){ne=null;break}var u=o.sibling;if(u!==null){u.return=o.return,ne=u;break}ne=o.return}}function sv(i){for(;ne!==null;){var o=ne;try{switch(o.tag){case 0:case 11:case 15:var u=o.return;try{da(4,o)}catch(b){Ke(o,u,b)}break;case 1:var f=o.stateNode;if(typeof f.componentDidMount=="function"){var p=o.return;try{f.componentDidMount()}catch(b){Ke(o,p,b)}}var g=o.return;try{ef(o)}catch(b){Ke(o,g,b)}break;case 5:var w=o.return;try{ef(o)}catch(b){Ke(o,w,b)}}}catch(b){Ke(o,o.return,b)}if(o===i){ne=null;break}var C=o.sibling;if(C!==null){C.return=o.return,ne=C;break}ne=o.return}}var Wb=Math.ceil,pa=_.ReactCurrentDispatcher,rf=_.ReactCurrentOwner,en=_.ReactCurrentBatchConfig,Ee=0,st=null,Ze=null,ht=0,Vt=0,Hr=gi(0),nt=0,so=null,Gi=0,ma=0,sf=0,oo=null,Nt=null,of=0,Wr=1/0,Gn=null,ga=!1,lf=null,Si=null,ya=!1,Ci=null,va=0,lo=0,af=null,wa=-1,ka=0;function Ct(){return(Ee&6)!==0?Ye():wa!==-1?wa:wa=Ye()}function bi(i){return(i.mode&1)===0?1:(Ee&2)!==0&&ht!==0?ht&-ht:Tb.transition!==null?(ka===0&&(ka=Jg()),ka):(i=De,i!==0||(i=window.event,i=i===void 0?16:l0(i.type)),i)}function gn(i,o,u,f){if(50<lo)throw lo=0,af=null,Error(t(185));Rs(i,u,f),((Ee&2)===0||i!==st)&&(i===st&&((Ee&2)===0&&(ma|=u),nt===4&&Ai(i,ht)),Bt(i,f),u===1&&Ee===0&&(o.mode&1)===0&&(Wr=Ye()+500,Gl&&vi()))}function Bt(i,o){var u=i.callbackNode;TC(i,o);var f=El(i,i===st?ht:0);if(f===0)u!==null&&qg(u),i.callbackNode=null,i.callbackPriority=0;else if(o=f&-f,i.callbackPriority!==o){if(u!=null&&qg(u),o===1)i.tag===0?Ab(lv.bind(null,i)):K0(lv.bind(null,i)),xb(function(){(Ee&6)===0&&vi()}),u=null;else{switch(Zg(f)){case 1:u=jh;break;case 4:u=Yg;break;case 16:u=Al;break;case 536870912:u=Xg;break;default:u=Al}u=mv(u,ov.bind(null,i))}i.callbackPriority=o,i.callbackNode=u}}function ov(i,o){if(wa=-1,ka=0,(Ee&6)!==0)throw Error(t(327));var u=i.callbackNode;if(Ur()&&i.callbackNode!==u)return null;var f=El(i,i===st?ht:0);if(f===0)return null;if((f&30)!==0||(f&i.expiredLanes)!==0||o)o=xa(i,f);else{o=f;var p=Ee;Ee|=2;var g=uv();(st!==i||ht!==o)&&(Gn=null,Wr=Ye()+500,Yi(i,o));do try{Kb();break}catch(C){av(i,C)}while(!0);Ac(),pa.current=g,Ee=p,Ze!==null?o=0:(st=null,ht=0,o=nt)}if(o!==0){if(o===2&&(p=Vh(i),p!==0&&(f=p,o=uf(i,p))),o===1)throw u=so,Yi(i,0),Ai(i,f),Bt(i,Ye()),u;if(o===6)Ai(i,f);else{if(p=i.current.alternate,(f&30)===0&&!Ub(p)&&(o=xa(i,f),o===2&&(g=Vh(i),g!==0&&(f=g,o=uf(i,g))),o===1))throw u=so,Yi(i,0),Ai(i,f),Bt(i,Ye()),u;switch(i.finishedWork=p,i.finishedLanes=f,o){case 0:case 1:throw Error(t(345));case 2:Xi(i,Nt,Gn);break;case 3:if(Ai(i,f),(f&130023424)===f&&(o=of+500-Ye(),10<o)){if(El(i,0)!==0)break;if(p=i.suspendedLanes,(p&f)!==f){Ct(),i.pingedLanes|=i.suspendedLanes&p;break}i.timeoutHandle=pc(Xi.bind(null,i,Nt,Gn),o);break}Xi(i,Nt,Gn);break;case 4:if(Ai(i,f),(f&4194240)===f)break;for(o=i.eventTimes,p=-1;0<f;){var w=31-hn(f);g=1<<w,w=o[w],w>p&&(p=w),f&=~g}if(f=p,f=Ye()-f,f=(120>f?120:480>f?480:1080>f?1080:1920>f?1920:3e3>f?3e3:4320>f?4320:1960*Wb(f/1960))-f,10<f){i.timeoutHandle=pc(Xi.bind(null,i,Nt,Gn),f);break}Xi(i,Nt,Gn);break;case 5:Xi(i,Nt,Gn);break;default:throw Error(t(329))}}}return Bt(i,Ye()),i.callbackNode===u?ov.bind(null,i):null}function uf(i,o){var u=oo;return i.current.memoizedState.isDehydrated&&(Yi(i,o).flags|=256),i=xa(i,o),i!==2&&(o=Nt,Nt=u,o!==null&&hf(o)),i}function hf(i){Nt===null?Nt=i:Nt.push.apply(Nt,i)}function Ub(i){for(var o=i;;){if(o.flags&16384){var u=o.updateQueue;if(u!==null&&(u=u.stores,u!==null))for(var f=0;f<u.length;f++){var p=u[f],g=p.getSnapshot;p=p.value;try{if(!cn(g(),p))return!1}catch{return!1}}}if(u=o.child,o.subtreeFlags&16384&&u!==null)u.return=o,o=u;else{if(o===i)break;for(;o.sibling===null;){if(o.return===null||o.return===i)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ai(i,o){for(o&=~sf,o&=~ma,i.suspendedLanes|=o,i.pingedLanes&=~o,i=i.expirationTimes;0<o;){var u=31-hn(o),f=1<<u;i[u]=-1,o&=~f}}function lv(i){if((Ee&6)!==0)throw Error(t(327));Ur();var o=El(i,0);if((o&1)===0)return Bt(i,Ye()),null;var u=xa(i,o);if(i.tag!==0&&u===2){var f=Vh(i);f!==0&&(o=f,u=uf(i,f))}if(u===1)throw u=so,Yi(i,0),Ai(i,o),Bt(i,Ye()),u;if(u===6)throw Error(t(345));return i.finishedWork=i.current.alternate,i.finishedLanes=o,Xi(i,Nt,Gn),Bt(i,Ye()),null}function cf(i,o){var u=Ee;Ee|=1;try{return i(o)}finally{Ee=u,Ee===0&&(Wr=Ye()+500,Gl&&vi())}}function qi(i){Ci!==null&&Ci.tag===0&&(Ee&6)===0&&Ur();var o=Ee;Ee|=1;var u=en.transition,f=De;try{if(en.transition=null,De=1,i)return i()}finally{De=f,en.transition=u,Ee=o,(Ee&6)===0&&vi()}}function ff(){Vt=Hr.current,_e(Hr)}function Yi(i,o){i.finishedWork=null,i.finishedLanes=0;var u=i.timeoutHandle;if(u!==-1&&(i.timeoutHandle=-1,kb(u)),Ze!==null)for(u=Ze.return;u!==null;){var f=u;switch(kc(f),f.tag){case 1:f=f.type.childContextTypes,f!=null&&Kl();break;case 3:_r(),_e(Rt),_e(gt),Lc();break;case 5:Rc(f);break;case 4:_r();break;case 13:_e(He);break;case 19:_e(He);break;case 10:Tc(f.type._context);break;case 22:case 23:ff()}u=u.return}if(st=i,Ze=i=Ti(i.current,null),ht=Vt=o,nt=0,so=null,sf=ma=Gi=0,Nt=oo=null,$i!==null){for(o=0;o<$i.length;o++)if(u=$i[o],f=u.interleaved,f!==null){u.interleaved=null;var p=f.next,g=u.pending;if(g!==null){var w=g.next;g.next=p,f.next=w}u.pending=f}$i=null}return i}function av(i,o){do{var u=Ze;try{if(Ac(),ra.current=aa,sa){for(var f=We.memoizedState;f!==null;){var p=f.queue;p!==null&&(p.pending=null),f=f.next}sa=!1}if(Qi=0,rt=tt=We=null,Zs=!1,eo=0,rf.current=null,u===null||u.return===null){nt=1,so=o,Ze=null;break}e:{var g=i,w=u.return,C=u,b=o;if(o=ht,C.flags|=32768,b!==null&&typeof b=="object"&&typeof b.then=="function"){var P=b,V=C,W=V.tag;if((V.mode&1)===0&&(W===0||W===11||W===15)){var j=V.alternate;j?(V.updateQueue=j.updateQueue,V.memoizedState=j.memoizedState,V.lanes=j.lanes):(V.updateQueue=null,V.memoizedState=null)}var Z=Ly(w);if(Z!==null){Z.flags&=-257,Ny(Z,w,C,g,o),Z.mode&1&&Dy(g,P,o),o=Z,b=P;var ie=o.updateQueue;if(ie===null){var re=new Set;re.add(b),o.updateQueue=re}else ie.add(b);break e}else{if((o&1)===0){Dy(g,P,o),df();break e}b=Error(t(426))}}else if(Ve&&C.mode&1){var Xe=Ly(w);if(Xe!==null){(Xe.flags&65536)===0&&(Xe.flags|=256),Ny(Xe,w,C,g,o),Cc(jr(b,C));break e}}g=b=jr(b,C),nt!==4&&(nt=2),oo===null?oo=[g]:oo.push(g),g=w;do{switch(g.tag){case 3:g.flags|=65536,o&=-o,g.lanes|=o;var O=Py(g,b,o);iy(g,O);break e;case 1:C=b;var A=g.type,E=g.stateNode;if((g.flags&128)===0&&(typeof A.getDerivedStateFromError=="function"||E!==null&&typeof E.componentDidCatch=="function"&&(Si===null||!Si.has(E)))){g.flags|=65536,o&=-o,g.lanes|=o;var U=Ry(g,C,o);iy(g,U);break e}}g=g.return}while(g!==null)}cv(u)}catch(le){o=le,Ze===u&&u!==null&&(Ze=u=u.return);continue}break}while(!0)}function uv(){var i=pa.current;return pa.current=aa,i===null?aa:i}function df(){(nt===0||nt===3||nt===2)&&(nt=4),st===null||(Gi&268435455)===0&&(ma&268435455)===0||Ai(st,ht)}function xa(i,o){var u=Ee;Ee|=2;var f=uv();(st!==i||ht!==o)&&(Gn=null,Yi(i,o));do try{$b();break}catch(p){av(i,p)}while(!0);if(Ac(),Ee=u,pa.current=f,Ze!==null)throw Error(t(261));return st=null,ht=0,nt}function $b(){for(;Ze!==null;)hv(Ze)}function Kb(){for(;Ze!==null&&!yC();)hv(Ze)}function hv(i){var o=pv(i.alternate,i,Vt);i.memoizedProps=i.pendingProps,o===null?cv(i):Ze=o,rf.current=null}function cv(i){var o=i;do{var u=o.alternate;if(i=o.return,(o.flags&32768)===0){if(u=Fb(u,o,Vt),u!==null){Ze=u;return}}else{if(u=_b(u,o),u!==null){u.flags&=32767,Ze=u;return}if(i!==null)i.flags|=32768,i.subtreeFlags=0,i.deletions=null;else{nt=6,Ze=null;return}}if(o=o.sibling,o!==null){Ze=o;return}Ze=o=i}while(o!==null);nt===0&&(nt=5)}function Xi(i,o,u){var f=De,p=en.transition;try{en.transition=null,De=1,Qb(i,o,u,f)}finally{en.transition=p,De=f}return null}function Qb(i,o,u,f){do Ur();while(Ci!==null);if((Ee&6)!==0)throw Error(t(327));u=i.finishedWork;var p=i.finishedLanes;if(u===null)return null;if(i.finishedWork=null,i.finishedLanes=0,u===i.current)throw Error(t(177));i.callbackNode=null,i.callbackPriority=0;var g=u.lanes|u.childLanes;if(MC(i,g),i===st&&(Ze=st=null,ht=0),(u.subtreeFlags&2064)===0&&(u.flags&2064)===0||ya||(ya=!0,mv(Al,function(){return Ur(),null})),g=(u.flags&15990)!==0,(u.subtreeFlags&15990)!==0||g){g=en.transition,en.transition=null;var w=De;De=1;var C=Ee;Ee|=4,rf.current=null,Vb(i,u),tv(u,i),db(fc),Dl=!!cc,fc=cc=null,i.current=u,Hb(u),vC(),Ee=C,De=w,en.transition=g}else i.current=u;if(ya&&(ya=!1,Ci=i,va=p),g=i.pendingLanes,g===0&&(Si=null),xC(u.stateNode),Bt(i,Ye()),o!==null)for(f=i.onRecoverableError,u=0;u<o.length;u++)p=o[u],f(p.value,{componentStack:p.stack,digest:p.digest});if(ga)throw ga=!1,i=lf,lf=null,i;return(va&1)!==0&&i.tag!==0&&Ur(),g=i.pendingLanes,(g&1)!==0?i===af?lo++:(lo=0,af=i):lo=0,vi(),null}function Ur(){if(Ci!==null){var i=Zg(va),o=en.transition,u=De;try{if(en.transition=null,De=16>i?16:i,Ci===null)var f=!1;else{if(i=Ci,Ci=null,va=0,(Ee&6)!==0)throw Error(t(331));var p=Ee;for(Ee|=4,ne=i.current;ne!==null;){var g=ne,w=g.child;if((ne.flags&16)!==0){var C=g.deletions;if(C!==null){for(var b=0;b<C.length;b++){var P=C[b];for(ne=P;ne!==null;){var V=ne;switch(V.tag){case 0:case 11:case 15:ro(8,V,g)}var W=V.child;if(W!==null)W.return=V,ne=W;else for(;ne!==null;){V=ne;var j=V.sibling,Z=V.return;if(Yy(V),V===P){ne=null;break}if(j!==null){j.return=Z,ne=j;break}ne=Z}}}var ie=g.alternate;if(ie!==null){var re=ie.child;if(re!==null){ie.child=null;do{var Xe=re.sibling;re.sibling=null,re=Xe}while(re!==null)}}ne=g}}if((g.subtreeFlags&2064)!==0&&w!==null)w.return=g,ne=w;else e:for(;ne!==null;){if(g=ne,(g.flags&2048)!==0)switch(g.tag){case 0:case 11:case 15:ro(9,g,g.return)}var O=g.sibling;if(O!==null){O.return=g.return,ne=O;break e}ne=g.return}}var A=i.current;for(ne=A;ne!==null;){w=ne;var E=w.child;if((w.subtreeFlags&2064)!==0&&E!==null)E.return=w,ne=E;else e:for(w=A;ne!==null;){if(C=ne,(C.flags&2048)!==0)try{switch(C.tag){case 0:case 11:case 15:da(9,C)}}catch(le){Ke(C,C.return,le)}if(C===w){ne=null;break e}var U=C.sibling;if(U!==null){U.return=C.return,ne=U;break e}ne=C.return}}if(Ee=p,vi(),Pn&&typeof Pn.onPostCommitFiberRoot=="function")try{Pn.onPostCommitFiberRoot(Tl,i)}catch{}f=!0}return f}finally{De=u,en.transition=o}}return!1}function fv(i,o,u){o=jr(u,o),o=Py(i,o,1),i=ki(i,o,1),o=Ct(),i!==null&&(Rs(i,1,o),Bt(i,o))}function Ke(i,o,u){if(i.tag===3)fv(i,i,u);else for(;o!==null;){if(o.tag===3){fv(o,i,u);break}else if(o.tag===1){var f=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Si===null||!Si.has(f))){i=jr(u,i),i=Ry(o,i,1),o=ki(o,i,1),i=Ct(),o!==null&&(Rs(o,1,i),Bt(o,i));break}}o=o.return}}function Gb(i,o,u){var f=i.pingCache;f!==null&&f.delete(o),o=Ct(),i.pingedLanes|=i.suspendedLanes&u,st===i&&(ht&u)===u&&(nt===4||nt===3&&(ht&130023424)===ht&&500>Ye()-of?Yi(i,0):sf|=u),Bt(i,o)}function dv(i,o){o===0&&((i.mode&1)===0?o=1:(o=Ol,Ol<<=1,(Ol&130023424)===0&&(Ol=4194304)));var u=Ct();i=$n(i,o),i!==null&&(Rs(i,o,u),Bt(i,u))}function qb(i){var o=i.memoizedState,u=0;o!==null&&(u=o.retryLane),dv(i,u)}function Yb(i,o){var u=0;switch(i.tag){case 13:var f=i.stateNode,p=i.memoizedState;p!==null&&(u=p.retryLane);break;case 19:f=i.stateNode;break;default:throw Error(t(314))}f!==null&&f.delete(o),dv(i,u)}var pv;pv=function(i,o,u){if(i!==null)if(i.memoizedProps!==o.pendingProps||Rt.current)Lt=!0;else{if((i.lanes&u)===0&&(o.flags&128)===0)return Lt=!1,zb(i,o,u);Lt=(i.flags&131072)!==0}else Lt=!1,Ve&&(o.flags&1048576)!==0&&Q0(o,Yl,o.index);switch(o.lanes=0,o.tag){case 2:var f=o.type;ca(i,o),i=o.pendingProps;var p=Dr(o,gt.current);Fr(o,u),p=Ic(null,o,f,i,p,u);var g=zc();return o.flags|=1,typeof p=="object"&&p!==null&&typeof p.render=="function"&&p.$$typeof===void 0?(o.tag=1,o.memoizedState=null,o.updateQueue=null,Dt(f)?(g=!0,Ql(o)):g=!1,o.memoizedState=p.state!==null&&p.state!==void 0?p.state:null,Ec(o),p.updater=ua,o.stateNode=p,p._reactInternals=o,Wc(o,f,i,u),o=Qc(null,o,f,!0,g,u)):(o.tag=0,Ve&&g&&wc(o),St(null,o,p,u),o=o.child),o;case 16:f=o.elementType;e:{switch(ca(i,o),i=o.pendingProps,p=f._init,f=p(f._payload),o.type=f,p=o.tag=Jb(f),i=dn(f,i),p){case 0:o=Kc(null,o,f,i,u);break e;case 1:o=jy(null,o,f,i,u);break e;case 11:o=By(null,o,f,i,u);break e;case 14:o=Iy(null,o,f,dn(f.type,i),u);break e}throw Error(t(306,f,""))}return o;case 0:return f=o.type,p=o.pendingProps,p=o.elementType===f?p:dn(f,p),Kc(i,o,f,p,u);case 1:return f=o.type,p=o.pendingProps,p=o.elementType===f?p:dn(f,p),jy(i,o,f,p,u);case 3:e:{if(Vy(o),i===null)throw Error(t(387));f=o.pendingProps,g=o.memoizedState,p=g.element,ny(i,o),na(o,f,null,u);var w=o.memoizedState;if(f=w.element,g.isDehydrated)if(g={element:f,isDehydrated:!1,cache:w.cache,pendingSuspenseBoundaries:w.pendingSuspenseBoundaries,transitions:w.transitions},o.updateQueue.baseState=g,o.memoizedState=g,o.flags&256){p=jr(Error(t(423)),o),o=Hy(i,o,f,u,p);break e}else if(f!==p){p=jr(Error(t(424)),o),o=Hy(i,o,f,u,p);break e}else for(jt=mi(o.stateNode.containerInfo.firstChild),_t=o,Ve=!0,fn=null,u=ey(o,null,f,u),o.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(Br(),f===p){o=Qn(i,o,u);break e}St(i,o,f,u)}o=o.child}return o;case 5:return sy(o),i===null&&Sc(o),f=o.type,p=o.pendingProps,g=i!==null?i.memoizedProps:null,w=p.children,dc(f,p)?w=null:g!==null&&dc(f,g)&&(o.flags|=32),_y(i,o),St(i,o,w,u),o.child;case 6:return i===null&&Sc(o),null;case 13:return Wy(i,o,u);case 4:return Pc(o,o.stateNode.containerInfo),f=o.pendingProps,i===null?o.child=Ir(o,null,f,u):St(i,o,f,u),o.child;case 11:return f=o.type,p=o.pendingProps,p=o.elementType===f?p:dn(f,p),By(i,o,f,p,u);case 7:return St(i,o,o.pendingProps,u),o.child;case 8:return St(i,o,o.pendingProps.children,u),o.child;case 12:return St(i,o,o.pendingProps.children,u),o.child;case 10:e:{if(f=o.type._context,p=o.pendingProps,g=o.memoizedProps,w=p.value,Ie(Zl,f._currentValue),f._currentValue=w,g!==null)if(cn(g.value,w)){if(g.children===p.children&&!Rt.current){o=Qn(i,o,u);break e}}else for(g=o.child,g!==null&&(g.return=o);g!==null;){var C=g.dependencies;if(C!==null){w=g.child;for(var b=C.firstContext;b!==null;){if(b.context===f){if(g.tag===1){b=Kn(-1,u&-u),b.tag=2;var P=g.updateQueue;if(P!==null){P=P.shared;var V=P.pending;V===null?b.next=b:(b.next=V.next,V.next=b),P.pending=b}}g.lanes|=u,b=g.alternate,b!==null&&(b.lanes|=u),Mc(g.return,u,o),C.lanes|=u;break}b=b.next}}else if(g.tag===10)w=g.type===o.type?null:g.child;else if(g.tag===18){if(w=g.return,w===null)throw Error(t(341));w.lanes|=u,C=w.alternate,C!==null&&(C.lanes|=u),Mc(w,u,o),w=g.sibling}else w=g.child;if(w!==null)w.return=g;else for(w=g;w!==null;){if(w===o){w=null;break}if(g=w.sibling,g!==null){g.return=w.return,w=g;break}w=w.return}g=w}St(i,o,p.children,u),o=o.child}return o;case 9:return p=o.type,f=o.pendingProps.children,Fr(o,u),p=Jt(p),f=f(p),o.flags|=1,St(i,o,f,u),o.child;case 14:return f=o.type,p=dn(f,o.pendingProps),p=dn(f.type,p),Iy(i,o,f,p,u);case 15:return zy(i,o,o.type,o.pendingProps,u);case 17:return f=o.type,p=o.pendingProps,p=o.elementType===f?p:dn(f,p),ca(i,o),o.tag=1,Dt(f)?(i=!0,Ql(o)):i=!1,Fr(o,u),Oy(o,f,p),Wc(o,f,p,u),Qc(null,o,f,!0,i,u);case 19:return $y(i,o,u);case 22:return Fy(i,o,u)}throw Error(t(156,o.tag))};function mv(i,o){return Gg(i,o)}function Xb(i,o,u,f){this.tag=i,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function tn(i,o,u,f){return new Xb(i,o,u,f)}function pf(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Jb(i){if(typeof i=="function")return pf(i)?1:0;if(i!=null){if(i=i.$$typeof,i===ae)return 11;if(i===Se)return 14}return 2}function Ti(i,o){var u=i.alternate;return u===null?(u=tn(i.tag,o,i.key,i.mode),u.elementType=i.elementType,u.type=i.type,u.stateNode=i.stateNode,u.alternate=i,i.alternate=u):(u.pendingProps=o,u.type=i.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=i.flags&14680064,u.childLanes=i.childLanes,u.lanes=i.lanes,u.child=i.child,u.memoizedProps=i.memoizedProps,u.memoizedState=i.memoizedState,u.updateQueue=i.updateQueue,o=i.dependencies,u.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},u.sibling=i.sibling,u.index=i.index,u.ref=i.ref,u}function Sa(i,o,u,f,p,g){var w=2;if(f=i,typeof i=="function")pf(i)&&(w=1);else if(typeof i=="string")w=5;else e:switch(i){case F:return Ji(u.children,p,g,o);case ee:w=8,p|=8;break;case ge:return i=tn(12,u,o,p|2),i.elementType=ge,i.lanes=g,i;case we:return i=tn(13,u,o,p),i.elementType=we,i.lanes=g,i;case ve:return i=tn(19,u,o,p),i.elementType=ve,i.lanes=g,i;case Ce:return Ca(u,p,g,o);default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case pe:w=10;break e;case me:w=9;break e;case ae:w=11;break e;case Se:w=14;break e;case ze:w=16,f=null;break e}throw Error(t(130,i==null?i:typeof i,""))}return o=tn(w,u,o,p),o.elementType=i,o.type=f,o.lanes=g,o}function Ji(i,o,u,f){return i=tn(7,i,f,o),i.lanes=u,i}function Ca(i,o,u,f){return i=tn(22,i,f,o),i.elementType=Ce,i.lanes=u,i.stateNode={isHidden:!1},i}function mf(i,o,u){return i=tn(6,i,null,o),i.lanes=u,i}function gf(i,o,u){return o=tn(4,i.children!==null?i.children:[],i.key,o),o.lanes=u,o.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},o}function Zb(i,o,u,f,p){this.tag=o,this.containerInfo=i,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hh(0),this.expirationTimes=Hh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hh(0),this.identifierPrefix=f,this.onRecoverableError=p,this.mutableSourceEagerHydrationData=null}function yf(i,o,u,f,p,g,w,C,b){return i=new Zb(i,o,u,C,b),o===1?(o=1,g===!0&&(o|=8)):o=0,g=tn(3,null,null,o),i.current=g,g.stateNode=i,g.memoizedState={element:f,isDehydrated:u,cache:null,transitions:null,pendingSuspenseBoundaries:null},Ec(g),i}function e2(i,o,u){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:I,key:f==null?null:""+f,children:i,containerInfo:o,implementation:u}}function gv(i){if(!i)return yi;i=i._reactInternals;e:{if(ji(i)!==i||i.tag!==1)throw Error(t(170));var o=i;do{switch(o.tag){case 3:o=o.stateNode.context;break e;case 1:if(Dt(o.type)){o=o.stateNode.__reactInternalMemoizedMergedChildContext;break e}}o=o.return}while(o!==null);throw Error(t(171))}if(i.tag===1){var u=i.type;if(Dt(u))return U0(i,u,o)}return o}function yv(i,o,u,f,p,g,w,C,b){return i=yf(u,f,!0,i,p,g,w,C,b),i.context=gv(null),u=i.current,f=Ct(),p=bi(u),g=Kn(f,p),g.callback=o??null,ki(u,g,p),i.current.lanes=p,Rs(i,p,f),Bt(i,f),i}function ba(i,o,u,f){var p=o.current,g=Ct(),w=bi(p);return u=gv(u),o.context===null?o.context=u:o.pendingContext=u,o=Kn(g,w),o.payload={element:i},f=f===void 0?null:f,f!==null&&(o.callback=f),i=ki(p,o,w),i!==null&&(gn(i,p,w,g),ta(i,p,w)),w}function Aa(i){return i=i.current,i.child?(i.child.tag===5,i.child.stateNode):null}function vv(i,o){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var u=i.retryLane;i.retryLane=u!==0&&u<o?u:o}}function vf(i,o){vv(i,o),(i=i.alternate)&&vv(i,o)}function t2(){return null}var wv=typeof reportError=="function"?reportError:function(i){console.error(i)};function wf(i){this._internalRoot=i}Ta.prototype.render=wf.prototype.render=function(i){var o=this._internalRoot;if(o===null)throw Error(t(409));ba(i,o,null,null)},Ta.prototype.unmount=wf.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var o=i.containerInfo;qi(function(){ba(null,i,null,null)}),o[Vn]=null}};function Ta(i){this._internalRoot=i}Ta.prototype.unstable_scheduleHydration=function(i){if(i){var o=n0();i={blockedOn:null,target:i,priority:o};for(var u=0;u<fi.length&&o!==0&&o<fi[u].priority;u++);fi.splice(u,0,i),u===0&&s0(i)}};function kf(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function Ma(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11&&(i.nodeType!==8||i.nodeValue!==" react-mount-point-unstable "))}function kv(){}function n2(i,o,u,f,p){if(p){if(typeof f=="function"){var g=f;f=function(){var P=Aa(w);g.call(P)}}var w=yv(o,f,i,0,null,!1,!1,"",kv);return i._reactRootContainer=w,i[Vn]=w.current,$s(i.nodeType===8?i.parentNode:i),qi(),w}for(;p=i.lastChild;)i.removeChild(p);if(typeof f=="function"){var C=f;f=function(){var P=Aa(b);C.call(P)}}var b=yf(i,0,!1,null,null,!1,!1,"",kv);return i._reactRootContainer=b,i[Vn]=b.current,$s(i.nodeType===8?i.parentNode:i),qi(function(){ba(o,b,u,f)}),b}function Oa(i,o,u,f,p){var g=u._reactRootContainer;if(g){var w=g;if(typeof p=="function"){var C=p;p=function(){var b=Aa(w);C.call(b)}}ba(o,w,i,p)}else w=n2(u,o,i,p,f);return Aa(w)}e0=function(i){switch(i.tag){case 3:var o=i.stateNode;if(o.current.memoizedState.isDehydrated){var u=Ps(o.pendingLanes);u!==0&&(Wh(o,u|1),Bt(o,Ye()),(Ee&6)===0&&(Wr=Ye()+500,vi()))}break;case 13:qi(function(){var f=$n(i,1);if(f!==null){var p=Ct();gn(f,i,1,p)}}),vf(i,1)}},Uh=function(i){if(i.tag===13){var o=$n(i,134217728);if(o!==null){var u=Ct();gn(o,i,134217728,u)}vf(i,134217728)}},t0=function(i){if(i.tag===13){var o=bi(i),u=$n(i,o);if(u!==null){var f=Ct();gn(u,i,o,f)}vf(i,o)}},n0=function(){return De},i0=function(i,o){var u=De;try{return De=i,o()}finally{De=u}},Ih=function(i,o,u){switch(o){case"input":if(Oh(i,u),o=u.name,u.type==="radio"&&o!=null){for(u=i;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll("input[name="+JSON.stringify(""+o)+'][type="radio"]'),o=0;o<u.length;o++){var f=u[o];if(f!==i&&f.form===i.form){var p=$l(f);if(!p)throw Error(t(90));mt(f),Oh(f,p)}}}break;case"textarea":Dg(i,u);break;case"select":o=u.value,o!=null&&kr(i,!!u.multiple,o,!1)}},Vg=cf,Hg=qi;var i2={usingClientEntryPoint:!1,Events:[Gs,Pr,$l,_g,jg,cf]},ao={findFiberByHostInstance:Vi,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},r2={bundleType:ao.bundleType,version:ao.version,rendererPackageName:ao.rendererPackageName,rendererConfig:ao.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:_.ReactCurrentDispatcher,findHostInstanceByFiber:function(i){return i=Kg(i),i===null?null:i.stateNode},findFiberByHostInstance:ao.findFiberByHostInstance||t2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ea=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ea.isDisabled&&Ea.supportsFiber)try{Tl=Ea.inject(r2),Pn=Ea}catch{}}return bt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i2,bt.createPortal=function(i,o){var u=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!kf(o))throw Error(t(200));return e2(i,o,null,u)},bt.createRoot=function(i,o){if(!kf(i))throw Error(t(299));var u=!1,f="",p=wv;return o!=null&&(o.unstable_strictMode===!0&&(u=!0),o.identifierPrefix!==void 0&&(f=o.identifierPrefix),o.onRecoverableError!==void 0&&(p=o.onRecoverableError)),o=yf(i,1,!1,null,null,u,!1,f,p),i[Vn]=o.current,$s(i.nodeType===8?i.parentNode:i),new wf(o)},bt.findDOMNode=function(i){if(i==null)return null;if(i.nodeType===1)return i;var o=i._reactInternals;if(o===void 0)throw typeof i.render=="function"?Error(t(188)):(i=Object.keys(i).join(","),Error(t(268,i)));return i=Kg(o),i=i===null?null:i.stateNode,i},bt.flushSync=function(i){return qi(i)},bt.hydrate=function(i,o,u){if(!Ma(o))throw Error(t(200));return Oa(null,i,o,!0,u)},bt.hydrateRoot=function(i,o,u){if(!kf(i))throw Error(t(405));var f=u!=null&&u.hydratedSources||null,p=!1,g="",w=wv;if(u!=null&&(u.unstable_strictMode===!0&&(p=!0),u.identifierPrefix!==void 0&&(g=u.identifierPrefix),u.onRecoverableError!==void 0&&(w=u.onRecoverableError)),o=yv(o,null,i,1,u??null,p,!1,g,w),i[Vn]=o.current,$s(i),f)for(i=0;i<f.length;i++)u=f[i],p=u._getVersion,p=p(u._source),o.mutableSourceEagerHydrationData==null?o.mutableSourceEagerHydrationData=[u,p]:o.mutableSourceEagerHydrationData.push(u,p);return new Ta(o)},bt.render=function(i,o,u){if(!Ma(o))throw Error(t(200));return Oa(null,i,o,!1,u)},bt.unmountComponentAtNode=function(i){if(!Ma(i))throw Error(t(40));return i._reactRootContainer?(qi(function(){Oa(null,null,i,!1,function(){i._reactRootContainer=null,i[Vn]=null})}),!0):!1},bt.unstable_batchedUpdates=cf,bt.unstable_renderSubtreeIntoContainer=function(i,o,u,f){if(!Ma(u))throw Error(t(200));if(i==null||i._reactInternals===void 0)throw Error(t(38));return Oa(i,o,u,!1,f)},bt.version="18.3.1-next-f1338f8080-20240426",bt}var Of;function Ov(){if(Of)return La.exports;Of=1;function s(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(s)}catch(e){console.error(e)}}return s(),La.exports=Mv(),La.exports}var Ef;function Ev(){if(Ef)return uo;Ef=1;var s=Ov();return uo.createRoot=s.createRoot,uo.hydrateRoot=s.hydrateRoot,uo}var Pv=Ev();const Ia=25,Rv={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&apos;"},Dv=s=>s.replace(/[&<>"']/gu,e=>Rv[e]),Lv=s=>s.replace(/[%_\[\]]/gu,e=>"["+e+"]");function Nv({environment:s,onSelect:e,onClose:t}){const n=Te.useRef(null),r=Te.useRef(!1),[l,a]=Te.useState(""),[h,c]=Te.useState([]),[d,m]=Te.useState("Search by logical name or display name."),[y,v]=Te.useState(!1),[k,x]=Te.useState(1),[S,T]=Te.useState(""),[D,q]=Te.useState(!1);Te.useEffect(()=>{const _=n.current;return _?.showModal(),()=>_?.close()},[]);async function L(_){const K=l.trim();if(!r.current){r.current=!0,v(!0),c([]),m("Searching Dataverse…");try{const I=await window.toolboxAPI.connections.getActiveConnection();if(!I)throw new Error("Select a PPTB connection first.");if(!s||new URL(I.url).origin!==new URL(s).origin)throw new Error("Select the PPTB connection for this project’s environment.");const F=K.split(/\s+/u).filter(Boolean).map(pe=>{const me=Dv("%"+Lv(pe)+"%");return`<filter type="or">
9
+ <condition attribute="name" operator="like" value="${me}" />
10
+ <condition attribute="displayname" operator="like" value="${me}" />
11
+ </filter>`}).join(""),{value:ee}=await window.dataverseAPI.retrieveMultiple(`<fetch count="${Ia}" page="${_}">
12
+ <entity name="webresource">
13
+ <attribute name="name" />
14
+ <attribute name="displayname" />
15
+ <order attribute="name" />
16
+ <order attribute="webresourceid" />
17
+ ${F?`<filter type="and">${F}</filter>`:""}
18
+ </entity>
19
+ </fetch>`),ge=new Map;for(const pe of ee.slice(0,Ia))typeof pe.name=="string"&&pe.name&&ge.set(pe.name,{name:pe.name,displayName:typeof pe.displayname=="string"?pe.displayname:void 0});c([...ge.values()]),x(_),T(K),q(ee.length===Ia),m(ge.size?"Page "+_:_>1?"No more results.":"No web resources found.")}catch(I){q(!1),m(I instanceof Error?I.message:String(I))}finally{r.current=!1,v(!1)}}}return B.jsxs("dialog",{ref:n,"aria-labelledby":"resource-picker-title",onCancel:_=>{_.preventDefault(),t()},children:[B.jsxs("div",{className:"section-head",children:[B.jsx("h2",{id:"resource-picker-title",children:"Find a web resource"}),B.jsx("button",{type:"button",onClick:t,children:"Close"})]}),B.jsxs("form",{className:"resource-search",onSubmit:_=>{_.preventDefault(),L(1)},children:[B.jsxs("label",{children:["Search",B.jsx("input",{autoFocus:!0,type:"search",value:l,maxLength:256,disabled:y,onChange:_=>a(_.target.value)})]}),B.jsx("button",{disabled:y,children:l.trim()?"Search":"Browse all"})]}),B.jsx("p",{role:"status",children:d}),h.length>0&&B.jsx("ul",{className:"resource-results",children:h.map(_=>B.jsx("li",{children:B.jsxs("button",{type:"button",onClick:()=>e(_.name),children:[B.jsx("code",{children:_.name}),_.displayName&&_.displayName!==_.name&&B.jsx("span",{children:_.displayName})]})},_.name))}),(k>1||D)&&B.jsxs("div",{className:"actions",children:[B.jsx("button",{type:"button",disabled:y||k<2||l.trim()!==S,onClick:()=>{L(k-1)},children:"Previous"}),B.jsx("button",{type:"button",disabled:y||!D||l.trim()!==S,onClick:()=>{L(k+1)},children:"Next"})]})]})}const Pf=[["HTML","text/html"],["CSS","text/css"],["JavaScript","application/javascript"],["XML / RESX","application/xml"],["PNG","image/png"],["JPEG","image/jpeg"],["GIF","image/gif"],["Silverlight (XAP)","application/x-silverlight-app"],["XSL","application/xslt+xml"],["ICO","image/x-icon"],["SVG","image/svg+xml"]];function Bv({value:s,onChange:e}){const[t,n]=Te.useState(!1),r=s.split(";",1)[0].trim().toLowerCase(),l=Pf.find(([,h])=>h===r),a=t||s!==""&&!l;return B.jsxs("div",{children:[B.jsxs("select",{"aria-label":"Content type",value:a?"custom":l?.[1]??"",onChange:h=>{const c=h.target.value;n(c==="custom"),c!=="custom"&&e(c)},children:[B.jsx("option",{value:"",children:"Auto"}),Pf.map(([h,c])=>B.jsx("option",{value:c,children:h},c)),B.jsx("option",{value:"custom",children:"Custom MIME type…"})]}),a&&B.jsx("input",{"aria-label":"Custom MIME type",placeholder:"application/json",value:s,onChange:h=>e(h.target.value)})]})}let za=[],Rf=[];(()=>{let s="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<s.length;e++)(e%2?Rf:za).push(t=t+s[e])})();function Iv(s){if(s<768)return!1;for(let e=0,t=za.length;;){let n=e+t>>1;if(s<za[n])t=n;else if(s>=Rf[n])e=n+1;else return!0;if(e==t)return!1}}function Df(s){return s>=127462&&s<=127487}const Lf=8205;function zv(s,e,t=!0,n=!0){return(t?Nf:Fv)(s,e,n)}function Nf(s,e,t){if(e==s.length)return e;e&&Bf(s.charCodeAt(e))&&If(s.charCodeAt(e-1))&&e--;let n=Fa(s,e);for(e+=zf(n);e<s.length;){let r=Fa(s,e);if(n==Lf||r==Lf||t&&Iv(r))e+=zf(r),n=r;else if(Df(r)){let l=0,a=e-2;for(;a>=0&&Df(Fa(s,a));)l++,a-=2;if(l%2==0)break;e+=2}else break}return e}function Fv(s,e,t){for(;e>1;){let n=Nf(s,e-2,t);if(n<e)return n;e--}return 0}function Fa(s,e){let t=s.charCodeAt(e);if(!If(t)||e+1==s.length)return t;let n=s.charCodeAt(e+1);return Bf(n)?(t-55296<<10)+(n-56320)+65536:t}function Bf(s){return s>=56320&&s<57344}function If(s){return s>=55296&&s<56320}function zf(s){return s<65536?1:2}class Me{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Zi(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),yn.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Zi(this,e,t);let n=[];return this.decompose(e,t,n,0),yn.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Kr(this),l=new Kr(e);for(let a=t,h=t;;){if(r.next(a),l.next(a),a=0,r.lineBreak!=l.lineBreak||r.done!=l.done||r.value!=l.value)return!1;if(h+=r.value.length,r.done||h>=n)return!0}}iter(e=1){return new Kr(this,e)}iterRange(e,t=this.length){return new _f(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new jf(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?Me.empty:e.length<=32?new Qe(e):yn.from(Qe.split(e,[]))}}class Qe extends Me{constructor(e,t=_v(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let l=0;;l++){let a=this.text[l],h=r+a.length;if((t?n:h)>=e)return new jv(r,h,n,a);r=h+1,n++}}decompose(e,t,n,r){let l=e<=0&&t>=this.length?this:new Qe(Ff(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let a=n.pop(),h=ho(l.text,a.text.slice(),0,l.length);if(h.length<=32)n.push(new Qe(h,a.length+l.length));else{let c=h.length>>1;n.push(new Qe(h.slice(0,c)),new Qe(h.slice(c)))}}else n.push(l)}replace(e,t,n){if(!(n instanceof Qe))return super.replace(e,t,n);[e,t]=Zi(this,e,t);let r=ho(this.text,ho(n.text,Ff(this.text,0,e)),t),l=this.length+n.length-(t-e);return r.length<=32?new Qe(r,l):yn.from(Qe.split(r,[]),l)}sliceString(e,t=this.length,n=`
20
+ `){[e,t]=Zi(this,e,t);let r="";for(let l=0,a=0;l<=t&&a<this.text.length;a++){let h=this.text[a],c=l+h.length;l>e&&a&&(r+=n),e<c&&t>l&&(r+=h.slice(Math.max(0,e-l),t-l)),l=c+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let l of e)n.push(l),r+=l.length+1,n.length==32&&(t.push(new Qe(n,r)),n=[],r=-1);return r>-1&&t.push(new Qe(n,r)),t}}class yn extends Me{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let l=0;;l++){let a=this.children[l],h=r+a.length,c=n+a.lines-1;if((t?c:h)>=e)return a.lineInner(e,t,n,r);r=h+1,n=c+1}}decompose(e,t,n,r){for(let l=0,a=0;a<=t&&l<this.children.length;l++){let h=this.children[l],c=a+h.length;if(e<=c&&t>=a){let d=r&((a<=e?1:0)|(c>=t?2:0));a>=e&&c<=t&&!d?n.push(h):h.decompose(e-a,t-a,n,d)}a=c+1}}replace(e,t,n){if([e,t]=Zi(this,e,t),n.lines<this.lines)for(let r=0,l=0;r<this.children.length;r++){let a=this.children[r],h=l+a.length;if(e>=l&&t<=h){let c=a.replace(e-l,t-l,n),d=this.lines-a.lines+c.lines;if(c.lines<d>>4&&c.lines>d>>6){let m=this.children.slice();return m[r]=c,new yn(m,this.length-(t-e)+n.length)}return super.replace(l,h,c)}l=h+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
21
+ `){[e,t]=Zi(this,e,t);let r="";for(let l=0,a=0;l<this.children.length&&a<=t;l++){let h=this.children[l],c=a+h.length;a>e&&l&&(r+=n),e<c&&t>a&&(r+=h.sliceString(e-a,t-a,n)),a=c+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof yn))return 0;let n=0,[r,l,a,h]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,l+=t){if(r==a||l==h)return n;let c=this.children[r],d=e.children[l];if(c!=d)return n+c.scanIdentical(d,t);n+=c.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let k of e)n+=k.lines;if(n<32){let k=[];for(let x of e)x.flatten(k);return new Qe(k,t)}let r=Math.max(32,n>>5),l=r<<1,a=r>>1,h=[],c=0,d=-1,m=[];function y(k){let x;if(k.lines>l&&k instanceof yn)for(let S of k.children)y(S);else k.lines>a&&(c>a||!c)?(v(),h.push(k)):k instanceof Qe&&c&&(x=m[m.length-1])instanceof Qe&&k.lines+x.lines<=32?(c+=k.lines,d+=k.length+1,m[m.length-1]=new Qe(x.text.concat(k.text),x.length+1+k.length)):(c+k.lines>r&&v(),c+=k.lines,d+=k.length+1,m.push(k))}function v(){c!=0&&(h.push(m.length==1?m[0]:yn.from(m,d)),d=-1,c=m.length=0)}for(let k of e)y(k);return v(),h.length==1?h[0]:new yn(h,t)}}Me.empty=new Qe([""],0);function _v(s){let e=-1;for(let t of s)e+=t.length+1;return e}function ho(s,e,t=0,n=1e9){for(let r=0,l=0,a=!0;l<s.length&&r<=n;l++){let h=s[l],c=r+h.length;c>=t&&(c>n&&(h=h.slice(0,n-r)),r<t&&(h=h.slice(t-r)),a?(e[e.length-1]+=h,a=!1):e.push(h)),r=c+1}return e}function Ff(s,e,t){return ho(s,[""],e,t)}class Kr{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof Qe?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],l=this.offsets[n],a=l>>1,h=r instanceof Qe?r.text.length:r.children.length;if(a==(t>0?h:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((l&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
22
+ `,this;e--}else if(r instanceof Qe){let c=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,c.length>Math.max(0,e))return this.value=e==0?c:t>0?c.slice(e):c.slice(0,c.length-e),this;e-=c.length}else{let c=r.children[a+(t<0?-1:0)];e>c.length?(e-=c.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(c),this.offsets.push(t>0?1:(c instanceof Qe?c.text.length:c.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class _f{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Kr(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class jf{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Me.prototype[Symbol.iterator]=function(){return this.iter()},Kr.prototype[Symbol.iterator]=_f.prototype[Symbol.iterator]=jf.prototype[Symbol.iterator]=function(){return this});class jv{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function Zi(s,e,t){return e=Math.max(0,Math.min(s.length,e)),[e,Math.max(e,Math.min(s.length,t))]}function ct(s,e,t=!0,n=!0){return zv(s,e,t,n)}function Vv(s){return s>=56320&&s<57344}function Hv(s){return s>=55296&&s<56320}function Wv(s,e){let t=s.charCodeAt(e);if(!Hv(t)||e+1==s.length)return t;let n=s.charCodeAt(e+1);return Vv(n)?(t-55296<<10)+(n-56320)+65536:t}function Uv(s){return s<65536?1:2}const _a=/\r\n?|\n/;var At=(function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s})(At||(At={}));class vn{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let l=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,l),r+=l):r+=a,n+=l}}iterChangedRanges(e,t=!1){ja(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new vn(e)}composeDesc(e){return this.empty?e:e.empty?this:Vf(this,e)}mapDesc(e,t=!1){return e.empty?this:Va(this,e,t)}mapPos(e,t=-1,n=At.Simple){let r=0,l=0;for(let a=0;a<this.sections.length;){let h=this.sections[a++],c=this.sections[a++],d=r+h;if(c<0){if(d>e)return l+(e-r);l+=h}else{if(n!=At.Simple&&d>=e&&(n==At.TrackDel&&r<e&&d>e||n==At.TrackBefore&&r<e||n==At.TrackAfter&&d>e))return null;if(d>e||d==e&&t<0&&!h)return e==r||t<0?l:l+c;l+=c}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return l}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let l=this.sections[n++],a=this.sections[n++],h=r+l;if(a>=0&&r<=t&&h>=e)return r<e&&h>t?"cover":!0;r=h}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new vn(e)}static create(e){return new vn(e)}}class et extends vn{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return ja(this,(t,n,r,l,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Va(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,l=0;r<t.length;r+=2){let a=t[r],h=t[r+1];if(h>=0){t[r]=h,t[r+1]=a;let c=r>>1;for(;n.length<c;)n.push(Me.empty);n.push(a?e.slice(l,l+a):Me.empty)}l+=a}return new et(t,n)}compose(e){return this.empty?e:e.empty?this:Vf(this,e,!0)}map(e,t=!1){return e.empty?this:Va(this,e,t,!0)}iterChanges(e,t=!1){ja(this,e,t)}get desc(){return vn.create(this.sections)}filter(e){let t=[],n=[],r=[],l=new Qr(this);e:for(let a=0,h=0;;){let c=a==e.length?1e9:e[a++];for(;h<c||h==c&&l.len==0;){if(l.done)break e;let m=Math.min(l.len,c-h);ft(r,m,-1);let y=l.ins==-1?-1:l.off==0?l.ins:0;ft(t,m,y),y>0&&qn(n,t,l.text),l.forward(m),h+=m}let d=e[a++];for(;h<d;){if(l.done)break e;let m=Math.min(l.len,d-h);ft(t,m,-1),ft(r,m,l.ins==-1?-1:l.off==0?l.ins:0),l.forward(m),h+=m}}return{changes:new et(t,n),filtered:vn.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],l=[],a=0,h=null;function c(m=!1){if(!m&&!r.length)return;a<t&&ft(r,t-a,-1);let y=new et(r,l);h=h?h.compose(y.map(h)):y,r=[],l=[],a=0}function d(m){if(Array.isArray(m))for(let y of m)d(y);else if(m instanceof et){if(m.length!=t)throw new RangeError(`Mismatched change set length (got ${m.length}, expected ${t})`);c(),h=h?h.compose(m.map(h)):m}else{let{from:y,to:v=y,insert:k}=m;if(y>v||y<0||v>t)throw new RangeError(`Invalid change range ${y} to ${v} (in doc of length ${t})`);let x=k?typeof k=="string"?Me.of(k.split(n||_a)):k:Me.empty,S=x.length;if(y==v&&S==0)return;y<a&&c(),y>a&&ft(r,y-a,-1),ft(r,v-y,S),qn(l,r,x),a=v}}return d(e),c(!h),h}static empty(e){return new et(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let l=e[r];if(typeof l=="number")t.push(l,-1);else{if(!Array.isArray(l)||typeof l[0]!="number"||l.some((a,h)=>h&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(l.length==1)t.push(l[0],0);else{for(;n.length<r;)n.push(Me.empty);n[r]=Me.of(l.slice(1)),t.push(l[0],n[r].length)}}}return new et(t,n)}static createSet(e,t){return new et(e,t)}}function ft(s,e,t,n=!1){if(e==0&&t<=0)return;let r=s.length-2;r>=0&&t<=0&&t==s[r+1]?s[r]+=e:r>=0&&e==0&&s[r]==0?s[r+1]+=t:n?(s[r]+=e,s[r+1]+=t):s.push(e,t)}function qn(s,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<s.length)s[s.length-1]=s[s.length-1].append(t);else{for(;s.length<n;)s.push(Me.empty);s.push(t)}}function ja(s,e,t){let n=s.inserted;for(let r=0,l=0,a=0;a<s.sections.length;){let h=s.sections[a++],c=s.sections[a++];if(c<0)r+=h,l+=h;else{let d=r,m=l,y=Me.empty;for(;d+=h,m+=c,c&&n&&(y=y.append(n[a-2>>1])),!(t||a==s.sections.length||s.sections[a+1]<0);)h=s.sections[a++],c=s.sections[a++];e(r,d,l,m,y),r=d,l=m}}}function Va(s,e,t,n=!1){let r=[],l=n?[]:null,a=new Qr(s),h=new Qr(e);for(let c=-1;;){if(a.done&&h.len||h.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&h.ins==-1){let d=Math.min(a.len,h.len);ft(r,d,-1),a.forward(d),h.forward(d)}else if(h.ins>=0&&(a.ins<0||c==a.i||a.off==0&&(h.len<a.len||h.len==a.len&&!t))){let d=h.len;for(ft(r,h.ins,-1);d;){let m=Math.min(a.len,d);a.ins>=0&&c<a.i&&a.len<=m&&(ft(r,0,a.ins),l&&qn(l,r,a.text),c=a.i),a.forward(m),d-=m}h.next()}else if(a.ins>=0){let d=0,m=a.len;for(;m;)if(h.ins==-1){let y=Math.min(m,h.len);d+=y,m-=y,h.forward(y)}else if(h.ins==0&&h.len<m)m-=h.len,h.next();else break;ft(r,d,c<a.i?a.ins:0),l&&c<a.i&&qn(l,r,a.text),c=a.i,a.forward(a.len-m)}else{if(a.done&&h.done)return l?et.createSet(r,l):vn.create(r);throw new Error("Mismatched change set lengths")}}}function Vf(s,e,t=!1){let n=[],r=t?[]:null,l=new Qr(s),a=new Qr(e);for(let h=!1;;){if(l.done&&a.done)return r?et.createSet(n,r):vn.create(n);if(l.ins==0)ft(n,l.len,0,h),l.next();else if(a.len==0&&!a.done)ft(n,0,a.ins,h),r&&qn(r,n,a.text),a.next();else{if(l.done||a.done)throw new Error("Mismatched change set lengths");{let c=Math.min(l.len2,a.len),d=n.length;if(l.ins==-1){let m=a.ins==-1?-1:a.off?0:a.ins;ft(n,c,m,h),r&&m&&qn(r,n,a.text)}else a.ins==-1?(ft(n,l.off?0:l.len,c,h),r&&qn(r,n,l.textBit(c))):(ft(n,l.off?0:l.len,a.off?0:a.ins,h),r&&!a.off&&qn(r,n,a.text));h=(l.ins>c||a.ins>=0&&a.len>c)&&(h||n.length>d),l.forward2(c),a.forward(c)}}}}class Qr{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?Me.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Me.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Yn{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new Yn(n,r,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return H.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return H.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return H.range(e.anchor,e.head)}static create(e,t,n,r){return new Yn(e,t,n,r)}}class H{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:H.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new H([this.main],0)}addRange(e,t=!0){return H.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,H.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new H(e.ranges.map(t=>Yn.fromJSON(t)),e.main)}static single(e,t=e){return new H([H.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let l=e[r];if(l.empty?l.from<=n:l.from<n)return H.normalized(e.slice(),t);n=l.to}return new H(e,t)}static cursor(e,t=0,n,r){return Yn.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,l){let a=r==null?7:Math.min(6,r);return!l&&e!=t&&(l=t<e?1:-1),l&&(a|=l<0?8:16),t<e?Yn.create(t,e,a|32,n):Yn.create(e,t,a,n)}static undirectionalRange(e,t){return Yn.create(e,t,64,void 0)}static normalized(e,t=0){let n=e[t];e.sort((r,l)=>r.from-l.from),t=e.indexOf(n);for(let r=1;r<e.length;r++){let l=e[r],a=e[r-1];if(l.empty?l.from<=a.to:l.from<a.to){let h=a.from,c=Math.max(l.to,a.to);r<=t&&t--,e.splice(--r,2,l.anchor>l.head?H.range(c,h):H.range(h,c))}}return new H(e,t)}}function Hf(s,e){for(let t of s.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ha=0;class te{constructor(e,t,n,r,l){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Ha++,this.default=e([]),this.extensions=typeof l=="function"?l(this):l}get reader(){return this}static define(e={}){return new te(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Wa),!!e.static,e.enables)}of(e){return new co([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new co(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new co(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Wa(s,e){return s==e||s.length==e.length&&s.every((t,n)=>t===e[n])}class co{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Ha++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,l=this.id,a=e[l]>>1,h=this.type==2,c=!1,d=!1,m=[];for(let y of this.dependencies)y=="doc"?c=!0:y=="selection"?d=!0:(((t=e[y.id])!==null&&t!==void 0?t:1)&1)==0&&m.push(e[y.id]);return{create(y){return y.values[a]=n(y),1},update(y,v){if(c&&v.docChanged||d&&(v.docChanged||v.selection)||Ua(y,m)){let k=n(y);if(h?!Wf(k,y.values[a],r):!r(k,y.values[a]))return y.values[a]=k,1}return 0},reconfigure:(y,v)=>{let k,x=v.config.address[l];if(x!=null){let S=mo(v,x);if(this.dependencies.every(T=>T instanceof te?v.facet(T)===y.facet(T):T instanceof Ht?v.field(T,!1)==y.field(T,!1):!0)||(h?Wf(k=n(y),S,r):r(k=n(y),S)))return y.values[a]=S,0}else k=n(y);return y.values[a]=k,1}}}get extension(){return this}}function Wf(s,e,t){if(s.length!=e.length)return!1;for(let n=0;n<s.length;n++)if(!t(s[n],e[n]))return!1;return!0}function Ua(s,e){let t=!1;for(let n of e)Yr(s,n)&1&&(t=!0);return t}function $v(s,e,t){let n=t.map(c=>s[c.id]),r=t.map(c=>c.type),l=n.filter(c=>!(c&1)),a=s[e.id]>>1;function h(c){let d=[];for(let m=0;m<n.length;m++){let y=mo(c,n[m]);if(r[m]==2)for(let v of y)d.push(v);else d.push(y)}return e.combine(d)}return{create(c){for(let d of n)Yr(c,d);return c.values[a]=h(c),1},update(c,d){if(!Ua(c,l))return 0;let m=h(c);return e.compare(m,c.values[a])?0:(c.values[a]=m,1)},reconfigure(c,d){let m=Ua(c,n),y=d.config.facets[e.id],v=d.facet(e);if(y&&!m&&Wa(t,y))return c.values[a]=v,0;let k=h(c);return e.compare(k,v)?(c.values[a]=v,0):(c.values[a]=k,1)}}}const fo=te.define({static:!0});class Ht{constructor(e,t,n,r,l){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=l,this.provides=void 0}static define(e){let t=new Ht(Ha++,e.create,e.update,e.compare||((n,r)=>n===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(fo).find(n=>n.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,r)=>{let l=n.values[t],a=this.updateF(l,r);return this.compareF(l,a)?0:(n.values[t]=a,1)},reconfigure:(n,r)=>{let l=n.facet(fo),a=r.facet(fo),h;return(h=l.find(c=>c.field==this))&&h!=a.find(c=>c.field==this)?(n.values[t]=h.create(n),1):r.config.address[this.id]!=null?(n.values[t]=r.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,fo.of({field:this,create:e})]}get extension(){return this}}const Oi={lowest:4,low:3,default:2,high:1,highest:0};function Gr(s){return e=>new Uf(e,s)}const $a={highest:Gr(Oi.highest),high:Gr(Oi.high),default:Gr(Oi.default),low:Gr(Oi.low),lowest:Gr(Oi.lowest)};class Uf{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class qr{of(e){return new Ka(this,e)}reconfigure(e){return qr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ka{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class po{constructor(e,t,n,r,l,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=l,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let r=[],l=Object.create(null),a=new Map;for(let v of Kv(e,t,a))v instanceof Ht?r.push(v):(l[v.facet.id]||(l[v.facet.id]=[])).push(v);let h=Object.create(null),c=[],d=[];for(let v of r)h[v.id]=d.length<<1,d.push(k=>v.slot(k));let m=n?.config.facets;for(let v in l){let k=l[v],x=k[0].facet,S=m&&m[v]||[];if(k.every(T=>T.type==0))if(h[x.id]=c.length<<1|1,Wa(S,k))c.push(n.facet(x));else{let T=x.combine(k.map(D=>D.value));c.push(n&&x.compare(T,n.facet(x))?n.facet(x):T)}else{for(let T of k)T.type==0?(h[T.id]=c.length<<1|1,c.push(T.value)):(h[T.id]=d.length<<1,d.push(D=>T.dynamicSlot(D)));h[x.id]=d.length<<1,d.push(T=>$v(T,x,k))}}let y=d.map(v=>v(h));return new po(e,a,y,h,c,l)}}function Kv(s,e,t){let n=[[],[],[],[],[]],r=new Map;function l(a,h){let c=r.get(a);if(c!=null){if(c<=h)return;let d=n[c].indexOf(a);d>-1&&n[c].splice(d,1),a instanceof Ka&&t.delete(a.compartment)}if(r.set(a,h),Array.isArray(a))for(let d of a)l(d,h);else if(a instanceof Ka){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;t.set(a.compartment,d),l(d,h)}else if(a instanceof Uf)l(a.inner,a.prec);else if(a instanceof Ht)n[h].push(a),a.provides&&l(a.provides,h);else if(a instanceof co)n[h].push(a),a.facet.extensions&&l(a.facet.extensions,Oi.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(d==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);l(d,h)}}return l(s,Oi.default),n.reduce((a,h)=>a.concat(h))}function Yr(s,e){if(e&1)return 2;let t=e>>1,n=s.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;s.status[t]=4;let r=s.computeSlot(s,s.config.dynamicSlots[t]);return s.status[t]=2|r}function mo(s,e){return e&1?s.config.staticValues[e>>1]:s.values[e>>1]}const $f=te.define(),Qa=te.define({combine:s=>s.some(e=>e),static:!0}),Kf=te.define({combine:s=>s.length?s[0]:void 0,static:!0}),Qf=te.define(),Gf=te.define(),qf=te.define(),Yf=te.define({combine:s=>s.length?s[0]:!1});class Bn{constructor(e,t){this.type=e,this.value=t}static define(){return new Qv}}class Qv{of(e){return new Bn(this,e)}}class Gv{constructor(e){this.map=e}of(e){return new Le(this,e)}}class Le{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Le(this.type,t)}is(e){return this.type==e}static define(e={}){return new Gv(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let l=r.map(t);l&&n.push(l)}return n}}Le.reconfigure=Le.define(),Le.appendConfig=Le.define();class Je{constructor(e,t,n,r,l,a){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=l,this.scrollIntoView=a,this._doc=null,this._state=null,n&&Hf(n,t.newLength),l.some(h=>h.type==Je.time)||(this.annotations=l.concat(Je.time.of(Date.now())))}static create(e,t,n,r,l,a){return new Je(e,t,n,r,l,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(Je.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}Je.time=Bn.define(),Je.userEvent=Bn.define(),Je.addToHistory=Bn.define(),Je.remote=Bn.define();function qv(s,e){let t=[];for(let n=0,r=0;;){let l,a;if(n<s.length&&(r==e.length||e[r]>=s[n]))l=s[n++],a=s[n++];else if(r<e.length)l=e[r++],a=e[r++];else return t;!t.length||t[t.length-1]<l?t.push(l,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function Xf(s,e,t){var n;let r,l,a;return t?(r=e.changes,l=et.empty(e.changes.length),a=s.changes.compose(e.changes)):(r=e.changes.map(s.changes),l=s.changes.mapDesc(e.changes,!0),a=s.changes.compose(r)),{changes:a,selection:e.selection?e.selection.map(l):(n=s.selection)===null||n===void 0?void 0:n.map(r),effects:Le.mapEffects(s.effects,r).concat(Le.mapEffects(e.effects,l)),annotations:s.annotations.length?s.annotations.concat(e.annotations):e.annotations,scrollIntoView:s.scrollIntoView||e.scrollIntoView}}function Ga(s,e,t){let n=e.selection,r=er(e.annotations);return e.userEvent&&(r=r.concat(Je.userEvent.of(e.userEvent))),{changes:e.changes instanceof et?e.changes:et.of(e.changes||[],t,s.facet(Kf)),selection:n&&(n instanceof H?n:H.single(n.anchor,n.head)),effects:er(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Jf(s,e,t){let n=Ga(s,e.length?e[0]:{},s.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let l=1;l<e.length;l++){e[l].filter===!1&&(t=!1);let a=!!e[l].sequential;n=Xf(n,Ga(s,e[l],a?n.changes.newLength:s.doc.length),a)}let r=Je.create(s,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return Xv(t?Yv(r):r)}function Yv(s){let e=s.startState,t=!0;for(let r of e.facet(Qf)){let l=r(s);if(l===!1){t=!1;break}Array.isArray(l)&&(t=t===!0?l:qv(t,l))}if(t!==!0){let r,l;if(t===!1)l=s.changes.invertedDesc,r=et.empty(e.doc.length);else{let a=s.changes.filter(t);r=a.changes,l=a.filtered.mapDesc(a.changes).invertedDesc}s=Je.create(e,r,s.selection&&s.selection.map(l),Le.mapEffects(s.effects,l),s.annotations,s.scrollIntoView)}let n=e.facet(Gf);for(let r=n.length-1;r>=0;r--){let l=n[r](s);l instanceof Je?s=l:Array.isArray(l)&&l.length==1&&l[0]instanceof Je?s=l[0]:s=Jf(e,er(l),!1)}return s}function Xv(s){let e=s.startState,t=e.facet(qf),n=s;for(let r=t.length-1;r>=0;r--){let l=t[r](s);l&&Object.keys(l).length&&(n=Xf(n,Ga(e,l,s.changes.newLength),!0))}return n==s?s:Je.create(e,s.changes,s.selection,n.effects,n.annotations,n.scrollIntoView)}const Jv=[];function er(s){return s==null?Jv:Array.isArray(s)?s:[s]}var In=(function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s})(In||(In={}));const Zv=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let qa;try{qa=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function e1(s){if(qa)return qa.test(s);for(let e=0;e<s.length;e++){let t=s[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||Zv.test(t)))return!0}return!1}function t1(s){return e=>{if(!/\S/.test(e))return In.Space;if(e1(e))return In.Word;for(let t=0;t<s.length;t++)if(e.indexOf(s[t])>-1)return In.Word;return In.Other}}class Oe{constructor(e,t,n,r,l,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=l,a&&(a._state=this);for(let h=0;h<this.config.dynamicSlots.length;h++)Yr(this,h<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Yr(this,n),mo(this,n)}update(...e){return Jf(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:r}=t;for(let h of e.effects)h.is(qr.reconfigure)?(t&&(r=new Map,t.compartments.forEach((c,d)=>r.set(d,c)),t=null),r.set(h.value.compartment,h.value.extension)):h.is(Le.reconfigure)?(t=null,n=h.value):h.is(Le.appendConfig)&&(t=null,n=er(n).concat(h.value));let l;t?l=e.startState.values.slice():(t=po.resolve(n,r,this),l=new Oe(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(c,d)=>d.reconfigure(c,this),null).values);let a=e.startState.facet(Qa)?e.newSelection:e.newSelection.asSingle();new Oe(t,e.newDoc,a,l,(h,c)=>c.update(h,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:H.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),l=[n.range],a=er(n.effects);for(let h=1;h<t.ranges.length;h++){let c=e(t.ranges[h]),d=this.changes(c.changes),m=d.map(r);for(let v=0;v<h;v++)l[v]=l[v].map(m);let y=r.mapDesc(d,!0);l.push(c.range.map(y)),r=r.compose(m),a=Le.mapEffects(a,m).concat(Le.mapEffects(er(c.effects),y))}return{changes:r,selection:H.create(l,t.mainIndex),effects:a}}changes(e=[]){return e instanceof et?e:et.of(e,this.doc.length,this.facet(Oe.lineSeparator))}toText(e){return Me.of(e.split(this.facet(Oe.lineSeparator)||_a))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Yr(this,t),mo(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Ht&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let l in n)if(Object.prototype.hasOwnProperty.call(e,l)){let a=n[l],h=e[l];r.push(a.init(c=>a.spec.fromJSON(h,c)))}}return Oe.create({doc:e.doc,selection:H.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=po.resolve(e.extensions||[],new Map),n=e.doc instanceof Me?e.doc:Me.of((e.doc||"").split(t.staticFacet(Oe.lineSeparator)||_a)),r=e.selection?e.selection instanceof H?e.selection:H.single(e.selection.anchor,e.selection.head):H.single(0);return Hf(r,n.length),t.staticFacet(Qa)||(r=r.asSingle()),new Oe(t,n,r,t.dynamicSlots.map(()=>null),(l,a)=>a.create(l),null)}get tabSize(){return this.facet(Oe.tabSize)}get lineBreak(){return this.facet(Oe.lineSeparator)||`
23
+ `}get readOnly(){return this.facet(Yf)}phrase(e,...t){for(let n of this.facet(Oe.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let l=+(r||1);return!l||l>t.length?n:t[l-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let l of this.facet($f))for(let a of l(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return t1(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),l=this.charCategorizer(e),a=e-n,h=e-n;for(;a>0;){let c=ct(t,a,!1);if(l(t.slice(c,a))!=In.Word)break;a=c}for(;h<r;){let c=ct(t,h);if(l(t.slice(h,c))!=In.Word)break;h=c}return a==h?null:H.range(a+n,h+n)}}Oe.allowMultipleSelections=Qa,Oe.tabSize=te.define({combine:s=>s.length?s[0]:4}),Oe.lineSeparator=Kf,Oe.readOnly=Yf,Oe.phrases=te.define({compare(s,e){let t=Object.keys(s),n=Object.keys(e);return t.length==n.length&&t.every(r=>s[r]==e[r])}}),Oe.languageData=$f,Oe.changeFilter=Qf,Oe.transactionFilter=Gf,Oe.transactionExtender=qf,qr.reconfigure=Le.define();function Xr(s,e,t={}){let n={};for(let r of s)for(let l of Object.keys(r)){let a=r[l],h=n[l];if(h===void 0)n[l]=a;else if(!(h===a||a===void 0))if(Object.hasOwnProperty.call(t,l))n[l]=t[l](h,a);else throw new Error("Config merge conflict for field "+l)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}class Ei{eq(e){return this==e}range(e,t=e){return Xa.create(e,t,this)}}Ei.prototype.startSide=Ei.prototype.endSide=0,Ei.prototype.point=!1,Ei.prototype.mapMode=At.TrackDel;function Ya(s,e){return s==e||s.constructor==e.constructor&&s.eq(e)}let Xa=class xv{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new xv(e,t,n)}};function Ja(s,e){return s.from-e.from||s.value.startSide-e.value.startSide}class Za{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return tr(this.to)}findIndex(e,t,n,r=0){let l=n?this.to:this.from;for(let a=r,h=l.length;;){if(a==h)return a;let c=a+h>>1,d=l[c]-e||(n?this.value[c].endSide:this.value[c].startSide)-t;if(c==a)return d>=0?a:h;d>=0?h=c:a=c+1}}between(e,t,n,r){for(let l=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,l);l<a;l++)if(r(this.from[l]+e,this.to[l]+e,this.value[l])===!1)return!1}map(e,t,n,r,l){let a=[],h=[],c=[],d=-1,m=-1;e:for(let y=0;y<this.value.length;y++){let v=this.value[y],k=this.from[y]+e,x=this.to[y]+e,S,T;if(k==x){let D=t.mapPos(k,v.startSide,v.mapMode);if(D==null||(S=T=D,v.startSide!=v.endSide&&(T=t.mapPos(k,v.endSide),T<S)))continue}else if(S=t.mapPos(k,v.startSide),T=t.mapPos(x,v.endSide),S>T||S==T&&v.startSide>0&&v.endSide<=0)continue;if(!((T-S||v.endSide-v.startSide)<0))if(d<0&&(d=S),v.point&&(m=Math.max(m,T-S)),(S-n||v.startSide-r)>=0)a.push(v),h.push(S-d),c.push(T-d),n=T,r=v.endSide;else{if(S==T)for(let D=a.length;D>0;D--){if((S-(c[D-1]+d)||v.startSide-a[D-1].endSide)>=0){a.splice(D,0,v),h.splice(D,0,S-d),c.splice(D,0,T-d);continue e}if((S-(h[D-1]+d)||v.endSide-a[D-1].startSide)>0)break}l(S,T,v)}}return{mapped:a.length?new Za(h,c,a,m):null,pos:d}}}class be{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new be(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:l=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(n&&(t=t.slice().sort(Ja)),this.isEmpty)return t.length?be.of(t):this;let h=new ed(this,null,-1).goto(0),c=0,d=[],m=new Pi;for(;h.value||c<t.length;)if(c<t.length&&(h.from-t[c].from||h.startSide-t[c].value.startSide)>=0){let y=t[c++];m.addInner(y.from,y.to,y.value,!1)||d.push(y)}else h.rangeIndex==1&&h.chunkIndex<this.chunk.length&&(c==t.length||this.chunkEnd(h.chunkIndex)<t[c].from)&&(!a||r>this.chunkEnd(h.chunkIndex)||l<this.chunkPos[h.chunkIndex])&&m.addChunk(this.chunkPos[h.chunkIndex],this.chunk[h.chunkIndex])?h.nextChunk():((!a||r>h.to||l<h.from||a(h.from,h.to,h.value))&&(m.addInner(h.from,h.to,h.value,!1)||d.push(Xa.create(h.from,h.to,h.value))),h.next());return m.finishInner(this.nextLayer.isEmpty&&!d.length?be.empty:this.nextLayer.update({add:d,filter:a,filterFrom:r,filterTo:l}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1,l,a=(c,d,m)=>{l||(l=new Pi),l.addRange(c,d,m,!1)};for(let c=0;c<this.chunk.length;c++){let d=this.chunkPos[c],m=this.chunk[c],y=e.touchesRange(d,d+m.length);if(y===!1)r=Math.max(r,m.maxPoint),t.push(m),n.push(e.mapPos(d));else if(y===!0){let[v,k]=t.length?[tr(n)+tr(t).length,tr(tr(t).value).endSide]:[-1,-1],{mapped:x,pos:S}=m.map(d,e,v,k,a);x&&(r=Math.max(r,x.maxPoint),t.push(x),n.push(S))}}let h=this.nextLayer.map(e);return l&&(h=l.finishInner(h)),t.length==0?h:new be(n,t,h||be.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let l=this.chunkPos[r],a=this.chunk[r];if(t>=l&&e<=l+a.length&&a.between(l,e-l,t-l,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Jr.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Jr.from(e).goto(t)}static compare(e,t,n,r,l=-1){let a=e.filter(y=>y.maxPoint>0||!y.isEmpty&&y.maxPoint>=l),h=t.filter(y=>y.maxPoint>0||!y.isEmpty&&y.maxPoint>=l),c=Zf(a,h,n),d=new Zr(a,c,l),m=new Zr(h,c,l);n.iterGaps((y,v,k)=>td(d,y,m,v,k,r)),n.empty&&n.length==0&&td(d,0,m,0,0,r)}static eq(e,t,n=0,r){r==null&&(r=999999999);let l=e.filter(m=>!m.isEmpty&&t.indexOf(m)<0),a=t.filter(m=>!m.isEmpty&&e.indexOf(m)<0);if(l.length!=a.length)return!1;if(!l.length)return!0;let h=Zf(l,a),c=new Zr(l,h,0).goto(n),d=new Zr(a,h,0).goto(n);for(;;){if(c.to!=d.to||!tu(c.active,d.active)||c.point&&(!d.point||!Ya(c.point,d.point)))return!1;if(c.to>r)return!0;c.next(),d.next()}}static spans(e,t,n,r,l=-1){let a=new Zr(e,null,l).goto(t),h=t,c=a.openStart;for(;;){let d=Math.min(a.to,n);if(a.point){let m=a.activeForPoint(a.to),y=a.pointFrom<t?m.length+1:a.point.startSide<0?m.length:Math.min(m.length,c);r.point(h,d,a.point,m,y,a.pointRank),c=Math.min(a.openEnd(d),m.length)}else d>h&&(r.span(h,d,a.active,c),c=a.openEnd(d));if(a.to>n)return c+(a.point&&a.to>n?1:0);h=a.to,a.next()}}static of(e,t=!1){let n=new Pi;for(let r of e instanceof Xa?[e]:t?n1(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return be.empty;let t=tr(e);for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=be.empty;r=r.nextLayer)t=new be(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}be.empty=new be([],[],null,-1);function tr(s){return s[s.length-1]}function n1(s){if(s.length>1)for(let e=s[0],t=1;t<s.length;t++){let n=s[t];if(Ja(e,n)>0)return s.slice().sort(Ja);e=n}return s}be.empty.nextLayer=be.empty;class Pi{finishChunk(e){this.chunks.push(new Za(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addRange(e,t,n,!0)}addRange(e,t,n,r){this.addInner(e,t,n,r)||(this.nextLayer||(this.nextLayer=new Pi)).addRange(e,t,n,r)}addInner(e,t,n,r){let l=e-this.lastTo||n.startSide-this.last.endSide;if(r&&l<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return l<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(be.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=be.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Zf(s,e,t){let n=new Map;for(let l of s)for(let a=0;a<l.chunk.length;a++)l.chunk[a].maxPoint<=0&&n.set(l.chunk[a],l.chunkPos[a]);let r=new Set;for(let l of e)for(let a=0;a<l.chunk.length;a++){let h=n.get(l.chunk[a]);h!=null&&(t?t.mapPos(h):h)==l.chunkPos[a]&&!t?.touchesRange(h,h+l.chunk[a].length)&&r.add(l.chunk[a])}return r}class ed{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Jr{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let l=0;l<e.length;l++)for(let a=e[l];!a.isEmpty;a=a.nextLayer)a.maxPoint>=n&&r.push(new ed(a,t,n,l));return r.length==1?r[0]:new Jr(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)eu(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)eu(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),eu(this.heap,0)}}}function eu(s,e){for(let t=s[e];;){let n=(e<<1)+1;if(n>=s.length)break;let r=s[n];if(n+1<s.length&&r.compare(s[n+1])>=0&&(r=s[n+1],n++),t.compare(r)<0)break;s[n]=t,s[e]=r,e=n}}class Zr{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Jr.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){go(this.active,e),go(this.activeTo,e),go(this.activeRank,e),this.minActive=nd(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:l}=this.cursor;for(;t<this.activeRank.length&&(l-this.activeRank[t]||r-this.activeTo[t])>0;)t++;yo(this.active,t,n),yo(this.activeTo,t,r),yo(this.activeRank,t,l),e&&yo(e,t,this.cursor.from),this.minActive=nd(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&go(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let l=this.cursor.value;if(!l.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=l,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=l.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let r=n.length-1;r>=0&&n[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function td(s,e,t,n,r,l){s.goto(e),t.goto(n);let a=n+r,h=n,c=n-e,d=!!l.boundChange;for(let m=!1;;){let y=s.to+c-t.to,v=y||s.endSide-t.endSide,k=v<0?s.to+c:t.to,x=Math.min(k,a);if(s.point||t.point?(s.point&&t.point&&Ya(s.point,t.point)&&tu(s.activeForPoint(s.to),t.activeForPoint(t.to))||l.comparePoint(h,x,s.point,t.point),m=!1):(m&&(l.boundChange(h),m=!1),x>h&&!tu(s.active,t.active)&&l.compareRange(h,x,s.active,t.active),d&&x<a&&(y||s.openEnd(k)!=t.openEnd(k))&&(m=!0)),k>a)break;h=k,v<=0&&s.next(),v>=0&&t.next()}}function tu(s,e){if(s.length!=e.length)return!1;for(let t=0;t<s.length;t++)if(s[t]!=e[t]&&!Ya(s[t],e[t]))return!1;return!0}function go(s,e){for(let t=e,n=s.length-1;t<n;t++)s[t]=s[t+1];s.pop()}function yo(s,e,t){for(let n=s.length-1;n>=e;n--)s[n+1]=s[n];s[e]=t}function nd(s,e){let t=-1,n=1e9;for(let r=0;r<e.length;r++)(e[r]-n||s[r].endSide-s[t].endSide)<0&&(t=r,n=e[r]);return t}function vo(s,e,t=s.length){let n=0;for(let r=0;r<t&&r<s.length;)s.charCodeAt(r)==9?(n+=e-n%e,r++):(n++,r=ct(s,r));return n}function i1(s,e,t,n){for(let r=0,l=0;;){if(l>=e)return r;if(r==s.length)break;l+=s.charCodeAt(r)==9?t-l%t:1,r=ct(s,r)}return s.length}const nu="ͼ",id=typeof Symbol>"u"?"__"+nu:Symbol.for(nu),iu=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),rd=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Xn{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(l,a,h,c){let d=[],m=/^@(\w+)\b/.exec(l[0]),y=m&&m[1]=="keyframes";if(m&&a==null)return h.push(l[0]+";");for(let v in a){let k=a[v];if(/&/.test(v))r(v.split(/,\s*/).map(x=>l.map(S=>x.replace(/&/,S))).reduce((x,S)=>x.concat(S)),k,h);else if(k&&typeof k=="object"){if(!m)throw new RangeError("The value of a property ("+v+") should be a primitive value.");r(sd(v),k,d,y)}else k!=null&&(/^--/.test(v)||(v=v.replace(/_.*/,"").replace(/[A-Z]/g,x=>"-"+x.toLowerCase())),d.push(v+": "+k+";"))}(d.length||y)&&h.push((n&&!m&&!c?l.map(n):l).join(", ")+" {"+d.join(" ")+"}")}for(let l in e)r(sd(l),e[l],this.rules)}getRules(){return this.rules.join(`
24
+ `)}static newName(){let e=rd[id]||1;return rd[id]=e+1,nu+e.toString(36)}static mount(e,t,n){let r=e[iu],l=n&&n.nonce;r?l&&r.setNonce(l):r=new r1(e,l),r.mount(Array.isArray(t)?t:[t],e)}}function sd(s){if(/^@/.test(s))return[s];let e=[],t=0,n=null,r=0,l=0;for(let a=0;a<s.length;a++){let h=s[a];h=="\\"?a++:h=='"'||h=="'"?h==n?n=!1:n||(n=h):(h=="["||h=="(")&&!n?t++:(h=="]"||h==")")&&!n?t--:h==","&&!t&&!n&&(e.push(s.slice(l,r)),l=a+1),/\S/.test(h)?r=a+1:a==l&&l++}return e.push(s.slice(l,r)),e}let od=new Map;class r1{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let l=od.get(n);if(l)return e[iu]=l;this.sheet=new r.CSSStyleSheet,od.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[iu]=this}mount(e,t){let n=this.sheet,r=0,l=0,a=!1;for(let h=0;h<e.length;h++){let c=e[h],d=this.modules.indexOf(c);if(d<l&&d>-1&&(this.modules.splice(d,1),a=!0,l--,d=-1),d==-1){if(this.modules.splice(l++,0,c),a=!0,n)for(let m=0;m<c.rules.length;m++)n.insertRule(c.rules[m],r++)}else{for(;l<d;)r+=this.modules[l++].rules.length;r+=c.rules.length,l++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let c="";for(let d=0;d<this.modules.length;d++)c+=this.modules[d].getRules()+`
25
+ `;this.styleTag.textContent=c}let h=t.head||t;this.styleTag.parentNode!=h&&h.insertBefore(this.styleTag,h.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Jn={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:"'"},es={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},s1=typeof navigator<"u"&&/Mac/.test(navigator.platform),o1=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),lt=0;lt<10;lt++)Jn[48+lt]=Jn[96+lt]=String(lt);for(var lt=1;lt<=24;lt++)Jn[lt+111]="F"+lt;for(var lt=65;lt<=90;lt++)Jn[lt]=String.fromCharCode(lt+32),es[lt]=String.fromCharCode(lt);for(var ru in Jn)es.hasOwnProperty(ru)||(es[ru]=Jn[ru]);function l1(s){var e=s1&&s.metaKey&&s.shiftKey&&!s.ctrlKey&&!s.altKey||o1&&s.shiftKey&&s.key&&s.key.length==1||s.key=="Unidentified",t=!e&&s.key||(s.shiftKey?es:Jn)[s.keyCode]||s.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function wn(){var s=arguments[0];typeof s=="string"&&(s=document.createElement(s));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=t[n];typeof r=="string"?s.setAttribute(n,r):r!=null&&(s[n]=r)}e++}for(;e<arguments.length;e++)ld(s,arguments[e]);return s}function ld(s,e){if(typeof e=="string")s.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)s.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)ld(s,e[t]);else throw new RangeError("Unsupported child node: "+e)}let kt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},su=typeof document<"u"?document:{documentElement:{style:{}}};const ou=/Edge\/(\d+)/.exec(kt.userAgent),ad=/MSIE \d/.test(kt.userAgent),lu=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(kt.userAgent),wo=!!(ad||lu||ou),ud=!wo&&/gecko\/(\d+)/i.test(kt.userAgent),au=!wo&&/Chrome\/(\d+)/.exec(kt.userAgent),hd="webkitFontSmoothing"in su.documentElement.style,uu=!wo&&/Apple Computer/.test(kt.vendor),cd=uu&&(/Mobile\/\w+/.test(kt.userAgent)||kt.maxTouchPoints>2);var Y={mac:cd||/Mac/.test(kt.platform),windows:/Win/.test(kt.platform),linux:/Linux|X11/.test(kt.platform),ie:wo,ie_version:ad?su.documentMode||6:lu?+lu[1]:ou?+ou[1]:0,gecko:ud,gecko_version:ud?+(/Firefox\/(\d+)/.exec(kt.userAgent)||[0,0])[1]:0,chrome:!!au,chrome_version:au?+au[1]:0,ios:cd,android:/Android\b/.test(kt.userAgent),webkit:hd,webkit_version:hd?+(/\bAppleWebKit\/(\d+)/.exec(kt.userAgent)||[0,0])[1]:0,safari:uu,safari_version:uu?+(/\bVersion\/(\d+(\.\d+)?)/.exec(kt.userAgent)||[0,0])[1]:0,tabSize:su.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function hu(s,e){for(let t in s)t=="class"&&e.class?e.class+=" "+s.class:t=="style"&&e.style?e.style+=";"+s.style:e[t]=s[t];return e}const ko=Object.create(null);function cu(s,e,t){if(s==e)return!0;s||(s=ko),e||(e=ko);let n=Object.keys(s),r=Object.keys(e);if(n.length-0!=r.length-0)return!1;for(let l of n)if(l!=t&&(r.indexOf(l)==-1||s[l]!==e[l]))return!1;return!0}function a1(s,e){for(let t=s.attributes.length-1;t>=0;t--){let n=s.attributes[t].name;e[n]==null&&s.removeAttribute(n)}for(let t in e){let n=e[t];t=="style"?s.style.cssText=n:s.getAttribute(t)!=n&&s.setAttribute(t,n)}}function fd(s,e,t){let n=!1;if(e)for(let r in e)t&&r in t||(n=!0,r=="style"?s.style.cssText="":s.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(n=!0,r=="style"?s.style.cssText=t[r]:s.setAttribute(r,t[r]));return n}function u1(s){let e=Object.create(null);for(let t=0;t<s.attributes.length;t++){let n=s.attributes[t];e[n.name]=n.value}return e}class ts{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Tt=(function(s){return s[s.Text=0]="Text",s[s.WidgetBefore=1]="WidgetBefore",s[s.WidgetAfter=2]="WidgetAfter",s[s.WidgetRange=3]="WidgetRange",s})(Tt||(Tt={}));class Re extends Ei{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new ns(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ri(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:l,end:a}=dd(e,t);n=(l?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new Ri(e,n,r,t,e.widget||null,!0)}static line(e){return new is(e)}static set(e,t=!1){return be.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Re.none=be.empty;class ns extends Re{constructor(e){let{start:t,end:n}=dd(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?hu(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||ko}eq(e){return this==e||e instanceof ns&&this.tagName==e.tagName&&cu(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}ns.prototype.point=!1;class is extends Re{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof is&&this.spec.class==e.spec.class&&cu(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}is.prototype.mapMode=At.TrackBefore,is.prototype.point=!0;class Ri extends Re{constructor(e,t,n,r,l,a){super(t,n,l,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?At.TrackBefore:At.TrackAfter:At.TrackDel}get type(){return this.startSide!=this.endSide?Tt.WidgetRange:this.startSide<=0?Tt.WidgetBefore:Tt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ri&&h1(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Ri.prototype.point=!0;function dd(s,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=s;return t==null&&(t=s.inclusive),n==null&&(n=s.inclusive),{start:t??e,end:n??e}}function h1(s,e){return s==e||!!(s&&e&&s.compare(e))}function nr(s,e,t,n=0){let r=t.length-1;r>=0&&t[r]+n>=s?t[r]=Math.max(t[r],e):t.push(s,e)}class rs extends Ei{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(e){return e==this||e instanceof rs&&this.tagName==e.tagName&&cu(this.attributes,e.attributes)}static create(e){return new rs(e.tagName,e.attributes||ko,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return be.of(e,t)}}rs.prototype.startSide=rs.prototype.endSide=-1;const it=s=>s.nodeType==1,ir=s=>s.nodeType==3;function ss(s){let e;return s.nodeType==11?e=s.getSelection?s:s.ownerDocument:e=s,e.getSelection()}function fu(s,e){return e?s==e||s.contains(e.nodeType!=1?e.parentNode:e):!1}function os(s,e){if(!e.anchorNode)return!1;try{return fu(s,e.anchorNode)}catch{return!1}}function xo(s){return ir(s)?as(s,0,s.nodeValue.length).getClientRects():it(s)?s.getClientRects():[]}function ls(s,e,t,n){return t?pd(s,e,t,n,-1)||pd(s,e,t,n,1):!1}function Zn(s){for(var e=0;;e++)if(s=s.previousSibling,!s)return e}function rr(s){return it(s)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(s.nodeName)}function pd(s,e,t,n,r){for(;;){if(s==t&&e==n)return!0;if(e==(r<0?0:zn(s))){if(s.nodeName=="DIV")return!1;let l=s.parentNode;if(!l||!it(l))return!1;e=Zn(s)+(r<0?0:1),s=l}else if(it(s)){if(s=s.childNodes[e+(r<0?-1:0)],it(s)&&(s.nodeName=="IMG"||s.nodeName=="BR"||s.contentEditable=="false"))return!1;e=r<0?zn(s):0}else return!1}}function zn(s){return ir(s)?s.nodeValue.length:s.childNodes.length}function So(s,e){let{left:t,right:n}=s;if(t==n)return s;let r=e?t:n;return{left:r,right:r,top:s.top,bottom:s.bottom}}function du(s,e){let{left:t,right:n,top:r,bottom:l}=s;for(let a of e)a.left!=null&&(t=Math.max(t,a.left)),a.right!=null&&(n=Math.min(n,a.right)),a.top!=null&&(r=Math.max(r,a.top)),a.bottom!=null&&(l=Math.min(l,a.bottom));return{left:t,right:n,top:r,bottom:l}}function c1(s){let e=s.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:s.innerWidth,top:0,bottom:s.innerHeight}}function md(s,e){let t=e.width/s.offsetWidth,n=e.height/s.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-s.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-s.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function f1(s,e,t,n,r,l,a,h,c){let d=s.ownerDocument,m=d.defaultView||window;for(let y=s,v=!1;y&&!v;)if(it(y)){let k,x=y==d.body,S=1,T=1,D=!0,q=!0;if(x)k=c1(m);else{let I=getComputedStyle(y);if(/^(fixed|sticky)$/.test(I.position)&&(v=!0),(y.scrollHeight<=y.clientHeight||!/auto|scroll/.test(I.overflowY))&&(q=!1),(y.scrollWidth<=y.clientWidth||!/auto|scroll/.test(I.overflowX))&&(D=!1),!D&&!q){y=y.assignedSlot||y.parentNode;continue}let F=y.getBoundingClientRect();({scaleX:S,scaleY:T}=md(y,F)),k={left:F.left,right:F.left+y.clientWidth*S,top:F.top,bottom:F.top+y.clientHeight*T}}let L=du(k,t),_=0,K=0;if(q)if(l=="nearest")e.top<L.top+h?(K=e.top-(L.top+h),n>0&&e.bottom>L.bottom+K&&(K=e.bottom-L.bottom+h)):e.bottom>L.bottom-h&&(K=e.bottom-L.bottom+h,n<0&&e.top-K<L.top&&(K=e.top-(L.top+h)));else{let I=e.bottom-e.top,F=L.bottom-L.top;K=(l=="center"&&I<=F?e.top+I/2-F/2:l=="start"||l=="center"&&n<0?e.top-h:e.bottom-F+h)-L.top}if(D&&(r=="nearest"?e.left<L.left+a?(_=e.left-(L.left+a),n>0&&e.right>L.right+_&&(_=e.right-L.right+a)):e.right>L.right-a&&(_=e.right-L.right+a,n<0&&e.left<L.left+_&&(_=e.left-(L.left+a))):_=(r=="center"?e.left+(e.right-e.left)/2-(L.right-L.left)/2:r=="start"==c?e.left-a:e.right-(L.right-L.left)+a)-L.left),_||K)if(x)m.scrollBy(_,K);else{let I=0,F=0;if(K){let ee=y.scrollTop;y.scrollTop+=K/T,F=(y.scrollTop-ee)*T}if(_){let ee=y.scrollLeft;y.scrollLeft+=_/S,I=(y.scrollLeft-ee)*S}e={left:e.left-I,top:e.top-F,right:e.right-I,bottom:e.bottom-F},I&&Math.abs(I-_)<1&&(r="nearest"),F&&Math.abs(F-K)<1&&(l="nearest")}if(x)break;(e.top<k.top||e.bottom>k.bottom||e.left<k.left||e.right>k.right)&&(e={left:Math.max(e.left,k.left),right:Math.min(e.right,k.right),top:Math.max(e.top,k.top),bottom:Math.min(e.bottom,k.bottom)}),t=t.filter(I=>!y.contains(I.elt)),y=y.assignedSlot||y.parentNode}else if(y.nodeType==11)y=y.host;else break}function gd(s,e=!0){let t=s.ownerDocument,n=null,r=null;for(let l=s.parentNode;l&&!(l==t.body||(!e||n)&&r);)if(it(l))!r&&l.scrollHeight>l.clientHeight&&/scroll|auto/.test(getComputedStyle(l).overflowY)&&(r=l),e&&!n&&l.scrollWidth>l.clientWidth&&/scroll|auto/.test(getComputedStyle(l).overflowX)&&(n=l),l=l.assignedSlot||l.parentNode;else if(l.nodeType==11)l=l.host;else break;return{x:n,y:r}}class d1{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?zn(t):0),n,Math.min(e.focusOffset,n?zn(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}function yd(s){let e=[];for(let t=s;t;t=t.nodeType==11?t.host:t.parentNode)it(t)&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function vd(s,e=!0){for(let{node:t,left:n,top:r}of s)e&&t.scrollTop!=r&&(t.scrollTop=r),t.scrollLeft!=n&&(t.scrollLeft=n)}let Di=null;Y.safari&&Y.safari_version>=26&&(Di=!1);function wd(s){if(s.setActive)return s.setActive();if(Di)return s.focus(Di);let e=yd(s);s.focus(Di==null?{get preventScroll(){return Di={preventScroll:!0},!0}}:void 0),Di||(Di=!1,vd(e))}let kd;function as(s,e,t=e){let n=kd||(kd=document.createRange());return n.setEnd(s,t),n.setStart(s,e),n}function sr(s,e,t,n){let r={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=n);let l=new KeyboardEvent("keydown",r);l.synthetic=!0,s.dispatchEvent(l);let a=new KeyboardEvent("keyup",r);return a.synthetic=!0,s.dispatchEvent(a),l.defaultPrevented||a.defaultPrevented}function p1(s){for(;s;){if(s&&(s.nodeType==9||s.nodeType==11&&s.host))return s;s=s.assignedSlot||s.parentNode}return null}function m1(s,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,zn(t));;)if(n){if(!it(t))return!1;let r=t.childNodes[n-1];r.contentEditable=="false"?n--:(t=r,n=zn(t))}else{if(t==s)return!0;n=Zn(t),t=t.parentNode}}function xd(s){return s instanceof Window?s.pageYOffset>Math.max(0,s.document.documentElement.scrollHeight-s.innerHeight-4):s.scrollTop>Math.max(1,s.scrollHeight-s.clientHeight-4)}function Sd(s,e){for(let t=s,n=e;;){if(ir(t)&&n>0)return{node:t,offset:n};if(it(t)&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=zn(t)}else if(t.parentNode&&!rr(t))n=Zn(t),t=t.parentNode;else return null}}function Cd(s,e){for(let t=s,n=e;;){if(ir(t)&&n<t.nodeValue.length)return{node:t,offset:n};if(it(t)&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!rr(t))n=Zn(t)+1,t=t.parentNode;else return null}}class nn{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new nn(e.parentNode,Zn(e),t)}static after(e,t){return new nn(e.parentNode,Zn(e)+1,t)}}var je=(function(s){return s[s.LTR=0]="LTR",s[s.RTL=1]="RTL",s})(je||(je={}));const or=je.LTR,pu=je.RTL;function bd(s){let e=[];for(let t=0;t<s.length;t++)e.push(1<<+s[t]);return e}const g1=bd("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),y1=bd("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),mu=Object.create(null),kn=[];for(let s of["()","[]","{}"]){let e=s.charCodeAt(0),t=s.charCodeAt(1);mu[e]=t,mu[t]=-e}function Ad(s){return s<=247?g1[s]:1424<=s&&s<=1524?2:1536<=s&&s<=1785?y1[s-1536]:1774<=s&&s<=2220?4:8192<=s&&s<=8204?256:64336<=s&&s<=65023?4:1}const v1=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class xn{get dir(){return this.level%2?pu:or}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let l=-1;for(let a=0;a<e.length;a++){let h=e[a];if(h.from<=t&&h.to>=t){if(h.level==n)return a;(l<0||(r!=0?r<0?h.from<t:h.to>t:e[l].level>h.level))&&(l=a)}}if(l<0)throw new RangeError("Index out of range");return l}}function Td(s,e){if(s.length!=e.length)return!1;for(let t=0;t<s.length;t++){let n=s[t],r=e[t];if(n.from!=r.from||n.to!=r.to||n.direction!=r.direction||!Td(n.inner,r.inner))return!1}return!0}const Ne=[];function w1(s,e,t,n,r){for(let l=0;l<=n.length;l++){let a=l?n[l-1].to:e,h=l<n.length?n[l].from:t,c=l?256:r;for(let d=a,m=c,y=c;d<h;d++){let v=Ad(s.charCodeAt(d));v==512?v=m:v==8&&y==4&&(v=16),Ne[d]=v==4?2:v,v&7&&(y=v),m=v}for(let d=a,m=c,y=c;d<h;d++){let v=Ne[d];if(v==128)d<h-1&&m==Ne[d+1]&&m&24?v=Ne[d]=m:Ne[d]=256;else if(v==64){let k=d+1;for(;k<h&&Ne[k]==64;)k++;let x=d&&m==8||k<t&&Ne[k]==8?y==1?1:8:256;for(let S=d;S<k;S++)Ne[S]=x;d=k-1}else v==8&&y==1&&(Ne[d]=1);m=v,v&7&&(y=v)}}}function k1(s,e,t,n,r){let l=r==1?2:1;for(let a=0,h=0,c=0;a<=n.length;a++){let d=a?n[a-1].to:e,m=a<n.length?n[a].from:t;for(let y=d,v,k,x;y<m;y++)if(k=mu[v=s.charCodeAt(y)])if(k<0){for(let S=h-3;S>=0;S-=3)if(kn[S+1]==-k){let T=kn[S+2],D=T&2?r:T&4?T&1?l:r:0;D&&(Ne[y]=Ne[kn[S]]=D),h=S;break}}else{if(kn.length==189)break;kn[h++]=y,kn[h++]=v,kn[h++]=c}else if((x=Ne[y])==2||x==1){let S=x==r;c=S?0:1;for(let T=h-3;T>=0;T-=3){let D=kn[T+2];if(D&2)break;if(S)kn[T+2]|=2;else{if(D&4)break;kn[T+2]|=4}}}}}function x1(s,e,t,n){for(let r=0,l=n;r<=t.length;r++){let a=r?t[r-1].to:s,h=r<t.length?t[r].from:e;for(let c=a;c<h;){let d=Ne[c];if(d==256){let m=c+1;for(;;)if(m==h){if(r==t.length)break;m=t[r++].to,h=r<t.length?t[r].from:e}else if(Ne[m]==256)m++;else break;let y=l==1,v=(m<e?Ne[m]:n)==1,k=y==v?y?1:2:n;for(let x=m,S=r,T=S?t[S-1].to:s;x>c;)x==T&&(x=t[--S].from,T=S?t[S-1].to:s),Ne[--x]=k;c=m}else l=d,c++}}}function gu(s,e,t,n,r,l,a){let h=n%2?2:1;if(n%2==r%2)for(let c=e,d=0;c<t;){let m=!0,y=!1;if(d==l.length||c<l[d].from){let S=Ne[c];S!=h&&(m=!1,y=S==16)}let v=!m&&h==1?[]:null,k=m?n:n+1,x=c;e:for(;;)if(d<l.length&&x==l[d].from){if(y)break e;let S=l[d];if(!m)for(let T=S.to,D=d+1;;){if(T==t)break e;if(D<l.length&&l[D].from==T)T=l[D++].to;else{if(Ne[T]==h)break e;break}}if(d++,v)v.push(S);else{S.from>c&&a.push(new xn(c,S.from,k));let T=S.direction==or!=!(k%2);yu(s,T?n+1:n,r,S.inner,S.from,S.to,a),c=S.to}x=S.to}else{if(x==t||(m?Ne[x]!=h:Ne[x]==h))break;x++}v?gu(s,c,x,n+1,r,v,a):c<x&&a.push(new xn(c,x,k)),c=x}else for(let c=t,d=l.length;c>e;){let m=!0,y=!1;if(!d||c>l[d-1].to){let S=Ne[c-1];S!=h&&(m=!1,y=S==16)}let v=!m&&h==1?[]:null,k=m?n:n+1,x=c;e:for(;;)if(d&&x==l[d-1].to){if(y)break e;let S=l[--d];if(!m)for(let T=S.from,D=d;;){if(T==e)break e;if(D&&l[D-1].to==T)T=l[--D].from;else{if(Ne[T-1]==h)break e;break}}if(v)v.push(S);else{S.to<c&&a.push(new xn(S.to,c,k));let T=S.direction==or!=!(k%2);yu(s,T?n+1:n,r,S.inner,S.from,S.to,a),c=S.from}x=S.from}else{if(x==e||(m?Ne[x-1]!=h:Ne[x-1]==h))break;x--}v?gu(s,x,c,n+1,r,v,a):x<c&&a.push(new xn(x,c,k)),c=x}}function yu(s,e,t,n,r,l,a){let h=e%2?2:1;w1(s,r,l,n,h),k1(s,r,l,n,h),x1(r,l,n,h),gu(s,r,l,e,t,n,a)}function S1(s,e,t){if(!s)return[new xn(0,0,e==pu?1:0)];if(e==or&&!t.length&&!v1.test(s))return Md(s.length);if(t.length)for(;s.length>Ne.length;)Ne[Ne.length]=256;let n=[],r=e==or?0:1;return yu(s,r,r,t,0,s.length,n),n}function Md(s){return[new xn(0,s,0)]}let Od="";function C1(s,e,t,n,r){var l;if(!s.length)return null;let a=n.head-s.from,h;if(n.head==s.from&&n.assoc<0){if(!r)return null;a=e[h=0].side(!1,t)}else if(n.head==s.to&&n.assoc>0){if(r)return null;a=e[h=e.length-1].side(!0,t)}else h=xn.find(e,a,(l=n.bidiLevel)!==null&&l!==void 0?l:-1,n.assoc);let c=e[h],d=c.side(r,t);if(a==d){let v=h+=r?1:-1;if(v<0||v>=e.length)return null;c=e[h=v],a=c.side(!r,t),d=c.side(r,t)}let m=ct(s.text,a,c.forward(r,t));(m<c.from||m>c.to)&&(m=d),Od=s.text.slice(Math.min(a,m),Math.max(a,m));let y=h==(r?e.length-1:0)?null:e[h+(r?1:-1)];if(m==d){if(!y)return r?H.cursor(s.to,1):H.cursor(s.from,-1);if(y.level+(r?0:1)<c.level)return H.cursor(y.side(!r,t)+s.from,y.forward(r,t)?1:-1,y.level)}return H.cursor(m+s.from,c.forward(r,t)?-1:1,c.level)}function b1(s,e,t){for(let n=e;n<t;n++){let r=Ad(s.charCodeAt(n));if(r==1)return or;if(r==2||r==4)return pu}}const Ed=te.define(),Pd=te.define(),Rd=te.define(),Dd=te.define(),vu=te.define(),Ld=te.define(),Nd=te.define(),wu=te.define(),ku=te.define(),Bd=te.define({combine:s=>s.some(e=>e)}),A1=te.define({combine:s=>s.some(e=>e)}),Id=te.define();class lr{constructor(e,t,n,r,l,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=l,this.isSnapshot=a}map(e){return e.empty?this:new lr(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new lr(H.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Co=Le.define({map:(s,e)=>s.map(e)}),zd=Le.define();function Wt(s,e,t){let n=s.facet(Dd);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Fn=te.define({combine:s=>s.length?s[0]:!0});let T1=0;const ar=te.define({combine(s){return s.filter((e,t)=>{for(let n=0;n<t;n++)if(s[n].plugin==e.plugin)return!1;return!0})}});class Mt{constructor(e,t,n,r,l){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=l(this),this.extension=this.baseExtensions.concat(ar.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(ar.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:r,provide:l,decorations:a}=t||{};return new Mt(T1++,e,n,r,h=>{let c=[];return a&&c.push(bo.of(d=>{let m=d.plugin(h);return m?a(m):Re.none})),l&&c.push(l(h)),c})}static fromClass(e,t){return Mt.define((n,r)=>new e(n,r),t)}}class xu{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(Wt(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Wt(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){Wt(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Fd=te.define(),Su=te.define(),bo=te.define(),_d=te.define(),Cu=te.define(),us=te.define(),jd=te.define();function Vd(s,e){let t=s.state.facet(jd);if(!t.length)return t;let n=t.map(l=>l instanceof Function?l(s):l),r=[];return be.spans(n,e.from,e.to,{point(){},span(l,a,h,c){let d=l-e.from,m=a-e.from,y=r;for(let v=h.length-1;v>=0;v--,c--){let k=h[v].spec.bidiIsolate,x;if(c>0&&y.length&&(x=y[y.length-1]).to==d&&x.direction==k)x.to=m,y=x.inner;else{let S={from:d,to:m,direction:k,inner:[]};y.push(S),y=S.inner}}}}),Hd(e.text,r)}function Hd(s,e){for(let t of e){if(t.direction==null){for(let n=t.from,r=0;n<t.to;r++){let l=r<t.inner.length?t.inner[r]:null,a=b1(s,n,l?l.from:t.to);if(a!=null){t.direction=a;break}if(!l)break;n=l.to}t.direction==null&&(t.direction=je.LTR)}Hd(s,t.inner)}return e}const Wd=te.define(),Ud=te.define();function bu(s){let e=[];for(let t of s.state.facet(Ud)){let n=t(s);n&&e.push(n)}for(let t of s.state.facet(Wd)){let n=t(s);if(n){let{win:r}=s,l=0,a=r.innerWidth,h=0,c=r.innerHeight;if(s.viewState.scrollParent){let m=s.viewState.scrollParent.getBoundingClientRect();l=Math.max(m.left,l),a=Math.min(m.right,a),h=Math.max(m.top,h),c=Math.min(m.bottom,c)}let d={elt:s.dom};n.left!=null&&(d.left=l+n.left),n.right!=null&&(d.right=a-n.right),n.top!=null&&(d.top=h+n.top),n.bottom!=null&&(d.bottom=c-n.bottom),e.push(d)}}return e}const hs=te.define();class Ut{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new Ut(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let r=0,l=0,a=0;;){let h=r<e.length?e[r].fromB:1e9,c=l<t.length?t[l]:1e9,d=Math.min(h,c);if(d==1e9)break;let m=d+a,y=d,v=m;for(;;)if(l<t.length&&t[l]<=y){let k=t[l+1];l+=2,y=Math.max(y,k);for(let x=r;x<e.length&&e[x].fromB<=y;x++)a=e[x].toA-e[x].toB;v=Math.max(v,k+a)}else if(r<e.length&&e[r].fromB<=y){let k=e[r++];y=Math.max(y,k.toB),v=Math.max(v,k.toA),a=k.toA-k.toB}else break;n.push(new Ut(m,v,d,y))}return n}}class Ao{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=et.empty(this.startState.doc.length);for(let l of n)this.changes=this.changes.compose(l.changes);let r=[];this.changes.iterChangedRanges((l,a,h,c)=>r.push(new Ut(l,a,h,c))),this.changedRanges=r}static create(e,t,n){return new Ao(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const M1=[];class Ge{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return M1}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&a1(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=Zn(this.dom),r=this.length?e>0:t>0;return new nn(this.parent.dom,n+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Mo)return e;return null}static get(e){return e.cmTile}}class To extends Ge{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,l=e?.node==t?e:null,a=0;for(let h of this.children){if(h.sync(e),a+=h.length+h.breakAfter,r=n?n.nextSibling:t.firstChild,l&&r!=h.dom&&(l.written=!0),h.dom.parentNode==t)for(;r&&r!=h.dom;)r=$d(r);else t.insertBefore(h.dom,r);n=h.dom}for(r=n?n.nextSibling:t.firstChild,l&&r&&(l.written=!0);r;)r=$d(r);this.length=a}}function $d(s){let e=s.nextSibling;return s.parentNode.removeChild(s),e}class Mo extends To{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Ge.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,l=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&l++,r=t.pop()}else{let a=n.children[r++];if(a instanceof _n)t.push(r),n=a,r=0;else{let h=l+a.length,c=e(a,l);if(c!==void 0)return c;l=h+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,l,a=-1;if(this.blockTiles((h,c)=>{let d=c+h.length;if(e>=c&&e<=d){if(h.isWidget()&&t>=-1&&t<=1){if(h.flags&32)return!0;h.flags&16&&(n=void 0)}(c<e||e==d&&(t<-1?h.length:h.covers(1)))&&(!n||!h.isWidget()&&n.isWidget())&&(n=h,r=e-c),(d>e||e==c&&(t>1?h.length:h.covers(-1)))&&(!l||!h.isWidget()&&l.isWidget())&&(l=h,a=e-c)}}),!n&&!l)throw new Error("No tile at position "+e);return n&&t<0||!l?{tile:n,offset:r}:{tile:l,offset:a}}}class _n extends To{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new _n(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class ur extends To{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let r=new ur(t||document.createElement("div"),e);return(!t||!n)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,l=-1,a=null,h=-1;function c(m,y){for(let v=0,k=0;v<m.children.length&&k<=y;v++){let x=m.children[v],S=k+x.length;S>=y&&(x.isComposite()?c(x,y-k):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&E1(a,x)))&&(S>y||x.flags&32&&t<=1)?(a=x,h=y-k):(k<y||x.flags&16&&!(n&&x.isHidden)&&t>=-1)&&(r=x,l=y-k)),k=S}}c(this,e);let d=(t<0?r:a)||r||a;return d?{tile:d,offset:d==r?l:h}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):O1(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:r,offset:l}=n;if(this.dom.contains(r.dom))return r.isText()?new nn(r.dom,Math.min(r.dom.nodeValue.length,l)):r.domPosFor(l,r.flags&16?1:r.flags&32?-1:t);let a=n.tile.parent,h=!1;for(let c of a.children){if(h)return new nn(c.dom,0);c==n.tile&&(h=!0)}}return new nn(this.dom,0)}}function O1(s){let e=s.dom.lastChild;if(!e)return s.dom.getBoundingClientRect();let t=xo(e);return t[t.length-1]||null}function E1(s,e){let t=s.coordsIn(0,1),n=e.coordsIn(0,1);return t&&n&&n.top<t.bottom}class Ot extends To{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new Ot(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class Li extends Ge{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let l=e,a=e,h=0;e==0&&t<0||e==r&&t>=0?Y.chrome||Y.gecko||(e?(l--,h=1):a<r&&(a++,h=-1)):t<0?l--:a<r&&a++;let c=as(this.dom,l,a).getClientRects();if(!c.length)return null;let d=c[(h?h<0:t>=0)?0:c.length-1];return Y.safari&&!h&&d.width==0&&(d=Array.prototype.find.call(c,m=>m.width)||d),n==null?d:So(d,(h?h>0:t<0)==n)}static of(e,t){let n=new Li(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class Ni extends Ge{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return So(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let l=this.dom.getClientRects(),a=null;if(!l.length)return null;let h=this.flags&16?!0:this.flags&32?!1:e>0;for(let c=h?l.length-1:0;a=l[c],!(e>0?c==0:c==l.length-1||a.top<a.bottom);c+=h?-1:1);return So(a,!h)}}get overrideDOMText(){if(!this.length)return Me.empty;let{root:e}=this;if(!e)return Me.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,r,l){return l||(l=e.toDOM(t),e.editable||(l.contentEditable="false")),new Ni(l,n,e,r)}}class Oo extends Ge{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return Me.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:So(r,t>0==n)}}class P1{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:l,beforeBreak:a,parents:h}=this;for(;e||t>0;)if(r.isComposite())if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(l==r.children.length){if(!e&&!h.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:l}=h.pop(),l++}else{let c=r.children[l],d=c.breakAfter;(t>0?c.length<=e:c.length<e)&&(!n||n.skip(c,0,c.length)!==!1||!c.isComposite)?(a=!!d,l++,e-=c.length):(h.push({tile:r,index:l}),r=c,l=0,n&&c.isComposite()&&n.enter(c))}else{let c=r.length;if(l<c&&e){let d=Math.min(e,c-l);n&&n.skip(r,l,l+d),e-=d,l+=d}if(l==c)a=!!r.breakAfter,{tile:r,index:l}=h.pop(),l++;else if(!e)break}return this.tile=r,this.index=l,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class R1{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}}class D1{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){var l;this.flushBuffer();let a=this.ensureMarks(t,n),h=a.lastChild;if(h&&h.isText()&&!(h.flags&8)&&h.length+e.length<512){this.cache.reused.set(h,2);let c=a.children[a.children.length-1]=new Li(h.dom,h.text+e);c.parent=a}else a.append(r||Li.of(e,(l=this.cache.find(Li))===null||l===void 0?void 0:l.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?Au(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let h=t.marks.length-1;h>=0;h--){let c=t.marks[h],d=r.lastChild;if(d instanceof Ot&&d.mark.eq(c.mark))d.dom!=c.dom&&d.setDOM(Au(c.dom)),r=d;else{let{dom:m}=c;this.cache.reused.get(c)&&Ge.get(c.dom)&&(m=Au(c.dom));let y=Ot.of(c.mark,m);r.append(y),r=y}this.cache.reused.set(c,2)}let l=Ge.get(e.text);l&&this.cache.reused.set(l,2);let a=new Li(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let l=this.ensureMarks(t,n);!r&&!(e.flags&16)&&l.append(this.getBuffer(1)),l.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=Qd);let r=ur.start(e,t||((n=this.cache.find(ur))===null||n===void 0?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let l=e.length-1;l>=0;l--){let a=e[l],h;if(t>0&&(h=r.lastChild)&&h instanceof Ot&&h.mark.eq(a))r=h,t--;else{let c=Ot.of(a,(n=this.cache.find(Ot,d=>d.mark.eq(a)))===null||n===void 0?void 0:n.dom);r.append(c),r=c,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Kd(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Y.ios&&Kd(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Tu,0,32)||new Ni(Tu.toDOM(),0,Tu,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new R1(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.from<this.pos&&r instanceof _n&&r.wrapper.eq(n.wrapper))t=r;else{let l=_n.of(n.wrapper,(e=this.cache.find(_n,a=>a.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(l),t=l}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(Oo,void 0,1);return n&&(n.flags=t),n||new Oo(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class L1{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:l,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=r;let h=this.textOff=Math.min(e,r.length);return l?null:r.slice(0,h)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const Eo=[Ni,ur,Li,Ot,Oo,_n,Mo];for(let s=0;s<Eo.length;s++)Eo[s].bucket=s;class N1{constructor(e){this.view=e,this.buckets=Eo.map(()=>[]),this.index=Eo.map(()=>0),this.reused=new Map,this.dir=1}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,l=this.buckets[r],a=this.index[r],[h,c,d]=this.dir>0?[0,l.length,1]:[l.length-1,-1,-1];for(let m=h;m!=c;m+=d){let y=(m+a)%l.length,v=l[y];if((!t||t(v))&&!this.reused.has(v))return l.splice(y,1),y<a&&this.index[r]--,this.reused.set(v,n),v}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let l=0,a=0;;l++){if(l==r.length){if(a)return null;a=1,l=0}let h=r[l];if(!this.reused.has(h)&&(a==0?h.widget.compare(e):h.widget.constructor==e.constructor&&e.updateDOM(h.dom,this.view,h.widget)))return r.splice(l,1),l<this.index[0]&&this.index[0]--,h.widget==e&&h.length==t&&(h.flags&497)==n?(this.reused.set(h,1),h):(this.reused.set(h,2),new Ni(h.dom,t,e,h.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class B1{constructor(e,t,n,r,l){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=l,this.openWidget=!1,this.openMarks=0,this.cache=new N1(e),this.text=new L1(e.state.doc),this.builder=new D1(this.cache,new Mo(e,e.contentDOM),be.iter(n)),this.cache.reused.set(t,2),this.old=new P1(t),this.reuseWalker={skip:(a,h,c)=>{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,l=0,a=0;;){let h=a<e.length?e[a++]:null,c=h?h.fromA:this.old.root.length;if(c>r){let d=c-r;this.cache.dir=-1,this.preserve(d,!a,!h),this.cache.dir=1,r=c,l+=d}if(!h)break;t&&h.fromA<=t.range.fromA&&h.toA>=t.range.toA?(this.forward(h.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(l,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,h.toA),this.emit(t.range.toB,h.toB)):(this.forward(h.fromA,h.toA),this.emit(l,h.toB)),l=h.toB,r=h.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=F1(this.old),l=this.openMarks;this.old.advance(e,n?1:-1,{skip:(a,h,c)=>{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(c-h);else{let d=c>0||h<a.length?Ni.of(a.widget,this.view,c-h,a.flags&496,this.cache.maybeReuse(a)):this.cache.reuse(a);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,r,l),l=r.length)}else if(a.isText())this.builder.ensureLine(null),!h&&c==a.length&&!this.cache.reused.has(a)?this.builder.addText(a.text,r,l,this.cache.reuse(a)):(this.cache.add(a),this.builder.addText(a.text.slice(h,c),r,l)),l=r.length;else if(a.isLine())a.flags&=-2,this.cache.reused.set(a,1),this.builder.addLine(a);else if(a instanceof Oo)this.cache.add(a);else if(a instanceof Ot)this.builder.ensureLine(null),this.builder.addMark(a,r,l),this.cache.reused.set(a,1),l=r.length;else return!1;this.openWidget=!1},enter:a=>{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof Ot&&r.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?r.length&&(r.length=l=0):a instanceof Ot&&(r.shift(),l=Math.min(l,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,l=-1,a=be.spans(this.decorations,e,t,{point:(h,c,d,m,y,v)=>{if(d instanceof Ri){if(this.disallowBlockEffectsFor[v]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(c>this.view.state.doc.lineAt(h).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(l=m.length,y>m.length)r.continueWidget(c-h);else{let k=d.widget||(d.block?hr.block:hr.inline),x=I1(d),S=this.cache.findWidget(k,c-h,x)||Ni.of(k,this.view,c-h,x);d.block?(d.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(S)):(r.ensureLine(n),r.addInlineWidget(S,m,y))}n=null}else n=z1(n,d);c>h&&this.text.skip(c-h)},span:(h,c,d,m)=>{for(let y=h;y<c;){let v=this.text.next(Math.min(512,c-y));v==null?(r.addLineStartIfNotCovered(n),r.addBreak(),y++):(r.ensureLine(n),r.addText(v,d,y==h?m:d.length),y+=v.length),n=null}l=d.length}});l>-1&&(this.openWidget=a>l),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let l=Ge.get(r);if(r==this.view.contentDOM)break;l instanceof Ot?t.push(l):l?.isLine()?n=l:l instanceof _n||(r.nodeName=="DIV"&&!n?n=new ur(r,Qd):n||t.push(Ot.of(new ns({tagName:r.nodeName.toLowerCase(),attributes:u1(r)}),r)))}return n?{line:n,marks:t}:null}}function Kd(s,e){let t=n=>{for(let r of n.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(s)}function I1(s){let e=s.isReplace?(s.startSide<0?64:0)|(s.endSide>0?128:0):s.startSide>0?32:16;return s.block&&(e|=256),e}const Qd={class:"cm-line"};function z1(s,e){let t=e.spec.attributes,n=e.spec.class;return!t&&!n||(s||(s={class:"cm-line"}),t&&hu(t,s),n&&(s.class+=" "+n)),s}function F1(s){let e=[];for(let t=s.parents.length;t>1;t--){let n=t==s.parents.length?s.tile:s.parents[t].tile;n instanceof Ot&&e.push(n.mark)}return e}function Au(s){let e=Ge.get(s);return e&&e.setDOM(s.cloneNode()),s}class hr extends ts{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}hr.inline=new hr("span"),hr.block=new hr("div");const Tu=new class extends ts{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Gd{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Re.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Mo(e,e.contentDOM),this.updateInner([new Ut(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:m,toA:y})=>y<this.minWidthFrom||m>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!Q1(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let l=r>-1?j1(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:m,to:y}=this.hasComposition;n=new Ut(m,y,e.changes.mapPos(m,-1),e.changes.mapPos(y,1)).addToSet(n.slice())}this.hasComposition=l?{from:l.range.fromB,to:l.range.toB}:null,(Y.ie||Y.chrome)&&!l&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,h=this.blockWrappers;this.updateDeco();let c=W1(a,this.decorations,e.changes);c.length&&(n=Ut.extendWithRanges(n,c));let d=$1(h,this.blockWrappers,e.changes);return d.length&&(n=Ut.extendWithRanges(n,d)),l&&!n.some(m=>m.fromA<=l.range.fromA&&m.toA>=l.range.toA)&&(n=l.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,l),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.setMustMeasure();let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let a=this.tile,h=new B1(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Ge.get(t.text)&&h.cache.reused.set(Ge.get(t.text),2),this.tile=h.run(e,t),Mu(a,h.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let l=Y.chrome||Y.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(l),l&&(l.written||n.selectionRange.focusNode!=l.node||!this.tile.dom.contains(l.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let l of this.tile.children)l.isWidget()&&l.widget instanceof Ou&&r.push(l.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(zd)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,t=!1){let{view:n}=this;(e||!n.observer.selectionRange.focusNode)&&n.observer.readSelectionRange();let{dom:r}=this.tile,l=n.root.activeElement,a=l==r,h=!a&&!(n.state.facet(Fn)||r.tabIndex>-1)&&os(r,n.observer.selectionRange)&&!(l&&r.contains(l));if(!(a||t||h))return;if(n.inputState.androidSelection>-1){n.inputState.androidSelectionNeedsFlush=!0;return}let c=this.forceSelection;this.forceSelection=!1;let d=n.state.selection.main,m,y;if(d.empty?y=m=this.inlineDOMNearPos(d.anchor,d.assoc||1):(y=this.inlineDOMNearPos(d.head,d.head==d.from?1:-1),m=this.inlineDOMNearPos(d.anchor,d.anchor==d.from?1:-1)),Y.gecko&&d.empty&&!this.hasComposition&&_1(m)){let k=document.createTextNode("");n.observer.ignore(()=>m.node.insertBefore(k,m.node.childNodes[m.offset]||null)),m=y=new nn(k,0),c=!0}let v=n.observer.selectionRange;(c||!v.focusNode||(!ls(m.node,m.offset,v.anchorNode,v.anchorOffset)||!ls(y.node,y.offset,v.focusNode,v.focusOffset))&&!this.suppressWidgetCursorChange(v,d))&&(n.observer.ignore(()=>{Y.android&&Y.chrome&&r.contains(v.focusNode)&&K1(v.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let k=ss(n.root);if(k)if(d.empty){if(Y.gecko){let x=V1(m.node,m.offset);if(x&&x!=3){let S=(x==1?Sd:Cd)(m.node,m.offset);S&&(m=new nn(S.node,S.offset))}}k.collapse(m.node,m.offset),d.bidiLevel!=null&&k.caretBidiLevel!==void 0&&(k.caretBidiLevel=d.bidiLevel)}else if(k.extend){k.collapse(m.node,m.offset);try{k.extend(y.node,y.offset)}catch{}}else{let x=document.createRange();d.anchor>d.head&&([m,y]=[y,m]),x.setEnd(y.node,y.offset),x.setStart(m.node,m.offset),k.removeAllRanges(),k.addRange(x)}h&&n.root.activeElement==r&&(r.blur(),l&&l.focus())}),n.observer.setSelectionRange(m,y)),this.impreciseAnchor=m.precise?null:new nn(v.anchorNode,v.anchorOffset),this.impreciseHead=y.precise?null:new nn(v.focusNode,v.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ls(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=ss(e.root),{anchorNode:r,anchorOffset:l}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let h=a.posAtStart;if(t.head==h||t.head==h+a.length)return;let c=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!c||!d||c.bottom>d.top)return;let m=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(m.node,m.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let y=e.observer.selectionRange;e.docView.posFromDOM(y.anchorNode,y.anchorOffset)!=t.from&&n.collapse(r,l)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let l;if(e==n.dom)l=n.dom.childNodes[t];else{let a=zn(e)==0?0:t==0?-1:1;for(;;){let h=e.parentNode;if(h==n.dom)break;a==0&&h.firstChild!=h.lastChild&&(e==h.firstChild?a=-1:a=1),e=h}a<0?l=e:l=e.nextSibling}if(l==n.dom.firstChild)return r;for(;l&&!Ge.get(l);)l=l.nextSibling;if(!l)return r+n.length;for(let a=0,h=r;;a++){let c=n.children[a];if(c.dom==l)return h;h+=c.length+c.breakAfter}}else return n.isText()?e==n.dom?r+t:r+(t?n.length:0):r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,l=!1,a,h=-1,c=!1;return this.tile.blockTiles((d,m)=>{if(d.isWidget()){if(d.flags&32&&m>=e)return!0;d.flags&16&&(l=!0)}else{let y=m+d.length;if(m<=e&&(n=d,r=e-m,l=y<e),y>=e&&!a&&(a=d,h=e-m,c=m>e),m>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(l&&a?n=null:c&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(h,t))}coordsAt(e,t,n){let{tile:r,offset:l}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Ou?null:r.coordsInWidget(l,t,!0):r.coordsIn(l,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(l,a){if(l.isComposite())for(let h of l.children){if(h.length>=a){let c=r(h,a);if(c)return c}if(a-=h.length,a<0)break}else if(l.isText()&&a<l.length){let h=ct(l.text,a);if(h==a)return null;let c=as(l.dom,a,h).getClientRects();for(let d=0;d<c.length;d++){let m=c[d];if(d==c.length-1||m.top<m.bottom&&m.left<m.right)return m}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,l=this.view.contentDOM.clientWidth,a=l>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,h=-1,c=this.view.textDirection==je.LTR,d=0,m=(y,v,k)=>{for(let x=0;x<y.children.length&&!(v>r);x++){let S=y.children[x],T=v+S.length,D=S.dom.getBoundingClientRect(),{height:q}=D;if(k&&!x&&(d+=D.top-k.top),S instanceof _n)T>n&&m(S,v,D);else if(v>=n&&(d>0&&t.push(-d),t.push(q+d),d=0,a)){let L=S.dom.lastChild,_=L?xo(L):[];if(_.length){let K=_[_.length-1],I=c?K.right-D.left:D.right-K.left;I>h&&(h=I,this.minWidth=l,this.minWidthFrom=v,this.minWidthTo=T)}}k&&x==y.children.length-1&&(d+=k.bottom-D.bottom),v=T+S.breakAfter}};return m(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?je.RTL:je.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let h=0,c;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let m=xo(d.dom);if(m.length!=1)return;h+=m[0].width,c=m[0].height}if(h)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:h/a.length,textHeight:c}}});if(e)return e;let t=document.createElement("div"),n,r,l;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let a=xo(t.firstChild)[0];n=t.getBoundingClientRect().height,r=a&&a.width?a.width/27:7,l=a&&a.height?a.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:l}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let l=r==t.viewports.length?null:t.viewports[r],a=l?l.from-1:this.view.state.doc.length;if(a>n){let h=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Re.replace({widget:new Ou(h),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!l)break;n=l.to+1}return Re.set(e)}updateDeco(){let e=1,t=this.view.state.facet(bo).map(l=>(this.dynamicDecorationMap[e++]=typeof l=="function")?l(this.view):l),n=!1,r=this.view.state.facet(Cu).map((l,a)=>{let h=typeof l=="function";return h&&(n=!0),h?l(this.view):l});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(be.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(_d).map(l=>typeof l=="function"?l(this.view):l)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(Id))try{if(h(this.view,e.range,e))return!0}catch(c){Wt(this.view.state,c,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(f1(this.view.scrollDOM,n,bu(this.view),t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==je.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let h=this.view.docView.lineAt(t.head,1);if(h){let c=yd(h.dom);h.dom.scrollIntoView({block:"nearest"}),vd(c,!1)}}}lineHasWidget(e){let t=n=>n.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Mu(this.tile)}}function Mu(s,e){let t=e?.get(s);if(t!=1){t==null&&s.destroy();for(let n of s.children)Mu(n,e)}}function _1(s){return it(s.node)&&s.node.firstChild&&(s.offset==0||s.node.childNodes[s.offset-1].contentEditable=="false")&&(s.offset==s.node.childNodes.length||s.node.childNodes[s.offset].contentEditable=="false")}function qd(s,e){let t=s.observer.selectionRange;if(!t.focusNode)return null;let n=Sd(t.focusNode,t.focusOffset),r=Cd(t.focusNode,t.focusOffset),l=n||r;if(r&&n&&r.node!=n.node){let h=Ge.get(r.node);if(!h||h.isText()&&h.text!=r.node.nodeValue)l=r;else if(s.docView.lastCompositionAfterCursor){let c=Ge.get(n.node);!c||c.isText()&&c.text!=n.node.nodeValue||(l=r)}}if(s.docView.lastCompositionAfterCursor=l!=n,!l)return null;let a=e-l.offset;return{from:a,to:a+l.node.nodeValue.length,node:l.node}}function j1(s,e,t){let n=qd(s,t);if(!n)return null;let{node:r,from:l,to:a}=n,h=r.nodeValue;if(/[\n\r]/.test(h)||s.state.doc.sliceString(n.from,n.to)!=h)return null;let c=e.invertedDesc;return{range:new Ut(c.mapPos(l),c.mapPos(a),l,a),text:r}}function V1(s,e){return it(s)?(e&&s.childNodes[e-1].contentEditable=="false"?1:0)|(e<s.childNodes.length&&s.childNodes[e].contentEditable=="false"?2:0):0}let H1=class{constructor(){this.changes=[]}compareRange(e,t){nr(e,t,this.changes)}comparePoint(e,t){nr(e,t,this.changes)}boundChange(e){nr(e,e,this.changes)}};function W1(s,e,t){let n=new H1;return be.compare(s,e,t,n),n.changes}class U1{constructor(){this.changes=[]}compareRange(e,t){nr(e,t,this.changes)}comparePoint(){}boundChange(e){nr(e,e,this.changes)}}function $1(s,e,t){let n=new U1;return be.compare(s,e,t,n),n.changes}function K1(s,e){for(let t=s;t&&t!=e;t=t.assignedSlot||t.parentNode)if(it(t)&&t.contentEditable=="false")return!0;return!1}function Q1(s,e){let t=!1;return e&&s.iterChangedRanges((n,r)=>{n<e.to&&r>e.from&&(t=!0)}),t}class Ou extends ts{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function G1(s,e,t=1){let n=s.charCategorizer(e),r=s.doc.lineAt(e),l=e-r.from;if(r.length==0)return H.cursor(e);l==0?t=1:l==r.length&&(t=-1);let a=l,h=l;t<0?a=ct(r.text,l,!1):h=ct(r.text,l);let c=n(r.text.slice(a,h));for(;a>0;){let d=ct(r.text,a,!1);if(n(r.text.slice(d,a))!=c)break;a=d}for(;h<r.length;){let d=ct(r.text,h);if(n(r.text.slice(h,d))!=c)break;h=d}return H.undirectionalRange(a+r.from,h+r.from)}function q1(s,e,t,n,r){let l=Math.round((n-e.left)*s.defaultCharacterWidth);if(s.lineWrapping&&t.height>s.defaultLineHeight*1.5){let h=s.viewState.heightOracle.textHeight,c=Math.floor((r-t.top-(s.defaultLineHeight-h)*.5)/h);l+=c*s.viewState.heightOracle.lineLength}let a=s.state.sliceDoc(t.from,t.to);return t.from+i1(a,l,s.state.tabSize)}function Y1(s,e,t){let n=s.lineBlockAt(e);if(Array.isArray(n.type)){let r;for(let l of n.type){if(l.from>e)break;if(!(l.to<e)){if(l.from<e&&l.to>e)return l;(!r||l.type==Tt.Text&&(r.type!=l.type||(t<0?l.from<e:l.to>e)))&&(r=l)}}return r||n}return n}function X1(s,e,t,n){let r=Y1(s,e.head,e.assoc||-1),l=!n||r.type!=Tt.Text||!(s.lineWrapping||r.widgetLineBreaks)?null:s.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(l){let a=s.dom.getBoundingClientRect(),h=s.textDirectionAt(r.from),c=s.posAndSideAtCoords({x:t==(h==je.LTR)?a.right-1:a.left+1,y:(l.top+l.bottom)/2});if(c)return H.cursor(c.pos,c.assoc)}return H.cursor(t?r.to:r.from,t?1:-1)}function Yd(s,e,t,n){let r=s.state.doc.lineAt(e.head),l=s.bidiSpans(r),a=s.textDirectionAt(r.from);for(let h=e,c=null;;){let d=C1(r,l,a,h,t),m=Od;if(!d){if(r.number==(t?s.state.doc.lines:1))return h;m=`
26
+ `,r=s.state.doc.line(r.number+(t?1:-1)),l=s.bidiSpans(r),d=t?H.cursor(r.from,-1):H.cursor(r.to,1)}if(c){if(!c(m))return h}else{if(!n)return d;c=n(m)}h=d}}function J1(s,e,t){let n=s.state.charCategorizer(e),r=n(t);return l=>{let a=n(l);return r==In.Space&&(r=a),r==a}}function Z1(s,e,t,n){let r=e.head,l=t?1:-1;if(r==(t?s.state.doc.length:0))return H.cursor(r,e.assoc);let a=e.goalColumn,h,c=s.contentDOM.getBoundingClientRect(),d=s.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),m=s.documentTop;if(d)a==null&&(a=d.left-c.left),h=l<0?d.top:d.bottom;else{let x=s.viewState.lineBlockAt(r);a==null&&(a=Math.min(c.right-c.left,s.defaultCharacterWidth*(r-x.from))),h=(l<0?x.top:x.bottom)+m}let y=c.left+a,v=s.viewState.heightOracle.textHeight>>1,k=n??v;for(let x=0;;x+=v){let S=h+(k+x)*l,T=Pu(s,{x:y,y:S},!1,l);if(t?S>c.bottom:S<c.top)return H.cursor(T.pos,T.assoc);let D=s.coordsAtPos(T.pos,T.assoc),q=D?(D.top+D.bottom)/2:0;if(!D||(t?q>h:q<h))return H.cursor(T.pos,T.assoc,void 0,a)}}function cs(s,e,t){for(;;){let n=0;for(let r of s)r.between(e-1,e+1,(l,a,h)=>{if(e>l&&e<a){let c=n||t||(e-l<a-e?-1:1);e=c<0?l:a,n=c}});if(!n)return e}}function Xd(s,e){let t=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],l=null;if(r.empty){let a=cs(s,r.from,0);a!=r.from&&(l=H.cursor(a,-1))}else{let a=cs(s,r.from,-1),h=cs(s,r.to,1);(a!=r.from||h!=r.to)&&(r.undirectional?l=H.undirectionalRange(r.from,r.to):l=H.range(r.from==r.anchor?a:h,r.from==r.head?a:h))}l&&(t||(t=e.ranges.slice()),t[n]=l)}return t?H.create(t,e.mainIndex):e}function Eu(s,e,t){let n=cs(s.state.facet(us).map(r=>r(s)),t.from,e.head>t.from?-1:1);return n==t.from?t:H.cursor(n,n<t.from?1:-1)}class Sn{constructor(e,t){this.pos=e,this.assoc=t}}function Pu(s,e,t,n){let r=s.contentDOM.getBoundingClientRect(),l=r.top+s.viewState.paddingTop,{x:a,y:h}=e,c=h-l,d;for(;;){if(c<0)return new Sn(0,1);if(c>s.viewState.docHeight)return new Sn(s.state.doc.length,-1);if(d=s.elementAtHeight(c),n==null)break;if(d.type==Tt.Text){if(n<0?d.to<s.viewport.from:d.from>s.viewport.to)break;let v=s.docView.coordsAt(n<0?d.from:d.to,n>0?-1:1);if(v&&(n<0?v.top<=c+l:v.bottom>=c+l))break}let y=s.viewState.heightOracle.textHeight/2;c=n>0?d.bottom+y:d.top-y}if(s.viewport.from>=d.to||s.viewport.to<=d.from){if(t)return null;if(d.type==Tt.Text){let y=q1(s,r,d,a,h);return new Sn(y,y==d.from?1:-1)}}if(d.type!=Tt.Text)return c<(d.top+d.bottom)/2?new Sn(d.from,1):new Sn(d.to,-1);let m=s.docView.lineAt(d.from,2);return(!m||m.length!=d.length)&&(m=s.docView.lineAt(d.from,-2)),new ew(s,a,h,s.textDirectionAt(d.from)).scanTile(m,d.from)}class ew{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[xn.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[xn.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,l=e.length-1,a=new Set,h=this.bidiIn(e[0],e[l]),c,d,m=-1,y=1e9,v;e:for(;r<l;){let x=l-r,S=r+l>>1;t:if(a.has(S)){for(let q=1;q<x;q++){let L=S+q;if(L>=l&&(L-=x),!a.has(L)){S=L;break t}}break e}a.add(S);let T=t(S),D=0;if(T)for(let q=0;q<T.length;q++){let L=T[q];if(!(L.width==0&&T.length>1))if(L.bottom<this.y)(!c||c.bottom<L.bottom)&&(c=L),D=1;else if(L.top>this.y)(!d||d.top>L.top)&&(d=L),D=-1;else{let _=L.left>this.x?this.x-L.left:L.right<this.x?this.x-L.right:0,K=Math.abs(_);K<y&&(m=S,y=K,v=L),_&&(D=_<0==(this.baseDir==je.LTR)?-1:1)}}D==-1&&(!h||this.baseDirAt(e[S],1))?l=S:D==1&&(!h||this.baseDirAt(e[S+1],-1))&&(r=S+1)}if(!v){if(!d&&!c)return{i:0,after:!1};let x=c&&(!d||this.y-c.bottom<d.top-this.y)?c:d;return this.y=(x.top+x.bottom)/2,this.scan(e,t,!0)}if(y&&!n){let{top:x,bottom:S}=v;if(c&&c.bottom>(x+x+S)/3)return this.y=c.bottom-1,this.scan(e,t,!0);if(d&&d.top<(x+S+S)/3)return this.y=d.top+1,this.scan(e,t,!0)}let k=(h?this.dirAt(e[m],1):this.baseDir)==je.LTR;return{i:m,after:this.x>(v.left+v.right)/2==k}}scanText(e,t){let n=[];for(let l=0;l<e.length;l=ct(e.text,l))n.push(t+l);n.push(t+e.length);let r=this.scan(n,l=>{let a=n[l]-t,h=n[l+1]-t;return as(e.dom,a,h).getClientRects()});return r.after?new Sn(n[r.i+1],-1):new Sn(n[r.i],1)}scanTile(e,t){if(!e.length)return new Sn(t,1);if(e.children.length==1){let h=e.children[0];if(h.isText())return this.scanText(h,t);if(h.isComposite())return this.scanTile(h,t)}let n=[t];for(let h=0,c=t;h<e.children.length;h++)n.push(c+=e.children[h].length);let r=this.scan(n,h=>{let c=e.children[h];return c.flags&48?null:(it(c.dom)?c.dom:as(c.dom,0,c.length)).getClientRects()}),l=e.children[r.i],a=n[r.i];return l.isText()?this.scanText(l,a):l.isComposite()?this.scanTile(l,a):r.after?new Sn(n[r.i+1],-1):new Sn(a,1)}}const cr="￿";class tw{constructor(e,t){this.points=e,this.text="",this.afterBreak=!0,this.lineSeparator=t.state.facet(Oe.lineSeparator)}append(e){this.text+=e,e.length&&(this.afterBreak=!1)}lineBreak(){this.text+=cr,this.afterBreak=!0}readRange(e,t,n){for(let r=e;r;)if(t){let l=r.nextSibling;if(l){if(l==n)break;r=l,t=!1}else{r=r.parentNode;let a=Ge.get(r);if(a&&!a.parent)break;this.findPointAtEnd(r),(a?a.breakAfter:rr(r)&&!Jd(r,n))&&this.lineBreak()}}else{this.findPointBefore(r);let l=Ge.get(r),a=l&&l.overrideDOMText;if(a!=null){this.findPointInside(r,a.length);for(let h=a.iter();!h.next().done;)h.lineBreak?this.lineBreak():this.append(h.value)}else if(ir(r))this.readTextNode(r);else if(r.nodeName=="BR")r.nextSibling&&this.lineBreak();else if(it(r)){(l?l.isBlock():rr(r))&&!this.afterBreak&&this.lineBreak();let h=r.firstChild;if(h){if(h==n)break;r=h;continue}else(l?l.breakAfter:rr(r)&&!Jd(r,n))&&this.lineBreak()}t=!0}return this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let l=-1,a=1,h;if(this.lineSeparator?(l=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(h=r.exec(t))&&(l=h.index,a=h[0].length),this.append(t.slice(n,l<0?t.length:l)),l<0)break;if(this.lineBreak(),a>1)for(let c of this.points)c.node==e&&c.pos>this.text.length&&(c.pos-=a-1);n=l+a}}findPointBefore(e){let t=e.parentNode;for(let n of this.points)n.node==t&&t.childNodes[n.offset]==e&&(n.pos=this.text.length)}findPointAtEnd(e){for(let t of this.points)t.node==e&&t.offset==e.childNodes.length&&(t.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(ir(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(nw(e,n.node,n.offset)?t:0))}}function nw(s,e,t){for(;;){if(!e||t<zn(e))return!1;if(e==s)return!0;t=Zn(e)+1,e=e.parentNode}}function Jd(s,e){let t;for(let n=s.nextSibling;n&&s!=e;n=n.nextSibling){let r=Ge.get(s);if(!r?.isWidget())return!1;r&&(t||(t=[])).push(r)}if(t)for(let n of t){let r=n.overrideDOMText;if(r?.length)return!1}return!0}class Zd{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class iw{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:l,impreciseAnchor:a}=e.docView,h=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=rw(e.docView.tile,t,n))){let c=l||a?[]:ow(e),d=new tw(c,e);this.bounds.startDOM?d.readRange(this.bounds.startDOM,!0,this.bounds.endDOM):e.contentDOM.firstChild&&d.readRange(e.contentDOM.firstChild,!1,this.bounds.endDOM),this.text=d.text,this.newSel=lw(c,this.bounds.from)}else{let c=e.observer.selectionRange,d=l&&l.node==c.focusNode&&l.offset==c.focusOffset||!fu(e.contentDOM,c.focusNode)?h.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),m=a&&a.node==c.anchorNode&&a.offset==c.anchorOffset||!fu(e.contentDOM,c.anchorNode)?h.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),y=e.viewport;if((Y.ios||Y.chrome)&&d!=m&&Math.min(d,m)<=h.main.from&&Math.max(d,m)>=h.main.to&&(y.from>0||y.to<e.state.doc.length)){let v=Math.min(d,m),k=Math.max(d,m),x=y.from-v,S=y.to-k;(x==0||x==1||v==0)&&(S==0||S==-1||k==e.state.doc.length)&&(d=0,m=e.state.doc.length)}if(e.inputState.composing>-1&&h.ranges.length>1)this.newSel=h.replaceRange(H.range(m,d));else if(e.lineWrapping&&m==d&&!(h.main.empty&&h.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let v=e.coordsAtPos(d,-1),k=0;v&&(k=e.inputState.lastTouchY<=v.bottom?-1:1),this.newSel=H.create([H.cursor(d,k)])}else this.newSel=H.single(m,d)}}}function rw(s,e,t){let n=null,r=null,l=(a,h)=>{for(let c=0;c<a.children.length&&!r;c++){let d=a.children[c],m=h+d.length;d.dom.parentNode==a.dom&&(m<e?n=d:h>t?r=d:(h<e||m>t)&&l(d,h)),h=m+d.breakAfter}};return l(s,0),{from:n?n.posAtEnd+n.breakAfter:0,to:r?r.posAtStart:s.length,startDOM:n?n.dom:null,endDOM:r?r.dom:null}}function ep(s,e){let t,{newSel:n}=e,{state:r}=s,l=r.selection.main,a=s.inputState.lastKeyTime>Date.now()-100?s.inputState.lastKeyCode:-1;if(e.bounds){let{from:h,to:c}=e.bounds,d=l.from,m=null;(a===8||Y.android&&e.text.length<c-h)&&(d=l.to,m="end");let y=r.doc.sliceString(h,c,cr),v,k;!l.empty&&l.from>=h&&l.to<=c&&(e.typeOver||y!=e.text)&&y.slice(0,l.from-h)==e.text.slice(0,l.from-h)&&y.slice(l.to-h)==e.text.slice(v=e.text.length-(y.length-(l.to-h)))?t={from:l.from,to:l.to,insert:Me.of(e.text.slice(l.from-h,v).split(cr))}:(k=tp(y,e.text,d-h,m))&&(Y.chrome&&a==13&&k.toB==k.from+2&&e.text.slice(k.from,k.toB)==cr+cr&&k.toB--,t={from:h+k.from,to:h+k.toA,insert:Me.of(e.text.slice(k.from,k.toB).split(cr))})}else n&&(!s.hasFocus&&r.facet(Fn)||Du(n,l))&&(n=null);if(!t&&!n)return!1;if((Y.mac||Y.android)&&t&&t.from==t.to&&t.from==l.head-1&&/^\. ?$/.test(t.insert.toString())&&s.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=H.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:Me.of([t.insert.toString().replace("."," ")])}):r.doc.lineAt(l.from).to<l.to&&s.docView.lineHasWidget(l.to)&&s.inputState.insertingTextAt>Date.now()-50?t={from:l.from,to:l.to,insert:r.toText(s.inputState.insertingText)}:Y.chrome&&t&&t.from==t.to&&t.from==l.head&&t.insert.toString()==`
27
+ `&&s.lineWrapping&&(n&&(n=H.single(n.main.anchor-1,n.main.head-1)),t={from:l.from,to:l.to,insert:Me.of([" "])}),t)return Ru(s,t,n,a);if(n&&!Du(n,l)){let h=!1,c="select";return s.inputState.lastSelectionTime>Date.now()-50&&(s.inputState.lastSelectionOrigin=="select"&&(h=!0),c=s.inputState.lastSelectionOrigin,c=="select.pointer"&&(n=Xd(r.facet(us).map(d=>d(s)),n))),s.dispatch({selection:n,scrollIntoView:h,userEvent:c}),!0}else return!1}function Ru(s,e,t,n=-1){if(Y.ios&&s.inputState.flushIOSKey(e))return!0;let r=s.state.selection.main;if(Y.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&s.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&sr(s.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&sr(s.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&sr(s.contentDOM,"Delete",46)))return!0;let l=e.insert.toString();s.inputState.composing>=0&&s.inputState.composing++;let a,h=()=>a||(a=sw(s,e,t));return s.state.facet(Ld).some(c=>c(s,e.from,e.to,l,h))||s.dispatch(h()),!0}function sw(s,e,t){let n,r=s.state,l=r.selection.main,a=-1;if(e.from==e.to&&e.from<l.from||e.from>l.to){let c=e.from<l.from?-1:1,d=c<0?l.from:l.to,m=cs(r.facet(us).map(y=>y(s)),d,c);e.from==m&&(a=m)}if(a>-1)n={changes:e,selection:H.cursor(e.from+e.insert.length,-1)};else if(e.from>=l.from&&e.to<=l.to&&e.to-e.from>=(l.to-l.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&s.inputState.composing<0){let c=l.from<e.from?r.sliceDoc(l.from,e.from):"",d=l.to>e.to?r.sliceDoc(e.to,l.to):"";n=r.replaceSelection(s.state.toText(c+e.insert.sliceString(0,void 0,s.state.lineBreak)+d))}else{let c=r.changes(e),d=t&&t.main.to<=c.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(s.inputState.composing>=0||s.inputState.compositionPendingChange)&&e.to<=l.to+10&&e.to>=l.to-10){let m=s.state.sliceDoc(e.from,e.to),y,v=t&&qd(s,t.main.head);if(v){let x=e.insert.length-(e.to-e.from);y={from:v.from,to:v.to-x}}else y=s.state.doc.lineAt(l.head);let k=l.to-e.to;n=r.changeByRange(x=>{if(x.from==l.from&&x.to==l.to)return{changes:c,range:d||x.map(c)};let S=x.to-k,T=S-m.length;if(s.state.sliceDoc(T,S)!=m||S>=y.from&&T<=y.to)return{range:x};let D=r.changes({from:T,to:S,insert:e.insert}),q=x.to-l.to;return{changes:D,range:d?H.range(Math.max(0,d.anchor+q),Math.max(0,d.head+q)):x.map(D)}})}else n={changes:c,selection:d&&r.selection.replaceRange(d)}}let h="input.type";return(s.composing||s.inputState.compositionPendingChange&&s.inputState.compositionEndedAt>Date.now()-50)&&(s.inputState.compositionPendingChange=!1,h+=".compose",s.inputState.compositionFirstChange&&(h+=".start",s.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:h,scrollIntoView:!0})}function tp(s,e,t,n){let r=Math.min(s.length,e.length),l=0;for(;l<r&&s.charCodeAt(l)==e.charCodeAt(l);)l++;if(l==r&&s.length==e.length)return null;let a=s.length,h=e.length;for(;a>0&&h>0&&s.charCodeAt(a-1)==e.charCodeAt(h-1);)a--,h--;if(n=="end"){let c=Math.max(0,l-Math.min(a,h));t-=a+c-l}if(a<l&&s.length<e.length){let c=t<=l&&t>=a?l-t:0;l-=c,h=l+(h-a),a=l}else if(h<l){let c=t<=l&&t>=h?l-t:0;l-=c,a=l+(a-h),h=l}return{from:l,toA:a,toB:h}}function ow(s){let e=[];if(s.root.activeElement!=s.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:l}=s.observer.selectionRange;return t&&(e.push(new Zd(t,n)),(r!=t||l!=n)&&e.push(new Zd(r,l))),e}function lw(s,e){if(s.length==0)return null;let t=s[0].pos,n=s.length==2?s[1].pos:t;return t<0||n<0?null:t==n?H.create([H.cursor(n+e,-1)]):H.single(t+e,n+e)}function Du(s,e){return e.head==s.main.head&&e.anchor==s.main.anchor}class aw{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.androidSelection=-1,this.androidSelectionNeedsFlush=!1,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Y.safari&&e.contentDOM.addEventListener("input",()=>null),Y.gecko&&bw(e.contentDOM.ownerDocument)}handleEvent(e){!yw(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,t);for(let r of n.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=hw(e),n=this.handlers,r=this.view.contentDOM;for(let l in t)if(l!="scroll"){let a=!t[l].handlers.length,h=n[l];h&&a!=!h.handlers.length&&(r.removeEventListener(l,this.handleEvent),h=null),h||r.addEventListener(l,this.handleEvent,{passive:a})}for(let l in n)l!="scroll"&&!t[l]&&r.removeEventListener(l,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),this.composing>=0&&e.isComposing===!1&&gp(this.view),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&rp.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Y.android&&Y.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Y.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(ip.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||cw.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&Y.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&uw(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,sr(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Y.safari&&!Y.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}selectionchange(){this.androidSelection>-1&&this.scheduleAndroidSelectionEnd()}startAndroidSelection(){this.scheduleAndroidSelectionEnd()}scheduleAndroidSelectionEnd(){this.view.win.clearTimeout(this.androidSelection),this.androidSelection=this.view.win.setTimeout(()=>this.endAndroidSelection(),1e3)}endAndroidSelection(){this.androidSelection>-1&&(this.view.win.clearTimeout(this.androidSelection),this.androidSelection=-1,this.androidSelectionNeedsFlush&&(this.androidSelectionNeedsFlush=!1,this.view.docView.updateSelection(!0)))}}function uw(s){return s.visualViewport?s.visualViewport.height*s.visualViewport.scale/s.document.documentElement.clientHeight<.85:!1}function np(s,e){return(t,n)=>{try{return e.call(s,n,t)}catch(r){Wt(t.state,r)}}}function hw(s){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of s){let r=n.spec,l=r&&r.plugin.domEventHandlers,a=r&&r.plugin.domEventObservers;if(l)for(let h in l){let c=l[h];c&&t(h).handlers.push(np(n.value,c))}if(a)for(let h in a){let c=a[h];c&&t(h).observers.push(np(n.value,c))}}for(let n in rn)t(n).handlers.push(rn[n]);for(let n in dt)t(n).observers.push(dt[n]);return e}const ip=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],cw="dthko",rp=[16,17,18,20,91,92,224,225],Po=6;function Ro(s){return Math.max(0,s)*.7+8}function fw(s,e){return Math.max(Math.abs(s.clientX-e.clientX),Math.abs(s.clientY-e.clientY))}class dw{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=gd(e.contentDOM),this.atoms=e.state.facet(us).map(a=>a(e));let l=e.contentDOM.ownerDocument;l.addEventListener("mousemove",this.move=this.move.bind(this)),l.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Oe.allowMultipleSelections)&&pw(e,t),this.dragging=gw(e,t)&&cp(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&fw(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,l=0,a=this.view.win.innerWidth,h=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:l,bottom:h}=this.scrollParents.y.getBoundingClientRect());let c=du({left:r,right:a,top:l,bottom:h},bu(this.view));e.clientX<=c.left+Po?t=-Ro(c.left-e.clientX):e.clientX>=c.right-Po&&(t=Ro(e.clientX-c.right)),e.clientY<=c.top+Po?n=-Ro(c.top-e.clientY):e.clientY>=c.bottom-Po&&(n=Ro(e.clientY-c.bottom)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=Xd(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function pw(s,e){let t=s.state.facet(Ed);return t.length?t[0](e):Y.mac?e.metaKey:e.ctrlKey}function mw(s,e){let t=s.state.facet(Pd);return t.length?t[0](e):Y.mac?!e.altKey:!e.ctrlKey}function gw(s,e){let{main:t}=s.state.selection;if(t.empty)return!1;let n=ss(s.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let l=0;l<r.length;l++){let a=r[l];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function yw(s,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=s.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=Ge.get(t))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}const rn=Object.create(null),dt=Object.create(null),sp=Y.ie&&Y.ie_version<15||Y.ios&&Y.webkit_version<604;function vw(s){let e=s.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{s.focus(),t.remove(),op(s,t.value)},50)}function Do(s,e,t){for(let n of s.facet(e))t=n(t,s);return t}function op(s,e){e=Do(s.state,wu,e);let{state:t}=s,n,r=1,l=t.toText(e),a=l.lines==t.selection.ranges.length;if(Lu!=null&&t.selection.ranges.every(c=>c.empty)&&Lu==l.toString()){let c=-1;n=t.changeByRange(d=>{let m=t.doc.lineAt(d.from);if(m.from==c)return{range:d};c=m.from;let y=t.toText((a?l.line(r++).text:e)+t.lineBreak);return{changes:{from:m.from,insert:y},range:H.cursor(d.from+y.length,-1)}})}else a?n=t.changeByRange(c=>{let d=l.line(r++);return{changes:{from:c.from,to:c.to,insert:d.text},range:H.cursor(c.from+d.length,-1)}}):n=t.replaceSelection(l);s.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}dt.scroll=s=>{let e=s.inputState;e.lastScrollTop=s.scrollDOM.scrollTop,e.lastScrollLeft=s.scrollDOM.scrollLeft,Y.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())},dt.wheel=dt.mousewheel=s=>{s.inputState.lastWheelEvent=Date.now()},rn.keydown=(s,e)=>(s.inputState.setSelectionOrigin("select"),e.keyCode==27&&s.inputState.tabFocusMode!=0&&(s.inputState.tabFocusMode=Date.now()+2e3),!1),dt.touchstart=(s,e)=>{let t=s.inputState,n=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),n&&(t.lastTouchX=n.clientX,t.lastTouchY=n.clientY),t.setSelectionOrigin("select.pointer")},dt.touchmove=s=>{s.inputState.setSelectionOrigin("select.pointer")},dt.touchend=dt.touchcancel=(s,e)=>{s.inputState.touchActive=!1,Y.chrome&&Y.android&&e.type=="touchcancel"&&s.inputState.startAndroidSelection()},rn.mousedown=(s,e)=>{if(s.observer.flush(),s.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of s.state.facet(Rd))if(t=n(s,e),t)break;if(!t&&e.button==0&&(t=kw(s,e)),t){let n=!s.hasFocus;s.inputState.startMouseSelection(new dw(s,e,t,n)),n&&s.observer.ignore(()=>{wd(s.contentDOM);let l=s.root.activeElement;l&&!l.contains(s.contentDOM)&&l.blur()});let r=s.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else s.inputState.setSelectionOrigin("select.pointer");return!1};function lp(s,e,t,n){if(n==1)return H.cursor(e,t);if(n==2)return G1(s.state,e,t);{let r=s.docView.lineAt(e,t),l=s.state.doc.lineAt(r?r.posAtEnd:e),a=r?r.posAtStart:l.from,h=r?r.posAtEnd:l.to;return h<s.state.doc.length&&h==l.to&&h++,H.undirectionalRange(a,h)}}const ww=Y.ie&&Y.ie_version<=11;let ap=null,up=0,hp=0;function cp(s){if(!ww)return s.detail;let e=ap,t=hp;return ap=s,hp=Date.now(),up=!e||t>Date.now()-400&&Math.abs(e.clientX-s.clientX)<2&&Math.abs(e.clientY-s.clientY)<2?(up+1)%3:1}function kw(s,e){let t=s.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=cp(e),r=s.state.selection;return{update(l){l.docChanged&&(t.pos=l.changes.mapPos(t.pos),r=r.map(l.changes))},get(l,a,h){let c=s.posAndSideAtCoords({x:l.clientX,y:l.clientY},!1),d,m=lp(s,c.pos,c.assoc,n);if(t.pos!=c.pos&&!a){let y=lp(s,t.pos,t.assoc,n),v=Math.min(y.from,m.from),k=Math.max(y.to,m.to);m=v<m.from?H.range(v,k,m.assoc):H.range(k,v,m.assoc)}return a?r.replaceRange(r.main.extend(m.from,m.to,m.assoc)):h&&n==1&&r.ranges.length>1&&(d=xw(r,c.pos))?d:h?r.addRange(m):H.create([m])}}}function xw(s,e){for(let t=0;t<s.ranges.length;t++){let{from:n,to:r}=s.ranges[t];if(n<=e&&r>=e)return H.create(s.ranges.slice(0,t).concat(s.ranges.slice(t+1)),s.mainIndex==t?0:s.mainIndex-(s.mainIndex>t?1:0))}return null}rn.dragstart=(s,e)=>{let{selection:{main:t}}=s.state;if(e.target.draggable){let r=s.docView.tile.nearest(e.target);if(r&&r.isWidget()){let l=r.posAtStart,a=l+r.length;(l>=t.to||a<=t.from)&&(t=H.undirectionalRange(l,a))}}let{inputState:n}=s;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",Do(s.state,ku,s.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1},rn.dragend=s=>(s.inputState.draggedContent=null,!1);function fp(s,e,t,n){if(t=Do(s.state,wu,t),!t)return;let r=s.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:l}=s.inputState,a=n&&l&&mw(s,e)?{from:l.from,to:l.to}:null,h={from:r,insert:t},c=s.state.changes(a?[a,h]:h);s.focus(),s.dispatch({changes:c,selection:{anchor:c.mapPos(r,-1),head:c.mapPos(r,1)},userEvent:a?"move.drop":"input.drop"}),s.inputState.draggedContent=null}rn.drop=(s,e)=>{if(!e.dataTransfer)return!1;if(s.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),r=0,l=()=>{++r==t.length&&fp(s,e,n.filter(a=>a!=null).join(s.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let h=new FileReader;h.onerror=l,h.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(h.result)||(n[a]=h.result),l()},h.readAsText(t[a])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return fp(s,e,n,!0),!0}return!1},rn.paste=(s,e)=>{if(s.state.readOnly)return!0;s.observer.flush();let t=sp?null:e.clipboardData;return t?(op(s,t.getData("text/plain")||t.getData("text/uri-list")),!0):(vw(s),!1)};function Sw(s,e){let t=s.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),s.focus()},50)}function Cw(s){let e=[],t=[],n=!1;for(let r of s.selection.ranges)r.empty||(e.push(s.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:l}of s.selection.ranges){let a=s.doc.lineAt(l);a.number>r&&(e.push(a.text),t.push({from:a.from,to:Math.min(s.doc.length,a.to+1)})),r=a.number}n=!0}return{text:Do(s,ku,e.join(s.lineBreak)),ranges:t,linewise:n}}let Lu=null;rn.copy=rn.cut=(s,e)=>{if(!os(s.contentDOM,s.observer.selectionRange))return!1;let{text:t,ranges:n,linewise:r}=Cw(s.state);if(!t&&!r)return!1;Lu=r?t:null,e.type=="cut"&&!s.state.readOnly&&s.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let l=sp?null:e.clipboardData;return l?(l.clearData(),l.setData("text/plain",t),!0):(Sw(s,t),!1)};const dp=Bn.define();function pp(s,e){let t=[];for(let n of s.facet(Nd)){let r=n(s,e);r&&t.push(r)}return t.length?s.update({effects:t,annotations:dp.of(!0)}):null}function mp(s){setTimeout(()=>{let e=s.hasFocus;if(e!=s.inputState.notifiedFocused){let t=pp(s.state,e);t?s.dispatch(t):s.update([])}},10)}dt.focus=s=>{s.inputState.lastFocusTime=Date.now(),!s.scrollDOM.scrollTop&&(s.inputState.lastScrollTop||s.inputState.lastScrollLeft)&&(s.scrollDOM.scrollTop=s.inputState.lastScrollTop,s.scrollDOM.scrollLeft=s.inputState.lastScrollLeft),mp(s)},dt.blur=s=>{s.observer.clearSelectionRange(),mp(s)},dt.compositionstart=dt.compositionupdate=(s,e)=>{if(!s.observer.editContext&&(s.inputState.compositionFirstChange==null&&(s.inputState.compositionFirstChange=!0),s.inputState.composing<0)){let{main:t}=s.state.selection;!t.empty&&s.lineBlockAt(t.from).from!=s.lineBlockAt(t.to).from&&!s.state.readOnly&&s.dispatch({changes:s.state.selection.ranges.filter(n=>!n.empty).map(n=>({from:n.from,to:n.to})),userEvent:"input"}),s.inputState.composing=0}};const gp=dt.compositionend=s=>{s.observer.editContext||(s.inputState.composing=-1,s.inputState.compositionEndedAt=Date.now(),s.inputState.compositionPendingKey=!0,s.inputState.compositionPendingChange=s.observer.pendingRecords().length>0,s.inputState.compositionFirstChange=null,Y.chrome&&Y.android?s.observer.flushSoon():s.inputState.compositionPendingChange?Promise.resolve().then(()=>s.observer.flush()):setTimeout(()=>{s.inputState.composing<0&&s.docView.hasComposition&&s.update([])},50))};dt.contextmenu=s=>{s.inputState.endAndroidSelection(),s.inputState.lastContextMenu=Date.now()},rn.beforeinput=(s,e)=>{var t,n;if(s.inputState.composing>=0&&e.isComposing===!1&&gp(s),(e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(s.inputState.insertingText=e.data,s.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&s.observer.editContext){let l=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(l&&a.length){let h=a[0],c=s.posAtDOM(h.startContainer,h.startOffset),d=s.posAtDOM(h.endContainer,h.endOffset);return Ru(s,{from:c,to:d,insert:s.state.toText(l)},null),!0}}let r;if(Y.chrome&&Y.android&&(r=ip.find(l=>l.inputType==e.inputType))&&(s.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let l=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>l+10&&s.hasFocus&&(s.contentDOM.blur(),s.focus())},100)}return Y.ios&&e.inputType=="deleteContentForward"&&s.observer.flushSoon(),Y.safari&&e.inputType=="insertText"&&s.inputState.composing>=0&&setTimeout(()=>dt.compositionend(s,e),20),!1};const yp=new Set;function bw(s){yp.has(s)||(yp.add(s),s.addEventListener("copy",()=>{}),s.addEventListener("cut",()=>{}))}const vp=["pre-wrap","normal","pre-line","break-spaces"];let fr=!1;function wp(){fr=!1}class Aw{constructor(e){this.lineWrapping=e,this.doc=Me.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return vp.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,l,a){let h=vp.indexOf(e)>-1,c=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=h;if(this.lineWrapping=h,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=l,c){this.heightSamples={};for(let d=0;d<a.length;d++){let m=a[d];m<0?d++:this.heightSamples[Math.floor(m*10)]=!0}}return c}}class Tw{constructor(e,t,n){this.from=e,this.heights=t,this.gaps=n,this.index=0}get more(){return this.index<this.heights.length}hasGap(e,t){if(this.gaps){for(let n of this.gaps)if(n.from<t&&n.to>e)return!0}return!1}}class sn{constructor(e,t,n,r,l){this.from=e,this.length=t,this.top=n,this.height=r,this._content=l}get type(){return typeof this._content=="number"?Tt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Ri?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new sn(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Be=(function(s){return s[s.ByPos=0]="ByPos",s[s.ByHeight=1]="ByHeight",s[s.ByPosNoHeight=2]="ByPosNoHeight",s})(Be||(Be={}));const Lo=.001;class xt{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Lo&&(fr=!0),this.height=e)}replace(e,t,n){return xt.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let l=this,a=n.doc;for(let h=r.length-1;h>=0;h--){let{fromA:c,toA:d,fromB:m,toB:y}=r[h],v=l.lineAt(c,Be.ByPosNoHeight,n.setDoc(t),0,0),k=v.to>=d?v:l.lineAt(d,Be.ByPosNoHeight,n,0,0);for(y+=k.to-d,d=k.to;h>0&&v.from<=r[h-1].toA;)c=r[h-1].fromA,m=r[h-1].fromB,h--,c<v.from&&(v=l.lineAt(c,Be.ByPosNoHeight,n,0,0));m+=v.from-c,c=v.from;let x=Nu.build(n.setDoc(a),e,m,y);l=No(l,l.replace(c,d,x))}return l.updateHeight(n,0)}static empty(){return new It(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,r=0,l=0;for(;;)if(t==n)if(r>l*2){let h=e[t-1];h.break?e.splice(--t,1,h.left,null,h.right):e.splice(--t,1,h.left,h.right),n+=1+h.break,r-=h.size}else if(l>r*2){let h=e[n];h.break?e.splice(n,1,h.left,null,h.right):e.splice(n,1,h.left,h.right),n+=2+h.break,l-=h.size}else break;else if(r<l){let h=e[t++];h&&(r+=h.size)}else{let h=e[--n];h&&(l+=h.size)}let a=!1;return e[t-1]==null?(a=!0,t--):e[t]==null&&(a=!0,n++),new Ow(xt.of(e.slice(0,t)),a,xt.of(e.slice(n)))}}function No(s,e){return s==e?s:(s.constructor!=e.constructor&&(fr=!0),e)}xt.prototype.size=1;const Mw=Re.replace({});class kp extends xt{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new sn(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new sn(r,0,n,this.spaceAbove,Mw):this.mainBlock(n,r)}lineAt(e,t,n,r,l){let a=this.mainBlock(r,l);return this.spaceAbove?this.blockAt(0,n,r,l).join(a):a}forEachLine(e,t,n,r,l,a){e<=l+this.length&&t>=l&&a(this.lineAt(0,Be.ByPos,n,r,l))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class It extends kp{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new sn(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let r=n[0];return n.length==1&&(r instanceof It||r instanceof at&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof at?r=new It(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):xt.of(n)}updateHeight(e,t=0,n=!1,r){let l=n||this.outdated;return r&&r.from<=t&&r.more&&(this.setMeasuredHeight(r),r.hasGap(t,t+this.length)&&(l=!0)),l&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class at extends xt{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,l=r-n+1,a,h=0;if(e.lineWrapping){let c=Math.min(this.height,e.lineHeight*l);a=c/l,this.length>l+1&&(h=(this.height-c)/(this.length-l-1))}else a=this.height/l;return{firstLine:n,lastLine:r,perLine:a,perChar:h}}blockAt(e,t,n,r){let{firstLine:l,lastLine:a,perLine:h,perChar:c}=this.heightMetrics(t,r);if(t.lineWrapping){let d=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),m=t.doc.lineAt(d),y=h+m.length*c,v=Math.max(n,e-y/2);return new sn(m.from,m.length,v,y,0)}else{let d=Math.max(0,Math.min(a-l,Math.floor((e-n)/h))),{from:m,length:y}=t.doc.line(l+d);return new sn(m,y,n+h*d,h,0)}}lineAt(e,t,n,r,l){if(t==Be.ByHeight)return this.blockAt(e,n,r,l);if(t==Be.ByPosNoHeight){let{from:k,to:x}=n.doc.lineAt(e);return new sn(k,x-k,0,0,0)}let{firstLine:a,perLine:h,perChar:c}=this.heightMetrics(n,l),d=n.doc.lineAt(e),m=h+d.length*c,y=d.number-a,v=r+h*y+c*(d.from-l-y);return new sn(d.from,d.length,Math.max(r,Math.min(v,r+this.height-m)),m,0)}forEachLine(e,t,n,r,l,a){e=Math.max(e,l),t=Math.min(t,l+this.length);let{firstLine:h,perLine:c,perChar:d}=this.heightMetrics(n,l);for(let m=e,y=r;m<=t;){let v=n.doc.lineAt(m);if(m==e){let x=v.number-h;y+=c*x+d*(e-l-x)}let k=c+d*v.length;a(new sn(v.from,v.length,y,k,0)),y+=k,m=v.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let l=n[n.length-1];l instanceof at?n[n.length-1]=new at(l.length+r):n.push(null,new at(r-1))}if(e>0){let l=n[0];l instanceof at?n[0]=new at(e+l.length):n.unshift(new at(e-1),null)}return xt.of(n)}decomposeLeft(e,t){t.push(new at(e-1),null)}decomposeRight(e,t){t.push(null,new at(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let l=t+this.length;if(r&&r.from<=t+this.length&&r.more){let a=[],h=Math.max(t,r.from),c=-1;for(r.from>t&&a.push(new at(r.from-t-1).updateHeight(e,t));h<=l&&r.more;){let m=e.doc.lineAt(h).length;a.length&&a.push(null);let y=r.heights[r.index++],v=0;y<0&&(v=-y,y=r.heights[r.index++]),c==-1?c=y:Math.abs(y-c)>=Lo&&(c=-2);let k=new It(m,y,v);k.outdated=!1,a.push(k),h+=m+1}h<=l&&a.push(null,new at(l-h).updateHeight(e,h));let d=xt.of(a);return(c<0||Math.abs(d.height-this.height)>=Lo||Math.abs(c-this.heightMetrics(e,t).perLine)>=Lo)&&(fr=!0),No(this,d)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class Ow extends xt{constructor(e,t,n){super(e.length+(t?1:0)+n.length,e.height+n.height,(t?1:0)|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let l=n+this.left.height;return e<l?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,l,r+this.left.length+this.break)}lineAt(e,t,n,r,l){let a=r+this.left.height,h=l+this.left.length+this.break,c=t==Be.ByHeight?e<a:e<h,d=c?this.left.lineAt(e,t,n,r,l):this.right.lineAt(e,t,n,a,h);if(this.break||(c?d.to<h:d.from>h))return d;let m=t==Be.ByPosNoHeight?Be.ByPosNoHeight:Be.ByPos;return c?d.join(this.right.lineAt(h,m,n,a,h)):this.left.lineAt(h,m,n,r,l).join(d)}forEachLine(e,t,n,r,l,a){let h=r+this.left.height,c=l+this.left.length+this.break;if(this.break)e<c&&this.left.forEachLine(e,t,n,r,l,a),t>=c&&this.right.forEachLine(e,t,n,h,c,a);else{let d=this.lineAt(c,Be.ByPos,n,r,l);e<d.from&&this.left.forEachLine(e,Math.min(t,d.from-1),n,r,l,a),d.to>=e&&d.from<=t&&a(d),t>d.to&&this.right.forEachLine(Math.max(e,d.to+1),t,n,h,c,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let l=[];e>0&&this.decomposeLeft(e,l);let a=l.length;for(let h of n)l.push(h);if(e>0&&xp(l,a-1),t<this.length){let h=l.length;this.decomposeRight(t,l),xp(l,h)}return xt.of(l)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?xt.of(this.break?[e,null,t]:[e,t]):(this.left=No(this.left,e),this.right=No(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:l,right:a}=this,h=t+l.length+this.break,c=null;return r&&r.from<=t+l.length&&r.more?c=l=l.updateHeight(e,t,n,r):l.updateHeight(e,t,n),r&&r.from<=h+a.length&&r.more?c=a=a.updateHeight(e,h,n,r):a.updateHeight(e,h,n),c?this.balanced(l,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function xp(s,e){let t,n;s[e]==null&&(t=s[e-1])instanceof at&&(n=s[e+1])instanceof at&&s.splice(e-1,3,new at(t.length+1+n.length))}const Ew=5;class Nu{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof It?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new It(n-this.pos,-1,0)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,l=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new kp(a,r,n)):(a||l||r>=Ew)&&this.addLineDeco(r,l,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new It(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new at(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof It)return e;let t=new It(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof It)&&!this.isCovered?this.nodes.push(new It(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let r of this.nodes)r instanceof It&&r.updateHeight(this.oracle,n),n+=r?r.length:1;return this.nodes}static build(e,t,n,r){let l=new Nu(n,e);return be.spans(t,n,r,l,0),l.finish(n)}}function Pw(s,e,t){let n=new Rw;return be.compare(s,e,t,n,0),n.changes}class Rw{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&nr(e,t,this.changes,5)}}function Dw(s,e){let t=s.getBoundingClientRect(),n=s.ownerDocument,r=n.defaultView||window,l=Math.max(0,t.left),a=Math.min(r.innerWidth,t.right),h=Math.max(0,t.top),c=Math.min(r.innerHeight,t.bottom);for(let d=s.parentNode;d&&d!=n.body;)if(it(d)){let m=window.getComputedStyle(d);if((d.scrollHeight>d.clientHeight||d.scrollWidth>d.clientWidth)&&m.overflow!="visible"){let y=d.getBoundingClientRect();l=Math.max(l,y.left),a=Math.min(a,y.right),h=Math.max(h,y.top),c=Math.min(d==s.parentNode?r.innerHeight:c,y.bottom)}d=m.position=="absolute"||m.position=="fixed"?d.offsetParent:d.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:l-t.left,right:Math.max(l,a)-t.left,top:h-(t.top+e),bottom:Math.max(h,c)-(t.top+e)}}function Lw(s){let e=s.getBoundingClientRect(),t=s.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function Nw(s,e){let t=s.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Bu{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],l=t[n];if(r.from!=l.from||r.to!=l.to||r.size!=l.size)return!1}return!0}draw(e,t){return Re.replace({widget:new Bw(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class Bw extends ts{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Sp{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Iu,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=je.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(Su).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new Aw(n),this.stateDeco=Cp(t),this.heightMap=xt.empty().applyChanges(this.stateDeco,Me.empty,this.heightOracle.setDoc(t.doc),[new Ut(0,0,0,t.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Re.set(this.lineGaps.map(r=>r.draw(this,n))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:l,to:a})=>r>=l&&r<=a)){let{from:l,to:a}=this.lineBlockAt(r);e.push(new Bo(l,a))}}return this.viewports=e.sort((n,r)=>n.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Iu:Fo.get(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(fs(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=Cp(this.state);let r=e.changedRanges,l=Ut.extendWithRanges(r,Pw(n,this.stateDeco,e?e.changes:et.empty(this.state.doc.length))),a=this.heightMap.height,h=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);wp(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),l),(this.heightMap.height!=a||fr)&&(e.flags|=2),h?(this.scrollAnchorPos=e.changes.mapPos(h.from,-1),this.scrollAnchorHeight=h.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let c=l.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<c.from||t.range.head>c.to)||!this.viewportIsAppropriate(c))&&(c=this.getViewport(0,t));let d=c.from!=this.viewport.from||c.to!=this.viewport.to;this.viewport=c,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(A1)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,l=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?je.RTL:je.LTR;let a=this.heightOracle.mustRefreshForWrapping(l)||this.mustMeasureContent==="refresh",h=t.getBoundingClientRect(),c=a||this.mustMeasureContent||this.contentDOMHeight!=h.height;this.contentDOMHeight=h.height,this.mustMeasureContent=!1;let d=0,m=0;if(h.width&&h.height){let{scaleX:I,scaleY:F}=md(t,h);(I>.005&&Math.abs(this.scaleX-I)>.005||F>.005&&Math.abs(this.scaleY-F)>.005)&&(this.scaleX=I,this.scaleY=F,d|=16,a=c=!0)}let y=(parseInt(n.paddingTop)||0)*this.scaleY,v=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=y||this.paddingBottom!=v)&&(this.paddingTop=y,this.paddingBottom=v,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(c=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let k=gd(this.view.contentDOM,!1).y;k!=this.scrollParent&&(this.scrollParent=k,this.scrollAnchorHeight=-1,this.scrollOffset=0);let x=this.getScrollOffset();this.scrollOffset!=x&&(this.scrollAnchorHeight=-1,this.scrollOffset=x),this.scrolledToBottom=xd(this.scrollParent||e.win);let S=(this.printing?Nw:Dw)(t,this.paddingTop),T=S.top-this.pixelViewport.top,D=S.bottom-this.pixelViewport.bottom;this.pixelViewport=S;let q=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(q!=this.inView&&(this.inView=q,q&&(c=!0)),!this.inView&&!this.scrollTarget&&!Lw(e.dom))return 0;let L=h.width,_=this.contentDOMWidth;if((_!=L||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=h.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),c){let I=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(I)&&(a=!0),a||r.lineWrapping&&Math.abs(L-_)>r.charWidth){let{lineHeight:F,charWidth:ee,textHeight:ge}=e.docView.measureTextSize();a=F>0&&r.refresh(l,F,ee,ge,Math.max(5,L/ee),I),a&&(e.docView.minWidth=0,d|=16)}T>0&&D>0?m=Math.max(T,D):T<0&&D<0&&(m=Math.min(T,D)),wp();for(let F of this.viewports){let ee=F.from==this.viewport.from?I:e.docView.measureVisibleLineHeights(F),ge=this.lineGaps.length&&this.heightOracle.lineWrapping?this.lineGaps:null;this.heightMap=(a?xt.empty().applyChanges(this.stateDeco,Me.empty,this.heightOracle,[new Ut(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new Tw(F.from,ee,ge))}fr&&(d|=2)}let K=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return K&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),d|=this.updateForViewport()),(d&2||K)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}setMustMeasure(){this.mustMeasureContent||(this.mustMeasureContent=!0)}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,l=this.heightOracle,{visibleTop:a,visibleBottom:h}=this,c=new Bo(r.lineAt(a-n*1e3,Be.ByHeight,l,0,0).from,r.lineAt(h+(1-n)*1e3,Be.ByHeight,l,0,0).to);if(t){let{head:d}=t.range;if(d<c.from||d>c.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),y=r.lineAt(d,Be.ByPos,l,0,0),v;t.y=="center"?v=(y.top+y.bottom)/2-m/2:t.y=="start"||t.y=="nearest"&&d<c.from?v=y.top:v=y.bottom-m,c=new Bo(r.lineAt(v-1e3/2,Be.ByHeight,l,0,0).from,r.lineAt(v+m+1e3/2,Be.ByHeight,l,0,0).to)}}return c}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new Bo(this.heightMap.lineAt(n,Be.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Be.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Be.ByPos,this.heightOracle,0,0),{bottom:l}=this.heightMap.lineAt(t,Be.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:h}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||l>=h+Math.max(10,Math.min(n,250)))&&r>a-2*1e3&&l<h+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Bu(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,l=r>>1,a=r<<1;if(this.defaultTextDirection!=je.LTR&&!n)return[];let h=[],c=(m,y,v,k)=>{if(y-m<l)return;let x=this.state.selection.main,S=[x.from];x.empty||S.push(x.to);for(let D of S)if(D>m&&D<y){c(m,D-10,v,k),c(D+10,y,v,k);return}let T=zw(e,D=>D.from>=v.from&&D.to<=v.to&&Math.abs(D.from-m)<l&&Math.abs(D.to-y)<l&&!S.some(q=>D.from<q&&D.to>q));if(!T){if(y<v.to&&t&&n&&t.visibleRanges.some(L=>L.from<=y&&L.to>=y)){let L=t.moveToLineBoundary(H.cursor(y),!1,!0).head;L>m&&(y=L)}let D=this.gapSize(v,m,y,k),q=n||D<2e6?D:2e6;T=new Bu(m,y,D,q)}h.push(T)},d=m=>{if(m.length<a||m.type!=Tt.Text)return;let y=Iw(m.from,m.to,this.stateDeco);if(y.total<a)return;let v=this.scrollTarget?this.scrollTarget.range.head:null,k,x;if(n){let S=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,T,D;if(v!=null){let q=zo(y,v),L=((this.visibleBottom-this.visibleTop)/2+S)/m.height;T=q-L,D=q+L}else T=(this.visibleTop-m.top-S)/m.height,D=(this.visibleBottom-m.top+S)/m.height;k=Io(y,T),x=Io(y,D)}else{let S=y.total*this.heightOracle.charWidth,T=r*this.heightOracle.charWidth,D=0;if(S>2e6)for(let I of e)I.from>=m.from&&I.from<m.to&&I.size!=I.displaySize&&I.from*this.heightOracle.charWidth+D<this.pixelViewport.left&&(D=I.size-I.displaySize);let q=this.pixelViewport.left+D,L=this.pixelViewport.right+D,_,K;if(v!=null){let I=zo(y,v),F=((L-q)/2+T)/S;_=I-F,K=I+F}else _=(q-T)/S,K=(L+T)/S;k=Io(y,_),x=Io(y,K)}k>m.from&&c(m.from,k,m,y),x<m.to&&c(x,m.to,m,y)};for(let m of this.viewportLines)Array.isArray(m.type)?m.type.forEach(d):d(m);return h}gapSize(e,t,n,r){let l=zo(r,n)-zo(r,t);return this.heightOracle.lineWrapping?e.height*l:r.total*this.heightOracle.charWidth*l}updateLineGaps(e){Bu.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Re.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];be.spans(t,this.viewport.from,this.viewport.to,{span(l,a){n.push({from:l,to:a})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let l=0;l<n.length&&!(r&8);l++){let a=this.visibleRanges[l],h=n[l];(a.from!=h.from||a.to!=h.to)&&(r|=4,e&&e.mapPos(a.from,-1)==h.from&&e.mapPos(a.to,1)==h.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||fs(this.heightMap.lineAt(e,Be.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||fs(this.heightMap.lineAt(this.scaler.fromDOM(e),Be.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return fs(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Bo{constructor(e,t){this.from=e,this.to=t}}function Iw(s,e,t){let n=[],r=s,l=0;return be.spans(t,s,e,{span(){},point(a,h){a>r&&(n.push({from:r,to:a}),l+=a-r),r=h}},20),r<e&&(n.push({from:r,to:e}),l+=e-r),{total:l,ranges:n}}function Io({total:s,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(s*t);for(let r=0;;r++){let{from:l,to:a}=e[r],h=a-l;if(n<=h)return l+n;n-=h}}function zo(s,e){let t=0;for(let{from:n,to:r}of s.ranges){if(e<=r){t+=e-n;break}t+=r-n}return t/s.total}function zw(s,e){for(let t of s)if(e(t))return t}const Iu={toDOM(s){return s},fromDOM(s){return s},scale:1,eq(s){return s==this}};function Cp(s){let e=s.facet(bo).filter(n=>typeof n!="function"),t=s.facet(Cu).filter(n=>typeof n!="function");return t.length&&e.push(be.join(t)),e}class Fo{constructor(e,t){this.scale=e,this.viewports=t}static get(e,t,n){let r=0,l=0,a=0,h=n.map(({from:d,to:m})=>{let y=t.lineAt(d,Be.ByPos,e,0,0).top,v=t.lineAt(m,Be.ByPos,e,0,0).bottom;return r+=v-y,{from:d,to:m,top:y,bottom:v,domTop:0,domBottom:0}});if(t.height-r<10)return Iu;let c=(7e6-r)/(t.height-r);for(let d of h)d.domTop=a+(d.top-l)*c,a=d.domBottom=d.domTop+(d.bottom-d.top),l=d.bottom;return new Fo(c,h)}toDOM(e){for(let t=0,n=0,r=0;;t++){let l=t<this.viewports.length?this.viewports[t]:null;if(!l||e<l.top)return r+(e-n)*this.scale;if(e<=l.bottom)return l.domTop+(e-l.top);n=l.bottom,r=l.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let l=t<this.viewports.length?this.viewports[t]:null;if(!l||e<l.domTop)return n+(e-r)/this.scale;if(e<=l.domBottom)return l.top+(e-l.domTop);n=l.bottom,r=l.domBottom}}eq(e){return e instanceof Fo?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function fs(s,e){if(e.scale==1)return s;let t=e.toDOM(s.top),n=e.toDOM(s.bottom);return new sn(s.from,s.length,t,n-t,Array.isArray(s._content)?s._content.map(r=>fs(r,e)):s._content)}const _o=te.define({combine:s=>s.join(" ")}),zu=te.define({combine:s=>s.indexOf(!0)>-1}),Fu=Xn.newName(),bp=Xn.newName(),Ap=Xn.newName(),Tp={"&light":"."+bp,"&dark":"."+Ap};function _u(s,e,t){return new Xn(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,r=>{if(r=="&")return s;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):s+" "+n}})}const Fw=_u("."+Fu,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{userSelect:"none",position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"baseline",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Tp),_w={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ju=Y.ie&&Y.ie_version<=11;class jw{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new d1,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(Y.ie&&Y.ie_version<=11||Y.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():Y.ios&&t.some(n=>n.type=="childList"&&Array.prototype.some.call(n.addedNodes,rr))?this.flushSoon():this.flush()}),window.EditContext&&Y.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Y.chrome&&Y.chrome_version<126)&&(this.editContext=new Hw(e),e.state.facet(Fn)&&(e.contentDOM.editContext=this.editContext.editContext)),ju&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(this.pendingRecords().length>0),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(this.view.inputState.selectionchange(),!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(Fn)?n.root.activeElement!=this.dom:!os(this.dom,r))return;let l=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(l&&l.isWidget()&&l.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Y.ie&&Y.ie_version<=11||Y.android&&Y.chrome)&&!n.state.selection.main.empty&&r.focusNode&&ls(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=e.dom.isConnected?ss(e.root):null;if(!t)return!1;let n=Y.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Vw(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=os(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&m1(this.dom,n)&&this.view.updateState==0?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(it(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,_w),ju&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ju&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let r=()=>{let l=this.delayedAndroidKey;l&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=l.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&l.force&&sr(this.dom,l.key,l.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}clearDelayedFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1)}forceFlush(){this.clearDelayedFlush(),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[],this.view.viewState.setMustMeasure());let t=-1,n=-1,r=!1;for(let l of e){let a=this.readMutation(l);a&&(a.typeOver&&(r=!0),t==-1?{from:t,to:n}=a:(t=Math.min(a.from,t),n=Math.max(a.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&os(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let l=new iw(this.view,e,t,n);return this.view.docView.domChanged={newSel:l.newSel?l.newSel.main:null},l}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,l=ep(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),l}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=Mp(t,e.previousSibling||e.target.previousSibling,-1),r=Mp(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Fn)!=e.state.facet(Fn)&&(e.view.contentDOM.editContext=e.state.facet(Fn)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Mp(s,e,t){for(;e;){let n=Ge.get(e);if(n&&n.parent==s)return n;let r=e.parentNode;e=r!=s.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function Op(s,e){let t=e.startContainer,n=e.startOffset,r=e.endContainer,l=e.endOffset,a=s.docView.domAtPos(s.state.selection.main.anchor,1);return ls(a.node,a.offset,r,l)&&([t,n,r,l]=[r,l,t,n]),{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:l}}function Vw(s,e){if(e.getComposedRanges){let r=e.getComposedRanges(s.root)[0];if(r)return Op(s,r)}let t=null;function n(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return s.contentDOM.addEventListener("beforeinput",n,!0),s.dom.ownerDocument.execCommand("indent"),s.contentDOM.removeEventListener("beforeinput",n,!0),t?Op(s,t):null}class Hw{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:l,head:a}=r,h=this.toEditorPos(n.updateRangeStart),c=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:h,drifted:!1});let d=c-h>n.text.length;h==this.from&&l<this.from?h=l:c==this.to&&l>this.to&&(c=l);let m=tp(e.state.sliceDoc(h,c),n.text,(d?r.from:r.to)-h,d?"end":null);if(!m){let v=H.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Du(v,r)||e.dispatch({selection:v,userEvent:"select"});return}let y={from:m.from+h,to:m.toA+h,insert:Me.of(n.text.slice(m.from,m.toB).split(`
28
+ `))};if((Y.mac||Y.android)&&y.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(y={from:h,to:c,insert:Me.of([n.text.replace("."," ")])}),this.pendingContextChange=y,!e.state.readOnly){let v=this.to-this.from+(y.to-y.from+y.insert.length);Ru(e,y,H.single(this.toEditorPos(n.selectionStart,v),this.toEditorPos(n.selectionEnd,v)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),y.from<y.to&&!y.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],l=null;for(let a=this.toEditorPos(n.rangeStart),h=this.toEditorPos(n.rangeEnd);a<h;a++){let c=e.coordsForChar(a);l=c&&new DOMRect(c.left,c.top,c.right-c.left,c.bottom-c.top)||l||new DOMRect,r.push(l)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let l of n.getTextFormats()){let a=l.underlineStyle,h=l.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(h)){let c=this.toEditorPos(l.rangeStart),d=this.toEditorPos(l.rangeEnd);if(c<d){let m=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(h)?1:2}px`;r.push(Re.mark({attributes:{style:m}}).range(c,d))}}}e.dispatch({effects:zd.of(Re.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{let r=ss(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((l,a,h,c,d)=>{if(n)return;let m=d.length-(a-l);if(r&&a>=r.to)if(r.from==l&&r.to==a&&r.insert.eq(d)){r=this.pendingContextChange=null,t+=m,this.to+=m;return}else r=null,this.revertPending(e.state);if(l+=t,a+=t,a<=this.from)this.from+=m,this.to+=m;else if(l<this.to){if(l<this.from||a>this.to||this.to-this.from+d.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(l),this.toContextPos(a),d.toString()),this.to+=m}t+=m}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class ue{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(l=>n(l,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||p1(e.parent)||document,this.viewState=new Sp(this,e.state||Oe.create(e)),e.scrollTo&&e.scrollTo.is(Co)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ar).map(r=>new xu(r));for(let r of this.plugins)r.update(this);this.observer=new jw(this),this.inputState=new aw(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Gd(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Je?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,r,l=this.state;for(let v of e){if(v.startState!=l)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");l=v.state}if(this.destroyed){this.viewState.state=l;return}let a=this.hasFocus,h=0,c=null;e.some(v=>v.annotation(dp))?(this.inputState.notifiedFocused=a,h=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,c=pp(l,a),c||(h=1));let d=this.observer.delayedAndroidKey,m=null;if(d?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange()):this.observer.delayedFlush>-1?(this.observer.clearDelayedFlush(),m=this.observer.readChange()):this.observer.clear(),(m&&!this.state.doc.eq(l.doc)||!this.state.selection.eq(l.selection))&&(m=null),l.facet(Oe.phrases)!=this.state.facet(Oe.phrases))return this.setState(l);r=Ao.create(this,l,e),r.flags|=h;let y=this.viewState.scrollTarget;try{this.updateState=2;for(let v of e){if(y&&(y=y.map(v.changes)),v.scrollIntoView){let{main:k}=v.state.selection,{x,y:S}=this.state.facet(ue.cursorScrollMargin);y=new lr(k.empty?k:H.cursor(k.head,k.head>k.anchor?-1:1),"nearest","nearest",S,x)}for(let k of v.effects)k.is(Co)&&(y=k.value.clip(this.state))}this.viewState.update(r,y),this.bidiCache=jo.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(hs)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(v=>v.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(_o)!=r.state.facet(_o)&&this.viewState.setMustMeasure(),(t||n||y||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let v of this.state.facet(vu))try{v(r)}catch(k){Wt(this.state,k,"update listener")}(c||m)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),m&&!ep(this,m)&&d.force&&sr(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Sp(this,e),this.plugins=e.facet(ar).map(n=>new xu(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new Gd(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(ar),n=e.state.facet(ar);if(t!=n){let r=[];for(let l of n){let a=t.indexOf(l);if(a<0)r.push(new xu(l));else{let h=this.plugins[a];h.mustUpdate=e,r.push(h)}}for(let l of this.plugins)l.mustUpdate!=e&&l.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){Wt(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:l,scrollAnchorHeight:a,scaleY:h}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(a<0){if(xd(n||this.win))l=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let x=this.viewState.scrollAnchorAt(r);l=x.from,a=x.top}h=this.viewState.scaleY}this.updateState=1;let d=this.viewState.measure();if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let m=[];d&4||([this.measureRequests,m]=[m,this.measureRequests]);let y=m.map(x=>{try{return x.read(this)}catch(S){return Wt(this.state,S),Ep}}),v=Ao.create(this,this.state,[]),k=!1;v.flags|=d,t?t.flags|=d:t=v,this.updateState=2,v.empty||(this.updatePlugins(v),this.inputState.update(v),this.updateAttrs(),k=this.docView.update(v),k&&this.docViewUpdate());for(let x=0;x<m.length;x++)if(y[x]!=Ep)try{let S=m[x];S.write&&S.write(y[x],this)}catch(S){Wt(this.state,S)}if(k&&this.docView.updateSelection(!0),!v.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let S=(l<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(l).top)/this.viewState.scaleY-a/h;if((S>1||S<-1)&&!(Y.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+S,n?l<0?n.scrollTop=n.scrollHeight:n.scrollTop+=S:this.win.scrollBy(0,S),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let c of this.state.facet(vu))c(t)}get themeClasses(){return Fu+" "+(this.state.facet(zu)?Ap:bp)+" "+this.state.facet(_o)}updateAttrs(){let e=Pp(this,Fd,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Fn)?"true":"false",class:"cm-content",style:`${Y.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Pp(this,Su,t);let n=this.observer.ignore(()=>{let r=fd(this.contentDOM,this.contentAttrs,t),l=fd(this.dom,this.editorAttrs,e);return r||l});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let r of n.effects)if(r.is(ue.announce)){t&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1);let l=this.announceDOM.appendChild(document.createElement("div"));l.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(hs);let e=this.state.facet(ue.cspNonce);Xn.mount(this.root,this.styleModules.concat(Fw).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return Eu(this,e,Yd(this,e,t,n))}moveByGroup(e,t){return Eu(this,e,Yd(this,e,t,n=>J1(this,e.head,n)))}visualLineSide(e,t){return t?H.cursor(e.to,1):H.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return X1(this,e,t,n)}moveVertically(e,t,n){return Eu(this,e,Z1(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=Pu(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Pu(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),l=r[xn.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&l.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+l.from,t=1):(e=n.from+l.to,t=-1)),this.docView.coordsAt(e,t,l.dir==je.RTL)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Bd)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Ww)return Md(e.length);let t=this.textDirectionAt(e.from),n;for(let l of this.bidiCache)if(l.from==e.from&&l.dir==t&&(l.fresh||Td(l.isolates,n=Vd(this,e))))return l.order;n||(n=Vd(this,e));let r=S1(e.text,t,n);return this.bidiCache.push(new jo(e.from,e.to,t,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Y.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{wd(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var n,r,l,a;return Co.of(new lr(typeof e=="number"?H.cursor(e):e,(n=t.y)!==null&&n!==void 0?n:"nearest",(r=t.x)!==null&&r!==void 0?r:"nearest",(l=t.yMargin)!==null&&l!==void 0?l:5,(a=t.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Co.of(new lr(H.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Mt.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Mt.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Xn.newName(),r=[_o.of(n),hs.of(_u(`.${n}`,e))];return t&&t.dark&&r.push(zu.of(!0)),r}static baseTheme(e){return $a.lowest(hs.of(_u("."+Fu,e,Tp)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&Ge.get(n)||Ge.get(e);return((t=r?.root)===null||t===void 0?void 0:t.view)||null}}ue.styleModule=hs,ue.inputHandler=Ld,ue.clipboardInputFilter=wu,ue.clipboardOutputFilter=ku,ue.scrollHandler=Id,ue.focusChangeEffect=Nd,ue.perLineTextDirection=Bd,ue.exceptionSink=Dd,ue.updateListener=vu,ue.editable=Fn,ue.mouseSelectionStyle=Rd,ue.dragMovesSelection=Pd,ue.clickAddsSelectionRange=Ed,ue.decorations=bo,ue.blockWrappers=_d,ue.outerDecorations=Cu,ue.atomicRanges=us,ue.bidiIsolatedRanges=jd,ue.cursorScrollMargin=te.define({combine:s=>{let e=5,t=5;for(let n of s)typeof n=="number"?e=t=n:{x:e,y:t}=n;return{x:e,y:t}}}),ue.coveredMargins=Ud,ue.scrollMargins=Wd,ue.darkTheme=zu,ue.cspNonce=te.define({combine:s=>s.length?s[0]:""}),ue.contentAttributes=Su,ue.editorAttributes=Fd,ue.lineWrapping=ue.contentAttributes.of({class:"cm-lineWrapping"}),ue.announce=Le.define();const Ww=4096,Ep={};class jo{constructor(e,t,n,r,l,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=l,this.order=a}static update(e,t){if(t.empty&&!e.some(l=>l.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:je.LTR;for(let l=Math.max(0,e.length-10);l<e.length;l++){let a=e[l];a.dir==r&&!t.touchesRange(a.from,a.to)&&n.push(new jo(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return n}}function Pp(s,e,t){for(let n=s.state.facet(e),r=n.length-1;r>=0;r--){let l=n[r],a=typeof l=="function"?l(s):l;a&&hu(a,t)}return t}const Uw=Y.mac?"mac":Y.windows?"win":Y.linux?"linux":"key";function $w(s,e){const t=s.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let r,l,a,h;for(let c=0;c<t.length-1;++c){const d=t[c];if(/^(cmd|meta|m)$/i.test(d))h=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))l=!0;else if(/^s(hift)?$/i.test(d))a=!0;else if(/^mod$/i.test(d))e=="mac"?h=!0:l=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(n="Alt-"+n),l&&(n="Ctrl-"+n),h&&(n="Meta-"+n),a&&(n="Shift-"+n),n}function Vo(s,e,t){return e.altKey&&(s="Alt-"+s),e.ctrlKey&&(s="Ctrl-"+s),e.metaKey&&(s="Meta-"+s),t!==!1&&e.shiftKey&&(s="Shift-"+s),s}const Kw=$a.default(ue.domEventHandlers({keydown(s,e){return Yw(Qw(e.state),s,e,"editor")}})),Rp=te.define({enables:Kw}),Dp=new WeakMap;function Qw(s){let e=s.facet(Rp),t=Dp.get(e);return t||Dp.set(e,t=qw(e.reduce((n,r)=>n.concat(r),[]))),t}let ei=null;const Gw=4e3;function qw(s,e=Uw){let t=Object.create(null),n=Object.create(null),r=(a,h)=>{let c=n[a];if(c==null)n[a]=h;else if(c!=h)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},l=(a,h,c,d,m)=>{var y,v;let k=t[a]||(t[a]=Object.create(null)),x=h.split(/ (?!$)/).map(D=>$w(D,e));for(let D=1;D<x.length;D++){let q=x.slice(0,D).join(" ");r(q,!0),k[q]||(k[q]={preventDefault:!0,stopPropagation:!1,run:[L=>{let _=ei={view:L,prefix:q,scope:a};return setTimeout(()=>{ei==_&&(ei=null)},Gw),!0}]})}let S=x.join(" ");r(S,!1);let T=k[S]||(k[S]={preventDefault:!1,stopPropagation:!1,run:((v=(y=k._any)===null||y===void 0?void 0:y.run)===null||v===void 0?void 0:v.slice())||[]});c&&T.run.push(c),d&&(T.preventDefault=!0),m&&(T.stopPropagation=!0)};for(let a of s){let h=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of h){let m=t[d]||(t[d]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:y}=a;for(let v in m)m[v].run.push(k=>y(k,Vu))}let c=a[e]||a.key;if(c)for(let d of h)l(d,c,a.run,a.preventDefault,a.stopPropagation),a.shift&&l(d,"Shift-"+c,a.shift,a.preventDefault,a.stopPropagation)}return t}let Vu=null;function Yw(s,e,t,n){Vu=e;let r=l1(e),l=Wv(r,0),a=Uv(l)==r.length&&r!=" ",h="",c=!1,d=!1,m=!1;ei&&ei.view==t&&ei.scope==n&&(h=ei.prefix+" ",rp.indexOf(e.keyCode)<0&&(d=!0,ei=null));let y=new Set,v=T=>{if(T){for(let D of T.run)if(!y.has(D)&&(y.add(D),D(t)))return T.stopPropagation&&(m=!0),!0;T.preventDefault&&(T.stopPropagation&&(m=!0),d=!0)}return!1},k=s[n],x,S;return k&&(v(k[h+Vo(r,e,!a)])?c=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Y.windows&&e.ctrlKey&&e.altKey)&&!(Y.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(x=Jn[e.keyCode])&&x!=r?(v(k[h+Vo(x,e,!0)])||e.shiftKey&&(S=es[e.keyCode])!=r&&S!=x&&v(k[h+Vo(S,e,!1)]))&&(c=!0):a&&e.shiftKey&&v(k[h+Vo(r,e,!0)])&&(c=!0),!c&&v(k._any)&&(c=!0)),d&&(c=!0),c&&m&&e.stopPropagation(),Vu=null,c}function Xw(){return Zw}const Jw=Re.line({class:"cm-activeLine"}),Zw=Mt.fromClass(class{constructor(s){this.decorations=this.getDeco(s)}update(s){(s.docChanged||s.selectionSet)&&(this.decorations=this.getDeco(s.view))}getDeco(s){let e=-1,t=[];for(let n of s.state.selection.ranges){let r=s.lineBlockAt(n.head);r.from>e&&(t.push(Jw.range(r.from)),e=r.from)}return Re.set(t)}},{decorations:s=>s.decorations}),ds="-10000px";class Lp{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(a=>a);let l=null;this.tooltipViews=this.tooltips.map(a=>l=n(a,l))}update(e,t){var n;let r=e.state.facet(this.facet),l=r.filter(c=>c);if(r===this.input){for(let c of this.tooltipViews)c.update&&c.update(e);return!1}let a=[],h=t?[]:null;for(let c=0;c<l.length;c++){let d=l[c],m=-1;if(d){for(let y=0;y<this.tooltips.length;y++){let v=this.tooltips[y];v&&v.create==d.create&&(m=y)}if(m<0)a[c]=this.createTooltipView(d,c?a[c-1]:null),h&&(h[c]=!!d.above);else{let y=a[c]=this.tooltipViews[m];h&&(h[c]=t[m]),y.update&&y.update(e)}}}for(let c of this.tooltipViews)a.indexOf(c)<0&&(this.removeTooltipView(c),(n=c.destroy)===null||n===void 0||n.call(c));return t&&(h.forEach((c,d)=>t[d]=c),t.length=h.length),this.input=r,this.tooltips=l,this.tooltipViews=a,!0}}function Np(s){let e=s.dom.ownerDocument.documentElement,t=e.clientWidth,n=getComputedStyle(e);if(!/stable/.test(n.scrollbarGutter||""))return{left:0,right:t};let r=e.getBoundingClientRect(),l=s.win.scrollX;return{left:Math.max(0,r.left+l-parseFloat(n.marginLeft)),right:Math.min(t,r.right+l+parseFloat(n.marginRight))}}function ek(s){let{left:e,right:t}=Np(s);return{top:0,left:e,right:t,bottom:s.dom.ownerDocument.documentElement.clientHeight}}const Hu=te.define({combine:s=>{var e,t,n;return{position:Y.ios?"absolute":((e=s.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=s.find(r=>r.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=s.find(r=>r.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||ek}}}),Bp=new WeakMap,Ip=Mt.fromClass(class{constructor(s){this.view=s,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=s.state.facet(Hu);this.position=e.position,this.parent=e.parent,this.classes=s.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new Lp(s,Wu,(t,n)=>this.createTooltip(t,n),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),s.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let s of this.manager.tooltipViews)this.intersectionObserver.observe(s.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(s){s.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(s,this.above);e&&this.observeIntersection();let t=e||s.geometryChanged,n=s.state.facet(Hu);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(s,e){let t=s.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),s.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",t.dom.appendChild(r)}return t.dom.style.position=this.position,t.dom.style.top=ds,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var s,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(s=n.destroy)===null||s===void 0||s.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let s=1,e=1,t=!1,n=0;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(Y.safari){if(r.style.top==ds&&r.style.left=="0px"){let l=r.getBoundingClientRect();t=Math.abs(l.top+1e4)>1||Math.abs(l.left)>1}}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(s=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:s,scaleY:e}=this.view.viewState);else n=Np(this.view).left;return{visible:du(this.view.scrollDOM.getBoundingClientRect(),bu(this.view)),parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,l)=>{let a=this.manager.tooltipViews[l];return a.getCoords?a.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(Hu).tooltipSpace(this.view),scaleX:s,scaleY:e,makeAbsolute:t,fixedLeft:n}}writeMeasure(s){var e;if(s.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let h of this.manager.tooltipViews)h.dom.style.position="absolute"}let{visible:t,space:n,scaleX:r,scaleY:l}=s,a=[];for(let h=0;h<this.manager.tooltips.length;h++){let c=this.manager.tooltips[h],d=this.manager.tooltipViews[h],{dom:m}=d,y=s.pos[h],v=s.size[h];if(!y||c.clip!==!1&&(y.bottom<=Math.max(t.top,n.top)||y.top>=Math.min(t.bottom,n.bottom)||y.right<Math.max(t.left,n.left)-.1||y.left>Math.min(t.right,n.right)+.1)){m.style.top=ds;continue}let k=c.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,x=k?7:0,S=v.right-v.left,T=(e=Bp.get(d))!==null&&e!==void 0?e:v.bottom-v.top,D=d.offset||nk,q=this.view.textDirection==je.LTR,L=v.width>n.right-n.left?q?n.left:n.right-v.width:q?Math.max(n.left,Math.min(y.left-(k?14:0)+D.x,n.right-S)):Math.min(Math.max(n.left,y.left-S+(k?14:0)-D.x),n.right-S),_=this.above[h];!c.strictSide&&(_?y.top-T-x-D.y<n.top:y.bottom+T+x+D.y>n.bottom)&&_==n.bottom-y.bottom>y.top-n.top&&(_=this.above[h]=!_);let K=(_?y.top-n.top:n.bottom-y.bottom)-x;if(K<T&&d.resize!==!1){if(K<this.view.defaultLineHeight){m.style.top=ds;continue}Bp.set(d,T),m.style.height=(T=K)/l+"px"}else m.style.height&&(m.style.height="");let I=_?y.top-T-x-D.y:y.bottom+x+D.y,F=L+S;if(d.overlap!==!0)for(let ee of a)ee.left<F&&ee.right>L&&ee.top<I+T&&ee.bottom>I&&(I=_?ee.top-T-2-x:ee.bottom+x+2);if(this.position=="absolute"?(m.style.top=(I-s.parent.top)/l+"px",zp(m,(L-s.parent.left)/r)):(m.style.top=I/l+"px",zp(m,(L-s.fixedLeft)/r)),k){let ee=y.left+(q?D.x:-D.x)-(L+14-7);k.style.left=ee/r+"px"}d.overlap!==!0&&a.push({left:L,top:I,right:F,bottom:I+T}),m.classList.toggle("cm-tooltip-above",_),m.classList.toggle("cm-tooltip-below",!_),d.positioned&&d.positioned(s.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let s of this.manager.tooltipViews)s.dom.style.top=ds}},{eventObservers:{scroll(){this.maybeMeasure()}}});function zp(s,e){let t=parseInt(s.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(s.style.left=e+"px")}const tk=ue.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),nk={x:0,y:0},Wu=te.define({enables:[Ip,tk]}),Ho=te.define({combine:s=>s.reduce((e,t)=>e.concat(t),[])});class Wo{static create(e){return new Wo(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Lp(e,Ho,(t,n)=>this.createHostedView(t,n),t=>t.dom.remove())}createHostedView(e,t){let n=e.create(this.view);return n.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(n.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&n.mount&&n.mount(this.view),n}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let n of this.manager.tooltipViews){let r=n[e];if(r!==void 0){if(t===void 0)t=r;else if(t!==r)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const ik=Wu.compute([Ho],s=>{let e=s.facet(Ho);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var n;return(n=t.end)!==null&&n!==void 0?n:t.pos})),create:Wo.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),rk=te.define();class sk{constructor(e,t,n,r,l,a){this.view=e,this.source=t,this.field=n,this.locked=r,this.setHover=l,this.hoverTime=a,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(e){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,n=e.docView.tile.nearest(t.target);if(!n)return;let r,l=1;if(n.isWidget())r=n.posAtStart;else{if(r=e.posAtCoords(t),r==null)return;let a=e.coordsAtPos(r);if(!a||t.y<a.top||t.y>a.bottom)return;let h=e.bidiSpans(e.state.doc.lineAt(r)).find(y=>y.from<=r&&y.to>=r),c=h&&h.dir==je.RTL?-1:1;l=t.x<a.left?-c:c;let d=l<0?r?e.coordsForChar(r-1):null:r<e.state.doc.length?e.coordsForChar(r):null,m=Math.max(d?d.right-d.left:0,e.defaultCharacterWidth);if(t.x<a.left-m||t.x>a.right+m)return}this.activateHover(e,r,l)}activateHover(e,t,n,r){let l=this.source(e,t,n),a=h=>{if(h&&!(Array.isArray(h)&&!h.length)){let c=Array.isArray(h)?h:[h];r&&this.locked.set(c,r),e.dispatch({effects:this.setHover.of(c)})}};if(l&&"then"in l){let h=this.pending={pos:t};l.then(c=>{this.pending==h&&(this.pending=null,a(c))},c=>Wt(e.state,c,"hover tooltip"))}else a(l)}get tooltip(){let e=this.view.plugin(Ip),t=e?e.manager.tooltips.findIndex(n=>n.create==Wo.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,n;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:r,tooltip:l}=this;if(r.length&&!this.locked.has(r)&&l&&!ok(l.dom,e)||this.pending){let{pos:a}=r[0]||this.pending,h=(n=(t=r[0])===null||t===void 0?void 0:t.end)!==null&&n!==void 0?n:a;(a==h?this.view.posAtCoords(this.lastMove)!=a:!lk(this.view,a,h,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:n}=this;n&&n.dom.contains(e.relatedTarget)?this.watchTooltipLeave(n.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=n=>{e.removeEventListener("mouseleave",t);let{active:r}=this;r.length&&!this.locked.has(r)&&!this.view.dom.contains(n.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Uo=4;function ok(s,e){let{left:t,right:n,top:r,bottom:l}=s.getBoundingClientRect(),a;if(a=s.querySelector(".cm-tooltip-arrow")){let h=a.getBoundingClientRect();r=Math.min(h.top,r),l=Math.max(h.bottom,l)}return e.clientX>=t-Uo&&e.clientX<=n+Uo&&e.clientY>=r-Uo&&e.clientY<=l+Uo}function lk(s,e,t,n,r,l){let a=s.scrollDOM.getBoundingClientRect(),h=s.documentTop+s.documentPadding.top+s.contentHeight;if(a.left>n||a.right<n||a.top>r||Math.min(a.bottom,h)<r)return!1;let c=s.posAtCoords({x:n,y:r},!1);return c>=e&&c<=t}function ak(s,e={}){let t=Le.define(),n=new WeakMap,r=Ht.define({create(){return[]},update(a,h){let c=n.get(a);if(a.length&&(e.hideOnChange&&(h.docChanged||h.selection)?a=[]:c&&c(h)?a=[]:e.hideOn&&(a=a.filter(d=>!e.hideOn(h,d)))),h.docChanged&&a.length){let d=[];for(let m of a){let y=h.changes.mapPos(m.pos,-1,At.TrackDel);if(y!=null){let v=Object.assign(Object.create(null),m);v.pos=y,v.end!=null&&(v.end=h.changes.mapPos(v.end)),d.push(v)}}a=d}for(let d of h.effects)d.is(t)&&(a=d.value,c=void 0),(d.is(uk)&&!d.value||d.value==r)&&(a=[]);return a.length&&c&&n.set(a,c),a},provide:a=>Ho.from(a)});const l=Mt.define(a=>new sk(a,s,r,n,t,e.hoverTime||300));return{active:r,extension:[r,l,rk.of(l),ik]}}const uk=Le.define(),Fp=te.define({combine(s){let e,t;for(let n of s)e=e||n.topContainer,t=t||n.bottomContainer;return{topContainer:e,bottomContainer:t}}}),hk=Mt.fromClass(class{constructor(s){this.input=s.state.facet(Uu),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(s));let e=s.state.facet(Fp);this.top=new $o(s,!0,e.topContainer),this.bottom=new $o(s,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(s){let e=s.state.facet(Fp);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new $o(s.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new $o(s.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=s.state.facet(Uu);if(t!=this.input){let n=t.filter(c=>c),r=[],l=[],a=[],h=[];for(let c of n){let d=this.specs.indexOf(c),m;d<0?(m=c(s.view),h.push(m)):(m=this.panels[d],m.update&&m.update(s)),r.push(m),(m.top?l:a).push(m)}this.specs=n,this.panels=r,this.top.sync(l),this.bottom.sync(a);for(let c of h)c.dom.classList.add("cm-panel"),c.mount&&c.mount()}else for(let n of this.panels)n.update&&n.update(s)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:s=>ue.coveredMargins.of(e=>{let t=e.plugin(s);if(!t)return null;let n,r,l;return t.top.dom&&!t.top.container&&(n=t.top.dom.getBoundingClientRect().bottom,l=t.top.dom),t.bottom.dom&&!t.bottom.container&&(r=t.bottom.dom.getBoundingClientRect().top,l=t.bottom.dom),l?{top:n,bottom:r,elt:l}:null})});class $o{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=_p(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=_p(e)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function _p(s){let e=s.nextSibling;return s.remove(),e}const Uu=te.define({enables:hk});class ti extends Ei{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ti.prototype.elementClass="",ti.prototype.toDOM=void 0,ti.prototype.mapMode=At.TrackBefore,ti.prototype.startSide=ti.prototype.endSide=-1,ti.prototype.point=!0;const $u=te.define(),ck=te.define(),fk={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>be.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ps=te.define();function dk(s){return[Vp(),ps.of({...fk,...s})]}const jp=te.define({combine:s=>s.some(e=>e)});function Vp(s){return[pk]}const pk=Mt.fromClass(class{constructor(s){this.view=s,this.domAfter=null,this.prevViewport=s.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=s.state.facet(ps).map(e=>new Wp(s,e)),this.fixed=!s.state.facet(jp);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),s.scrollDOM.insertBefore(this.dom,s.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(s){if(this.updateGutters(s)){let e=this.prevViewport,t=s.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}if(s.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(jp)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=s.view.viewport}syncGutters(s){let e=this.dom.nextSibling;s&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=be.iter(this.view.state.facet($u),this.view.viewport.from),n=[],r=this.gutters.map(l=>new mk(l,this.view.viewport,-this.view.documentPadding.top));for(let l of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(l.type)){let a=!0;for(let h of l.type)if(h.type==Tt.Text&&a){Ku(t,n,h.from);for(let c of r)c.line(this.view,h,n);a=!1}else if(h.widget)for(let c of r)c.widget(this.view,h)}else if(l.type==Tt.Text){Ku(t,n,l.from);for(let a of r)a.line(this.view,l,n)}else if(l.widget)for(let a of r)a.widget(this.view,l);for(let l of r)l.finish();s&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(s){let e=s.startState.facet(ps),t=s.state.facet(ps),n=s.docChanged||s.heightChanged||s.viewportChanged||!be.eq(s.startState.facet($u),s.state.facet($u),s.view.viewport.from,s.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(s)&&(n=!0);else{n=!0;let r=[];for(let l of t){let a=e.indexOf(l);a<0?r.push(new Wp(this.view,l)):(this.gutters[a].update(s),r.push(this.gutters[a]))}for(let l of this.gutters)l.dom.remove(),r.indexOf(l)<0&&l.destroy();for(let l of r)l.config.side=="after"?this.getDOMAfter().appendChild(l.dom):this.dom.appendChild(l.dom);this.gutters=r}return n}destroy(){for(let s of this.gutters)s.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:s=>ue.coveredMargins.of(e=>{var t;let n=e.plugin(s);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.getBoundingClientRect(),l=(t=n.domAfter)===null||t===void 0?void 0:t.getBoundingClientRect();return e.textDirection==je.LTR?{left:r.right,right:l?.left,elt:n.dom}:{right:r.left,left:l?.right,elt:n.dom}})});function Hp(s){return Array.isArray(s)?s:[s]}function Ku(s,e,t){for(;s.value&&s.from<=t;)s.from==t&&e.push(s.value),s.next()}class mk{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=be.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,l=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let h=new Up(e,a,l,n);r.elements.push(h),r.dom.appendChild(h.dom)}else r.elements[this.i].update(e,a,l,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];Ku(this.cursor,r,t.from),n.length&&(r=r.concat(n));let l=this.gutter.config.lineMarker(e,t,r);l&&r.unshift(l);let a=this.gutter;r.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let l of e.state.facet(ck)){let a=l(e,t.widget,t);a&&(r||(r=[])).push(a)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Wp{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let l=r.target,a;if(l!=this.dom&&this.dom.contains(l)){for(;l.parentNode!=this.dom;)l=l.parentNode;let c=l.getBoundingClientRect();a=(c.top+c.bottom)/2}else a=r.clientY;let h=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[n](e,h,r)&&r.preventDefault()});this.markers=Hp(t.markers(e)),t.initialSpacer&&(this.spacer=new Up(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Hp(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let n=e.view.viewport;return!be.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Up{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),gk(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let l=0,a=0;;){let h=a,c=l<t.length?t[l++]:null,d=!1;if(c){let m=c.elementClass;m&&(n+=" "+m);for(let y=a;y<this.markers.length;y++)if(this.markers[y].compare(c)){h=y,d=!0;break}}else h=this.markers.length;for(;a<h;){let m=this.markers[a++];if(m.toDOM){m.destroy(r);let y=r.nextSibling;r.remove(),r=y}}if(!c)break;c.toDOM&&(d?r=r.nextSibling:this.dom.insertBefore(c.toDOM(e),r)),d&&a++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function gk(s,e){if(s.length!=e.length)return!1;for(let t=0;t<s.length;t++)if(!s[t].compare(e[t]))return!1;return!0}const yk=te.define(),vk=te.define(),dr=te.define({combine(s){return Xr(s,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let r in t){let l=n[r],a=t[r];n[r]=l?(h,c,d)=>l(h,c,d)||a(h,c,d):a}return n}})}});class Qu extends ti{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Gu(s,e){return s.state.facet(dr).formatNumber(e,s.state)}const wk=ps.compute([dr],s=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(yk)},lineMarker(e,t,n){return n.some(r=>r.toDOM)?null:new Qu(Gu(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(vk)){let l=r(e,t,n);if(l)return l}return null},lineMarkerChange:e=>e.startState.facet(dr)!=e.state.facet(dr),initialSpacer(e){return new Qu(Gu(e,$p(e.state.doc.lines)))},updateSpacer(e,t){let n=Gu(t.view,$p(t.view.state.doc.lines));return n==e.number?e:new Qu(n)},domEventHandlers:s.facet(dr).domEventHandlers,side:"before"}));function kk(s={}){return[dr.of(s),Vp(),wk]}function $p(s){let e=9;for(;e<s;)e=e*10+9;return e}const Kp=1024;let xk=0;class qu{constructor(e,t){this.from=e,this.to=t}}class ke{constructor(e={}){this.id=xk++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Et.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}ke.closedBy=new ke({deserialize:s=>s.split(" ")}),ke.openedBy=new ke({deserialize:s=>s.split(" ")}),ke.group=new ke({deserialize:s=>s.split(" ")}),ke.isolate=new ke({deserialize:s=>{if(s&&s!="rtl"&&s!="ltr"&&s!="auto")throw new RangeError("Invalid value for isolate: "+s);return s||"auto"}}),ke.contextHash=new ke({perNode:!0}),ke.lookAhead=new ke({perNode:!0}),ke.mounted=new ke({perNode:!0});class ms{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[ke.mounted.id]}}const Sk=Object.create(null);class Et{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):Sk,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new Et(e.name||"",t,e.id,n);if(e.props){for(let l of e.props)if(Array.isArray(l)||(l=l(r)),l){if(l[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[l[0].id]=l[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(ke.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(ke.group),l=-1;l<(r?r.length:0);l++){let a=t[l<0?n.name:r[l]];if(a)return a}}}}Et.none=new Et("",Object.create(null),0,8);class Yu{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let l of e){let a=l(n);if(a){r||(r=Object.assign({},n.props));let h=a[1],c=a[0];c.combine&&c.id in r&&(h=c.combine(r[c.id],h)),r[c.id]=h}}t.push(r?new Et(n.name,r,n.id,n.flags):n)}return new Yu(t)}}const Ko=new WeakMap,Qp=new WeakMap;var Ue;(function(s){s[s.ExcludeBuffers=1]="ExcludeBuffers",s[s.IncludeAnonymous=2]="IncludeAnonymous",s[s.IgnoreMounts=4]="IgnoreMounts",s[s.IgnoreOverlays=8]="IgnoreOverlays",s[s.EnterBracketed=16]="EnterBracketed"})(Ue||(Ue={}));class qe{constructor(e,t,n,r,l){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,l&&l.length){this.props=Object.create(null);for(let[a,h]of l)this.props[typeof a=="number"?a:a.id]=h}}toString(){let e=ms.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let r=n.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Zu(this.topNode,e)}cursorAt(e,t=0,n=0){let r=Ko.get(this)||this.topNode,l=new Zu(r);return l.moveTo(e,t),Ko.set(this,l._tree),l}get topNode(){return new $t(this,0,0,null)}resolve(e,t=0){let n=gs(Ko.get(this)||this.topNode,e,t,!1);return Ko.set(this,n),n}resolveInner(e,t=0){let n=gs(Qp.get(this)||this.topNode,e,t,!0);return Qp.set(this,n),n}resolveStack(e,t=0){return Ak(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:l=this.length}=e,a=e.mode||0,h=(a&Ue.IncludeAnonymous)>0;for(let c=this.cursor(a|Ue.IncludeAnonymous);;){let d=!1;if(c.from<=l&&c.to>=r&&(!h&&c.type.isAnonymous||t(c)!==!1)){if(c.firstChild())continue;d=!0}for(;d&&n&&(h||!c.type.isAnonymous)&&n(c),!c.nextSibling();){if(!c.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:th(Et.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new qe(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new qe(Et.none,t,n,r)))}static build(e){return Tk(e)}}qe.empty=new qe(Et.none,[],[],0);class Xu{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Xu(this.buffer,this.index)}}class ni{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Et.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],l=r.name;if(/\W/.test(l)&&!r.isError&&(l=JSON.stringify(l)),e+=4,n==e)return l;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return l+"("+a.join(",")+")"}findChild(e,t,n,r,l){let{buffer:a}=this,h=-1;for(let c=e;c!=t&&!(Gp(l,r,a[c+1],a[c+2])&&(h=c,n>0));c=a[c+3]);return h}slice(e,t,n){let r=this.buffer,l=new Uint16Array(t-e),a=0;for(let h=e,c=0;h<t;){l[c++]=r[h++],l[c++]=r[h++]-n;let d=l[c++]=r[h++]-n;l[c++]=r[h++]-e,a=Math.max(a,d)}return new ni(l,a,this.set)}}function Gp(s,e,t,n){switch(s){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function gs(s,e,t,n){for(var r;s.from==s.to||(t<1?s.from>=e:s.from>e)||(t>-1?s.to<=e:s.to<e);){let a=!n&&s instanceof $t&&s.index<0?null:s.parent;if(!a)return s;s=a}let l=n?0:Ue.IgnoreOverlays;if(n)for(let a=s,h=a.parent;h;a=h,h=a.parent)a instanceof $t&&a.index<0&&((r=h.enter(e,t,l))===null||r===void 0?void 0:r.from)!=a.from&&(s=h);for(;;){let a=s.enter(e,t,l);if(!a)return s;s=a}}class qp{cursor(e=0){return new Zu(this,e)}getChild(e,t=null,n=null){let r=Yp(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return Yp(this,e,t,n)}resolve(e,t=0){return gs(this,e,t,!1)}resolveInner(e,t=0){return gs(this,e,t,!0)}matchContext(e){return Ju(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(n=t,t=r.prevSibling):t=r}return n}get node(){return this}get next(){return this.parent}}class $t extends qp{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,l=0){for(let a=this;;){for(let{children:h,positions:c}=a._tree,d=t>0?h.length:-1;e!=d;e+=t){let m=h[e],y=c[e]+a.from,v;if(!(!(l&Ue.EnterBracketed&&m instanceof qe&&(v=ms.get(m))&&!v.overlay&&v.bracketed&&n>=y&&n<=y+m.length)&&!Gp(r,n,y,y+m.length))){if(m instanceof ni){if(l&Ue.ExcludeBuffers)continue;let k=m.findChild(0,m.buffer.length,t,n-y,r);if(k>-1)return new ii(new Ck(a,m,e,y),null,k)}else if(l&Ue.IncludeAnonymous||!m.type.isAnonymous||eh(m)){let k;if(!(l&Ue.IgnoreMounts)&&(k=ms.get(m))&&!k.overlay)return new $t(k.tree,y,e,a);let x=new $t(m,y,e,a);return l&Ue.IncludeAnonymous||!x.type.isAnonymous?x:x.nextChild(t<0?m.children.length-1:0,t,n,r,l)}}}if(l&Ue.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&Ue.IgnoreOverlays)&&(r=ms.get(this._tree))&&r.overlay){let l=e-this.from,a=n&Ue.EnterBracketed&&r.bracketed;for(let{from:h,to:c}of r.overlay)if((t>0||a?h<=l:h<l)&&(t<0||a?c>=l:c>l))return new $t(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Yp(s,e,t,n){let r=s.cursor(),l=[];if(!r.firstChild())return l;if(t!=null){for(let a=!1;!a;)if(a=r.type.is(t),!r.nextSibling())return l}for(;;){if(n!=null&&r.type.is(n))return l;if(r.type.is(e)&&l.push(r.node),!r.nextSibling())return n==null?l:[]}}function Ju(s,e,t=e.length-1){for(let n=s;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class Ck{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class ii extends qp{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,l=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return l<0?null:new ii(this.context,this,l)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&Ue.ExcludeBuffers)return null;let{buffer:r}=this.context,l=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return l<0?null:new ii(this.context,this,l)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new ii(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new ii(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,l=n.buffer[this.index+3];if(l>r){let a=n.buffer[this.index+1];e.push(n.slice(r,l,a)),t.push(0)}return new qe(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Xp(s){if(!s.length)return null;let e=0,t=s[0];for(let l=1;l<s.length;l++){let a=s[l];(a.from>t.from||a.to<t.to)&&(t=a,e=l)}let n=t instanceof $t&&t.index<0?null:t.parent,r=s.slice();return n?r[e]=n:r.splice(e,1),new bk(r,t)}class bk{constructor(e,t){this.heads=e,this.node=t}get next(){return Xp(this.heads)}}function Ak(s,e,t){let n=s.resolveInner(e,t),r=null;for(let l=n instanceof $t?n:n.context.parent;l;l=l.parent)if(l.index<0){let a=l.parent;(r||(r=[n])).push(a.resolve(e,t)),l=a}else{let a=ms.get(l.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let h=new $t(a.tree,a.overlay[0].from+l.from,-1,l);(r||(r=[n])).push(gs(h,e,t,!1))}}return r?Xp(r):n}class Zu{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Ue.EnterBracketed,e instanceof $t)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof $t?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,l=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return l<0?!1:(this.stack.push(this.index),this.yieldBuf(l))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&Ue.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ue.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ue.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let l=0;l<this.index;l++)if(r.buffer.buffer[l+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let l=t+e,a=e<0?-1:n._tree.children.length;l!=a;l+=e){let h=n._tree.children[l];if(this.mode&Ue.IncludeAnonymous||h instanceof ni||!h.type.isAnonymous||eh(h))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,l=this.stack.length;l>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=l+1;break e}r=this.stack[--l]}for(let r=n;r<this.stack.length;r++)t=new ii(this.buffer,t,this.stack[r]);return this.bufferNode=new ii(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return Ju(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,l=this.stack.length-1;r>=0;l--){if(l<0)return Ju(this._tree,e,r);let a=n[t.buffer[this.stack[l]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}}function eh(s){return s.children.some(e=>e instanceof ni||!e.type.isAnonymous||eh(e))}function Tk(s){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=Kp,reused:l=[],minRepeatType:a=n.types.length}=s,h=Array.isArray(t)?new Xu(t,t.length):t,c=n.types,d=0,m=0;function y(K,I,F,ee,ge,pe){let{id:me,start:ae,end:we,size:ve}=h;if(ve<0)if(h.next(),ve==-1){let se=l[me];F.push(se),ee.push(ae-K);return}else if(ve==-3){d=me;return}else if(ve==-4){m=me;return}else throw new RangeError(`Unrecognized record size: ${ve}`);let Se=c[me],ze,Ce,Q=ae-K;if(we-ae<=r&&(Ce=T(h.pos-I,ge))){let se=new Uint16Array(Ce.size-Ce.skip),J=h.pos-Ce.size,M=se.length;for(;h.pos>J;)M=D(Ce.start,se,M);ze=new ni(se,we-Ce.start,n),Q=Ce.start-K}else{let se=m,J=d,M=h.pos-ve;h.next();let N=[],R=[],z=me>=a?me:-1,X=0,$=we,oe=se;for(;h.pos>M;)z>=0&&h.id==z&&h.size>=0?(h.end<=$-r&&(x(N,R,ae,X,h.end,$,z,oe,d),X=N.length,$=h.end,oe=m),h.next()):pe>2500?v(ae,M,N,R):(z>=0&&h.size==-1&&l[h.id].type==n.types[z]&&(X<N.length&&x(N,R,ae,X,h.end,$,z,oe,d),X=N.length+1,$=h.start,oe=m),y(ae,M,N,R,z,pe+1));if(z>=0&&X>0&&X<N.length&&x(N,R,ae,X,ae,$,z,oe,d),N.reverse(),R.reverse(),z>-1&&X>0){let ce=k(Se);ze=th(Se,N,R,0,N.length,0,we-ae,ce,ce)}else ze=S(Se,N,R,we-ae,se-we,J)}F.push(ze),ee.push(Q)}function v(K,I,F,ee){let ge=[],pe=0,me=-1;for(;h.pos>I;){let{id:ae,start:we,end:ve,size:Se}=h;if(Se>4)h.next();else{if(me>-1&&we<me)break;me<0&&(me=ve-r),ge.push(ae,we,ve),pe++,h.next()}}if(pe){let ae=new Uint16Array(pe*4),we=ge[ge.length-2];for(let ve=ge.length-3,Se=0;ve>=0;ve-=3)ae[Se++]=ge[ve],ae[Se++]=ge[ve+1]-we,ae[Se++]=ge[ve+2]-we,ae[Se++]=Se;F.push(new ni(ae,ge[2]-we,n)),ee.push(we-K)}}function k(K){return(I,F,ee)=>{var ge;let pe=0,me=I.length-1,ae,we;if(me>=0&&(ae=I[me])instanceof qe){if(!me&&ae.type==K&&ae.length==ee)return ae;(we=ae.prop(ke.lookAhead))&&(pe=F[me]+ae.length+we-ee)}let ve=0;for(let Se=0;Se<I.length;Se++)if(I[Se]instanceof qe){ve=(ge=I[Se].prop(ke.contextHash))!==null&&ge!==void 0?ge:0;break}return S(K,I,F,ee,pe,ve)}}function x(K,I,F,ee,ge,pe,me,ae,we){let ve=[],Se=[];for(;K.length>ee;)ve.push(K.pop()),Se.push(I.pop()+F-ge);K.push(S(n.types[me],ve,Se,pe-ge,ae-pe,we)),I.push(ge-F)}function S(K,I,F,ee,ge,pe,me){if(pe){let ae=[ke.contextHash,pe];me=me?[ae].concat(me):[ae]}if(ge>25){let ae=[ke.lookAhead,ge];me=me?[ae].concat(me):[ae]}return new qe(K,I,F,ee,me)}function T(K,I){let F=h.fork(),ee=0,ge=0,pe=0,me=F.end-r,ae={size:0,start:0,skip:0};e:for(let we=F.pos-K;F.pos>we;){let ve=F.size;if(F.id==I&&ve>=0){ae.size=ee,ae.start=ge,ae.skip=pe,pe+=4,ee+=4,F.next();continue}let Se=F.pos-ve;if(ve<0||Se<we||F.start<me)break;let ze=F.id>=a?4:0,Ce=F.start;for(F.next();F.pos>Se;){if(F.size<0)if(F.size==-3||F.size==-4)ze+=4;else break e;else F.id>=a&&(ze+=4);F.next()}ge=Ce,ee+=ve,pe+=ze}return(I<0||ee==K)&&(ae.size=ee,ae.start=ge,ae.skip=pe),ae.size>4?ae:void 0}function D(K,I,F){let{id:ee,start:ge,end:pe,size:me}=h;if(h.next(),me>=0&&ee<a){let ae=F;if(me>4){let we=h.pos-(me-4);for(;h.pos>we;)F=D(K,I,F)}I[--F]=ae,I[--F]=pe-K,I[--F]=ge-K,I[--F]=ee}else me==-3?d=ee:me==-4&&(m=ee);return F}let q=[],L=[];for(;h.pos>0;)y(s.start||0,s.bufferStart||0,q,L,-1,0);let _=(e=s.length)!==null&&e!==void 0?e:q.length?L[0]+q[0].length:0;return new qe(c[s.topID],q.reverse(),L.reverse(),_)}const Jp=new WeakMap;function Qo(s,e){if(!s.isAnonymous||e instanceof ni||e.type!=s)return 1;let t=Jp.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=s||!(n instanceof qe)){t=1;break}t+=Qo(s,n)}Jp.set(e,t)}return t}function th(s,e,t,n,r,l,a,h,c){let d=0;for(let x=n;x<r;x++)d+=Qo(s,e[x]);let m=Math.ceil(d*1.5/8),y=[],v=[];function k(x,S,T,D,q){for(let L=T;L<D;){let _=L,K=S[L],I=Qo(s,x[L]);for(L++;L<D;L++){let F=Qo(s,x[L]);if(I+F>=m)break;I+=F}if(L==_+1){if(I>m){let F=x[_];k(F.children,F.positions,0,F.children.length,S[_]+q);continue}y.push(x[_])}else{let F=S[L-1]+x[L-1].length-K;y.push(th(s,x,S,_,L,K,F,null,c))}v.push(K+q-l)}}return k(e,t,n,r,0),(h||c)(y,v,a)}class Bi{constructor(e,t,n,r,l=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(l?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Bi(0,e.length,e,0,!1,n)];for(let l of t)l.to>e.length&&r.push(l);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],l=1,a=e.length?e[0]:null;for(let h=0,c=0,d=0;;h++){let m=h<t.length?t[h]:null,y=m?m.fromA:1e9;if(y-c>=n)for(;a&&a.from<y;){let v=a;if(c>=v.from||y<=v.to||d){let k=Math.max(v.from,c)-d,x=Math.min(v.to,y)-d;v=k>=x?null:new Bi(k,x,v.tree,v.offset+d,v.openStart||h>0,v.openEnd||!!m)}if(v&&r.push(v),a.to>y)break;a=l<e.length?e[l++]:null}if(!m)break;c=m.toA,d=m.toA-m.toB}return r}}class Zp{startParse(e,t,n){return typeof e=="string"&&(e=new Mk(e)),n=n?n.length?n.map(r=>new qu(r.from,r.to)):[new qu(0,0)]:[new qu(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let l=r.advance();if(l)return l}}}class Mk{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new ke({perNode:!0});let Ok=0;class Kt{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Ok++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof Kt&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let r=new Kt(n,[],null,[]);if(r.set.push(r),t)for(let l of t.set)r.set.push(l);return r}static defineModifier(e){let t=new Go(e);return n=>n.modified.indexOf(t)>-1?n:Go.get(n.base||n,n.modified.concat(t).sort((r,l)=>r.id-l.id))}}let Ek=0;class Go{constructor(e){this.name=e,this.instances=[],this.id=Ek++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(h=>h.base==e&&Pk(t,h.modified));if(n)return n;let r=[],l=new Kt(e.name,r,e,t);for(let h of t)h.instances.push(l);let a=Rk(t);for(let h of e.set)if(!h.modified.length)for(let c of a)r.push(Go.get(h,c));return l}}function Pk(s,e){return s.length==e.length&&s.every((t,n)=>t==e[n])}function Rk(s){let e=[[]];for(let t=0;t<s.length;t++)for(let n=0,r=e.length;n<r;n++)e.push(e[n].concat(s[t]));return e.sort((t,n)=>n.length-t.length)}function em(s){let e=Object.create(null);for(let t in s){let n=s[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let l=[],a=2,h=r;for(let y=0;;){if(h=="..."&&y>0&&y+3==r.length){a=1;break}let v=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(h);if(!v)throw new RangeError("Invalid path: "+r);if(l.push(v[0]=="*"?"":v[0][0]=='"'?JSON.parse(v[0]):v[0]),y+=v[0].length,y==r.length)break;let k=r[y++];if(y==r.length&&k=="!"){a=0;break}if(k!="/")throw new RangeError("Invalid path: "+r);h=r.slice(y)}let c=l.length-1,d=l[c];if(!d)throw new RangeError("Invalid path: "+r);let m=new ys(n,a,c>0?l.slice(0,c):null);e[d]=m.sort(e[d])}}return tm.add(e)}const tm=new ke({combine(s,e){let t,n,r;for(;s||e;){if(!s||e&&s.depth<=e.depth?(r=e,e=e.next):(r=s,s=s.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let l=new ys(r.tags,r.mode,r.context);t?t.next=l:n=l,t=l}return n}});class ys{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}ys.empty=new ys([],2,null);function nm(s,e){let t=Object.create(null);for(let l of s)if(!Array.isArray(l.tag))t[l.tag.id]=l.class;else for(let a of l.tag)t[a.id]=l.class;let{scope:n,all:r=null}=e||{};return{style:l=>{let a=r;for(let h of l)for(let c of h.set){let d=t[c.id];if(d){a=a?a+" "+d:d;break}}return a},scope:n}}function Dk(s,e){let t=null;for(let n of s){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function Lk(s,e,t,n=0,r=s.length){let l=new Nk(n,Array.isArray(e)?e:[e],t);l.highlightRange(s.cursor(),n,r,"",l.highlighters),l.flush(r)}class Nk{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,l){let{type:a,from:h,to:c}=e;if(h>=n||c<=t)return;a.isTop&&(l=this.highlighters.filter(k=>!k.scope||k.scope(a)));let d=r,m=Bk(e)||ys.empty,y=Dk(l,m.tags);if(y&&(d&&(d+=" "),d+=y,m.mode==1&&(r+=(r?" ":"")+y)),this.startSpan(Math.max(t,h),d),m.opaque)return;let v=e.tree&&e.tree.prop(ke.mounted);if(v&&v.overlay){let k=e.node.enter(v.overlay[0].from+h,1),x=this.highlighters.filter(T=>!T.scope||T.scope(v.tree.type)),S=e.firstChild();for(let T=0,D=h;;T++){let q=T<v.overlay.length?v.overlay[T]:null,L=q?q.from+h:c,_=Math.max(t,D),K=Math.min(n,L);if(_<K&&S)for(;e.from<K&&(this.highlightRange(e,_,K,r,l),this.startSpan(Math.min(K,e.to),d),!(e.to>=L||!e.nextSibling())););if(!q||L>n)break;D=q.to+h,D>t&&(this.highlightRange(k.cursor(),Math.max(t,q.from+h),Math.min(n,D),"",x),this.startSpan(Math.min(n,D),d))}S&&e.parent()}else if(e.firstChild()){v&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,l),this.startSpan(Math.min(n,e.to),d)}while(e.nextSibling());e.parent()}}}function Bk(s){let e=s.type.prop(tm);for(;e&&e.context&&!s.matchContext(e.context);)e=e.next;return e||null}const G=Kt.define,qo=G(),ri=G(),im=G(ri),rm=G(ri),si=G(),Yo=G(si),nh=G(si),Cn=G(),Ii=G(Cn),bn=G(),An=G(),ih=G(),vs=G(ih),Xo=G(),he={comment:qo,lineComment:G(qo),blockComment:G(qo),docComment:G(qo),name:ri,variableName:G(ri),typeName:im,tagName:G(im),propertyName:rm,attributeName:G(rm),className:G(ri),labelName:G(ri),namespace:G(ri),macroName:G(ri),literal:si,string:Yo,docString:G(Yo),character:G(Yo),attributeValue:G(Yo),number:nh,integer:G(nh),float:G(nh),bool:G(si),regexp:G(si),escape:G(si),color:G(si),url:G(si),keyword:bn,self:G(bn),null:G(bn),atom:G(bn),unit:G(bn),modifier:G(bn),operatorKeyword:G(bn),controlKeyword:G(bn),definitionKeyword:G(bn),moduleKeyword:G(bn),operator:An,derefOperator:G(An),arithmeticOperator:G(An),logicOperator:G(An),bitwiseOperator:G(An),compareOperator:G(An),updateOperator:G(An),definitionOperator:G(An),typeOperator:G(An),controlOperator:G(An),punctuation:ih,separator:G(ih),bracket:vs,angleBracket:G(vs),squareBracket:G(vs),paren:G(vs),brace:G(vs),content:Cn,heading:Ii,heading1:G(Ii),heading2:G(Ii),heading3:G(Ii),heading4:G(Ii),heading5:G(Ii),heading6:G(Ii),contentSeparator:G(Cn),list:G(Cn),quote:G(Cn),emphasis:G(Cn),strong:G(Cn),link:G(Cn),monospace:G(Cn),strikethrough:G(Cn),inserted:G(),deleted:G(),changed:G(),invalid:G(),meta:Xo,documentMeta:G(Xo),annotation:G(Xo),processingInstruction:G(Xo),definition:Kt.defineModifier("definition"),constant:Kt.defineModifier("constant"),function:Kt.defineModifier("function"),standard:Kt.defineModifier("standard"),local:Kt.defineModifier("local"),special:Kt.defineModifier("special")};for(let s in he){let e=he[s];e instanceof Kt&&(e.name=s)}nm([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var rh;const pr=new ke;function Ik(s){return te.define({combine:s?e=>e.concat(s):void 0})}const zk=new ke;class on{constructor(e,t,n=[],r=""){this.data=e,this.name=r,Oe.prototype.hasOwnProperty("tree")||Object.defineProperty(Oe.prototype,"tree",{get(){return Tn(this)}}),this.parser=t,this.extension=[gr.of(this),Oe.languageData.of((l,a,h)=>{let c=sm(l,a,h),d=c.type.prop(pr);if(!d)return[];let m=l.facet(d),y=c.type.prop(zk);if(y){let v=c.resolve(a-c.from,h);for(let k of y)if(k.test(v,l)){let x=l.facet(k.facet);return k.type=="replace"?x:x.concat(m)}}return m})].concat(n)}isActiveAt(e,t,n=-1){return sm(e,t,n).type.prop(pr)==this.data}findRegions(e){let t=e.facet(gr);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(l,a)=>{if(l.prop(pr)==this.data){n.push({from:a,to:a+l.length});return}let h=l.prop(ke.mounted);if(h){if(h.tree.prop(pr)==this.data){if(h.overlay)for(let c of h.overlay)n.push({from:c.from+a,to:c.to+a});else n.push({from:a,to:a+l.length});return}else if(h.overlay){let c=n.length;if(r(h.tree,h.overlay[0].from+a),n.length>c)return}}for(let c=0;c<l.children.length;c++){let d=l.children[c];d instanceof qe&&r(d,l.positions[c]+a)}};return r(Tn(e),0),n}get allowsNesting(){return!0}}on.setState=Le.define();function sm(s,e,t){let n=s.facet(gr),r=Tn(s).topNode;if(!n||n.allowsNesting)for(let l=r;l;l=l.enter(e,t,Ue.ExcludeBuffers|Ue.EnterBracketed))l.type.isTop&&(r=l);return r}class Jo extends on{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=Ik(e.languageData);return new Jo(t,e.parser.configure({props:[pr.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Jo(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Tn(s){let e=s.field(on.state,!1);return e?e.tree:qe.empty}class Fk{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let ws=null;class Zo{constructor(e,t,n=[],r,l,a,h,c){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=l,this.viewport=a,this.skipped=h,this.scheduleOn=c,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new Zo(e,t,[],qe.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Fk(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=qe.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Bi.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Bi.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ws;ws=this;try{return e()}finally{ws=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=om(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:l,viewport:a,skipped:h}=this;if(this.takeTree(),!e.empty){let c=[];if(e.iterChangedRanges((d,m,y,v)=>c.push({fromA:d,toA:m,fromB:y,toB:v})),n=Bi.applyChanges(n,c),r=qe.empty,l=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){h=[];for(let d of this.skipped){let m=e.mapPos(d.from,1),y=e.mapPos(d.to,-1);m<y&&h.push({from:m,to:y})}}}return new Zo(this.parser,t,n,r,l,a,h,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:r,to:l}=this.skipped[n];r<e.to&&l>e.from&&(this.fragments=om(this.fragments,r,l),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Zp{createParse(t,n,r){let l=r[0].from,a=r[r.length-1].to;return{parsedPos:l,advance(){let c=ws;if(c){for(let d of r)c.tempSkipped.push(d);e&&(c.scheduleOn=c.scheduleOn?Promise.all([c.scheduleOn,e]):e)}return this.parsedPos=a,new qe(Et.none,[],[],a-l)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return ws}}function om(s,e,t){return Bi.applyChanges(s,[{fromA:e,toA:t,fromB:e,toB:t}])}class mr{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new mr(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Zo.create(e.facet(gr).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new mr(n)}}on.state=Ht.define({create:mr.init,update(s,e){for(let t of e.effects)if(t.is(on.setState))return t.value;return e.startState.facet(gr)!=e.state.facet(gr)?mr.init(e.state):s.apply(e)}});let lm=s=>{let e=setTimeout(()=>s(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(lm=s=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(s,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const sh=typeof navigator<"u"&&(!((rh=navigator.scheduling)===null||rh===void 0)&&rh.isInputPending)?()=>navigator.scheduling.isInputPending():null,_k=Mt.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(on.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(on.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=lm(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,l=n.field(on.state);if(l.tree==l.context.tree&&l.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!sh?Math.max(25,e.timeRemaining()-5):1e9),h=l.context.treeLen<r&&n.doc.length>r+1e3,c=l.context.work(()=>sh&&sh()||Date.now()>a,r+(h?0:1e5));this.chunkBudget-=Date.now()-t,(c||this.chunkBudget<=0)&&(l.context.takeTree(),this.view.dispatch({effects:on.setState.of(new mr(l.context))})),this.chunkBudget>0&&!(c&&!h)&&this.scheduleWork(),this.checkAsyncSchedule(l.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>Wt(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),gr=te.define({combine(s){return s.length?s[0]:null},enables:s=>[on.state,_k,ue.contentAttributes.compute([s],e=>{let t=e.facet(s);return t&&t.name?{"data-language":t.name}:{}})]});class jk{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Vk=te.define(),oh=te.define({combine:s=>{if(!s.length)return" ";let e=s[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(s[0]));return e}});function el(s){let e=s.facet(oh);return e.charCodeAt(0)==9?s.tabSize*e.length:e.length}function ks(s,e){let t="",n=s.tabSize,r=s.facet(oh)[0];if(r==" "){for(;e>=n;)t+=" ",e-=n;r=" "}for(let l=0;l<e;l++)t+=r;return t}function lh(s,e){s instanceof Oe&&(s=new tl(s));for(let n of s.state.facet(Vk)){let r=n(s,e);if(r!==void 0)return r}let t=Tn(s.state);return t.length>=e?Hk(s,t,e):null}class tl{constructor(e,t={}){this.state=e,this.options=t,this.unit=el(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:l}=this.options;return r!=null&&r>=n.from&&r<=n.to?l&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),l=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(l+=a-this.countColumn(n,n.search(/\S|$/))),l}countColumn(e,t=e.length){return vo(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),l=this.options.overrideIndentation;if(l){let a=l(r);if(a>-1)return a}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const am=new ke;function Hk(s,e,t){let n=e.resolveStack(t),r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=n.node){let l=[];for(let a=r;a&&!(a.from<n.node.from||a.to>n.node.to||a.from==n.node.from&&a.type==n.node.type);a=a.parent)l.push(a);for(let a=l.length-1;a>=0;a--)n={node:l[a],next:n}}return um(n,s,t)}function um(s,e,t){for(let n=s;n;n=n.next){let r=Uk(n.node);if(r)return r(ah.create(e,t,n))}return 0}function Wk(s){return s.pos==s.options.simulateBreak&&s.options.simulateDoubleBreak}function Uk(s){let e=s.type.prop(am);if(e)return e;let t=s.firstChild,n;if(t&&(n=t.type.prop(ke.closedBy))){let r=s.lastChild,l=r&&n.indexOf(r.name)>-1;return a=>Gk(a,!0,1,void 0,l&&!Wk(a)?r.from:void 0)}return s.parent==null?$k:null}function $k(){return 0}class ah extends tl{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new ah(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Kk(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return um(this.context.next,this.base,this.pos)}}function Kk(s,e){for(let t=e;t;t=t.parent)if(s==t)return!0;return!1}function Qk(s){let e=s.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let r=s.options.simulateBreak,l=s.state.doc.lineAt(t.from),a=r==null||r<=l.from?l.to:Math.min(l.to,r);for(let h=t.to;;){let c=e.childAfter(h);if(!c||c==n)return null;if(!c.type.isSkipped){if(c.from>=a)return null;let d=/^ */.exec(l.text.slice(t.to-l.from))[0].length;return{from:t.from,to:t.to+d}}h=c.to}}function Gk(s,e,t,n,r){let l=s.textAfter,a=l.match(/^\s*/)[0].length,h=n&&l.slice(a,a+n.length)==n||r==s.pos+a,c=Qk(s);return c?h?s.column(c.from):s.column(c.to):s.baseIndent+(h?0:s.unit*t)}function hm({except:s,units:e=1}={}){return t=>{let n=s&&s.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const qk=200;function Yk(){return Oe.transactionFilter.of(s=>{if(!s.docChanged||!s.isUserEvent("input.type")&&!s.isUserEvent("input.complete"))return s;let e=s.startState.languageDataAt("indentOnInput",s.startState.selection.main.head);if(!e.length)return s;let t=s.newDoc,{head:n}=s.newSelection.main,r=t.lineAt(n);if(n>r.from+qk)return s;let l=t.sliceString(r.from,n);if(!e.some(d=>d.test(l)))return s;let{state:a}=s,h=-1,c=[];for(let{head:d}of a.selection.ranges){let m=a.doc.lineAt(d);if(m.from==h)continue;h=m.from;let y=lh(a,m.from);if(y==null)continue;let v=/^\s*/.exec(m.text)[0],k=ks(a,y);v!=k&&c.push({from:m.from,to:m.from+v.length,insert:k})}return c.length?[s,{changes:c,sequential:!0}]:s})}const Xk=new ke;function Jk(s){let e=s.firstChild,t=s.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?s.to:t.from}:null}class nl{constructor(e,t){this.specs=e;let n;function r(h){let c=Xn.newName();return(n||(n=Object.create(null)))["."+c]=h,c}const l=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof on?h=>h.prop(pr)==a.data:a?h=>h==a:void 0,this.style=nm(e.map(h=>({tag:h.tag,class:h.class||r(Object.assign({},h,{tag:null}))})),{all:l}).style,this.module=n?new Xn(n):null,this.themeType=t.themeType}static define(e,t){return new nl(e,t||{})}}const uh=te.define(),Zk=te.define({combine(s){return s.length?[s[0]]:null}});function hh(s){let e=s.facet(uh);return e.length?e:s.facet(Zk)}function ex(s,e){let t=[nx],n;return s instanceof nl&&(s.module&&t.push(ue.styleModule.of(s.module)),n=s.themeType),n?t.push(uh.computeN([ue.darkTheme],r=>r.facet(ue.darkTheme)==(n=="dark")?[s]:[])):t.push(uh.of(s)),t}class tx{constructor(e){this.markCache=Object.create(null),this.tree=Tn(e.state),this.decorations=this.buildDeco(e,hh(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Tn(e.state),n=hh(e.state),r=n!=hh(e.startState),{viewport:l}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<l.to&&!r&&t.type==this.tree.type&&a>=l.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=l.to)}buildDeco(e,t){if(!t||!this.tree.length)return Re.none;let n=new Pi;for(let{from:r,to:l}of e.visibleRanges)Lk(this.tree,t,(a,h,c)=>{n.add(a,h,this.markCache[c]||(this.markCache[c]=Re.mark({class:c})))},r,l);return n.finish()}}const nx=$a.high(Mt.fromClass(tx,{decorations:s=>s.decorations})),ix=ue.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),cm=1e4,fm="()[]{}",dm=te.define({combine(s){return Xr(s,{afterCursor:!0,brackets:fm,maxScanDistance:cm,renderMatch:ox})}}),rx=Re.mark({class:"cm-matchingBracket"}),sx=Re.mark({class:"cm-nonmatchingBracket"});function ox(s){let e=[],t=s.matched?rx:sx;return e.push(t.range(s.start.from,s.start.to)),s.end&&e.push(t.range(s.end.from,s.end.to)),e}function pm(s){let e=[],t=s.facet(dm);for(let n of s.selection.ranges){if(!n.empty)continue;let r=Mn(s,n.head,-1,t)||n.head>0&&Mn(s,n.head-1,1,t)||t.afterCursor&&(Mn(s,n.head,1,t)||n.head<s.doc.length&&Mn(s,n.head+1,-1,t));r&&(e=e.concat(t.renderMatch(r,s)))}return Re.set(e,!0)}const lx=[Mt.fromClass(class{constructor(s){this.paused=!1,this.decorations=pm(s.state)}update(s){(s.docChanged||s.selectionSet||this.paused)&&(s.view.composing?(this.decorations=this.decorations.map(s.changes),this.paused=!0):(this.decorations=pm(s.state),this.paused=!1))}},{decorations:s=>s.decorations}),ix];function ax(s={}){return[dm.of(s),lx]}const ux=new ke;function ch(s,e,t){let n=s.prop(e<0?ke.openedBy:ke.closedBy);if(n)return n;if(s.name.length==1){let r=t.indexOf(s.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function fh(s){let e=s.type.prop(ux);return e?e(s.node):s}function Mn(s,e,t,n={}){let r=n.maxScanDistance||cm,l=n.brackets||fm,a=Tn(s),h=a.resolveInner(e,t);for(let c=h;c;c=c.parent){let d=ch(c.type,t,l);if(d&&c.from<c.to){let m=fh(c);if(m&&(t>0?e>=m.from&&e<m.to:e>m.from&&e<=m.to))return hx(s,e,t,c,m,d,l)}}return cx(s,e,t,a,h.type,r,l)}function hx(s,e,t,n,r,l,a){let h=n.parent,c={from:r.from,to:r.to},d=0,m=h?.cursor();if(m&&(t<0?m.childBefore(n.from):m.childAfter(n.to)))do if(t<0?m.to<=n.from:m.from>=n.to){if(d==0&&l.indexOf(m.type.name)>-1&&m.from<m.to){let y=fh(m);return{start:c,end:y?{from:y.from,to:y.to}:void 0,matched:!0}}else if(ch(m.type,t,a))d++;else if(ch(m.type,-t,a)){if(d==0){let y=fh(m);return{start:c,end:y&&y.from<y.to?{from:y.from,to:y.to}:void 0,matched:!1}}d--}}while(t<0?m.prevSibling():m.nextSibling());return{start:c,matched:!1}}function cx(s,e,t,n,r,l,a){if(t<0?!e:e==s.doc.length)return null;let h=t<0?s.sliceDoc(e-1,e):s.sliceDoc(e,e+1),c=a.indexOf(h);if(c<0||c%2==0!=t>0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},m=s.doc.iterRange(e,t>0?s.doc.length:0),y=0;for(let v=0;!m.next().done&&v<=l;){let k=m.value;t<0&&(v+=k.length);let x=e+v*t;for(let S=t>0?0:k.length-1,T=t>0?k.length:-1;S!=T;S+=t){let D=a.indexOf(k[S]);if(!(D<0||n.resolveInner(x+S,1).type!=r))if(D%2==0==t>0)y++;else{if(y==1)return{start:d,end:{from:x+S,to:x+S+1},matched:D>>1==c>>1};y--}}t>0&&(v+=k.length)}return m.done?{start:d,matched:!1}:null}const fx=Object.create(null),mm=[Et.none],gm=[],ym=Object.create(null),dx=Object.create(null);for(let[s,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])dx[s]=px(fx,e);function dh(s,e){gm.indexOf(s)>-1||(gm.push(s),console.warn(e))}function px(s,e){let t=[];for(let h of e.split(" ")){let c=[];for(let d of h.split(".")){let m=s[d]||he[d];m?typeof m=="function"?c.length?c=c.map(m):dh(d,`Modifier ${d} used at start of tag`):c.length?dh(d,`Tag ${d} used as modifier`):c=Array.isArray(m)?m:[m]:dh(d,`Unknown highlighting tag ${d}`)}for(let d of c)t.push(d)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+t.map(h=>h.id),l=ym[r];if(l)return l.id;let a=ym[r]=Et.define({id:mm.length,name:n,props:[em({[n]:t})]});return mm.push(a),a.id}je.RTL,je.LTR;const mx=s=>{let{state:e}=s,t=e.doc.lineAt(e.selection.main.from),n=mh(s.state,t.from);return n.line?gx(s):n.block?vx(s):!1};function ph(s,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=s(e,t);return r?(n(t.update(r)),!0):!1}}const gx=ph(xx,0),yx=ph(vm,0),vx=ph((s,e)=>vm(s,e,kx(e)),0);function mh(s,e){let t=s.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const xs=50;function wx(s,{open:e,close:t},n,r){let l=s.sliceDoc(n-xs,n),a=s.sliceDoc(r,r+xs),h=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(a)[0].length,d=l.length-h;if(l.slice(d-e.length,d)==e&&a.slice(c,c+t.length)==t)return{open:{pos:n-h,margin:h&&1},close:{pos:r+c,margin:c&&1}};let m,y;r-n<=2*xs?m=y=s.sliceDoc(n,r):(m=s.sliceDoc(n,n+xs),y=s.sliceDoc(r-xs,r));let v=/^\s*/.exec(m)[0].length,k=/\s*$/.exec(y)[0].length,x=y.length-k-t.length;return m.slice(v,v+e.length)==e&&y.slice(x,x+t.length)==t?{open:{pos:n+v+e.length,margin:/\s/.test(m.charAt(v+e.length))?1:0},close:{pos:r-k-t.length,margin:/\s/.test(y.charAt(x-1))?1:0}}:null}function kx(s){let e=[];for(let t of s.selection.ranges){let n=s.doc.lineAt(t.from),r=t.to<=n.to?n:s.doc.lineAt(t.to);r.from>n.from&&r.from==t.to&&(r=t.to==n.to+1?n:s.doc.lineAt(t.to-1));let l=e.length-1;l>=0&&e[l].to>n.from?e[l].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function vm(s,e,t=e.selection.ranges){let n=t.map(l=>mh(e,l.from).block);if(!n.every(l=>l))return null;let r=t.map((l,a)=>wx(e,n[a],l.from,l.to));if(s!=2&&!r.every(l=>l))return{changes:e.changes(t.map((l,a)=>r[a]?[]:[{from:l.from,insert:n[a].open+" "},{from:l.to,insert:" "+n[a].close}]))};if(s!=1&&r.some(l=>l)){let l=[];for(let a=0,h;a<r.length;a++)if(h=r[a]){let c=n[a],{open:d,close:m}=h;l.push({from:d.pos-c.open.length,to:d.pos+d.margin},{from:m.pos-m.margin,to:m.pos+c.close.length})}return{changes:l}}return null}function xx(s,e,t=e.selection.ranges){let n=[],r=-1;e:for(let{from:l,to:a}of t){let h=n.length,c=1e9,d;for(let m=l;m<=a;){let y=e.doc.lineAt(m);if(d==null&&(d=mh(e,y.from).line,!d))continue e;if(y.from>r&&(l==a||a>y.from)){r=y.from;let v=/^\s*/.exec(y.text)[0].length,k=v==y.length,x=y.text.slice(v,v+d.length)==d?v:-1;v<y.text.length&&v<c&&(c=v),n.push({line:y,comment:x,token:d,indent:v,empty:k,single:!1})}m=y.to+1}if(c<1e9)for(let m=h;m<n.length;m++)n[m].indent<n[m].line.text.length&&(n[m].indent=c);n.length==h+1&&(n[h].single=!0)}if(s!=2&&n.some(l=>l.comment<0&&(!l.empty||l.single))){let l=[];for(let{line:h,token:c,indent:d,empty:m,single:y}of n)(y||!m)&&l.push({from:h.from+d,insert:c+" "});let a=e.changes(l);return{changes:a,selection:e.selection.map(a,1)}}else if(s!=1&&n.some(l=>l.comment>=0)){let l=[];for(let{line:a,comment:h,token:c}of n)if(h>=0){let d=a.from+h,m=d+c.length;a.text[m-a.from]==" "&&m++,l.push({from:d,to:m})}return{changes:l}}return null}const gh=Bn.define(),Sx=Bn.define(),Cx=te.define(),wm=te.define({combine(s){return Xr(s,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),km=Ht.define({create(){return On.empty},update(s,e){let t=e.state.facet(wm),n=e.annotation(gh);if(n){let c=Pt.fromTransaction(e,n.selection),d=n.side,m=d==0?s.undone:s.done;return c?m=rl(m,m.length,t.minDepth,c):m=Cm(m,e.startState.selection),new On(d==0?n.rest:m,d==0?m:n.rest)}let r=e.annotation(Sx);if((r=="full"||r=="before")&&(s=s.isolate()),e.annotation(Je.addToHistory)===!1)return e.changes.empty?s:s.addMapping(e.changes.desc);let l=Pt.fromTransaction(e),a=e.annotation(Je.time),h=e.annotation(Je.userEvent);return l?s=s.addChanges(l,a,h,t,e):e.selection&&(s=s.addSelection(e.startState.selection,a,h,t.newGroupDelay)),(r=="full"||r=="after")&&(s=s.isolate()),s},toJSON(s){return{done:s.done.map(e=>e.toJSON()),undone:s.undone.map(e=>e.toJSON())}},fromJSON(s){return new On(s.done.map(Pt.fromJSON),s.undone.map(Pt.fromJSON))}});function bx(s={}){return[km,wm.of(s),ue.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?xm:e.inputType=="historyRedo"?yh:null;return n?(e.preventDefault(),n(t)):!1}})]}function il(s,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let r=t.field(km,!1);if(!r)return!1;let l=r.pop(s,t,e);return l?(n(l),!0):!1}}const xm=il(0,!1),yh=il(1,!1),Ax=il(0,!0),Tx=il(1,!0);class Pt{constructor(e,t,n,r,l){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=l}setSelAfter(e){return new Pt(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new Pt(e.changes&&et.fromJSON(e.changes),[],e.mapped&&vn.fromJSON(e.mapped),e.startSelection&&H.fromJSON(e.startSelection),e.selectionsAfter.map(H.fromJSON))}static fromTransaction(e,t){let n=Qt;for(let r of e.startState.facet(Cx)){let l=r(e);l.length&&(n=n.concat(l))}return!n.length&&e.changes.empty?null:new Pt(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,Qt)}static selection(e){return new Pt(void 0,Qt,void 0,void 0,e)}}function rl(s,e,t,n){let r=e+1>t+20?e-t-1:0,l=s.slice(r,e);return l.push(n),l}function Mx(s,e){let t=[],n=!1;return s.iterChangedRanges((r,l)=>t.push(r,l)),e.iterChangedRanges((r,l,a,h)=>{for(let c=0;c<t.length;){let d=t[c++],m=t[c++];h>=d&&a<=m&&(n=!0)}}),n}function Ox(s,e){return s.ranges.length==e.ranges.length&&s.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function Sm(s,e){return s.length?e.length?s.concat(e):s:e}const Qt=[],Ex=200;function Cm(s,e){if(s.length){let t=s[s.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-Ex));return n.length&&n[n.length-1].eq(e)?s:(n.push(e),rl(s,s.length-1,1e9,t.setSelAfter(n)))}else return[Pt.selection([e])]}function Px(s){let e=s[s.length-1],t=s.slice();return t[s.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function vh(s,e){if(!s.length)return s;let t=s.length,n=Qt;for(;t;){let r=Rx(s[t-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let l=s.slice(0,t);return l[t-1]=r,l}else e=r.mapped,t--,n=r.selectionsAfter}return n.length?[Pt.selection(n)]:Qt}function Rx(s,e,t){let n=Sm(s.selectionsAfter.length?s.selectionsAfter.map(h=>h.map(e)):Qt,t);if(!s.changes)return Pt.selection(n);let r=s.changes.map(e),l=e.mapDesc(s.changes,!0),a=s.mapped?s.mapped.composeDesc(l):l;return new Pt(r,Le.mapEffects(s.effects,e),a,s.startSelection.map(l),n)}const Dx=/^(input\.type|delete)($|\.)/;class On{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new On(this.done,this.undone):this}addChanges(e,t,n,r,l){let a=this.done,h=a[a.length-1];return h&&h.changes&&!h.changes.empty&&e.changes&&(!n||Dx.test(n))&&(!h.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(l,Mx(h.changes,e.changes))||n=="input.type.compose")?a=rl(a,a.length-1,r.minDepth,new Pt(e.changes.compose(h.changes),Sm(Le.mapEffects(e.effects,h.changes),h.effects),h.mapped,h.startSelection,Qt)):a=rl(a,a.length,r.minDepth,e),new On(a,Qt,t,n)}addSelection(e,t,n,r){let l=this.done.length?this.done[this.done.length-1].selectionsAfter:Qt;return l.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&Ox(l[l.length-1],e)?this:new On(Cm(this.done,e),this.undone,t,n)}addMapping(e){return new On(vh(this.done,e),vh(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let l=r[r.length-1],a=l.selectionsAfter[0]||(l.startSelection?l.startSelection.map(l.changes.invertedDesc,1):t.selection);if(n&&l.selectionsAfter.length)return t.update({selection:l.selectionsAfter[l.selectionsAfter.length-1],annotations:gh.of({side:e,rest:Px(r),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(l.changes){let h=r.length==1?Qt:r.slice(0,r.length-1);return l.mapped&&(h=vh(h,l.mapped)),t.update({changes:l.changes,selection:l.startSelection,effects:l.effects,annotations:gh.of({side:e,rest:h,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}On.empty=new On(Qt,Qt);const Lx=[{key:"Mod-z",run:xm,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:yh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:yh,preventDefault:!0},{key:"Mod-u",run:Ax,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:Tx,preventDefault:!0}];function yr(s,e){return H.create(s.ranges.map(e),s.mainIndex)}function ln(s,e){return s.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function an({state:s,dispatch:e},t){let n=yr(s.selection,t);return n.eq(s.selection,!0)?!1:(e(ln(s,n)),!0)}function sl(s,e){return H.cursor(e?s.to:s.from)}function bm(s,e){return an(s,t=>t.empty?s.moveByChar(t,e):sl(t,e))}function pt(s){return s.textDirectionAt(s.state.selection.main.head)==je.LTR}const Am=s=>bm(s,!pt(s)),Tm=s=>bm(s,pt(s));function Mm(s,e){return an(s,t=>t.empty?s.moveByGroup(t,e):sl(t,e))}const Nx=s=>Mm(s,!pt(s)),Bx=s=>Mm(s,pt(s));function Ix(s,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(s.sliceDoc(e.from,e.to)))||e.firstChild}function ol(s,e,t){let n=Tn(s).resolveInner(e.head),r=t?ke.closedBy:ke.openedBy;for(let c=e.head;;){let d=t?n.childAfter(c):n.childBefore(c);if(!d)break;Ix(s,d,r)?n=d:c=t?d.to:d.from}let l=n.type.prop(r),a,h;return l&&(a=t?Mn(s,n.from,1):Mn(s,n.to,-1))&&a.matched?h=t?a.end.to:a.end.from:h=t?n.to:n.from,H.cursor(h,t?-1:1)}const zx=s=>an(s,e=>ol(s.state,e,!pt(s))),Fx=s=>an(s,e=>ol(s.state,e,pt(s)));function Om(s,e){return an(s,t=>{if(!t.empty)return sl(t,e);let n=s.moveVertically(t,e);return n.head!=t.head?n:s.moveToLineBoundary(t,e)})}const Em=s=>Om(s,!1),Pm=s=>Om(s,!0);function Rm(s){let e=s.scrollDOM.clientHeight<s.scrollDOM.scrollHeight-2,t=0,n=0,r;if(e){for(let l of s.state.facet(ue.scrollMargins)){let a=l(s);a?.top&&(t=Math.max(a?.top,t)),a?.bottom&&(n=Math.max(a?.bottom,n))}r=s.scrollDOM.clientHeight-t-n}else r=(s.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(s.defaultLineHeight,r-5)}}function Dm(s,e){let t=Rm(s),{state:n}=s,r=yr(n.selection,a=>a.empty?s.moveVertically(a,e,t.height):sl(a,e));if(r.eq(n.selection))return!1;let l;if(t.selfScroll){let a=s.coordsAtPos(n.selection.main.head),h=s.scrollDOM.getBoundingClientRect(),c=h.top+t.marginTop,d=h.bottom-t.marginBottom;a&&a.top>c&&a.bottom<d&&(l=ue.scrollIntoView(r.main.head,{y:"start",yMargin:a.top-c}))}return s.dispatch(ln(n,r),{effects:l}),!0}const Lm=s=>Dm(s,!1),wh=s=>Dm(s,!0);function oi(s,e,t){let n=s.lineBlockAt(e.head),r=s.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?n.to:n.from)&&(r=s.moveToLineBoundary(e,t,!1)),!t&&r.head==n.from&&n.length){let l=/^\s*/.exec(s.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;l&&e.head!=n.from+l&&(r=H.cursor(n.from+l))}return r}const _x=s=>an(s,e=>oi(s,e,!0)),jx=s=>an(s,e=>oi(s,e,!1)),Vx=s=>an(s,e=>oi(s,e,!pt(s))),Hx=s=>an(s,e=>oi(s,e,pt(s))),Wx=s=>an(s,e=>s.moveToLineBoundary(e,!1,!1)),Ux=s=>an(s,e=>s.moveToLineBoundary(e,!0,!1));function $x(s,e,t){let n=!1,r=yr(s.selection,l=>{let a=Mn(s,l.head,-1)||Mn(s,l.head,1)||l.head>0&&Mn(s,l.head-1,1)||l.head<s.doc.length&&Mn(s,l.head+1,-1);if(!a||!a.end)return l;n=!0;let h=a.start.from==l.head?a.end.to:a.end.from;return H.cursor(h)});return n?(e(ln(s,r)),!0):!1}const Kx=({state:s,dispatch:e})=>$x(s,e);function Gt(s,e,t){let n=yr(s.state.selection,r=>{r.undirectional&&r.head>=r.anchor!=e&&(r=H.range(r.head,r.anchor));let l=t(r);return H.range(r.anchor,l.head,l.goalColumn,l.bidiLevel||void 0,l.assoc)});return n.eq(s.state.selection)?!1:(s.dispatch(ln(s.state,n)),!0)}function Nm(s,e){return Gt(s,e,t=>s.moveByChar(t,e))}const Bm=s=>Nm(s,!pt(s)),Im=s=>Nm(s,pt(s));function zm(s,e){return Gt(s,e,t=>s.moveByGroup(t,e))}const Qx=s=>zm(s,!pt(s)),Gx=s=>zm(s,pt(s)),qx=s=>{let e=!pt(s);return Gt(s,e,t=>ol(s.state,t,e))},Yx=s=>{let e=pt(s);return Gt(s,e,t=>ol(s.state,t,e))};function Fm(s,e){return Gt(s,e,t=>s.moveVertically(t,e))}const _m=s=>Fm(s,!1),jm=s=>Fm(s,!0);function Vm(s,e){return Gt(s,e,t=>s.moveVertically(t,e,Rm(s).height))}const Hm=s=>Vm(s,!1),Wm=s=>Vm(s,!0),Xx=s=>Gt(s,!0,e=>oi(s,e,!0)),Jx=s=>Gt(s,!1,e=>oi(s,e,!1)),Zx=s=>{let e=!pt(s);return Gt(s,e,t=>oi(s,t,e))},eS=s=>{let e=pt(s);return Gt(s,e,t=>oi(s,t,e))},tS=s=>Gt(s,!1,e=>H.cursor(s.lineBlockAt(e.head).from)),nS=s=>Gt(s,!0,e=>H.cursor(s.lineBlockAt(e.head).to)),Um=({state:s,dispatch:e})=>(e(ln(s,{anchor:0})),!0),$m=({state:s,dispatch:e})=>(e(ln(s,{anchor:s.doc.length})),!0),Km=({state:s,dispatch:e})=>(e(ln(s,{anchor:s.selection.main.anchor,head:0})),!0),Qm=({state:s,dispatch:e})=>(e(ln(s,{anchor:s.selection.main.anchor,head:s.doc.length})),!0),iS=({state:s,dispatch:e})=>(e(s.update({selection:{anchor:0,head:s.doc.length},userEvent:"select"})),!0),rS=({state:s,dispatch:e})=>{let t=al(s).map(({from:n,to:r})=>H.undirectionalRange(n,Math.min(r+1,s.doc.length)));return e(s.update({selection:H.create(t),userEvent:"select"})),!0},sS=({state:s,dispatch:e})=>{let t=yr(s.selection,n=>{let r=Tn(s),l=r.resolveStack(n.from,1);if(n.empty){let a=r.resolveStack(n.from,-1);a.node.from>=l.node.from&&a.node.to<=l.node.to&&(l=a)}for(let a=l;a;a=a.next){let{node:h}=a;if((h.from<n.from&&h.to>=n.to||h.to>n.to&&h.from<=n.from)&&a.next)return H.undirectionalRange(h.from,h.to)}return n});return t.eq(s.selection)?!1:(e(ln(s,t)),!0)};function Gm(s,e){let{state:t}=s,n=t.selection,r=t.selection.ranges.slice();for(let l of t.selection.ranges){let a=t.doc.lineAt(l.head);if(e?a.to<s.state.doc.length:a.from>0)for(let h=l;;){let c=s.moveVertically(h,e);if(c.head<a.from||c.head>a.to){r.some(d=>d.head==c.head)||r.push(c);break}else{if(c.head==h.head)break;h=c}}}return r.length==n.ranges.length?!1:(s.dispatch(ln(t,H.create(r,r.length-1))),!0)}const oS=s=>Gm(s,!1),lS=s=>Gm(s,!0),aS=({state:s,dispatch:e})=>{let t=s.selection,n=null;return t.ranges.length>1?n=H.create([t.main]):t.main.empty||(n=H.create([H.cursor(t.main.head)])),n?(e(ln(s,n)),!0):!1};function Ss(s,e){if(s.state.readOnly)return!1;let t="delete.selection",{state:n}=s,r=n.changeByRange(l=>{let{from:a,to:h}=l;if(a==h){let c=e(l);c<a?(t="delete.backward",c=ll(s,c,!1)):c>a&&(t="delete.forward",c=ll(s,c,!0)),a=Math.min(a,c),h=Math.max(h,c)}else a=ll(s,a,!1),h=ll(s,h,!0);return a==h?{range:l}:{changes:{from:a,to:h},range:H.cursor(a,a<l.head?-1:1)}});return r.changes.empty?!1:(s.dispatch(n.update(r,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?ue.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function ll(s,e,t){if(s instanceof ue)for(let n of s.state.facet(ue.atomicRanges).map(r=>r(s)))n.between(e,e,(r,l)=>{r<e&&l>e&&(e=t?l:r)});return e}const qm=(s,e,t)=>Ss(s,n=>{let r=n.from,{state:l}=s,a=l.doc.lineAt(r),h,c;if(t&&!e&&r>a.from&&r<a.from+200&&!/[^ \t]/.test(h=a.text.slice(0,r-a.from))){if(h[h.length-1]==" ")return r-1;let d=vo(h,l.tabSize),m=d%el(l)||el(l);for(let y=0;y<m&&h[h.length-1-y]==" ";y++)r--;c=r}else c=ct(a.text,r-a.from,e,e)+a.from,c==r&&a.number!=(e?l.doc.lines:1)?c+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(c-a.from,r-a.from))&&(c=ct(a.text,c-a.from,!1,!1)+a.from);return c}),kh=s=>qm(s,!1,!0),Ym=s=>qm(s,!0,!1),Xm=(s,e)=>Ss(s,t=>{let n=t.head,{state:r}=s,l=r.doc.lineAt(n),a=r.charCategorizer(n);for(let h=null;;){if(n==(e?l.to:l.from)){n==t.head&&l.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let c=ct(l.text,n-l.from,e)+l.from,d=l.text.slice(Math.min(n,c)-l.from,Math.max(n,c)-l.from),m=a(d);if(h!=null&&m!=h)break;(d!=" "||n!=t.head)&&(h=m),n=c}return n}),Jm=s=>Xm(s,!1),uS=s=>Xm(s,!0),hS=s=>Ss(s,e=>{let t=s.lineBlockAt(e.head).to;return e.head<t?t:Math.min(s.state.doc.length,e.head+1)}),cS=s=>Ss(s,e=>{let t=s.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),fS=s=>Ss(s,e=>{let t=s.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(s.state.doc.length,e.head+1)}),dS=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let t=s.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:Me.of(["",""])},range:H.cursor(n.from)}));return e(s.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},pS=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let t=s.changeByRange(n=>{if(!n.empty||n.from==0||n.from==s.doc.length)return{range:n};let r=n.from,l=s.doc.lineAt(r),a=r==l.from?r-1:ct(l.text,r-l.from,!1)+l.from,h=r==l.to?r+1:ct(l.text,r-l.from,!0)+l.from;return{changes:{from:a,to:h,insert:s.doc.slice(r,h).append(s.doc.slice(a,r))},range:H.cursor(h)}});return t.changes.empty?!1:(e(s.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function al(s){let e=[],t=-1;for(let n of s.selection.ranges){let r=s.doc.lineAt(n.from),l=s.doc.lineAt(n.to);if(!n.empty&&n.to==l.from&&(l=s.doc.lineAt(n.to-1)),t>=r.number){let a=e[e.length-1];a.to=l.to,a.ranges.push(n)}else e.push({from:r.from,to:l.to,ranges:[n]});t=l.number+1}return e}function Zm(s,e,t){if(s.readOnly)return!1;let n=[],r=[];for(let l of al(s)){if(t?l.to==s.doc.length:l.from==0)continue;let a=s.doc.lineAt(t?l.to+1:l.from-1),h=a.length+1;if(t){n.push({from:l.to,to:a.to},{from:l.from,insert:a.text+s.lineBreak});for(let c of l.ranges)r.push(H.range(Math.min(s.doc.length,c.anchor+h),Math.min(s.doc.length,c.head+h)))}else{n.push({from:a.from,to:l.from},{from:l.to,insert:s.lineBreak+a.text});for(let c of l.ranges)r.push(H.range(c.anchor-h,c.head-h))}}return n.length?(e(s.update({changes:n,scrollIntoView:!0,selection:H.create(r,s.selection.mainIndex),userEvent:"move.line"})),!0):!1}const mS=({state:s,dispatch:e})=>Zm(s,e,!1),gS=({state:s,dispatch:e})=>Zm(s,e,!0);function eg(s,e,t){if(s.readOnly)return!1;let n=[];for(let l of al(s))t?n.push({from:l.from,insert:s.doc.slice(l.from,l.to)+s.lineBreak}):n.push({from:l.to,insert:s.lineBreak+s.doc.slice(l.from,l.to)});let r=s.changes(n);return e(s.update({changes:r,selection:s.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const yS=({state:s,dispatch:e})=>eg(s,e,!1),vS=({state:s,dispatch:e})=>eg(s,e,!0),wS=s=>{if(s.state.readOnly)return!1;let{state:e}=s,t=e.changes(al(e).map(({from:r,to:l})=>(r>0?r--:l<e.doc.length&&l++,{from:r,to:l}))),n=yr(e.selection,r=>{let l;if(s.lineWrapping){let a=s.lineBlockAt(r.head),h=s.coordsAtPos(r.head,r.assoc||1);h&&(l=a.bottom+s.documentTop-h.bottom+s.defaultLineHeight/2)}return s.moveVertically(r,!0,l)}).map(t);return s.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function kS(s,e){if(/\(\)|\[\]|\{\}/.test(s.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Tn(s).resolveInner(e),n=t.childBefore(e),r=t.childAfter(e),l;return n&&r&&n.to<=e&&r.from>=e&&(l=n.type.prop(ke.closedBy))&&l.indexOf(r.name)>-1&&s.doc.lineAt(n.to).from==s.doc.lineAt(r.from).from&&!/\S/.test(s.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}const tg=ng(!1),xS=ng(!0);function ng(s){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:l,to:a}=r,h=e.doc.lineAt(l),c=!s&&l==a&&kS(e,l);s&&(l=a=(a<=h.to?h:e.doc.lineAt(a)).to);let d=new tl(e,{simulateBreak:l,simulateDoubleBreak:!!c}),m=lh(d,l);for(m==null&&(m=vo(/^\s*/.exec(e.doc.lineAt(l).text)[0],e.tabSize));a<h.to&&/\s/.test(h.text[a-h.from]);)a++;c?{from:l,to:a}=c:l>h.from&&l<h.from+100&&!/\S/.test(h.text.slice(0,l))&&(l=h.from);let y=["",ks(e,m)];return c&&y.push(ks(e,d.lineIndent(h.from,-1))),{changes:{from:l,to:a,insert:Me.of(y)},range:H.cursor(l+1+y[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function xh(s,e){let t=-1;return s.changeByRange(n=>{let r=[];for(let a=n.from;a<=n.to;){let h=s.doc.lineAt(a);h.number>t&&(n.empty||n.to>h.from)&&(e(h,r,n),t=h.number),a=h.to+1}let l=s.changes(r);return{changes:r,range:H.range(l.mapPos(n.anchor,1),l.mapPos(n.head,1))}})}const SS=({state:s,dispatch:e})=>{if(s.readOnly)return!1;let t=Object.create(null),n=new tl(s,{overrideIndentation:l=>{let a=t[l];return a??-1}}),r=xh(s,(l,a,h)=>{let c=lh(n,l.from);if(c==null)return;/\S/.test(l.text)||(c=0);let d=/^\s*/.exec(l.text)[0],m=ks(s,c);(d!=m||h.from<l.from+d.length)&&(t[l.from]=c,a.push({from:l.from,to:l.from+d.length,insert:m}))});return r.changes.empty||e(s.update(r,{userEvent:"indent"})),!0},CS=({state:s,dispatch:e})=>s.readOnly?!1:(e(s.update(xh(s,(t,n)=>{n.push({from:t.from,insert:s.facet(oh)})}),{userEvent:"input.indent"})),!0),bS=({state:s,dispatch:e})=>s.readOnly?!1:(e(s.update(xh(s,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let l=vo(r,s.tabSize),a=0,h=ks(s,Math.max(0,l-el(s)));for(;a<r.length&&a<h.length&&r.charCodeAt(a)==h.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:h.slice(a)})}),{userEvent:"delete.dedent"})),!0),AS=s=>(s.setTabFocusMode(),!0),TS=[{key:"Ctrl-b",run:Am,shift:Bm,preventDefault:!0},{key:"Ctrl-f",run:Tm,shift:Im},{key:"Ctrl-p",run:Em,shift:_m},{key:"Ctrl-n",run:Pm,shift:jm},{key:"Ctrl-a",run:Wx,shift:tS},{key:"Ctrl-e",run:Ux,shift:nS},{key:"Ctrl-d",run:Ym},{key:"Ctrl-h",run:kh},{key:"Ctrl-k",run:hS},{key:"Ctrl-Alt-h",run:Jm},{key:"Ctrl-o",run:dS},{key:"Ctrl-t",run:pS},{key:"Ctrl-v",run:wh}],MS=[{key:"ArrowLeft",run:Am,shift:Bm,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:Nx,shift:Qx,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Vx,shift:Zx,preventDefault:!0},{key:"ArrowRight",run:Tm,shift:Im,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:Bx,shift:Gx,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Hx,shift:eS,preventDefault:!0},{key:"ArrowUp",run:Em,shift:_m,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Um,shift:Km},{mac:"Ctrl-ArrowUp",run:Lm,shift:Hm},{key:"ArrowDown",run:Pm,shift:jm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:$m,shift:Qm},{mac:"Ctrl-ArrowDown",run:wh,shift:Wm},{key:"PageUp",run:Lm,shift:Hm},{key:"PageDown",run:wh,shift:Wm},{key:"Home",run:jx,shift:Jx,preventDefault:!0},{key:"Mod-Home",run:Um,shift:Km},{key:"End",run:_x,shift:Xx,preventDefault:!0},{key:"Mod-End",run:$m,shift:Qm},{key:"Enter",run:tg,shift:tg},{key:"Mod-a",run:iS},{key:"Backspace",run:kh,shift:kh,preventDefault:!0},{key:"Delete",run:Ym,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Jm,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:uS,preventDefault:!0},{mac:"Mod-Backspace",run:cS,preventDefault:!0},{mac:"Mod-Delete",run:fS,preventDefault:!0}].concat(TS.map(s=>({mac:s.key,run:s.run,shift:s.shift}))),OS=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:zx,shift:qx},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:Fx,shift:Yx},{key:"Alt-ArrowUp",run:mS},{key:"Shift-Alt-ArrowUp",run:yS},{key:"Alt-ArrowDown",run:gS},{key:"Shift-Alt-ArrowDown",run:vS},{key:"Mod-Alt-ArrowUp",run:oS},{key:"Mod-Alt-ArrowDown",run:lS},{key:"Escape",run:aS},{key:"Mod-Enter",run:xS},{key:"Alt-l",mac:"Ctrl-l",run:rS},{key:"Mod-i",run:sS,preventDefault:!0},{key:"Mod-[",run:bS},{key:"Mod-]",run:CS},{key:"Mod-Alt-\\",run:SS},{key:"Shift-Mod-k",run:wS},{key:"Shift-Mod-\\",run:Kx},{key:"Mod-/",run:mx},{key:"Alt-A",mac:"Ctrl-A",run:yx},{key:"Ctrl-m",mac:"Shift-Alt-m",run:AS}].concat(MS);var ig={};class ul{constructor(e,t,n,r,l,a,h,c,d,m=0,y){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=l,this.score=a,this.buffer=h,this.bufferBase=c,this.curContext=d,this.lookAhead=m,this.parent=y}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new ul(e,[],t,n,n,0,[],0,r?new rg(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:l}=this.p,a=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),h=l.dynamicPrecedence(r);if(h&&(this.score+=h),n==0){r<l.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(l.getGoto(this.state,r,!0),this.reducePos),r<l.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(r,this.reducePos);return}let c=this.stack.length-(n-1)*3-(e&262144?6:0),d=c?this.stack[c-2]:this.p.ranges[0].from;r<l.minRepeatTerm&&d==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let m=this.reducePos-d;m>=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSize<m&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=m));let y=c?this.stack[c-1]:0,v=this.bufferBase+this.buffer.length-y;if(r<l.minRepeatTerm||e&131072){let k=l.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,d,k,v+4,!0)}if(e&262144)this.state=this.stack[c];else{let k=this.stack[c-3];this.state=l.getGoto(k,r,!0)}for(;this.stack.length>c;)this.stack.pop();this.reduceContext(r,d)}storeNode(e,t,n,r=4,l=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this.buffer.length;if(a>0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==n)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=n;return}}}if(!l||this.pos==n)this.buffer.push(e,t,n,r);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let h=!1;for(let c=a;c>0&&this.buffer[c-2]>n;c-=4)if(this.buffer[c-1]>=0){h=!0;break}if(h)for(;a>0&&this.buffer[a-2]>n;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,r>4&&(r-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=n,this.buffer[a+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let l=e,{parser:a}=this.p;this.pos=r;let h=a.stateFlag(l,1);!h&&(r>n||t<=a.maxNode)&&(this.reducePos=r),this.pushState(l,h?n:Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}else this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4)}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t,n){let r=this.p.reused.length-1;(r<0||this.p.reused[r]!=e)&&(this.p.reused.push(e),r++);let l=this.reducePos=this.pos=n+e.length;this.pushState(t,n),this.buffer.push(r,n,l,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream,this.pos-e.length))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new ul(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new ES(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if((n&65536)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let l=0,a;l<t.length;l+=2)(a=t[l+1])!=this.state&&this.p.parser.hasAction(a,e)&&r.push(t[l],a);if(this.stack.length<120)for(let l=0;r.length<8&&l<t.length;l+=2){let a=t[l+1];r.some((h,c)=>c&1&&h==a)||r.push(t[l],a)}t=r}let n=[];for(let r=0;r<t.length&&n.length<4;r+=2){let l=t[r+1];if(l==this.state)continue;let a=this.split();a.pushState(l,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[r],this.pos),a.reducePos=this.pos,a.score-=200,n.push(a)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,l=this.stack.length-n*3;if(l<0||e.getGoto(this.stack[l],r,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,l)=>{if(!t.includes(r))return t.push(r),e.allActions(r,a=>{if(!(a&393216))if(a&65536){let h=(a>>19)-l;if(h>1){let c=a&65535,d=this.stack.length-h*3;if(d>=0&&e.getGoto(this.stack[d],c,!1)>=0)return h<<19|65536|c}}else{let h=n(a,l+1);if(h!=null)return h}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream,t))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream,t))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.storeNode(this.curContext.hash,this.reducePos,this.reducePos,-3,!0)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new rg(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class rg{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class ES{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class hl{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new hl(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new hl(this.stack,this.pos,this.index)}}function cl(s,e=Uint16Array){if(typeof s!="string")return s;let t=null;for(let n=0,r=0;n<s.length;){let l=0;for(;;){let a=s.charCodeAt(n++),h=!1;if(a==126){l=65535;break}a>=92&&a--,a>=34&&a--;let c=a-32;if(c>=46&&(c-=46,h=!0),l+=c,h)break;l*=46}t?t[r++]=l:t=new e(l)}return t}class fl{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const sg=new fl;class PS{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=sg,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,l=this.pos+e;for(;l<n.from;){if(!r)return null;let a=this.ranges[--r];l-=n.from-a.to,n=a}for(;t<0?l>n.to:l>=n.to;){if(r==this.ranges.length-1)return null;let a=this.ranges[++r];l+=a.from-n.to,n=a}return l}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let l=this.resolveOffset(e,1);if(l==null)return-1;if(n=l,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let a=this.rangeIndex,h=this.range;for(;h.to<=n;)h=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>h.to&&(this.chunk2=this.chunk2.slice(0,h.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=sg,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class vr{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;RS(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}vr.prototype.contextual=vr.prototype.fallback=vr.prototype.extend=!1,vr.prototype.fallback=vr.prototype.extend=!1;function RS(s,e,t,n,r,l){let a=0,h=1<<n,{dialect:c}=t.p.parser;e:for(;(h&s[a])!=0;){let d=s[a+1];for(let k=a+3;k<d;k+=2)if((s[k+1]&h)>0){let x=s[k];if(c.allows(x)&&(e.token.value==-1||e.token.value==x||DS(x,e.token.value,r,l))){e.acceptToken(x);break}}let m=e.next,y=0,v=s[a+2];if(e.next<0&&v>y&&s[d+v*3-3]==65535){a=s[d+v*3-1];continue e}for(;y<v;){let k=y+v>>1,x=d+k+(k<<1),S=s[x],T=s[x+1]||65536;if(m<S)v=k;else if(m>=T)y=k+1;else{a=s[x+2],e.advance();continue e}}break}}function og(s,e,t){for(let n=e,r;(r=s[n])!=65535;n++)if(r==t)return n-e;return-1}function DS(s,e,t,n){let r=og(t,n,e);return r<0||og(t,n,s)<r}const zt=typeof process<"u"&&ig&&/\bparse\b/.test(ig.LOG);let Sh=null;function lg(s,e,t){let n=s.cursor(Ue.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(s.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:s.length}}class LS{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?lg(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?lg(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;if(e<this.safeFrom)return null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let l=n.children[r],a=this.start[t]+n.positions[r];if(a>e)return this.nextStart=a,null;if(l instanceof qe){let h=a>this.lastRepeatPos&&l.type.id>=this.minRepeat;if(a==e||h){let c=a+l.length,d;if(a>=this.safeFrom&&c<=this.safeTo&&(!(d=l.prop(ke.lookAhead))||c+d<this.fragment.to)&&(h&&(this.lastRepeat=l,this.lastRepeatPos=a),a==e))return l}this.index[t]++,a+l.length>=Math.max(this.safeFrom,e)&&(this.trees.push(l),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+l.length}}}class NS{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new fl)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:l}=r,a=r.stateSlot(e.state,3),h=e.curContext?e.curContext.hash:0,c=0;for(let d=0;d<l.length;d++){if((1<<d&a)==0)continue;let m=l[d],y=this.tokens[d];if(!(n&&!m.fallback)&&((m.contextual||y.start!=e.pos||y.mask!=a||y.context!=h)&&(this.updateCachedToken(y,m,e),y.mask=a,y.context=h),y.lookAhead>y.end+25&&(c=Math.max(y.lookAhead,c)),y.value!=0)){let v=t;if(y.extended>-1&&(t=this.addActions(e,y.extended,y.end,t)),t=this.addActions(e,y.value,y.end,t),!m.extend&&(n=y,t>v))break}}for(;this.actions.length>t;)this.actions.pop();return c&&e.setLookAhead(c),!n&&e.pos==this.stream.end&&(n=new fl,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new fl,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:l}=n.p;for(let a=0;a<l.specialized.length;a++)if(l.specialized[a]==e.value){let h=l.specializers[a](this.stream.read(e.start,e.end),n);if(h>=0&&n.p.parser.dialect.allows(h>>1)){(h&1)==0?e.value=h>>1:e.extended=h>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let l=0;l<r;l+=3)if(this.actions[l]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:l}=e,{parser:a}=e.p,{data:h}=a;for(let c=0;c<2;c++)for(let d=a.stateSlot(l,c?2:1);;d+=3){if(h[d]==65535)if(h[d+1]==1)d=jn(h,d+2);else{r==0&&h[d+1]==2&&(r=this.putAction(jn(h,d+2),t,n,r));break}h[d]==t&&(r=this.putAction(jn(h,d+1),t,n,r))}return r}}class BS{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new PS(t,r),this.tokens=new NS(e,this.stream),this.topTerm=e.top[1];let{from:l}=r[0];this.stacks=[ul.start(this,e.top[0],l)],this.fragments=n.length&&this.stream.end-l>e.bufferLength*4?new LS(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,l;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let h=e[a];for(;;){if(this.tokens.mainToken=null,h.pos>t)n.push(h);else{if(this.advanceStack(h,n,e))continue;{r||(r=[],l=[]),r.push(h);let c=this.tokens.getMainToken(h);l.push(c.value,c.end)}}break}}if(!n.length){let a=r&&zS(r);if(a)return zt&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw zt&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let a=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,l,n);if(a)return zt&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(n.length>a)for(n.sort((h,c)=>c.score-h.score);n.length>a;)n.pop();n.some(h=>h.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let a=0;a<n.length-1;a++){let h=n[a];for(let c=a+1;c<n.length;c++){let d=n[c];if(h.sameState(d)||h.buffer.length>500&&d.buffer.length>500)if((h.score-d.score||h.buffer.length-d.buffer.length)>0)n.splice(c--,1);else{n.splice(a--,1);continue e}}}n.length>12&&(n.sort((a,h)=>h.score-a.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let a=1;a<n.length;a++)n[a].pos<this.minStackPos&&(this.minStackPos=n[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}tryReuse(e,t,n,r){if(!n)return null;let l=e.curContext&&e.curContext.tracker.strict,a=l?e.curContext.hash:0;for(;n;){let h=this.parser.nodeSet.types[n.type.id]!=n.type?-1:this.parser.getGoto(e.state,n.type.id);if(h>-1&&n.length&&(!l||(n.prop(ke.contextHash)||0)==a))return e.useNode(n,h,t),n;if(n.children.length==0||n.positions[0]>0)break;let c=n.children[0];if(c instanceof qe&&(!r||c.type.id>=this.parser.minRepeatTerm))n=c;else break}return null}advanceStack(e,t,n){let r=e.pos,{parser:l}=this,a=zt?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.reducePos<r&&e.buffer.length&&e.buffer[e.buffer.length-2]<=e.reducePos&&this.fragments.lastRepeatPos==e.reducePos&&this.tryReuse(e,e.reducePos,this.fragments.lastRepeat,!0)||this.tryReuse(e,r,this.fragments.nodeAt(r),!1);if(d)return zt&&console.log(a+this.stackID(e)+` (via reuse of ${l.getName(d.type.id)})`),!0}let h=l.stateSlot(e.state,4);if(h>0)return e.reduce(h),zt&&console.log(a+this.stackID(e)+` (via always-reduce ${l.getName(h&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let c=this.tokens.getActions(e);for(let d=0;d<c.length;){let m=c[d++],y=c[d++],v=c[d++],k=d==c.length||!n,x=k?e:e.split(),S=this.tokens.mainToken;if(x.apply(m,y,S?S.start:x.pos,v),zt&&console.log(a+this.stackID(x)+` (via ${(m&65536)==0?"shift":`reduce of ${l.getName(m&65535)}`} for ${l.getName(y)} @ ${r}${x==e?"":", split"})`),k)return!0;x.pos>r?t.push(x):n.push(x)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return ag(e,t),!0}}runRecovery(e,t,n){let r=null,l=!1;for(let a=0;a<e.length;a++){let h=e[a],c=t[a<<1],d=t[(a<<1)+1],m=zt?this.stackID(h)+" -> ":"";if(h.deadEnd&&(l||(l=!0,h.restart(),zt&&console.log(m+this.stackID(h)+" (restarted)"),this.advanceFully(h,n))))continue;let y=h.split(),v=m;for(let k=0;k<10&&y.forceReduce()&&(zt&&console.log(v+this.stackID(y)+" (via force-reduce)"),!this.advanceFully(y,n));k++)zt&&(v=this.stackID(y)+" -> ");for(let k of h.recoverByInsert(c))zt&&console.log(m+this.stackID(k)+" (via recover-insert)"),this.advanceFully(k,n);this.stream.end>h.pos?(d==h.pos&&(d++,c=0),h.recoverByDelete(c,d),zt&&console.log(m+this.stackID(h)+` (via recover-delete ${this.parser.getName(c)})`),ag(h,n)):(!r||r.score<y.score)&&(r=y)}return r}stackToTree(e){return e.close(),qe.build({buffer:hl.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(Sh||(Sh=new WeakMap)).get(e);return t||Sh.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function ag(s,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==s.pos&&n.sameState(s)){e[t].score<s.score&&(e[t]=s);return}}e.push(s)}class IS{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class dl extends Zp{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let h=0;h<e.repeatNodeCount;h++)t.push("");let n=Object.keys(e.topRules).map(h=>e.topRules[h][1]),r=[];for(let h=0;h<t.length;h++)r.push([]);function l(h,c,d){r[h].push([c,c.deserialize(String(d))])}if(e.nodeProps)for(let h of e.nodeProps){let c=h[0];typeof c=="string"&&(c=ke[c]);for(let d=1;d<h.length;){let m=h[d++];if(m>=0)l(m,c,h[d++]);else{let y=h[d+-m];for(let v=-m;v>0;v--)l(h[d++],c,y);d++}}}this.nodeSet=new Yu(t.map((h,c)=>Et.define({name:c>=this.minRepeatTerm?void 0:h,id:c,props:r[c],top:n.indexOf(c)>-1,error:c==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(c)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=Kp;let a=cl(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let h=0;h<this.specializerSpecs.length;h++)this.specialized[h]=this.specializerSpecs[h].term;this.specializers=this.specializerSpecs.map(ug),this.states=cl(e.states,Uint32Array),this.data=cl(e.stateData),this.goto=cl(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(h=>typeof h=="number"?new vr(a,h):h),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new BS(this,e,t,n);for(let l of this.wrappers)r=l(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let l=r[t+1];;){let a=r[l++],h=a&1,c=r[l++];if(h&&n)return c;for(let d=l+(a>>1);l<d;l++)if(r[l]==e)return c;if(h)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let l=this.stateSlot(e,r?2:1),a;;l+=3){if((a=n[l])==65535)if(n[l+1]==1)a=n[l=jn(n,l+2)];else{if(n[l+1]==2)return jn(n,l+2);break}if(a==t||a==0)return jn(n,l+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let l=this.stateSlot(e,1);r==null;l+=3){if(this.data[l]==65535)if(this.data[l+1]==1)l=jn(this.data,l+2);else break;r=t(jn(this.data,l+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=jn(this.data,n+2);else break;if((this.data[n+2]&1)==0){let r=this.data[n+1];t.some((l,a)=>a&1&&l==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(dl.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(l=>l.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let l=e.specializers.find(h=>h.from==n.external);if(!l)return n;let a=Object.assign(Object.assign({},n),{external:l.to});return t.specializers[r]=ug(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let l of e.split(" ")){let a=t.indexOf(l);a>=0&&(n[a]=!0)}let r=null;for(let l=0;l<t.length;l++)if(!n[l])for(let a=this.dialects[t[l]],h;(h=this.data[a++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[h]=1;return new IS(e,n,r)}static deserialize(e){return new dl(e)}}function jn(s,e){return s[e]|s[e+1]<<16}function zS(s){let e=null;for(let t of s){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function ug(s){if(s.external){let e=s.extend?1:0;return(t,n)=>s.external(t,n)<<1|e}return s.get}const FS=em({String:he.string,Number:he.number,"True False":he.bool,PropertyName:he.propertyName,Null:he.null,", :":he.separator,"[ ]":he.squareBracket,"{ }":he.brace}),_S=dl.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[FS],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),jS=()=>s=>{try{JSON.parse(s.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=VS(e,s.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function VS(s,e){let t;return(t=s.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=s.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const HS=Jo.define({name:"json",parser:_S.configure({props:[am.add({Object:hm({except:/^\s*\}/}),Array:hm({except:/^\s*\]/})}),Xk.add({"Object Array":Jk})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function WS(){return new jk(HS)}class hg{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class zi{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let r=n.facet(En).markerFilter;r&&(e=r(e,n));let l=e.slice().sort((k,x)=>k.from-x.from||k.to-x.to),a=new Pi,h=[],c=0,d=n.doc.iter(),m=0,y=n.doc.length;for(let k=0;;){let x=k==l.length?null:l[k];if(!x&&!h.length)break;let S,T;if(h.length)S=c,T=h.reduce((L,_)=>Math.min(L,_.to),x&&x.from>S?x.from:1e8);else{if(S=x.from,S>y)break;T=x.to,h.push(x),k++}for(;k<l.length;){let L=l[k];if(L.from==S&&(L.to>L.from||L.to==S))h.push(L),k++,T=Math.min(L.to,T);else{T=Math.min(L.from,T);break}}T=Math.min(T,y);let D=!1;if(h.some(L=>L.from==S&&(L.to==T||T==y))&&(D=S==T,!D&&T-S<10)){let L=S-(m+d.value.length);L>0&&(d.next(L),m=S);for(let _=S;;){if(_>=T){D=!0;break}if(!d.lineBreak&&m+d.value.length>_)break;_=m+d.value.length,m+=d.value.length,d.next()}}let q=kg(h);if(D)a.add(S,S,Re.widget({widget:new XS(q),diagnostics:h.slice()}));else{let L=h.reduce((_,K)=>K.markClass?_+" "+K.markClass:_,"");a.add(S,T,Re.mark({class:"cm-lintRange cm-lintRange-"+q+L,diagnostics:h.slice(),inclusiveEnd:h.some(_=>_.to>T)}))}if(c=T,c==y)break;for(let L=0;L<h.length;L++)h[L].to<=c&&h.splice(L--,1)}let v=a.finish();return new zi(v,t,wr(v))}}function wr(s,e=null,t=0){let n=null;return s.between(t,1e9,(r,l,{spec:a})=>{if(!(e&&a.diagnostics.indexOf(e)<0))if(!n)n=new hg(r,l,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(n.diagnostic)<0)return!1;n=new hg(n.from,l,n.diagnostic)}}),n}function cg(s,e){let t=e.pos,n=e.end||t,r=s.state.facet(En).hideOn(s,t,n);if(r!=null)return r;let l=s.startState.doc.lineAt(e.pos);return!!(s.effects.some(a=>a.is(pl))||s.changes.touchesRange(l.from,Math.max(l.to,n)))}function US(s,e){return s.field(un,!1)?e:e.concat(Le.appendConfig.of(Cg))}function $S(s,e){return{effects:US(s,[pl.of(e)])}}const pl=Le.define(),fg=Le.define(),dg=Le.define(),un=Ht.define({create(){return new zi(Re.none,null,null)},update(s,e){if(e.docChanged&&s.diagnostics.size){let t=s.diagnostics.map(e.changes),n=null,r=s.panel;if(s.selected){let l=e.changes.mapPos(s.selected.from,1);n=wr(t,s.selected.diagnostic,l)||wr(t,null,l)}!t.size&&r&&e.state.facet(En).autoPanel&&(r=null),s=new zi(t,r,n)}for(let t of e.effects)if(t.is(pl)){let n=e.state.facet(En).autoPanel?t.value.length?ml.open:null:s.panel;s=zi.init(t.value,n,e.state)}else t.is(fg)?s=new zi(s.diagnostics,t.value?ml.open:null,s.selected):t.is(dg)&&(s=new zi(s.diagnostics,s.panel,t.value));return s},provide:s=>[Uu.from(s,e=>e.panel),ue.decorations.from(s,e=>e.diagnostics)]}),KS=Re.mark({class:"cm-lintRange cm-lintRange-active"});function QS(s,e,t){let{diagnostics:n}=s.state.field(un),r,l=-1,a=-1;n.between(e-(t<0?1:0),e+(t>0?1:0),(c,d,{spec:m})=>{if(e>=c&&e<=d&&(c==d||(e>c||t>0)&&(e<d||t<0)))return r=m.diagnostics,l=c,a=d,!1});let h=s.state.facet(En).tooltipFilter;return r&&h&&(r=h(r,s.state)),r?{pos:l,end:a,above:!0,create(){return{dom:pg(s,r)}}}:null}function pg(s,e){return wn("ul",{class:"cm-tooltip-lint"},e.map(t=>vg(s,t,!1)))}const mg=s=>{let e=s.state.field(un,!1);return!e||!e.panel?!1:(s.dispatch({effects:fg.of(!1)}),!0)},GS=Mt.fromClass(class{constructor(s){this.view=s,this.timeout=-1,this.set=!0;let{delay:e}=s.state.facet(En);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let s=Date.now();if(s<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-s);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(En);t.length&&qS(t.map(n=>Promise.resolve(n(this.view))),n=>{this.view.state.doc==e.doc&&this.view.dispatch($S(this.view.state,n.reduce((r,l)=>r.concat(l))))},n=>{Wt(this.view.state,n)})}}update(s){let e=s.state.facet(En);(s.docChanged||e!=s.startState.facet(En)||e.needsRefresh&&e.needsRefresh(s))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function qS(s,e,t){let n=[],r=-1;for(let l of s)l.then(a=>{n.push(a),clearTimeout(r),n.length==s.length?e(n):r=setTimeout(()=>e(n),200)},t)}const En=te.define({combine(s){return{sources:s.map(e=>e.source).filter(e=>e!=null),...Xr(s.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:gg,tooltipFilter:gg,needsRefresh:(e,t)=>e?t?n=>e(n)||t(n):e:t,hideOn:(e,t)=>e?t?(n,r,l)=>e(n,r,l)||t(n,r,l):e:t,autoPanel:(e,t)=>e||t})}}});function gg(s,e){return s?e?(t,n)=>e(s(t,n),n):s:e}function YS(s,e={}){return[En.of({source:s,config:e}),GS,Cg]}function yg(s){let e=[];if(s)e:for(let{name:t}of s){for(let n=0;n<t.length;n++){let r=t[n];if(/[a-zA-Z]/.test(r)&&!e.some(l=>l.toLowerCase()==r.toLowerCase())){e.push(r);continue e}}e.push("")}return e}function vg(s,e,t){var n;let r=t?yg(e.actions):[];return wn("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},wn("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(s):e.message),(n=e.actions)===null||n===void 0?void 0:n.map((l,a)=>{let h=0,c=k=>{if(k.preventDefault(),h>Date.now()-100)return;let x=wr(s.state.field(un).diagnostics,e);x&&l.apply(s,x.from,x.to),h=Date.now()},{name:d}=l,m=r[a]?d.indexOf(r[a]):-1,y=m<0?d:[d.slice(0,m),wn("u",d.slice(m,m+1)),d.slice(m+1)],v=l.markClass?" "+l.markClass:"";return wn("button",{type:"button",class:"cm-diagnosticAction"+v,onclick:c,onmousedown:c,"aria-label":` Action: ${d}${m<0?"":` (access key "${r[a]})"`}.`},y)}),e.source&&wn("div",{class:"cm-diagnosticSource"},e.source))}class XS extends ts{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return wn("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class wg{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=vg(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ml{constructor(e){this.view=e,this.items=[];let t=r=>{if(!(r.ctrlKey||r.altKey||r.metaKey)){if(r.keyCode==27)mg(this.view),this.view.focus();else if(r.keyCode==38||r.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(r.keyCode==40||r.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(r.keyCode==36)this.moveSelection(0);else if(r.keyCode==35)this.moveSelection(this.items.length-1);else if(r.keyCode==13)this.view.focus();else if(r.keyCode>=65&&r.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:l}=this.items[this.selectedIndex],a=yg(l.actions);for(let h=0;h<a.length;h++)if(a[h].toUpperCase().charCodeAt(0)==r.keyCode){let c=wr(this.view.state.field(un).diagnostics,l);c&&l.actions[h].apply(e,c.from,c.to)}}else return;r.preventDefault()}},n=r=>{for(let l=0;l<this.items.length;l++)this.items[l].dom.contains(r.target)&&this.moveSelection(l)};this.list=wn("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:n}),this.dom=wn("div",{class:"cm-panel-lint"},this.list,wn("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>mg(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(un).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(un),n=0,r=!1,l=null,a=new Set;for(e.between(0,this.view.state.doc.length,(h,c,{spec:d})=>{for(let m of d.diagnostics){if(a.has(m))continue;a.add(m);let y=-1,v;for(let k=n;k<this.items.length;k++)if(this.items[k].diagnostic==m){y=k;break}y<0?(v=new wg(this.view,m),this.items.splice(n,0,v),r=!0):(v=this.items[y],y>n&&(this.items.splice(n,y-n),r=!0)),t&&v.diagnostic==t.diagnostic?v.dom.hasAttribute("aria-selected")||(v.dom.setAttribute("aria-selected","true"),l=v):v.dom.hasAttribute("aria-selected")&&v.dom.removeAttribute("aria-selected"),n++}});n<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)r=!0,this.items.pop();this.items.length==0&&(this.items.push(new wg(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),r=!0),l?(this.list.setAttribute("aria-activedescendant",l.id),this.view.requestMeasure({key:this,read:()=>({sel:l.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:h,panel:c})=>{let d=c.height/this.list.offsetHeight;h.top<c.top?this.list.scrollTop-=(c.top-h.top)/d:h.bottom>c.bottom&&(this.list.scrollTop+=(h.bottom-c.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),r&&this.sync()}sync(){let e=this.list.firstChild;function t(){let n=e;e=n.nextSibling,n.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(un),n=wr(t.diagnostics,this.items[e].diagnostic);n&&this.view.dispatch({selection:{anchor:n.from,head:n.to},scrollIntoView:!0,effects:dg.of(n)})}static open(e){return new ml(e)}}function gl(s,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(s)}</svg>')`}function yl(s){return gl(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${s}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const JS=ue.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:yl("#f11")},".cm-lintRange-warning":{backgroundImage:yl("orange")},".cm-lintRange-info":{backgroundImage:yl("#999")},".cm-lintRange-hint":{backgroundImage:yl("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function ZS(s){return s=="error"?4:s=="warning"?3:s=="info"?2:1}function kg(s){let e="hint",t=1;for(let n of s){let r=ZS(n.severity);r>t&&(t=r,e=n.severity)}return e}class xg extends ti{constructor(e){super(),this.diagnostics=e,this.severity=kg(e)}toDOM(e){let t=document.createElement("div");t.className="cm-lint-marker cm-lint-marker-"+this.severity;let n=this.diagnostics,r=e.state.facet(vl).tooltipFilter;return r&&(n=r(n,e.state)),n.length&&(t.onmouseover=()=>tC(e,t,n)),t}}function eC(s,e){let t=n=>{let r=e.getBoundingClientRect();if(!(n.clientX>r.left-10&&n.clientX<r.right+10&&n.clientY>r.top-10&&n.clientY<r.bottom+10)){for(let l=n.target;l;l=l.parentNode)if(l.nodeType==1&&l.classList.contains("cm-tooltip-lint"))return;window.removeEventListener("mousemove",t),s.state.field(Sg)&&s.dispatch({effects:bh.of(null)})}};window.addEventListener("mousemove",t)}function tC(s,e,t){function n(){let a=s.elementAtHeight(e.getBoundingClientRect().top+5-s.documentTop);s.coordsAtPos(a.from)&&s.dispatch({effects:bh.of({pos:a.from,above:!1,clip:!1,create(){return{dom:pg(s,t),getCoords:()=>e.getBoundingClientRect()}}})}),e.onmouseout=e.onmousemove=null,eC(s,e)}let{hoverTime:r}=s.state.facet(vl),l=setTimeout(n,r);e.onmouseout=()=>{clearTimeout(l),e.onmouseout=e.onmousemove=null},e.onmousemove=()=>{clearTimeout(l),l=setTimeout(n,r)}}function nC(s,e){let t=Object.create(null);for(let r of e){let l=s.lineAt(r.from);(t[l.from]||(t[l.from]=[])).push(r)}let n=[];for(let r in t)n.push(new xg(t[r]).range(+r));return be.of(n,!0)}const iC=dk({class:"cm-gutter-lint",markers:s=>s.state.field(Ch),widgetMarker:(s,e,t)=>{let n=[];return s.state.field(Ch).between(t.from,t.to,(r,l,a)=>{r>t.from&&r<t.to&&n.push(...a.diagnostics)}),n.length?new xg(n):null}}),Ch=Ht.define({create(){return be.empty},update(s,e){s=s.map(e.changes);let t=e.state.facet(vl).markerFilter;for(let n of e.effects)if(n.is(pl)){let r=n.value;t&&(r=t(r||[],e.state)),s=nC(e.state.doc,r.slice(0))}return s}}),bh=Le.define(),Sg=Ht.define({create(){return null},update(s,e){return s&&e.docChanged&&(s=cg(e,s)?null:{...s,pos:e.changes.mapPos(s.pos)}),e.effects.reduce((t,n)=>n.is(bh)?n.value:t,s)},provide:s=>Wu.from(s)}),rC=ue.baseTheme({".cm-gutter-lint":{width:"1.4em","& .cm-gutterElement":{padding:".2em"}},".cm-lint-marker":{width:"1em",height:"1em"},".cm-lint-marker-info":{content:gl('<path fill="#aaf" stroke="#77e" stroke-width="6" stroke-linejoin="round" d="M5 5L35 5L35 35L5 35Z"/>')},".cm-lint-marker-warning":{content:gl('<path fill="#fe8" stroke="#fd7" stroke-width="6" stroke-linejoin="round" d="M20 6L37 35L3 35Z"/>')},".cm-lint-marker-error":{content:gl('<circle cx="20" cy="20" r="15" fill="#f87" stroke="#f43" stroke-width="6"/>')}}),sC=ak(QS,{hideOn:cg}),Cg=[un,ue.decorations.compute([un],s=>{let{selected:e,panel:t}=s.field(un);return!e||!t||e.from==e.to?Re.none:Re.set([KS.range(e.from,e.to)])}),sC,JS],vl=te.define({combine(s){return Xr(s,{hoverTime:300,markerFilter:null,tooltipFilter:null})}});function oC(s={}){return[vl.of(s),Ch,iC,rC,Sg]}const bg=Bn.define(),lC=ex(nl.define([{tag:he.propertyName,color:"var(--json-key)"},{tag:he.string,color:"var(--json-string)"},{tag:[he.number,he.bool,he.null],color:"var(--json-value)"}]));function aC({value:s,disabled:e,onChange:t}){const n=Te.useRef(null),r=Te.useRef(),l=Te.useRef(new qr),a=Te.useRef({value:s,disabled:e,onChange:t});return a.current={value:s,disabled:e,onChange:t},Te.useLayoutEffect(()=>{const h=n.current;if(!h)return;const c=a.current,d=new ue({parent:h,state:Oe.create({doc:c.value,extensions:[WS(),kk(),Xw(),ax(),Yk(),bx(),Rp.of([...OS,...Lx]),lC,oC(),YS(jS()),ue.lineWrapping,ue.contentAttributes.of({"aria-label":"Configuration JSON",spellcheck:"false"}),l.current.of(Oe.readOnly.of(c.disabled)),ue.updateListener.of(m=>{if(m.docChanged&&!m.transactions.some(y=>y.annotation(bg))){const y=m.state.doc.toString();a.current.onChange(a.current.value.includes(`\r
29
+ `)?y.replaceAll(`
30
+ `,`\r
31
+ `):y)}})]})});return r.current=d,()=>{d.destroy(),r.current=void 0}},[]),Te.useLayoutEffect(()=>{const h=r.current;h&&s.replace(/\r\n?/gu,`
32
+ `)!==h.state.doc.toString()&&h.dispatch({changes:{from:0,to:h.state.doc.length,insert:s},annotations:[bg.of(!0),Je.addToHistory.of(!1)]})},[s]),Te.useLayoutEffect(()=>{r.current?.dispatch({effects:l.current.reconfigure(Oe.readOnly.of(e))})},[e]),B.jsx("div",{id:"raw-config",ref:n})}const Ag="@oliverflint/dataverse-dev-proxy",Ah="dataverse-dev.json",Th=/^[a-z0-9][a-z0-9_. -]*\.json$/iu,Mh=/^[a-z0-9][a-z0-9_-]{0,63}$/u,li=(s,e)=>s.replace(/[\\/]+$/u,"")+"/"+e,wl=s=>s instanceof Error?s.message:String(s),Fi=s=>typeof s=="string"?s:"",Tg=s=>JSON.stringify(s,null,2)+`
33
+ `;function Cs(s){const e=JSON.parse(s.replace(/^\uFEFF/u,""));if(!e||typeof e!="object"||Array.isArray(e)||!Array.isArray(e.webResources)||e.webResources.some(t=>!t||typeof t!="object"||Array.isArray(t)))throw new Error("Expected a JSON configuration with a webResources array of mappings.");return e}function Mg(s){try{return new URL(s??"")}catch{return null}}function Og(s){const e=Mg(s.environment);if(!e||e.protocol!=="https:"||e.href!==e.origin+"/")throw new Error("Enter an HTTPS environment origin without an app path.");if(s.startUrl){const n=Mg(s.startUrl);if(!n||n.origin!==e.origin||n.username||n.password)throw new Error("App URL must use the same origin and contain no credentials.")}if(s.profile&&!Mh.test(s.profile))throw new Error("Use 1–64 lowercase letters, digits, hyphens or underscores for the profile. Start with a letter or digit.");if(!s.webResources.length)throw new Error("Add at least one web resource mapping.");const t=new Set;for(const{name:n,file:r}of s.webResources){if(typeof n!="string"||!n.trim()||!Fi(r).trim())throw new Error("Enter a name and local file for each mapping.");const l=n.toLowerCase();if(t.has(l))throw new Error("Duplicate web resource mapping: "+n);t.add(l)}}function uC(){const s=window.toolboxAPI,[e,t]=Te.useState(),[n,r]=Te.useState(),[l,a]=Te.useState(Ah),[h,c]=Te.useState("editor"),d=Te.useRef(),[m,y]=Te.useState(),[v,k]=Te.useState(!1),[x,S]=Te.useState(),T=Te.useRef(!1),[D,q]=Te.useState({text:"",error:!1}),L=Te.useRef(null),_=Te.useRef(null),K=Te.useRef(!1),I=(R,z=!1)=>q({text:R,error:z}),F=e?.directory;let ee=e?.config.browser??"msedge";if(h==="json"&&e?.raw!==void 0)try{ee=Cs(e.raw).browser??"msedge"}catch{ee=""}const ge=x&&x.directory===F&&x.browser===ee?x.names:[];Te.useEffect(()=>{if(!s||!F||v||ee!=="msedge"&&ee!=="chrome")return;let R=!0;const z=li(F,".browser-profile/named"),X=ee+"-";return(async()=>{const oe=(await s.fileSystem.exists(z)?await s.fileSystem.readDirectory(z):[]).filter(ce=>ce.type==="directory"&&ce.name.startsWith(X)).map(ce=>ce.name.slice(X.length)).filter(ce=>Mh.test(ce)).sort();R&&S({directory:F,browser:ee,names:oe})})().catch(()=>{R&&S(void 0)}),()=>{R=!1}},[s,F,ee,v]),Te.useEffect(()=>{if(!s)return;let R=!0,z=0;const X=window.matchMedia("(prefers-color-scheme: dark)"),$=()=>{const mt=++z;s.utils.getCurrentTheme().then(qt=>{R&&mt===z&&(document.documentElement.dataset.theme=qt)}).catch(()=>{})},oe=mt=>mt==="settings:updated"||typeof mt=="object"&&mt!==null&&"event"in mt&&mt.event==="settings:updated",ce=(mt,qt)=>{(oe(mt)||oe(qt))&&$()},Ae=s.events.on(ce),$e=()=>{document.hidden||$()},ai=window.setInterval($e,1e3);return window.addEventListener("focus",$e),document.addEventListener("visibilitychange",$e),X.addEventListener("change",$),$(),()=>{R=!1,typeof Ae=="function"?Ae():s.events.off(ce),window.clearInterval(ai),window.removeEventListener("focus",$e),document.removeEventListener("visibilitychange",$e),X.removeEventListener("change",$)}},[s]),Te.useEffect(()=>{K.current&&(L.current?.focus(),K.current=!1)},[e]);async function pe(R){if(!(!s||T.current)){T.current=!0,k(!0);try{await R()}catch(z){I(wl(z),!0)}finally{T.current=!1,k(!1)}}}async function me(R){return await s.fileSystem.exists(R)?s.fileSystem.readText(R):void 0}async function ae(R,z,X=!1){if(!Th.test(z))throw new Error("Use a .json filename starting with a letter or number. Other characters can be letters, numbers, spaces, dots, underscores, or hyphens.");const $=await me(li(R,z));if($===void 0&&!X)throw new Error("Could not find "+z+". Choose another config or create a new one.");let oe={environment:"",browser:"msedge",webResources:[]},ce;if($!==void 0)try{oe=Cs($)}catch(Ae){ce=wl(Ae)}t({directory:R,fileName:z,original:$,config:oe,dirty:$===void 0,raw:$}),r(void 0),c(ce?"json":"editor"),I(ce??(X&&$!==void 0?"Opened the existing configuration.":""),!!ce)}function we(){return!e?.dirty||window.confirm("Discard unsaved changes and switch projects?")}async function ve(R){if(!we())return;const z=await s.fileSystem.selectPath({type:"folder",title:"Select a Dataverse project",defaultPath:e?.directory});if(!z)return;const $=(R?[]:await s.fileSystem.readDirectory(z)).filter(oe=>oe.type==="file"&&Th.test(oe.name)&&!/^(package(?:-lock)?|tsconfig(?:\..+)?|npm-shrinkwrap)\.json$/iu.test(oe.name)).map(oe=>oe.name).sort();a(R||$.includes(Ah)?Ah:$[0]??""),r({directory:z,create:R,files:$}),I("")}function Se(R){t(z=>z&&{...z,config:R(z.config),dirty:!0,raw:void 0})}function ze(R){try{R.raw!==void 0&&t({...R,config:Cs(R.raw)}),c("editor"),I("")}catch(z){I(wl(z),!0)}}function Ce(R,z){Se(X=>{const $={...X};return!z&&(R==="startUrl"||R==="profile")?delete $[R]:$[R]=z,$})}function Q(R,z,X){Se($=>({...$,webResources:$.webResources.map((oe,ce)=>{if(ce!==R)return oe;const Ae={...oe};return z==="contentType"&&!X?delete Ae.contentType:Ae[z]=X,Ae})}))}async function se(R,z){const X=await s.fileSystem.selectPath({type:"file",title:"Select a local web resource",defaultPath:R});if(!X)return;const $=li(R,"").replaceAll("\\","/"),oe=X.replaceAll("\\","/");Q(z,"file",oe.toLowerCase().startsWith($.toLowerCase())?"./"+oe.slice($.length):X)}async function J(R){if(!R.dirty)return R;const z=R.raw===void 0?R.config:Cs(R.raw);Og(z);const X=li(R.directory,R.fileName);if(await me(X)!==R.original){window.confirm("The config changed on disk. Reload it and discard this draft?")&&await ae(R.directory,R.fileName);return}const $=R.raw??Tg(z);await s.fileSystem.writeText(X,$);const oe={...R,config:z,original:$,dirty:!1};return t(oe),I("Configuration saved."),oe}async function M(R,z,X){if(Og(R.raw===void 0?R.config:Cs(R.raw)),X!==void 0&&(z!=="start"||!Mh.test(X)))throw new Error("Invalid launch profile.");const{directory:$,fileName:oe,original:ce}=R;if(!Th.test(oe))throw new Error("Invalid config filename.");if(await me(li($,oe))!==ce)throw new Error("The config changed on disk. Reopen the project before running the proxy.");const Ae=await me(li($,"package.json")),$e=Ae!==void 0&&JSON.parse(Ae.replace(/^\uFEFF/u,""))?.name===Ag;if($e&&!await s.fileSystem.exists(li($,"pptb/package.json")))throw new Error("The proxy checkout needs its pptb folder to resolve the published runner.");const ai="npx --yes --prefer-online "+($e?"--prefix ./pptb ":"")+"--package="+Ag+"@latest -- dataverse-dev-proxy",mt=d.current;mt&&await s.terminal.get(mt)&&await s.terminal.close(mt),d.current=void 0;const qt=await s.terminal.create({name:"Dataverse Dev Proxy",cwd:$});d.current=qt.id,await s.terminal.setVisibility(qt.id,!0),I(z==="start"?"Proxy command launched. Follow startup in the terminal. Close the browser to stop.":"Validating the saved configuration…");let _i;try{_i=await s.terminal.execute(qt.id,ai+" "+z+' --config "'+oe+'"'+(X?" --profile "+X:""))}catch(xl){throw new Error("Terminal disconnected or rejected the command. Check whether the browser is still open before restarting. "+wl(xl))}if(_i.exitCode!==0)throw new Error(_i.error||"Command failed. Check the terminal for details.");I(z==="start"?"Proxy command exited.":"Saved configuration passed validation.")}function N(R,z){return pe(async()=>{const X=await J(R);X&&await M(X,"start",z)})}return B.jsxs("main",{children:[B.jsxs("header",{children:[B.jsxs("div",{children:[B.jsx("h1",{children:"Dataverse Dev Proxy"}),B.jsx("p",{id:"project",children:e?li(e.directory,e.fileName):"Choose a trusted local project to begin."})]}),B.jsxs("div",{className:"actions",children:[B.jsx("button",{disabled:!s||v,onClick:()=>{pe(()=>ve(!1))},children:"Open project…"}),B.jsx("button",{disabled:!s||v,onClick:()=>{pe(()=>ve(!0))},children:"New config…"})]})]}),n&&B.jsxs("section",{"aria-labelledby":"config-picker-title",children:[B.jsx("h2",{id:"config-picker-title",children:n.create?"Name the config":"Choose a mapping file"}),B.jsx("p",{children:n.directory}),B.jsxs("form",{onSubmit:R=>{R.preventDefault(),pe(()=>ae(n.directory,l,n.create))},children:[n.create?B.jsxs("label",{children:["Filename",B.jsx("input",{value:l,disabled:v,onChange:R=>a(R.target.value)})]}):n.files.length>0?B.jsxs("label",{children:["Mapping file",B.jsx("select",{disabled:v,value:l,onChange:R=>a(R.target.value),children:n.files.map(R=>B.jsx("option",{children:R},R))})]}):B.jsx("p",{children:"No supported JSON filenames in this folder. Use New config to create one."}),B.jsxs("div",{className:"actions config-picker-actions",children:[B.jsx("button",{type:"button",disabled:v,onClick:()=>r(void 0),children:"Cancel"}),B.jsx("button",{type:"submit",className:"primary",disabled:v||!l,children:n.create?"Continue":"Open config"})]})]})]}),e&&!n&&B.jsxs("form",{onSubmit:R=>R.preventDefault(),children:[B.jsxs("nav",{className:"editor-tabs","aria-label":"Configuration views",children:[B.jsx("button",{type:"button","aria-pressed":h==="editor",disabled:v,onClick:()=>ze(e),children:"Mapping editor"}),B.jsx("button",{type:"button","aria-pressed":h==="json",disabled:v,onClick:()=>c("json"),children:"Raw JSON"})]}),h==="json"?B.jsxs("section",{children:[B.jsx("h2",{children:"Configuration JSON"}),B.jsx(aC,{disabled:v,value:e.raw??Tg(e.config),onChange:R=>t(z=>z&&{...z,raw:R,dirty:!0})})]}):B.jsxs(B.Fragment,{children:[B.jsxs("section",{"aria-labelledby":"target",children:[B.jsxs("div",{className:"section-head",children:[B.jsx("h2",{id:"target",children:"Browser target"}),B.jsx("button",{type:"button",disabled:v,onClick:()=>{pe(async()=>{const R=await s.connections.getActiveConnection();if(!R)throw new Error("Select a PPTB connection first.");Ce("environment",new URL(R.url).origin)})},children:"Use PPTB connection"})]}),B.jsxs("div",{className:"fields",children:[B.jsxs("label",{children:["Environment origin",B.jsx("input",{type:"url",required:!0,disabled:v,value:Fi(e.config.environment),placeholder:"https://yourorg.crm.dynamics.com",onChange:R=>Ce("environment",R.target.value)})]}),B.jsxs("label",{children:["App URL ",B.jsx("span",{children:"Optional"}),B.jsx("input",{type:"url",disabled:v,value:Fi(e.config.startUrl),onChange:R=>Ce("startUrl",R.target.value)})]}),B.jsxs("label",{children:["Browser",B.jsxs("select",{disabled:v,value:e.config.browser??"msedge",onChange:R=>Ce("browser",R.target.value),children:[B.jsx("option",{value:"msedge",children:"Microsoft Edge"}),B.jsx("option",{value:"chrome",children:"Google Chrome"})]})]}),B.jsxs("label",{children:["Profile ",B.jsx("span",{children:"Optional"}),B.jsx("input",{disabled:v,value:Fi(e.config.profile),placeholder:"Default profile",onChange:R=>Ce("profile",R.target.value)})]})]})]}),B.jsxs("section",{"aria-labelledby":"mappings",children:[B.jsxs("div",{className:"section-head",children:[B.jsx("h2",{id:"mappings",children:"Web resource mappings"}),B.jsx("button",{type:"button",ref:_,disabled:v,onClick:()=>{K.current=!0,Se(R=>({...R,webResources:[...R.webResources,{name:"",file:""}]}))},children:"Add mapping"})]}),!e.config.webResources.length&&B.jsx("p",{children:"Add a mapping between a logical resource name and a local file."}),e.config.webResources.length>0&&B.jsx("fieldset",{className:"mapping-fields",disabled:v,children:B.jsx("div",{className:"mapping-scroll",role:"region","aria-label":"Scrollable web resource mappings",tabIndex:0,children:B.jsxs("table",{className:"mapping-table","aria-labelledby":"mappings",children:[B.jsxs("colgroup",{children:[B.jsx("col",{}),B.jsx("col",{}),B.jsx("col",{className:"type-column"}),B.jsx("col",{className:"actions-column"})]}),B.jsx("thead",{children:B.jsxs("tr",{children:[B.jsx("th",{scope:"col",children:"Logical name"}),B.jsx("th",{scope:"col",children:"Local file"}),B.jsx("th",{scope:"col",children:"Content type"}),B.jsx("th",{scope:"col",children:"Actions"})]})}),B.jsx("tbody",{children:e.config.webResources.map((R,z,X)=>B.jsxs("tr",{children:[B.jsx("td",{children:B.jsxs("div",{className:"file",children:[B.jsx("input",{required:!0,"aria-label":"Logical name",value:Fi(R.name),ref:z===X.length-1?L:void 0,placeholder:"new_/account.js",onChange:$=>Q(z,"name",$.target.value)}),B.jsx("button",{type:"button",disabled:!window.dataverseAPI,onClick:()=>y(z),children:"Look up…"})]})}),B.jsx("td",{children:B.jsxs("div",{className:"file",children:[B.jsx("input",{required:!0,"aria-label":"Local file",value:Fi(R.file),placeholder:"./dist/account.js",onChange:$=>Q(z,"file",$.target.value)}),B.jsx("button",{type:"button",onClick:()=>{pe(()=>se(e.directory,z))},children:"Browse…"})]})}),B.jsx("td",{children:B.jsx(Bv,{value:Fi(R.contentType),onChange:$=>Q(z,"contentType",$)})}),B.jsx("td",{children:B.jsx("button",{type:"button",onClick:()=>{Se($=>({...$,webResources:$.webResources.filter((oe,ce)=>ce!==z)})),_.current?.focus()},children:"Remove"})})]},z))})]})})})]})]}),B.jsxs("footer",{className:"actions",children:[B.jsx("button",{type:"button",disabled:v||!e.dirty,onClick:()=>{pe(()=>J(e))},children:"Save"}),B.jsx("button",{type:"button",disabled:v||e.dirty||e.original===void 0,onClick:()=>{pe(()=>M(e,"validate"))},children:"Validate saved config"}),B.jsxs("div",{className:"start-control",children:[B.jsx("button",{type:"button",className:"primary",disabled:v,onClick:()=>{N(e)},children:e.dirty?"Save and start":"Start proxy"}),!v&&ge.length>0&&B.jsxs("details",{className:"start-profiles",children:[B.jsx("summary",{"aria-label":"Start with an existing profile",title:"Start with an existing profile",children:"▾"}),B.jsx("div",{className:"profile-options",children:ge.map(R=>B.jsx("button",{type:"button",onClick:()=>{N(e,R)},children:R},R))})]})]})]})]}),e&&m!==void 0&&B.jsx(Nv,{environment:e.config.environment,onClose:()=>y(void 0),onSelect:R=>{Q(m,"name",R),y(void 0)}}),B.jsx("p",{id:"status",role:"status","aria-live":"polite","data-error":D.error,children:s?D.text:"Open this tool in Power Platform ToolBox Desktop."})]})}const kl=document.getElementById("root");kl&&!kl.hasAttribute("data-reactroot-initialized")&&(kl.setAttribute("data-reactroot-initialized","true"),Pv.createRoot(kl).render(B.jsx(Te.StrictMode,{children:B.jsx(uC,{})})))})();