prauga-flexdoc 0.4.6 → 0.4.7
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.
- checksums.yaml +4 -4
- data/assets/flexdoc.standalone.js +43 -43
- data/lib/prauga/flexdoc/version.rb +1 -1
- metadata +2 -2
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var FlexDocStandaloneBundle=(function(ks){"use strict";var bg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gd={exports:{}},ra={};var vg;function NA(){if(vg)return ra;vg=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,s,a){var c=null;if(a!==void 0&&(c=""+a),s.key!==void 0&&(c=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:t,type:r,key:c,ref:s!==void 0?s:null,props:a}}return ra.Fragment=e,ra.jsx=n,ra.jsxs=n,ra}var wg;function TA(){return wg||(wg=1,gd.exports=NA()),gd.exports}var p=TA(),yd={exports:{}},sa={},bd={exports:{}},xd={};var Sg;function jA(){return Sg||(Sg=1,(function(t){function e(L,Q){var oe=L.length;L.push(Q);e:for(;0<oe;){var ce=oe-1>>>1,ve=L[ce];if(0<s(ve,Q))L[ce]=Q,L[oe]=ve,oe=ce;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var Q=L[0],oe=L.pop();if(oe!==Q){L[0]=oe;e:for(var ce=0,ve=L.length,T=ve>>>1;ce<T;){var z=2*(ce+1)-1,he=L[z],ne=z+1,ke=L[ne];if(0>s(he,oe))ne<ve&&0>s(ke,he)?(L[ce]=ke,L[ne]=oe,ce=ne):(L[ce]=he,L[z]=oe,ce=z);else if(ne<ve&&0>s(ke,oe))L[ce]=ke,L[ne]=oe,ce=ne;else break e}}return Q}function s(L,Q){var oe=L.sortIndex-Q.sortIndex;return oe!==0?oe:L.id-Q.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var c=Date,u=c.now();t.unstable_now=function(){return c.now()-u}}var f=[],h=[],g=1,b=null,v=3,w=!1,A=!1,C=!1,j=!1,D=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,E=typeof setImmediate<"u"?setImmediate:null;function R(L){for(var Q=n(h);Q!==null;){if(Q.callback===null)r(h);else if(Q.startTime<=L)r(h),Q.sortIndex=Q.expirationTime,e(f,Q);else break;Q=n(h)}}function _(L){if(C=!1,R(L),!A)if(n(f)!==null)A=!0,q||(q=!0,W());else{var Q=n(h);Q!==null&&fe(_,Q.startTime-L)}}var q=!1,O=-1,X=5,U=-1;function B(){return j?!0:!(t.unstable_now()-U<X)}function K(){if(j=!1,q){var L=t.unstable_now();U=L;var Q=!0;try{e:{A=!1,C&&(C=!1,M(O),O=-1),w=!0;var oe=v;try{t:{for(R(L),b=n(f);b!==null&&!(b.expirationTime>L&&B());){var ce=b.callback;if(typeof ce=="function"){b.callback=null,v=b.priorityLevel;var ve=ce(b.expirationTime<=L);if(L=t.unstable_now(),typeof ve=="function"){b.callback=ve,R(L),Q=!0;break t}b===n(f)&&r(f),R(L)}else r(f);b=n(f)}if(b!==null)Q=!0;else{var T=n(h);T!==null&&fe(_,T.startTime-L),Q=!1}}break e}finally{b=null,v=oe,w=!1}Q=void 0}}finally{Q?W():q=!1}}}var W;if(typeof E=="function")W=function(){E(K)};else if(typeof MessageChannel<"u"){var ye=new MessageChannel,pe=ye.port2;ye.port1.onmessage=K,W=function(){pe.postMessage(null)}}else W=function(){D(K,0)};function fe(L,Q){O=D(function(){L(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<L?Math.floor(1e3/L):5},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_next=function(L){switch(v){case 1:case 2:case 3:var Q=3;break;default:Q=v}var oe=v;v=Q;try{return L()}finally{v=oe}},t.unstable_requestPaint=function(){j=!0},t.unstable_runWithPriority=function(L,Q){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var oe=v;v=L;try{return Q()}finally{v=oe}},t.unstable_scheduleCallback=function(L,Q,oe){var ce=t.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?ce+oe:ce):oe=ce,L){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=oe+ve,L={id:g++,callback:Q,priorityLevel:L,startTime:oe,expirationTime:ve,sortIndex:-1},oe>ce?(L.sortIndex=oe,e(h,L),n(f)===null&&L===n(h)&&(C?(M(O),O=-1):C=!0,fe(_,oe-ce))):(L.sortIndex=ve,e(f,L),A||w||(A=!0,q||(q=!0,W()))),L},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(L){var Q=v;return function(){var oe=v;v=Q;try{return L.apply(this,arguments)}finally{v=oe}}}})(xd)),xd}var Ag;function EA(){return Ag||(Ag=1,bd.exports=jA()),bd.exports}var vd={exports:{}},Ze={};var kg;function OA(){if(kg)return Ze;kg=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function w(T){return T===null||typeof T!="object"?null:(T=v&&T[v]||T["@@iterator"],typeof T=="function"?T:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,j={};function D(T,z,he){this.props=T,this.context=z,this.refs=j,this.updater=he||A}D.prototype.isReactComponent={},D.prototype.setState=function(T,z){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,z,"setState")},D.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function M(){}M.prototype=D.prototype;function E(T,z,he){this.props=T,this.context=z,this.refs=j,this.updater=he||A}var R=E.prototype=new M;R.constructor=E,C(R,D.prototype),R.isPureReactComponent=!0;var _=Array.isArray;function q(){}var O={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function U(T,z,he){var ne=he.ref;return{$$typeof:t,type:T,key:z,ref:ne!==void 0?ne:null,props:he}}function B(T,z){return U(T.type,z,T.props)}function K(T){return typeof T=="object"&&T!==null&&T.$$typeof===t}function W(T){var z={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(he){return z[he]})}var ye=/\/+/g;function pe(T,z){return typeof T=="object"&&T!==null&&T.key!=null?W(""+T.key):z.toString(36)}function fe(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(q,q):(T.status="pending",T.then(function(z){T.status==="pending"&&(T.status="fulfilled",T.value=z)},function(z){T.status==="pending"&&(T.status="rejected",T.reason=z)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function L(T,z,he,ne,ke){var qe=typeof T;(qe==="undefined"||qe==="boolean")&&(T=null);var $e=!1;if(T===null)$e=!0;else switch(qe){case"bigint":case"string":case"number":$e=!0;break;case"object":switch(T.$$typeof){case t:case e:$e=!0;break;case g:return $e=T._init,L($e(T._payload),z,he,ne,ke)}}if($e)return ke=ke(T),$e=ne===""?"."+pe(T,0):ne,_(ke)?(he="",$e!=null&&(he=$e.replace(ye,"$&/")+"/"),L(ke,z,he,"",function(Ie){return Ie})):ke!=null&&(K(ke)&&(ke=B(ke,he+(ke.key==null||T&&T.key===ke.key?"":(""+ke.key).replace(ye,"$&/")+"/")+$e)),z.push(ke)),1;$e=0;var Fe=ne===""?".":ne+":";if(_(T))for(var Ye=0;Ye<T.length;Ye++)ne=T[Ye],qe=Fe+pe(ne,Ye),$e+=L(ne,z,he,qe,ke);else if(Ye=w(T),typeof Ye=="function")for(T=Ye.call(T),Ye=0;!(ne=T.next()).done;)ne=ne.value,qe=Fe+pe(ne,Ye++),$e+=L(ne,z,he,qe,ke);else if(qe==="object"){if(typeof T.then=="function")return L(fe(T),z,he,ne,ke);throw z=String(T),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return $e}function Q(T,z,he){if(T==null)return T;var ne=[],ke=0;return L(T,ne,"","",function(qe){return z.call(he,qe,ke++)}),ne}function oe(T){if(T._status===-1){var z=T._result;z=z(),z.then(function(he){(T._status===0||T._status===-1)&&(T._status=1,T._result=he)},function(he){(T._status===0||T._status===-1)&&(T._status=2,T._result=he)}),T._status===-1&&(T._status=0,T._result=z)}if(T._status===1)return T._result.default;throw T._result}var ce=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},ve={map:Q,forEach:function(T,z,he){Q(T,function(){z.apply(this,arguments)},he)},count:function(T){var z=0;return Q(T,function(){z++}),z},toArray:function(T){return Q(T,function(z){return z})||[]},only:function(T){if(!K(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Ze.Activity=b,Ze.Children=ve,Ze.Component=D,Ze.Fragment=n,Ze.Profiler=s,Ze.PureComponent=E,Ze.StrictMode=r,Ze.Suspense=f,Ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Ze.__COMPILER_RUNTIME={__proto__:null,c:function(T){return O.H.useMemoCache(T)}},Ze.cache=function(T){return function(){return T.apply(null,arguments)}},Ze.cacheSignal=function(){return null},Ze.cloneElement=function(T,z,he){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var ne=C({},T.props),ke=T.key;if(z!=null)for(qe in z.key!==void 0&&(ke=""+z.key),z)!X.call(z,qe)||qe==="key"||qe==="__self"||qe==="__source"||qe==="ref"&&z.ref===void 0||(ne[qe]=z[qe]);var qe=arguments.length-2;if(qe===1)ne.children=he;else if(1<qe){for(var $e=Array(qe),Fe=0;Fe<qe;Fe++)$e[Fe]=arguments[Fe+2];ne.children=$e}return U(T.type,ke,ne)},Ze.createContext=function(T){return T={$$typeof:c,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:a,_context:T},T},Ze.createElement=function(T,z,he){var ne,ke={},qe=null;if(z!=null)for(ne in z.key!==void 0&&(qe=""+z.key),z)X.call(z,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ke[ne]=z[ne]);var $e=arguments.length-2;if($e===1)ke.children=he;else if(1<$e){for(var Fe=Array($e),Ye=0;Ye<$e;Ye++)Fe[Ye]=arguments[Ye+2];ke.children=Fe}if(T&&T.defaultProps)for(ne in $e=T.defaultProps,$e)ke[ne]===void 0&&(ke[ne]=$e[ne]);return U(T,qe,ke)},Ze.createRef=function(){return{current:null}},Ze.forwardRef=function(T){return{$$typeof:u,render:T}},Ze.isValidElement=K,Ze.lazy=function(T){return{$$typeof:g,_payload:{_status:-1,_result:T},_init:oe}},Ze.memo=function(T,z){return{$$typeof:h,type:T,compare:z===void 0?null:z}},Ze.startTransition=function(T){var z=O.T,he={};O.T=he;try{var ne=T(),ke=O.S;ke!==null&&ke(he,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(q,ce)}catch(qe){ce(qe)}finally{z!==null&&he.types!==null&&(z.types=he.types),O.T=z}},Ze.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Ze.use=function(T){return O.H.use(T)},Ze.useActionState=function(T,z,he){return O.H.useActionState(T,z,he)},Ze.useCallback=function(T,z){return O.H.useCallback(T,z)},Ze.useContext=function(T){return O.H.useContext(T)},Ze.useDebugValue=function(){},Ze.useDeferredValue=function(T,z){return O.H.useDeferredValue(T,z)},Ze.useEffect=function(T,z){return O.H.useEffect(T,z)},Ze.useEffectEvent=function(T){return O.H.useEffectEvent(T)},Ze.useId=function(){return O.H.useId()},Ze.useImperativeHandle=function(T,z,he){return O.H.useImperativeHandle(T,z,he)},Ze.useInsertionEffect=function(T,z){return O.H.useInsertionEffect(T,z)},Ze.useLayoutEffect=function(T,z){return O.H.useLayoutEffect(T,z)},Ze.useMemo=function(T,z){return O.H.useMemo(T,z)},Ze.useOptimistic=function(T,z){return O.H.useOptimistic(T,z)},Ze.useReducer=function(T,z,he){return O.H.useReducer(T,z,he)},Ze.useRef=function(T){return O.H.useRef(T)},Ze.useState=function(T){return O.H.useState(T)},Ze.useSyncExternalStore=function(T,z,he){return O.H.useSyncExternalStore(T,z,he)},Ze.useTransition=function(){return O.H.useTransition()},Ze.version="19.2.8",Ze}var Cg;function wd(){return Cg||(Cg=1,vd.exports=OA()),vd.exports}var Sd={exports:{}},xn={};var Ng;function MA(){if(Ng)return xn;Ng=1;var t=wd();function e(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(f,h,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:b==null?null:""+b,children:f,containerInfo:h,implementation:g}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return xn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,xn.createPortal=function(f,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return a(f,h,null,g)},xn.flushSync=function(f){var h=c.T,g=r.p;try{if(c.T=null,r.p=2,f)return f()}finally{c.T=h,r.p=g,r.d.f()}},xn.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(f,h))},xn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},xn.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var g=h.as,b=u(g,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?r.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:w}):g==="script"&&r.d.X(f,{crossOrigin:b,integrity:v,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},xn.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=u(h.as,h.crossOrigin);r.d.M(f,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(f)},xn.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,b=u(g,h.crossOrigin);r.d.L(f,g,{crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},xn.preloadModule=function(f,h){if(typeof f=="string")if(h){var g=u(h.as,h.crossOrigin);r.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(f)},xn.requestFormReset=function(f){r.d.r(f)},xn.unstable_batchedUpdates=function(f,h){return f(h)},xn.useFormState=function(f,h,g){return c.H.useFormState(f,h,g)},xn.useFormStatus=function(){return c.H.useHostTransitionStatus()},xn.version="19.2.8",xn}var Tg;function RA(){if(Tg)return Sd.exports;Tg=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Sd.exports=MA(),Sd.exports}var jg;function DA(){if(jg)return sa;jg=1;var t=EA(),e=wd(),n=RA();function r(i){var l="https://react.dev/errors/"+i;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)l+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+i+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function a(i){var l=i,o=i;if(i.alternate)for(;l.return;)l=l.return;else{i=l;do l=i,(l.flags&4098)!==0&&(o=l.return),i=l.return;while(i)}return l.tag===3?o:null}function c(i){if(i.tag===13){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function u(i){if(i.tag===31){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function f(i){if(a(i)!==i)throw Error(r(188))}function h(i){var l=i.alternate;if(!l){if(l=a(i),l===null)throw Error(r(188));return l!==i?null:i}for(var o=i,d=l;;){var m=o.return;if(m===null)break;var y=m.alternate;if(y===null){if(d=m.return,d!==null){o=d;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===o)return f(m),i;if(y===d)return f(m),l;y=y.sibling}throw Error(r(188))}if(o.return!==d.return)o=m,d=y;else{for(var S=!1,N=m.child;N;){if(N===o){S=!0,o=m,d=y;break}if(N===d){S=!0,d=m,o=y;break}N=N.sibling}if(!S){for(N=y.child;N;){if(N===o){S=!0,o=y,d=m;break}if(N===d){S=!0,d=y,o=m;break}N=N.sibling}if(!S)throw Error(r(189))}}if(o.alternate!==d)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?i:l}function g(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i;for(i=i.child;i!==null;){if(l=g(i),l!==null)return l;i=i.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),E=Symbol.for("react.context"),R=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function W(i){return i===null||typeof i!="object"?null:(i=K&&i[K]||i["@@iterator"],typeof i=="function"?i:null)}var ye=Symbol.for("react.client.reference");function pe(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===ye?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case C:return"Fragment";case D:return"Profiler";case j:return"StrictMode";case _:return"Suspense";case q:return"SuspenseList";case U:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case A:return"Portal";case E:return i.displayName||"Context";case M:return(i._context.displayName||"Context")+".Consumer";case R:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case O:return l=i.displayName||null,l!==null?l:pe(i.type)||"Memo";case X:l=i._payload,i=i._init;try{return pe(i(l))}catch{}}return null}var fe=Array.isArray,L=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},ce=[],ve=-1;function T(i){return{current:i}}function z(i){0>ve||(i.current=ce[ve],ce[ve]=null,ve--)}function he(i,l){ve++,ce[ve]=i.current,i.current=l}var ne=T(null),ke=T(null),qe=T(null),$e=T(null);function Fe(i,l){switch(he(qe,l),he(ke,i),he(ne,null),l.nodeType){case 9:case 11:i=(i=l.documentElement)&&(i=i.namespaceURI)?K2(i):0;break;default:if(i=l.tagName,l=l.namespaceURI)l=K2(l),i=G2(l,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}z(ne),he(ne,i)}function Ye(){z(ne),z(ke),z(qe)}function Ie(i){i.memoizedState!==null&&he($e,i);var l=ne.current,o=G2(l,i.type);l!==o&&(he(ke,i),he(ne,o))}function ut(i){ke.current===i&&(z(ne),z(ke)),$e.current===i&&(z($e),jo._currentValue=oe)}var Rt,Ce;function Oe(i){if(Rt===void 0)try{throw Error()}catch(o){var l=o.stack.trim().match(/\n( *(at )?)/);Rt=l&&l[1]||"",Ce=-1<o.stack.indexOf(`
|
|
1
|
+
var FlexDocStandaloneBundle=(function(ks){"use strict";var wg=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Sg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var gd={exports:{}},ra={};var Ag;function jA(){if(Ag)return ra;Ag=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,s,a){var c=null;if(a!==void 0&&(c=""+a),s.key!==void 0&&(c=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:t,type:r,key:c,ref:s!==void 0?s:null,props:a}}return ra.Fragment=e,ra.jsx=n,ra.jsxs=n,ra}var kg;function EA(){return kg||(kg=1,gd.exports=jA()),gd.exports}var p=EA(),yd={exports:{}},sa={},bd={exports:{}},xd={};var Cg;function OA(){return Cg||(Cg=1,(function(t){function e(L,Q){var oe=L.length;L.push(Q);e:for(;0<oe;){var ce=oe-1>>>1,ve=L[ce];if(0<s(ve,Q))L[ce]=Q,L[oe]=ve,oe=ce;else break e}}function n(L){return L.length===0?null:L[0]}function r(L){if(L.length===0)return null;var Q=L[0],oe=L.pop();if(oe!==Q){L[0]=oe;e:for(var ce=0,ve=L.length,T=ve>>>1;ce<T;){var z=2*(ce+1)-1,he=L[z],ne=z+1,ke=L[ne];if(0>s(he,oe))ne<ve&&0>s(ke,he)?(L[ce]=ke,L[ne]=oe,ce=ne):(L[ce]=he,L[z]=oe,ce=z);else if(ne<ve&&0>s(ke,oe))L[ce]=ke,L[ne]=oe,ce=ne;else break e}}return Q}function s(L,Q){var oe=L.sortIndex-Q.sortIndex;return oe!==0?oe:L.id-Q.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var c=Date,u=c.now();t.unstable_now=function(){return c.now()-u}}var f=[],h=[],g=1,b=null,v=3,w=!1,A=!1,C=!1,O=!1,D=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function M(L){for(var Q=n(h);Q!==null;){if(Q.callback===null)r(h);else if(Q.startTime<=L)r(h),Q.sortIndex=Q.expirationTime,e(f,Q);else break;Q=n(h)}}function _(L){if(C=!1,M(L),!A)if(n(f)!==null)A=!0,q||(q=!0,W());else{var Q=n(h);Q!==null&&fe(_,Q.startTime-L)}}var q=!1,R=-1,X=5,U=-1;function B(){return O?!0:!(t.unstable_now()-U<X)}function K(){if(O=!1,q){var L=t.unstable_now();U=L;var Q=!0;try{e:{A=!1,C&&(C=!1,E(R),R=-1),w=!0;var oe=v;try{t:{for(M(L),b=n(f);b!==null&&!(b.expirationTime>L&&B());){var ce=b.callback;if(typeof ce=="function"){b.callback=null,v=b.priorityLevel;var ve=ce(b.expirationTime<=L);if(L=t.unstable_now(),typeof ve=="function"){b.callback=ve,M(L),Q=!0;break t}b===n(f)&&r(f),M(L)}else r(f);b=n(f)}if(b!==null)Q=!0;else{var T=n(h);T!==null&&fe(_,T.startTime-L),Q=!1}}break e}finally{b=null,v=oe,w=!1}Q=void 0}}finally{Q?W():q=!1}}}var W;if(typeof j=="function")W=function(){j(K)};else if(typeof MessageChannel<"u"){var ye=new MessageChannel,pe=ye.port2;ye.port1.onmessage=K,W=function(){pe.postMessage(null)}}else W=function(){D(K,0)};function fe(L,Q){R=D(function(){L(t.unstable_now())},Q)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(L){L.callback=null},t.unstable_forceFrameRate=function(L){0>L||125<L?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<L?Math.floor(1e3/L):5},t.unstable_getCurrentPriorityLevel=function(){return v},t.unstable_next=function(L){switch(v){case 1:case 2:case 3:var Q=3;break;default:Q=v}var oe=v;v=Q;try{return L()}finally{v=oe}},t.unstable_requestPaint=function(){O=!0},t.unstable_runWithPriority=function(L,Q){switch(L){case 1:case 2:case 3:case 4:case 5:break;default:L=3}var oe=v;v=L;try{return Q()}finally{v=oe}},t.unstable_scheduleCallback=function(L,Q,oe){var ce=t.unstable_now();switch(typeof oe=="object"&&oe!==null?(oe=oe.delay,oe=typeof oe=="number"&&0<oe?ce+oe:ce):oe=ce,L){case 1:var ve=-1;break;case 2:ve=250;break;case 5:ve=1073741823;break;case 4:ve=1e4;break;default:ve=5e3}return ve=oe+ve,L={id:g++,callback:Q,priorityLevel:L,startTime:oe,expirationTime:ve,sortIndex:-1},oe>ce?(L.sortIndex=oe,e(h,L),n(f)===null&&L===n(h)&&(C?(E(R),R=-1):C=!0,fe(_,oe-ce))):(L.sortIndex=ve,e(f,L),A||w||(A=!0,q||(q=!0,W()))),L},t.unstable_shouldYield=B,t.unstable_wrapCallback=function(L){var Q=v;return function(){var oe=v;v=Q;try{return L.apply(this,arguments)}finally{v=oe}}}})(xd)),xd}var Ng;function MA(){return Ng||(Ng=1,bd.exports=OA()),bd.exports}var vd={exports:{}},Ze={};var Tg;function RA(){if(Tg)return Ze;Tg=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),g=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),v=Symbol.iterator;function w(T){return T===null||typeof T!="object"?null:(T=v&&T[v]||T["@@iterator"],typeof T=="function"?T:null)}var A={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,O={};function D(T,z,he){this.props=T,this.context=z,this.refs=O,this.updater=he||A}D.prototype.isReactComponent={},D.prototype.setState=function(T,z){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,z,"setState")},D.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function E(){}E.prototype=D.prototype;function j(T,z,he){this.props=T,this.context=z,this.refs=O,this.updater=he||A}var M=j.prototype=new E;M.constructor=j,C(M,D.prototype),M.isPureReactComponent=!0;var _=Array.isArray;function q(){}var R={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function U(T,z,he){var ne=he.ref;return{$$typeof:t,type:T,key:z,ref:ne!==void 0?ne:null,props:he}}function B(T,z){return U(T.type,z,T.props)}function K(T){return typeof T=="object"&&T!==null&&T.$$typeof===t}function W(T){var z={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(he){return z[he]})}var ye=/\/+/g;function pe(T,z){return typeof T=="object"&&T!==null&&T.key!=null?W(""+T.key):z.toString(36)}function fe(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(q,q):(T.status="pending",T.then(function(z){T.status==="pending"&&(T.status="fulfilled",T.value=z)},function(z){T.status==="pending"&&(T.status="rejected",T.reason=z)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function L(T,z,he,ne,ke){var qe=typeof T;(qe==="undefined"||qe==="boolean")&&(T=null);var $e=!1;if(T===null)$e=!0;else switch(qe){case"bigint":case"string":case"number":$e=!0;break;case"object":switch(T.$$typeof){case t:case e:$e=!0;break;case g:return $e=T._init,L($e(T._payload),z,he,ne,ke)}}if($e)return ke=ke(T),$e=ne===""?"."+pe(T,0):ne,_(ke)?(he="",$e!=null&&(he=$e.replace(ye,"$&/")+"/"),L(ke,z,he,"",function(Ie){return Ie})):ke!=null&&(K(ke)&&(ke=B(ke,he+(ke.key==null||T&&T.key===ke.key?"":(""+ke.key).replace(ye,"$&/")+"/")+$e)),z.push(ke)),1;$e=0;var Fe=ne===""?".":ne+":";if(_(T))for(var Ye=0;Ye<T.length;Ye++)ne=T[Ye],qe=Fe+pe(ne,Ye),$e+=L(ne,z,he,qe,ke);else if(Ye=w(T),typeof Ye=="function")for(T=Ye.call(T),Ye=0;!(ne=T.next()).done;)ne=ne.value,qe=Fe+pe(ne,Ye++),$e+=L(ne,z,he,qe,ke);else if(qe==="object"){if(typeof T.then=="function")return L(fe(T),z,he,ne,ke);throw z=String(T),Error("Objects are not valid as a React child (found: "+(z==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":z)+"). If you meant to render a collection of children, use an array instead.")}return $e}function Q(T,z,he){if(T==null)return T;var ne=[],ke=0;return L(T,ne,"","",function(qe){return z.call(he,qe,ke++)}),ne}function oe(T){if(T._status===-1){var z=T._result;z=z(),z.then(function(he){(T._status===0||T._status===-1)&&(T._status=1,T._result=he)},function(he){(T._status===0||T._status===-1)&&(T._status=2,T._result=he)}),T._status===-1&&(T._status=0,T._result=z)}if(T._status===1)return T._result.default;throw T._result}var ce=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var z=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(z))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},ve={map:Q,forEach:function(T,z,he){Q(T,function(){z.apply(this,arguments)},he)},count:function(T){var z=0;return Q(T,function(){z++}),z},toArray:function(T){return Q(T,function(z){return z})||[]},only:function(T){if(!K(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return Ze.Activity=b,Ze.Children=ve,Ze.Component=D,Ze.Fragment=n,Ze.Profiler=s,Ze.PureComponent=j,Ze.StrictMode=r,Ze.Suspense=f,Ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=R,Ze.__COMPILER_RUNTIME={__proto__:null,c:function(T){return R.H.useMemoCache(T)}},Ze.cache=function(T){return function(){return T.apply(null,arguments)}},Ze.cacheSignal=function(){return null},Ze.cloneElement=function(T,z,he){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var ne=C({},T.props),ke=T.key;if(z!=null)for(qe in z.key!==void 0&&(ke=""+z.key),z)!X.call(z,qe)||qe==="key"||qe==="__self"||qe==="__source"||qe==="ref"&&z.ref===void 0||(ne[qe]=z[qe]);var qe=arguments.length-2;if(qe===1)ne.children=he;else if(1<qe){for(var $e=Array(qe),Fe=0;Fe<qe;Fe++)$e[Fe]=arguments[Fe+2];ne.children=$e}return U(T.type,ke,ne)},Ze.createContext=function(T){return T={$$typeof:c,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:a,_context:T},T},Ze.createElement=function(T,z,he){var ne,ke={},qe=null;if(z!=null)for(ne in z.key!==void 0&&(qe=""+z.key),z)X.call(z,ne)&&ne!=="key"&&ne!=="__self"&&ne!=="__source"&&(ke[ne]=z[ne]);var $e=arguments.length-2;if($e===1)ke.children=he;else if(1<$e){for(var Fe=Array($e),Ye=0;Ye<$e;Ye++)Fe[Ye]=arguments[Ye+2];ke.children=Fe}if(T&&T.defaultProps)for(ne in $e=T.defaultProps,$e)ke[ne]===void 0&&(ke[ne]=$e[ne]);return U(T,qe,ke)},Ze.createRef=function(){return{current:null}},Ze.forwardRef=function(T){return{$$typeof:u,render:T}},Ze.isValidElement=K,Ze.lazy=function(T){return{$$typeof:g,_payload:{_status:-1,_result:T},_init:oe}},Ze.memo=function(T,z){return{$$typeof:h,type:T,compare:z===void 0?null:z}},Ze.startTransition=function(T){var z=R.T,he={};R.T=he;try{var ne=T(),ke=R.S;ke!==null&&ke(he,ne),typeof ne=="object"&&ne!==null&&typeof ne.then=="function"&&ne.then(q,ce)}catch(qe){ce(qe)}finally{z!==null&&he.types!==null&&(z.types=he.types),R.T=z}},Ze.unstable_useCacheRefresh=function(){return R.H.useCacheRefresh()},Ze.use=function(T){return R.H.use(T)},Ze.useActionState=function(T,z,he){return R.H.useActionState(T,z,he)},Ze.useCallback=function(T,z){return R.H.useCallback(T,z)},Ze.useContext=function(T){return R.H.useContext(T)},Ze.useDebugValue=function(){},Ze.useDeferredValue=function(T,z){return R.H.useDeferredValue(T,z)},Ze.useEffect=function(T,z){return R.H.useEffect(T,z)},Ze.useEffectEvent=function(T){return R.H.useEffectEvent(T)},Ze.useId=function(){return R.H.useId()},Ze.useImperativeHandle=function(T,z,he){return R.H.useImperativeHandle(T,z,he)},Ze.useInsertionEffect=function(T,z){return R.H.useInsertionEffect(T,z)},Ze.useLayoutEffect=function(T,z){return R.H.useLayoutEffect(T,z)},Ze.useMemo=function(T,z){return R.H.useMemo(T,z)},Ze.useOptimistic=function(T,z){return R.H.useOptimistic(T,z)},Ze.useReducer=function(T,z,he){return R.H.useReducer(T,z,he)},Ze.useRef=function(T){return R.H.useRef(T)},Ze.useState=function(T){return R.H.useState(T)},Ze.useSyncExternalStore=function(T,z,he){return R.H.useSyncExternalStore(T,z,he)},Ze.useTransition=function(){return R.H.useTransition()},Ze.version="19.2.8",Ze}var jg;function wd(){return jg||(jg=1,vd.exports=RA()),vd.exports}var Sd={exports:{}},xn={};var Eg;function DA(){if(Eg)return xn;Eg=1;var t=wd();function e(f){var h="https://react.dev/errors/"+f;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var g=2;g<arguments.length;g++)h+="&args[]="+encodeURIComponent(arguments[g])}return"Minified React error #"+f+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(f,h,g){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:b==null?null:""+b,children:f,containerInfo:h,implementation:g}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,h){if(f==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return xn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,xn.createPortal=function(f,h){var g=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return a(f,h,null,g)},xn.flushSync=function(f){var h=c.T,g=r.p;try{if(c.T=null,r.p=2,f)return f()}finally{c.T=h,r.p=g,r.d.f()}},xn.preconnect=function(f,h){typeof f=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,r.d.C(f,h))},xn.prefetchDNS=function(f){typeof f=="string"&&r.d.D(f)},xn.preinit=function(f,h){if(typeof f=="string"&&h&&typeof h.as=="string"){var g=h.as,b=u(g,h.crossOrigin),v=typeof h.integrity=="string"?h.integrity:void 0,w=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;g==="style"?r.d.S(f,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:w}):g==="script"&&r.d.X(f,{crossOrigin:b,integrity:v,fetchPriority:w,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},xn.preinitModule=function(f,h){if(typeof f=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var g=u(h.as,h.crossOrigin);r.d.M(f,{crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&r.d.M(f)},xn.preload=function(f,h){if(typeof f=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var g=h.as,b=u(g,h.crossOrigin);r.d.L(f,g,{crossOrigin:b,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},xn.preloadModule=function(f,h){if(typeof f=="string")if(h){var g=u(h.as,h.crossOrigin);r.d.m(f,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:g,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else r.d.m(f)},xn.requestFormReset=function(f){r.d.r(f)},xn.unstable_batchedUpdates=function(f,h){return f(h)},xn.useFormState=function(f,h,g){return c.H.useFormState(f,h,g)},xn.useFormStatus=function(){return c.H.useHostTransitionStatus()},xn.version="19.2.8",xn}var Og;function _A(){if(Og)return Sd.exports;Og=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Sd.exports=DA(),Sd.exports}var Mg;function LA(){if(Mg)return sa;Mg=1;var t=MA(),e=wd(),n=_A();function r(i){var l="https://react.dev/errors/"+i;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var o=2;o<arguments.length;o++)l+="&args[]="+encodeURIComponent(arguments[o])}return"Minified React error #"+i+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function a(i){var l=i,o=i;if(i.alternate)for(;l.return;)l=l.return;else{i=l;do l=i,(l.flags&4098)!==0&&(o=l.return),i=l.return;while(i)}return l.tag===3?o:null}function c(i){if(i.tag===13){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function u(i){if(i.tag===31){var l=i.memoizedState;if(l===null&&(i=i.alternate,i!==null&&(l=i.memoizedState)),l!==null)return l.dehydrated}return null}function f(i){if(a(i)!==i)throw Error(r(188))}function h(i){var l=i.alternate;if(!l){if(l=a(i),l===null)throw Error(r(188));return l!==i?null:i}for(var o=i,d=l;;){var m=o.return;if(m===null)break;var y=m.alternate;if(y===null){if(d=m.return,d!==null){o=d;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===o)return f(m),i;if(y===d)return f(m),l;y=y.sibling}throw Error(r(188))}if(o.return!==d.return)o=m,d=y;else{for(var S=!1,N=m.child;N;){if(N===o){S=!0,o=m,d=y;break}if(N===d){S=!0,d=m,o=y;break}N=N.sibling}if(!S){for(N=y.child;N;){if(N===o){S=!0,o=y,d=m;break}if(N===d){S=!0,d=y,o=m;break}N=N.sibling}if(!S)throw Error(r(189))}}if(o.alternate!==d)throw Error(r(190))}if(o.tag!==3)throw Error(r(188));return o.stateNode.current===o?i:l}function g(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i;for(i=i.child;i!==null;){if(l=g(i),l!==null)return l;i=i.sibling}return null}var b=Object.assign,v=Symbol.for("react.element"),w=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),O=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),E=Symbol.for("react.consumer"),j=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),_=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),R=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),B=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function W(i){return i===null||typeof i!="object"?null:(i=K&&i[K]||i["@@iterator"],typeof i=="function"?i:null)}var ye=Symbol.for("react.client.reference");function pe(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===ye?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case C:return"Fragment";case D:return"Profiler";case O:return"StrictMode";case _:return"Suspense";case q:return"SuspenseList";case U:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case A:return"Portal";case j:return i.displayName||"Context";case E:return(i._context.displayName||"Context")+".Consumer";case M:var l=i.render;return i=i.displayName,i||(i=l.displayName||l.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case R:return l=i.displayName||null,l!==null?l:pe(i.type)||"Memo";case X:l=i._payload,i=i._init;try{return pe(i(l))}catch{}}return null}var fe=Array.isArray,L=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,oe={pending:!1,data:null,method:null,action:null},ce=[],ve=-1;function T(i){return{current:i}}function z(i){0>ve||(i.current=ce[ve],ce[ve]=null,ve--)}function he(i,l){ve++,ce[ve]=i.current,i.current=l}var ne=T(null),ke=T(null),qe=T(null),$e=T(null);function Fe(i,l){switch(he(qe,l),he(ke,i),he(ne,null),l.nodeType){case 9:case 11:i=(i=l.documentElement)&&(i=i.namespaceURI)?X2(i):0;break;default:if(i=l.tagName,l=l.namespaceURI)l=X2(l),i=J2(l,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}z(ne),he(ne,i)}function Ye(){z(ne),z(ke),z(qe)}function Ie(i){i.memoizedState!==null&&he($e,i);var l=ne.current,o=J2(l,i.type);l!==o&&(he(ke,i),he(ne,o))}function ut(i){ke.current===i&&(z(ne),z(ke)),$e.current===i&&(z($e),jo._currentValue=oe)}var Rt,Ce;function Oe(i){if(Rt===void 0)try{throw Error()}catch(o){var l=o.stack.trim().match(/\n( *(at )?)/);Rt=l&&l[1]||"",Ce=-1<o.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<o.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+Rt+i+Ce}var G=!1;function we(i,l){if(!i||G)return"";G=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(l){var be=function(){throw Error()};if(Object.defineProperty(be.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(be,[])}catch(le){var ie=le}Reflect.construct(i,[],be)}else{try{be.call()}catch(le){ie=le}i.call(be.prototype)}}else{try{throw Error()}catch(le){ie=le}(be=i())&&typeof be.catch=="function"&&be.catch(function(){})}}catch(le){if(le&&ie&&typeof le.stack=="string")return[le.stack,ie.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=d.DetermineComponentFrameRoot(),S=y[0],N=y[1];if(S&&N){var $=S.split(`
|
|
4
4
|
`),te=N.split(`
|
|
5
5
|
`);for(m=d=0;d<$.length&&!$[d].includes("DetermineComponentFrameRoot");)d++;for(;m<te.length&&!te[m].includes("DetermineComponentFrameRoot");)m++;if(d===$.length||m===te.length)for(d=$.length-1,m=te.length-1;1<=d&&0<=m&&$[d]!==te[m];)m--;for(;1<=d&&0<=m;d--,m--)if($[d]!==te[m]){if(d!==1||m!==1)do if(d--,m--,0>m||$[d]!==te[m]){var de=`
|
|
6
6
|
`+$[d].replace(" at new "," at ");return i.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",i.displayName)),de}while(1<=d&&0<=m);break}}}finally{G=!1,Error.prepareStackTrace=o}return(o=i?i.displayName||i.name:"")?Oe(o):""}function Ne(i,l){switch(i.tag){case 26:case 27:case 5:return Oe(i.type);case 16:return Oe("Lazy");case 13:return i.child!==l&&l!==null?Oe("Suspense Fallback"):Oe("Suspense");case 19:return Oe("SuspenseList");case 0:case 15:return we(i.type,!1);case 11:return we(i.type.render,!1);case 1:return we(i.type,!0);case 31:return Oe("Activity");default:return""}}function De(i){try{var l="",o=null;do l+=Ne(i,o),o=i,i=i.return;while(i);return l}catch(d){return`
|
|
7
7
|
Error generating stack: `+d.message+`
|
|
8
|
-
`+d.stack}}var Ke=Object.prototype.hasOwnProperty,st=t.unstable_scheduleCallback,Et=t.unstable_cancelCallback,Zn=t.unstable_shouldYield,Nn=t.unstable_requestPaint,ht=t.unstable_now,_n=t.unstable_getCurrentPriorityLevel,Tn=t.unstable_ImmediatePriority,ei=t.unstable_UserBlockingPriority,kt=t.unstable_NormalPriority,x=t.unstable_LowPriority,V=t.unstable_IdlePriority,me=t.log,ae=t.unstable_setDisableYieldValue,J=null,k=null;function Y(i){if(typeof me=="function"&&ae(i),k&&typeof k.setStrictMode=="function")try{k.setStrictMode(J,i)}catch{}}var Z=Math.clz32?Math.clz32:ue,xe=Math.log,F=Math.LN2;function ue(i){return i>>>=0,i===0?32:31-(xe(i)/F|0)|0}var re=256,Se=262144,Me=4194304;function je(i){var l=i&42;if(l!==0)return l;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function _e(i,l,o){var d=i.pendingLanes;if(d===0)return 0;var m=0,y=i.suspendedLanes,S=i.pingedLanes;i=i.warmLanes;var N=d&134217727;return N!==0?(d=N&~y,d!==0?m=je(d):(S&=N,S!==0?m=je(S):o||(o=N&~i,o!==0&&(m=je(o))))):(N=d&~y,N!==0?m=je(N):S!==0?m=je(S):o||(o=d&~i,o!==0&&(m=je(o)))),m===0?0:l!==0&&l!==m&&(l&y)===0&&(y=m&-m,o=l&-l,y>=o||y===32&&(o&4194048)!==0)?l:m}function ze(i,l){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&l)===0}function Qe(i,l){switch(i){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pn(){var i=Me;return Me<<=1,(Me&62914560)===0&&(Me=4194304),i}function Un(i){for(var l=[],o=0;31>o;o++)l.push(i);return l}function jn(i,l){i.pendingLanes|=l,l!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function nu(i,l,o,d,m,y){var S=i.pendingLanes;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=o,i.entangledLanes&=o,i.errorRecoveryDisabledLanes&=o,i.shellSuspendCounter=0;var N=i.entanglements,$=i.expirationTimes,te=i.hiddenUpdates;for(o=S&~o;0<o;){var de=31-Z(o),be=1<<de;N[de]=0,$[de]=-1;var ie=te[de];if(ie!==null)for(te[de]=null,de=0;de<ie.length;de++){var le=ie[de];le!==null&&(le.lane&=-536870913)}o&=~be}d!==0&&Wr(i,d,0),y!==0&&m===0&&i.tag!==0&&(i.suspendedLanes|=y&~(S&~l))}function Wr(i,l,o){i.pendingLanes|=l,i.suspendedLanes&=~l;var d=31-Z(l);i.entangledLanes|=l,i.entanglements[d]=i.entanglements[d]|1073741824|o&261930}function yi(i,l){var o=i.entangledLanes|=l;for(i=i.entanglements;o;){var d=31-Z(o),m=1<<d;m&l|i[d]&l&&(i[d]|=l),o&=~m}}function Ee(i,l){var o=l&-l;return o=(o&42)!==0?1:We(o),(o&(i.suspendedLanes|l))!==0?0:o}function We(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Vt(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Ln(){var i=Q.p;return i!==0?i:(i=window.event,i===void 0?32:yA(i.type))}function bi(i,l){var o=Q.p;try{return Q.p=i,l()}finally{Q.p=o}}var qn=Math.random().toString(36).slice(2),Ft="__reactFiber$"+qn,Kt="__reactProps$"+qn,Vn="__reactContainer$"+qn,ur="__reactEvents$"+qn,Bs="__reactListeners$"+qn,Li="__reactHandles$"+qn,za="__reactResources$"+qn,Zr="__reactMarker$"+qn;function kl(i){delete i[Ft],delete i[Kt],delete i[ur],delete i[Bs],delete i[Li]}function dr(i){var l=i[Ft];if(l)return l;for(var o=i.parentNode;o;){if(l=o[Vn]||o[Ft]){if(o=l.alternate,l.child!==null||o!==null&&o.child!==null)for(i=tA(i);i!==null;){if(o=i[Ft])return o;i=tA(i)}return l}i=o,o=i.parentNode}return null}function es(i){if(i=i[Ft]||i[Vn]){var l=i.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return i}return null}function fr(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i.stateNode;throw Error(r(33))}function hr(i){var l=i[za];return l||(l=i[za]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Gt(i){i[Zr]=!0}var iu=new Set,Ua={};function se(i,l){Le(i,l),Le(i+"Capture",l)}function Le(i,l){for(Ua[i]=l,i=0;i<l.length;i++)iu.add(l[i])}var tt=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),qi={},ti={};function Va(i){return Ke.call(ti,i)?!0:Ke.call(qi,i)?!1:tt.test(i)?ti[i]=!0:(qi[i]=!0,!1)}function ru(i,l,o){if(Va(l))if(o===null)i.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":i.removeAttribute(l);return;case"boolean":var d=l.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){i.removeAttribute(l);return}}i.setAttribute(l,""+o)}}function su(i,l,o){if(o===null)i.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttribute(l,""+o)}}function pr(i,l,o,d){if(d===null)i.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(o);return}i.setAttributeNS(l,o,""+d)}}function xi(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function I1(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function FM(i,l,o){var d=Object.getOwnPropertyDescriptor(i.constructor.prototype,l);if(!i.hasOwnProperty(l)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,y=d.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return m.call(this)},set:function(S){o=""+S,y.call(this,S)}}),Object.defineProperty(i,l,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(S){o=""+S},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function dp(i){if(!i._valueTracker){var l=I1(i)?"checked":"value";i._valueTracker=FM(i,l,""+i[l])}}function H1(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var o=l.getValue(),d="";return i&&(d=I1(i)?i.checked?"true":"false":i.value),i=d,i!==o?(l.setValue(i),!0):!1}function lu(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}}var PM=/[\n"\\]/g;function vi(i){return i.replace(PM,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function fp(i,l,o,d,m,y,S,N){i.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?i.type=S:i.removeAttribute("type"),l!=null?S==="number"?(l===0&&i.value===""||i.value!=l)&&(i.value=""+xi(l)):i.value!==""+xi(l)&&(i.value=""+xi(l)):S!=="submit"&&S!=="reset"||i.removeAttribute("value"),l!=null?hp(i,S,xi(l)):o!=null?hp(i,S,xi(o)):d!=null&&i.removeAttribute("value"),m==null&&y!=null&&(i.defaultChecked=!!y),m!=null&&(i.checked=m&&typeof m!="function"&&typeof m!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?i.name=""+xi(N):i.removeAttribute("name")}function z1(i,l,o,d,m,y,S,N){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(i.type=y),l!=null||o!=null){if(!(y!=="submit"&&y!=="reset"||l!=null)){dp(i);return}o=o!=null?""+xi(o):"",l=l!=null?""+xi(l):o,N||l===i.value||(i.value=l),i.defaultValue=l}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,i.checked=N?i.checked:!!d,i.defaultChecked=!!d,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(i.name=S),dp(i)}function hp(i,l,o){l==="number"&&lu(i.ownerDocument)===i||i.defaultValue===""+o||(i.defaultValue=""+o)}function Cl(i,l,o,d){if(i=i.options,l){l={};for(var m=0;m<o.length;m++)l["$"+o[m]]=!0;for(o=0;o<i.length;o++)m=l.hasOwnProperty("$"+i[o].value),i[o].selected!==m&&(i[o].selected=m),m&&d&&(i[o].defaultSelected=!0)}else{for(o=""+xi(o),l=null,m=0;m<i.length;m++){if(i[m].value===o){i[m].selected=!0,d&&(i[m].defaultSelected=!0);return}l!==null||i[m].disabled||(l=i[m])}l!==null&&(l.selected=!0)}}function U1(i,l,o){if(l!=null&&(l=""+xi(l),l!==i.value&&(i.value=l),o==null)){i.defaultValue!==l&&(i.defaultValue=l);return}i.defaultValue=o!=null?""+xi(o):""}function V1(i,l,o,d){if(l==null){if(d!=null){if(o!=null)throw Error(r(92));if(fe(d)){if(1<d.length)throw Error(r(93));d=d[0]}o=d}o==null&&(o=""),l=o}o=xi(l),i.defaultValue=o,d=i.textContent,d===o&&d!==""&&d!==null&&(i.value=d),dp(i)}function Nl(i,l){if(l){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=l;return}}i.textContent=l}var YM=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function F1(i,l,o){var d=l.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="":d?i.setProperty(l,o):typeof o!="number"||o===0||YM.has(l)?l==="float"?i.cssFloat=o:i[l]=(""+o).trim():i[l]=o+"px"}function P1(i,l,o){if(l!=null&&typeof l!="object")throw Error(r(62));if(i=i.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||l!=null&&l.hasOwnProperty(d)||(d.indexOf("--")===0?i.setProperty(d,""):d==="float"?i.cssFloat="":i[d]="");for(var m in l)d=l[m],l.hasOwnProperty(m)&&o[m]!==d&&F1(i,m,d)}else for(var y in l)l.hasOwnProperty(y)&&F1(i,y,l[y])}function pp(i){if(i.indexOf("-")===-1)return!1;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 KM=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),GM=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function au(i){return GM.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function mr(){}var mp=null;function gp(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Tl=null,jl=null;function Y1(i){var l=es(i);if(l&&(i=l.stateNode)){var o=i[Kt]||null;e:switch(i=l.stateNode,l.type){case"input":if(fp(i,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),l=o.name,o.type==="radio"&&l!=null){for(o=i;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+vi(""+l)+'"][type="radio"]'),l=0;l<o.length;l++){var d=o[l];if(d!==i&&d.form===i.form){var m=d[Kt]||null;if(!m)throw Error(r(90));fp(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(l=0;l<o.length;l++)d=o[l],d.form===i.form&&H1(d)}break e;case"textarea":U1(i,o.value,o.defaultValue);break e;case"select":l=o.value,l!=null&&Cl(i,!!o.multiple,l,!1)}}}var yp=!1;function K1(i,l,o){if(yp)return i(l,o);yp=!0;try{var d=i(l);return d}finally{if(yp=!1,(Tl!==null||jl!==null)&&(Gu(),Tl&&(l=Tl,i=jl,jl=Tl=null,Y1(l),i)))for(l=0;l<i.length;l++)Y1(i[l])}}function Fa(i,l){var o=i.stateNode;if(o===null)return null;var d=o[Kt]||null;if(d===null)return null;o=d[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(i=i.type,d=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!d;break e;default:i=!1}if(i)return null;if(o&&typeof o!="function")throw Error(r(231,l,typeof o));return o}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),bp=!1;if(gr)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){bp=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{bp=!1}var ts=null,xp=null,ou=null;function G1(){if(ou)return ou;var i,l=xp,o=l.length,d,m="value"in ts?ts.value:ts.textContent,y=m.length;for(i=0;i<o&&l[i]===m[i];i++);var S=o-i;for(d=1;d<=S&&l[o-d]===m[y-d];d++);return ou=m.slice(i,1<d?1-d:void 0)}function cu(i){var l=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&l===13&&(i=13)):i=l,i===10&&(i=13),32<=i||i===13?i:0}function uu(){return!0}function X1(){return!1}function Fn(i){function l(o,d,m,y,S){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=y,this.target=S,this.currentTarget=null;for(var N in i)i.hasOwnProperty(N)&&(o=i[N],this[N]=o?o(y):y[N]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?uu:X1,this.isPropagationStopped=X1,this}return b(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=uu)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=uu)},persist:function(){},isPersistent:uu}),l}var $s={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},du=Fn($s),Ya=b({},$s,{view:0,detail:0}),XM=Fn(Ya),vp,wp,Ka,fu=b({},Ya,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ap,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!==Ka&&(Ka&&i.type==="mousemove"?(vp=i.screenX-Ka.screenX,wp=i.screenY-Ka.screenY):wp=vp=0,Ka=i),vp)},movementY:function(i){return"movementY"in i?i.movementY:wp}}),J1=Fn(fu),JM=b({},fu,{dataTransfer:0}),QM=Fn(JM),WM=b({},Ya,{relatedTarget:0}),Sp=Fn(WM),ZM=b({},$s,{animationName:0,elapsedTime:0,pseudoElement:0}),eR=Fn(ZM),tR=b({},$s,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),nR=Fn(tR),iR=b({},$s,{data:0}),Q1=Fn(iR),rR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},sR={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"},lR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function aR(i){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(i):(i=lR[i])?!!l[i]:!1}function Ap(){return aR}var oR=b({},Ya,{key:function(i){if(i.key){var l=rR[i.key]||i.key;if(l!=="Unidentified")return l}return i.type==="keypress"?(i=cu(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?sR[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ap,charCode:function(i){return i.type==="keypress"?cu(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?cu(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),cR=Fn(oR),uR=b({},fu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),W1=Fn(uR),dR=b({},Ya,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ap}),fR=Fn(dR),hR=b({},$s,{propertyName:0,elapsedTime:0,pseudoElement:0}),pR=Fn(hR),mR=b({},fu,{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}),gR=Fn(mR),yR=b({},$s,{newState:0,oldState:0}),bR=Fn(yR),xR=[9,13,27,32],kp=gr&&"CompositionEvent"in window,Ga=null;gr&&"documentMode"in document&&(Ga=document.documentMode);var vR=gr&&"TextEvent"in window&&!Ga,Z1=gr&&(!kp||Ga&&8<Ga&&11>=Ga),ew=" ",tw=!1;function nw(i,l){switch(i){case"keyup":return xR.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function iw(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var El=!1;function wR(i,l){switch(i){case"compositionend":return iw(l);case"keypress":return l.which!==32?null:(tw=!0,ew);case"textInput":return i=l.data,i===ew&&tw?null:i;default:return null}}function SR(i,l){if(El)return i==="compositionend"||!kp&&nw(i,l)?(i=G1(),ou=xp=ts=null,El=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return Z1&&l.locale!=="ko"?null:l.data;default:return null}}var AR={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 rw(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l==="input"?!!AR[i.type]:l==="textarea"}function sw(i,l,o,d){Tl?jl?jl.push(d):jl=[d]:Tl=d,l=td(l,"onChange"),0<l.length&&(o=new du("onChange","change",null,o,d),i.push({event:o,listeners:l}))}var Xa=null,Ja=null;function kR(i){z2(i,0)}function hu(i){var l=fr(i);if(H1(l))return i}function lw(i,l){if(i==="change")return l}var aw=!1;if(gr){var Cp;if(gr){var Np="oninput"in document;if(!Np){var ow=document.createElement("div");ow.setAttribute("oninput","return;"),Np=typeof ow.oninput=="function"}Cp=Np}else Cp=!1;aw=Cp&&(!document.documentMode||9<document.documentMode)}function cw(){Xa&&(Xa.detachEvent("onpropertychange",uw),Ja=Xa=null)}function uw(i){if(i.propertyName==="value"&&hu(Ja)){var l=[];sw(l,Ja,i,gp(i)),K1(kR,l)}}function CR(i,l,o){i==="focusin"?(cw(),Xa=l,Ja=o,Xa.attachEvent("onpropertychange",uw)):i==="focusout"&&cw()}function NR(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return hu(Ja)}function TR(i,l){if(i==="click")return hu(l)}function jR(i,l){if(i==="input"||i==="change")return hu(l)}function ER(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var ni=typeof Object.is=="function"?Object.is:ER;function Qa(i,l){if(ni(i,l))return!0;if(typeof i!="object"||i===null||typeof l!="object"||l===null)return!1;var o=Object.keys(i),d=Object.keys(l);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!Ke.call(l,m)||!ni(i[m],l[m]))return!1}return!0}function dw(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function fw(i,l){var o=dw(i);i=0;for(var d;o;){if(o.nodeType===3){if(d=i+o.textContent.length,i<=l&&d>=l)return{node:o,offset:l-i};i=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=dw(o)}}function hw(i,l){return i&&l?i===l?!0:i&&i.nodeType===3?!1:l&&l.nodeType===3?hw(i,l.parentNode):"contains"in i?i.contains(l):i.compareDocumentPosition?!!(i.compareDocumentPosition(l)&16):!1:!1}function pw(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var l=lu(i.document);l instanceof i.HTMLIFrameElement;){try{var o=typeof l.contentWindow.location.href=="string"}catch{o=!1}if(o)i=l.contentWindow;else break;l=lu(i.document)}return l}function Tp(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l&&(l==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||l==="textarea"||i.contentEditable==="true")}var OR=gr&&"documentMode"in document&&11>=document.documentMode,Ol=null,jp=null,Wa=null,Ep=!1;function mw(i,l,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Ep||Ol==null||Ol!==lu(d)||(d=Ol,"selectionStart"in d&&Tp(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Wa&&Qa(Wa,d)||(Wa=d,d=td(jp,"onSelect"),0<d.length&&(l=new du("onSelect","select",null,l,o),i.push({event:l,listeners:d}),l.target=Ol)))}function Is(i,l){var o={};return o[i.toLowerCase()]=l.toLowerCase(),o["Webkit"+i]="webkit"+l,o["Moz"+i]="moz"+l,o}var Ml={animationend:Is("Animation","AnimationEnd"),animationiteration:Is("Animation","AnimationIteration"),animationstart:Is("Animation","AnimationStart"),transitionrun:Is("Transition","TransitionRun"),transitionstart:Is("Transition","TransitionStart"),transitioncancel:Is("Transition","TransitionCancel"),transitionend:Is("Transition","TransitionEnd")},Op={},gw={};gr&&(gw=document.createElement("div").style,"AnimationEvent"in window||(delete Ml.animationend.animation,delete Ml.animationiteration.animation,delete Ml.animationstart.animation),"TransitionEvent"in window||delete Ml.transitionend.transition);function Hs(i){if(Op[i])return Op[i];if(!Ml[i])return i;var l=Ml[i],o;for(o in l)if(l.hasOwnProperty(o)&&o in gw)return Op[i]=l[o];return i}var yw=Hs("animationend"),bw=Hs("animationiteration"),xw=Hs("animationstart"),MR=Hs("transitionrun"),RR=Hs("transitionstart"),DR=Hs("transitioncancel"),vw=Hs("transitionend"),ww=new Map,Mp="abort auxClick beforeToggle 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(" ");Mp.push("scrollEnd");function Bi(i,l){ww.set(i,l),se(l,[i])}var pu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},wi=[],Rl=0,Rp=0;function mu(){for(var i=Rl,l=Rp=Rl=0;l<i;){var o=wi[l];wi[l++]=null;var d=wi[l];wi[l++]=null;var m=wi[l];wi[l++]=null;var y=wi[l];if(wi[l++]=null,d!==null&&m!==null){var S=d.pending;S===null?m.next=m:(m.next=S.next,S.next=m),d.pending=m}y!==0&&Sw(o,m,y)}}function gu(i,l,o,d){wi[Rl++]=i,wi[Rl++]=l,wi[Rl++]=o,wi[Rl++]=d,Rp|=d,i.lanes|=d,i=i.alternate,i!==null&&(i.lanes|=d)}function Dp(i,l,o,d){return gu(i,l,o,d),yu(i)}function zs(i,l){return gu(i,null,null,l),yu(i)}function Sw(i,l,o){i.lanes|=o;var d=i.alternate;d!==null&&(d.lanes|=o);for(var m=!1,y=i.return;y!==null;)y.childLanes|=o,d=y.alternate,d!==null&&(d.childLanes|=o),y.tag===22&&(i=y.stateNode,i===null||i._visibility&1||(m=!0)),i=y,y=y.return;return i.tag===3?(y=i.stateNode,m&&l!==null&&(m=31-Z(o),i=y.hiddenUpdates,d=i[m],d===null?i[m]=[l]:d.push(l),l.lane=o|536870912),y):null}function yu(i){if(50<wo)throw wo=0,Um=null,Error(r(185));for(var l=i.return;l!==null;)i=l,l=i.return;return i.tag===3?i.stateNode:null}var Dl={};function _R(i,l,o,d){this.tag=i,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ii(i,l,o,d){return new _R(i,l,o,d)}function _p(i){return i=i.prototype,!(!i||!i.isReactComponent)}function yr(i,l){var o=i.alternate;return o===null?(o=ii(i.tag,l,i.key,i.mode),o.elementType=i.elementType,o.type=i.type,o.stateNode=i.stateNode,o.alternate=i,i.alternate=o):(o.pendingProps=l,o.type=i.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=i.flags&65011712,o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,l=i.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},o.sibling=i.sibling,o.index=i.index,o.ref=i.ref,o.refCleanup=i.refCleanup,o}function Aw(i,l){i.flags&=65011714;var o=i.alternate;return o===null?(i.childLanes=0,i.lanes=l,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,l=o.dependencies,i.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),i}function bu(i,l,o,d,m,y){var S=0;if(d=i,typeof i=="function")_p(i)&&(S=1);else if(typeof i=="string")S=I4(i,o,ne.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case U:return i=ii(31,o,l,m),i.elementType=U,i.lanes=y,i;case C:return Us(o.children,m,y,l);case j:S=8,m|=24;break;case D:return i=ii(12,o,l,m|2),i.elementType=D,i.lanes=y,i;case _:return i=ii(13,o,l,m),i.elementType=_,i.lanes=y,i;case q:return i=ii(19,o,l,m),i.elementType=q,i.lanes=y,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case E:S=10;break e;case M:S=9;break e;case R:S=11;break e;case O:S=14;break e;case X:S=16,d=null;break e}S=29,o=Error(r(130,i===null?"null":typeof i,"")),d=null}return l=ii(S,o,l,m),l.elementType=i,l.type=d,l.lanes=y,l}function Us(i,l,o,d){return i=ii(7,i,d,l),i.lanes=o,i}function Lp(i,l,o){return i=ii(6,i,null,l),i.lanes=o,i}function kw(i){var l=ii(18,null,null,0);return l.stateNode=i,l}function qp(i,l,o){return l=ii(4,i.children!==null?i.children:[],i.key,l),l.lanes=o,l.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},l}var Cw=new WeakMap;function Si(i,l){if(typeof i=="object"&&i!==null){var o=Cw.get(i);return o!==void 0?o:(l={value:i,source:l,stack:De(l)},Cw.set(i,l),l)}return{value:i,source:l,stack:De(l)}}var _l=[],Ll=0,xu=null,Za=0,Ai=[],ki=0,ns=null,Wi=1,Zi="";function br(i,l){_l[Ll++]=Za,_l[Ll++]=xu,xu=i,Za=l}function Nw(i,l,o){Ai[ki++]=Wi,Ai[ki++]=Zi,Ai[ki++]=ns,ns=i;var d=Wi;i=Zi;var m=32-Z(d)-1;d&=~(1<<m),o+=1;var y=32-Z(l)+m;if(30<y){var S=m-m%5;y=(d&(1<<S)-1).toString(32),d>>=S,m-=S,Wi=1<<32-Z(l)+m|o<<m|d,Zi=y+i}else Wi=1<<y|o<<m|d,Zi=i}function Bp(i){i.return!==null&&(br(i,1),Nw(i,1,0))}function $p(i){for(;i===xu;)xu=_l[--Ll],_l[Ll]=null,Za=_l[--Ll],_l[Ll]=null;for(;i===ns;)ns=Ai[--ki],Ai[ki]=null,Zi=Ai[--ki],Ai[ki]=null,Wi=Ai[--ki],Ai[ki]=null}function Tw(i,l){Ai[ki++]=Wi,Ai[ki++]=Zi,Ai[ki++]=ns,Wi=l.id,Zi=l.overflow,ns=i}var mn=null,Dt=null,pt=!1,is=null,Ci=!1,Ip=Error(r(519));function rs(i){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw eo(Si(l,i)),Ip}function jw(i){var l=i.stateNode,o=i.type,d=i.memoizedProps;switch(l[Ft]=i,l[Kt]=d,o){case"dialog":ct("cancel",l),ct("close",l);break;case"iframe":case"object":case"embed":ct("load",l);break;case"video":case"audio":for(o=0;o<Ao.length;o++)ct(Ao[o],l);break;case"source":ct("error",l);break;case"img":case"image":case"link":ct("error",l),ct("load",l);break;case"details":ct("toggle",l);break;case"input":ct("invalid",l),z1(l,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ct("invalid",l);break;case"textarea":ct("invalid",l),V1(l,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||l.textContent===""+o||d.suppressHydrationWarning===!0||P2(l.textContent,o)?(d.popover!=null&&(ct("beforetoggle",l),ct("toggle",l)),d.onScroll!=null&&ct("scroll",l),d.onScrollEnd!=null&&ct("scrollend",l),d.onClick!=null&&(l.onclick=mr),l=!0):l=!1,l||rs(i,!0)}function Ew(i){for(mn=i.return;mn;)switch(mn.tag){case 5:case 31:case 13:Ci=!1;return;case 27:case 3:Ci=!0;return;default:mn=mn.return}}function ql(i){if(i!==mn)return!1;if(!pt)return Ew(i),pt=!0,!1;var l=i.tag,o;if((o=l!==3&&l!==27)&&((o=l===5)&&(o=i.type,o=!(o!=="form"&&o!=="button")||ig(i.type,i.memoizedProps)),o=!o),o&&Dt&&rs(i),Ew(i),l===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Dt=eA(i)}else if(l===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Dt=eA(i)}else l===27?(l=Dt,bs(i.type)?(i=og,og=null,Dt=i):Dt=l):Dt=mn?Ti(i.stateNode.nextSibling):null;return!0}function Vs(){Dt=mn=null,pt=!1}function Hp(){var i=is;return i!==null&&(Gn===null?Gn=i:Gn.push.apply(Gn,i),is=null),i}function eo(i){is===null?is=[i]:is.push(i)}var zp=T(null),Fs=null,xr=null;function ss(i,l,o){he(zp,l._currentValue),l._currentValue=o}function vr(i){i._currentValue=zp.current,z(zp)}function Up(i,l,o){for(;i!==null;){var d=i.alternate;if((i.childLanes&l)!==l?(i.childLanes|=l,d!==null&&(d.childLanes|=l)):d!==null&&(d.childLanes&l)!==l&&(d.childLanes|=l),i===o)break;i=i.return}}function Vp(i,l,o,d){var m=i.child;for(m!==null&&(m.return=i);m!==null;){var y=m.dependencies;if(y!==null){var S=m.child;y=y.firstContext;e:for(;y!==null;){var N=y;y=m;for(var $=0;$<l.length;$++)if(N.context===l[$]){y.lanes|=o,N=y.alternate,N!==null&&(N.lanes|=o),Up(y.return,o,i),d||(S=null);break e}y=N.next}}else if(m.tag===18){if(S=m.return,S===null)throw Error(r(341));S.lanes|=o,y=S.alternate,y!==null&&(y.lanes|=o),Up(S,o,i),S=null}else S=m.child;if(S!==null)S.return=m;else for(S=m;S!==null;){if(S===i){S=null;break}if(m=S.sibling,m!==null){m.return=S.return,S=m;break}S=S.return}m=S}}function Bl(i,l,o,d){i=null;for(var m=l,y=!1;m!==null;){if(!y){if((m.flags&524288)!==0)y=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var S=m.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var N=m.type;ni(m.pendingProps.value,S.value)||(i!==null?i.push(N):i=[N])}}else if(m===$e.current){if(S=m.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(i!==null?i.push(jo):i=[jo])}m=m.return}i!==null&&Vp(l,i,o,d),l.flags|=262144}function vu(i){for(i=i.firstContext;i!==null;){if(!ni(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ps(i){Fs=i,xr=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function gn(i){return Ow(Fs,i)}function wu(i,l){return Fs===null&&Ps(i),Ow(i,l)}function Ow(i,l){var o=l._currentValue;if(l={context:l,memoizedValue:o,next:null},xr===null){if(i===null)throw Error(r(308));xr=l,i.dependencies={lanes:0,firstContext:l},i.flags|=524288}else xr=xr.next=l;return o}var LR=typeof AbortController<"u"?AbortController:function(){var i=[],l=this.signal={aborted:!1,addEventListener:function(o,d){i.push(d)}};this.abort=function(){l.aborted=!0,i.forEach(function(o){return o()})}},qR=t.unstable_scheduleCallback,BR=t.unstable_NormalPriority,Xt={$$typeof:E,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Fp(){return{controller:new LR,data:new Map,refCount:0}}function to(i){i.refCount--,i.refCount===0&&qR(BR,function(){i.controller.abort()})}var no=null,Pp=0,$l=0,Il=null;function $R(i,l){if(no===null){var o=no=[];Pp=0,$l=Gm(),Il={status:"pending",value:void 0,then:function(d){o.push(d)}}}return Pp++,l.then(Mw,Mw),l}function Mw(){if(--Pp===0&&no!==null){Il!==null&&(Il.status="fulfilled");var i=no;no=null,$l=0,Il=null;for(var l=0;l<i.length;l++)(0,i[l])()}}function IR(i,l){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return i.then(function(){d.status="fulfilled",d.value=l;for(var m=0;m<o.length;m++)(0,o[m])(l)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var Rw=L.S;L.S=function(i,l){m2=ht(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&$R(i,l),Rw!==null&&Rw(i,l)};var Ys=T(null);function Yp(){var i=Ys.current;return i!==null?i:Ot.pooledCache}function Su(i,l){l===null?he(Ys,Ys.current):he(Ys,l.pool)}function Dw(){var i=Yp();return i===null?null:{parent:Xt._currentValue,pool:i}}var Hl=Error(r(460)),Kp=Error(r(474)),Au=Error(r(542)),ku={then:function(){}};function _w(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Lw(i,l,o){switch(o=i[o],o===void 0?i.push(l):o!==l&&(l.then(mr,mr),l=o),l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,Bw(i),i;default:if(typeof l.status=="string")l.then(mr,mr);else{if(i=Ot,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=l,i.status="pending",i.then(function(d){if(l.status==="pending"){var m=l;m.status="fulfilled",m.value=d}},function(d){if(l.status==="pending"){var m=l;m.status="rejected",m.reason=d}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,Bw(i),i}throw Gs=l,Hl}}function Ks(i){try{var l=i._init;return l(i._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Gs=o,Hl):o}}var Gs=null;function qw(){if(Gs===null)throw Error(r(459));var i=Gs;return Gs=null,i}function Bw(i){if(i===Hl||i===Au)throw Error(r(483))}var zl=null,io=0;function Cu(i){var l=io;return io+=1,zl===null&&(zl=[]),Lw(zl,i,l)}function ro(i,l){l=l.props.ref,i.ref=l!==void 0?l:null}function Nu(i,l){throw l.$$typeof===v?Error(r(525)):(i=Object.prototype.toString.call(l),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":i)))}function $w(i){function l(P,H){if(i){var ee=P.deletions;ee===null?(P.deletions=[H],P.flags|=16):ee.push(H)}}function o(P,H){if(!i)return null;for(;H!==null;)l(P,H),H=H.sibling;return null}function d(P){for(var H=new Map;P!==null;)P.key!==null?H.set(P.key,P):H.set(P.index,P),P=P.sibling;return H}function m(P,H){return P=yr(P,H),P.index=0,P.sibling=null,P}function y(P,H,ee){return P.index=ee,i?(ee=P.alternate,ee!==null?(ee=ee.index,ee<H?(P.flags|=67108866,H):ee):(P.flags|=67108866,H)):(P.flags|=1048576,H)}function S(P){return i&&P.alternate===null&&(P.flags|=67108866),P}function N(P,H,ee,ge){return H===null||H.tag!==6?(H=Lp(ee,P.mode,ge),H.return=P,H):(H=m(H,ee),H.return=P,H)}function $(P,H,ee,ge){var Ve=ee.type;return Ve===C?de(P,H,ee.props.children,ge,ee.key):H!==null&&(H.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===X&&Ks(Ve)===H.type)?(H=m(H,ee.props),ro(H,ee),H.return=P,H):(H=bu(ee.type,ee.key,ee.props,null,P.mode,ge),ro(H,ee),H.return=P,H)}function te(P,H,ee,ge){return H===null||H.tag!==4||H.stateNode.containerInfo!==ee.containerInfo||H.stateNode.implementation!==ee.implementation?(H=qp(ee,P.mode,ge),H.return=P,H):(H=m(H,ee.children||[]),H.return=P,H)}function de(P,H,ee,ge,Ve){return H===null||H.tag!==7?(H=Us(ee,P.mode,ge,Ve),H.return=P,H):(H=m(H,ee),H.return=P,H)}function be(P,H,ee){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=Lp(""+H,P.mode,ee),H.return=P,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case w:return ee=bu(H.type,H.key,H.props,null,P.mode,ee),ro(ee,H),ee.return=P,ee;case A:return H=qp(H,P.mode,ee),H.return=P,H;case X:return H=Ks(H),be(P,H,ee)}if(fe(H)||W(H))return H=Us(H,P.mode,ee,null),H.return=P,H;if(typeof H.then=="function")return be(P,Cu(H),ee);if(H.$$typeof===E)return be(P,wu(P,H),ee);Nu(P,H)}return null}function ie(P,H,ee,ge){var Ve=H!==null?H.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Ve!==null?null:N(P,H,""+ee,ge);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:return ee.key===Ve?$(P,H,ee,ge):null;case A:return ee.key===Ve?te(P,H,ee,ge):null;case X:return ee=Ks(ee),ie(P,H,ee,ge)}if(fe(ee)||W(ee))return Ve!==null?null:de(P,H,ee,ge,null);if(typeof ee.then=="function")return ie(P,H,Cu(ee),ge);if(ee.$$typeof===E)return ie(P,H,wu(P,ee),ge);Nu(P,ee)}return null}function le(P,H,ee,ge,Ve){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return P=P.get(ee)||null,N(H,P,""+ge,Ve);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case w:return P=P.get(ge.key===null?ee:ge.key)||null,$(H,P,ge,Ve);case A:return P=P.get(ge.key===null?ee:ge.key)||null,te(H,P,ge,Ve);case X:return ge=Ks(ge),le(P,H,ee,ge,Ve)}if(fe(ge)||W(ge))return P=P.get(ee)||null,de(H,P,ge,Ve,null);if(typeof ge.then=="function")return le(P,H,ee,Cu(ge),Ve);if(ge.$$typeof===E)return le(P,H,ee,wu(H,ge),Ve);Nu(H,ge)}return null}function Be(P,H,ee,ge){for(var Ve=null,bt=null,He=H,it=H=0,ft=null;He!==null&&it<ee.length;it++){He.index>it?(ft=He,He=null):ft=He.sibling;var xt=ie(P,He,ee[it],ge);if(xt===null){He===null&&(He=ft);break}i&&He&&xt.alternate===null&&l(P,He),H=y(xt,H,it),bt===null?Ve=xt:bt.sibling=xt,bt=xt,He=ft}if(it===ee.length)return o(P,He),pt&&br(P,it),Ve;if(He===null){for(;it<ee.length;it++)He=be(P,ee[it],ge),He!==null&&(H=y(He,H,it),bt===null?Ve=He:bt.sibling=He,bt=He);return pt&&br(P,it),Ve}for(He=d(He);it<ee.length;it++)ft=le(He,P,it,ee[it],ge),ft!==null&&(i&&ft.alternate!==null&&He.delete(ft.key===null?it:ft.key),H=y(ft,H,it),bt===null?Ve=ft:bt.sibling=ft,bt=ft);return i&&He.forEach(function(As){return l(P,As)}),pt&&br(P,it),Ve}function Ge(P,H,ee,ge){if(ee==null)throw Error(r(151));for(var Ve=null,bt=null,He=H,it=H=0,ft=null,xt=ee.next();He!==null&&!xt.done;it++,xt=ee.next()){He.index>it?(ft=He,He=null):ft=He.sibling;var As=ie(P,He,xt.value,ge);if(As===null){He===null&&(He=ft);break}i&&He&&As.alternate===null&&l(P,He),H=y(As,H,it),bt===null?Ve=As:bt.sibling=As,bt=As,He=ft}if(xt.done)return o(P,He),pt&&br(P,it),Ve;if(He===null){for(;!xt.done;it++,xt=ee.next())xt=be(P,xt.value,ge),xt!==null&&(H=y(xt,H,it),bt===null?Ve=xt:bt.sibling=xt,bt=xt);return pt&&br(P,it),Ve}for(He=d(He);!xt.done;it++,xt=ee.next())xt=le(He,P,it,xt.value,ge),xt!==null&&(i&&xt.alternate!==null&&He.delete(xt.key===null?it:xt.key),H=y(xt,H,it),bt===null?Ve=xt:bt.sibling=xt,bt=xt);return i&&He.forEach(function(J4){return l(P,J4)}),pt&&br(P,it),Ve}function Tt(P,H,ee,ge){if(typeof ee=="object"&&ee!==null&&ee.type===C&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:e:{for(var Ve=ee.key;H!==null;){if(H.key===Ve){if(Ve=ee.type,Ve===C){if(H.tag===7){o(P,H.sibling),ge=m(H,ee.props.children),ge.return=P,P=ge;break e}}else if(H.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===X&&Ks(Ve)===H.type){o(P,H.sibling),ge=m(H,ee.props),ro(ge,ee),ge.return=P,P=ge;break e}o(P,H);break}else l(P,H);H=H.sibling}ee.type===C?(ge=Us(ee.props.children,P.mode,ge,ee.key),ge.return=P,P=ge):(ge=bu(ee.type,ee.key,ee.props,null,P.mode,ge),ro(ge,ee),ge.return=P,P=ge)}return S(P);case A:e:{for(Ve=ee.key;H!==null;){if(H.key===Ve)if(H.tag===4&&H.stateNode.containerInfo===ee.containerInfo&&H.stateNode.implementation===ee.implementation){o(P,H.sibling),ge=m(H,ee.children||[]),ge.return=P,P=ge;break e}else{o(P,H);break}else l(P,H);H=H.sibling}ge=qp(ee,P.mode,ge),ge.return=P,P=ge}return S(P);case X:return ee=Ks(ee),Tt(P,H,ee,ge)}if(fe(ee))return Be(P,H,ee,ge);if(W(ee)){if(Ve=W(ee),typeof Ve!="function")throw Error(r(150));return ee=Ve.call(ee),Ge(P,H,ee,ge)}if(typeof ee.then=="function")return Tt(P,H,Cu(ee),ge);if(ee.$$typeof===E)return Tt(P,H,wu(P,ee),ge);Nu(P,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,H!==null&&H.tag===6?(o(P,H.sibling),ge=m(H,ee),ge.return=P,P=ge):(o(P,H),ge=Lp(ee,P.mode,ge),ge.return=P,P=ge),S(P)):o(P,H)}return function(P,H,ee,ge){try{io=0;var Ve=Tt(P,H,ee,ge);return zl=null,Ve}catch(He){if(He===Hl||He===Au)throw He;var bt=ii(29,He,null,P.mode);return bt.lanes=ge,bt.return=P,bt}}}var Xs=$w(!0),Iw=$w(!1),ls=!1;function Gp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Xp(i,l){i=i.updateQueue,l.updateQueue===i&&(l.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function as(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function os(i,l,o){var d=i.updateQueue;if(d===null)return null;if(d=d.shared,(vt&2)!==0){var m=d.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),d.pending=l,l=yu(i),Sw(i,null,o),l}return gu(i,d,l,o),yu(i)}function so(i,l,o){if(l=l.updateQueue,l!==null&&(l=l.shared,(o&4194048)!==0)){var d=l.lanes;d&=i.pendingLanes,o|=d,l.lanes=o,yi(i,o)}}function Jp(i,l){var o=i.updateQueue,d=i.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,y=null;if(o=o.firstBaseUpdate,o!==null){do{var S={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};y===null?m=y=S:y=y.next=S,o=o.next}while(o!==null);y===null?m=y=l:y=y.next=l}else m=y=l;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},i.updateQueue=o;return}i=o.lastBaseUpdate,i===null?o.firstBaseUpdate=l:i.next=l,o.lastBaseUpdate=l}var Qp=!1;function lo(){if(Qp){var i=Il;if(i!==null)throw i}}function ao(i,l,o,d){Qp=!1;var m=i.updateQueue;ls=!1;var y=m.firstBaseUpdate,S=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var $=N,te=$.next;$.next=null,S===null?y=te:S.next=te,S=$;var de=i.alternate;de!==null&&(de=de.updateQueue,N=de.lastBaseUpdate,N!==S&&(N===null?de.firstBaseUpdate=te:N.next=te,de.lastBaseUpdate=$))}if(y!==null){var be=m.baseState;S=0,de=te=$=null,N=y;do{var ie=N.lane&-536870913,le=ie!==N.lane;if(le?(dt&ie)===ie:(d&ie)===ie){ie!==0&&ie===$l&&(Qp=!0),de!==null&&(de=de.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Be=i,Ge=N;ie=l;var Tt=o;switch(Ge.tag){case 1:if(Be=Ge.payload,typeof Be=="function"){be=Be.call(Tt,be,ie);break e}be=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=Ge.payload,ie=typeof Be=="function"?Be.call(Tt,be,ie):Be,ie==null)break e;be=b({},be,ie);break e;case 2:ls=!0}}ie=N.callback,ie!==null&&(i.flags|=64,le&&(i.flags|=8192),le=m.callbacks,le===null?m.callbacks=[ie]:le.push(ie))}else le={lane:ie,tag:N.tag,payload:N.payload,callback:N.callback,next:null},de===null?(te=de=le,$=be):de=de.next=le,S|=ie;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;le=N,N=le.next,le.next=null,m.lastBaseUpdate=le,m.shared.pending=null}}while(!0);de===null&&($=be),m.baseState=$,m.firstBaseUpdate=te,m.lastBaseUpdate=de,y===null&&(m.shared.lanes=0),hs|=S,i.lanes=S,i.memoizedState=be}}function Hw(i,l){if(typeof i!="function")throw Error(r(191,i));i.call(l)}function zw(i,l){var o=i.callbacks;if(o!==null)for(i.callbacks=null,i=0;i<o.length;i++)Hw(o[i],l)}var Ul=T(null),Tu=T(0);function Uw(i,l){i=Er,he(Tu,i),he(Ul,l),Er=i|l.baseLanes}function Wp(){he(Tu,Er),he(Ul,Ul.current)}function Zp(){Er=Tu.current,z(Ul),z(Tu)}var ri=T(null),Ni=null;function cs(i){var l=i.alternate;he(Pt,Pt.current&1),he(ri,i),Ni===null&&(l===null||Ul.current!==null||l.memoizedState!==null)&&(Ni=i)}function em(i){he(Pt,Pt.current),he(ri,i),Ni===null&&(Ni=i)}function Vw(i){i.tag===22?(he(Pt,Pt.current),he(ri,i),Ni===null&&(Ni=i)):us()}function us(){he(Pt,Pt.current),he(ri,ri.current)}function si(i){z(ri),Ni===i&&(Ni=null),z(Pt)}var Pt=T(0);function ju(i){for(var l=i;l!==null;){if(l.tag===13){var o=l.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||lg(o)||ag(o)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var wr=0,nt=null,Ct=null,Jt=null,Eu=!1,Vl=!1,Js=!1,Ou=0,oo=0,Fl=null,HR=0;function $t(){throw Error(r(321))}function tm(i,l){if(l===null)return!1;for(var o=0;o<l.length&&o<i.length;o++)if(!ni(i[o],l[o]))return!1;return!0}function nm(i,l,o,d,m,y){return wr=y,nt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,L.H=i===null||i.memoizedState===null?NS:ym,Js=!1,y=o(d,m),Js=!1,Vl&&(y=Pw(l,o,d,m)),Fw(i),y}function Fw(i){L.H=fo;var l=Ct!==null&&Ct.next!==null;if(wr=0,Jt=Ct=nt=null,Eu=!1,oo=0,Fl=null,l)throw Error(r(300));i===null||Qt||(i=i.dependencies,i!==null&&vu(i)&&(Qt=!0))}function Pw(i,l,o,d){nt=i;var m=0;do{if(Vl&&(Fl=null),oo=0,Vl=!1,25<=m)throw Error(r(301));if(m+=1,Jt=Ct=null,i.updateQueue!=null){var y=i.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}L.H=TS,y=l(o,d)}while(Vl);return y}function zR(){var i=L.H,l=i.useState()[0];return l=typeof l.then=="function"?co(l):l,i=i.useState()[0],(Ct!==null?Ct.memoizedState:null)!==i&&(nt.flags|=1024),l}function im(){var i=Ou!==0;return Ou=0,i}function rm(i,l,o){l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~o}function sm(i){if(Eu){for(i=i.memoizedState;i!==null;){var l=i.queue;l!==null&&(l.pending=null),i=i.next}Eu=!1}wr=0,Jt=Ct=nt=null,Vl=!1,oo=Ou=0,Fl=null}function Bn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?nt.memoizedState=Jt=i:Jt=Jt.next=i,Jt}function Yt(){if(Ct===null){var i=nt.alternate;i=i!==null?i.memoizedState:null}else i=Ct.next;var l=Jt===null?nt.memoizedState:Jt.next;if(l!==null)Jt=l,Ct=i;else{if(i===null)throw nt.alternate===null?Error(r(467)):Error(r(310));Ct=i,i={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},Jt===null?nt.memoizedState=Jt=i:Jt=Jt.next=i}return Jt}function Mu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function co(i){var l=oo;return oo+=1,Fl===null&&(Fl=[]),i=Lw(Fl,i,l),l=nt,(Jt===null?l.memoizedState:Jt.next)===null&&(l=l.alternate,L.H=l===null||l.memoizedState===null?NS:ym),i}function Ru(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return co(i);if(i.$$typeof===E)return gn(i)}throw Error(r(438,String(i)))}function lm(i){var l=null,o=nt.updateQueue;if(o!==null&&(l=o.memoCache),l==null){var d=nt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(l={data:d.data.map(function(m){return m.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),o===null&&(o=Mu(),nt.updateQueue=o),o.memoCache=l,o=l.data[l.index],o===void 0)for(o=l.data[l.index]=Array(i),d=0;d<i;d++)o[d]=B;return l.index++,o}function Sr(i,l){return typeof l=="function"?l(i):l}function Du(i){var l=Yt();return am(l,Ct,i)}function am(i,l,o){var d=i.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=o;var m=i.baseQueue,y=d.pending;if(y!==null){if(m!==null){var S=m.next;m.next=y.next,y.next=S}l.baseQueue=m=y,d.pending=null}if(y=i.baseState,m===null)i.memoizedState=y;else{l=m.next;var N=S=null,$=null,te=l,de=!1;do{var be=te.lane&-536870913;if(be!==te.lane?(dt&be)===be:(wr&be)===be){var ie=te.revertLane;if(ie===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),be===$l&&(de=!0);else if((wr&ie)===ie){te=te.next,ie===$l&&(de=!0);continue}else be={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},$===null?(N=$=be,S=y):$=$.next=be,nt.lanes|=ie,hs|=ie;be=te.action,Js&&o(y,be),y=te.hasEagerState?te.eagerState:o(y,be)}else ie={lane:be,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},$===null?(N=$=ie,S=y):$=$.next=ie,nt.lanes|=be,hs|=be;te=te.next}while(te!==null&&te!==l);if($===null?S=y:$.next=N,!ni(y,i.memoizedState)&&(Qt=!0,de&&(o=Il,o!==null)))throw o;i.memoizedState=y,i.baseState=S,i.baseQueue=$,d.lastRenderedState=y}return m===null&&(d.lanes=0),[i.memoizedState,d.dispatch]}function om(i){var l=Yt(),o=l.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var d=o.dispatch,m=o.pending,y=l.memoizedState;if(m!==null){o.pending=null;var S=m=m.next;do y=i(y,S.action),S=S.next;while(S!==m);ni(y,l.memoizedState)||(Qt=!0),l.memoizedState=y,l.baseQueue===null&&(l.baseState=y),o.lastRenderedState=y}return[y,d]}function Yw(i,l,o){var d=nt,m=Yt(),y=pt;if(y){if(o===void 0)throw Error(r(407));o=o()}else o=l();var S=!ni((Ct||m).memoizedState,o);if(S&&(m.memoizedState=o,Qt=!0),m=m.queue,dm(Xw.bind(null,d,m,i),[i]),m.getSnapshot!==l||S||Jt!==null&&Jt.memoizedState.tag&1){if(d.flags|=2048,Pl(9,{destroy:void 0},Gw.bind(null,d,m,o,l),null),Ot===null)throw Error(r(349));y||(wr&127)!==0||Kw(d,l,o)}return o}function Kw(i,l,o){i.flags|=16384,i={getSnapshot:l,value:o},l=nt.updateQueue,l===null?(l=Mu(),nt.updateQueue=l,l.stores=[i]):(o=l.stores,o===null?l.stores=[i]:o.push(i))}function Gw(i,l,o,d){l.value=o,l.getSnapshot=d,Jw(l)&&Qw(i)}function Xw(i,l,o){return o(function(){Jw(l)&&Qw(i)})}function Jw(i){var l=i.getSnapshot;i=i.value;try{var o=l();return!ni(i,o)}catch{return!0}}function Qw(i){var l=zs(i,2);l!==null&&Xn(l,i,2)}function cm(i){var l=Bn();if(typeof i=="function"){var o=i;if(i=o(),Js){Y(!0);try{o()}finally{Y(!1)}}}return l.memoizedState=l.baseState=i,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:i},l}function Ww(i,l,o,d){return i.baseState=o,am(i,Ct,typeof d=="function"?d:Sr)}function UR(i,l,o,d,m){if(qu(i))throw Error(r(485));if(i=l.action,i!==null){var y={payload:m,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){y.listeners.push(S)}};L.T!==null?o(!0):y.isTransition=!1,d(y),o=l.pending,o===null?(y.next=l.pending=y,Zw(l,y)):(y.next=o.next,l.pending=o.next=y)}}function Zw(i,l){var o=l.action,d=l.payload,m=i.state;if(l.isTransition){var y=L.T,S={};L.T=S;try{var N=o(m,d),$=L.S;$!==null&&$(S,N),eS(i,l,N)}catch(te){um(i,l,te)}finally{y!==null&&S.types!==null&&(y.types=S.types),L.T=y}}else try{y=o(m,d),eS(i,l,y)}catch(te){um(i,l,te)}}function eS(i,l,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){tS(i,l,d)},function(d){return um(i,l,d)}):tS(i,l,o)}function tS(i,l,o){l.status="fulfilled",l.value=o,nS(l),i.state=o,l=i.pending,l!==null&&(o=l.next,o===l?i.pending=null:(o=o.next,l.next=o,Zw(i,o)))}function um(i,l,o){var d=i.pending;if(i.pending=null,d!==null){d=d.next;do l.status="rejected",l.reason=o,nS(l),l=l.next;while(l!==d)}i.action=null}function nS(i){i=i.listeners;for(var l=0;l<i.length;l++)(0,i[l])()}function iS(i,l){return l}function rS(i,l){if(pt){var o=Ot.formState;if(o!==null){e:{var d=nt;if(pt){if(Dt){t:{for(var m=Dt,y=Ci;m.nodeType!==8;){if(!y){m=null;break t}if(m=Ti(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){Dt=Ti(m.nextSibling),d=m.data==="F!";break e}}rs(d)}d=!1}d&&(l=o[0])}}return o=Bn(),o.memoizedState=o.baseState=l,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:iS,lastRenderedState:l},o.queue=d,o=AS.bind(null,nt,d),d.dispatch=o,d=cm(!1),y=gm.bind(null,nt,!1,d.queue),d=Bn(),m={state:l,dispatch:null,action:i,pending:null},d.queue=m,o=UR.bind(null,nt,m,y,o),m.dispatch=o,d.memoizedState=i,[l,o,!1]}function sS(i){var l=Yt();return lS(l,Ct,i)}function lS(i,l,o){if(l=am(i,l,iS)[0],i=Du(Sr)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var d=co(l)}catch(S){throw S===Hl?Au:S}else d=l;l=Yt();var m=l.queue,y=m.dispatch;return o!==l.memoizedState&&(nt.flags|=2048,Pl(9,{destroy:void 0},VR.bind(null,m,o),null)),[d,y,i]}function VR(i,l){i.action=l}function aS(i){var l=Yt(),o=Ct;if(o!==null)return lS(l,o,i);Yt(),l=l.memoizedState,o=Yt();var d=o.queue.dispatch;return o.memoizedState=i,[l,d,!1]}function Pl(i,l,o,d){return i={tag:i,create:o,deps:d,inst:l,next:null},l=nt.updateQueue,l===null&&(l=Mu(),nt.updateQueue=l),o=l.lastEffect,o===null?l.lastEffect=i.next=i:(d=o.next,o.next=i,i.next=d,l.lastEffect=i),i}function oS(){return Yt().memoizedState}function _u(i,l,o,d){var m=Bn();nt.flags|=i,m.memoizedState=Pl(1|l,{destroy:void 0},o,d===void 0?null:d)}function Lu(i,l,o,d){var m=Yt();d=d===void 0?null:d;var y=m.memoizedState.inst;Ct!==null&&d!==null&&tm(d,Ct.memoizedState.deps)?m.memoizedState=Pl(l,y,o,d):(nt.flags|=i,m.memoizedState=Pl(1|l,y,o,d))}function cS(i,l){_u(8390656,8,i,l)}function dm(i,l){Lu(2048,8,i,l)}function FR(i){nt.flags|=4;var l=nt.updateQueue;if(l===null)l=Mu(),nt.updateQueue=l,l.events=[i];else{var o=l.events;o===null?l.events=[i]:o.push(i)}}function uS(i){var l=Yt().memoizedState;return FR({ref:l,nextImpl:i}),function(){if((vt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function dS(i,l){return Lu(4,2,i,l)}function fS(i,l){return Lu(4,4,i,l)}function hS(i,l){if(typeof l=="function"){i=i();var o=l(i);return function(){typeof o=="function"?o():l(null)}}if(l!=null)return i=i(),l.current=i,function(){l.current=null}}function pS(i,l,o){o=o!=null?o.concat([i]):null,Lu(4,4,hS.bind(null,l,i),o)}function fm(){}function mS(i,l){var o=Yt();l=l===void 0?null:l;var d=o.memoizedState;return l!==null&&tm(l,d[1])?d[0]:(o.memoizedState=[i,l],i)}function gS(i,l){var o=Yt();l=l===void 0?null:l;var d=o.memoizedState;if(l!==null&&tm(l,d[1]))return d[0];if(d=i(),Js){Y(!0);try{i()}finally{Y(!1)}}return o.memoizedState=[d,l],d}function hm(i,l,o){return o===void 0||(wr&1073741824)!==0&&(dt&261930)===0?i.memoizedState=l:(i.memoizedState=o,i=y2(),nt.lanes|=i,hs|=i,o)}function yS(i,l,o,d){return ni(o,l)?o:Ul.current!==null?(i=hm(i,o,d),ni(i,l)||(Qt=!0),i):(wr&42)===0||(wr&1073741824)!==0&&(dt&261930)===0?(Qt=!0,i.memoizedState=o):(i=y2(),nt.lanes|=i,hs|=i,l)}function bS(i,l,o,d,m){var y=Q.p;Q.p=y!==0&&8>y?y:8;var S=L.T,N={};L.T=N,gm(i,!1,l,o);try{var $=m(),te=L.S;if(te!==null&&te(N,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var de=IR($,d);uo(i,l,de,oi(i))}else uo(i,l,d,oi(i))}catch(be){uo(i,l,{then:function(){},status:"rejected",reason:be},oi())}finally{Q.p=y,S!==null&&N.types!==null&&(S.types=N.types),L.T=S}}function PR(){}function pm(i,l,o,d){if(i.tag!==5)throw Error(r(476));var m=xS(i).queue;bS(i,m,l,oe,o===null?PR:function(){return vS(i),o(d)})}function xS(i){var l=i.memoizedState;if(l!==null)return l;l={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:oe},next:null};var o={};return l.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:o},next:null},i.memoizedState=l,i=i.alternate,i!==null&&(i.memoizedState=l),l}function vS(i){var l=xS(i);l.next===null&&(l=i.alternate.memoizedState),uo(i,l.next.queue,{},oi())}function mm(){return gn(jo)}function wS(){return Yt().memoizedState}function SS(){return Yt().memoizedState}function YR(i){for(var l=i.return;l!==null;){switch(l.tag){case 24:case 3:var o=oi();i=as(o);var d=os(l,i,o);d!==null&&(Xn(d,l,o),so(d,l,o)),l={cache:Fp()},i.payload=l;return}l=l.return}}function KR(i,l,o){var d=oi();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},qu(i)?kS(l,o):(o=Dp(i,l,o,d),o!==null&&(Xn(o,i,d),CS(o,l,d)))}function AS(i,l,o){var d=oi();uo(i,l,o,d)}function uo(i,l,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(qu(i))kS(l,m);else{var y=i.alternate;if(i.lanes===0&&(y===null||y.lanes===0)&&(y=l.lastRenderedReducer,y!==null))try{var S=l.lastRenderedState,N=y(S,o);if(m.hasEagerState=!0,m.eagerState=N,ni(N,S))return gu(i,l,m,0),Ot===null&&mu(),!1}catch{}if(o=Dp(i,l,m,d),o!==null)return Xn(o,i,d),CS(o,l,d),!0}return!1}function gm(i,l,o,d){if(d={lane:2,revertLane:Gm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},qu(i)){if(l)throw Error(r(479))}else l=Dp(i,o,d,2),l!==null&&Xn(l,i,2)}function qu(i){var l=i.alternate;return i===nt||l!==null&&l===nt}function kS(i,l){Vl=Eu=!0;var o=i.pending;o===null?l.next=l:(l.next=o.next,o.next=l),i.pending=l}function CS(i,l,o){if((o&4194048)!==0){var d=l.lanes;d&=i.pendingLanes,o|=d,l.lanes=o,yi(i,o)}}var fo={readContext:gn,use:Ru,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useLayoutEffect:$t,useInsertionEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useSyncExternalStore:$t,useId:$t,useHostTransitionStatus:$t,useFormState:$t,useActionState:$t,useOptimistic:$t,useMemoCache:$t,useCacheRefresh:$t};fo.useEffectEvent=$t;var NS={readContext:gn,use:Ru,useCallback:function(i,l){return Bn().memoizedState=[i,l===void 0?null:l],i},useContext:gn,useEffect:cS,useImperativeHandle:function(i,l,o){o=o!=null?o.concat([i]):null,_u(4194308,4,hS.bind(null,l,i),o)},useLayoutEffect:function(i,l){return _u(4194308,4,i,l)},useInsertionEffect:function(i,l){_u(4,2,i,l)},useMemo:function(i,l){var o=Bn();l=l===void 0?null:l;var d=i();if(Js){Y(!0);try{i()}finally{Y(!1)}}return o.memoizedState=[d,l],d},useReducer:function(i,l,o){var d=Bn();if(o!==void 0){var m=o(l);if(Js){Y(!0);try{o(l)}finally{Y(!1)}}}else m=l;return d.memoizedState=d.baseState=m,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:m},d.queue=i,i=i.dispatch=KR.bind(null,nt,i),[d.memoizedState,i]},useRef:function(i){var l=Bn();return i={current:i},l.memoizedState=i},useState:function(i){i=cm(i);var l=i.queue,o=AS.bind(null,nt,l);return l.dispatch=o,[i.memoizedState,o]},useDebugValue:fm,useDeferredValue:function(i,l){var o=Bn();return hm(o,i,l)},useTransition:function(){var i=cm(!1);return i=bS.bind(null,nt,i.queue,!0,!1),Bn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,l,o){var d=nt,m=Bn();if(pt){if(o===void 0)throw Error(r(407));o=o()}else{if(o=l(),Ot===null)throw Error(r(349));(dt&127)!==0||Kw(d,l,o)}m.memoizedState=o;var y={value:o,getSnapshot:l};return m.queue=y,cS(Xw.bind(null,d,y,i),[i]),d.flags|=2048,Pl(9,{destroy:void 0},Gw.bind(null,d,y,o,l),null),o},useId:function(){var i=Bn(),l=Ot.identifierPrefix;if(pt){var o=Zi,d=Wi;o=(d&~(1<<32-Z(d)-1)).toString(32)+o,l="_"+l+"R_"+o,o=Ou++,0<o&&(l+="H"+o.toString(32)),l+="_"}else o=HR++,l="_"+l+"r_"+o.toString(32)+"_";return i.memoizedState=l},useHostTransitionStatus:mm,useFormState:rS,useActionState:rS,useOptimistic:function(i){var l=Bn();l.memoizedState=l.baseState=i;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=o,l=gm.bind(null,nt,!0,o),o.dispatch=l,[i,l]},useMemoCache:lm,useCacheRefresh:function(){return Bn().memoizedState=YR.bind(null,nt)},useEffectEvent:function(i){var l=Bn(),o={impl:i};return l.memoizedState=o,function(){if((vt&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},ym={readContext:gn,use:Ru,useCallback:mS,useContext:gn,useEffect:dm,useImperativeHandle:pS,useInsertionEffect:dS,useLayoutEffect:fS,useMemo:gS,useReducer:Du,useRef:oS,useState:function(){return Du(Sr)},useDebugValue:fm,useDeferredValue:function(i,l){var o=Yt();return yS(o,Ct.memoizedState,i,l)},useTransition:function(){var i=Du(Sr)[0],l=Yt().memoizedState;return[typeof i=="boolean"?i:co(i),l]},useSyncExternalStore:Yw,useId:wS,useHostTransitionStatus:mm,useFormState:sS,useActionState:sS,useOptimistic:function(i,l){var o=Yt();return Ww(o,Ct,i,l)},useMemoCache:lm,useCacheRefresh:SS};ym.useEffectEvent=uS;var TS={readContext:gn,use:Ru,useCallback:mS,useContext:gn,useEffect:dm,useImperativeHandle:pS,useInsertionEffect:dS,useLayoutEffect:fS,useMemo:gS,useReducer:om,useRef:oS,useState:function(){return om(Sr)},useDebugValue:fm,useDeferredValue:function(i,l){var o=Yt();return Ct===null?hm(o,i,l):yS(o,Ct.memoizedState,i,l)},useTransition:function(){var i=om(Sr)[0],l=Yt().memoizedState;return[typeof i=="boolean"?i:co(i),l]},useSyncExternalStore:Yw,useId:wS,useHostTransitionStatus:mm,useFormState:aS,useActionState:aS,useOptimistic:function(i,l){var o=Yt();return Ct!==null?Ww(o,Ct,i,l):(o.baseState=i,[i,o.queue.dispatch])},useMemoCache:lm,useCacheRefresh:SS};TS.useEffectEvent=uS;function bm(i,l,o,d){l=i.memoizedState,o=o(d,l),o=o==null?l:b({},l,o),i.memoizedState=o,i.lanes===0&&(i.updateQueue.baseState=o)}var xm={enqueueSetState:function(i,l,o){i=i._reactInternals;var d=oi(),m=as(d);m.payload=l,o!=null&&(m.callback=o),l=os(i,m,d),l!==null&&(Xn(l,i,d),so(l,i,d))},enqueueReplaceState:function(i,l,o){i=i._reactInternals;var d=oi(),m=as(d);m.tag=1,m.payload=l,o!=null&&(m.callback=o),l=os(i,m,d),l!==null&&(Xn(l,i,d),so(l,i,d))},enqueueForceUpdate:function(i,l){i=i._reactInternals;var o=oi(),d=as(o);d.tag=2,l!=null&&(d.callback=l),l=os(i,d,o),l!==null&&(Xn(l,i,o),so(l,i,o))}};function jS(i,l,o,d,m,y,S){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(d,y,S):l.prototype&&l.prototype.isPureReactComponent?!Qa(o,d)||!Qa(m,y):!0}function ES(i,l,o,d){i=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(o,d),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(o,d),l.state!==i&&xm.enqueueReplaceState(l,l.state,null)}function Qs(i,l){var o=l;if("ref"in l){o={};for(var d in l)d!=="ref"&&(o[d]=l[d])}if(i=i.defaultProps){o===l&&(o=b({},o));for(var m in i)o[m]===void 0&&(o[m]=i[m])}return o}function OS(i){pu(i)}function MS(i){console.error(i)}function RS(i){pu(i)}function Bu(i,l){try{var o=i.onUncaughtError;o(l.value,{componentStack:l.stack})}catch(d){setTimeout(function(){throw d})}}function DS(i,l,o){try{var d=i.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function vm(i,l,o){return o=as(o),o.tag=3,o.payload={element:null},o.callback=function(){Bu(i,l)},o}function _S(i){return i=as(i),i.tag=3,i}function LS(i,l,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var y=d.value;i.payload=function(){return m(y)},i.callback=function(){DS(l,o,d)}}var S=o.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(i.callback=function(){DS(l,o,d),typeof m!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var N=d.stack;this.componentDidCatch(d.value,{componentStack:N!==null?N:""})})}function GR(i,l,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(l=o.alternate,l!==null&&Bl(l,o,m,!0),o=ri.current,o!==null){switch(o.tag){case 31:case 13:return Ni===null?Xu():o.alternate===null&&It===0&&(It=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===ku?o.flags|=16384:(l=o.updateQueue,l===null?o.updateQueue=new Set([d]):l.add(d),Pm(i,d,m)),!1;case 22:return o.flags|=65536,d===ku?o.flags|=16384:(l=o.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=l):(o=l.retryQueue,o===null?l.retryQueue=new Set([d]):o.add(d)),Pm(i,d,m)),!1}throw Error(r(435,o.tag))}return Pm(i,d,m),Xu(),!1}if(pt)return l=ri.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,d!==Ip&&(i=Error(r(422),{cause:d}),eo(Si(i,o)))):(d!==Ip&&(l=Error(r(423),{cause:d}),eo(Si(l,o))),i=i.current.alternate,i.flags|=65536,m&=-m,i.lanes|=m,d=Si(d,o),m=vm(i.stateNode,d,m),Jp(i,m),It!==4&&(It=2)),!1;var y=Error(r(520),{cause:d});if(y=Si(y,o),vo===null?vo=[y]:vo.push(y),It!==4&&(It=2),l===null)return!0;d=Si(d,o),o=l;do{switch(o.tag){case 3:return o.flags|=65536,i=m&-m,o.lanes|=i,i=vm(o.stateNode,d,i),Jp(o,i),!1;case 1:if(l=o.type,y=o.stateNode,(o.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(ps===null||!ps.has(y))))return o.flags|=65536,m&=-m,o.lanes|=m,m=_S(m),LS(m,i,o,d),Jp(o,m),!1}o=o.return}while(o!==null);return!1}var wm=Error(r(461)),Qt=!1;function yn(i,l,o,d){l.child=i===null?Iw(l,null,o,d):Xs(l,i.child,o,d)}function qS(i,l,o,d,m){o=o.render;var y=l.ref;if("ref"in d){var S={};for(var N in d)N!=="ref"&&(S[N]=d[N])}else S=d;return Ps(l),d=nm(i,l,o,S,y,m),N=im(),i!==null&&!Qt?(rm(i,l,m),Ar(i,l,m)):(pt&&N&&Bp(l),l.flags|=1,yn(i,l,d,m),l.child)}function BS(i,l,o,d,m){if(i===null){var y=o.type;return typeof y=="function"&&!_p(y)&&y.defaultProps===void 0&&o.compare===null?(l.tag=15,l.type=y,$S(i,l,y,d,m)):(i=bu(o.type,null,d,l,l.mode,m),i.ref=l.ref,i.return=l,l.child=i)}if(y=i.child,!Em(i,m)){var S=y.memoizedProps;if(o=o.compare,o=o!==null?o:Qa,o(S,d)&&i.ref===l.ref)return Ar(i,l,m)}return l.flags|=1,i=yr(y,d),i.ref=l.ref,i.return=l,l.child=i}function $S(i,l,o,d,m){if(i!==null){var y=i.memoizedProps;if(Qa(y,d)&&i.ref===l.ref)if(Qt=!1,l.pendingProps=d=y,Em(i,m))(i.flags&131072)!==0&&(Qt=!0);else return l.lanes=i.lanes,Ar(i,l,m)}return Sm(i,l,o,d,m)}function IS(i,l,o,d){var m=d.children,y=i!==null?i.memoizedState:null;if(i===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((l.flags&128)!==0){if(y=y!==null?y.baseLanes|o:o,i!==null){for(d=l.child=i.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~y}else d=0,l.child=null;return HS(i,l,y,o,d)}if((o&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},i!==null&&Su(l,y!==null?y.cachePool:null),y!==null?Uw(l,y):Wp(),Vw(l);else return d=l.lanes=536870912,HS(i,l,y!==null?y.baseLanes|o:o,o,d)}else y!==null?(Su(l,y.cachePool),Uw(l,y),us(),l.memoizedState=null):(i!==null&&Su(l,null),Wp(),us());return yn(i,l,m,o),l.child}function ho(i,l){return i!==null&&i.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function HS(i,l,o,d,m){var y=Yp();return y=y===null?null:{parent:Xt._currentValue,pool:y},l.memoizedState={baseLanes:o,cachePool:y},i!==null&&Su(l,null),Wp(),Vw(l),i!==null&&Bl(i,l,d,!0),l.childLanes=m,null}function $u(i,l){return l=Hu({mode:l.mode,children:l.children},i.mode),l.ref=i.ref,i.child=l,l.return=i,l}function zS(i,l,o){return Xs(l,i.child,null,o),i=$u(l,l.pendingProps),i.flags|=2,si(l),l.memoizedState=null,i}function XR(i,l,o){var d=l.pendingProps,m=(l.flags&128)!==0;if(l.flags&=-129,i===null){if(pt){if(d.mode==="hidden")return i=$u(l,d),l.lanes=536870912,ho(null,i);if(em(l),(i=Dt)?(i=Z2(i,Ci),i=i!==null&&i.data==="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:ns!==null?{id:Wi,overflow:Zi}:null,retryLane:536870912,hydrationErrors:null},o=kw(i),o.return=l,l.child=o,mn=l,Dt=null)):i=null,i===null)throw rs(l);return l.lanes=536870912,null}return $u(l,d)}var y=i.memoizedState;if(y!==null){var S=y.dehydrated;if(em(l),m)if(l.flags&256)l.flags&=-257,l=zS(i,l,o);else if(l.memoizedState!==null)l.child=i.child,l.flags|=128,l=null;else throw Error(r(558));else if(Qt||Bl(i,l,o,!1),m=(o&i.childLanes)!==0,Qt||m){if(d=Ot,d!==null&&(S=Ee(d,o),S!==0&&S!==y.retryLane))throw y.retryLane=S,zs(i,S),Xn(d,i,S),wm;Xu(),l=zS(i,l,o)}else i=y.treeContext,Dt=Ti(S.nextSibling),mn=l,pt=!0,is=null,Ci=!1,i!==null&&Tw(l,i),l=$u(l,d),l.flags|=4096;return l}return i=yr(i.child,{mode:d.mode,children:d.children}),i.ref=l.ref,l.child=i,i.return=l,i}function Iu(i,l){var o=l.ref;if(o===null)i!==null&&i.ref!==null&&(l.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(i===null||i.ref!==o)&&(l.flags|=4194816)}}function Sm(i,l,o,d,m){return Ps(l),o=nm(i,l,o,d,void 0,m),d=im(),i!==null&&!Qt?(rm(i,l,m),Ar(i,l,m)):(pt&&d&&Bp(l),l.flags|=1,yn(i,l,o,m),l.child)}function US(i,l,o,d,m,y){return Ps(l),l.updateQueue=null,o=Pw(l,d,o,m),Fw(i),d=im(),i!==null&&!Qt?(rm(i,l,y),Ar(i,l,y)):(pt&&d&&Bp(l),l.flags|=1,yn(i,l,o,y),l.child)}function VS(i,l,o,d,m){if(Ps(l),l.stateNode===null){var y=Dl,S=o.contextType;typeof S=="object"&&S!==null&&(y=gn(S)),y=new o(d,y),l.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=xm,l.stateNode=y,y._reactInternals=l,y=l.stateNode,y.props=d,y.state=l.memoizedState,y.refs={},Gp(l),S=o.contextType,y.context=typeof S=="object"&&S!==null?gn(S):Dl,y.state=l.memoizedState,S=o.getDerivedStateFromProps,typeof S=="function"&&(bm(l,o,S,d),y.state=l.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(S=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),S!==y.state&&xm.enqueueReplaceState(y,y.state,null),ao(l,d,y,m),lo(),y.state=l.memoizedState),typeof y.componentDidMount=="function"&&(l.flags|=4194308),d=!0}else if(i===null){y=l.stateNode;var N=l.memoizedProps,$=Qs(o,N);y.props=$;var te=y.context,de=o.contextType;S=Dl,typeof de=="object"&&de!==null&&(S=gn(de));var be=o.getDerivedStateFromProps;de=typeof be=="function"||typeof y.getSnapshotBeforeUpdate=="function",N=l.pendingProps!==N,de||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N||te!==S)&&ES(l,y,d,S),ls=!1;var ie=l.memoizedState;y.state=ie,ao(l,d,y,m),lo(),te=l.memoizedState,N||ie!==te||ls?(typeof be=="function"&&(bm(l,o,be,d),te=l.memoizedState),($=ls||jS(l,o,$,d,ie,te,S))?(de||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(l.flags|=4194308)):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=d,l.memoizedState=te),y.props=d,y.state=te,y.context=S,d=$):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),d=!1)}else{y=l.stateNode,Xp(i,l),S=l.memoizedProps,de=Qs(o,S),y.props=de,be=l.pendingProps,ie=y.context,te=o.contextType,$=Dl,typeof te=="object"&&te!==null&&($=gn(te)),N=o.getDerivedStateFromProps,(te=typeof N=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==be||ie!==$)&&ES(l,y,d,$),ls=!1,ie=l.memoizedState,y.state=ie,ao(l,d,y,m),lo();var le=l.memoizedState;S!==be||ie!==le||ls||i!==null&&i.dependencies!==null&&vu(i.dependencies)?(typeof N=="function"&&(bm(l,o,N,d),le=l.memoizedState),(de=ls||jS(l,o,de,d,ie,le,$)||i!==null&&i.dependencies!==null&&vu(i.dependencies))?(te||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,le,$),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,le,$)),typeof y.componentDidUpdate=="function"&&(l.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof y.componentDidUpdate!="function"||S===i.memoizedProps&&ie===i.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===i.memoizedProps&&ie===i.memoizedState||(l.flags|=1024),l.memoizedProps=d,l.memoizedState=le),y.props=d,y.state=le,y.context=$,d=de):(typeof y.componentDidUpdate!="function"||S===i.memoizedProps&&ie===i.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===i.memoizedProps&&ie===i.memoizedState||(l.flags|=1024),d=!1)}return y=d,Iu(i,l),d=(l.flags&128)!==0,y||d?(y=l.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:y.render(),l.flags|=1,i!==null&&d?(l.child=Xs(l,i.child,null,m),l.child=Xs(l,null,o,m)):yn(i,l,o,m),l.memoizedState=y.state,i=l.child):i=Ar(i,l,m),i}function FS(i,l,o,d){return Vs(),l.flags|=256,yn(i,l,o,d),l.child}var Am={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function km(i){return{baseLanes:i,cachePool:Dw()}}function Cm(i,l,o){return i=i!==null?i.childLanes&~o:0,l&&(i|=ai),i}function PS(i,l,o){var d=l.pendingProps,m=!1,y=(l.flags&128)!==0,S;if((S=y)||(S=i!==null&&i.memoizedState===null?!1:(Pt.current&2)!==0),S&&(m=!0,l.flags&=-129),S=(l.flags&32)!==0,l.flags&=-33,i===null){if(pt){if(m?cs(l):us(),(i=Dt)?(i=Z2(i,Ci),i=i!==null&&i.data!=="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:ns!==null?{id:Wi,overflow:Zi}:null,retryLane:536870912,hydrationErrors:null},o=kw(i),o.return=l,l.child=o,mn=l,Dt=null)):i=null,i===null)throw rs(l);return ag(i)?l.lanes=32:l.lanes=536870912,null}var N=d.children;return d=d.fallback,m?(us(),m=l.mode,N=Hu({mode:"hidden",children:N},m),d=Us(d,m,o,null),N.return=l,d.return=l,N.sibling=d,l.child=N,d=l.child,d.memoizedState=km(o),d.childLanes=Cm(i,S,o),l.memoizedState=Am,ho(null,d)):(cs(l),Nm(l,N))}var $=i.memoizedState;if($!==null&&(N=$.dehydrated,N!==null)){if(y)l.flags&256?(cs(l),l.flags&=-257,l=Tm(i,l,o)):l.memoizedState!==null?(us(),l.child=i.child,l.flags|=128,l=null):(us(),N=d.fallback,m=l.mode,d=Hu({mode:"visible",children:d.children},m),N=Us(N,m,o,null),N.flags|=2,d.return=l,N.return=l,d.sibling=N,l.child=d,Xs(l,i.child,null,o),d=l.child,d.memoizedState=km(o),d.childLanes=Cm(i,S,o),l.memoizedState=Am,l=ho(null,d));else if(cs(l),ag(N)){if(S=N.nextSibling&&N.nextSibling.dataset,S)var te=S.dgst;S=te,d=Error(r(419)),d.stack="",d.digest=S,eo({value:d,source:null,stack:null}),l=Tm(i,l,o)}else if(Qt||Bl(i,l,o,!1),S=(o&i.childLanes)!==0,Qt||S){if(S=Ot,S!==null&&(d=Ee(S,o),d!==0&&d!==$.retryLane))throw $.retryLane=d,zs(i,d),Xn(S,i,d),wm;lg(N)||Xu(),l=Tm(i,l,o)}else lg(N)?(l.flags|=192,l.child=i.child,l=null):(i=$.treeContext,Dt=Ti(N.nextSibling),mn=l,pt=!0,is=null,Ci=!1,i!==null&&Tw(l,i),l=Nm(l,d.children),l.flags|=4096);return l}return m?(us(),N=d.fallback,m=l.mode,$=i.child,te=$.sibling,d=yr($,{mode:"hidden",children:d.children}),d.subtreeFlags=$.subtreeFlags&65011712,te!==null?N=yr(te,N):(N=Us(N,m,o,null),N.flags|=2),N.return=l,d.return=l,d.sibling=N,l.child=d,ho(null,d),d=l.child,N=i.child.memoizedState,N===null?N=km(o):(m=N.cachePool,m!==null?($=Xt._currentValue,m=m.parent!==$?{parent:$,pool:$}:m):m=Dw(),N={baseLanes:N.baseLanes|o,cachePool:m}),d.memoizedState=N,d.childLanes=Cm(i,S,o),l.memoizedState=Am,ho(i.child,d)):(cs(l),o=i.child,i=o.sibling,o=yr(o,{mode:"visible",children:d.children}),o.return=l,o.sibling=null,i!==null&&(S=l.deletions,S===null?(l.deletions=[i],l.flags|=16):S.push(i)),l.child=o,l.memoizedState=null,o)}function Nm(i,l){return l=Hu({mode:"visible",children:l},i.mode),l.return=i,i.child=l}function Hu(i,l){return i=ii(22,i,null,l),i.lanes=0,i}function Tm(i,l,o){return Xs(l,i.child,null,o),i=Nm(l,l.pendingProps.children),i.flags|=2,l.memoizedState=null,i}function YS(i,l,o){i.lanes|=l;var d=i.alternate;d!==null&&(d.lanes|=l),Up(i.return,l,o)}function jm(i,l,o,d,m,y){var S=i.memoizedState;S===null?i.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:y}:(S.isBackwards=l,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=o,S.tailMode=m,S.treeForkCount=y)}function KS(i,l,o){var d=l.pendingProps,m=d.revealOrder,y=d.tail;d=d.children;var S=Pt.current,N=(S&2)!==0;if(N?(S=S&1|2,l.flags|=128):S&=1,he(Pt,S),yn(i,l,d,o),d=pt?Za:0,!N&&i!==null&&(i.flags&128)!==0)e:for(i=l.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&YS(i,o,l);else if(i.tag===19)YS(i,o,l);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break e;for(;i.sibling===null;){if(i.return===null||i.return===l)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(m){case"forwards":for(o=l.child,m=null;o!==null;)i=o.alternate,i!==null&&ju(i)===null&&(m=o),o=o.sibling;o=m,o===null?(m=l.child,l.child=null):(m=o.sibling,o.sibling=null),jm(l,!1,m,o,y,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=l.child,l.child=null;m!==null;){if(i=m.alternate,i!==null&&ju(i)===null){l.child=m;break}i=m.sibling,m.sibling=o,o=m,m=i}jm(l,!0,o,null,y,d);break;case"together":jm(l,!1,null,null,void 0,d);break;default:l.memoizedState=null}return l.child}function Ar(i,l,o){if(i!==null&&(l.dependencies=i.dependencies),hs|=l.lanes,(o&l.childLanes)===0)if(i!==null){if(Bl(i,l,o,!1),(o&l.childLanes)===0)return null}else return null;if(i!==null&&l.child!==i.child)throw Error(r(153));if(l.child!==null){for(i=l.child,o=yr(i,i.pendingProps),l.child=o,o.return=l;i.sibling!==null;)i=i.sibling,o=o.sibling=yr(i,i.pendingProps),o.return=l;o.sibling=null}return l.child}function Em(i,l){return(i.lanes&l)!==0?!0:(i=i.dependencies,!!(i!==null&&vu(i)))}function JR(i,l,o){switch(l.tag){case 3:Fe(l,l.stateNode.containerInfo),ss(l,Xt,i.memoizedState.cache),Vs();break;case 27:case 5:Ie(l);break;case 4:Fe(l,l.stateNode.containerInfo);break;case 10:ss(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,em(l),null;break;case 13:var d=l.memoizedState;if(d!==null)return d.dehydrated!==null?(cs(l),l.flags|=128,null):(o&l.child.childLanes)!==0?PS(i,l,o):(cs(l),i=Ar(i,l,o),i!==null?i.sibling:null);cs(l);break;case 19:var m=(i.flags&128)!==0;if(d=(o&l.childLanes)!==0,d||(Bl(i,l,o,!1),d=(o&l.childLanes)!==0),m){if(d)return KS(i,l,o);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),he(Pt,Pt.current),d)break;return null;case 22:return l.lanes=0,IS(i,l,o,l.pendingProps);case 24:ss(l,Xt,i.memoizedState.cache)}return Ar(i,l,o)}function GS(i,l,o){if(i!==null)if(i.memoizedProps!==l.pendingProps)Qt=!0;else{if(!Em(i,o)&&(l.flags&128)===0)return Qt=!1,JR(i,l,o);Qt=(i.flags&131072)!==0}else Qt=!1,pt&&(l.flags&1048576)!==0&&Nw(l,Za,l.index);switch(l.lanes=0,l.tag){case 16:e:{var d=l.pendingProps;if(i=Ks(l.elementType),l.type=i,typeof i=="function")_p(i)?(d=Qs(i,d),l.tag=1,l=VS(null,l,i,d,o)):(l.tag=0,l=Sm(null,l,i,d,o));else{if(i!=null){var m=i.$$typeof;if(m===R){l.tag=11,l=qS(null,l,i,d,o);break e}else if(m===O){l.tag=14,l=BS(null,l,i,d,o);break e}}throw l=pe(i)||i,Error(r(306,l,""))}}return l;case 0:return Sm(i,l,l.type,l.pendingProps,o);case 1:return d=l.type,m=Qs(d,l.pendingProps),VS(i,l,d,m,o);case 3:e:{if(Fe(l,l.stateNode.containerInfo),i===null)throw Error(r(387));d=l.pendingProps;var y=l.memoizedState;m=y.element,Xp(i,l),ao(l,d,null,o);var S=l.memoizedState;if(d=S.cache,ss(l,Xt,d),d!==y.cache&&Vp(l,[Xt],o,!0),lo(),d=S.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:S.cache},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){l=FS(i,l,d,o);break e}else if(d!==m){m=Si(Error(r(424)),l),eo(m),l=FS(i,l,d,o);break e}else for(i=l.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Dt=Ti(i.firstChild),mn=l,pt=!0,is=null,Ci=!0,o=Iw(l,null,d,o),l.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Vs(),d===m){l=Ar(i,l,o);break e}yn(i,l,d,o)}l=l.child}return l;case 26:return Iu(i,l),i===null?(o=sA(l.type,null,l.pendingProps,null))?l.memoizedState=o:pt||(o=l.type,i=l.pendingProps,d=nd(qe.current).createElement(o),d[Ft]=l,d[Kt]=i,bn(d,o,i),Gt(d),l.stateNode=d):l.memoizedState=sA(l.type,i.memoizedProps,l.pendingProps,i.memoizedState),null;case 27:return Ie(l),i===null&&pt&&(d=l.stateNode=nA(l.type,l.pendingProps,qe.current),mn=l,Ci=!0,m=Dt,bs(l.type)?(og=m,Dt=Ti(d.firstChild)):Dt=m),yn(i,l,l.pendingProps.children,o),Iu(i,l),i===null&&(l.flags|=4194304),l.child;case 5:return i===null&&pt&&((m=d=Dt)&&(d=N4(d,l.type,l.pendingProps,Ci),d!==null?(l.stateNode=d,mn=l,Dt=Ti(d.firstChild),Ci=!1,m=!0):m=!1),m||rs(l)),Ie(l),m=l.type,y=l.pendingProps,S=i!==null?i.memoizedProps:null,d=y.children,ig(m,y)?d=null:S!==null&&ig(m,S)&&(l.flags|=32),l.memoizedState!==null&&(m=nm(i,l,zR,null,null,o),jo._currentValue=m),Iu(i,l),yn(i,l,d,o),l.child;case 6:return i===null&&pt&&((i=o=Dt)&&(o=T4(o,l.pendingProps,Ci),o!==null?(l.stateNode=o,mn=l,Dt=null,i=!0):i=!1),i||rs(l)),null;case 13:return PS(i,l,o);case 4:return Fe(l,l.stateNode.containerInfo),d=l.pendingProps,i===null?l.child=Xs(l,null,d,o):yn(i,l,d,o),l.child;case 11:return qS(i,l,l.type,l.pendingProps,o);case 7:return yn(i,l,l.pendingProps,o),l.child;case 8:return yn(i,l,l.pendingProps.children,o),l.child;case 12:return yn(i,l,l.pendingProps.children,o),l.child;case 10:return d=l.pendingProps,ss(l,l.type,d.value),yn(i,l,d.children,o),l.child;case 9:return m=l.type._context,d=l.pendingProps.children,Ps(l),m=gn(m),d=d(m),l.flags|=1,yn(i,l,d,o),l.child;case 14:return BS(i,l,l.type,l.pendingProps,o);case 15:return $S(i,l,l.type,l.pendingProps,o);case 19:return KS(i,l,o);case 31:return XR(i,l,o);case 22:return IS(i,l,o,l.pendingProps);case 24:return Ps(l),d=gn(Xt),i===null?(m=Yp(),m===null&&(m=Ot,y=Fp(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=o),m=y),l.memoizedState={parent:d,cache:m},Gp(l),ss(l,Xt,m)):((i.lanes&o)!==0&&(Xp(i,l),ao(l,null,null,o),lo()),m=i.memoizedState,y=l.memoizedState,m.parent!==d?(m={parent:d,cache:d},l.memoizedState=m,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=m),ss(l,Xt,d)):(d=y.cache,ss(l,Xt,d),d!==m.cache&&Vp(l,[Xt],o,!0))),yn(i,l,l.pendingProps.children,o),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function kr(i){i.flags|=4}function Om(i,l,o,d,m){if((l=(i.mode&32)!==0)&&(l=!1),l){if(i.flags|=16777216,(m&335544128)===m)if(i.stateNode.complete)i.flags|=8192;else if(w2())i.flags|=8192;else throw Gs=ku,Kp}else i.flags&=-16777217}function XS(i,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!uA(l))if(w2())i.flags|=8192;else throw Gs=ku,Kp}function zu(i,l){l!==null&&(i.flags|=4),i.flags&16384&&(l=i.tag!==22?pn():536870912,i.lanes|=l,Xl|=l)}function po(i,l){if(!pt)switch(i.tailMode){case"hidden":l=i.tail;for(var o=null;l!==null;)l.alternate!==null&&(o=l),l=l.sibling;o===null?i.tail=null:o.sibling=null;break;case"collapsed":o=i.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?l||i.tail===null?i.tail=null:i.tail.sibling=null:d.sibling=null}}function _t(i){var l=i.alternate!==null&&i.alternate.child===i.child,o=0,d=0;if(l)for(var m=i.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=i,m=m.sibling;else for(m=i.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=i,m=m.sibling;return i.subtreeFlags|=d,i.childLanes=o,l}function QR(i,l,o){var d=l.pendingProps;switch($p(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(l),null;case 1:return _t(l),null;case 3:return o=l.stateNode,d=null,i!==null&&(d=i.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),vr(Xt),Ye(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(i===null||i.child===null)&&(ql(l)?kr(l):i===null||i.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Hp())),_t(l),null;case 26:var m=l.type,y=l.memoizedState;return i===null?(kr(l),y!==null?(_t(l),XS(l,y)):(_t(l),Om(l,m,null,d,o))):y?y!==i.memoizedState?(kr(l),_t(l),XS(l,y)):(_t(l),l.flags&=-16777217):(i=i.memoizedProps,i!==d&&kr(l),_t(l),Om(l,m,i,d,o)),null;case 27:if(ut(l),o=qe.current,m=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==d&&kr(l);else{if(!d){if(l.stateNode===null)throw Error(r(166));return _t(l),null}i=ne.current,ql(l)?jw(l):(i=nA(m,d,o),l.stateNode=i,kr(l))}return _t(l),null;case 5:if(ut(l),m=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==d&&kr(l);else{if(!d){if(l.stateNode===null)throw Error(r(166));return _t(l),null}if(y=ne.current,ql(l))jw(l);else{var S=nd(qe.current);switch(y){case 1:y=S.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=S.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=S.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?S.createElement(m,{is:d.is}):S.createElement(m)}}y[Ft]=l,y[Kt]=d;e:for(S=l.child;S!==null;){if(S.tag===5||S.tag===6)y.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===l)break e;for(;S.sibling===null;){if(S.return===null||S.return===l)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}l.stateNode=y;e:switch(bn(y,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&kr(l)}}return _t(l),Om(l,l.type,i===null?null:i.memoizedProps,l.pendingProps,o),null;case 6:if(i&&l.stateNode!=null)i.memoizedProps!==d&&kr(l);else{if(typeof d!="string"&&l.stateNode===null)throw Error(r(166));if(i=qe.current,ql(l)){if(i=l.stateNode,o=l.memoizedProps,d=null,m=mn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}i[Ft]=l,i=!!(i.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||P2(i.nodeValue,o)),i||rs(l,!0)}else i=nd(i).createTextNode(d),i[Ft]=l,l.stateNode=i}return _t(l),null;case 31:if(o=l.memoizedState,i===null||i.memoizedState!==null){if(d=ql(l),o!==null){if(i===null){if(!d)throw Error(r(318));if(i=l.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Ft]=l}else Vs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;_t(l),i=!1}else o=Hp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=o),i=!0;if(!i)return l.flags&256?(si(l),l):(si(l),null);if((l.flags&128)!==0)throw Error(r(558))}return _t(l),null;case 13:if(d=l.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(m=ql(l),d!==null&&d.dehydrated!==null){if(i===null){if(!m)throw Error(r(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(r(317));m[Ft]=l}else Vs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;_t(l),m=!1}else m=Hp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(si(l),l):(si(l),null)}return si(l),(l.flags&128)!==0?(l.lanes=o,l):(o=d!==null,i=i!==null&&i.memoizedState!==null,o&&(d=l.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==m&&(d.flags|=2048)),o!==i&&o&&(l.child.flags|=8192),zu(l,l.updateQueue),_t(l),null);case 4:return Ye(),i===null&&Wm(l.stateNode.containerInfo),_t(l),null;case 10:return vr(l.type),_t(l),null;case 19:if(z(Pt),d=l.memoizedState,d===null)return _t(l),null;if(m=(l.flags&128)!==0,y=d.rendering,y===null)if(m)po(d,!1);else{if(It!==0||i!==null&&(i.flags&128)!==0)for(i=l.child;i!==null;){if(y=ju(i),y!==null){for(l.flags|=128,po(d,!1),i=y.updateQueue,l.updateQueue=i,zu(l,i),l.subtreeFlags=0,i=o,o=l.child;o!==null;)Aw(o,i),o=o.sibling;return he(Pt,Pt.current&1|2),pt&&br(l,d.treeForkCount),l.child}i=i.sibling}d.tail!==null&&ht()>Yu&&(l.flags|=128,m=!0,po(d,!1),l.lanes=4194304)}else{if(!m)if(i=ju(y),i!==null){if(l.flags|=128,m=!0,i=i.updateQueue,l.updateQueue=i,zu(l,i),po(d,!0),d.tail===null&&d.tailMode==="hidden"&&!y.alternate&&!pt)return _t(l),null}else 2*ht()-d.renderingStartTime>Yu&&o!==536870912&&(l.flags|=128,m=!0,po(d,!1),l.lanes=4194304);d.isBackwards?(y.sibling=l.child,l.child=y):(i=d.last,i!==null?i.sibling=y:l.child=y,d.last=y)}return d.tail!==null?(i=d.tail,d.rendering=i,d.tail=i.sibling,d.renderingStartTime=ht(),i.sibling=null,o=Pt.current,he(Pt,m?o&1|2:o&1),pt&&br(l,d.treeForkCount),i):(_t(l),null);case 22:case 23:return si(l),Zp(),d=l.memoizedState!==null,i!==null?i.memoizedState!==null!==d&&(l.flags|=8192):d&&(l.flags|=8192),d?(o&536870912)!==0&&(l.flags&128)===0&&(_t(l),l.subtreeFlags&6&&(l.flags|=8192)):_t(l),o=l.updateQueue,o!==null&&zu(l,o.retryQueue),o=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==o&&(l.flags|=2048),i!==null&&z(Ys),null;case 24:return o=null,i!==null&&(o=i.memoizedState.cache),l.memoizedState.cache!==o&&(l.flags|=2048),vr(Xt),_t(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function WR(i,l){switch($p(l),l.tag){case 1:return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 3:return vr(Xt),Ye(),i=l.flags,(i&65536)!==0&&(i&128)===0?(l.flags=i&-65537|128,l):null;case 26:case 27:case 5:return ut(l),null;case 31:if(l.memoizedState!==null){if(si(l),l.alternate===null)throw Error(r(340));Vs()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 13:if(si(l),i=l.memoizedState,i!==null&&i.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Vs()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 19:return z(Pt),null;case 4:return Ye(),null;case 10:return vr(l.type),null;case 22:case 23:return si(l),Zp(),i!==null&&z(Ys),i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 24:return vr(Xt),null;case 25:return null;default:return null}}function JS(i,l){switch($p(l),l.tag){case 3:vr(Xt),Ye();break;case 26:case 27:case 5:ut(l);break;case 4:Ye();break;case 31:l.memoizedState!==null&&si(l);break;case 13:si(l);break;case 19:z(Pt);break;case 10:vr(l.type);break;case 22:case 23:si(l),Zp(),i!==null&&z(Ys);break;case 24:vr(Xt)}}function mo(i,l){try{var o=l.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&i)===i){d=void 0;var y=o.create,S=o.inst;d=y(),S.destroy=d}o=o.next}while(o!==m)}}catch(N){At(l,l.return,N)}}function ds(i,l,o){try{var d=l.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var y=m.next;d=y;do{if((d.tag&i)===i){var S=d.inst,N=S.destroy;if(N!==void 0){S.destroy=void 0,m=l;var $=o,te=N;try{te()}catch(de){At(m,$,de)}}}d=d.next}while(d!==y)}}catch(de){At(l,l.return,de)}}function QS(i){var l=i.updateQueue;if(l!==null){var o=i.stateNode;try{zw(l,o)}catch(d){At(i,i.return,d)}}}function WS(i,l,o){o.props=Qs(i.type,i.memoizedProps),o.state=i.memoizedState;try{o.componentWillUnmount()}catch(d){At(i,l,d)}}function go(i,l){try{var o=i.ref;if(o!==null){switch(i.tag){case 26:case 27:case 5:var d=i.stateNode;break;case 30:d=i.stateNode;break;default:d=i.stateNode}typeof o=="function"?i.refCleanup=o(d):o.current=d}}catch(m){At(i,l,m)}}function er(i,l){var o=i.ref,d=i.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){At(i,l,m)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){At(i,l,m)}else o.current=null}function ZS(i){var l=i.type,o=i.memoizedProps,d=i.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){At(i,i.return,m)}}function Mm(i,l,o){try{var d=i.stateNode;v4(d,i.type,o,l),d[Kt]=l}catch(m){At(i,i.return,m)}}function e2(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&bs(i.type)||i.tag===4}function Rm(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||e2(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.tag===27&&bs(i.type)||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 Dm(i,l,o){var d=i.tag;if(d===5||d===6)i=i.stateNode,l?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(i,l):(l=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,l.appendChild(i),o=o._reactRootContainer,o!=null||l.onclick!==null||(l.onclick=mr));else if(d!==4&&(d===27&&bs(i.type)&&(o=i.stateNode,l=null),i=i.child,i!==null))for(Dm(i,l,o),i=i.sibling;i!==null;)Dm(i,l,o),i=i.sibling}function Uu(i,l,o){var d=i.tag;if(d===5||d===6)i=i.stateNode,l?o.insertBefore(i,l):o.appendChild(i);else if(d!==4&&(d===27&&bs(i.type)&&(o=i.stateNode),i=i.child,i!==null))for(Uu(i,l,o),i=i.sibling;i!==null;)Uu(i,l,o),i=i.sibling}function t2(i){var l=i.stateNode,o=i.memoizedProps;try{for(var d=i.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);bn(l,d,o),l[Ft]=i,l[Kt]=o}catch(y){At(i,i.return,y)}}var Cr=!1,Wt=!1,_m=!1,n2=typeof WeakSet=="function"?WeakSet:Set,ln=null;function ZR(i,l){if(i=i.containerInfo,tg=cd,i=pw(i),Tp(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var S=0,N=-1,$=-1,te=0,de=0,be=i,ie=null;t:for(;;){for(var le;be!==o||m!==0&&be.nodeType!==3||(N=S+m),be!==y||d!==0&&be.nodeType!==3||($=S+d),be.nodeType===3&&(S+=be.nodeValue.length),(le=be.firstChild)!==null;)ie=be,be=le;for(;;){if(be===i)break t;if(ie===o&&++te===m&&(N=S),ie===y&&++de===d&&($=S),(le=be.nextSibling)!==null)break;be=ie,ie=be.parentNode}be=le}o=N===-1||$===-1?null:{start:N,end:$}}else o=null}o=o||{start:0,end:0}}else o=null;for(ng={focusedElem:i,selectionRange:o},cd=!1,ln=l;ln!==null;)if(l=ln,i=l.child,(l.subtreeFlags&1028)!==0&&i!==null)i.return=l,ln=i;else for(;ln!==null;){switch(l=ln,y=l.alternate,i=l.flags,l.tag){case 0:if((i&4)!==0&&(i=l.updateQueue,i=i!==null?i.events:null,i!==null))for(o=0;o<i.length;o++)m=i[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&y!==null){i=void 0,o=l,m=y.memoizedProps,y=y.memoizedState,d=o.stateNode;try{var Be=Qs(o.type,m);i=d.getSnapshotBeforeUpdate(Be,y),d.__reactInternalSnapshotBeforeUpdate=i}catch(Ge){At(o,o.return,Ge)}}break;case 3:if((i&1024)!==0){if(i=l.stateNode.containerInfo,o=i.nodeType,o===9)sg(i);else if(o===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":sg(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=l.sibling,i!==null){i.return=l.return,ln=i;break}ln=l.return}}function i2(i,l,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:Tr(i,o),d&4&&mo(5,o);break;case 1:if(Tr(i,o),d&4)if(i=o.stateNode,l===null)try{i.componentDidMount()}catch(S){At(o,o.return,S)}else{var m=Qs(o.type,l.memoizedProps);l=l.memoizedState;try{i.componentDidUpdate(m,l,i.__reactInternalSnapshotBeforeUpdate)}catch(S){At(o,o.return,S)}}d&64&&QS(o),d&512&&go(o,o.return);break;case 3:if(Tr(i,o),d&64&&(i=o.updateQueue,i!==null)){if(l=null,o.child!==null)switch(o.child.tag){case 27:case 5:l=o.child.stateNode;break;case 1:l=o.child.stateNode}try{zw(i,l)}catch(S){At(o,o.return,S)}}break;case 27:l===null&&d&4&&t2(o);case 26:case 5:Tr(i,o),l===null&&d&4&&ZS(o),d&512&&go(o,o.return);break;case 12:Tr(i,o);break;case 31:Tr(i,o),d&4&&l2(i,o);break;case 13:Tr(i,o),d&4&&a2(i,o),d&64&&(i=o.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(o=o4.bind(null,o),j4(i,o))));break;case 22:if(d=o.memoizedState!==null||Cr,!d){l=l!==null&&l.memoizedState!==null||Wt,m=Cr;var y=Wt;Cr=d,(Wt=l)&&!y?jr(i,o,(o.subtreeFlags&8772)!==0):Tr(i,o),Cr=m,Wt=y}break;case 30:break;default:Tr(i,o)}}function r2(i){var l=i.alternate;l!==null&&(i.alternate=null,r2(l)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(l=i.stateNode,l!==null&&kl(l)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var qt=null,Pn=!1;function Nr(i,l,o){for(o=o.child;o!==null;)s2(i,l,o),o=o.sibling}function s2(i,l,o){if(k&&typeof k.onCommitFiberUnmount=="function")try{k.onCommitFiberUnmount(J,o)}catch{}switch(o.tag){case 26:Wt||er(o,l),Nr(i,l,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Wt||er(o,l);var d=qt,m=Pn;bs(o.type)&&(qt=o.stateNode,Pn=!1),Nr(i,l,o),Co(o.stateNode),qt=d,Pn=m;break;case 5:Wt||er(o,l);case 6:if(d=qt,m=Pn,qt=null,Nr(i,l,o),qt=d,Pn=m,qt!==null)if(Pn)try{(qt.nodeType===9?qt.body:qt.nodeName==="HTML"?qt.ownerDocument.body:qt).removeChild(o.stateNode)}catch(y){At(o,l,y)}else try{qt.removeChild(o.stateNode)}catch(y){At(o,l,y)}break;case 18:qt!==null&&(Pn?(i=qt,Q2(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,o.stateNode),ia(i)):Q2(qt,o.stateNode));break;case 4:d=qt,m=Pn,qt=o.stateNode.containerInfo,Pn=!0,Nr(i,l,o),qt=d,Pn=m;break;case 0:case 11:case 14:case 15:ds(2,o,l),Wt||ds(4,o,l),Nr(i,l,o);break;case 1:Wt||(er(o,l),d=o.stateNode,typeof d.componentWillUnmount=="function"&&WS(o,l,d)),Nr(i,l,o);break;case 21:Nr(i,l,o);break;case 22:Wt=(d=Wt)||o.memoizedState!==null,Nr(i,l,o),Wt=d;break;default:Nr(i,l,o)}}function l2(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{ia(i)}catch(o){At(l,l.return,o)}}}function a2(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{ia(i)}catch(o){At(l,l.return,o)}}function e4(i){switch(i.tag){case 31:case 13:case 19:var l=i.stateNode;return l===null&&(l=i.stateNode=new n2),l;case 22:return i=i.stateNode,l=i._retryCache,l===null&&(l=i._retryCache=new n2),l;default:throw Error(r(435,i.tag))}}function Vu(i,l){var o=e4(i);l.forEach(function(d){if(!o.has(d)){o.add(d);var m=c4.bind(null,i,d);d.then(m,m)}})}function Yn(i,l){var o=l.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],y=i,S=l,N=S;e:for(;N!==null;){switch(N.tag){case 27:if(bs(N.type)){qt=N.stateNode,Pn=!1;break e}break;case 5:qt=N.stateNode,Pn=!1;break e;case 3:case 4:qt=N.stateNode.containerInfo,Pn=!0;break e}N=N.return}if(qt===null)throw Error(r(160));s2(y,S,m),qt=null,Pn=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)o2(l,i),l=l.sibling}var $i=null;function o2(i,l){var o=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Yn(l,i),Kn(i),d&4&&(ds(3,i,i.return),mo(3,i),ds(5,i,i.return));break;case 1:Yn(l,i),Kn(i),d&512&&(Wt||o===null||er(o,o.return)),d&64&&Cr&&(i=i.updateQueue,i!==null&&(d=i.callbacks,d!==null&&(o=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=$i;if(Yn(l,i),Kn(i),d&512&&(Wt||o===null||er(o,o.return)),d&4){var y=o!==null?o.memoizedState:null;if(d=i.memoizedState,o===null)if(d===null)if(i.stateNode===null){e:{d=i.type,o=i.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":y=m.getElementsByTagName("title")[0],(!y||y[Zr]||y[Ft]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(d),m.head.insertBefore(y,m.querySelector("head > title"))),bn(y,d,o),y[Ft]=i,Gt(y),d=y;break e;case"link":var S=oA("link","href",m).get(d+(o.href||""));if(S){for(var N=0;N<S.length;N++)if(y=S[N],y.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&y.getAttribute("rel")===(o.rel==null?null:o.rel)&&y.getAttribute("title")===(o.title==null?null:o.title)&&y.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){S.splice(N,1);break t}}y=m.createElement(d),bn(y,d,o),m.head.appendChild(y);break;case"meta":if(S=oA("meta","content",m).get(d+(o.content||""))){for(N=0;N<S.length;N++)if(y=S[N],y.getAttribute("content")===(o.content==null?null:""+o.content)&&y.getAttribute("name")===(o.name==null?null:o.name)&&y.getAttribute("property")===(o.property==null?null:o.property)&&y.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&y.getAttribute("charset")===(o.charSet==null?null:o.charSet)){S.splice(N,1);break t}}y=m.createElement(d),bn(y,d,o),m.head.appendChild(y);break;default:throw Error(r(468,d))}y[Ft]=i,Gt(y),d=y}i.stateNode=d}else cA(m,i.type,i.stateNode);else i.stateNode=aA(m,d,i.memoizedProps);else y!==d?(y===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):y.count--,d===null?cA(m,i.type,i.stateNode):aA(m,d,i.memoizedProps)):d===null&&i.stateNode!==null&&Mm(i,i.memoizedProps,o.memoizedProps)}break;case 27:Yn(l,i),Kn(i),d&512&&(Wt||o===null||er(o,o.return)),o!==null&&d&4&&Mm(i,i.memoizedProps,o.memoizedProps);break;case 5:if(Yn(l,i),Kn(i),d&512&&(Wt||o===null||er(o,o.return)),i.flags&32){m=i.stateNode;try{Nl(m,"")}catch(Be){At(i,i.return,Be)}}d&4&&i.stateNode!=null&&(m=i.memoizedProps,Mm(i,m,o!==null?o.memoizedProps:m)),d&1024&&(_m=!0);break;case 6:if(Yn(l,i),Kn(i),d&4){if(i.stateNode===null)throw Error(r(162));d=i.memoizedProps,o=i.stateNode;try{o.nodeValue=d}catch(Be){At(i,i.return,Be)}}break;case 3:if(sd=null,m=$i,$i=id(l.containerInfo),Yn(l,i),$i=m,Kn(i),d&4&&o!==null&&o.memoizedState.isDehydrated)try{ia(l.containerInfo)}catch(Be){At(i,i.return,Be)}_m&&(_m=!1,c2(i));break;case 4:d=$i,$i=id(i.stateNode.containerInfo),Yn(l,i),Kn(i),$i=d;break;case 12:Yn(l,i),Kn(i);break;case 31:Yn(l,i),Kn(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Vu(i,d)));break;case 13:Yn(l,i),Kn(i),i.child.flags&8192&&i.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Pu=ht()),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Vu(i,d)));break;case 22:m=i.memoizedState!==null;var $=o!==null&&o.memoizedState!==null,te=Cr,de=Wt;if(Cr=te||m,Wt=de||$,Yn(l,i),Wt=de,Cr=te,Kn(i),d&8192)e:for(l=i.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(o===null||$||Cr||Wt||Ws(i)),o=null,l=i;;){if(l.tag===5||l.tag===26){if(o===null){$=o=l;try{if(y=$.stateNode,m)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{N=$.stateNode;var be=$.memoizedProps.style,ie=be!=null&&be.hasOwnProperty("display")?be.display:null;N.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Be){At($,$.return,Be)}}}else if(l.tag===6){if(o===null){$=l;try{$.stateNode.nodeValue=m?"":$.memoizedProps}catch(Be){At($,$.return,Be)}}}else if(l.tag===18){if(o===null){$=l;try{var le=$.stateNode;m?W2(le,!0):W2($.stateNode,!1)}catch(Be){At($,$.return,Be)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===i)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break e;for(;l.sibling===null;){if(l.return===null||l.return===i)break e;o===l&&(o=null),l=l.return}o===l&&(o=null),l.sibling.return=l.return,l=l.sibling}d&4&&(d=i.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,Vu(i,o))));break;case 19:Yn(l,i),Kn(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Vu(i,d)));break;case 30:break;case 21:break;default:Yn(l,i),Kn(i)}}function Kn(i){var l=i.flags;if(l&2){try{for(var o,d=i.return;d!==null;){if(e2(d)){o=d;break}d=d.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var m=o.stateNode,y=Rm(i);Uu(i,y,m);break;case 5:var S=o.stateNode;o.flags&32&&(Nl(S,""),o.flags&=-33);var N=Rm(i);Uu(i,N,S);break;case 3:case 4:var $=o.stateNode.containerInfo,te=Rm(i);Dm(i,te,$);break;default:throw Error(r(161))}}catch(de){At(i,i.return,de)}i.flags&=-3}l&4096&&(i.flags&=-4097)}function c2(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var l=i;c2(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),i=i.sibling}}function Tr(i,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)i2(i,l.alternate,l),l=l.sibling}function Ws(i){for(i=i.child;i!==null;){var l=i;switch(l.tag){case 0:case 11:case 14:case 15:ds(4,l,l.return),Ws(l);break;case 1:er(l,l.return);var o=l.stateNode;typeof o.componentWillUnmount=="function"&&WS(l,l.return,o),Ws(l);break;case 27:Co(l.stateNode);case 26:case 5:er(l,l.return),Ws(l);break;case 22:l.memoizedState===null&&Ws(l);break;case 30:Ws(l);break;default:Ws(l)}i=i.sibling}}function jr(i,l,o){for(o=o&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var d=l.alternate,m=i,y=l,S=y.flags;switch(y.tag){case 0:case 11:case 15:jr(m,y,o),mo(4,y);break;case 1:if(jr(m,y,o),d=y,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){At(d,d.return,te)}if(d=y,m=d.updateQueue,m!==null){var N=d.stateNode;try{var $=m.shared.hiddenCallbacks;if($!==null)for(m.shared.hiddenCallbacks=null,m=0;m<$.length;m++)Hw($[m],N)}catch(te){At(d,d.return,te)}}o&&S&64&&QS(y),go(y,y.return);break;case 27:t2(y);case 26:case 5:jr(m,y,o),o&&d===null&&S&4&&ZS(y),go(y,y.return);break;case 12:jr(m,y,o);break;case 31:jr(m,y,o),o&&S&4&&l2(m,y);break;case 13:jr(m,y,o),o&&S&4&&a2(m,y);break;case 22:y.memoizedState===null&&jr(m,y,o),go(y,y.return);break;case 30:break;default:jr(m,y,o)}l=l.sibling}}function Lm(i,l){var o=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),i=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(i=l.memoizedState.cachePool.pool),i!==o&&(i!=null&&i.refCount++,o!=null&&to(o))}function qm(i,l){i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&to(i))}function Ii(i,l,o,d){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)u2(i,l,o,d),l=l.sibling}function u2(i,l,o,d){var m=l.flags;switch(l.tag){case 0:case 11:case 15:Ii(i,l,o,d),m&2048&&mo(9,l);break;case 1:Ii(i,l,o,d);break;case 3:Ii(i,l,o,d),m&2048&&(i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&to(i)));break;case 12:if(m&2048){Ii(i,l,o,d),i=l.stateNode;try{var y=l.memoizedProps,S=y.id,N=y.onPostCommit;typeof N=="function"&&N(S,l.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch($){At(l,l.return,$)}}else Ii(i,l,o,d);break;case 31:Ii(i,l,o,d);break;case 13:Ii(i,l,o,d);break;case 23:break;case 22:y=l.stateNode,S=l.alternate,l.memoizedState!==null?y._visibility&2?Ii(i,l,o,d):yo(i,l):y._visibility&2?Ii(i,l,o,d):(y._visibility|=2,Yl(i,l,o,d,(l.subtreeFlags&10256)!==0||!1)),m&2048&&Lm(S,l);break;case 24:Ii(i,l,o,d),m&2048&&qm(l.alternate,l);break;default:Ii(i,l,o,d)}}function Yl(i,l,o,d,m){for(m=m&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var y=i,S=l,N=o,$=d,te=S.flags;switch(S.tag){case 0:case 11:case 15:Yl(y,S,N,$,m),mo(8,S);break;case 23:break;case 22:var de=S.stateNode;S.memoizedState!==null?de._visibility&2?Yl(y,S,N,$,m):yo(y,S):(de._visibility|=2,Yl(y,S,N,$,m)),m&&te&2048&&Lm(S.alternate,S);break;case 24:Yl(y,S,N,$,m),m&&te&2048&&qm(S.alternate,S);break;default:Yl(y,S,N,$,m)}l=l.sibling}}function yo(i,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var o=i,d=l,m=d.flags;switch(d.tag){case 22:yo(o,d),m&2048&&Lm(d.alternate,d);break;case 24:yo(o,d),m&2048&&qm(d.alternate,d);break;default:yo(o,d)}l=l.sibling}}var bo=8192;function Kl(i,l,o){if(i.subtreeFlags&bo)for(i=i.child;i!==null;)d2(i,l,o),i=i.sibling}function d2(i,l,o){switch(i.tag){case 26:Kl(i,l,o),i.flags&bo&&i.memoizedState!==null&&H4(o,$i,i.memoizedState,i.memoizedProps);break;case 5:Kl(i,l,o);break;case 3:case 4:var d=$i;$i=id(i.stateNode.containerInfo),Kl(i,l,o),$i=d;break;case 22:i.memoizedState===null&&(d=i.alternate,d!==null&&d.memoizedState!==null?(d=bo,bo=16777216,Kl(i,l,o),bo=d):Kl(i,l,o));break;default:Kl(i,l,o)}}function f2(i){var l=i.alternate;if(l!==null&&(i=l.child,i!==null)){l.child=null;do l=i.sibling,i.sibling=null,i=l;while(i!==null)}}function xo(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var o=0;o<l.length;o++){var d=l[o];ln=d,p2(d,i)}f2(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)h2(i),i=i.sibling}function h2(i){switch(i.tag){case 0:case 11:case 15:xo(i),i.flags&2048&&ds(9,i,i.return);break;case 3:xo(i);break;case 12:xo(i);break;case 22:var l=i.stateNode;i.memoizedState!==null&&l._visibility&2&&(i.return===null||i.return.tag!==13)?(l._visibility&=-3,Fu(i)):xo(i);break;default:xo(i)}}function Fu(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var o=0;o<l.length;o++){var d=l[o];ln=d,p2(d,i)}f2(i)}for(i=i.child;i!==null;){switch(l=i,l.tag){case 0:case 11:case 15:ds(8,l,l.return),Fu(l);break;case 22:o=l.stateNode,o._visibility&2&&(o._visibility&=-3,Fu(l));break;default:Fu(l)}i=i.sibling}}function p2(i,l){for(;ln!==null;){var o=ln;switch(o.tag){case 0:case 11:case 15:ds(8,o,l);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:to(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,ln=d;else e:for(o=i;ln!==null;){d=ln;var m=d.sibling,y=d.return;if(r2(d),d===o){ln=null;break e}if(m!==null){m.return=y,ln=m;break e}ln=y}}}var t4={getCacheForType:function(i){var l=gn(Xt),o=l.data.get(i);return o===void 0&&(o=i(),l.data.set(i,o)),o},cacheSignal:function(){return gn(Xt).controller.signal}},n4=typeof WeakMap=="function"?WeakMap:Map,vt=0,Ot=null,ot=null,dt=0,St=0,li=null,fs=!1,Gl=!1,Bm=!1,Er=0,It=0,hs=0,Zs=0,$m=0,ai=0,Xl=0,vo=null,Gn=null,Im=!1,Pu=0,m2=0,Yu=1/0,Ku=null,ps=null,nn=0,ms=null,Jl=null,Or=0,Hm=0,zm=null,g2=null,wo=0,Um=null;function oi(){return(vt&2)!==0&&dt!==0?dt&-dt:L.T!==null?Gm():Ln()}function y2(){if(ai===0)if((dt&536870912)===0||pt){var i=Se;Se<<=1,(Se&3932160)===0&&(Se=262144),ai=i}else ai=536870912;return i=ri.current,i!==null&&(i.flags|=32),ai}function Xn(i,l,o){(i===Ot&&(St===2||St===9)||i.cancelPendingCommit!==null)&&(Ql(i,0),gs(i,dt,ai,!1)),jn(i,o),((vt&2)===0||i!==Ot)&&(i===Ot&&((vt&2)===0&&(Zs|=o),It===4&&gs(i,dt,ai,!1)),tr(i))}function b2(i,l,o){if((vt&6)!==0)throw Error(r(327));var d=!o&&(l&127)===0&&(l&i.expiredLanes)===0||ze(i,l),m=d?s4(i,l):Fm(i,l,!0),y=d;do{if(m===0){Gl&&!d&&gs(i,l,0,!1);break}else{if(o=i.current.alternate,y&&!i4(o)){m=Fm(i,l,!1),y=!1;continue}if(m===2){if(y=l,i.errorRecoveryDisabledLanes&y)var S=0;else S=i.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){l=S;e:{var N=i;m=vo;var $=N.current.memoizedState.isDehydrated;if($&&(Ql(N,S).flags|=256),S=Fm(N,S,!1),S!==2){if(Bm&&!$){N.errorRecoveryDisabledLanes|=y,Zs|=y,m=4;break e}y=Gn,Gn=m,y!==null&&(Gn===null?Gn=y:Gn.push.apply(Gn,y))}m=S}if(y=!1,m!==2)continue}}if(m===1){Ql(i,0),gs(i,l,0,!0);break}e:{switch(d=i,y=m,y){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:gs(d,l,ai,!fs);break e;case 2:Gn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(m=Pu+300-ht(),10<m)){if(gs(d,l,ai,!fs),_e(d,0,!0)!==0)break e;Or=l,d.timeoutHandle=X2(x2.bind(null,d,o,Gn,Ku,Im,l,ai,Zs,Xl,fs,y,"Throttled",-0,0),m);break e}x2(d,o,Gn,Ku,Im,l,ai,Zs,Xl,fs,y,null,-0,0)}}break}while(!0);tr(i)}function x2(i,l,o,d,m,y,S,N,$,te,de,be,ie,le){if(i.timeoutHandle=-1,be=l.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:mr},d2(l,y,be);var Be=(y&62914560)===y?Pu-ht():(y&4194048)===y?m2-ht():0;if(Be=z4(be,Be),Be!==null){Or=y,i.cancelPendingCommit=Be(T2.bind(null,i,l,y,o,d,m,S,N,$,de,be,null,ie,le)),gs(i,y,S,!te);return}}T2(i,l,y,o,d,m,S,N,$)}function i4(i){for(var l=i;;){var o=l.tag;if((o===0||o===11||o===15)&&l.flags&16384&&(o=l.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],y=m.getSnapshot;m=m.value;try{if(!ni(y(),m))return!1}catch{return!1}}if(o=l.child,l.subtreeFlags&16384&&o!==null)o.return=l,l=o;else{if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function gs(i,l,o,d){l&=~$m,l&=~Zs,i.suspendedLanes|=l,i.pingedLanes&=~l,d&&(i.warmLanes|=l),d=i.expirationTimes;for(var m=l;0<m;){var y=31-Z(m),S=1<<y;d[y]=-1,m&=~S}o!==0&&Wr(i,o,l)}function Gu(){return(vt&6)===0?(So(0),!1):!0}function Vm(){if(ot!==null){if(St===0)var i=ot.return;else i=ot,xr=Fs=null,sm(i),zl=null,io=0,i=ot;for(;i!==null;)JS(i.alternate,i),i=i.return;ot=null}}function Ql(i,l){var o=i.timeoutHandle;o!==-1&&(i.timeoutHandle=-1,A4(o)),o=i.cancelPendingCommit,o!==null&&(i.cancelPendingCommit=null,o()),Or=0,Vm(),Ot=i,ot=o=yr(i.current,null),dt=l,St=0,li=null,fs=!1,Gl=ze(i,l),Bm=!1,Xl=ai=$m=Zs=hs=It=0,Gn=vo=null,Im=!1,(l&8)!==0&&(l|=l&32);var d=i.entangledLanes;if(d!==0)for(i=i.entanglements,d&=l;0<d;){var m=31-Z(d),y=1<<m;l|=i[m],d&=~y}return Er=l,mu(),o}function v2(i,l){nt=null,L.H=fo,l===Hl||l===Au?(l=qw(),St=3):l===Kp?(l=qw(),St=4):St=l===wm?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,li=l,ot===null&&(It=1,Bu(i,Si(l,i.current)))}function w2(){var i=ri.current;return i===null?!0:(dt&4194048)===dt?Ni===null:(dt&62914560)===dt||(dt&536870912)!==0?i===Ni:!1}function S2(){var i=L.H;return L.H=fo,i===null?fo:i}function A2(){var i=L.A;return L.A=t4,i}function Xu(){It=4,fs||(dt&4194048)!==dt&&ri.current!==null||(Gl=!0),(hs&134217727)===0&&(Zs&134217727)===0||Ot===null||gs(Ot,dt,ai,!1)}function Fm(i,l,o){var d=vt;vt|=2;var m=S2(),y=A2();(Ot!==i||dt!==l)&&(Ku=null,Ql(i,l)),l=!1;var S=It;e:do try{if(St!==0&&ot!==null){var N=ot,$=li;switch(St){case 8:Vm(),S=6;break e;case 3:case 2:case 9:case 6:ri.current===null&&(l=!0);var te=St;if(St=0,li=null,Wl(i,N,$,te),o&&Gl){S=0;break e}break;default:te=St,St=0,li=null,Wl(i,N,$,te)}}r4(),S=It;break}catch(de){v2(i,de)}while(!0);return l&&i.shellSuspendCounter++,xr=Fs=null,vt=d,L.H=m,L.A=y,ot===null&&(Ot=null,dt=0,mu()),S}function r4(){for(;ot!==null;)k2(ot)}function s4(i,l){var o=vt;vt|=2;var d=S2(),m=A2();Ot!==i||dt!==l?(Ku=null,Yu=ht()+500,Ql(i,l)):Gl=ze(i,l);e:do try{if(St!==0&&ot!==null){l=ot;var y=li;t:switch(St){case 1:St=0,li=null,Wl(i,l,y,1);break;case 2:case 9:if(_w(y)){St=0,li=null,C2(l);break}l=function(){St!==2&&St!==9||Ot!==i||(St=7),tr(i)},y.then(l,l);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:_w(y)?(St=0,li=null,C2(l)):(St=0,li=null,Wl(i,l,y,7));break;case 5:var S=null;switch(ot.tag){case 26:S=ot.memoizedState;case 5:case 27:var N=ot;if(S?uA(S):N.stateNode.complete){St=0,li=null;var $=N.sibling;if($!==null)ot=$;else{var te=N.return;te!==null?(ot=te,Ju(te)):ot=null}break t}}St=0,li=null,Wl(i,l,y,5);break;case 6:St=0,li=null,Wl(i,l,y,6);break;case 8:Vm(),It=6;break e;default:throw Error(r(462))}}l4();break}catch(de){v2(i,de)}while(!0);return xr=Fs=null,L.H=d,L.A=m,vt=o,ot!==null?0:(Ot=null,dt=0,mu(),It)}function l4(){for(;ot!==null&&!Zn();)k2(ot)}function k2(i){var l=GS(i.alternate,i,Er);i.memoizedProps=i.pendingProps,l===null?Ju(i):ot=l}function C2(i){var l=i,o=l.alternate;switch(l.tag){case 15:case 0:l=US(o,l,l.pendingProps,l.type,void 0,dt);break;case 11:l=US(o,l,l.pendingProps,l.type.render,l.ref,dt);break;case 5:sm(l);default:JS(o,l),l=ot=Aw(l,Er),l=GS(o,l,Er)}i.memoizedProps=i.pendingProps,l===null?Ju(i):ot=l}function Wl(i,l,o,d){xr=Fs=null,sm(l),zl=null,io=0;var m=l.return;try{if(GR(i,m,l,o,dt)){It=1,Bu(i,Si(o,i.current)),ot=null;return}}catch(y){if(m!==null)throw ot=m,y;It=1,Bu(i,Si(o,i.current)),ot=null;return}l.flags&32768?(pt||d===1?i=!0:Gl||(dt&536870912)!==0?i=!1:(fs=i=!0,(d===2||d===9||d===3||d===6)&&(d=ri.current,d!==null&&d.tag===13&&(d.flags|=16384))),N2(l,i)):Ju(l)}function Ju(i){var l=i;do{if((l.flags&32768)!==0){N2(l,fs);return}i=l.return;var o=QR(l.alternate,l,Er);if(o!==null){ot=o;return}if(l=l.sibling,l!==null){ot=l;return}ot=l=i}while(l!==null);It===0&&(It=5)}function N2(i,l){do{var o=WR(i.alternate,i);if(o!==null){o.flags&=32767,ot=o;return}if(o=i.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!l&&(i=i.sibling,i!==null)){ot=i;return}ot=i=o}while(i!==null);It=6,ot=null}function T2(i,l,o,d,m,y,S,N,$){i.cancelPendingCommit=null;do Qu();while(nn!==0);if((vt&6)!==0)throw Error(r(327));if(l!==null){if(l===i.current)throw Error(r(177));if(y=l.lanes|l.childLanes,y|=Rp,nu(i,o,y,S,N,$),i===Ot&&(ot=Ot=null,dt=0),Jl=l,ms=i,Or=o,Hm=y,zm=m,g2=d,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,u4(kt,function(){return R2(),null})):(i.callbackNode=null,i.callbackPriority=0),d=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||d){d=L.T,L.T=null,m=Q.p,Q.p=2,S=vt,vt|=4;try{ZR(i,l,o)}finally{vt=S,Q.p=m,L.T=d}}nn=1,j2(),E2(),O2()}}function j2(){if(nn===1){nn=0;var i=ms,l=Jl,o=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||o){o=L.T,L.T=null;var d=Q.p;Q.p=2;var m=vt;vt|=4;try{o2(l,i);var y=ng,S=pw(i.containerInfo),N=y.focusedElem,$=y.selectionRange;if(S!==N&&N&&N.ownerDocument&&hw(N.ownerDocument.documentElement,N)){if($!==null&&Tp(N)){var te=$.start,de=$.end;if(de===void 0&&(de=te),"selectionStart"in N)N.selectionStart=te,N.selectionEnd=Math.min(de,N.value.length);else{var be=N.ownerDocument||document,ie=be&&be.defaultView||window;if(ie.getSelection){var le=ie.getSelection(),Be=N.textContent.length,Ge=Math.min($.start,Be),Tt=$.end===void 0?Ge:Math.min($.end,Be);!le.extend&&Ge>Tt&&(S=Tt,Tt=Ge,Ge=S);var P=fw(N,Ge),H=fw(N,Tt);if(P&&H&&(le.rangeCount!==1||le.anchorNode!==P.node||le.anchorOffset!==P.offset||le.focusNode!==H.node||le.focusOffset!==H.offset)){var ee=be.createRange();ee.setStart(P.node,P.offset),le.removeAllRanges(),Ge>Tt?(le.addRange(ee),le.extend(H.node,H.offset)):(ee.setEnd(H.node,H.offset),le.addRange(ee))}}}}for(be=[],le=N;le=le.parentNode;)le.nodeType===1&&be.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<be.length;N++){var ge=be[N];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}cd=!!tg,ng=tg=null}finally{vt=m,Q.p=d,L.T=o}}i.current=l,nn=2}}function E2(){if(nn===2){nn=0;var i=ms,l=Jl,o=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||o){o=L.T,L.T=null;var d=Q.p;Q.p=2;var m=vt;vt|=4;try{i2(i,l.alternate,l)}finally{vt=m,Q.p=d,L.T=o}}nn=3}}function O2(){if(nn===4||nn===3){nn=0,Nn();var i=ms,l=Jl,o=Or,d=g2;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?nn=5:(nn=0,Jl=ms=null,M2(i,i.pendingLanes));var m=i.pendingLanes;if(m===0&&(ps=null),Vt(o),l=l.stateNode,k&&typeof k.onCommitFiberRoot=="function")try{k.onCommitFiberRoot(J,l,void 0,(l.current.flags&128)===128)}catch{}if(d!==null){l=L.T,m=Q.p,Q.p=2,L.T=null;try{for(var y=i.onRecoverableError,S=0;S<d.length;S++){var N=d[S];y(N.value,{componentStack:N.stack})}}finally{L.T=l,Q.p=m}}(Or&3)!==0&&Qu(),tr(i),m=i.pendingLanes,(o&261930)!==0&&(m&42)!==0?i===Um?wo++:(wo=0,Um=i):wo=0,So(0)}}function M2(i,l){(i.pooledCacheLanes&=l)===0&&(l=i.pooledCache,l!=null&&(i.pooledCache=null,to(l)))}function Qu(){return j2(),E2(),O2(),R2()}function R2(){if(nn!==5)return!1;var i=ms,l=Hm;Hm=0;var o=Vt(Or),d=L.T,m=Q.p;try{Q.p=32>o?32:o,L.T=null,o=zm,zm=null;var y=ms,S=Or;if(nn=0,Jl=ms=null,Or=0,(vt&6)!==0)throw Error(r(331));var N=vt;if(vt|=4,h2(y.current),u2(y,y.current,S,o),vt=N,So(0,!1),k&&typeof k.onPostCommitFiberRoot=="function")try{k.onPostCommitFiberRoot(J,y)}catch{}return!0}finally{Q.p=m,L.T=d,M2(i,l)}}function D2(i,l,o){l=Si(o,l),l=vm(i.stateNode,l,2),i=os(i,l,2),i!==null&&(jn(i,2),tr(i))}function At(i,l,o){if(i.tag===3)D2(i,i,o);else for(;l!==null;){if(l.tag===3){D2(l,i,o);break}else if(l.tag===1){var d=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ps===null||!ps.has(d))){i=Si(o,i),o=_S(2),d=os(l,o,2),d!==null&&(LS(o,d,l,i),jn(d,2),tr(d));break}}l=l.return}}function Pm(i,l,o){var d=i.pingCache;if(d===null){d=i.pingCache=new n4;var m=new Set;d.set(l,m)}else m=d.get(l),m===void 0&&(m=new Set,d.set(l,m));m.has(o)||(Bm=!0,m.add(o),i=a4.bind(null,i,l,o),l.then(i,i))}function a4(i,l,o){var d=i.pingCache;d!==null&&d.delete(l),i.pingedLanes|=i.suspendedLanes&o,i.warmLanes&=~o,Ot===i&&(dt&o)===o&&(It===4||It===3&&(dt&62914560)===dt&&300>ht()-Pu?(vt&2)===0&&Ql(i,0):$m|=o,Xl===dt&&(Xl=0)),tr(i)}function _2(i,l){l===0&&(l=pn()),i=zs(i,l),i!==null&&(jn(i,l),tr(i))}function o4(i){var l=i.memoizedState,o=0;l!==null&&(o=l.retryLane),_2(i,o)}function c4(i,l){var o=0;switch(i.tag){case 31:case 13:var d=i.stateNode,m=i.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=i.stateNode;break;case 22:d=i.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(l),_2(i,o)}function u4(i,l){return st(i,l)}var Wu=null,Zl=null,Ym=!1,Zu=!1,Km=!1,ys=0;function tr(i){i!==Zl&&i.next===null&&(Zl===null?Wu=Zl=i:Zl=Zl.next=i),Zu=!0,Ym||(Ym=!0,f4())}function So(i,l){if(!Km&&Zu){Km=!0;do for(var o=!1,d=Wu;d!==null;){if(i!==0){var m=d.pendingLanes;if(m===0)var y=0;else{var S=d.suspendedLanes,N=d.pingedLanes;y=(1<<31-Z(42|i)+1)-1,y&=m&~(S&~N),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(o=!0,$2(d,y))}else y=dt,y=_e(d,d===Ot?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||ze(d,y)||(o=!0,$2(d,y));d=d.next}while(o);Km=!1}}function d4(){L2()}function L2(){Zu=Ym=!1;var i=0;ys!==0&&S4()&&(i=ys);for(var l=ht(),o=null,d=Wu;d!==null;){var m=d.next,y=q2(d,l);y===0?(d.next=null,o===null?Wu=m:o.next=m,m===null&&(Zl=o)):(o=d,(i!==0||(y&3)!==0)&&(Zu=!0)),d=m}nn!==0&&nn!==5||So(i),ys!==0&&(ys=0)}function q2(i,l){for(var o=i.suspendedLanes,d=i.pingedLanes,m=i.expirationTimes,y=i.pendingLanes&-62914561;0<y;){var S=31-Z(y),N=1<<S,$=m[S];$===-1?((N&o)===0||(N&d)!==0)&&(m[S]=Qe(N,l)):$<=l&&(i.expiredLanes|=N),y&=~N}if(l=Ot,o=dt,o=_e(i,i===l?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d=i.callbackNode,o===0||i===l&&(St===2||St===9)||i.cancelPendingCommit!==null)return d!==null&&d!==null&&Et(d),i.callbackNode=null,i.callbackPriority=0;if((o&3)===0||ze(i,o)){if(l=o&-o,l===i.callbackPriority)return l;switch(d!==null&&Et(d),Vt(o)){case 2:case 8:o=ei;break;case 32:o=kt;break;case 268435456:o=V;break;default:o=kt}return d=B2.bind(null,i),o=st(o,d),i.callbackPriority=l,i.callbackNode=o,l}return d!==null&&d!==null&&Et(d),i.callbackPriority=2,i.callbackNode=null,2}function B2(i,l){if(nn!==0&&nn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var o=i.callbackNode;if(Qu()&&i.callbackNode!==o)return null;var d=dt;return d=_e(i,i===Ot?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d===0?null:(b2(i,d,l),q2(i,ht()),i.callbackNode!=null&&i.callbackNode===o?B2.bind(null,i):null)}function $2(i,l){if(Qu())return null;b2(i,l,!0)}function f4(){k4(function(){(vt&6)!==0?st(Tn,d4):L2()})}function Gm(){if(ys===0){var i=$l;i===0&&(i=re,re<<=1,(re&261888)===0&&(re=256)),ys=i}return ys}function I2(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:au(""+i)}function H2(i,l){var o=l.ownerDocument.createElement("input");return o.name=l.name,o.value=l.value,i.id&&o.setAttribute("form",i.id),l.parentNode.insertBefore(o,l),i=new FormData(i),o.parentNode.removeChild(o),i}function h4(i,l,o,d,m){if(l==="submit"&&o&&o.stateNode===m){var y=I2((m[Kt]||null).action),S=d.submitter;S&&(l=(l=S[Kt]||null)?I2(l.formAction):S.getAttribute("formAction"),l!==null&&(y=l,S=null));var N=new du("action","action",null,d,m);i.push({event:N,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ys!==0){var $=S?H2(m,S):new FormData(m);pm(o,{pending:!0,data:$,method:m.method,action:y},null,$)}}else typeof y=="function"&&(N.preventDefault(),$=S?H2(m,S):new FormData(m),pm(o,{pending:!0,data:$,method:m.method,action:y},y,$))},currentTarget:m}]})}}for(var Xm=0;Xm<Mp.length;Xm++){var Jm=Mp[Xm],p4=Jm.toLowerCase(),m4=Jm[0].toUpperCase()+Jm.slice(1);Bi(p4,"on"+m4)}Bi(yw,"onAnimationEnd"),Bi(bw,"onAnimationIteration"),Bi(xw,"onAnimationStart"),Bi("dblclick","onDoubleClick"),Bi("focusin","onFocus"),Bi("focusout","onBlur"),Bi(MR,"onTransitionRun"),Bi(RR,"onTransitionStart"),Bi(DR,"onTransitionCancel"),Bi(vw,"onTransitionEnd"),Le("onMouseEnter",["mouseout","mouseover"]),Le("onMouseLeave",["mouseout","mouseover"]),Le("onPointerEnter",["pointerout","pointerover"]),Le("onPointerLeave",["pointerout","pointerover"]),se("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),se("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),se("onBeforeInput",["compositionend","keypress","textInput","paste"]),se("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ao="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(" "),g4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ao));function z2(i,l){l=(l&4)!==0;for(var o=0;o<i.length;o++){var d=i[o],m=d.event;d=d.listeners;e:{var y=void 0;if(l)for(var S=d.length-1;0<=S;S--){var N=d[S],$=N.instance,te=N.currentTarget;if(N=N.listener,$!==y&&m.isPropagationStopped())break e;y=N,m.currentTarget=te;try{y(m)}catch(de){pu(de)}m.currentTarget=null,y=$}else for(S=0;S<d.length;S++){if(N=d[S],$=N.instance,te=N.currentTarget,N=N.listener,$!==y&&m.isPropagationStopped())break e;y=N,m.currentTarget=te;try{y(m)}catch(de){pu(de)}m.currentTarget=null,y=$}}}}function ct(i,l){var o=l[ur];o===void 0&&(o=l[ur]=new Set);var d=i+"__bubble";o.has(d)||(U2(l,i,2,!1),o.add(d))}function Qm(i,l,o){var d=0;l&&(d|=4),U2(o,i,d,l)}var ed="_reactListening"+Math.random().toString(36).slice(2);function Wm(i){if(!i[ed]){i[ed]=!0,iu.forEach(function(o){o!=="selectionchange"&&(g4.has(o)||Qm(o,!1,i),Qm(o,!0,i))});var l=i.nodeType===9?i:i.ownerDocument;l===null||l[ed]||(l[ed]=!0,Qm("selectionchange",!1,l))}}function U2(i,l,o,d){switch(yA(l)){case 2:var m=F4;break;case 8:m=P4;break;default:m=hg}o=m.bind(null,l,o,i),m=void 0,!bp||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),d?m!==void 0?i.addEventListener(l,o,{capture:!0,passive:m}):i.addEventListener(l,o,!0):m!==void 0?i.addEventListener(l,o,{passive:m}):i.addEventListener(l,o,!1)}function Zm(i,l,o,d,m){var y=d;if((l&1)===0&&(l&2)===0&&d!==null)e:for(;;){if(d===null)return;var S=d.tag;if(S===3||S===4){var N=d.stateNode.containerInfo;if(N===m)break;if(S===4)for(S=d.return;S!==null;){var $=S.tag;if(($===3||$===4)&&S.stateNode.containerInfo===m)return;S=S.return}for(;N!==null;){if(S=dr(N),S===null)return;if($=S.tag,$===5||$===6||$===26||$===27){d=y=S;continue e}N=N.parentNode}}d=d.return}K1(function(){var te=y,de=gp(o),be=[];e:{var ie=ww.get(i);if(ie!==void 0){var le=du,Be=i;switch(i){case"keypress":if(cu(o)===0)break e;case"keydown":case"keyup":le=cR;break;case"focusin":Be="focus",le=Sp;break;case"focusout":Be="blur",le=Sp;break;case"beforeblur":case"afterblur":le=Sp;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=J1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=QM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=fR;break;case yw:case bw:case xw:le=eR;break;case vw:le=pR;break;case"scroll":case"scrollend":le=XM;break;case"wheel":le=gR;break;case"copy":case"cut":case"paste":le=nR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=W1;break;case"toggle":case"beforetoggle":le=bR}var Ge=(l&4)!==0,Tt=!Ge&&(i==="scroll"||i==="scrollend"),P=Ge?ie!==null?ie+"Capture":null:ie;Ge=[];for(var H=te,ee;H!==null;){var ge=H;if(ee=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||ee===null||P===null||(ge=Fa(H,P),ge!=null&&Ge.push(ko(H,ge,ee))),Tt)break;H=H.return}0<Ge.length&&(ie=new le(ie,Be,null,o,de),be.push({event:ie,listeners:Ge}))}}if((l&7)===0){e:{if(ie=i==="mouseover"||i==="pointerover",le=i==="mouseout"||i==="pointerout",ie&&o!==mp&&(Be=o.relatedTarget||o.fromElement)&&(dr(Be)||Be[Vn]))break e;if((le||ie)&&(ie=de.window===de?de:(ie=de.ownerDocument)?ie.defaultView||ie.parentWindow:window,le?(Be=o.relatedTarget||o.toElement,le=te,Be=Be?dr(Be):null,Be!==null&&(Tt=a(Be),Ge=Be.tag,Be!==Tt||Ge!==5&&Ge!==27&&Ge!==6)&&(Be=null)):(le=null,Be=te),le!==Be)){if(Ge=J1,ge="onMouseLeave",P="onMouseEnter",H="mouse",(i==="pointerout"||i==="pointerover")&&(Ge=W1,ge="onPointerLeave",P="onPointerEnter",H="pointer"),Tt=le==null?ie:fr(le),ee=Be==null?ie:fr(Be),ie=new Ge(ge,H+"leave",le,o,de),ie.target=Tt,ie.relatedTarget=ee,ge=null,dr(de)===te&&(Ge=new Ge(P,H+"enter",Be,o,de),Ge.target=ee,Ge.relatedTarget=Tt,ge=Ge),Tt=ge,le&&Be)t:{for(Ge=y4,P=le,H=Be,ee=0,ge=P;ge;ge=Ge(ge))ee++;ge=0;for(var Ve=H;Ve;Ve=Ge(Ve))ge++;for(;0<ee-ge;)P=Ge(P),ee--;for(;0<ge-ee;)H=Ge(H),ge--;for(;ee--;){if(P===H||H!==null&&P===H.alternate){Ge=P;break t}P=Ge(P),H=Ge(H)}Ge=null}else Ge=null;le!==null&&V2(be,ie,le,Ge,!1),Be!==null&&Tt!==null&&V2(be,Tt,Be,Ge,!0)}}e:{if(ie=te?fr(te):window,le=ie.nodeName&&ie.nodeName.toLowerCase(),le==="select"||le==="input"&&ie.type==="file")var bt=lw;else if(rw(ie))if(aw)bt=jR;else{bt=NR;var He=CR}else le=ie.nodeName,!le||le.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?te&&pp(te.elementType)&&(bt=lw):bt=TR;if(bt&&(bt=bt(i,te))){sw(be,bt,o,de);break e}He&&He(i,ie,te),i==="focusout"&&te&&ie.type==="number"&&te.memoizedProps.value!=null&&hp(ie,"number",ie.value)}switch(He=te?fr(te):window,i){case"focusin":(rw(He)||He.contentEditable==="true")&&(Ol=He,jp=te,Wa=null);break;case"focusout":Wa=jp=Ol=null;break;case"mousedown":Ep=!0;break;case"contextmenu":case"mouseup":case"dragend":Ep=!1,mw(be,o,de);break;case"selectionchange":if(OR)break;case"keydown":case"keyup":mw(be,o,de)}var it;if(kp)e:{switch(i){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else El?nw(i,o)&&(ft="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(ft="onCompositionStart");ft&&(Z1&&o.locale!=="ko"&&(El||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&El&&(it=G1()):(ts=de,xp="value"in ts?ts.value:ts.textContent,El=!0)),He=td(te,ft),0<He.length&&(ft=new Q1(ft,i,null,o,de),be.push({event:ft,listeners:He}),it?ft.data=it:(it=iw(o),it!==null&&(ft.data=it)))),(it=vR?wR(i,o):SR(i,o))&&(ft=td(te,"onBeforeInput"),0<ft.length&&(He=new Q1("onBeforeInput","beforeinput",null,o,de),be.push({event:He,listeners:ft}),He.data=it)),h4(be,i,te,o,de)}z2(be,l)})}function ko(i,l,o){return{instance:i,listener:l,currentTarget:o}}function td(i,l){for(var o=l+"Capture",d=[];i!==null;){var m=i,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=Fa(i,o),m!=null&&d.unshift(ko(i,m,y)),m=Fa(i,l),m!=null&&d.push(ko(i,m,y))),i.tag===3)return d;i=i.return}return[]}function y4(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function V2(i,l,o,d,m){for(var y=l._reactName,S=[];o!==null&&o!==d;){var N=o,$=N.alternate,te=N.stateNode;if(N=N.tag,$!==null&&$===d)break;N!==5&&N!==26&&N!==27||te===null||($=te,m?(te=Fa(o,y),te!=null&&S.unshift(ko(o,te,$))):m||(te=Fa(o,y),te!=null&&S.push(ko(o,te,$)))),o=o.return}S.length!==0&&i.push({event:l,listeners:S})}var b4=/\r\n?/g,x4=/\u0000|\uFFFD/g;function F2(i){return(typeof i=="string"?i:""+i).replace(b4,`
|
|
9
|
-
`).replace(x4,"")}function P2(i,l){return l=F2(l),F2(i)===l}function Nt(i,l,o,d,m,y){switch(o){case"children":typeof d=="string"?l==="body"||l==="textarea"&&d===""||Nl(i,d):(typeof d=="number"||typeof d=="bigint")&&l!=="body"&&Nl(i,""+d);break;case"className":su(i,"class",d);break;case"tabIndex":su(i,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":su(i,o,d);break;case"style":P1(i,d,y);break;case"data":if(l!=="object"){su(i,"data",d);break}case"src":case"href":if(d===""&&(l!=="a"||o!=="href")){i.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(o);break}d=au(""+d),i.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){i.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(o==="formAction"?(l!=="input"&&Nt(i,l,"name",m.name,m,null),Nt(i,l,"formEncType",m.formEncType,m,null),Nt(i,l,"formMethod",m.formMethod,m,null),Nt(i,l,"formTarget",m.formTarget,m,null)):(Nt(i,l,"encType",m.encType,m,null),Nt(i,l,"method",m.method,m,null),Nt(i,l,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(o);break}d=au(""+d),i.setAttribute(o,d);break;case"onClick":d!=null&&(i.onclick=mr);break;case"onScroll":d!=null&&ct("scroll",i);break;case"onScrollEnd":d!=null&&ct("scrollend",i);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(r(60));i.innerHTML=o}}break;case"multiple":i.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":i.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){i.removeAttribute("xlink:href");break}o=au(""+d),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(o,""+d):i.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(o,""):i.removeAttribute(o);break;case"capture":case"download":d===!0?i.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(o,d):i.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?i.setAttribute(o,d):i.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?i.removeAttribute(o):i.setAttribute(o,d);break;case"popover":ct("beforetoggle",i),ct("toggle",i),ru(i,"popover",d);break;case"xlinkActuate":pr(i,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":pr(i,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":pr(i,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":pr(i,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":pr(i,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":pr(i,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":pr(i,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":pr(i,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":pr(i,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":ru(i,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=KM.get(o)||o,ru(i,o,d))}}function eg(i,l,o,d,m,y){switch(o){case"style":P1(i,d,y);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(r(60));i.innerHTML=o}}break;case"children":typeof d=="string"?Nl(i,d):(typeof d=="number"||typeof d=="bigint")&&Nl(i,""+d);break;case"onScroll":d!=null&&ct("scroll",i);break;case"onScrollEnd":d!=null&&ct("scrollend",i);break;case"onClick":d!=null&&(i.onclick=mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ua.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),l=o.slice(2,m?o.length-7:void 0),y=i[Kt]||null,y=y!=null?y[o]:null,typeof y=="function"&&i.removeEventListener(l,y,m),typeof d=="function")){typeof y!="function"&&y!==null&&(o in i?i[o]=null:i.hasAttribute(o)&&i.removeAttribute(o)),i.addEventListener(l,d,m);break e}o in i?i[o]=d:d===!0?i.setAttribute(o,""):ru(i,o,d)}}}function bn(i,l,o){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",i),ct("load",i);var d=!1,m=!1,y;for(y in o)if(o.hasOwnProperty(y)){var S=o[y];if(S!=null)switch(y){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Nt(i,l,y,S,o,null)}}m&&Nt(i,l,"srcSet",o.srcSet,o,null),d&&Nt(i,l,"src",o.src,o,null);return;case"input":ct("invalid",i);var N=y=S=m=null,$=null,te=null;for(d in o)if(o.hasOwnProperty(d)){var de=o[d];if(de!=null)switch(d){case"name":m=de;break;case"type":S=de;break;case"checked":$=de;break;case"defaultChecked":te=de;break;case"value":y=de;break;case"defaultValue":N=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,l));break;default:Nt(i,l,d,de,o,null)}}z1(i,y,N,$,te,S,m,!1);return;case"select":ct("invalid",i),d=S=y=null;for(m in o)if(o.hasOwnProperty(m)&&(N=o[m],N!=null))switch(m){case"value":y=N;break;case"defaultValue":S=N;break;case"multiple":d=N;default:Nt(i,l,m,N,o,null)}l=y,o=S,i.multiple=!!d,l!=null?Cl(i,!!d,l,!1):o!=null&&Cl(i,!!d,o,!0);return;case"textarea":ct("invalid",i),y=m=d=null;for(S in o)if(o.hasOwnProperty(S)&&(N=o[S],N!=null))switch(S){case"value":d=N;break;case"defaultValue":m=N;break;case"children":y=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:Nt(i,l,S,N,o,null)}V1(i,d,m,y);return;case"option":for($ in o)o.hasOwnProperty($)&&(d=o[$],d!=null)&&($==="selected"?i.selected=d&&typeof d!="function"&&typeof d!="symbol":Nt(i,l,$,d,o,null));return;case"dialog":ct("beforetoggle",i),ct("toggle",i),ct("cancel",i),ct("close",i);break;case"iframe":case"object":ct("load",i);break;case"video":case"audio":for(d=0;d<Ao.length;d++)ct(Ao[d],i);break;case"image":ct("error",i),ct("load",i);break;case"details":ct("toggle",i);break;case"embed":case"source":case"link":ct("error",i),ct("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in o)if(o.hasOwnProperty(te)&&(d=o[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Nt(i,l,te,d,o,null)}return;default:if(pp(l)){for(de in o)o.hasOwnProperty(de)&&(d=o[de],d!==void 0&&eg(i,l,de,d,o,void 0));return}}for(N in o)o.hasOwnProperty(N)&&(d=o[N],d!=null&&Nt(i,l,N,d,o,null))}function v4(i,l,o,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,y=null,S=null,N=null,$=null,te=null,de=null;for(le in o){var be=o[le];if(o.hasOwnProperty(le)&&be!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":$=be;default:d.hasOwnProperty(le)||Nt(i,l,le,null,d,be)}}for(var ie in d){var le=d[ie];if(be=o[ie],d.hasOwnProperty(ie)&&(le!=null||be!=null))switch(ie){case"type":y=le;break;case"name":m=le;break;case"checked":te=le;break;case"defaultChecked":de=le;break;case"value":S=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,l));break;default:le!==be&&Nt(i,l,ie,le,d,be)}}fp(i,S,N,$,te,de,y,m);return;case"select":le=S=N=ie=null;for(y in o)if($=o[y],o.hasOwnProperty(y)&&$!=null)switch(y){case"value":break;case"multiple":le=$;default:d.hasOwnProperty(y)||Nt(i,l,y,null,d,$)}for(m in d)if(y=d[m],$=o[m],d.hasOwnProperty(m)&&(y!=null||$!=null))switch(m){case"value":ie=y;break;case"defaultValue":N=y;break;case"multiple":S=y;default:y!==$&&Nt(i,l,m,y,d,$)}l=N,o=S,d=le,ie!=null?Cl(i,!!o,ie,!1):!!d!=!!o&&(l!=null?Cl(i,!!o,l,!0):Cl(i,!!o,o?[]:"",!1));return;case"textarea":le=ie=null;for(N in o)if(m=o[N],o.hasOwnProperty(N)&&m!=null&&!d.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Nt(i,l,N,null,d,m)}for(S in d)if(m=d[S],y=o[S],d.hasOwnProperty(S)&&(m!=null||y!=null))switch(S){case"value":ie=m;break;case"defaultValue":le=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(r(91));break;default:m!==y&&Nt(i,l,S,m,d,y)}U1(i,ie,le);return;case"option":for(var Be in o)ie=o[Be],o.hasOwnProperty(Be)&&ie!=null&&!d.hasOwnProperty(Be)&&(Be==="selected"?i.selected=!1:Nt(i,l,Be,null,d,ie));for($ in d)ie=d[$],le=o[$],d.hasOwnProperty($)&&ie!==le&&(ie!=null||le!=null)&&($==="selected"?i.selected=ie&&typeof ie!="function"&&typeof ie!="symbol":Nt(i,l,$,ie,d,le));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ge in o)ie=o[Ge],o.hasOwnProperty(Ge)&&ie!=null&&!d.hasOwnProperty(Ge)&&Nt(i,l,Ge,null,d,ie);for(te in d)if(ie=d[te],le=o[te],d.hasOwnProperty(te)&&ie!==le&&(ie!=null||le!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,l));break;default:Nt(i,l,te,ie,d,le)}return;default:if(pp(l)){for(var Tt in o)ie=o[Tt],o.hasOwnProperty(Tt)&&ie!==void 0&&!d.hasOwnProperty(Tt)&&eg(i,l,Tt,void 0,d,ie);for(de in d)ie=d[de],le=o[de],!d.hasOwnProperty(de)||ie===le||ie===void 0&&le===void 0||eg(i,l,de,ie,d,le);return}}for(var P in o)ie=o[P],o.hasOwnProperty(P)&&ie!=null&&!d.hasOwnProperty(P)&&Nt(i,l,P,null,d,ie);for(be in d)ie=d[be],le=o[be],!d.hasOwnProperty(be)||ie===le||ie==null&&le==null||Nt(i,l,be,ie,d,le)}function Y2(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function w4(){if(typeof performance.getEntriesByType=="function"){for(var i=0,l=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],y=m.transferSize,S=m.initiatorType,N=m.duration;if(y&&N&&Y2(S)){for(S=0,N=m.responseEnd,d+=1;d<o.length;d++){var $=o[d],te=$.startTime;if(te>N)break;var de=$.transferSize,be=$.initiatorType;de&&Y2(be)&&($=$.responseEnd,S+=de*($<N?1:(N-te)/($-te)))}if(--d,l+=8*(y+S)/(m.duration/1e3),i++,10<i)break}}if(0<i)return l/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var tg=null,ng=null;function nd(i){return i.nodeType===9?i:i.ownerDocument}function K2(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function G2(i,l){if(i===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&l==="foreignObject"?0:i}function ig(i,l){return i==="textarea"||i==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var rg=null;function S4(){var i=window.event;return i&&i.type==="popstate"?i===rg?!1:(rg=i,!0):(rg=null,!1)}var X2=typeof setTimeout=="function"?setTimeout:void 0,A4=typeof clearTimeout=="function"?clearTimeout:void 0,J2=typeof Promise=="function"?Promise:void 0,k4=typeof queueMicrotask=="function"?queueMicrotask:typeof J2<"u"?function(i){return J2.resolve(null).then(i).catch(C4)}:X2;function C4(i){setTimeout(function(){throw i})}function bs(i){return i==="head"}function Q2(i,l){var o=l,d=0;do{var m=o.nextSibling;if(i.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){i.removeChild(m),ia(l);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")Co(i.ownerDocument.documentElement);else if(o==="head"){o=i.ownerDocument.head,Co(o);for(var y=o.firstChild;y;){var S=y.nextSibling,N=y.nodeName;y[Zr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&y.rel.toLowerCase()==="stylesheet"||o.removeChild(y),y=S}}else o==="body"&&Co(i.ownerDocument.body);o=m}while(o);ia(l)}function W2(i,l){var o=i;i=0;do{var d=o.nextSibling;if(o.nodeType===1?l?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(l?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(i===0)break;i--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||i++;o=d}while(o)}function sg(i){var l=i.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var o=l;switch(l=l.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":sg(o),kl(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}i.removeChild(o)}}function N4(i,l,o,d){for(;i.nodeType===1;){var m=o;if(i.nodeName.toLowerCase()!==l.toLowerCase()){if(!d&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(d){if(!i[Zr])switch(l){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(y=i.getAttribute("rel"),y==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(y!==m.rel||i.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||i.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||i.getAttribute("title")!==(m.title==null?null:m.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(y=i.getAttribute("src"),(y!==(m.src==null?null:m.src)||i.getAttribute("type")!==(m.type==null?null:m.type)||i.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(l==="input"&&i.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&i.getAttribute("name")===y)return i}else return i;if(i=Ti(i.nextSibling),i===null)break}return null}function T4(i,l,o){if(l==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!o||(i=Ti(i.nextSibling),i===null))return null;return i}function Z2(i,l){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=Ti(i.nextSibling),i===null))return null;return i}function lg(i){return i.data==="$?"||i.data==="$~"}function ag(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function j4(i,l){var o=i.ownerDocument;if(i.data==="$~")i._reactRetry=l;else if(i.data!=="$?"||o.readyState!=="loading")l();else{var d=function(){l(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),i._reactRetry=d}}function Ti(i){for(;i!=null;i=i.nextSibling){var l=i.nodeType;if(l===1||l===3)break;if(l===8){if(l=i.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return i}var og=null;function eA(i){i=i.nextSibling;for(var l=0;i;){if(i.nodeType===8){var o=i.data;if(o==="/$"||o==="/&"){if(l===0)return Ti(i.nextSibling);l--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||l++}i=i.nextSibling}return null}function tA(i){i=i.previousSibling;for(var l=0;i;){if(i.nodeType===8){var o=i.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(l===0)return i;l--}else o!=="/$"&&o!=="/&"||l++}i=i.previousSibling}return null}function nA(i,l,o){switch(l=nd(o),i){case"html":if(i=l.documentElement,!i)throw Error(r(452));return i;case"head":if(i=l.head,!i)throw Error(r(453));return i;case"body":if(i=l.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Co(i){for(var l=i.attributes;l.length;)i.removeAttributeNode(l[0]);kl(i)}var ji=new Map,iA=new Set;function id(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Mr=Q.d;Q.d={f:E4,r:O4,D:M4,C:R4,L:D4,m:_4,X:q4,S:L4,M:B4};function E4(){var i=Mr.f(),l=Gu();return i||l}function O4(i){var l=es(i);l!==null&&l.tag===5&&l.type==="form"?vS(l):Mr.r(i)}var ea=typeof document>"u"?null:document;function rA(i,l,o){var d=ea;if(d&&typeof l=="string"&&l){var m=vi(l);m='link[rel="'+i+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),iA.has(m)||(iA.add(m),i={rel:i,crossOrigin:o,href:l},d.querySelector(m)===null&&(l=d.createElement("link"),bn(l,"link",i),Gt(l),d.head.appendChild(l)))}}function M4(i){Mr.D(i),rA("dns-prefetch",i,null)}function R4(i,l){Mr.C(i,l),rA("preconnect",i,l)}function D4(i,l,o){Mr.L(i,l,o);var d=ea;if(d&&i&&l){var m='link[rel="preload"][as="'+vi(l)+'"]';l==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+vi(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+vi(o.imageSizes)+'"]')):m+='[href="'+vi(i)+'"]';var y=m;switch(l){case"style":y=ta(i);break;case"script":y=na(i)}ji.has(y)||(i=b({rel:"preload",href:l==="image"&&o&&o.imageSrcSet?void 0:i,as:l},o),ji.set(y,i),d.querySelector(m)!==null||l==="style"&&d.querySelector(No(y))||l==="script"&&d.querySelector(To(y))||(l=d.createElement("link"),bn(l,"link",i),Gt(l),d.head.appendChild(l)))}}function _4(i,l){Mr.m(i,l);var o=ea;if(o&&i){var d=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+vi(d)+'"][href="'+vi(i)+'"]',y=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=na(i)}if(!ji.has(y)&&(i=b({rel:"modulepreload",href:i},l),ji.set(y,i),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(To(y)))return}d=o.createElement("link"),bn(d,"link",i),Gt(d),o.head.appendChild(d)}}}function L4(i,l,o){Mr.S(i,l,o);var d=ea;if(d&&i){var m=hr(d).hoistableStyles,y=ta(i);l=l||"default";var S=m.get(y);if(!S){var N={loading:0,preload:null};if(S=d.querySelector(No(y)))N.loading=5;else{i=b({rel:"stylesheet",href:i,"data-precedence":l},o),(o=ji.get(y))&&cg(i,o);var $=S=d.createElement("link");Gt($),bn($,"link",i),$._p=new Promise(function(te,de){$.onload=te,$.onerror=de}),$.addEventListener("load",function(){N.loading|=1}),$.addEventListener("error",function(){N.loading|=2}),N.loading|=4,rd(S,l,d)}S={type:"stylesheet",instance:S,count:1,state:N},m.set(y,S)}}}function q4(i,l){Mr.X(i,l);var o=ea;if(o&&i){var d=hr(o).hoistableScripts,m=na(i),y=d.get(m);y||(y=o.querySelector(To(m)),y||(i=b({src:i,async:!0},l),(l=ji.get(m))&&ug(i,l),y=o.createElement("script"),Gt(y),bn(y,"link",i),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(m,y))}}function B4(i,l){Mr.M(i,l);var o=ea;if(o&&i){var d=hr(o).hoistableScripts,m=na(i),y=d.get(m);y||(y=o.querySelector(To(m)),y||(i=b({src:i,async:!0,type:"module"},l),(l=ji.get(m))&&ug(i,l),y=o.createElement("script"),Gt(y),bn(y,"link",i),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(m,y))}}function sA(i,l,o,d){var m=(m=qe.current)?id(m):null;if(!m)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(l=ta(o.href),o=hr(m).hoistableStyles,d=o.get(l),d||(d={type:"style",instance:null,count:0,state:null},o.set(l,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){i=ta(o.href);var y=hr(m).hoistableStyles,S=y.get(i);if(S||(m=m.ownerDocument||m,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(i,S),(y=m.querySelector(No(i)))&&!y._p&&(S.instance=y,S.state.loading=5),ji.has(i)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ji.set(i,o),y||$4(m,i,o,S.state))),l&&d===null)throw Error(r(528,""));return S}if(l&&d!==null)throw Error(r(529,""));return null;case"script":return l=o.async,o=o.src,typeof o=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=na(o),o=hr(m).hoistableScripts,d=o.get(l),d||(d={type:"script",instance:null,count:0,state:null},o.set(l,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function ta(i){return'href="'+vi(i)+'"'}function No(i){return'link[rel="stylesheet"]['+i+"]"}function lA(i){return b({},i,{"data-precedence":i.precedence,precedence:null})}function $4(i,l,o,d){i.querySelector('link[rel="preload"][as="style"]['+l+"]")?d.loading=1:(l=i.createElement("link"),d.preload=l,l.addEventListener("load",function(){return d.loading|=1}),l.addEventListener("error",function(){return d.loading|=2}),bn(l,"link",o),Gt(l),i.head.appendChild(l))}function na(i){return'[src="'+vi(i)+'"]'}function To(i){return"script[async]"+i}function aA(i,l,o){if(l.count++,l.instance===null)switch(l.type){case"style":var d=i.querySelector('style[data-href~="'+vi(o.href)+'"]');if(d)return l.instance=d,Gt(d),d;var m=b({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(i.ownerDocument||i).createElement("style"),Gt(d),bn(d,"style",m),rd(d,o.precedence,i),l.instance=d;case"stylesheet":m=ta(o.href);var y=i.querySelector(No(m));if(y)return l.state.loading|=4,l.instance=y,Gt(y),y;d=lA(o),(m=ji.get(m))&&cg(d,m),y=(i.ownerDocument||i).createElement("link"),Gt(y);var S=y;return S._p=new Promise(function(N,$){S.onload=N,S.onerror=$}),bn(y,"link",d),l.state.loading|=4,rd(y,o.precedence,i),l.instance=y;case"script":return y=na(o.src),(m=i.querySelector(To(y)))?(l.instance=m,Gt(m),m):(d=o,(m=ji.get(y))&&(d=b({},o),ug(d,m)),i=i.ownerDocument||i,m=i.createElement("script"),Gt(m),bn(m,"link",d),i.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(d=l.instance,l.state.loading|=4,rd(d,o.precedence,i));return l.instance}function rd(i,l,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,y=m,S=0;S<d.length;S++){var N=d[S];if(N.dataset.precedence===l)y=N;else if(y!==m)break}y?y.parentNode.insertBefore(i,y.nextSibling):(l=o.nodeType===9?o.head:o,l.insertBefore(i,l.firstChild))}function cg(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.title==null&&(i.title=l.title)}function ug(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.integrity==null&&(i.integrity=l.integrity)}var sd=null;function oA(i,l,o){if(sd===null){var d=new Map,m=sd=new Map;m.set(o,d)}else m=sd,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(i))return d;for(d.set(i,null),o=o.getElementsByTagName(i),m=0;m<o.length;m++){var y=o[m];if(!(y[Zr]||y[Ft]||i==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var S=y.getAttribute(l)||"";S=i+S;var N=d.get(S);N?N.push(y):d.set(S,[y])}}return d}function cA(i,l,o){i=i.ownerDocument||i,i.head.insertBefore(o,l==="title"?i.querySelector("head > title"):null)}function I4(i,l,o){if(o===1||l.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(i=l.disabled,typeof l.precedence=="string"&&i==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function uA(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function H4(i,l,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=ta(d.href),y=l.querySelector(No(m));if(y){l=y._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(i.count++,i=ld.bind(i),l.then(i,i)),o.state.loading|=4,o.instance=y,Gt(y);return}y=l.ownerDocument||l,d=lA(d),(m=ji.get(m))&&cg(d,m),y=y.createElement("link"),Gt(y);var S=y;S._p=new Promise(function(N,$){S.onload=N,S.onerror=$}),bn(y,"link",d),o.instance=y}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(o,l),(l=o.state.preload)&&(o.state.loading&3)===0&&(i.count++,o=ld.bind(i),l.addEventListener("load",o),l.addEventListener("error",o))}}var dg=0;function z4(i,l){return i.stylesheets&&i.count===0&&od(i,i.stylesheets),0<i.count||0<i.imgCount?function(o){var d=setTimeout(function(){if(i.stylesheets&&od(i,i.stylesheets),i.unsuspend){var y=i.unsuspend;i.unsuspend=null,y()}},6e4+l);0<i.imgBytes&&dg===0&&(dg=62500*w4());var m=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&od(i,i.stylesheets),i.unsuspend)){var y=i.unsuspend;i.unsuspend=null,y()}},(i.imgBytes>dg?50:800)+l);return i.unsuspend=o,function(){i.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function ld(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)od(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var ad=null;function od(i,l){i.stylesheets=null,i.unsuspend!==null&&(i.count++,ad=new Map,l.forEach(U4,i),ad=null,ld.call(i))}function U4(i,l){if(!(l.state.loading&4)){var o=ad.get(i);if(o)var d=o.get(null);else{o=new Map,ad.set(i,o);for(var m=i.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var S=m[y];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(o.set(S.dataset.precedence,S),d=S)}d&&o.set(null,d)}m=l.instance,S=m.getAttribute("data-precedence"),y=o.get(S)||d,y===d&&o.set(null,m),o.set(S,m),this.count++,d=ld.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),y?y.parentNode.insertBefore(m,y.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(m,i.firstChild)),l.state.loading|=4}}var jo={$$typeof:E,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function V4(i,l,o,d,m,y,S,N,$){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Un(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Un(0),this.hiddenUpdates=Un(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function dA(i,l,o,d,m,y,S,N,$,te,de,be){return i=new V4(i,l,o,S,$,te,de,be,N),l=1,y===!0&&(l|=24),y=ii(3,null,null,l),i.current=y,y.stateNode=i,l=Fp(),l.refCount++,i.pooledCache=l,l.refCount++,y.memoizedState={element:d,isDehydrated:o,cache:l},Gp(y),i}function fA(i){return i?(i=Dl,i):Dl}function hA(i,l,o,d,m,y){m=fA(m),d.context===null?d.context=m:d.pendingContext=m,d=as(l),d.payload={element:o},y=y===void 0?null:y,y!==null&&(d.callback=y),o=os(i,d,l),o!==null&&(Xn(o,i,l),so(o,i,l))}function pA(i,l){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<l?o:l}}function fg(i,l){pA(i,l),(i=i.alternate)&&pA(i,l)}function mA(i){if(i.tag===13||i.tag===31){var l=zs(i,67108864);l!==null&&Xn(l,i,67108864),fg(i,67108864)}}function gA(i){if(i.tag===13||i.tag===31){var l=oi();l=We(l);var o=zs(i,l);o!==null&&Xn(o,i,l),fg(i,l)}}var cd=!0;function F4(i,l,o,d){var m=L.T;L.T=null;var y=Q.p;try{Q.p=2,hg(i,l,o,d)}finally{Q.p=y,L.T=m}}function P4(i,l,o,d){var m=L.T;L.T=null;var y=Q.p;try{Q.p=8,hg(i,l,o,d)}finally{Q.p=y,L.T=m}}function hg(i,l,o,d){if(cd){var m=pg(d);if(m===null)Zm(i,l,d,ud,o),bA(i,d);else if(K4(m,i,l,o,d))d.stopPropagation();else if(bA(i,d),l&4&&-1<Y4.indexOf(i)){for(;m!==null;){var y=es(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=je(y.pendingLanes);if(S!==0){var N=y;for(N.pendingLanes|=2,N.entangledLanes|=2;S;){var $=1<<31-Z(S);N.entanglements[1]|=$,S&=~$}tr(y),(vt&6)===0&&(Yu=ht()+500,So(0))}}break;case 31:case 13:N=zs(y,2),N!==null&&Xn(N,y,2),Gu(),fg(y,2)}if(y=pg(d),y===null&&Zm(i,l,d,ud,o),y===m)break;m=y}m!==null&&d.stopPropagation()}else Zm(i,l,d,null,o)}}function pg(i){return i=gp(i),mg(i)}var ud=null;function mg(i){if(ud=null,i=dr(i),i!==null){var l=a(i);if(l===null)i=null;else{var o=l.tag;if(o===13){if(i=c(l),i!==null)return i;i=null}else if(o===31){if(i=u(l),i!==null)return i;i=null}else if(o===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;i=null}else l!==i&&(i=null)}}return ud=i,null}function yA(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_n()){case Tn:return 2;case ei:return 8;case kt:case x:return 32;case V:return 268435456;default:return 32}default:return 32}}var gg=!1,xs=null,vs=null,ws=null,Eo=new Map,Oo=new Map,Ss=[],Y4="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function bA(i,l){switch(i){case"focusin":case"focusout":xs=null;break;case"dragenter":case"dragleave":vs=null;break;case"mouseover":case"mouseout":ws=null;break;case"pointerover":case"pointerout":Eo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(l.pointerId)}}function Mo(i,l,o,d,m,y){return i===null||i.nativeEvent!==y?(i={blockedOn:l,domEventName:o,eventSystemFlags:d,nativeEvent:y,targetContainers:[m]},l!==null&&(l=es(l),l!==null&&mA(l)),i):(i.eventSystemFlags|=d,l=i.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),i)}function K4(i,l,o,d,m){switch(l){case"focusin":return xs=Mo(xs,i,l,o,d,m),!0;case"dragenter":return vs=Mo(vs,i,l,o,d,m),!0;case"mouseover":return ws=Mo(ws,i,l,o,d,m),!0;case"pointerover":var y=m.pointerId;return Eo.set(y,Mo(Eo.get(y)||null,i,l,o,d,m)),!0;case"gotpointercapture":return y=m.pointerId,Oo.set(y,Mo(Oo.get(y)||null,i,l,o,d,m)),!0}return!1}function xA(i){var l=dr(i.target);if(l!==null){var o=a(l);if(o!==null){if(l=o.tag,l===13){if(l=c(o),l!==null){i.blockedOn=l,bi(i.priority,function(){gA(o)});return}}else if(l===31){if(l=u(o),l!==null){i.blockedOn=l,bi(i.priority,function(){gA(o)});return}}else if(l===3&&o.stateNode.current.memoizedState.isDehydrated){i.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}i.blockedOn=null}function dd(i){if(i.blockedOn!==null)return!1;for(var l=i.targetContainers;0<l.length;){var o=pg(i.nativeEvent);if(o===null){o=i.nativeEvent;var d=new o.constructor(o.type,o);mp=d,o.target.dispatchEvent(d),mp=null}else return l=es(o),l!==null&&mA(l),i.blockedOn=o,!1;l.shift()}return!0}function vA(i,l,o){dd(i)&&o.delete(l)}function G4(){gg=!1,xs!==null&&dd(xs)&&(xs=null),vs!==null&&dd(vs)&&(vs=null),ws!==null&&dd(ws)&&(ws=null),Eo.forEach(vA),Oo.forEach(vA)}function fd(i,l){i.blockedOn===l&&(i.blockedOn=null,gg||(gg=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,G4)))}var hd=null;function wA(i){hd!==i&&(hd=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){hd===i&&(hd=null);for(var l=0;l<i.length;l+=3){var o=i[l],d=i[l+1],m=i[l+2];if(typeof d!="function"){if(mg(d||o)===null)continue;break}var y=es(o);y!==null&&(i.splice(l,3),l-=3,pm(y,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function ia(i){function l($){return fd($,i)}xs!==null&&fd(xs,i),vs!==null&&fd(vs,i),ws!==null&&fd(ws,i),Eo.forEach(l),Oo.forEach(l);for(var o=0;o<Ss.length;o++){var d=Ss[o];d.blockedOn===i&&(d.blockedOn=null)}for(;0<Ss.length&&(o=Ss[0],o.blockedOn===null);)xA(o),o.blockedOn===null&&Ss.shift();if(o=(i.ownerDocument||i).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],y=o[d+1],S=m[Kt]||null;if(typeof y=="function")S||wA(o);else if(S){var N=null;if(y&&y.hasAttribute("formAction")){if(m=y,S=y[Kt]||null)N=S.formAction;else if(mg(m)!==null)continue}else N=S.action;typeof N=="function"?o[d+1]=N:(o.splice(d,3),d-=3),wA(o)}}}function SA(){function i(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(S){return m=S})},focusReset:"manual",scroll:"manual"})}function l(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),m!==null&&(m(),m=null)}}}function yg(i){this._internalRoot=i}pd.prototype.render=yg.prototype.render=function(i){var l=this._internalRoot;if(l===null)throw Error(r(409));var o=l.current,d=oi();hA(o,d,i,l,null,null)},pd.prototype.unmount=yg.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var l=i.containerInfo;hA(i.current,2,null,i,null,null),Gu(),l[Vn]=null}};function pd(i){this._internalRoot=i}pd.prototype.unstable_scheduleHydration=function(i){if(i){var l=Ln();i={blockedOn:null,target:i,priority:l};for(var o=0;o<Ss.length&&l!==0&&l<Ss[o].priority;o++);Ss.splice(o,0,i),o===0&&xA(i)}};var AA=e.version;if(AA!=="19.2.8")throw Error(r(527,AA,"19.2.8"));Q.findDOMNode=function(i){var l=i._reactInternals;if(l===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=h(l),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var X4={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var md=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!md.isDisabled&&md.supportsFiber)try{J=md.inject(X4),k=md}catch{}}return sa.createRoot=function(i,l){if(!s(i))throw Error(r(299));var o=!1,d="",m=OS,y=MS,S=RS;return l!=null&&(l.unstable_strictMode===!0&&(o=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(S=l.onRecoverableError)),l=dA(i,1,!1,null,null,o,d,null,m,y,S,SA),i[Vn]=l.current,Wm(i),new yg(l)},sa.hydrateRoot=function(i,l,o){if(!s(i))throw Error(r(299));var d=!1,m="",y=OS,S=MS,N=RS,$=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(y=o.onUncaughtError),o.onCaughtError!==void 0&&(S=o.onCaughtError),o.onRecoverableError!==void 0&&(N=o.onRecoverableError),o.formState!==void 0&&($=o.formState)),l=dA(i,1,!0,l,o??null,d,m,$,y,S,N,SA),l.context=fA(null),o=l.current,d=oi(),d=We(d),m=as(d),m.callback=null,os(o,m,d),o=d,l.current.lanes=o,jn(l,o),tr(l),i[Vn]=l.current,Wm(i),new pd(l)},sa.version="19.2.8",sa}var Eg;function _A(){if(Eg)return yd.exports;Eg=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),yd.exports=DA(),yd.exports}var LA=_A(),I=wd();const Og=xg(I);const qA=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),BA=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Mg=t=>{const e=BA(t);return e.charAt(0).toUpperCase()+e.slice(1)},Rg=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),$A=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var IA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const HA=I.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:c,...u},f)=>I.createElement("svg",{ref:f,...IA,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:Rg("lucide",s),...!a&&!$A(u)&&{"aria-hidden":"true"},...u},[...c.map(([h,g])=>I.createElement(h,g)),...Array.isArray(a)?a:[a]]));const lt=(t,e)=>{const n=I.forwardRef(({className:r,...s},a)=>I.createElement(HA,{ref:a,iconNode:e,className:Rg(`lucide-${qA(Mg(t))}`,`lucide-${t}`,r),...s}));return n.displayName=Mg(t),n};const Dg=lt("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const Ro=lt("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const _g=lt("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Lg=lt("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const qg=lt("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const Ad=lt("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const la=lt("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const zA=lt("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const kd=lt("clock-3",[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const UA=lt("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Cd=lt("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const Nd=lt("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const Bg=lt("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const VA=lt("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const FA=lt("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const PA=lt("library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);const YA=lt("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);const KA=lt("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const GA=lt("lock-open",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);const XA=lt("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const JA=lt("menu",[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]]);const Td=lt("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);const jd=lt("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);const aa=lt("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const Cs=lt("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const QA=lt("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const WA=lt("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const $g=lt("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const Ig=lt("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);const ZA=lt("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const ek=lt("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const Hg=lt("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const zg=lt("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);const ci=lt("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const Ed=lt("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Ug=lt("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);const tk=lt("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);const Od=lt("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function nk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vn={},Do={},Rr={},Vg;function oa(){if(Vg)return Rr;Vg=1;function t(c){return typeof c>"u"||c===null}function e(c){return typeof c=="object"&&c!==null}function n(c){return Array.isArray(c)?c:t(c)?[]:[c]}function r(c,u){if(u){const f=Object.keys(u);for(let h=0,g=f.length;h<g;h+=1){const b=f[h];c[b]=u[b]}}return c}function s(c,u){let f="";for(let h=0;h<u;h+=1)f+=c;return f}function a(c){return c===0&&Number.NEGATIVE_INFINITY===1/c}return Rr.isNothing=t,Rr.isObject=e,Rr.toArray=n,Rr.repeat=s,Rr.isNegativeZero=a,Rr.extend=r,Rr}var Md,Fg;function ca(){if(Fg)return Md;Fg=1;function t(n,r){let s="";const a=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(s+='in "'+n.mark.name+'" '),s+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!r&&n.mark.snippet&&(s+=`
|
|
8
|
+
`+d.stack}}var Ke=Object.prototype.hasOwnProperty,st=t.unstable_scheduleCallback,Et=t.unstable_cancelCallback,Zn=t.unstable_shouldYield,Nn=t.unstable_requestPaint,ht=t.unstable_now,_n=t.unstable_getCurrentPriorityLevel,Tn=t.unstable_ImmediatePriority,ei=t.unstable_UserBlockingPriority,kt=t.unstable_NormalPriority,x=t.unstable_LowPriority,V=t.unstable_IdlePriority,me=t.log,ae=t.unstable_setDisableYieldValue,J=null,k=null;function Y(i){if(typeof me=="function"&&ae(i),k&&typeof k.setStrictMode=="function")try{k.setStrictMode(J,i)}catch{}}var Z=Math.clz32?Math.clz32:ue,xe=Math.log,F=Math.LN2;function ue(i){return i>>>=0,i===0?32:31-(xe(i)/F|0)|0}var re=256,Se=262144,Me=4194304;function je(i){var l=i&42;if(l!==0)return l;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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function _e(i,l,o){var d=i.pendingLanes;if(d===0)return 0;var m=0,y=i.suspendedLanes,S=i.pingedLanes;i=i.warmLanes;var N=d&134217727;return N!==0?(d=N&~y,d!==0?m=je(d):(S&=N,S!==0?m=je(S):o||(o=N&~i,o!==0&&(m=je(o))))):(N=d&~y,N!==0?m=je(N):S!==0?m=je(S):o||(o=d&~i,o!==0&&(m=je(o)))),m===0?0:l!==0&&l!==m&&(l&y)===0&&(y=m&-m,o=l&-l,y>=o||y===32&&(o&4194048)!==0)?l:m}function ze(i,l){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&l)===0}function Qe(i,l){switch(i){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function pn(){var i=Me;return Me<<=1,(Me&62914560)===0&&(Me=4194304),i}function Un(i){for(var l=[],o=0;31>o;o++)l.push(i);return l}function jn(i,l){i.pendingLanes|=l,l!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function nu(i,l,o,d,m,y){var S=i.pendingLanes;i.pendingLanes=o,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=o,i.entangledLanes&=o,i.errorRecoveryDisabledLanes&=o,i.shellSuspendCounter=0;var N=i.entanglements,$=i.expirationTimes,te=i.hiddenUpdates;for(o=S&~o;0<o;){var de=31-Z(o),be=1<<de;N[de]=0,$[de]=-1;var ie=te[de];if(ie!==null)for(te[de]=null,de=0;de<ie.length;de++){var le=ie[de];le!==null&&(le.lane&=-536870913)}o&=~be}d!==0&&Wr(i,d,0),y!==0&&m===0&&i.tag!==0&&(i.suspendedLanes|=y&~(S&~l))}function Wr(i,l,o){i.pendingLanes|=l,i.suspendedLanes&=~l;var d=31-Z(l);i.entangledLanes|=l,i.entanglements[d]=i.entanglements[d]|1073741824|o&261930}function yi(i,l){var o=i.entangledLanes|=l;for(i=i.entanglements;o;){var d=31-Z(o),m=1<<d;m&l|i[d]&l&&(i[d]|=l),o&=~m}}function Ee(i,l){var o=l&-l;return o=(o&42)!==0?1:We(o),(o&(i.suspendedLanes|l))!==0?0:o}function We(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function Vt(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function Ln(){var i=Q.p;return i!==0?i:(i=window.event,i===void 0?32:xA(i.type))}function bi(i,l){var o=Q.p;try{return Q.p=i,l()}finally{Q.p=o}}var qn=Math.random().toString(36).slice(2),Ft="__reactFiber$"+qn,Kt="__reactProps$"+qn,Vn="__reactContainer$"+qn,ur="__reactEvents$"+qn,Bs="__reactListeners$"+qn,Li="__reactHandles$"+qn,za="__reactResources$"+qn,Zr="__reactMarker$"+qn;function kl(i){delete i[Ft],delete i[Kt],delete i[ur],delete i[Bs],delete i[Li]}function dr(i){var l=i[Ft];if(l)return l;for(var o=i.parentNode;o;){if(l=o[Vn]||o[Ft]){if(o=l.alternate,l.child!==null||o!==null&&o.child!==null)for(i=iA(i);i!==null;){if(o=i[Ft])return o;i=iA(i)}return l}i=o,o=i.parentNode}return null}function es(i){if(i=i[Ft]||i[Vn]){var l=i.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return i}return null}function fr(i){var l=i.tag;if(l===5||l===26||l===27||l===6)return i.stateNode;throw Error(r(33))}function hr(i){var l=i[za];return l||(l=i[za]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Gt(i){i[Zr]=!0}var iu=new Set,Ua={};function se(i,l){Le(i,l),Le(i+"Capture",l)}function Le(i,l){for(Ua[i]=l,i=0;i<l.length;i++)iu.add(l[i])}var tt=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),qi={},ti={};function Va(i){return Ke.call(ti,i)?!0:Ke.call(qi,i)?!1:tt.test(i)?ti[i]=!0:(qi[i]=!0,!1)}function ru(i,l,o){if(Va(l))if(o===null)i.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":i.removeAttribute(l);return;case"boolean":var d=l.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){i.removeAttribute(l);return}}i.setAttribute(l,""+o)}}function su(i,l,o){if(o===null)i.removeAttribute(l);else{switch(typeof o){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(l);return}i.setAttribute(l,""+o)}}function pr(i,l,o,d){if(d===null)i.removeAttribute(o);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(o);return}i.setAttributeNS(l,o,""+d)}}function xi(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function z1(i){var l=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function eR(i,l,o){var d=Object.getOwnPropertyDescriptor(i.constructor.prototype,l);if(!i.hasOwnProperty(l)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var m=d.get,y=d.set;return Object.defineProperty(i,l,{configurable:!0,get:function(){return m.call(this)},set:function(S){o=""+S,y.call(this,S)}}),Object.defineProperty(i,l,{enumerable:d.enumerable}),{getValue:function(){return o},setValue:function(S){o=""+S},stopTracking:function(){i._valueTracker=null,delete i[l]}}}}function pp(i){if(!i._valueTracker){var l=z1(i)?"checked":"value";i._valueTracker=eR(i,l,""+i[l])}}function U1(i){if(!i)return!1;var l=i._valueTracker;if(!l)return!0;var o=l.getValue(),d="";return i&&(d=z1(i)?i.checked?"true":"false":i.value),i=d,i!==o?(l.setValue(i),!0):!1}function lu(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}}var tR=/[\n"\\]/g;function vi(i){return i.replace(tR,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function mp(i,l,o,d,m,y,S,N){i.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?i.type=S:i.removeAttribute("type"),l!=null?S==="number"?(l===0&&i.value===""||i.value!=l)&&(i.value=""+xi(l)):i.value!==""+xi(l)&&(i.value=""+xi(l)):S!=="submit"&&S!=="reset"||i.removeAttribute("value"),l!=null?gp(i,S,xi(l)):o!=null?gp(i,S,xi(o)):d!=null&&i.removeAttribute("value"),m==null&&y!=null&&(i.defaultChecked=!!y),m!=null&&(i.checked=m&&typeof m!="function"&&typeof m!="symbol"),N!=null&&typeof N!="function"&&typeof N!="symbol"&&typeof N!="boolean"?i.name=""+xi(N):i.removeAttribute("name")}function V1(i,l,o,d,m,y,S,N){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(i.type=y),l!=null||o!=null){if(!(y!=="submit"&&y!=="reset"||l!=null)){pp(i);return}o=o!=null?""+xi(o):"",l=l!=null?""+xi(l):o,N||l===i.value||(i.value=l),i.defaultValue=l}d=d??m,d=typeof d!="function"&&typeof d!="symbol"&&!!d,i.checked=N?i.checked:!!d,i.defaultChecked=!!d,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(i.name=S),pp(i)}function gp(i,l,o){l==="number"&&lu(i.ownerDocument)===i||i.defaultValue===""+o||(i.defaultValue=""+o)}function Cl(i,l,o,d){if(i=i.options,l){l={};for(var m=0;m<o.length;m++)l["$"+o[m]]=!0;for(o=0;o<i.length;o++)m=l.hasOwnProperty("$"+i[o].value),i[o].selected!==m&&(i[o].selected=m),m&&d&&(i[o].defaultSelected=!0)}else{for(o=""+xi(o),l=null,m=0;m<i.length;m++){if(i[m].value===o){i[m].selected=!0,d&&(i[m].defaultSelected=!0);return}l!==null||i[m].disabled||(l=i[m])}l!==null&&(l.selected=!0)}}function F1(i,l,o){if(l!=null&&(l=""+xi(l),l!==i.value&&(i.value=l),o==null)){i.defaultValue!==l&&(i.defaultValue=l);return}i.defaultValue=o!=null?""+xi(o):""}function P1(i,l,o,d){if(l==null){if(d!=null){if(o!=null)throw Error(r(92));if(fe(d)){if(1<d.length)throw Error(r(93));d=d[0]}o=d}o==null&&(o=""),l=o}o=xi(l),i.defaultValue=o,d=i.textContent,d===o&&d!==""&&d!==null&&(i.value=d),pp(i)}function Nl(i,l){if(l){var o=i.firstChild;if(o&&o===i.lastChild&&o.nodeType===3){o.nodeValue=l;return}}i.textContent=l}var nR=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Y1(i,l,o){var d=l.indexOf("--")===0;o==null||typeof o=="boolean"||o===""?d?i.setProperty(l,""):l==="float"?i.cssFloat="":i[l]="":d?i.setProperty(l,o):typeof o!="number"||o===0||nR.has(l)?l==="float"?i.cssFloat=o:i[l]=(""+o).trim():i[l]=o+"px"}function K1(i,l,o){if(l!=null&&typeof l!="object")throw Error(r(62));if(i=i.style,o!=null){for(var d in o)!o.hasOwnProperty(d)||l!=null&&l.hasOwnProperty(d)||(d.indexOf("--")===0?i.setProperty(d,""):d==="float"?i.cssFloat="":i[d]="");for(var m in l)d=l[m],l.hasOwnProperty(m)&&o[m]!==d&&Y1(i,m,d)}else for(var y in l)l.hasOwnProperty(y)&&Y1(i,y,l[y])}function yp(i){if(i.indexOf("-")===-1)return!1;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 iR=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),rR=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function au(i){return rR.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function mr(){}var bp=null;function xp(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var Tl=null,jl=null;function G1(i){var l=es(i);if(l&&(i=l.stateNode)){var o=i[Kt]||null;e:switch(i=l.stateNode,l.type){case"input":if(mp(i,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name),l=o.name,o.type==="radio"&&l!=null){for(o=i;o.parentNode;)o=o.parentNode;for(o=o.querySelectorAll('input[name="'+vi(""+l)+'"][type="radio"]'),l=0;l<o.length;l++){var d=o[l];if(d!==i&&d.form===i.form){var m=d[Kt]||null;if(!m)throw Error(r(90));mp(d,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(l=0;l<o.length;l++)d=o[l],d.form===i.form&&U1(d)}break e;case"textarea":F1(i,o.value,o.defaultValue);break e;case"select":l=o.value,l!=null&&Cl(i,!!o.multiple,l,!1)}}}var vp=!1;function X1(i,l,o){if(vp)return i(l,o);vp=!0;try{var d=i(l);return d}finally{if(vp=!1,(Tl!==null||jl!==null)&&(Gu(),Tl&&(l=Tl,i=jl,jl=Tl=null,G1(l),i)))for(l=0;l<i.length;l++)G1(i[l])}}function Fa(i,l){var o=i.stateNode;if(o===null)return null;var d=o[Kt]||null;if(d===null)return null;o=d[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(i=i.type,d=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!d;break e;default:i=!1}if(i)return null;if(o&&typeof o!="function")throw Error(r(231,l,typeof o));return o}var gr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wp=!1;if(gr)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){wp=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{wp=!1}var ts=null,Sp=null,ou=null;function J1(){if(ou)return ou;var i,l=Sp,o=l.length,d,m="value"in ts?ts.value:ts.textContent,y=m.length;for(i=0;i<o&&l[i]===m[i];i++);var S=o-i;for(d=1;d<=S&&l[o-d]===m[y-d];d++);return ou=m.slice(i,1<d?1-d:void 0)}function cu(i){var l=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&l===13&&(i=13)):i=l,i===10&&(i=13),32<=i||i===13?i:0}function uu(){return!0}function Q1(){return!1}function Fn(i){function l(o,d,m,y,S){this._reactName=o,this._targetInst=m,this.type=d,this.nativeEvent=y,this.target=S,this.currentTarget=null;for(var N in i)i.hasOwnProperty(N)&&(o=i[N],this[N]=o?o(y):y[N]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?uu:Q1,this.isPropagationStopped=Q1,this}return b(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var o=this.nativeEvent;o&&(o.preventDefault?o.preventDefault():typeof o.returnValue!="unknown"&&(o.returnValue=!1),this.isDefaultPrevented=uu)},stopPropagation:function(){var o=this.nativeEvent;o&&(o.stopPropagation?o.stopPropagation():typeof o.cancelBubble!="unknown"&&(o.cancelBubble=!0),this.isPropagationStopped=uu)},persist:function(){},isPersistent:uu}),l}var $s={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},du=Fn($s),Ya=b({},$s,{view:0,detail:0}),sR=Fn(Ya),Ap,kp,Ka,fu=b({},Ya,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Np,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!==Ka&&(Ka&&i.type==="mousemove"?(Ap=i.screenX-Ka.screenX,kp=i.screenY-Ka.screenY):kp=Ap=0,Ka=i),Ap)},movementY:function(i){return"movementY"in i?i.movementY:kp}}),W1=Fn(fu),lR=b({},fu,{dataTransfer:0}),aR=Fn(lR),oR=b({},Ya,{relatedTarget:0}),Cp=Fn(oR),cR=b({},$s,{animationName:0,elapsedTime:0,pseudoElement:0}),uR=Fn(cR),dR=b({},$s,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),fR=Fn(dR),hR=b({},$s,{data:0}),Z1=Fn(hR),pR={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mR={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"},gR={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function yR(i){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(i):(i=gR[i])?!!l[i]:!1}function Np(){return yR}var bR=b({},Ya,{key:function(i){if(i.key){var l=pR[i.key]||i.key;if(l!=="Unidentified")return l}return i.type==="keypress"?(i=cu(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?mR[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Np,charCode:function(i){return i.type==="keypress"?cu(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?cu(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),xR=Fn(bR),vR=b({},fu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ew=Fn(vR),wR=b({},Ya,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Np}),SR=Fn(wR),AR=b({},$s,{propertyName:0,elapsedTime:0,pseudoElement:0}),kR=Fn(AR),CR=b({},fu,{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}),NR=Fn(CR),TR=b({},$s,{newState:0,oldState:0}),jR=Fn(TR),ER=[9,13,27,32],Tp=gr&&"CompositionEvent"in window,Ga=null;gr&&"documentMode"in document&&(Ga=document.documentMode);var OR=gr&&"TextEvent"in window&&!Ga,tw=gr&&(!Tp||Ga&&8<Ga&&11>=Ga),nw=" ",iw=!1;function rw(i,l){switch(i){case"keyup":return ER.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function sw(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var El=!1;function MR(i,l){switch(i){case"compositionend":return sw(l);case"keypress":return l.which!==32?null:(iw=!0,nw);case"textInput":return i=l.data,i===nw&&iw?null:i;default:return null}}function RR(i,l){if(El)return i==="compositionend"||!Tp&&rw(i,l)?(i=J1(),ou=Sp=ts=null,El=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return tw&&l.locale!=="ko"?null:l.data;default:return null}}var DR={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 lw(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l==="input"?!!DR[i.type]:l==="textarea"}function aw(i,l,o,d){Tl?jl?jl.push(d):jl=[d]:Tl=d,l=td(l,"onChange"),0<l.length&&(o=new du("onChange","change",null,o,d),i.push({event:o,listeners:l}))}var Xa=null,Ja=null;function _R(i){V2(i,0)}function hu(i){var l=fr(i);if(U1(l))return i}function ow(i,l){if(i==="change")return l}var cw=!1;if(gr){var jp;if(gr){var Ep="oninput"in document;if(!Ep){var uw=document.createElement("div");uw.setAttribute("oninput","return;"),Ep=typeof uw.oninput=="function"}jp=Ep}else jp=!1;cw=jp&&(!document.documentMode||9<document.documentMode)}function dw(){Xa&&(Xa.detachEvent("onpropertychange",fw),Ja=Xa=null)}function fw(i){if(i.propertyName==="value"&&hu(Ja)){var l=[];aw(l,Ja,i,xp(i)),X1(_R,l)}}function LR(i,l,o){i==="focusin"?(dw(),Xa=l,Ja=o,Xa.attachEvent("onpropertychange",fw)):i==="focusout"&&dw()}function qR(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return hu(Ja)}function BR(i,l){if(i==="click")return hu(l)}function $R(i,l){if(i==="input"||i==="change")return hu(l)}function IR(i,l){return i===l&&(i!==0||1/i===1/l)||i!==i&&l!==l}var ni=typeof Object.is=="function"?Object.is:IR;function Qa(i,l){if(ni(i,l))return!0;if(typeof i!="object"||i===null||typeof l!="object"||l===null)return!1;var o=Object.keys(i),d=Object.keys(l);if(o.length!==d.length)return!1;for(d=0;d<o.length;d++){var m=o[d];if(!Ke.call(l,m)||!ni(i[m],l[m]))return!1}return!0}function hw(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function pw(i,l){var o=hw(i);i=0;for(var d;o;){if(o.nodeType===3){if(d=i+o.textContent.length,i<=l&&d>=l)return{node:o,offset:l-i};i=d}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=hw(o)}}function mw(i,l){return i&&l?i===l?!0:i&&i.nodeType===3?!1:l&&l.nodeType===3?mw(i,l.parentNode):"contains"in i?i.contains(l):i.compareDocumentPosition?!!(i.compareDocumentPosition(l)&16):!1:!1}function gw(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var l=lu(i.document);l instanceof i.HTMLIFrameElement;){try{var o=typeof l.contentWindow.location.href=="string"}catch{o=!1}if(o)i=l.contentWindow;else break;l=lu(i.document)}return l}function Op(i){var l=i&&i.nodeName&&i.nodeName.toLowerCase();return l&&(l==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||l==="textarea"||i.contentEditable==="true")}var HR=gr&&"documentMode"in document&&11>=document.documentMode,Ol=null,Mp=null,Wa=null,Rp=!1;function yw(i,l,o){var d=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Rp||Ol==null||Ol!==lu(d)||(d=Ol,"selectionStart"in d&&Op(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Wa&&Qa(Wa,d)||(Wa=d,d=td(Mp,"onSelect"),0<d.length&&(l=new du("onSelect","select",null,l,o),i.push({event:l,listeners:d}),l.target=Ol)))}function Is(i,l){var o={};return o[i.toLowerCase()]=l.toLowerCase(),o["Webkit"+i]="webkit"+l,o["Moz"+i]="moz"+l,o}var Ml={animationend:Is("Animation","AnimationEnd"),animationiteration:Is("Animation","AnimationIteration"),animationstart:Is("Animation","AnimationStart"),transitionrun:Is("Transition","TransitionRun"),transitionstart:Is("Transition","TransitionStart"),transitioncancel:Is("Transition","TransitionCancel"),transitionend:Is("Transition","TransitionEnd")},Dp={},bw={};gr&&(bw=document.createElement("div").style,"AnimationEvent"in window||(delete Ml.animationend.animation,delete Ml.animationiteration.animation,delete Ml.animationstart.animation),"TransitionEvent"in window||delete Ml.transitionend.transition);function Hs(i){if(Dp[i])return Dp[i];if(!Ml[i])return i;var l=Ml[i],o;for(o in l)if(l.hasOwnProperty(o)&&o in bw)return Dp[i]=l[o];return i}var xw=Hs("animationend"),vw=Hs("animationiteration"),ww=Hs("animationstart"),zR=Hs("transitionrun"),UR=Hs("transitionstart"),VR=Hs("transitioncancel"),Sw=Hs("transitionend"),Aw=new Map,_p="abort auxClick beforeToggle 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(" ");_p.push("scrollEnd");function Bi(i,l){Aw.set(i,l),se(l,[i])}var pu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},wi=[],Rl=0,Lp=0;function mu(){for(var i=Rl,l=Lp=Rl=0;l<i;){var o=wi[l];wi[l++]=null;var d=wi[l];wi[l++]=null;var m=wi[l];wi[l++]=null;var y=wi[l];if(wi[l++]=null,d!==null&&m!==null){var S=d.pending;S===null?m.next=m:(m.next=S.next,S.next=m),d.pending=m}y!==0&&kw(o,m,y)}}function gu(i,l,o,d){wi[Rl++]=i,wi[Rl++]=l,wi[Rl++]=o,wi[Rl++]=d,Lp|=d,i.lanes|=d,i=i.alternate,i!==null&&(i.lanes|=d)}function qp(i,l,o,d){return gu(i,l,o,d),yu(i)}function zs(i,l){return gu(i,null,null,l),yu(i)}function kw(i,l,o){i.lanes|=o;var d=i.alternate;d!==null&&(d.lanes|=o);for(var m=!1,y=i.return;y!==null;)y.childLanes|=o,d=y.alternate,d!==null&&(d.childLanes|=o),y.tag===22&&(i=y.stateNode,i===null||i._visibility&1||(m=!0)),i=y,y=y.return;return i.tag===3?(y=i.stateNode,m&&l!==null&&(m=31-Z(o),i=y.hiddenUpdates,d=i[m],d===null?i[m]=[l]:d.push(l),l.lane=o|536870912),y):null}function yu(i){if(50<wo)throw wo=0,Pm=null,Error(r(185));for(var l=i.return;l!==null;)i=l,l=i.return;return i.tag===3?i.stateNode:null}var Dl={};function FR(i,l,o,d){this.tag=i,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ii(i,l,o,d){return new FR(i,l,o,d)}function Bp(i){return i=i.prototype,!(!i||!i.isReactComponent)}function yr(i,l){var o=i.alternate;return o===null?(o=ii(i.tag,l,i.key,i.mode),o.elementType=i.elementType,o.type=i.type,o.stateNode=i.stateNode,o.alternate=i,i.alternate=o):(o.pendingProps=l,o.type=i.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=i.flags&65011712,o.childLanes=i.childLanes,o.lanes=i.lanes,o.child=i.child,o.memoizedProps=i.memoizedProps,o.memoizedState=i.memoizedState,o.updateQueue=i.updateQueue,l=i.dependencies,o.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},o.sibling=i.sibling,o.index=i.index,o.ref=i.ref,o.refCleanup=i.refCleanup,o}function Cw(i,l){i.flags&=65011714;var o=i.alternate;return o===null?(i.childLanes=0,i.lanes=l,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,l=o.dependencies,i.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),i}function bu(i,l,o,d,m,y){var S=0;if(d=i,typeof i=="function")Bp(i)&&(S=1);else if(typeof i=="string")S=X4(i,o,ne.current)?26:i==="html"||i==="head"||i==="body"?27:5;else e:switch(i){case U:return i=ii(31,o,l,m),i.elementType=U,i.lanes=y,i;case C:return Us(o.children,m,y,l);case O:S=8,m|=24;break;case D:return i=ii(12,o,l,m|2),i.elementType=D,i.lanes=y,i;case _:return i=ii(13,o,l,m),i.elementType=_,i.lanes=y,i;case q:return i=ii(19,o,l,m),i.elementType=q,i.lanes=y,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case j:S=10;break e;case E:S=9;break e;case M:S=11;break e;case R:S=14;break e;case X:S=16,d=null;break e}S=29,o=Error(r(130,i===null?"null":typeof i,"")),d=null}return l=ii(S,o,l,m),l.elementType=i,l.type=d,l.lanes=y,l}function Us(i,l,o,d){return i=ii(7,i,d,l),i.lanes=o,i}function $p(i,l,o){return i=ii(6,i,null,l),i.lanes=o,i}function Nw(i){var l=ii(18,null,null,0);return l.stateNode=i,l}function Ip(i,l,o){return l=ii(4,i.children!==null?i.children:[],i.key,l),l.lanes=o,l.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},l}var Tw=new WeakMap;function Si(i,l){if(typeof i=="object"&&i!==null){var o=Tw.get(i);return o!==void 0?o:(l={value:i,source:l,stack:De(l)},Tw.set(i,l),l)}return{value:i,source:l,stack:De(l)}}var _l=[],Ll=0,xu=null,Za=0,Ai=[],ki=0,ns=null,Wi=1,Zi="";function br(i,l){_l[Ll++]=Za,_l[Ll++]=xu,xu=i,Za=l}function jw(i,l,o){Ai[ki++]=Wi,Ai[ki++]=Zi,Ai[ki++]=ns,ns=i;var d=Wi;i=Zi;var m=32-Z(d)-1;d&=~(1<<m),o+=1;var y=32-Z(l)+m;if(30<y){var S=m-m%5;y=(d&(1<<S)-1).toString(32),d>>=S,m-=S,Wi=1<<32-Z(l)+m|o<<m|d,Zi=y+i}else Wi=1<<y|o<<m|d,Zi=i}function Hp(i){i.return!==null&&(br(i,1),jw(i,1,0))}function zp(i){for(;i===xu;)xu=_l[--Ll],_l[Ll]=null,Za=_l[--Ll],_l[Ll]=null;for(;i===ns;)ns=Ai[--ki],Ai[ki]=null,Zi=Ai[--ki],Ai[ki]=null,Wi=Ai[--ki],Ai[ki]=null}function Ew(i,l){Ai[ki++]=Wi,Ai[ki++]=Zi,Ai[ki++]=ns,Wi=l.id,Zi=l.overflow,ns=i}var mn=null,Dt=null,pt=!1,is=null,Ci=!1,Up=Error(r(519));function rs(i){var l=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw eo(Si(l,i)),Up}function Ow(i){var l=i.stateNode,o=i.type,d=i.memoizedProps;switch(l[Ft]=i,l[Kt]=d,o){case"dialog":ct("cancel",l),ct("close",l);break;case"iframe":case"object":case"embed":ct("load",l);break;case"video":case"audio":for(o=0;o<Ao.length;o++)ct(Ao[o],l);break;case"source":ct("error",l);break;case"img":case"image":case"link":ct("error",l),ct("load",l);break;case"details":ct("toggle",l);break;case"input":ct("invalid",l),V1(l,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ct("invalid",l);break;case"textarea":ct("invalid",l),P1(l,d.value,d.defaultValue,d.children)}o=d.children,typeof o!="string"&&typeof o!="number"&&typeof o!="bigint"||l.textContent===""+o||d.suppressHydrationWarning===!0||K2(l.textContent,o)?(d.popover!=null&&(ct("beforetoggle",l),ct("toggle",l)),d.onScroll!=null&&ct("scroll",l),d.onScrollEnd!=null&&ct("scrollend",l),d.onClick!=null&&(l.onclick=mr),l=!0):l=!1,l||rs(i,!0)}function Mw(i){for(mn=i.return;mn;)switch(mn.tag){case 5:case 31:case 13:Ci=!1;return;case 27:case 3:Ci=!0;return;default:mn=mn.return}}function ql(i){if(i!==mn)return!1;if(!pt)return Mw(i),pt=!0,!1;var l=i.tag,o;if((o=l!==3&&l!==27)&&((o=l===5)&&(o=i.type,o=!(o!=="form"&&o!=="button")||lg(i.type,i.memoizedProps)),o=!o),o&&Dt&&rs(i),Mw(i),l===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Dt=nA(i)}else if(l===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(317));Dt=nA(i)}else l===27?(l=Dt,bs(i.type)?(i=dg,dg=null,Dt=i):Dt=l):Dt=mn?Ti(i.stateNode.nextSibling):null;return!0}function Vs(){Dt=mn=null,pt=!1}function Vp(){var i=is;return i!==null&&(Gn===null?Gn=i:Gn.push.apply(Gn,i),is=null),i}function eo(i){is===null?is=[i]:is.push(i)}var Fp=T(null),Fs=null,xr=null;function ss(i,l,o){he(Fp,l._currentValue),l._currentValue=o}function vr(i){i._currentValue=Fp.current,z(Fp)}function Pp(i,l,o){for(;i!==null;){var d=i.alternate;if((i.childLanes&l)!==l?(i.childLanes|=l,d!==null&&(d.childLanes|=l)):d!==null&&(d.childLanes&l)!==l&&(d.childLanes|=l),i===o)break;i=i.return}}function Yp(i,l,o,d){var m=i.child;for(m!==null&&(m.return=i);m!==null;){var y=m.dependencies;if(y!==null){var S=m.child;y=y.firstContext;e:for(;y!==null;){var N=y;y=m;for(var $=0;$<l.length;$++)if(N.context===l[$]){y.lanes|=o,N=y.alternate,N!==null&&(N.lanes|=o),Pp(y.return,o,i),d||(S=null);break e}y=N.next}}else if(m.tag===18){if(S=m.return,S===null)throw Error(r(341));S.lanes|=o,y=S.alternate,y!==null&&(y.lanes|=o),Pp(S,o,i),S=null}else S=m.child;if(S!==null)S.return=m;else for(S=m;S!==null;){if(S===i){S=null;break}if(m=S.sibling,m!==null){m.return=S.return,S=m;break}S=S.return}m=S}}function Bl(i,l,o,d){i=null;for(var m=l,y=!1;m!==null;){if(!y){if((m.flags&524288)!==0)y=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var S=m.alternate;if(S===null)throw Error(r(387));if(S=S.memoizedProps,S!==null){var N=m.type;ni(m.pendingProps.value,S.value)||(i!==null?i.push(N):i=[N])}}else if(m===$e.current){if(S=m.alternate,S===null)throw Error(r(387));S.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(i!==null?i.push(jo):i=[jo])}m=m.return}i!==null&&Yp(l,i,o,d),l.flags|=262144}function vu(i){for(i=i.firstContext;i!==null;){if(!ni(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function Ps(i){Fs=i,xr=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function gn(i){return Rw(Fs,i)}function wu(i,l){return Fs===null&&Ps(i),Rw(i,l)}function Rw(i,l){var o=l._currentValue;if(l={context:l,memoizedValue:o,next:null},xr===null){if(i===null)throw Error(r(308));xr=l,i.dependencies={lanes:0,firstContext:l},i.flags|=524288}else xr=xr.next=l;return o}var PR=typeof AbortController<"u"?AbortController:function(){var i=[],l=this.signal={aborted:!1,addEventListener:function(o,d){i.push(d)}};this.abort=function(){l.aborted=!0,i.forEach(function(o){return o()})}},YR=t.unstable_scheduleCallback,KR=t.unstable_NormalPriority,Xt={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Kp(){return{controller:new PR,data:new Map,refCount:0}}function to(i){i.refCount--,i.refCount===0&&YR(KR,function(){i.controller.abort()})}var no=null,Gp=0,$l=0,Il=null;function GR(i,l){if(no===null){var o=no=[];Gp=0,$l=Qm(),Il={status:"pending",value:void 0,then:function(d){o.push(d)}}}return Gp++,l.then(Dw,Dw),l}function Dw(){if(--Gp===0&&no!==null){Il!==null&&(Il.status="fulfilled");var i=no;no=null,$l=0,Il=null;for(var l=0;l<i.length;l++)(0,i[l])()}}function XR(i,l){var o=[],d={status:"pending",value:null,reason:null,then:function(m){o.push(m)}};return i.then(function(){d.status="fulfilled",d.value=l;for(var m=0;m<o.length;m++)(0,o[m])(l)},function(m){for(d.status="rejected",d.reason=m,m=0;m<o.length;m++)(0,o[m])(void 0)}),d}var _w=L.S;L.S=function(i,l){y2=ht(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&GR(i,l),_w!==null&&_w(i,l)};var Ys=T(null);function Xp(){var i=Ys.current;return i!==null?i:Ot.pooledCache}function Su(i,l){l===null?he(Ys,Ys.current):he(Ys,l.pool)}function Lw(){var i=Xp();return i===null?null:{parent:Xt._currentValue,pool:i}}var Hl=Error(r(460)),Jp=Error(r(474)),Au=Error(r(542)),ku={then:function(){}};function qw(i){return i=i.status,i==="fulfilled"||i==="rejected"}function Bw(i,l,o){switch(o=i[o],o===void 0?i.push(l):o!==l&&(l.then(mr,mr),l=o),l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,Iw(i),i;default:if(typeof l.status=="string")l.then(mr,mr);else{if(i=Ot,i!==null&&100<i.shellSuspendCounter)throw Error(r(482));i=l,i.status="pending",i.then(function(d){if(l.status==="pending"){var m=l;m.status="fulfilled",m.value=d}},function(d){if(l.status==="pending"){var m=l;m.status="rejected",m.reason=d}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw i=l.reason,Iw(i),i}throw Gs=l,Hl}}function Ks(i){try{var l=i._init;return l(i._payload)}catch(o){throw o!==null&&typeof o=="object"&&typeof o.then=="function"?(Gs=o,Hl):o}}var Gs=null;function $w(){if(Gs===null)throw Error(r(459));var i=Gs;return Gs=null,i}function Iw(i){if(i===Hl||i===Au)throw Error(r(483))}var zl=null,io=0;function Cu(i){var l=io;return io+=1,zl===null&&(zl=[]),Bw(zl,i,l)}function ro(i,l){l=l.props.ref,i.ref=l!==void 0?l:null}function Nu(i,l){throw l.$$typeof===v?Error(r(525)):(i=Object.prototype.toString.call(l),Error(r(31,i==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":i)))}function Hw(i){function l(P,H){if(i){var ee=P.deletions;ee===null?(P.deletions=[H],P.flags|=16):ee.push(H)}}function o(P,H){if(!i)return null;for(;H!==null;)l(P,H),H=H.sibling;return null}function d(P){for(var H=new Map;P!==null;)P.key!==null?H.set(P.key,P):H.set(P.index,P),P=P.sibling;return H}function m(P,H){return P=yr(P,H),P.index=0,P.sibling=null,P}function y(P,H,ee){return P.index=ee,i?(ee=P.alternate,ee!==null?(ee=ee.index,ee<H?(P.flags|=67108866,H):ee):(P.flags|=67108866,H)):(P.flags|=1048576,H)}function S(P){return i&&P.alternate===null&&(P.flags|=67108866),P}function N(P,H,ee,ge){return H===null||H.tag!==6?(H=$p(ee,P.mode,ge),H.return=P,H):(H=m(H,ee),H.return=P,H)}function $(P,H,ee,ge){var Ve=ee.type;return Ve===C?de(P,H,ee.props.children,ge,ee.key):H!==null&&(H.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===X&&Ks(Ve)===H.type)?(H=m(H,ee.props),ro(H,ee),H.return=P,H):(H=bu(ee.type,ee.key,ee.props,null,P.mode,ge),ro(H,ee),H.return=P,H)}function te(P,H,ee,ge){return H===null||H.tag!==4||H.stateNode.containerInfo!==ee.containerInfo||H.stateNode.implementation!==ee.implementation?(H=Ip(ee,P.mode,ge),H.return=P,H):(H=m(H,ee.children||[]),H.return=P,H)}function de(P,H,ee,ge,Ve){return H===null||H.tag!==7?(H=Us(ee,P.mode,ge,Ve),H.return=P,H):(H=m(H,ee),H.return=P,H)}function be(P,H,ee){if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return H=$p(""+H,P.mode,ee),H.return=P,H;if(typeof H=="object"&&H!==null){switch(H.$$typeof){case w:return ee=bu(H.type,H.key,H.props,null,P.mode,ee),ro(ee,H),ee.return=P,ee;case A:return H=Ip(H,P.mode,ee),H.return=P,H;case X:return H=Ks(H),be(P,H,ee)}if(fe(H)||W(H))return H=Us(H,P.mode,ee,null),H.return=P,H;if(typeof H.then=="function")return be(P,Cu(H),ee);if(H.$$typeof===j)return be(P,wu(P,H),ee);Nu(P,H)}return null}function ie(P,H,ee,ge){var Ve=H!==null?H.key:null;if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return Ve!==null?null:N(P,H,""+ee,ge);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:return ee.key===Ve?$(P,H,ee,ge):null;case A:return ee.key===Ve?te(P,H,ee,ge):null;case X:return ee=Ks(ee),ie(P,H,ee,ge)}if(fe(ee)||W(ee))return Ve!==null?null:de(P,H,ee,ge,null);if(typeof ee.then=="function")return ie(P,H,Cu(ee),ge);if(ee.$$typeof===j)return ie(P,H,wu(P,ee),ge);Nu(P,ee)}return null}function le(P,H,ee,ge,Ve){if(typeof ge=="string"&&ge!==""||typeof ge=="number"||typeof ge=="bigint")return P=P.get(ee)||null,N(H,P,""+ge,Ve);if(typeof ge=="object"&&ge!==null){switch(ge.$$typeof){case w:return P=P.get(ge.key===null?ee:ge.key)||null,$(H,P,ge,Ve);case A:return P=P.get(ge.key===null?ee:ge.key)||null,te(H,P,ge,Ve);case X:return ge=Ks(ge),le(P,H,ee,ge,Ve)}if(fe(ge)||W(ge))return P=P.get(ee)||null,de(H,P,ge,Ve,null);if(typeof ge.then=="function")return le(P,H,ee,Cu(ge),Ve);if(ge.$$typeof===j)return le(P,H,ee,wu(H,ge),Ve);Nu(H,ge)}return null}function Be(P,H,ee,ge){for(var Ve=null,bt=null,He=H,it=H=0,ft=null;He!==null&&it<ee.length;it++){He.index>it?(ft=He,He=null):ft=He.sibling;var xt=ie(P,He,ee[it],ge);if(xt===null){He===null&&(He=ft);break}i&&He&&xt.alternate===null&&l(P,He),H=y(xt,H,it),bt===null?Ve=xt:bt.sibling=xt,bt=xt,He=ft}if(it===ee.length)return o(P,He),pt&&br(P,it),Ve;if(He===null){for(;it<ee.length;it++)He=be(P,ee[it],ge),He!==null&&(H=y(He,H,it),bt===null?Ve=He:bt.sibling=He,bt=He);return pt&&br(P,it),Ve}for(He=d(He);it<ee.length;it++)ft=le(He,P,it,ee[it],ge),ft!==null&&(i&&ft.alternate!==null&&He.delete(ft.key===null?it:ft.key),H=y(ft,H,it),bt===null?Ve=ft:bt.sibling=ft,bt=ft);return i&&He.forEach(function(As){return l(P,As)}),pt&&br(P,it),Ve}function Ge(P,H,ee,ge){if(ee==null)throw Error(r(151));for(var Ve=null,bt=null,He=H,it=H=0,ft=null,xt=ee.next();He!==null&&!xt.done;it++,xt=ee.next()){He.index>it?(ft=He,He=null):ft=He.sibling;var As=ie(P,He,xt.value,ge);if(As===null){He===null&&(He=ft);break}i&&He&&As.alternate===null&&l(P,He),H=y(As,H,it),bt===null?Ve=As:bt.sibling=As,bt=As,He=ft}if(xt.done)return o(P,He),pt&&br(P,it),Ve;if(He===null){for(;!xt.done;it++,xt=ee.next())xt=be(P,xt.value,ge),xt!==null&&(H=y(xt,H,it),bt===null?Ve=xt:bt.sibling=xt,bt=xt);return pt&&br(P,it),Ve}for(He=d(He);!xt.done;it++,xt=ee.next())xt=le(He,P,it,xt.value,ge),xt!==null&&(i&&xt.alternate!==null&&He.delete(xt.key===null?it:xt.key),H=y(xt,H,it),bt===null?Ve=xt:bt.sibling=xt,bt=xt);return i&&He.forEach(function(lD){return l(P,lD)}),pt&&br(P,it),Ve}function Tt(P,H,ee,ge){if(typeof ee=="object"&&ee!==null&&ee.type===C&&ee.key===null&&(ee=ee.props.children),typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case w:e:{for(var Ve=ee.key;H!==null;){if(H.key===Ve){if(Ve=ee.type,Ve===C){if(H.tag===7){o(P,H.sibling),ge=m(H,ee.props.children),ge.return=P,P=ge;break e}}else if(H.elementType===Ve||typeof Ve=="object"&&Ve!==null&&Ve.$$typeof===X&&Ks(Ve)===H.type){o(P,H.sibling),ge=m(H,ee.props),ro(ge,ee),ge.return=P,P=ge;break e}o(P,H);break}else l(P,H);H=H.sibling}ee.type===C?(ge=Us(ee.props.children,P.mode,ge,ee.key),ge.return=P,P=ge):(ge=bu(ee.type,ee.key,ee.props,null,P.mode,ge),ro(ge,ee),ge.return=P,P=ge)}return S(P);case A:e:{for(Ve=ee.key;H!==null;){if(H.key===Ve)if(H.tag===4&&H.stateNode.containerInfo===ee.containerInfo&&H.stateNode.implementation===ee.implementation){o(P,H.sibling),ge=m(H,ee.children||[]),ge.return=P,P=ge;break e}else{o(P,H);break}else l(P,H);H=H.sibling}ge=Ip(ee,P.mode,ge),ge.return=P,P=ge}return S(P);case X:return ee=Ks(ee),Tt(P,H,ee,ge)}if(fe(ee))return Be(P,H,ee,ge);if(W(ee)){if(Ve=W(ee),typeof Ve!="function")throw Error(r(150));return ee=Ve.call(ee),Ge(P,H,ee,ge)}if(typeof ee.then=="function")return Tt(P,H,Cu(ee),ge);if(ee.$$typeof===j)return Tt(P,H,wu(P,ee),ge);Nu(P,ee)}return typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint"?(ee=""+ee,H!==null&&H.tag===6?(o(P,H.sibling),ge=m(H,ee),ge.return=P,P=ge):(o(P,H),ge=$p(ee,P.mode,ge),ge.return=P,P=ge),S(P)):o(P,H)}return function(P,H,ee,ge){try{io=0;var Ve=Tt(P,H,ee,ge);return zl=null,Ve}catch(He){if(He===Hl||He===Au)throw He;var bt=ii(29,He,null,P.mode);return bt.lanes=ge,bt.return=P,bt}}}var Xs=Hw(!0),zw=Hw(!1),ls=!1;function Qp(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Wp(i,l){i=i.updateQueue,l.updateQueue===i&&(l.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function as(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function os(i,l,o){var d=i.updateQueue;if(d===null)return null;if(d=d.shared,(vt&2)!==0){var m=d.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),d.pending=l,l=yu(i),kw(i,null,o),l}return gu(i,d,l,o),yu(i)}function so(i,l,o){if(l=l.updateQueue,l!==null&&(l=l.shared,(o&4194048)!==0)){var d=l.lanes;d&=i.pendingLanes,o|=d,l.lanes=o,yi(i,o)}}function Zp(i,l){var o=i.updateQueue,d=i.alternate;if(d!==null&&(d=d.updateQueue,o===d)){var m=null,y=null;if(o=o.firstBaseUpdate,o!==null){do{var S={lane:o.lane,tag:o.tag,payload:o.payload,callback:null,next:null};y===null?m=y=S:y=y.next=S,o=o.next}while(o!==null);y===null?m=y=l:y=y.next=l}else m=y=l;o={baseState:d.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},i.updateQueue=o;return}i=o.lastBaseUpdate,i===null?o.firstBaseUpdate=l:i.next=l,o.lastBaseUpdate=l}var em=!1;function lo(){if(em){var i=Il;if(i!==null)throw i}}function ao(i,l,o,d){em=!1;var m=i.updateQueue;ls=!1;var y=m.firstBaseUpdate,S=m.lastBaseUpdate,N=m.shared.pending;if(N!==null){m.shared.pending=null;var $=N,te=$.next;$.next=null,S===null?y=te:S.next=te,S=$;var de=i.alternate;de!==null&&(de=de.updateQueue,N=de.lastBaseUpdate,N!==S&&(N===null?de.firstBaseUpdate=te:N.next=te,de.lastBaseUpdate=$))}if(y!==null){var be=m.baseState;S=0,de=te=$=null,N=y;do{var ie=N.lane&-536870913,le=ie!==N.lane;if(le?(dt&ie)===ie:(d&ie)===ie){ie!==0&&ie===$l&&(em=!0),de!==null&&(de=de.next={lane:0,tag:N.tag,payload:N.payload,callback:null,next:null});e:{var Be=i,Ge=N;ie=l;var Tt=o;switch(Ge.tag){case 1:if(Be=Ge.payload,typeof Be=="function"){be=Be.call(Tt,be,ie);break e}be=Be;break e;case 3:Be.flags=Be.flags&-65537|128;case 0:if(Be=Ge.payload,ie=typeof Be=="function"?Be.call(Tt,be,ie):Be,ie==null)break e;be=b({},be,ie);break e;case 2:ls=!0}}ie=N.callback,ie!==null&&(i.flags|=64,le&&(i.flags|=8192),le=m.callbacks,le===null?m.callbacks=[ie]:le.push(ie))}else le={lane:ie,tag:N.tag,payload:N.payload,callback:N.callback,next:null},de===null?(te=de=le,$=be):de=de.next=le,S|=ie;if(N=N.next,N===null){if(N=m.shared.pending,N===null)break;le=N,N=le.next,le.next=null,m.lastBaseUpdate=le,m.shared.pending=null}}while(!0);de===null&&($=be),m.baseState=$,m.firstBaseUpdate=te,m.lastBaseUpdate=de,y===null&&(m.shared.lanes=0),hs|=S,i.lanes=S,i.memoizedState=be}}function Uw(i,l){if(typeof i!="function")throw Error(r(191,i));i.call(l)}function Vw(i,l){var o=i.callbacks;if(o!==null)for(i.callbacks=null,i=0;i<o.length;i++)Uw(o[i],l)}var Ul=T(null),Tu=T(0);function Fw(i,l){i=Er,he(Tu,i),he(Ul,l),Er=i|l.baseLanes}function tm(){he(Tu,Er),he(Ul,Ul.current)}function nm(){Er=Tu.current,z(Ul),z(Tu)}var ri=T(null),Ni=null;function cs(i){var l=i.alternate;he(Pt,Pt.current&1),he(ri,i),Ni===null&&(l===null||Ul.current!==null||l.memoizedState!==null)&&(Ni=i)}function im(i){he(Pt,Pt.current),he(ri,i),Ni===null&&(Ni=i)}function Pw(i){i.tag===22?(he(Pt,Pt.current),he(ri,i),Ni===null&&(Ni=i)):us()}function us(){he(Pt,Pt.current),he(ri,ri.current)}function si(i){z(ri),Ni===i&&(Ni=null),z(Pt)}var Pt=T(0);function ju(i){for(var l=i;l!==null;){if(l.tag===13){var o=l.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||cg(o)||ug(o)))return l}else if(l.tag===19&&(l.memoizedProps.revealOrder==="forwards"||l.memoizedProps.revealOrder==="backwards"||l.memoizedProps.revealOrder==="unstable_legacy-backwards"||l.memoizedProps.revealOrder==="together")){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var wr=0,nt=null,Ct=null,Jt=null,Eu=!1,Vl=!1,Js=!1,Ou=0,oo=0,Fl=null,JR=0;function $t(){throw Error(r(321))}function rm(i,l){if(l===null)return!1;for(var o=0;o<l.length&&o<i.length;o++)if(!ni(i[o],l[o]))return!1;return!0}function sm(i,l,o,d,m,y){return wr=y,nt=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,L.H=i===null||i.memoizedState===null?jS:vm,Js=!1,y=o(d,m),Js=!1,Vl&&(y=Kw(l,o,d,m)),Yw(i),y}function Yw(i){L.H=fo;var l=Ct!==null&&Ct.next!==null;if(wr=0,Jt=Ct=nt=null,Eu=!1,oo=0,Fl=null,l)throw Error(r(300));i===null||Qt||(i=i.dependencies,i!==null&&vu(i)&&(Qt=!0))}function Kw(i,l,o,d){nt=i;var m=0;do{if(Vl&&(Fl=null),oo=0,Vl=!1,25<=m)throw Error(r(301));if(m+=1,Jt=Ct=null,i.updateQueue!=null){var y=i.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}L.H=ES,y=l(o,d)}while(Vl);return y}function QR(){var i=L.H,l=i.useState()[0];return l=typeof l.then=="function"?co(l):l,i=i.useState()[0],(Ct!==null?Ct.memoizedState:null)!==i&&(nt.flags|=1024),l}function lm(){var i=Ou!==0;return Ou=0,i}function am(i,l,o){l.updateQueue=i.updateQueue,l.flags&=-2053,i.lanes&=~o}function om(i){if(Eu){for(i=i.memoizedState;i!==null;){var l=i.queue;l!==null&&(l.pending=null),i=i.next}Eu=!1}wr=0,Jt=Ct=nt=null,Vl=!1,oo=Ou=0,Fl=null}function Bn(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Jt===null?nt.memoizedState=Jt=i:Jt=Jt.next=i,Jt}function Yt(){if(Ct===null){var i=nt.alternate;i=i!==null?i.memoizedState:null}else i=Ct.next;var l=Jt===null?nt.memoizedState:Jt.next;if(l!==null)Jt=l,Ct=i;else{if(i===null)throw nt.alternate===null?Error(r(467)):Error(r(310));Ct=i,i={memoizedState:Ct.memoizedState,baseState:Ct.baseState,baseQueue:Ct.baseQueue,queue:Ct.queue,next:null},Jt===null?nt.memoizedState=Jt=i:Jt=Jt.next=i}return Jt}function Mu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function co(i){var l=oo;return oo+=1,Fl===null&&(Fl=[]),i=Bw(Fl,i,l),l=nt,(Jt===null?l.memoizedState:Jt.next)===null&&(l=l.alternate,L.H=l===null||l.memoizedState===null?jS:vm),i}function Ru(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return co(i);if(i.$$typeof===j)return gn(i)}throw Error(r(438,String(i)))}function cm(i){var l=null,o=nt.updateQueue;if(o!==null&&(l=o.memoCache),l==null){var d=nt.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(l={data:d.data.map(function(m){return m.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),o===null&&(o=Mu(),nt.updateQueue=o),o.memoCache=l,o=l.data[l.index],o===void 0)for(o=l.data[l.index]=Array(i),d=0;d<i;d++)o[d]=B;return l.index++,o}function Sr(i,l){return typeof l=="function"?l(i):l}function Du(i){var l=Yt();return um(l,Ct,i)}function um(i,l,o){var d=i.queue;if(d===null)throw Error(r(311));d.lastRenderedReducer=o;var m=i.baseQueue,y=d.pending;if(y!==null){if(m!==null){var S=m.next;m.next=y.next,y.next=S}l.baseQueue=m=y,d.pending=null}if(y=i.baseState,m===null)i.memoizedState=y;else{l=m.next;var N=S=null,$=null,te=l,de=!1;do{var be=te.lane&-536870913;if(be!==te.lane?(dt&be)===be:(wr&be)===be){var ie=te.revertLane;if(ie===0)$!==null&&($=$.next={lane:0,revertLane:0,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null}),be===$l&&(de=!0);else if((wr&ie)===ie){te=te.next,ie===$l&&(de=!0);continue}else be={lane:0,revertLane:te.revertLane,gesture:null,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},$===null?(N=$=be,S=y):$=$.next=be,nt.lanes|=ie,hs|=ie;be=te.action,Js&&o(y,be),y=te.hasEagerState?te.eagerState:o(y,be)}else ie={lane:be,revertLane:te.revertLane,gesture:te.gesture,action:te.action,hasEagerState:te.hasEagerState,eagerState:te.eagerState,next:null},$===null?(N=$=ie,S=y):$=$.next=ie,nt.lanes|=be,hs|=be;te=te.next}while(te!==null&&te!==l);if($===null?S=y:$.next=N,!ni(y,i.memoizedState)&&(Qt=!0,de&&(o=Il,o!==null)))throw o;i.memoizedState=y,i.baseState=S,i.baseQueue=$,d.lastRenderedState=y}return m===null&&(d.lanes=0),[i.memoizedState,d.dispatch]}function dm(i){var l=Yt(),o=l.queue;if(o===null)throw Error(r(311));o.lastRenderedReducer=i;var d=o.dispatch,m=o.pending,y=l.memoizedState;if(m!==null){o.pending=null;var S=m=m.next;do y=i(y,S.action),S=S.next;while(S!==m);ni(y,l.memoizedState)||(Qt=!0),l.memoizedState=y,l.baseQueue===null&&(l.baseState=y),o.lastRenderedState=y}return[y,d]}function Gw(i,l,o){var d=nt,m=Yt(),y=pt;if(y){if(o===void 0)throw Error(r(407));o=o()}else o=l();var S=!ni((Ct||m).memoizedState,o);if(S&&(m.memoizedState=o,Qt=!0),m=m.queue,pm(Qw.bind(null,d,m,i),[i]),m.getSnapshot!==l||S||Jt!==null&&Jt.memoizedState.tag&1){if(d.flags|=2048,Pl(9,{destroy:void 0},Jw.bind(null,d,m,o,l),null),Ot===null)throw Error(r(349));y||(wr&127)!==0||Xw(d,l,o)}return o}function Xw(i,l,o){i.flags|=16384,i={getSnapshot:l,value:o},l=nt.updateQueue,l===null?(l=Mu(),nt.updateQueue=l,l.stores=[i]):(o=l.stores,o===null?l.stores=[i]:o.push(i))}function Jw(i,l,o,d){l.value=o,l.getSnapshot=d,Ww(l)&&Zw(i)}function Qw(i,l,o){return o(function(){Ww(l)&&Zw(i)})}function Ww(i){var l=i.getSnapshot;i=i.value;try{var o=l();return!ni(i,o)}catch{return!0}}function Zw(i){var l=zs(i,2);l!==null&&Xn(l,i,2)}function fm(i){var l=Bn();if(typeof i=="function"){var o=i;if(i=o(),Js){Y(!0);try{o()}finally{Y(!1)}}}return l.memoizedState=l.baseState=i,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:i},l}function eS(i,l,o,d){return i.baseState=o,um(i,Ct,typeof d=="function"?d:Sr)}function WR(i,l,o,d,m){if(qu(i))throw Error(r(485));if(i=l.action,i!==null){var y={payload:m,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){y.listeners.push(S)}};L.T!==null?o(!0):y.isTransition=!1,d(y),o=l.pending,o===null?(y.next=l.pending=y,tS(l,y)):(y.next=o.next,l.pending=o.next=y)}}function tS(i,l){var o=l.action,d=l.payload,m=i.state;if(l.isTransition){var y=L.T,S={};L.T=S;try{var N=o(m,d),$=L.S;$!==null&&$(S,N),nS(i,l,N)}catch(te){hm(i,l,te)}finally{y!==null&&S.types!==null&&(y.types=S.types),L.T=y}}else try{y=o(m,d),nS(i,l,y)}catch(te){hm(i,l,te)}}function nS(i,l,o){o!==null&&typeof o=="object"&&typeof o.then=="function"?o.then(function(d){iS(i,l,d)},function(d){return hm(i,l,d)}):iS(i,l,o)}function iS(i,l,o){l.status="fulfilled",l.value=o,rS(l),i.state=o,l=i.pending,l!==null&&(o=l.next,o===l?i.pending=null:(o=o.next,l.next=o,tS(i,o)))}function hm(i,l,o){var d=i.pending;if(i.pending=null,d!==null){d=d.next;do l.status="rejected",l.reason=o,rS(l),l=l.next;while(l!==d)}i.action=null}function rS(i){i=i.listeners;for(var l=0;l<i.length;l++)(0,i[l])()}function sS(i,l){return l}function lS(i,l){if(pt){var o=Ot.formState;if(o!==null){e:{var d=nt;if(pt){if(Dt){t:{for(var m=Dt,y=Ci;m.nodeType!==8;){if(!y){m=null;break t}if(m=Ti(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){Dt=Ti(m.nextSibling),d=m.data==="F!";break e}}rs(d)}d=!1}d&&(l=o[0])}}return o=Bn(),o.memoizedState=o.baseState=l,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:sS,lastRenderedState:l},o.queue=d,o=CS.bind(null,nt,d),d.dispatch=o,d=fm(!1),y=xm.bind(null,nt,!1,d.queue),d=Bn(),m={state:l,dispatch:null,action:i,pending:null},d.queue=m,o=WR.bind(null,nt,m,y,o),m.dispatch=o,d.memoizedState=i,[l,o,!1]}function aS(i){var l=Yt();return oS(l,Ct,i)}function oS(i,l,o){if(l=um(i,l,sS)[0],i=Du(Sr)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var d=co(l)}catch(S){throw S===Hl?Au:S}else d=l;l=Yt();var m=l.queue,y=m.dispatch;return o!==l.memoizedState&&(nt.flags|=2048,Pl(9,{destroy:void 0},ZR.bind(null,m,o),null)),[d,y,i]}function ZR(i,l){i.action=l}function cS(i){var l=Yt(),o=Ct;if(o!==null)return oS(l,o,i);Yt(),l=l.memoizedState,o=Yt();var d=o.queue.dispatch;return o.memoizedState=i,[l,d,!1]}function Pl(i,l,o,d){return i={tag:i,create:o,deps:d,inst:l,next:null},l=nt.updateQueue,l===null&&(l=Mu(),nt.updateQueue=l),o=l.lastEffect,o===null?l.lastEffect=i.next=i:(d=o.next,o.next=i,i.next=d,l.lastEffect=i),i}function uS(){return Yt().memoizedState}function _u(i,l,o,d){var m=Bn();nt.flags|=i,m.memoizedState=Pl(1|l,{destroy:void 0},o,d===void 0?null:d)}function Lu(i,l,o,d){var m=Yt();d=d===void 0?null:d;var y=m.memoizedState.inst;Ct!==null&&d!==null&&rm(d,Ct.memoizedState.deps)?m.memoizedState=Pl(l,y,o,d):(nt.flags|=i,m.memoizedState=Pl(1|l,y,o,d))}function dS(i,l){_u(8390656,8,i,l)}function pm(i,l){Lu(2048,8,i,l)}function e4(i){nt.flags|=4;var l=nt.updateQueue;if(l===null)l=Mu(),nt.updateQueue=l,l.events=[i];else{var o=l.events;o===null?l.events=[i]:o.push(i)}}function fS(i){var l=Yt().memoizedState;return e4({ref:l,nextImpl:i}),function(){if((vt&2)!==0)throw Error(r(440));return l.impl.apply(void 0,arguments)}}function hS(i,l){return Lu(4,2,i,l)}function pS(i,l){return Lu(4,4,i,l)}function mS(i,l){if(typeof l=="function"){i=i();var o=l(i);return function(){typeof o=="function"?o():l(null)}}if(l!=null)return i=i(),l.current=i,function(){l.current=null}}function gS(i,l,o){o=o!=null?o.concat([i]):null,Lu(4,4,mS.bind(null,l,i),o)}function mm(){}function yS(i,l){var o=Yt();l=l===void 0?null:l;var d=o.memoizedState;return l!==null&&rm(l,d[1])?d[0]:(o.memoizedState=[i,l],i)}function bS(i,l){var o=Yt();l=l===void 0?null:l;var d=o.memoizedState;if(l!==null&&rm(l,d[1]))return d[0];if(d=i(),Js){Y(!0);try{i()}finally{Y(!1)}}return o.memoizedState=[d,l],d}function gm(i,l,o){return o===void 0||(wr&1073741824)!==0&&(dt&261930)===0?i.memoizedState=l:(i.memoizedState=o,i=x2(),nt.lanes|=i,hs|=i,o)}function xS(i,l,o,d){return ni(o,l)?o:Ul.current!==null?(i=gm(i,o,d),ni(i,l)||(Qt=!0),i):(wr&42)===0||(wr&1073741824)!==0&&(dt&261930)===0?(Qt=!0,i.memoizedState=o):(i=x2(),nt.lanes|=i,hs|=i,l)}function vS(i,l,o,d,m){var y=Q.p;Q.p=y!==0&&8>y?y:8;var S=L.T,N={};L.T=N,xm(i,!1,l,o);try{var $=m(),te=L.S;if(te!==null&&te(N,$),$!==null&&typeof $=="object"&&typeof $.then=="function"){var de=XR($,d);uo(i,l,de,oi(i))}else uo(i,l,d,oi(i))}catch(be){uo(i,l,{then:function(){},status:"rejected",reason:be},oi())}finally{Q.p=y,S!==null&&N.types!==null&&(S.types=N.types),L.T=S}}function t4(){}function ym(i,l,o,d){if(i.tag!==5)throw Error(r(476));var m=wS(i).queue;vS(i,m,l,oe,o===null?t4:function(){return SS(i),o(d)})}function wS(i){var l=i.memoizedState;if(l!==null)return l;l={memoizedState:oe,baseState:oe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:oe},next:null};var o={};return l.next={memoizedState:o,baseState:o,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Sr,lastRenderedState:o},next:null},i.memoizedState=l,i=i.alternate,i!==null&&(i.memoizedState=l),l}function SS(i){var l=wS(i);l.next===null&&(l=i.alternate.memoizedState),uo(i,l.next.queue,{},oi())}function bm(){return gn(jo)}function AS(){return Yt().memoizedState}function kS(){return Yt().memoizedState}function n4(i){for(var l=i.return;l!==null;){switch(l.tag){case 24:case 3:var o=oi();i=as(o);var d=os(l,i,o);d!==null&&(Xn(d,l,o),so(d,l,o)),l={cache:Kp()},i.payload=l;return}l=l.return}}function i4(i,l,o){var d=oi();o={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null},qu(i)?NS(l,o):(o=qp(i,l,o,d),o!==null&&(Xn(o,i,d),TS(o,l,d)))}function CS(i,l,o){var d=oi();uo(i,l,o,d)}function uo(i,l,o,d){var m={lane:d,revertLane:0,gesture:null,action:o,hasEagerState:!1,eagerState:null,next:null};if(qu(i))NS(l,m);else{var y=i.alternate;if(i.lanes===0&&(y===null||y.lanes===0)&&(y=l.lastRenderedReducer,y!==null))try{var S=l.lastRenderedState,N=y(S,o);if(m.hasEagerState=!0,m.eagerState=N,ni(N,S))return gu(i,l,m,0),Ot===null&&mu(),!1}catch{}if(o=qp(i,l,m,d),o!==null)return Xn(o,i,d),TS(o,l,d),!0}return!1}function xm(i,l,o,d){if(d={lane:2,revertLane:Qm(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},qu(i)){if(l)throw Error(r(479))}else l=qp(i,o,d,2),l!==null&&Xn(l,i,2)}function qu(i){var l=i.alternate;return i===nt||l!==null&&l===nt}function NS(i,l){Vl=Eu=!0;var o=i.pending;o===null?l.next=l:(l.next=o.next,o.next=l),i.pending=l}function TS(i,l,o){if((o&4194048)!==0){var d=l.lanes;d&=i.pendingLanes,o|=d,l.lanes=o,yi(i,o)}}var fo={readContext:gn,use:Ru,useCallback:$t,useContext:$t,useEffect:$t,useImperativeHandle:$t,useLayoutEffect:$t,useInsertionEffect:$t,useMemo:$t,useReducer:$t,useRef:$t,useState:$t,useDebugValue:$t,useDeferredValue:$t,useTransition:$t,useSyncExternalStore:$t,useId:$t,useHostTransitionStatus:$t,useFormState:$t,useActionState:$t,useOptimistic:$t,useMemoCache:$t,useCacheRefresh:$t};fo.useEffectEvent=$t;var jS={readContext:gn,use:Ru,useCallback:function(i,l){return Bn().memoizedState=[i,l===void 0?null:l],i},useContext:gn,useEffect:dS,useImperativeHandle:function(i,l,o){o=o!=null?o.concat([i]):null,_u(4194308,4,mS.bind(null,l,i),o)},useLayoutEffect:function(i,l){return _u(4194308,4,i,l)},useInsertionEffect:function(i,l){_u(4,2,i,l)},useMemo:function(i,l){var o=Bn();l=l===void 0?null:l;var d=i();if(Js){Y(!0);try{i()}finally{Y(!1)}}return o.memoizedState=[d,l],d},useReducer:function(i,l,o){var d=Bn();if(o!==void 0){var m=o(l);if(Js){Y(!0);try{o(l)}finally{Y(!1)}}}else m=l;return d.memoizedState=d.baseState=m,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:m},d.queue=i,i=i.dispatch=i4.bind(null,nt,i),[d.memoizedState,i]},useRef:function(i){var l=Bn();return i={current:i},l.memoizedState=i},useState:function(i){i=fm(i);var l=i.queue,o=CS.bind(null,nt,l);return l.dispatch=o,[i.memoizedState,o]},useDebugValue:mm,useDeferredValue:function(i,l){var o=Bn();return gm(o,i,l)},useTransition:function(){var i=fm(!1);return i=vS.bind(null,nt,i.queue,!0,!1),Bn().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,l,o){var d=nt,m=Bn();if(pt){if(o===void 0)throw Error(r(407));o=o()}else{if(o=l(),Ot===null)throw Error(r(349));(dt&127)!==0||Xw(d,l,o)}m.memoizedState=o;var y={value:o,getSnapshot:l};return m.queue=y,dS(Qw.bind(null,d,y,i),[i]),d.flags|=2048,Pl(9,{destroy:void 0},Jw.bind(null,d,y,o,l),null),o},useId:function(){var i=Bn(),l=Ot.identifierPrefix;if(pt){var o=Zi,d=Wi;o=(d&~(1<<32-Z(d)-1)).toString(32)+o,l="_"+l+"R_"+o,o=Ou++,0<o&&(l+="H"+o.toString(32)),l+="_"}else o=JR++,l="_"+l+"r_"+o.toString(32)+"_";return i.memoizedState=l},useHostTransitionStatus:bm,useFormState:lS,useActionState:lS,useOptimistic:function(i){var l=Bn();l.memoizedState=l.baseState=i;var o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=o,l=xm.bind(null,nt,!0,o),o.dispatch=l,[i,l]},useMemoCache:cm,useCacheRefresh:function(){return Bn().memoizedState=n4.bind(null,nt)},useEffectEvent:function(i){var l=Bn(),o={impl:i};return l.memoizedState=o,function(){if((vt&2)!==0)throw Error(r(440));return o.impl.apply(void 0,arguments)}}},vm={readContext:gn,use:Ru,useCallback:yS,useContext:gn,useEffect:pm,useImperativeHandle:gS,useInsertionEffect:hS,useLayoutEffect:pS,useMemo:bS,useReducer:Du,useRef:uS,useState:function(){return Du(Sr)},useDebugValue:mm,useDeferredValue:function(i,l){var o=Yt();return xS(o,Ct.memoizedState,i,l)},useTransition:function(){var i=Du(Sr)[0],l=Yt().memoizedState;return[typeof i=="boolean"?i:co(i),l]},useSyncExternalStore:Gw,useId:AS,useHostTransitionStatus:bm,useFormState:aS,useActionState:aS,useOptimistic:function(i,l){var o=Yt();return eS(o,Ct,i,l)},useMemoCache:cm,useCacheRefresh:kS};vm.useEffectEvent=fS;var ES={readContext:gn,use:Ru,useCallback:yS,useContext:gn,useEffect:pm,useImperativeHandle:gS,useInsertionEffect:hS,useLayoutEffect:pS,useMemo:bS,useReducer:dm,useRef:uS,useState:function(){return dm(Sr)},useDebugValue:mm,useDeferredValue:function(i,l){var o=Yt();return Ct===null?gm(o,i,l):xS(o,Ct.memoizedState,i,l)},useTransition:function(){var i=dm(Sr)[0],l=Yt().memoizedState;return[typeof i=="boolean"?i:co(i),l]},useSyncExternalStore:Gw,useId:AS,useHostTransitionStatus:bm,useFormState:cS,useActionState:cS,useOptimistic:function(i,l){var o=Yt();return Ct!==null?eS(o,Ct,i,l):(o.baseState=i,[i,o.queue.dispatch])},useMemoCache:cm,useCacheRefresh:kS};ES.useEffectEvent=fS;function wm(i,l,o,d){l=i.memoizedState,o=o(d,l),o=o==null?l:b({},l,o),i.memoizedState=o,i.lanes===0&&(i.updateQueue.baseState=o)}var Sm={enqueueSetState:function(i,l,o){i=i._reactInternals;var d=oi(),m=as(d);m.payload=l,o!=null&&(m.callback=o),l=os(i,m,d),l!==null&&(Xn(l,i,d),so(l,i,d))},enqueueReplaceState:function(i,l,o){i=i._reactInternals;var d=oi(),m=as(d);m.tag=1,m.payload=l,o!=null&&(m.callback=o),l=os(i,m,d),l!==null&&(Xn(l,i,d),so(l,i,d))},enqueueForceUpdate:function(i,l){i=i._reactInternals;var o=oi(),d=as(o);d.tag=2,l!=null&&(d.callback=l),l=os(i,d,o),l!==null&&(Xn(l,i,o),so(l,i,o))}};function OS(i,l,o,d,m,y,S){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(d,y,S):l.prototype&&l.prototype.isPureReactComponent?!Qa(o,d)||!Qa(m,y):!0}function MS(i,l,o,d){i=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(o,d),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(o,d),l.state!==i&&Sm.enqueueReplaceState(l,l.state,null)}function Qs(i,l){var o=l;if("ref"in l){o={};for(var d in l)d!=="ref"&&(o[d]=l[d])}if(i=i.defaultProps){o===l&&(o=b({},o));for(var m in i)o[m]===void 0&&(o[m]=i[m])}return o}function RS(i){pu(i)}function DS(i){console.error(i)}function _S(i){pu(i)}function Bu(i,l){try{var o=i.onUncaughtError;o(l.value,{componentStack:l.stack})}catch(d){setTimeout(function(){throw d})}}function LS(i,l,o){try{var d=i.onCaughtError;d(o.value,{componentStack:o.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function Am(i,l,o){return o=as(o),o.tag=3,o.payload={element:null},o.callback=function(){Bu(i,l)},o}function qS(i){return i=as(i),i.tag=3,i}function BS(i,l,o,d){var m=o.type.getDerivedStateFromError;if(typeof m=="function"){var y=d.value;i.payload=function(){return m(y)},i.callback=function(){LS(l,o,d)}}var S=o.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(i.callback=function(){LS(l,o,d),typeof m!="function"&&(ps===null?ps=new Set([this]):ps.add(this));var N=d.stack;this.componentDidCatch(d.value,{componentStack:N!==null?N:""})})}function r4(i,l,o,d,m){if(o.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(l=o.alternate,l!==null&&Bl(l,o,m,!0),o=ri.current,o!==null){switch(o.tag){case 31:case 13:return Ni===null?Xu():o.alternate===null&&It===0&&(It=3),o.flags&=-257,o.flags|=65536,o.lanes=m,d===ku?o.flags|=16384:(l=o.updateQueue,l===null?o.updateQueue=new Set([d]):l.add(d),Gm(i,d,m)),!1;case 22:return o.flags|=65536,d===ku?o.flags|=16384:(l=o.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([d])},o.updateQueue=l):(o=l.retryQueue,o===null?l.retryQueue=new Set([d]):o.add(d)),Gm(i,d,m)),!1}throw Error(r(435,o.tag))}return Gm(i,d,m),Xu(),!1}if(pt)return l=ri.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,d!==Up&&(i=Error(r(422),{cause:d}),eo(Si(i,o)))):(d!==Up&&(l=Error(r(423),{cause:d}),eo(Si(l,o))),i=i.current.alternate,i.flags|=65536,m&=-m,i.lanes|=m,d=Si(d,o),m=Am(i.stateNode,d,m),Zp(i,m),It!==4&&(It=2)),!1;var y=Error(r(520),{cause:d});if(y=Si(y,o),vo===null?vo=[y]:vo.push(y),It!==4&&(It=2),l===null)return!0;d=Si(d,o),o=l;do{switch(o.tag){case 3:return o.flags|=65536,i=m&-m,o.lanes|=i,i=Am(o.stateNode,d,i),Zp(o,i),!1;case 1:if(l=o.type,y=o.stateNode,(o.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(ps===null||!ps.has(y))))return o.flags|=65536,m&=-m,o.lanes|=m,m=qS(m),BS(m,i,o,d),Zp(o,m),!1}o=o.return}while(o!==null);return!1}var km=Error(r(461)),Qt=!1;function yn(i,l,o,d){l.child=i===null?zw(l,null,o,d):Xs(l,i.child,o,d)}function $S(i,l,o,d,m){o=o.render;var y=l.ref;if("ref"in d){var S={};for(var N in d)N!=="ref"&&(S[N]=d[N])}else S=d;return Ps(l),d=sm(i,l,o,S,y,m),N=lm(),i!==null&&!Qt?(am(i,l,m),Ar(i,l,m)):(pt&&N&&Hp(l),l.flags|=1,yn(i,l,d,m),l.child)}function IS(i,l,o,d,m){if(i===null){var y=o.type;return typeof y=="function"&&!Bp(y)&&y.defaultProps===void 0&&o.compare===null?(l.tag=15,l.type=y,HS(i,l,y,d,m)):(i=bu(o.type,null,d,l,l.mode,m),i.ref=l.ref,i.return=l,l.child=i)}if(y=i.child,!Rm(i,m)){var S=y.memoizedProps;if(o=o.compare,o=o!==null?o:Qa,o(S,d)&&i.ref===l.ref)return Ar(i,l,m)}return l.flags|=1,i=yr(y,d),i.ref=l.ref,i.return=l,l.child=i}function HS(i,l,o,d,m){if(i!==null){var y=i.memoizedProps;if(Qa(y,d)&&i.ref===l.ref)if(Qt=!1,l.pendingProps=d=y,Rm(i,m))(i.flags&131072)!==0&&(Qt=!0);else return l.lanes=i.lanes,Ar(i,l,m)}return Cm(i,l,o,d,m)}function zS(i,l,o,d){var m=d.children,y=i!==null?i.memoizedState:null;if(i===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((l.flags&128)!==0){if(y=y!==null?y.baseLanes|o:o,i!==null){for(d=l.child=i.child,m=0;d!==null;)m=m|d.lanes|d.childLanes,d=d.sibling;d=m&~y}else d=0,l.child=null;return US(i,l,y,o,d)}if((o&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},i!==null&&Su(l,y!==null?y.cachePool:null),y!==null?Fw(l,y):tm(),Pw(l);else return d=l.lanes=536870912,US(i,l,y!==null?y.baseLanes|o:o,o,d)}else y!==null?(Su(l,y.cachePool),Fw(l,y),us(),l.memoizedState=null):(i!==null&&Su(l,null),tm(),us());return yn(i,l,m,o),l.child}function ho(i,l){return i!==null&&i.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function US(i,l,o,d,m){var y=Xp();return y=y===null?null:{parent:Xt._currentValue,pool:y},l.memoizedState={baseLanes:o,cachePool:y},i!==null&&Su(l,null),tm(),Pw(l),i!==null&&Bl(i,l,d,!0),l.childLanes=m,null}function $u(i,l){return l=Hu({mode:l.mode,children:l.children},i.mode),l.ref=i.ref,i.child=l,l.return=i,l}function VS(i,l,o){return Xs(l,i.child,null,o),i=$u(l,l.pendingProps),i.flags|=2,si(l),l.memoizedState=null,i}function s4(i,l,o){var d=l.pendingProps,m=(l.flags&128)!==0;if(l.flags&=-129,i===null){if(pt){if(d.mode==="hidden")return i=$u(l,d),l.lanes=536870912,ho(null,i);if(im(l),(i=Dt)?(i=tA(i,Ci),i=i!==null&&i.data==="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:ns!==null?{id:Wi,overflow:Zi}:null,retryLane:536870912,hydrationErrors:null},o=Nw(i),o.return=l,l.child=o,mn=l,Dt=null)):i=null,i===null)throw rs(l);return l.lanes=536870912,null}return $u(l,d)}var y=i.memoizedState;if(y!==null){var S=y.dehydrated;if(im(l),m)if(l.flags&256)l.flags&=-257,l=VS(i,l,o);else if(l.memoizedState!==null)l.child=i.child,l.flags|=128,l=null;else throw Error(r(558));else if(Qt||Bl(i,l,o,!1),m=(o&i.childLanes)!==0,Qt||m){if(d=Ot,d!==null&&(S=Ee(d,o),S!==0&&S!==y.retryLane))throw y.retryLane=S,zs(i,S),Xn(d,i,S),km;Xu(),l=VS(i,l,o)}else i=y.treeContext,Dt=Ti(S.nextSibling),mn=l,pt=!0,is=null,Ci=!1,i!==null&&Ew(l,i),l=$u(l,d),l.flags|=4096;return l}return i=yr(i.child,{mode:d.mode,children:d.children}),i.ref=l.ref,l.child=i,i.return=l,i}function Iu(i,l){var o=l.ref;if(o===null)i!==null&&i.ref!==null&&(l.flags|=4194816);else{if(typeof o!="function"&&typeof o!="object")throw Error(r(284));(i===null||i.ref!==o)&&(l.flags|=4194816)}}function Cm(i,l,o,d,m){return Ps(l),o=sm(i,l,o,d,void 0,m),d=lm(),i!==null&&!Qt?(am(i,l,m),Ar(i,l,m)):(pt&&d&&Hp(l),l.flags|=1,yn(i,l,o,m),l.child)}function FS(i,l,o,d,m,y){return Ps(l),l.updateQueue=null,o=Kw(l,d,o,m),Yw(i),d=lm(),i!==null&&!Qt?(am(i,l,y),Ar(i,l,y)):(pt&&d&&Hp(l),l.flags|=1,yn(i,l,o,y),l.child)}function PS(i,l,o,d,m){if(Ps(l),l.stateNode===null){var y=Dl,S=o.contextType;typeof S=="object"&&S!==null&&(y=gn(S)),y=new o(d,y),l.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Sm,l.stateNode=y,y._reactInternals=l,y=l.stateNode,y.props=d,y.state=l.memoizedState,y.refs={},Qp(l),S=o.contextType,y.context=typeof S=="object"&&S!==null?gn(S):Dl,y.state=l.memoizedState,S=o.getDerivedStateFromProps,typeof S=="function"&&(wm(l,o,S,d),y.state=l.memoizedState),typeof o.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(S=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),S!==y.state&&Sm.enqueueReplaceState(y,y.state,null),ao(l,d,y,m),lo(),y.state=l.memoizedState),typeof y.componentDidMount=="function"&&(l.flags|=4194308),d=!0}else if(i===null){y=l.stateNode;var N=l.memoizedProps,$=Qs(o,N);y.props=$;var te=y.context,de=o.contextType;S=Dl,typeof de=="object"&&de!==null&&(S=gn(de));var be=o.getDerivedStateFromProps;de=typeof be=="function"||typeof y.getSnapshotBeforeUpdate=="function",N=l.pendingProps!==N,de||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(N||te!==S)&&MS(l,y,d,S),ls=!1;var ie=l.memoizedState;y.state=ie,ao(l,d,y,m),lo(),te=l.memoizedState,N||ie!==te||ls?(typeof be=="function"&&(wm(l,o,be,d),te=l.memoizedState),($=ls||OS(l,o,$,d,ie,te,S))?(de||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(l.flags|=4194308)):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=d,l.memoizedState=te),y.props=d,y.state=te,y.context=S,d=$):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),d=!1)}else{y=l.stateNode,Wp(i,l),S=l.memoizedProps,de=Qs(o,S),y.props=de,be=l.pendingProps,ie=y.context,te=o.contextType,$=Dl,typeof te=="object"&&te!==null&&($=gn(te)),N=o.getDerivedStateFromProps,(te=typeof N=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==be||ie!==$)&&MS(l,y,d,$),ls=!1,ie=l.memoizedState,y.state=ie,ao(l,d,y,m),lo();var le=l.memoizedState;S!==be||ie!==le||ls||i!==null&&i.dependencies!==null&&vu(i.dependencies)?(typeof N=="function"&&(wm(l,o,N,d),le=l.memoizedState),(de=ls||OS(l,o,de,d,ie,le,$)||i!==null&&i.dependencies!==null&&vu(i.dependencies))?(te||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,le,$),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,le,$)),typeof y.componentDidUpdate=="function"&&(l.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof y.componentDidUpdate!="function"||S===i.memoizedProps&&ie===i.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===i.memoizedProps&&ie===i.memoizedState||(l.flags|=1024),l.memoizedProps=d,l.memoizedState=le),y.props=d,y.state=le,y.context=$,d=de):(typeof y.componentDidUpdate!="function"||S===i.memoizedProps&&ie===i.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===i.memoizedProps&&ie===i.memoizedState||(l.flags|=1024),d=!1)}return y=d,Iu(i,l),d=(l.flags&128)!==0,y||d?(y=l.stateNode,o=d&&typeof o.getDerivedStateFromError!="function"?null:y.render(),l.flags|=1,i!==null&&d?(l.child=Xs(l,i.child,null,m),l.child=Xs(l,null,o,m)):yn(i,l,o,m),l.memoizedState=y.state,i=l.child):i=Ar(i,l,m),i}function YS(i,l,o,d){return Vs(),l.flags|=256,yn(i,l,o,d),l.child}var Nm={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Tm(i){return{baseLanes:i,cachePool:Lw()}}function jm(i,l,o){return i=i!==null?i.childLanes&~o:0,l&&(i|=ai),i}function KS(i,l,o){var d=l.pendingProps,m=!1,y=(l.flags&128)!==0,S;if((S=y)||(S=i!==null&&i.memoizedState===null?!1:(Pt.current&2)!==0),S&&(m=!0,l.flags&=-129),S=(l.flags&32)!==0,l.flags&=-33,i===null){if(pt){if(m?cs(l):us(),(i=Dt)?(i=tA(i,Ci),i=i!==null&&i.data!=="&"?i:null,i!==null&&(l.memoizedState={dehydrated:i,treeContext:ns!==null?{id:Wi,overflow:Zi}:null,retryLane:536870912,hydrationErrors:null},o=Nw(i),o.return=l,l.child=o,mn=l,Dt=null)):i=null,i===null)throw rs(l);return ug(i)?l.lanes=32:l.lanes=536870912,null}var N=d.children;return d=d.fallback,m?(us(),m=l.mode,N=Hu({mode:"hidden",children:N},m),d=Us(d,m,o,null),N.return=l,d.return=l,N.sibling=d,l.child=N,d=l.child,d.memoizedState=Tm(o),d.childLanes=jm(i,S,o),l.memoizedState=Nm,ho(null,d)):(cs(l),Em(l,N))}var $=i.memoizedState;if($!==null&&(N=$.dehydrated,N!==null)){if(y)l.flags&256?(cs(l),l.flags&=-257,l=Om(i,l,o)):l.memoizedState!==null?(us(),l.child=i.child,l.flags|=128,l=null):(us(),N=d.fallback,m=l.mode,d=Hu({mode:"visible",children:d.children},m),N=Us(N,m,o,null),N.flags|=2,d.return=l,N.return=l,d.sibling=N,l.child=d,Xs(l,i.child,null,o),d=l.child,d.memoizedState=Tm(o),d.childLanes=jm(i,S,o),l.memoizedState=Nm,l=ho(null,d));else if(cs(l),ug(N)){if(S=N.nextSibling&&N.nextSibling.dataset,S)var te=S.dgst;S=te,d=Error(r(419)),d.stack="",d.digest=S,eo({value:d,source:null,stack:null}),l=Om(i,l,o)}else if(Qt||Bl(i,l,o,!1),S=(o&i.childLanes)!==0,Qt||S){if(S=Ot,S!==null&&(d=Ee(S,o),d!==0&&d!==$.retryLane))throw $.retryLane=d,zs(i,d),Xn(S,i,d),km;cg(N)||Xu(),l=Om(i,l,o)}else cg(N)?(l.flags|=192,l.child=i.child,l=null):(i=$.treeContext,Dt=Ti(N.nextSibling),mn=l,pt=!0,is=null,Ci=!1,i!==null&&Ew(l,i),l=Em(l,d.children),l.flags|=4096);return l}return m?(us(),N=d.fallback,m=l.mode,$=i.child,te=$.sibling,d=yr($,{mode:"hidden",children:d.children}),d.subtreeFlags=$.subtreeFlags&65011712,te!==null?N=yr(te,N):(N=Us(N,m,o,null),N.flags|=2),N.return=l,d.return=l,d.sibling=N,l.child=d,ho(null,d),d=l.child,N=i.child.memoizedState,N===null?N=Tm(o):(m=N.cachePool,m!==null?($=Xt._currentValue,m=m.parent!==$?{parent:$,pool:$}:m):m=Lw(),N={baseLanes:N.baseLanes|o,cachePool:m}),d.memoizedState=N,d.childLanes=jm(i,S,o),l.memoizedState=Nm,ho(i.child,d)):(cs(l),o=i.child,i=o.sibling,o=yr(o,{mode:"visible",children:d.children}),o.return=l,o.sibling=null,i!==null&&(S=l.deletions,S===null?(l.deletions=[i],l.flags|=16):S.push(i)),l.child=o,l.memoizedState=null,o)}function Em(i,l){return l=Hu({mode:"visible",children:l},i.mode),l.return=i,i.child=l}function Hu(i,l){return i=ii(22,i,null,l),i.lanes=0,i}function Om(i,l,o){return Xs(l,i.child,null,o),i=Em(l,l.pendingProps.children),i.flags|=2,l.memoizedState=null,i}function GS(i,l,o){i.lanes|=l;var d=i.alternate;d!==null&&(d.lanes|=l),Pp(i.return,l,o)}function Mm(i,l,o,d,m,y){var S=i.memoizedState;S===null?i.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:d,tail:o,tailMode:m,treeForkCount:y}:(S.isBackwards=l,S.rendering=null,S.renderingStartTime=0,S.last=d,S.tail=o,S.tailMode=m,S.treeForkCount=y)}function XS(i,l,o){var d=l.pendingProps,m=d.revealOrder,y=d.tail;d=d.children;var S=Pt.current,N=(S&2)!==0;if(N?(S=S&1|2,l.flags|=128):S&=1,he(Pt,S),yn(i,l,d,o),d=pt?Za:0,!N&&i!==null&&(i.flags&128)!==0)e:for(i=l.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&GS(i,o,l);else if(i.tag===19)GS(i,o,l);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===l)break e;for(;i.sibling===null;){if(i.return===null||i.return===l)break e;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(m){case"forwards":for(o=l.child,m=null;o!==null;)i=o.alternate,i!==null&&ju(i)===null&&(m=o),o=o.sibling;o=m,o===null?(m=l.child,l.child=null):(m=o.sibling,o.sibling=null),Mm(l,!1,m,o,y,d);break;case"backwards":case"unstable_legacy-backwards":for(o=null,m=l.child,l.child=null;m!==null;){if(i=m.alternate,i!==null&&ju(i)===null){l.child=m;break}i=m.sibling,m.sibling=o,o=m,m=i}Mm(l,!0,o,null,y,d);break;case"together":Mm(l,!1,null,null,void 0,d);break;default:l.memoizedState=null}return l.child}function Ar(i,l,o){if(i!==null&&(l.dependencies=i.dependencies),hs|=l.lanes,(o&l.childLanes)===0)if(i!==null){if(Bl(i,l,o,!1),(o&l.childLanes)===0)return null}else return null;if(i!==null&&l.child!==i.child)throw Error(r(153));if(l.child!==null){for(i=l.child,o=yr(i,i.pendingProps),l.child=o,o.return=l;i.sibling!==null;)i=i.sibling,o=o.sibling=yr(i,i.pendingProps),o.return=l;o.sibling=null}return l.child}function Rm(i,l){return(i.lanes&l)!==0?!0:(i=i.dependencies,!!(i!==null&&vu(i)))}function l4(i,l,o){switch(l.tag){case 3:Fe(l,l.stateNode.containerInfo),ss(l,Xt,i.memoizedState.cache),Vs();break;case 27:case 5:Ie(l);break;case 4:Fe(l,l.stateNode.containerInfo);break;case 10:ss(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,im(l),null;break;case 13:var d=l.memoizedState;if(d!==null)return d.dehydrated!==null?(cs(l),l.flags|=128,null):(o&l.child.childLanes)!==0?KS(i,l,o):(cs(l),i=Ar(i,l,o),i!==null?i.sibling:null);cs(l);break;case 19:var m=(i.flags&128)!==0;if(d=(o&l.childLanes)!==0,d||(Bl(i,l,o,!1),d=(o&l.childLanes)!==0),m){if(d)return XS(i,l,o);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),he(Pt,Pt.current),d)break;return null;case 22:return l.lanes=0,zS(i,l,o,l.pendingProps);case 24:ss(l,Xt,i.memoizedState.cache)}return Ar(i,l,o)}function JS(i,l,o){if(i!==null)if(i.memoizedProps!==l.pendingProps)Qt=!0;else{if(!Rm(i,o)&&(l.flags&128)===0)return Qt=!1,l4(i,l,o);Qt=(i.flags&131072)!==0}else Qt=!1,pt&&(l.flags&1048576)!==0&&jw(l,Za,l.index);switch(l.lanes=0,l.tag){case 16:e:{var d=l.pendingProps;if(i=Ks(l.elementType),l.type=i,typeof i=="function")Bp(i)?(d=Qs(i,d),l.tag=1,l=PS(null,l,i,d,o)):(l.tag=0,l=Cm(null,l,i,d,o));else{if(i!=null){var m=i.$$typeof;if(m===M){l.tag=11,l=$S(null,l,i,d,o);break e}else if(m===R){l.tag=14,l=IS(null,l,i,d,o);break e}}throw l=pe(i)||i,Error(r(306,l,""))}}return l;case 0:return Cm(i,l,l.type,l.pendingProps,o);case 1:return d=l.type,m=Qs(d,l.pendingProps),PS(i,l,d,m,o);case 3:e:{if(Fe(l,l.stateNode.containerInfo),i===null)throw Error(r(387));d=l.pendingProps;var y=l.memoizedState;m=y.element,Wp(i,l),ao(l,d,null,o);var S=l.memoizedState;if(d=S.cache,ss(l,Xt,d),d!==y.cache&&Yp(l,[Xt],o,!0),lo(),d=S.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:S.cache},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){l=YS(i,l,d,o);break e}else if(d!==m){m=Si(Error(r(424)),l),eo(m),l=YS(i,l,d,o);break e}else for(i=l.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,Dt=Ti(i.firstChild),mn=l,pt=!0,is=null,Ci=!0,o=zw(l,null,d,o),l.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Vs(),d===m){l=Ar(i,l,o);break e}yn(i,l,d,o)}l=l.child}return l;case 26:return Iu(i,l),i===null?(o=aA(l.type,null,l.pendingProps,null))?l.memoizedState=o:pt||(o=l.type,i=l.pendingProps,d=nd(qe.current).createElement(o),d[Ft]=l,d[Kt]=i,bn(d,o,i),Gt(d),l.stateNode=d):l.memoizedState=aA(l.type,i.memoizedProps,l.pendingProps,i.memoizedState),null;case 27:return Ie(l),i===null&&pt&&(d=l.stateNode=rA(l.type,l.pendingProps,qe.current),mn=l,Ci=!0,m=Dt,bs(l.type)?(dg=m,Dt=Ti(d.firstChild)):Dt=m),yn(i,l,l.pendingProps.children,o),Iu(i,l),i===null&&(l.flags|=4194304),l.child;case 5:return i===null&&pt&&((m=d=Dt)&&(d=q4(d,l.type,l.pendingProps,Ci),d!==null?(l.stateNode=d,mn=l,Dt=Ti(d.firstChild),Ci=!1,m=!0):m=!1),m||rs(l)),Ie(l),m=l.type,y=l.pendingProps,S=i!==null?i.memoizedProps:null,d=y.children,lg(m,y)?d=null:S!==null&&lg(m,S)&&(l.flags|=32),l.memoizedState!==null&&(m=sm(i,l,QR,null,null,o),jo._currentValue=m),Iu(i,l),yn(i,l,d,o),l.child;case 6:return i===null&&pt&&((i=o=Dt)&&(o=B4(o,l.pendingProps,Ci),o!==null?(l.stateNode=o,mn=l,Dt=null,i=!0):i=!1),i||rs(l)),null;case 13:return KS(i,l,o);case 4:return Fe(l,l.stateNode.containerInfo),d=l.pendingProps,i===null?l.child=Xs(l,null,d,o):yn(i,l,d,o),l.child;case 11:return $S(i,l,l.type,l.pendingProps,o);case 7:return yn(i,l,l.pendingProps,o),l.child;case 8:return yn(i,l,l.pendingProps.children,o),l.child;case 12:return yn(i,l,l.pendingProps.children,o),l.child;case 10:return d=l.pendingProps,ss(l,l.type,d.value),yn(i,l,d.children,o),l.child;case 9:return m=l.type._context,d=l.pendingProps.children,Ps(l),m=gn(m),d=d(m),l.flags|=1,yn(i,l,d,o),l.child;case 14:return IS(i,l,l.type,l.pendingProps,o);case 15:return HS(i,l,l.type,l.pendingProps,o);case 19:return XS(i,l,o);case 31:return s4(i,l,o);case 22:return zS(i,l,o,l.pendingProps);case 24:return Ps(l),d=gn(Xt),i===null?(m=Xp(),m===null&&(m=Ot,y=Kp(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=o),m=y),l.memoizedState={parent:d,cache:m},Qp(l),ss(l,Xt,m)):((i.lanes&o)!==0&&(Wp(i,l),ao(l,null,null,o),lo()),m=i.memoizedState,y=l.memoizedState,m.parent!==d?(m={parent:d,cache:d},l.memoizedState=m,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=m),ss(l,Xt,d)):(d=y.cache,ss(l,Xt,d),d!==m.cache&&Yp(l,[Xt],o,!0))),yn(i,l,l.pendingProps.children,o),l.child;case 29:throw l.pendingProps}throw Error(r(156,l.tag))}function kr(i){i.flags|=4}function Dm(i,l,o,d,m){if((l=(i.mode&32)!==0)&&(l=!1),l){if(i.flags|=16777216,(m&335544128)===m)if(i.stateNode.complete)i.flags|=8192;else if(A2())i.flags|=8192;else throw Gs=ku,Jp}else i.flags&=-16777217}function QS(i,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!fA(l))if(A2())i.flags|=8192;else throw Gs=ku,Jp}function zu(i,l){l!==null&&(i.flags|=4),i.flags&16384&&(l=i.tag!==22?pn():536870912,i.lanes|=l,Xl|=l)}function po(i,l){if(!pt)switch(i.tailMode){case"hidden":l=i.tail;for(var o=null;l!==null;)l.alternate!==null&&(o=l),l=l.sibling;o===null?i.tail=null:o.sibling=null;break;case"collapsed":o=i.tail;for(var d=null;o!==null;)o.alternate!==null&&(d=o),o=o.sibling;d===null?l||i.tail===null?i.tail=null:i.tail.sibling=null:d.sibling=null}}function _t(i){var l=i.alternate!==null&&i.alternate.child===i.child,o=0,d=0;if(l)for(var m=i.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags&65011712,d|=m.flags&65011712,m.return=i,m=m.sibling;else for(m=i.child;m!==null;)o|=m.lanes|m.childLanes,d|=m.subtreeFlags,d|=m.flags,m.return=i,m=m.sibling;return i.subtreeFlags|=d,i.childLanes=o,l}function a4(i,l,o){var d=l.pendingProps;switch(zp(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return _t(l),null;case 1:return _t(l),null;case 3:return o=l.stateNode,d=null,i!==null&&(d=i.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),vr(Xt),Ye(),o.pendingContext&&(o.context=o.pendingContext,o.pendingContext=null),(i===null||i.child===null)&&(ql(l)?kr(l):i===null||i.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Vp())),_t(l),null;case 26:var m=l.type,y=l.memoizedState;return i===null?(kr(l),y!==null?(_t(l),QS(l,y)):(_t(l),Dm(l,m,null,d,o))):y?y!==i.memoizedState?(kr(l),_t(l),QS(l,y)):(_t(l),l.flags&=-16777217):(i=i.memoizedProps,i!==d&&kr(l),_t(l),Dm(l,m,i,d,o)),null;case 27:if(ut(l),o=qe.current,m=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==d&&kr(l);else{if(!d){if(l.stateNode===null)throw Error(r(166));return _t(l),null}i=ne.current,ql(l)?Ow(l):(i=rA(m,d,o),l.stateNode=i,kr(l))}return _t(l),null;case 5:if(ut(l),m=l.type,i!==null&&l.stateNode!=null)i.memoizedProps!==d&&kr(l);else{if(!d){if(l.stateNode===null)throw Error(r(166));return _t(l),null}if(y=ne.current,ql(l))Ow(l);else{var S=nd(qe.current);switch(y){case 1:y=S.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=S.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=S.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?S.createElement("select",{is:d.is}):S.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?S.createElement(m,{is:d.is}):S.createElement(m)}}y[Ft]=l,y[Kt]=d;e:for(S=l.child;S!==null;){if(S.tag===5||S.tag===6)y.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===l)break e;for(;S.sibling===null;){if(S.return===null||S.return===l)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}l.stateNode=y;e:switch(bn(y,m,d),m){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&kr(l)}}return _t(l),Dm(l,l.type,i===null?null:i.memoizedProps,l.pendingProps,o),null;case 6:if(i&&l.stateNode!=null)i.memoizedProps!==d&&kr(l);else{if(typeof d!="string"&&l.stateNode===null)throw Error(r(166));if(i=qe.current,ql(l)){if(i=l.stateNode,o=l.memoizedProps,d=null,m=mn,m!==null)switch(m.tag){case 27:case 5:d=m.memoizedProps}i[Ft]=l,i=!!(i.nodeValue===o||d!==null&&d.suppressHydrationWarning===!0||K2(i.nodeValue,o)),i||rs(l,!0)}else i=nd(i).createTextNode(d),i[Ft]=l,l.stateNode=i}return _t(l),null;case 31:if(o=l.memoizedState,i===null||i.memoizedState!==null){if(d=ql(l),o!==null){if(i===null){if(!d)throw Error(r(318));if(i=l.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(r(557));i[Ft]=l}else Vs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;_t(l),i=!1}else o=Vp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=o),i=!0;if(!i)return l.flags&256?(si(l),l):(si(l),null);if((l.flags&128)!==0)throw Error(r(558))}return _t(l),null;case 13:if(d=l.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(m=ql(l),d!==null&&d.dehydrated!==null){if(i===null){if(!m)throw Error(r(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(r(317));m[Ft]=l}else Vs(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;_t(l),m=!1}else m=Vp(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(si(l),l):(si(l),null)}return si(l),(l.flags&128)!==0?(l.lanes=o,l):(o=d!==null,i=i!==null&&i.memoizedState!==null,o&&(d=l.child,m=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(m=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==m&&(d.flags|=2048)),o!==i&&o&&(l.child.flags|=8192),zu(l,l.updateQueue),_t(l),null);case 4:return Ye(),i===null&&tg(l.stateNode.containerInfo),_t(l),null;case 10:return vr(l.type),_t(l),null;case 19:if(z(Pt),d=l.memoizedState,d===null)return _t(l),null;if(m=(l.flags&128)!==0,y=d.rendering,y===null)if(m)po(d,!1);else{if(It!==0||i!==null&&(i.flags&128)!==0)for(i=l.child;i!==null;){if(y=ju(i),y!==null){for(l.flags|=128,po(d,!1),i=y.updateQueue,l.updateQueue=i,zu(l,i),l.subtreeFlags=0,i=o,o=l.child;o!==null;)Cw(o,i),o=o.sibling;return he(Pt,Pt.current&1|2),pt&&br(l,d.treeForkCount),l.child}i=i.sibling}d.tail!==null&&ht()>Yu&&(l.flags|=128,m=!0,po(d,!1),l.lanes=4194304)}else{if(!m)if(i=ju(y),i!==null){if(l.flags|=128,m=!0,i=i.updateQueue,l.updateQueue=i,zu(l,i),po(d,!0),d.tail===null&&d.tailMode==="hidden"&&!y.alternate&&!pt)return _t(l),null}else 2*ht()-d.renderingStartTime>Yu&&o!==536870912&&(l.flags|=128,m=!0,po(d,!1),l.lanes=4194304);d.isBackwards?(y.sibling=l.child,l.child=y):(i=d.last,i!==null?i.sibling=y:l.child=y,d.last=y)}return d.tail!==null?(i=d.tail,d.rendering=i,d.tail=i.sibling,d.renderingStartTime=ht(),i.sibling=null,o=Pt.current,he(Pt,m?o&1|2:o&1),pt&&br(l,d.treeForkCount),i):(_t(l),null);case 22:case 23:return si(l),nm(),d=l.memoizedState!==null,i!==null?i.memoizedState!==null!==d&&(l.flags|=8192):d&&(l.flags|=8192),d?(o&536870912)!==0&&(l.flags&128)===0&&(_t(l),l.subtreeFlags&6&&(l.flags|=8192)):_t(l),o=l.updateQueue,o!==null&&zu(l,o.retryQueue),o=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),d=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==o&&(l.flags|=2048),i!==null&&z(Ys),null;case 24:return o=null,i!==null&&(o=i.memoizedState.cache),l.memoizedState.cache!==o&&(l.flags|=2048),vr(Xt),_t(l),null;case 25:return null;case 30:return null}throw Error(r(156,l.tag))}function o4(i,l){switch(zp(l),l.tag){case 1:return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 3:return vr(Xt),Ye(),i=l.flags,(i&65536)!==0&&(i&128)===0?(l.flags=i&-65537|128,l):null;case 26:case 27:case 5:return ut(l),null;case 31:if(l.memoizedState!==null){if(si(l),l.alternate===null)throw Error(r(340));Vs()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 13:if(si(l),i=l.memoizedState,i!==null&&i.dehydrated!==null){if(l.alternate===null)throw Error(r(340));Vs()}return i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 19:return z(Pt),null;case 4:return Ye(),null;case 10:return vr(l.type),null;case 22:case 23:return si(l),nm(),i!==null&&z(Ys),i=l.flags,i&65536?(l.flags=i&-65537|128,l):null;case 24:return vr(Xt),null;case 25:return null;default:return null}}function WS(i,l){switch(zp(l),l.tag){case 3:vr(Xt),Ye();break;case 26:case 27:case 5:ut(l);break;case 4:Ye();break;case 31:l.memoizedState!==null&&si(l);break;case 13:si(l);break;case 19:z(Pt);break;case 10:vr(l.type);break;case 22:case 23:si(l),nm(),i!==null&&z(Ys);break;case 24:vr(Xt)}}function mo(i,l){try{var o=l.updateQueue,d=o!==null?o.lastEffect:null;if(d!==null){var m=d.next;o=m;do{if((o.tag&i)===i){d=void 0;var y=o.create,S=o.inst;d=y(),S.destroy=d}o=o.next}while(o!==m)}}catch(N){At(l,l.return,N)}}function ds(i,l,o){try{var d=l.updateQueue,m=d!==null?d.lastEffect:null;if(m!==null){var y=m.next;d=y;do{if((d.tag&i)===i){var S=d.inst,N=S.destroy;if(N!==void 0){S.destroy=void 0,m=l;var $=o,te=N;try{te()}catch(de){At(m,$,de)}}}d=d.next}while(d!==y)}}catch(de){At(l,l.return,de)}}function ZS(i){var l=i.updateQueue;if(l!==null){var o=i.stateNode;try{Vw(l,o)}catch(d){At(i,i.return,d)}}}function e2(i,l,o){o.props=Qs(i.type,i.memoizedProps),o.state=i.memoizedState;try{o.componentWillUnmount()}catch(d){At(i,l,d)}}function go(i,l){try{var o=i.ref;if(o!==null){switch(i.tag){case 26:case 27:case 5:var d=i.stateNode;break;case 30:d=i.stateNode;break;default:d=i.stateNode}typeof o=="function"?i.refCleanup=o(d):o.current=d}}catch(m){At(i,l,m)}}function er(i,l){var o=i.ref,d=i.refCleanup;if(o!==null)if(typeof d=="function")try{d()}catch(m){At(i,l,m)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof o=="function")try{o(null)}catch(m){At(i,l,m)}else o.current=null}function t2(i){var l=i.type,o=i.memoizedProps,d=i.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":o.autoFocus&&d.focus();break e;case"img":o.src?d.src=o.src:o.srcSet&&(d.srcset=o.srcSet)}}catch(m){At(i,i.return,m)}}function _m(i,l,o){try{var d=i.stateNode;O4(d,i.type,o,l),d[Kt]=l}catch(m){At(i,i.return,m)}}function n2(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&bs(i.type)||i.tag===4}function Lm(i){e:for(;;){for(;i.sibling===null;){if(i.return===null||n2(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.tag===27&&bs(i.type)||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 qm(i,l,o){var d=i.tag;if(d===5||d===6)i=i.stateNode,l?(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o).insertBefore(i,l):(l=o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,l.appendChild(i),o=o._reactRootContainer,o!=null||l.onclick!==null||(l.onclick=mr));else if(d!==4&&(d===27&&bs(i.type)&&(o=i.stateNode,l=null),i=i.child,i!==null))for(qm(i,l,o),i=i.sibling;i!==null;)qm(i,l,o),i=i.sibling}function Uu(i,l,o){var d=i.tag;if(d===5||d===6)i=i.stateNode,l?o.insertBefore(i,l):o.appendChild(i);else if(d!==4&&(d===27&&bs(i.type)&&(o=i.stateNode),i=i.child,i!==null))for(Uu(i,l,o),i=i.sibling;i!==null;)Uu(i,l,o),i=i.sibling}function i2(i){var l=i.stateNode,o=i.memoizedProps;try{for(var d=i.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);bn(l,d,o),l[Ft]=i,l[Kt]=o}catch(y){At(i,i.return,y)}}var Cr=!1,Wt=!1,Bm=!1,r2=typeof WeakSet=="function"?WeakSet:Set,ln=null;function c4(i,l){if(i=i.containerInfo,rg=cd,i=gw(i),Op(i)){if("selectionStart"in i)var o={start:i.selectionStart,end:i.selectionEnd};else e:{o=(o=i.ownerDocument)&&o.defaultView||window;var d=o.getSelection&&o.getSelection();if(d&&d.rangeCount!==0){o=d.anchorNode;var m=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{o.nodeType,y.nodeType}catch{o=null;break e}var S=0,N=-1,$=-1,te=0,de=0,be=i,ie=null;t:for(;;){for(var le;be!==o||m!==0&&be.nodeType!==3||(N=S+m),be!==y||d!==0&&be.nodeType!==3||($=S+d),be.nodeType===3&&(S+=be.nodeValue.length),(le=be.firstChild)!==null;)ie=be,be=le;for(;;){if(be===i)break t;if(ie===o&&++te===m&&(N=S),ie===y&&++de===d&&($=S),(le=be.nextSibling)!==null)break;be=ie,ie=be.parentNode}be=le}o=N===-1||$===-1?null:{start:N,end:$}}else o=null}o=o||{start:0,end:0}}else o=null;for(sg={focusedElem:i,selectionRange:o},cd=!1,ln=l;ln!==null;)if(l=ln,i=l.child,(l.subtreeFlags&1028)!==0&&i!==null)i.return=l,ln=i;else for(;ln!==null;){switch(l=ln,y=l.alternate,i=l.flags,l.tag){case 0:if((i&4)!==0&&(i=l.updateQueue,i=i!==null?i.events:null,i!==null))for(o=0;o<i.length;o++)m=i[o],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&y!==null){i=void 0,o=l,m=y.memoizedProps,y=y.memoizedState,d=o.stateNode;try{var Be=Qs(o.type,m);i=d.getSnapshotBeforeUpdate(Be,y),d.__reactInternalSnapshotBeforeUpdate=i}catch(Ge){At(o,o.return,Ge)}}break;case 3:if((i&1024)!==0){if(i=l.stateNode.containerInfo,o=i.nodeType,o===9)og(i);else if(o===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":og(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(r(163))}if(i=l.sibling,i!==null){i.return=l.return,ln=i;break}ln=l.return}}function s2(i,l,o){var d=o.flags;switch(o.tag){case 0:case 11:case 15:Tr(i,o),d&4&&mo(5,o);break;case 1:if(Tr(i,o),d&4)if(i=o.stateNode,l===null)try{i.componentDidMount()}catch(S){At(o,o.return,S)}else{var m=Qs(o.type,l.memoizedProps);l=l.memoizedState;try{i.componentDidUpdate(m,l,i.__reactInternalSnapshotBeforeUpdate)}catch(S){At(o,o.return,S)}}d&64&&ZS(o),d&512&&go(o,o.return);break;case 3:if(Tr(i,o),d&64&&(i=o.updateQueue,i!==null)){if(l=null,o.child!==null)switch(o.child.tag){case 27:case 5:l=o.child.stateNode;break;case 1:l=o.child.stateNode}try{Vw(i,l)}catch(S){At(o,o.return,S)}}break;case 27:l===null&&d&4&&i2(o);case 26:case 5:Tr(i,o),l===null&&d&4&&t2(o),d&512&&go(o,o.return);break;case 12:Tr(i,o);break;case 31:Tr(i,o),d&4&&o2(i,o);break;case 13:Tr(i,o),d&4&&c2(i,o),d&64&&(i=o.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(o=b4.bind(null,o),$4(i,o))));break;case 22:if(d=o.memoizedState!==null||Cr,!d){l=l!==null&&l.memoizedState!==null||Wt,m=Cr;var y=Wt;Cr=d,(Wt=l)&&!y?jr(i,o,(o.subtreeFlags&8772)!==0):Tr(i,o),Cr=m,Wt=y}break;case 30:break;default:Tr(i,o)}}function l2(i){var l=i.alternate;l!==null&&(i.alternate=null,l2(l)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(l=i.stateNode,l!==null&&kl(l)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var qt=null,Pn=!1;function Nr(i,l,o){for(o=o.child;o!==null;)a2(i,l,o),o=o.sibling}function a2(i,l,o){if(k&&typeof k.onCommitFiberUnmount=="function")try{k.onCommitFiberUnmount(J,o)}catch{}switch(o.tag){case 26:Wt||er(o,l),Nr(i,l,o),o.memoizedState?o.memoizedState.count--:o.stateNode&&(o=o.stateNode,o.parentNode.removeChild(o));break;case 27:Wt||er(o,l);var d=qt,m=Pn;bs(o.type)&&(qt=o.stateNode,Pn=!1),Nr(i,l,o),Co(o.stateNode),qt=d,Pn=m;break;case 5:Wt||er(o,l);case 6:if(d=qt,m=Pn,qt=null,Nr(i,l,o),qt=d,Pn=m,qt!==null)if(Pn)try{(qt.nodeType===9?qt.body:qt.nodeName==="HTML"?qt.ownerDocument.body:qt).removeChild(o.stateNode)}catch(y){At(o,l,y)}else try{qt.removeChild(o.stateNode)}catch(y){At(o,l,y)}break;case 18:qt!==null&&(Pn?(i=qt,Z2(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,o.stateNode),ia(i)):Z2(qt,o.stateNode));break;case 4:d=qt,m=Pn,qt=o.stateNode.containerInfo,Pn=!0,Nr(i,l,o),qt=d,Pn=m;break;case 0:case 11:case 14:case 15:ds(2,o,l),Wt||ds(4,o,l),Nr(i,l,o);break;case 1:Wt||(er(o,l),d=o.stateNode,typeof d.componentWillUnmount=="function"&&e2(o,l,d)),Nr(i,l,o);break;case 21:Nr(i,l,o);break;case 22:Wt=(d=Wt)||o.memoizedState!==null,Nr(i,l,o),Wt=d;break;default:Nr(i,l,o)}}function o2(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{ia(i)}catch(o){At(l,l.return,o)}}}function c2(i,l){if(l.memoizedState===null&&(i=l.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{ia(i)}catch(o){At(l,l.return,o)}}function u4(i){switch(i.tag){case 31:case 13:case 19:var l=i.stateNode;return l===null&&(l=i.stateNode=new r2),l;case 22:return i=i.stateNode,l=i._retryCache,l===null&&(l=i._retryCache=new r2),l;default:throw Error(r(435,i.tag))}}function Vu(i,l){var o=u4(i);l.forEach(function(d){if(!o.has(d)){o.add(d);var m=x4.bind(null,i,d);d.then(m,m)}})}function Yn(i,l){var o=l.deletions;if(o!==null)for(var d=0;d<o.length;d++){var m=o[d],y=i,S=l,N=S;e:for(;N!==null;){switch(N.tag){case 27:if(bs(N.type)){qt=N.stateNode,Pn=!1;break e}break;case 5:qt=N.stateNode,Pn=!1;break e;case 3:case 4:qt=N.stateNode.containerInfo,Pn=!0;break e}N=N.return}if(qt===null)throw Error(r(160));a2(y,S,m),qt=null,Pn=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)u2(l,i),l=l.sibling}var $i=null;function u2(i,l){var o=i.alternate,d=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:Yn(l,i),Kn(i),d&4&&(ds(3,i,i.return),mo(3,i),ds(5,i,i.return));break;case 1:Yn(l,i),Kn(i),d&512&&(Wt||o===null||er(o,o.return)),d&64&&Cr&&(i=i.updateQueue,i!==null&&(d=i.callbacks,d!==null&&(o=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=o===null?d:o.concat(d))));break;case 26:var m=$i;if(Yn(l,i),Kn(i),d&512&&(Wt||o===null||er(o,o.return)),d&4){var y=o!==null?o.memoizedState:null;if(d=i.memoizedState,o===null)if(d===null)if(i.stateNode===null){e:{d=i.type,o=i.memoizedProps,m=m.ownerDocument||m;t:switch(d){case"title":y=m.getElementsByTagName("title")[0],(!y||y[Zr]||y[Ft]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(d),m.head.insertBefore(y,m.querySelector("head > title"))),bn(y,d,o),y[Ft]=i,Gt(y),d=y;break e;case"link":var S=uA("link","href",m).get(d+(o.href||""));if(S){for(var N=0;N<S.length;N++)if(y=S[N],y.getAttribute("href")===(o.href==null||o.href===""?null:o.href)&&y.getAttribute("rel")===(o.rel==null?null:o.rel)&&y.getAttribute("title")===(o.title==null?null:o.title)&&y.getAttribute("crossorigin")===(o.crossOrigin==null?null:o.crossOrigin)){S.splice(N,1);break t}}y=m.createElement(d),bn(y,d,o),m.head.appendChild(y);break;case"meta":if(S=uA("meta","content",m).get(d+(o.content||""))){for(N=0;N<S.length;N++)if(y=S[N],y.getAttribute("content")===(o.content==null?null:""+o.content)&&y.getAttribute("name")===(o.name==null?null:o.name)&&y.getAttribute("property")===(o.property==null?null:o.property)&&y.getAttribute("http-equiv")===(o.httpEquiv==null?null:o.httpEquiv)&&y.getAttribute("charset")===(o.charSet==null?null:o.charSet)){S.splice(N,1);break t}}y=m.createElement(d),bn(y,d,o),m.head.appendChild(y);break;default:throw Error(r(468,d))}y[Ft]=i,Gt(y),d=y}i.stateNode=d}else dA(m,i.type,i.stateNode);else i.stateNode=cA(m,d,i.memoizedProps);else y!==d?(y===null?o.stateNode!==null&&(o=o.stateNode,o.parentNode.removeChild(o)):y.count--,d===null?dA(m,i.type,i.stateNode):cA(m,d,i.memoizedProps)):d===null&&i.stateNode!==null&&_m(i,i.memoizedProps,o.memoizedProps)}break;case 27:Yn(l,i),Kn(i),d&512&&(Wt||o===null||er(o,o.return)),o!==null&&d&4&&_m(i,i.memoizedProps,o.memoizedProps);break;case 5:if(Yn(l,i),Kn(i),d&512&&(Wt||o===null||er(o,o.return)),i.flags&32){m=i.stateNode;try{Nl(m,"")}catch(Be){At(i,i.return,Be)}}d&4&&i.stateNode!=null&&(m=i.memoizedProps,_m(i,m,o!==null?o.memoizedProps:m)),d&1024&&(Bm=!0);break;case 6:if(Yn(l,i),Kn(i),d&4){if(i.stateNode===null)throw Error(r(162));d=i.memoizedProps,o=i.stateNode;try{o.nodeValue=d}catch(Be){At(i,i.return,Be)}}break;case 3:if(sd=null,m=$i,$i=id(l.containerInfo),Yn(l,i),$i=m,Kn(i),d&4&&o!==null&&o.memoizedState.isDehydrated)try{ia(l.containerInfo)}catch(Be){At(i,i.return,Be)}Bm&&(Bm=!1,d2(i));break;case 4:d=$i,$i=id(i.stateNode.containerInfo),Yn(l,i),Kn(i),$i=d;break;case 12:Yn(l,i),Kn(i);break;case 31:Yn(l,i),Kn(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Vu(i,d)));break;case 13:Yn(l,i),Kn(i),i.child.flags&8192&&i.memoizedState!==null!=(o!==null&&o.memoizedState!==null)&&(Pu=ht()),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Vu(i,d)));break;case 22:m=i.memoizedState!==null;var $=o!==null&&o.memoizedState!==null,te=Cr,de=Wt;if(Cr=te||m,Wt=de||$,Yn(l,i),Wt=de,Cr=te,Kn(i),d&8192)e:for(l=i.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(o===null||$||Cr||Wt||Ws(i)),o=null,l=i;;){if(l.tag===5||l.tag===26){if(o===null){$=o=l;try{if(y=$.stateNode,m)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{N=$.stateNode;var be=$.memoizedProps.style,ie=be!=null&&be.hasOwnProperty("display")?be.display:null;N.style.display=ie==null||typeof ie=="boolean"?"":(""+ie).trim()}}catch(Be){At($,$.return,Be)}}}else if(l.tag===6){if(o===null){$=l;try{$.stateNode.nodeValue=m?"":$.memoizedProps}catch(Be){At($,$.return,Be)}}}else if(l.tag===18){if(o===null){$=l;try{var le=$.stateNode;m?eA(le,!0):eA($.stateNode,!1)}catch(Be){At($,$.return,Be)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===i)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===i)break e;for(;l.sibling===null;){if(l.return===null||l.return===i)break e;o===l&&(o=null),l=l.return}o===l&&(o=null),l.sibling.return=l.return,l=l.sibling}d&4&&(d=i.updateQueue,d!==null&&(o=d.retryQueue,o!==null&&(d.retryQueue=null,Vu(i,o))));break;case 19:Yn(l,i),Kn(i),d&4&&(d=i.updateQueue,d!==null&&(i.updateQueue=null,Vu(i,d)));break;case 30:break;case 21:break;default:Yn(l,i),Kn(i)}}function Kn(i){var l=i.flags;if(l&2){try{for(var o,d=i.return;d!==null;){if(n2(d)){o=d;break}d=d.return}if(o==null)throw Error(r(160));switch(o.tag){case 27:var m=o.stateNode,y=Lm(i);Uu(i,y,m);break;case 5:var S=o.stateNode;o.flags&32&&(Nl(S,""),o.flags&=-33);var N=Lm(i);Uu(i,N,S);break;case 3:case 4:var $=o.stateNode.containerInfo,te=Lm(i);qm(i,te,$);break;default:throw Error(r(161))}}catch(de){At(i,i.return,de)}i.flags&=-3}l&4096&&(i.flags&=-4097)}function d2(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var l=i;d2(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),i=i.sibling}}function Tr(i,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)s2(i,l.alternate,l),l=l.sibling}function Ws(i){for(i=i.child;i!==null;){var l=i;switch(l.tag){case 0:case 11:case 14:case 15:ds(4,l,l.return),Ws(l);break;case 1:er(l,l.return);var o=l.stateNode;typeof o.componentWillUnmount=="function"&&e2(l,l.return,o),Ws(l);break;case 27:Co(l.stateNode);case 26:case 5:er(l,l.return),Ws(l);break;case 22:l.memoizedState===null&&Ws(l);break;case 30:Ws(l);break;default:Ws(l)}i=i.sibling}}function jr(i,l,o){for(o=o&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var d=l.alternate,m=i,y=l,S=y.flags;switch(y.tag){case 0:case 11:case 15:jr(m,y,o),mo(4,y);break;case 1:if(jr(m,y,o),d=y,m=d.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(te){At(d,d.return,te)}if(d=y,m=d.updateQueue,m!==null){var N=d.stateNode;try{var $=m.shared.hiddenCallbacks;if($!==null)for(m.shared.hiddenCallbacks=null,m=0;m<$.length;m++)Uw($[m],N)}catch(te){At(d,d.return,te)}}o&&S&64&&ZS(y),go(y,y.return);break;case 27:i2(y);case 26:case 5:jr(m,y,o),o&&d===null&&S&4&&t2(y),go(y,y.return);break;case 12:jr(m,y,o);break;case 31:jr(m,y,o),o&&S&4&&o2(m,y);break;case 13:jr(m,y,o),o&&S&4&&c2(m,y);break;case 22:y.memoizedState===null&&jr(m,y,o),go(y,y.return);break;case 30:break;default:jr(m,y,o)}l=l.sibling}}function $m(i,l){var o=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(o=i.memoizedState.cachePool.pool),i=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(i=l.memoizedState.cachePool.pool),i!==o&&(i!=null&&i.refCount++,o!=null&&to(o))}function Im(i,l){i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&to(i))}function Ii(i,l,o,d){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)f2(i,l,o,d),l=l.sibling}function f2(i,l,o,d){var m=l.flags;switch(l.tag){case 0:case 11:case 15:Ii(i,l,o,d),m&2048&&mo(9,l);break;case 1:Ii(i,l,o,d);break;case 3:Ii(i,l,o,d),m&2048&&(i=null,l.alternate!==null&&(i=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==i&&(l.refCount++,i!=null&&to(i)));break;case 12:if(m&2048){Ii(i,l,o,d),i=l.stateNode;try{var y=l.memoizedProps,S=y.id,N=y.onPostCommit;typeof N=="function"&&N(S,l.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch($){At(l,l.return,$)}}else Ii(i,l,o,d);break;case 31:Ii(i,l,o,d);break;case 13:Ii(i,l,o,d);break;case 23:break;case 22:y=l.stateNode,S=l.alternate,l.memoizedState!==null?y._visibility&2?Ii(i,l,o,d):yo(i,l):y._visibility&2?Ii(i,l,o,d):(y._visibility|=2,Yl(i,l,o,d,(l.subtreeFlags&10256)!==0||!1)),m&2048&&$m(S,l);break;case 24:Ii(i,l,o,d),m&2048&&Im(l.alternate,l);break;default:Ii(i,l,o,d)}}function Yl(i,l,o,d,m){for(m=m&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var y=i,S=l,N=o,$=d,te=S.flags;switch(S.tag){case 0:case 11:case 15:Yl(y,S,N,$,m),mo(8,S);break;case 23:break;case 22:var de=S.stateNode;S.memoizedState!==null?de._visibility&2?Yl(y,S,N,$,m):yo(y,S):(de._visibility|=2,Yl(y,S,N,$,m)),m&&te&2048&&$m(S.alternate,S);break;case 24:Yl(y,S,N,$,m),m&&te&2048&&Im(S.alternate,S);break;default:Yl(y,S,N,$,m)}l=l.sibling}}function yo(i,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var o=i,d=l,m=d.flags;switch(d.tag){case 22:yo(o,d),m&2048&&$m(d.alternate,d);break;case 24:yo(o,d),m&2048&&Im(d.alternate,d);break;default:yo(o,d)}l=l.sibling}}var bo=8192;function Kl(i,l,o){if(i.subtreeFlags&bo)for(i=i.child;i!==null;)h2(i,l,o),i=i.sibling}function h2(i,l,o){switch(i.tag){case 26:Kl(i,l,o),i.flags&bo&&i.memoizedState!==null&&J4(o,$i,i.memoizedState,i.memoizedProps);break;case 5:Kl(i,l,o);break;case 3:case 4:var d=$i;$i=id(i.stateNode.containerInfo),Kl(i,l,o),$i=d;break;case 22:i.memoizedState===null&&(d=i.alternate,d!==null&&d.memoizedState!==null?(d=bo,bo=16777216,Kl(i,l,o),bo=d):Kl(i,l,o));break;default:Kl(i,l,o)}}function p2(i){var l=i.alternate;if(l!==null&&(i=l.child,i!==null)){l.child=null;do l=i.sibling,i.sibling=null,i=l;while(i!==null)}}function xo(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var o=0;o<l.length;o++){var d=l[o];ln=d,g2(d,i)}p2(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)m2(i),i=i.sibling}function m2(i){switch(i.tag){case 0:case 11:case 15:xo(i),i.flags&2048&&ds(9,i,i.return);break;case 3:xo(i);break;case 12:xo(i);break;case 22:var l=i.stateNode;i.memoizedState!==null&&l._visibility&2&&(i.return===null||i.return.tag!==13)?(l._visibility&=-3,Fu(i)):xo(i);break;default:xo(i)}}function Fu(i){var l=i.deletions;if((i.flags&16)!==0){if(l!==null)for(var o=0;o<l.length;o++){var d=l[o];ln=d,g2(d,i)}p2(i)}for(i=i.child;i!==null;){switch(l=i,l.tag){case 0:case 11:case 15:ds(8,l,l.return),Fu(l);break;case 22:o=l.stateNode,o._visibility&2&&(o._visibility&=-3,Fu(l));break;default:Fu(l)}i=i.sibling}}function g2(i,l){for(;ln!==null;){var o=ln;switch(o.tag){case 0:case 11:case 15:ds(8,o,l);break;case 23:case 22:if(o.memoizedState!==null&&o.memoizedState.cachePool!==null){var d=o.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:to(o.memoizedState.cache)}if(d=o.child,d!==null)d.return=o,ln=d;else e:for(o=i;ln!==null;){d=ln;var m=d.sibling,y=d.return;if(l2(d),d===o){ln=null;break e}if(m!==null){m.return=y,ln=m;break e}ln=y}}}var d4={getCacheForType:function(i){var l=gn(Xt),o=l.data.get(i);return o===void 0&&(o=i(),l.data.set(i,o)),o},cacheSignal:function(){return gn(Xt).controller.signal}},f4=typeof WeakMap=="function"?WeakMap:Map,vt=0,Ot=null,ot=null,dt=0,St=0,li=null,fs=!1,Gl=!1,Hm=!1,Er=0,It=0,hs=0,Zs=0,zm=0,ai=0,Xl=0,vo=null,Gn=null,Um=!1,Pu=0,y2=0,Yu=1/0,Ku=null,ps=null,nn=0,ms=null,Jl=null,Or=0,Vm=0,Fm=null,b2=null,wo=0,Pm=null;function oi(){return(vt&2)!==0&&dt!==0?dt&-dt:L.T!==null?Qm():Ln()}function x2(){if(ai===0)if((dt&536870912)===0||pt){var i=Se;Se<<=1,(Se&3932160)===0&&(Se=262144),ai=i}else ai=536870912;return i=ri.current,i!==null&&(i.flags|=32),ai}function Xn(i,l,o){(i===Ot&&(St===2||St===9)||i.cancelPendingCommit!==null)&&(Ql(i,0),gs(i,dt,ai,!1)),jn(i,o),((vt&2)===0||i!==Ot)&&(i===Ot&&((vt&2)===0&&(Zs|=o),It===4&&gs(i,dt,ai,!1)),tr(i))}function v2(i,l,o){if((vt&6)!==0)throw Error(r(327));var d=!o&&(l&127)===0&&(l&i.expiredLanes)===0||ze(i,l),m=d?m4(i,l):Km(i,l,!0),y=d;do{if(m===0){Gl&&!d&&gs(i,l,0,!1);break}else{if(o=i.current.alternate,y&&!h4(o)){m=Km(i,l,!1),y=!1;continue}if(m===2){if(y=l,i.errorRecoveryDisabledLanes&y)var S=0;else S=i.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){l=S;e:{var N=i;m=vo;var $=N.current.memoizedState.isDehydrated;if($&&(Ql(N,S).flags|=256),S=Km(N,S,!1),S!==2){if(Hm&&!$){N.errorRecoveryDisabledLanes|=y,Zs|=y,m=4;break e}y=Gn,Gn=m,y!==null&&(Gn===null?Gn=y:Gn.push.apply(Gn,y))}m=S}if(y=!1,m!==2)continue}}if(m===1){Ql(i,0),gs(i,l,0,!0);break}e:{switch(d=i,y=m,y){case 0:case 1:throw Error(r(345));case 4:if((l&4194048)!==l)break;case 6:gs(d,l,ai,!fs);break e;case 2:Gn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((l&62914560)===l&&(m=Pu+300-ht(),10<m)){if(gs(d,l,ai,!fs),_e(d,0,!0)!==0)break e;Or=l,d.timeoutHandle=Q2(w2.bind(null,d,o,Gn,Ku,Um,l,ai,Zs,Xl,fs,y,"Throttled",-0,0),m);break e}w2(d,o,Gn,Ku,Um,l,ai,Zs,Xl,fs,y,null,-0,0)}}break}while(!0);tr(i)}function w2(i,l,o,d,m,y,S,N,$,te,de,be,ie,le){if(i.timeoutHandle=-1,be=l.subtreeFlags,be&8192||(be&16785408)===16785408){be={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:mr},h2(l,y,be);var Be=(y&62914560)===y?Pu-ht():(y&4194048)===y?y2-ht():0;if(Be=Q4(be,Be),Be!==null){Or=y,i.cancelPendingCommit=Be(E2.bind(null,i,l,y,o,d,m,S,N,$,de,be,null,ie,le)),gs(i,y,S,!te);return}}E2(i,l,y,o,d,m,S,N,$)}function h4(i){for(var l=i;;){var o=l.tag;if((o===0||o===11||o===15)&&l.flags&16384&&(o=l.updateQueue,o!==null&&(o=o.stores,o!==null)))for(var d=0;d<o.length;d++){var m=o[d],y=m.getSnapshot;m=m.value;try{if(!ni(y(),m))return!1}catch{return!1}}if(o=l.child,l.subtreeFlags&16384&&o!==null)o.return=l,l=o;else{if(l===i)break;for(;l.sibling===null;){if(l.return===null||l.return===i)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function gs(i,l,o,d){l&=~zm,l&=~Zs,i.suspendedLanes|=l,i.pingedLanes&=~l,d&&(i.warmLanes|=l),d=i.expirationTimes;for(var m=l;0<m;){var y=31-Z(m),S=1<<y;d[y]=-1,m&=~S}o!==0&&Wr(i,o,l)}function Gu(){return(vt&6)===0?(So(0),!1):!0}function Ym(){if(ot!==null){if(St===0)var i=ot.return;else i=ot,xr=Fs=null,om(i),zl=null,io=0,i=ot;for(;i!==null;)WS(i.alternate,i),i=i.return;ot=null}}function Ql(i,l){var o=i.timeoutHandle;o!==-1&&(i.timeoutHandle=-1,D4(o)),o=i.cancelPendingCommit,o!==null&&(i.cancelPendingCommit=null,o()),Or=0,Ym(),Ot=i,ot=o=yr(i.current,null),dt=l,St=0,li=null,fs=!1,Gl=ze(i,l),Hm=!1,Xl=ai=zm=Zs=hs=It=0,Gn=vo=null,Um=!1,(l&8)!==0&&(l|=l&32);var d=i.entangledLanes;if(d!==0)for(i=i.entanglements,d&=l;0<d;){var m=31-Z(d),y=1<<m;l|=i[m],d&=~y}return Er=l,mu(),o}function S2(i,l){nt=null,L.H=fo,l===Hl||l===Au?(l=$w(),St=3):l===Jp?(l=$w(),St=4):St=l===km?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,li=l,ot===null&&(It=1,Bu(i,Si(l,i.current)))}function A2(){var i=ri.current;return i===null?!0:(dt&4194048)===dt?Ni===null:(dt&62914560)===dt||(dt&536870912)!==0?i===Ni:!1}function k2(){var i=L.H;return L.H=fo,i===null?fo:i}function C2(){var i=L.A;return L.A=d4,i}function Xu(){It=4,fs||(dt&4194048)!==dt&&ri.current!==null||(Gl=!0),(hs&134217727)===0&&(Zs&134217727)===0||Ot===null||gs(Ot,dt,ai,!1)}function Km(i,l,o){var d=vt;vt|=2;var m=k2(),y=C2();(Ot!==i||dt!==l)&&(Ku=null,Ql(i,l)),l=!1;var S=It;e:do try{if(St!==0&&ot!==null){var N=ot,$=li;switch(St){case 8:Ym(),S=6;break e;case 3:case 2:case 9:case 6:ri.current===null&&(l=!0);var te=St;if(St=0,li=null,Wl(i,N,$,te),o&&Gl){S=0;break e}break;default:te=St,St=0,li=null,Wl(i,N,$,te)}}p4(),S=It;break}catch(de){S2(i,de)}while(!0);return l&&i.shellSuspendCounter++,xr=Fs=null,vt=d,L.H=m,L.A=y,ot===null&&(Ot=null,dt=0,mu()),S}function p4(){for(;ot!==null;)N2(ot)}function m4(i,l){var o=vt;vt|=2;var d=k2(),m=C2();Ot!==i||dt!==l?(Ku=null,Yu=ht()+500,Ql(i,l)):Gl=ze(i,l);e:do try{if(St!==0&&ot!==null){l=ot;var y=li;t:switch(St){case 1:St=0,li=null,Wl(i,l,y,1);break;case 2:case 9:if(qw(y)){St=0,li=null,T2(l);break}l=function(){St!==2&&St!==9||Ot!==i||(St=7),tr(i)},y.then(l,l);break e;case 3:St=7;break e;case 4:St=5;break e;case 7:qw(y)?(St=0,li=null,T2(l)):(St=0,li=null,Wl(i,l,y,7));break;case 5:var S=null;switch(ot.tag){case 26:S=ot.memoizedState;case 5:case 27:var N=ot;if(S?fA(S):N.stateNode.complete){St=0,li=null;var $=N.sibling;if($!==null)ot=$;else{var te=N.return;te!==null?(ot=te,Ju(te)):ot=null}break t}}St=0,li=null,Wl(i,l,y,5);break;case 6:St=0,li=null,Wl(i,l,y,6);break;case 8:Ym(),It=6;break e;default:throw Error(r(462))}}g4();break}catch(de){S2(i,de)}while(!0);return xr=Fs=null,L.H=d,L.A=m,vt=o,ot!==null?0:(Ot=null,dt=0,mu(),It)}function g4(){for(;ot!==null&&!Zn();)N2(ot)}function N2(i){var l=JS(i.alternate,i,Er);i.memoizedProps=i.pendingProps,l===null?Ju(i):ot=l}function T2(i){var l=i,o=l.alternate;switch(l.tag){case 15:case 0:l=FS(o,l,l.pendingProps,l.type,void 0,dt);break;case 11:l=FS(o,l,l.pendingProps,l.type.render,l.ref,dt);break;case 5:om(l);default:WS(o,l),l=ot=Cw(l,Er),l=JS(o,l,Er)}i.memoizedProps=i.pendingProps,l===null?Ju(i):ot=l}function Wl(i,l,o,d){xr=Fs=null,om(l),zl=null,io=0;var m=l.return;try{if(r4(i,m,l,o,dt)){It=1,Bu(i,Si(o,i.current)),ot=null;return}}catch(y){if(m!==null)throw ot=m,y;It=1,Bu(i,Si(o,i.current)),ot=null;return}l.flags&32768?(pt||d===1?i=!0:Gl||(dt&536870912)!==0?i=!1:(fs=i=!0,(d===2||d===9||d===3||d===6)&&(d=ri.current,d!==null&&d.tag===13&&(d.flags|=16384))),j2(l,i)):Ju(l)}function Ju(i){var l=i;do{if((l.flags&32768)!==0){j2(l,fs);return}i=l.return;var o=a4(l.alternate,l,Er);if(o!==null){ot=o;return}if(l=l.sibling,l!==null){ot=l;return}ot=l=i}while(l!==null);It===0&&(It=5)}function j2(i,l){do{var o=o4(i.alternate,i);if(o!==null){o.flags&=32767,ot=o;return}if(o=i.return,o!==null&&(o.flags|=32768,o.subtreeFlags=0,o.deletions=null),!l&&(i=i.sibling,i!==null)){ot=i;return}ot=i=o}while(i!==null);It=6,ot=null}function E2(i,l,o,d,m,y,S,N,$){i.cancelPendingCommit=null;do Qu();while(nn!==0);if((vt&6)!==0)throw Error(r(327));if(l!==null){if(l===i.current)throw Error(r(177));if(y=l.lanes|l.childLanes,y|=Lp,nu(i,o,y,S,N,$),i===Ot&&(ot=Ot=null,dt=0),Jl=l,ms=i,Or=o,Vm=y,Fm=m,b2=d,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,v4(kt,function(){return _2(),null})):(i.callbackNode=null,i.callbackPriority=0),d=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||d){d=L.T,L.T=null,m=Q.p,Q.p=2,S=vt,vt|=4;try{c4(i,l,o)}finally{vt=S,Q.p=m,L.T=d}}nn=1,O2(),M2(),R2()}}function O2(){if(nn===1){nn=0;var i=ms,l=Jl,o=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||o){o=L.T,L.T=null;var d=Q.p;Q.p=2;var m=vt;vt|=4;try{u2(l,i);var y=sg,S=gw(i.containerInfo),N=y.focusedElem,$=y.selectionRange;if(S!==N&&N&&N.ownerDocument&&mw(N.ownerDocument.documentElement,N)){if($!==null&&Op(N)){var te=$.start,de=$.end;if(de===void 0&&(de=te),"selectionStart"in N)N.selectionStart=te,N.selectionEnd=Math.min(de,N.value.length);else{var be=N.ownerDocument||document,ie=be&&be.defaultView||window;if(ie.getSelection){var le=ie.getSelection(),Be=N.textContent.length,Ge=Math.min($.start,Be),Tt=$.end===void 0?Ge:Math.min($.end,Be);!le.extend&&Ge>Tt&&(S=Tt,Tt=Ge,Ge=S);var P=pw(N,Ge),H=pw(N,Tt);if(P&&H&&(le.rangeCount!==1||le.anchorNode!==P.node||le.anchorOffset!==P.offset||le.focusNode!==H.node||le.focusOffset!==H.offset)){var ee=be.createRange();ee.setStart(P.node,P.offset),le.removeAllRanges(),Ge>Tt?(le.addRange(ee),le.extend(H.node,H.offset)):(ee.setEnd(H.node,H.offset),le.addRange(ee))}}}}for(be=[],le=N;le=le.parentNode;)le.nodeType===1&&be.push({element:le,left:le.scrollLeft,top:le.scrollTop});for(typeof N.focus=="function"&&N.focus(),N=0;N<be.length;N++){var ge=be[N];ge.element.scrollLeft=ge.left,ge.element.scrollTop=ge.top}}cd=!!rg,sg=rg=null}finally{vt=m,Q.p=d,L.T=o}}i.current=l,nn=2}}function M2(){if(nn===2){nn=0;var i=ms,l=Jl,o=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||o){o=L.T,L.T=null;var d=Q.p;Q.p=2;var m=vt;vt|=4;try{s2(i,l.alternate,l)}finally{vt=m,Q.p=d,L.T=o}}nn=3}}function R2(){if(nn===4||nn===3){nn=0,Nn();var i=ms,l=Jl,o=Or,d=b2;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?nn=5:(nn=0,Jl=ms=null,D2(i,i.pendingLanes));var m=i.pendingLanes;if(m===0&&(ps=null),Vt(o),l=l.stateNode,k&&typeof k.onCommitFiberRoot=="function")try{k.onCommitFiberRoot(J,l,void 0,(l.current.flags&128)===128)}catch{}if(d!==null){l=L.T,m=Q.p,Q.p=2,L.T=null;try{for(var y=i.onRecoverableError,S=0;S<d.length;S++){var N=d[S];y(N.value,{componentStack:N.stack})}}finally{L.T=l,Q.p=m}}(Or&3)!==0&&Qu(),tr(i),m=i.pendingLanes,(o&261930)!==0&&(m&42)!==0?i===Pm?wo++:(wo=0,Pm=i):wo=0,So(0)}}function D2(i,l){(i.pooledCacheLanes&=l)===0&&(l=i.pooledCache,l!=null&&(i.pooledCache=null,to(l)))}function Qu(){return O2(),M2(),R2(),_2()}function _2(){if(nn!==5)return!1;var i=ms,l=Vm;Vm=0;var o=Vt(Or),d=L.T,m=Q.p;try{Q.p=32>o?32:o,L.T=null,o=Fm,Fm=null;var y=ms,S=Or;if(nn=0,Jl=ms=null,Or=0,(vt&6)!==0)throw Error(r(331));var N=vt;if(vt|=4,m2(y.current),f2(y,y.current,S,o),vt=N,So(0,!1),k&&typeof k.onPostCommitFiberRoot=="function")try{k.onPostCommitFiberRoot(J,y)}catch{}return!0}finally{Q.p=m,L.T=d,D2(i,l)}}function L2(i,l,o){l=Si(o,l),l=Am(i.stateNode,l,2),i=os(i,l,2),i!==null&&(jn(i,2),tr(i))}function At(i,l,o){if(i.tag===3)L2(i,i,o);else for(;l!==null;){if(l.tag===3){L2(l,i,o);break}else if(l.tag===1){var d=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ps===null||!ps.has(d))){i=Si(o,i),o=qS(2),d=os(l,o,2),d!==null&&(BS(o,d,l,i),jn(d,2),tr(d));break}}l=l.return}}function Gm(i,l,o){var d=i.pingCache;if(d===null){d=i.pingCache=new f4;var m=new Set;d.set(l,m)}else m=d.get(l),m===void 0&&(m=new Set,d.set(l,m));m.has(o)||(Hm=!0,m.add(o),i=y4.bind(null,i,l,o),l.then(i,i))}function y4(i,l,o){var d=i.pingCache;d!==null&&d.delete(l),i.pingedLanes|=i.suspendedLanes&o,i.warmLanes&=~o,Ot===i&&(dt&o)===o&&(It===4||It===3&&(dt&62914560)===dt&&300>ht()-Pu?(vt&2)===0&&Ql(i,0):zm|=o,Xl===dt&&(Xl=0)),tr(i)}function q2(i,l){l===0&&(l=pn()),i=zs(i,l),i!==null&&(jn(i,l),tr(i))}function b4(i){var l=i.memoizedState,o=0;l!==null&&(o=l.retryLane),q2(i,o)}function x4(i,l){var o=0;switch(i.tag){case 31:case 13:var d=i.stateNode,m=i.memoizedState;m!==null&&(o=m.retryLane);break;case 19:d=i.stateNode;break;case 22:d=i.stateNode._retryCache;break;default:throw Error(r(314))}d!==null&&d.delete(l),q2(i,o)}function v4(i,l){return st(i,l)}var Wu=null,Zl=null,Xm=!1,Zu=!1,Jm=!1,ys=0;function tr(i){i!==Zl&&i.next===null&&(Zl===null?Wu=Zl=i:Zl=Zl.next=i),Zu=!0,Xm||(Xm=!0,S4())}function So(i,l){if(!Jm&&Zu){Jm=!0;do for(var o=!1,d=Wu;d!==null;){if(i!==0){var m=d.pendingLanes;if(m===0)var y=0;else{var S=d.suspendedLanes,N=d.pingedLanes;y=(1<<31-Z(42|i)+1)-1,y&=m&~(S&~N),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(o=!0,H2(d,y))}else y=dt,y=_e(d,d===Ot?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||ze(d,y)||(o=!0,H2(d,y));d=d.next}while(o);Jm=!1}}function w4(){B2()}function B2(){Zu=Xm=!1;var i=0;ys!==0&&R4()&&(i=ys);for(var l=ht(),o=null,d=Wu;d!==null;){var m=d.next,y=$2(d,l);y===0?(d.next=null,o===null?Wu=m:o.next=m,m===null&&(Zl=o)):(o=d,(i!==0||(y&3)!==0)&&(Zu=!0)),d=m}nn!==0&&nn!==5||So(i),ys!==0&&(ys=0)}function $2(i,l){for(var o=i.suspendedLanes,d=i.pingedLanes,m=i.expirationTimes,y=i.pendingLanes&-62914561;0<y;){var S=31-Z(y),N=1<<S,$=m[S];$===-1?((N&o)===0||(N&d)!==0)&&(m[S]=Qe(N,l)):$<=l&&(i.expiredLanes|=N),y&=~N}if(l=Ot,o=dt,o=_e(i,i===l?o:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d=i.callbackNode,o===0||i===l&&(St===2||St===9)||i.cancelPendingCommit!==null)return d!==null&&d!==null&&Et(d),i.callbackNode=null,i.callbackPriority=0;if((o&3)===0||ze(i,o)){if(l=o&-o,l===i.callbackPriority)return l;switch(d!==null&&Et(d),Vt(o)){case 2:case 8:o=ei;break;case 32:o=kt;break;case 268435456:o=V;break;default:o=kt}return d=I2.bind(null,i),o=st(o,d),i.callbackPriority=l,i.callbackNode=o,l}return d!==null&&d!==null&&Et(d),i.callbackPriority=2,i.callbackNode=null,2}function I2(i,l){if(nn!==0&&nn!==5)return i.callbackNode=null,i.callbackPriority=0,null;var o=i.callbackNode;if(Qu()&&i.callbackNode!==o)return null;var d=dt;return d=_e(i,i===Ot?d:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),d===0?null:(v2(i,d,l),$2(i,ht()),i.callbackNode!=null&&i.callbackNode===o?I2.bind(null,i):null)}function H2(i,l){if(Qu())return null;v2(i,l,!0)}function S4(){_4(function(){(vt&6)!==0?st(Tn,w4):B2()})}function Qm(){if(ys===0){var i=$l;i===0&&(i=re,re<<=1,(re&261888)===0&&(re=256)),ys=i}return ys}function z2(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:au(""+i)}function U2(i,l){var o=l.ownerDocument.createElement("input");return o.name=l.name,o.value=l.value,i.id&&o.setAttribute("form",i.id),l.parentNode.insertBefore(o,l),i=new FormData(i),o.parentNode.removeChild(o),i}function A4(i,l,o,d,m){if(l==="submit"&&o&&o.stateNode===m){var y=z2((m[Kt]||null).action),S=d.submitter;S&&(l=(l=S[Kt]||null)?z2(l.formAction):S.getAttribute("formAction"),l!==null&&(y=l,S=null));var N=new du("action","action",null,d,m);i.push({event:N,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(ys!==0){var $=S?U2(m,S):new FormData(m);ym(o,{pending:!0,data:$,method:m.method,action:y},null,$)}}else typeof y=="function"&&(N.preventDefault(),$=S?U2(m,S):new FormData(m),ym(o,{pending:!0,data:$,method:m.method,action:y},y,$))},currentTarget:m}]})}}for(var Wm=0;Wm<_p.length;Wm++){var Zm=_p[Wm],k4=Zm.toLowerCase(),C4=Zm[0].toUpperCase()+Zm.slice(1);Bi(k4,"on"+C4)}Bi(xw,"onAnimationEnd"),Bi(vw,"onAnimationIteration"),Bi(ww,"onAnimationStart"),Bi("dblclick","onDoubleClick"),Bi("focusin","onFocus"),Bi("focusout","onBlur"),Bi(zR,"onTransitionRun"),Bi(UR,"onTransitionStart"),Bi(VR,"onTransitionCancel"),Bi(Sw,"onTransitionEnd"),Le("onMouseEnter",["mouseout","mouseover"]),Le("onMouseLeave",["mouseout","mouseover"]),Le("onPointerEnter",["pointerout","pointerover"]),Le("onPointerLeave",["pointerout","pointerover"]),se("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),se("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),se("onBeforeInput",["compositionend","keypress","textInput","paste"]),se("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),se("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Ao="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(" "),N4=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Ao));function V2(i,l){l=(l&4)!==0;for(var o=0;o<i.length;o++){var d=i[o],m=d.event;d=d.listeners;e:{var y=void 0;if(l)for(var S=d.length-1;0<=S;S--){var N=d[S],$=N.instance,te=N.currentTarget;if(N=N.listener,$!==y&&m.isPropagationStopped())break e;y=N,m.currentTarget=te;try{y(m)}catch(de){pu(de)}m.currentTarget=null,y=$}else for(S=0;S<d.length;S++){if(N=d[S],$=N.instance,te=N.currentTarget,N=N.listener,$!==y&&m.isPropagationStopped())break e;y=N,m.currentTarget=te;try{y(m)}catch(de){pu(de)}m.currentTarget=null,y=$}}}}function ct(i,l){var o=l[ur];o===void 0&&(o=l[ur]=new Set);var d=i+"__bubble";o.has(d)||(F2(l,i,2,!1),o.add(d))}function eg(i,l,o){var d=0;l&&(d|=4),F2(o,i,d,l)}var ed="_reactListening"+Math.random().toString(36).slice(2);function tg(i){if(!i[ed]){i[ed]=!0,iu.forEach(function(o){o!=="selectionchange"&&(N4.has(o)||eg(o,!1,i),eg(o,!0,i))});var l=i.nodeType===9?i:i.ownerDocument;l===null||l[ed]||(l[ed]=!0,eg("selectionchange",!1,l))}}function F2(i,l,o,d){switch(xA(l)){case 2:var m=eD;break;case 8:m=tD;break;default:m=gg}o=m.bind(null,l,o,i),m=void 0,!wp||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),d?m!==void 0?i.addEventListener(l,o,{capture:!0,passive:m}):i.addEventListener(l,o,!0):m!==void 0?i.addEventListener(l,o,{passive:m}):i.addEventListener(l,o,!1)}function ng(i,l,o,d,m){var y=d;if((l&1)===0&&(l&2)===0&&d!==null)e:for(;;){if(d===null)return;var S=d.tag;if(S===3||S===4){var N=d.stateNode.containerInfo;if(N===m)break;if(S===4)for(S=d.return;S!==null;){var $=S.tag;if(($===3||$===4)&&S.stateNode.containerInfo===m)return;S=S.return}for(;N!==null;){if(S=dr(N),S===null)return;if($=S.tag,$===5||$===6||$===26||$===27){d=y=S;continue e}N=N.parentNode}}d=d.return}X1(function(){var te=y,de=xp(o),be=[];e:{var ie=Aw.get(i);if(ie!==void 0){var le=du,Be=i;switch(i){case"keypress":if(cu(o)===0)break e;case"keydown":case"keyup":le=xR;break;case"focusin":Be="focus",le=Cp;break;case"focusout":Be="blur",le=Cp;break;case"beforeblur":case"afterblur":le=Cp;break;case"click":if(o.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":le=W1;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":le=aR;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":le=SR;break;case xw:case vw:case ww:le=uR;break;case Sw:le=kR;break;case"scroll":case"scrollend":le=sR;break;case"wheel":le=NR;break;case"copy":case"cut":case"paste":le=fR;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":le=ew;break;case"toggle":case"beforetoggle":le=jR}var Ge=(l&4)!==0,Tt=!Ge&&(i==="scroll"||i==="scrollend"),P=Ge?ie!==null?ie+"Capture":null:ie;Ge=[];for(var H=te,ee;H!==null;){var ge=H;if(ee=ge.stateNode,ge=ge.tag,ge!==5&&ge!==26&&ge!==27||ee===null||P===null||(ge=Fa(H,P),ge!=null&&Ge.push(ko(H,ge,ee))),Tt)break;H=H.return}0<Ge.length&&(ie=new le(ie,Be,null,o,de),be.push({event:ie,listeners:Ge}))}}if((l&7)===0){e:{if(ie=i==="mouseover"||i==="pointerover",le=i==="mouseout"||i==="pointerout",ie&&o!==bp&&(Be=o.relatedTarget||o.fromElement)&&(dr(Be)||Be[Vn]))break e;if((le||ie)&&(ie=de.window===de?de:(ie=de.ownerDocument)?ie.defaultView||ie.parentWindow:window,le?(Be=o.relatedTarget||o.toElement,le=te,Be=Be?dr(Be):null,Be!==null&&(Tt=a(Be),Ge=Be.tag,Be!==Tt||Ge!==5&&Ge!==27&&Ge!==6)&&(Be=null)):(le=null,Be=te),le!==Be)){if(Ge=W1,ge="onMouseLeave",P="onMouseEnter",H="mouse",(i==="pointerout"||i==="pointerover")&&(Ge=ew,ge="onPointerLeave",P="onPointerEnter",H="pointer"),Tt=le==null?ie:fr(le),ee=Be==null?ie:fr(Be),ie=new Ge(ge,H+"leave",le,o,de),ie.target=Tt,ie.relatedTarget=ee,ge=null,dr(de)===te&&(Ge=new Ge(P,H+"enter",Be,o,de),Ge.target=ee,Ge.relatedTarget=Tt,ge=Ge),Tt=ge,le&&Be)t:{for(Ge=T4,P=le,H=Be,ee=0,ge=P;ge;ge=Ge(ge))ee++;ge=0;for(var Ve=H;Ve;Ve=Ge(Ve))ge++;for(;0<ee-ge;)P=Ge(P),ee--;for(;0<ge-ee;)H=Ge(H),ge--;for(;ee--;){if(P===H||H!==null&&P===H.alternate){Ge=P;break t}P=Ge(P),H=Ge(H)}Ge=null}else Ge=null;le!==null&&P2(be,ie,le,Ge,!1),Be!==null&&Tt!==null&&P2(be,Tt,Be,Ge,!0)}}e:{if(ie=te?fr(te):window,le=ie.nodeName&&ie.nodeName.toLowerCase(),le==="select"||le==="input"&&ie.type==="file")var bt=ow;else if(lw(ie))if(cw)bt=$R;else{bt=qR;var He=LR}else le=ie.nodeName,!le||le.toLowerCase()!=="input"||ie.type!=="checkbox"&&ie.type!=="radio"?te&&yp(te.elementType)&&(bt=ow):bt=BR;if(bt&&(bt=bt(i,te))){aw(be,bt,o,de);break e}He&&He(i,ie,te),i==="focusout"&&te&&ie.type==="number"&&te.memoizedProps.value!=null&&gp(ie,"number",ie.value)}switch(He=te?fr(te):window,i){case"focusin":(lw(He)||He.contentEditable==="true")&&(Ol=He,Mp=te,Wa=null);break;case"focusout":Wa=Mp=Ol=null;break;case"mousedown":Rp=!0;break;case"contextmenu":case"mouseup":case"dragend":Rp=!1,yw(be,o,de);break;case"selectionchange":if(HR)break;case"keydown":case"keyup":yw(be,o,de)}var it;if(Tp)e:{switch(i){case"compositionstart":var ft="onCompositionStart";break e;case"compositionend":ft="onCompositionEnd";break e;case"compositionupdate":ft="onCompositionUpdate";break e}ft=void 0}else El?rw(i,o)&&(ft="onCompositionEnd"):i==="keydown"&&o.keyCode===229&&(ft="onCompositionStart");ft&&(tw&&o.locale!=="ko"&&(El||ft!=="onCompositionStart"?ft==="onCompositionEnd"&&El&&(it=J1()):(ts=de,Sp="value"in ts?ts.value:ts.textContent,El=!0)),He=td(te,ft),0<He.length&&(ft=new Z1(ft,i,null,o,de),be.push({event:ft,listeners:He}),it?ft.data=it:(it=sw(o),it!==null&&(ft.data=it)))),(it=OR?MR(i,o):RR(i,o))&&(ft=td(te,"onBeforeInput"),0<ft.length&&(He=new Z1("onBeforeInput","beforeinput",null,o,de),be.push({event:He,listeners:ft}),He.data=it)),A4(be,i,te,o,de)}V2(be,l)})}function ko(i,l,o){return{instance:i,listener:l,currentTarget:o}}function td(i,l){for(var o=l+"Capture",d=[];i!==null;){var m=i,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=Fa(i,o),m!=null&&d.unshift(ko(i,m,y)),m=Fa(i,l),m!=null&&d.push(ko(i,m,y))),i.tag===3)return d;i=i.return}return[]}function T4(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function P2(i,l,o,d,m){for(var y=l._reactName,S=[];o!==null&&o!==d;){var N=o,$=N.alternate,te=N.stateNode;if(N=N.tag,$!==null&&$===d)break;N!==5&&N!==26&&N!==27||te===null||($=te,m?(te=Fa(o,y),te!=null&&S.unshift(ko(o,te,$))):m||(te=Fa(o,y),te!=null&&S.push(ko(o,te,$)))),o=o.return}S.length!==0&&i.push({event:l,listeners:S})}var j4=/\r\n?/g,E4=/\u0000|\uFFFD/g;function Y2(i){return(typeof i=="string"?i:""+i).replace(j4,`
|
|
9
|
+
`).replace(E4,"")}function K2(i,l){return l=Y2(l),Y2(i)===l}function Nt(i,l,o,d,m,y){switch(o){case"children":typeof d=="string"?l==="body"||l==="textarea"&&d===""||Nl(i,d):(typeof d=="number"||typeof d=="bigint")&&l!=="body"&&Nl(i,""+d);break;case"className":su(i,"class",d);break;case"tabIndex":su(i,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":su(i,o,d);break;case"style":K1(i,d,y);break;case"data":if(l!=="object"){su(i,"data",d);break}case"src":case"href":if(d===""&&(l!=="a"||o!=="href")){i.removeAttribute(o);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(o);break}d=au(""+d),i.setAttribute(o,d);break;case"action":case"formAction":if(typeof d=="function"){i.setAttribute(o,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(o==="formAction"?(l!=="input"&&Nt(i,l,"name",m.name,m,null),Nt(i,l,"formEncType",m.formEncType,m,null),Nt(i,l,"formMethod",m.formMethod,m,null),Nt(i,l,"formTarget",m.formTarget,m,null)):(Nt(i,l,"encType",m.encType,m,null),Nt(i,l,"method",m.method,m,null),Nt(i,l,"target",m.target,m,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){i.removeAttribute(o);break}d=au(""+d),i.setAttribute(o,d);break;case"onClick":d!=null&&(i.onclick=mr);break;case"onScroll":d!=null&&ct("scroll",i);break;case"onScrollEnd":d!=null&&ct("scrollend",i);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(r(60));i.innerHTML=o}}break;case"multiple":i.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":i.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){i.removeAttribute("xlink:href");break}o=au(""+d),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(o,""+d):i.removeAttribute(o);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(o,""):i.removeAttribute(o);break;case"capture":case"download":d===!0?i.setAttribute(o,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?i.setAttribute(o,d):i.removeAttribute(o);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?i.setAttribute(o,d):i.removeAttribute(o);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?i.removeAttribute(o):i.setAttribute(o,d);break;case"popover":ct("beforetoggle",i),ct("toggle",i),ru(i,"popover",d);break;case"xlinkActuate":pr(i,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":pr(i,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":pr(i,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":pr(i,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":pr(i,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":pr(i,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":pr(i,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":pr(i,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":pr(i,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":ru(i,"is",d);break;case"innerText":case"textContent":break;default:(!(2<o.length)||o[0]!=="o"&&o[0]!=="O"||o[1]!=="n"&&o[1]!=="N")&&(o=iR.get(o)||o,ru(i,o,d))}}function ig(i,l,o,d,m,y){switch(o){case"style":K1(i,d,y);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(r(61));if(o=d.__html,o!=null){if(m.children!=null)throw Error(r(60));i.innerHTML=o}}break;case"children":typeof d=="string"?Nl(i,d):(typeof d=="number"||typeof d=="bigint")&&Nl(i,""+d);break;case"onScroll":d!=null&&ct("scroll",i);break;case"onScrollEnd":d!=null&&ct("scrollend",i);break;case"onClick":d!=null&&(i.onclick=mr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Ua.hasOwnProperty(o))e:{if(o[0]==="o"&&o[1]==="n"&&(m=o.endsWith("Capture"),l=o.slice(2,m?o.length-7:void 0),y=i[Kt]||null,y=y!=null?y[o]:null,typeof y=="function"&&i.removeEventListener(l,y,m),typeof d=="function")){typeof y!="function"&&y!==null&&(o in i?i[o]=null:i.hasAttribute(o)&&i.removeAttribute(o)),i.addEventListener(l,d,m);break e}o in i?i[o]=d:d===!0?i.setAttribute(o,""):ru(i,o,d)}}}function bn(i,l,o){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ct("error",i),ct("load",i);var d=!1,m=!1,y;for(y in o)if(o.hasOwnProperty(y)){var S=o[y];if(S!=null)switch(y){case"src":d=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Nt(i,l,y,S,o,null)}}m&&Nt(i,l,"srcSet",o.srcSet,o,null),d&&Nt(i,l,"src",o.src,o,null);return;case"input":ct("invalid",i);var N=y=S=m=null,$=null,te=null;for(d in o)if(o.hasOwnProperty(d)){var de=o[d];if(de!=null)switch(d){case"name":m=de;break;case"type":S=de;break;case"checked":$=de;break;case"defaultChecked":te=de;break;case"value":y=de;break;case"defaultValue":N=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(r(137,l));break;default:Nt(i,l,d,de,o,null)}}V1(i,y,N,$,te,S,m,!1);return;case"select":ct("invalid",i),d=S=y=null;for(m in o)if(o.hasOwnProperty(m)&&(N=o[m],N!=null))switch(m){case"value":y=N;break;case"defaultValue":S=N;break;case"multiple":d=N;default:Nt(i,l,m,N,o,null)}l=y,o=S,i.multiple=!!d,l!=null?Cl(i,!!d,l,!1):o!=null&&Cl(i,!!d,o,!0);return;case"textarea":ct("invalid",i),y=m=d=null;for(S in o)if(o.hasOwnProperty(S)&&(N=o[S],N!=null))switch(S){case"value":d=N;break;case"defaultValue":m=N;break;case"children":y=N;break;case"dangerouslySetInnerHTML":if(N!=null)throw Error(r(91));break;default:Nt(i,l,S,N,o,null)}P1(i,d,m,y);return;case"option":for($ in o)o.hasOwnProperty($)&&(d=o[$],d!=null)&&($==="selected"?i.selected=d&&typeof d!="function"&&typeof d!="symbol":Nt(i,l,$,d,o,null));return;case"dialog":ct("beforetoggle",i),ct("toggle",i),ct("cancel",i),ct("close",i);break;case"iframe":case"object":ct("load",i);break;case"video":case"audio":for(d=0;d<Ao.length;d++)ct(Ao[d],i);break;case"image":ct("error",i),ct("load",i);break;case"details":ct("toggle",i);break;case"embed":case"source":case"link":ct("error",i),ct("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(te in o)if(o.hasOwnProperty(te)&&(d=o[te],d!=null))switch(te){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,l));default:Nt(i,l,te,d,o,null)}return;default:if(yp(l)){for(de in o)o.hasOwnProperty(de)&&(d=o[de],d!==void 0&&ig(i,l,de,d,o,void 0));return}}for(N in o)o.hasOwnProperty(N)&&(d=o[N],d!=null&&Nt(i,l,N,d,o,null))}function O4(i,l,o,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,y=null,S=null,N=null,$=null,te=null,de=null;for(le in o){var be=o[le];if(o.hasOwnProperty(le)&&be!=null)switch(le){case"checked":break;case"value":break;case"defaultValue":$=be;default:d.hasOwnProperty(le)||Nt(i,l,le,null,d,be)}}for(var ie in d){var le=d[ie];if(be=o[ie],d.hasOwnProperty(ie)&&(le!=null||be!=null))switch(ie){case"type":y=le;break;case"name":m=le;break;case"checked":te=le;break;case"defaultChecked":de=le;break;case"value":S=le;break;case"defaultValue":N=le;break;case"children":case"dangerouslySetInnerHTML":if(le!=null)throw Error(r(137,l));break;default:le!==be&&Nt(i,l,ie,le,d,be)}}mp(i,S,N,$,te,de,y,m);return;case"select":le=S=N=ie=null;for(y in o)if($=o[y],o.hasOwnProperty(y)&&$!=null)switch(y){case"value":break;case"multiple":le=$;default:d.hasOwnProperty(y)||Nt(i,l,y,null,d,$)}for(m in d)if(y=d[m],$=o[m],d.hasOwnProperty(m)&&(y!=null||$!=null))switch(m){case"value":ie=y;break;case"defaultValue":N=y;break;case"multiple":S=y;default:y!==$&&Nt(i,l,m,y,d,$)}l=N,o=S,d=le,ie!=null?Cl(i,!!o,ie,!1):!!d!=!!o&&(l!=null?Cl(i,!!o,l,!0):Cl(i,!!o,o?[]:"",!1));return;case"textarea":le=ie=null;for(N in o)if(m=o[N],o.hasOwnProperty(N)&&m!=null&&!d.hasOwnProperty(N))switch(N){case"value":break;case"children":break;default:Nt(i,l,N,null,d,m)}for(S in d)if(m=d[S],y=o[S],d.hasOwnProperty(S)&&(m!=null||y!=null))switch(S){case"value":ie=m;break;case"defaultValue":le=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(r(91));break;default:m!==y&&Nt(i,l,S,m,d,y)}F1(i,ie,le);return;case"option":for(var Be in o)ie=o[Be],o.hasOwnProperty(Be)&&ie!=null&&!d.hasOwnProperty(Be)&&(Be==="selected"?i.selected=!1:Nt(i,l,Be,null,d,ie));for($ in d)ie=d[$],le=o[$],d.hasOwnProperty($)&&ie!==le&&(ie!=null||le!=null)&&($==="selected"?i.selected=ie&&typeof ie!="function"&&typeof ie!="symbol":Nt(i,l,$,ie,d,le));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ge in o)ie=o[Ge],o.hasOwnProperty(Ge)&&ie!=null&&!d.hasOwnProperty(Ge)&&Nt(i,l,Ge,null,d,ie);for(te in d)if(ie=d[te],le=o[te],d.hasOwnProperty(te)&&ie!==le&&(ie!=null||le!=null))switch(te){case"children":case"dangerouslySetInnerHTML":if(ie!=null)throw Error(r(137,l));break;default:Nt(i,l,te,ie,d,le)}return;default:if(yp(l)){for(var Tt in o)ie=o[Tt],o.hasOwnProperty(Tt)&&ie!==void 0&&!d.hasOwnProperty(Tt)&&ig(i,l,Tt,void 0,d,ie);for(de in d)ie=d[de],le=o[de],!d.hasOwnProperty(de)||ie===le||ie===void 0&&le===void 0||ig(i,l,de,ie,d,le);return}}for(var P in o)ie=o[P],o.hasOwnProperty(P)&&ie!=null&&!d.hasOwnProperty(P)&&Nt(i,l,P,null,d,ie);for(be in d)ie=d[be],le=o[be],!d.hasOwnProperty(be)||ie===le||ie==null&&le==null||Nt(i,l,be,ie,d,le)}function G2(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function M4(){if(typeof performance.getEntriesByType=="function"){for(var i=0,l=0,o=performance.getEntriesByType("resource"),d=0;d<o.length;d++){var m=o[d],y=m.transferSize,S=m.initiatorType,N=m.duration;if(y&&N&&G2(S)){for(S=0,N=m.responseEnd,d+=1;d<o.length;d++){var $=o[d],te=$.startTime;if(te>N)break;var de=$.transferSize,be=$.initiatorType;de&&G2(be)&&($=$.responseEnd,S+=de*($<N?1:(N-te)/($-te)))}if(--d,l+=8*(y+S)/(m.duration/1e3),i++,10<i)break}}if(0<i)return l/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var rg=null,sg=null;function nd(i){return i.nodeType===9?i:i.ownerDocument}function X2(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function J2(i,l){if(i===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&l==="foreignObject"?0:i}function lg(i,l){return i==="textarea"||i==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var ag=null;function R4(){var i=window.event;return i&&i.type==="popstate"?i===ag?!1:(ag=i,!0):(ag=null,!1)}var Q2=typeof setTimeout=="function"?setTimeout:void 0,D4=typeof clearTimeout=="function"?clearTimeout:void 0,W2=typeof Promise=="function"?Promise:void 0,_4=typeof queueMicrotask=="function"?queueMicrotask:typeof W2<"u"?function(i){return W2.resolve(null).then(i).catch(L4)}:Q2;function L4(i){setTimeout(function(){throw i})}function bs(i){return i==="head"}function Z2(i,l){var o=l,d=0;do{var m=o.nextSibling;if(i.removeChild(o),m&&m.nodeType===8)if(o=m.data,o==="/$"||o==="/&"){if(d===0){i.removeChild(m),ia(l);return}d--}else if(o==="$"||o==="$?"||o==="$~"||o==="$!"||o==="&")d++;else if(o==="html")Co(i.ownerDocument.documentElement);else if(o==="head"){o=i.ownerDocument.head,Co(o);for(var y=o.firstChild;y;){var S=y.nextSibling,N=y.nodeName;y[Zr]||N==="SCRIPT"||N==="STYLE"||N==="LINK"&&y.rel.toLowerCase()==="stylesheet"||o.removeChild(y),y=S}}else o==="body"&&Co(i.ownerDocument.body);o=m}while(o);ia(l)}function eA(i,l){var o=i;i=0;do{var d=o.nextSibling;if(o.nodeType===1?l?(o._stashedDisplay=o.style.display,o.style.display="none"):(o.style.display=o._stashedDisplay||"",o.getAttribute("style")===""&&o.removeAttribute("style")):o.nodeType===3&&(l?(o._stashedText=o.nodeValue,o.nodeValue=""):o.nodeValue=o._stashedText||""),d&&d.nodeType===8)if(o=d.data,o==="/$"){if(i===0)break;i--}else o!=="$"&&o!=="$?"&&o!=="$~"&&o!=="$!"||i++;o=d}while(o)}function og(i){var l=i.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var o=l;switch(l=l.nextSibling,o.nodeName){case"HTML":case"HEAD":case"BODY":og(o),kl(o);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(o.rel.toLowerCase()==="stylesheet")continue}i.removeChild(o)}}function q4(i,l,o,d){for(;i.nodeType===1;){var m=o;if(i.nodeName.toLowerCase()!==l.toLowerCase()){if(!d&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(d){if(!i[Zr])switch(l){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(y=i.getAttribute("rel"),y==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(y!==m.rel||i.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||i.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||i.getAttribute("title")!==(m.title==null?null:m.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(y=i.getAttribute("src"),(y!==(m.src==null?null:m.src)||i.getAttribute("type")!==(m.type==null?null:m.type)||i.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(l==="input"&&i.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&i.getAttribute("name")===y)return i}else return i;if(i=Ti(i.nextSibling),i===null)break}return null}function B4(i,l,o){if(l==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!o||(i=Ti(i.nextSibling),i===null))return null;return i}function tA(i,l){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!l||(i=Ti(i.nextSibling),i===null))return null;return i}function cg(i){return i.data==="$?"||i.data==="$~"}function ug(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function $4(i,l){var o=i.ownerDocument;if(i.data==="$~")i._reactRetry=l;else if(i.data!=="$?"||o.readyState!=="loading")l();else{var d=function(){l(),o.removeEventListener("DOMContentLoaded",d)};o.addEventListener("DOMContentLoaded",d),i._reactRetry=d}}function Ti(i){for(;i!=null;i=i.nextSibling){var l=i.nodeType;if(l===1||l===3)break;if(l===8){if(l=i.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return i}var dg=null;function nA(i){i=i.nextSibling;for(var l=0;i;){if(i.nodeType===8){var o=i.data;if(o==="/$"||o==="/&"){if(l===0)return Ti(i.nextSibling);l--}else o!=="$"&&o!=="$!"&&o!=="$?"&&o!=="$~"&&o!=="&"||l++}i=i.nextSibling}return null}function iA(i){i=i.previousSibling;for(var l=0;i;){if(i.nodeType===8){var o=i.data;if(o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"){if(l===0)return i;l--}else o!=="/$"&&o!=="/&"||l++}i=i.previousSibling}return null}function rA(i,l,o){switch(l=nd(o),i){case"html":if(i=l.documentElement,!i)throw Error(r(452));return i;case"head":if(i=l.head,!i)throw Error(r(453));return i;case"body":if(i=l.body,!i)throw Error(r(454));return i;default:throw Error(r(451))}}function Co(i){for(var l=i.attributes;l.length;)i.removeAttributeNode(l[0]);kl(i)}var ji=new Map,sA=new Set;function id(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Mr=Q.d;Q.d={f:I4,r:H4,D:z4,C:U4,L:V4,m:F4,X:Y4,S:P4,M:K4};function I4(){var i=Mr.f(),l=Gu();return i||l}function H4(i){var l=es(i);l!==null&&l.tag===5&&l.type==="form"?SS(l):Mr.r(i)}var ea=typeof document>"u"?null:document;function lA(i,l,o){var d=ea;if(d&&typeof l=="string"&&l){var m=vi(l);m='link[rel="'+i+'"][href="'+m+'"]',typeof o=="string"&&(m+='[crossorigin="'+o+'"]'),sA.has(m)||(sA.add(m),i={rel:i,crossOrigin:o,href:l},d.querySelector(m)===null&&(l=d.createElement("link"),bn(l,"link",i),Gt(l),d.head.appendChild(l)))}}function z4(i){Mr.D(i),lA("dns-prefetch",i,null)}function U4(i,l){Mr.C(i,l),lA("preconnect",i,l)}function V4(i,l,o){Mr.L(i,l,o);var d=ea;if(d&&i&&l){var m='link[rel="preload"][as="'+vi(l)+'"]';l==="image"&&o&&o.imageSrcSet?(m+='[imagesrcset="'+vi(o.imageSrcSet)+'"]',typeof o.imageSizes=="string"&&(m+='[imagesizes="'+vi(o.imageSizes)+'"]')):m+='[href="'+vi(i)+'"]';var y=m;switch(l){case"style":y=ta(i);break;case"script":y=na(i)}ji.has(y)||(i=b({rel:"preload",href:l==="image"&&o&&o.imageSrcSet?void 0:i,as:l},o),ji.set(y,i),d.querySelector(m)!==null||l==="style"&&d.querySelector(No(y))||l==="script"&&d.querySelector(To(y))||(l=d.createElement("link"),bn(l,"link",i),Gt(l),d.head.appendChild(l)))}}function F4(i,l){Mr.m(i,l);var o=ea;if(o&&i){var d=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+vi(d)+'"][href="'+vi(i)+'"]',y=m;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=na(i)}if(!ji.has(y)&&(i=b({rel:"modulepreload",href:i},l),ji.set(y,i),o.querySelector(m)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(o.querySelector(To(y)))return}d=o.createElement("link"),bn(d,"link",i),Gt(d),o.head.appendChild(d)}}}function P4(i,l,o){Mr.S(i,l,o);var d=ea;if(d&&i){var m=hr(d).hoistableStyles,y=ta(i);l=l||"default";var S=m.get(y);if(!S){var N={loading:0,preload:null};if(S=d.querySelector(No(y)))N.loading=5;else{i=b({rel:"stylesheet",href:i,"data-precedence":l},o),(o=ji.get(y))&&fg(i,o);var $=S=d.createElement("link");Gt($),bn($,"link",i),$._p=new Promise(function(te,de){$.onload=te,$.onerror=de}),$.addEventListener("load",function(){N.loading|=1}),$.addEventListener("error",function(){N.loading|=2}),N.loading|=4,rd(S,l,d)}S={type:"stylesheet",instance:S,count:1,state:N},m.set(y,S)}}}function Y4(i,l){Mr.X(i,l);var o=ea;if(o&&i){var d=hr(o).hoistableScripts,m=na(i),y=d.get(m);y||(y=o.querySelector(To(m)),y||(i=b({src:i,async:!0},l),(l=ji.get(m))&&hg(i,l),y=o.createElement("script"),Gt(y),bn(y,"link",i),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(m,y))}}function K4(i,l){Mr.M(i,l);var o=ea;if(o&&i){var d=hr(o).hoistableScripts,m=na(i),y=d.get(m);y||(y=o.querySelector(To(m)),y||(i=b({src:i,async:!0,type:"module"},l),(l=ji.get(m))&&hg(i,l),y=o.createElement("script"),Gt(y),bn(y,"link",i),o.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(m,y))}}function aA(i,l,o,d){var m=(m=qe.current)?id(m):null;if(!m)throw Error(r(446));switch(i){case"meta":case"title":return null;case"style":return typeof o.precedence=="string"&&typeof o.href=="string"?(l=ta(o.href),o=hr(m).hoistableStyles,d=o.get(l),d||(d={type:"style",instance:null,count:0,state:null},o.set(l,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(o.rel==="stylesheet"&&typeof o.href=="string"&&typeof o.precedence=="string"){i=ta(o.href);var y=hr(m).hoistableStyles,S=y.get(i);if(S||(m=m.ownerDocument||m,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(i,S),(y=m.querySelector(No(i)))&&!y._p&&(S.instance=y,S.state.loading=5),ji.has(i)||(o={rel:"preload",as:"style",href:o.href,crossOrigin:o.crossOrigin,integrity:o.integrity,media:o.media,hrefLang:o.hrefLang,referrerPolicy:o.referrerPolicy},ji.set(i,o),y||G4(m,i,o,S.state))),l&&d===null)throw Error(r(528,""));return S}if(l&&d!==null)throw Error(r(529,""));return null;case"script":return l=o.async,o=o.src,typeof o=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=na(o),o=hr(m).hoistableScripts,d=o.get(l),d||(d={type:"script",instance:null,count:0,state:null},o.set(l,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,i))}}function ta(i){return'href="'+vi(i)+'"'}function No(i){return'link[rel="stylesheet"]['+i+"]"}function oA(i){return b({},i,{"data-precedence":i.precedence,precedence:null})}function G4(i,l,o,d){i.querySelector('link[rel="preload"][as="style"]['+l+"]")?d.loading=1:(l=i.createElement("link"),d.preload=l,l.addEventListener("load",function(){return d.loading|=1}),l.addEventListener("error",function(){return d.loading|=2}),bn(l,"link",o),Gt(l),i.head.appendChild(l))}function na(i){return'[src="'+vi(i)+'"]'}function To(i){return"script[async]"+i}function cA(i,l,o){if(l.count++,l.instance===null)switch(l.type){case"style":var d=i.querySelector('style[data-href~="'+vi(o.href)+'"]');if(d)return l.instance=d,Gt(d),d;var m=b({},o,{"data-href":o.href,"data-precedence":o.precedence,href:null,precedence:null});return d=(i.ownerDocument||i).createElement("style"),Gt(d),bn(d,"style",m),rd(d,o.precedence,i),l.instance=d;case"stylesheet":m=ta(o.href);var y=i.querySelector(No(m));if(y)return l.state.loading|=4,l.instance=y,Gt(y),y;d=oA(o),(m=ji.get(m))&&fg(d,m),y=(i.ownerDocument||i).createElement("link"),Gt(y);var S=y;return S._p=new Promise(function(N,$){S.onload=N,S.onerror=$}),bn(y,"link",d),l.state.loading|=4,rd(y,o.precedence,i),l.instance=y;case"script":return y=na(o.src),(m=i.querySelector(To(y)))?(l.instance=m,Gt(m),m):(d=o,(m=ji.get(y))&&(d=b({},o),hg(d,m)),i=i.ownerDocument||i,m=i.createElement("script"),Gt(m),bn(m,"link",d),i.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(r(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(d=l.instance,l.state.loading|=4,rd(d,o.precedence,i));return l.instance}function rd(i,l,o){for(var d=o.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=d.length?d[d.length-1]:null,y=m,S=0;S<d.length;S++){var N=d[S];if(N.dataset.precedence===l)y=N;else if(y!==m)break}y?y.parentNode.insertBefore(i,y.nextSibling):(l=o.nodeType===9?o.head:o,l.insertBefore(i,l.firstChild))}function fg(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.title==null&&(i.title=l.title)}function hg(i,l){i.crossOrigin==null&&(i.crossOrigin=l.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=l.referrerPolicy),i.integrity==null&&(i.integrity=l.integrity)}var sd=null;function uA(i,l,o){if(sd===null){var d=new Map,m=sd=new Map;m.set(o,d)}else m=sd,d=m.get(o),d||(d=new Map,m.set(o,d));if(d.has(i))return d;for(d.set(i,null),o=o.getElementsByTagName(i),m=0;m<o.length;m++){var y=o[m];if(!(y[Zr]||y[Ft]||i==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var S=y.getAttribute(l)||"";S=i+S;var N=d.get(S);N?N.push(y):d.set(S,[y])}}return d}function dA(i,l,o){i=i.ownerDocument||i,i.head.insertBefore(o,l==="title"?i.querySelector("head > title"):null)}function X4(i,l,o){if(o===1||l.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;return l.rel==="stylesheet"?(i=l.disabled,typeof l.precedence=="string"&&i==null):!0;case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function fA(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function J4(i,l,o,d){if(o.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(o.state.loading&4)===0){if(o.instance===null){var m=ta(d.href),y=l.querySelector(No(m));if(y){l=y._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(i.count++,i=ld.bind(i),l.then(i,i)),o.state.loading|=4,o.instance=y,Gt(y);return}y=l.ownerDocument||l,d=oA(d),(m=ji.get(m))&&fg(d,m),y=y.createElement("link"),Gt(y);var S=y;S._p=new Promise(function(N,$){S.onload=N,S.onerror=$}),bn(y,"link",d),o.instance=y}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(o,l),(l=o.state.preload)&&(o.state.loading&3)===0&&(i.count++,o=ld.bind(i),l.addEventListener("load",o),l.addEventListener("error",o))}}var pg=0;function Q4(i,l){return i.stylesheets&&i.count===0&&od(i,i.stylesheets),0<i.count||0<i.imgCount?function(o){var d=setTimeout(function(){if(i.stylesheets&&od(i,i.stylesheets),i.unsuspend){var y=i.unsuspend;i.unsuspend=null,y()}},6e4+l);0<i.imgBytes&&pg===0&&(pg=62500*M4());var m=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&od(i,i.stylesheets),i.unsuspend)){var y=i.unsuspend;i.unsuspend=null,y()}},(i.imgBytes>pg?50:800)+l);return i.unsuspend=o,function(){i.unsuspend=null,clearTimeout(d),clearTimeout(m)}}:null}function ld(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)od(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var ad=null;function od(i,l){i.stylesheets=null,i.unsuspend!==null&&(i.count++,ad=new Map,l.forEach(W4,i),ad=null,ld.call(i))}function W4(i,l){if(!(l.state.loading&4)){var o=ad.get(i);if(o)var d=o.get(null);else{o=new Map,ad.set(i,o);for(var m=i.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var S=m[y];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(o.set(S.dataset.precedence,S),d=S)}d&&o.set(null,d)}m=l.instance,S=m.getAttribute("data-precedence"),y=o.get(S)||d,y===d&&o.set(null,m),o.set(S,m),this.count++,d=ld.bind(this),m.addEventListener("load",d),m.addEventListener("error",d),y?y.parentNode.insertBefore(m,y.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(m,i.firstChild)),l.state.loading|=4}}var jo={$$typeof:j,Provider:null,Consumer:null,_currentValue:oe,_currentValue2:oe,_threadCount:0};function Z4(i,l,o,d,m,y,S,N,$){this.tag=1,this.containerInfo=i,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Un(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Un(0),this.hiddenUpdates=Un(null),this.identifierPrefix=d,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=$,this.incompleteTransitions=new Map}function hA(i,l,o,d,m,y,S,N,$,te,de,be){return i=new Z4(i,l,o,S,$,te,de,be,N),l=1,y===!0&&(l|=24),y=ii(3,null,null,l),i.current=y,y.stateNode=i,l=Kp(),l.refCount++,i.pooledCache=l,l.refCount++,y.memoizedState={element:d,isDehydrated:o,cache:l},Qp(y),i}function pA(i){return i?(i=Dl,i):Dl}function mA(i,l,o,d,m,y){m=pA(m),d.context===null?d.context=m:d.pendingContext=m,d=as(l),d.payload={element:o},y=y===void 0?null:y,y!==null&&(d.callback=y),o=os(i,d,l),o!==null&&(Xn(o,i,l),so(o,i,l))}function gA(i,l){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var o=i.retryLane;i.retryLane=o!==0&&o<l?o:l}}function mg(i,l){gA(i,l),(i=i.alternate)&&gA(i,l)}function yA(i){if(i.tag===13||i.tag===31){var l=zs(i,67108864);l!==null&&Xn(l,i,67108864),mg(i,67108864)}}function bA(i){if(i.tag===13||i.tag===31){var l=oi();l=We(l);var o=zs(i,l);o!==null&&Xn(o,i,l),mg(i,l)}}var cd=!0;function eD(i,l,o,d){var m=L.T;L.T=null;var y=Q.p;try{Q.p=2,gg(i,l,o,d)}finally{Q.p=y,L.T=m}}function tD(i,l,o,d){var m=L.T;L.T=null;var y=Q.p;try{Q.p=8,gg(i,l,o,d)}finally{Q.p=y,L.T=m}}function gg(i,l,o,d){if(cd){var m=yg(d);if(m===null)ng(i,l,d,ud,o),vA(i,d);else if(iD(m,i,l,o,d))d.stopPropagation();else if(vA(i,d),l&4&&-1<nD.indexOf(i)){for(;m!==null;){var y=es(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=je(y.pendingLanes);if(S!==0){var N=y;for(N.pendingLanes|=2,N.entangledLanes|=2;S;){var $=1<<31-Z(S);N.entanglements[1]|=$,S&=~$}tr(y),(vt&6)===0&&(Yu=ht()+500,So(0))}}break;case 31:case 13:N=zs(y,2),N!==null&&Xn(N,y,2),Gu(),mg(y,2)}if(y=yg(d),y===null&&ng(i,l,d,ud,o),y===m)break;m=y}m!==null&&d.stopPropagation()}else ng(i,l,d,null,o)}}function yg(i){return i=xp(i),bg(i)}var ud=null;function bg(i){if(ud=null,i=dr(i),i!==null){var l=a(i);if(l===null)i=null;else{var o=l.tag;if(o===13){if(i=c(l),i!==null)return i;i=null}else if(o===31){if(i=u(l),i!==null)return i;i=null}else if(o===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;i=null}else l!==i&&(i=null)}}return ud=i,null}function xA(i){switch(i){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(_n()){case Tn:return 2;case ei:return 8;case kt:case x:return 32;case V:return 268435456;default:return 32}default:return 32}}var xg=!1,xs=null,vs=null,ws=null,Eo=new Map,Oo=new Map,Ss=[],nD="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function vA(i,l){switch(i){case"focusin":case"focusout":xs=null;break;case"dragenter":case"dragleave":vs=null;break;case"mouseover":case"mouseout":ws=null;break;case"pointerover":case"pointerout":Eo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Oo.delete(l.pointerId)}}function Mo(i,l,o,d,m,y){return i===null||i.nativeEvent!==y?(i={blockedOn:l,domEventName:o,eventSystemFlags:d,nativeEvent:y,targetContainers:[m]},l!==null&&(l=es(l),l!==null&&yA(l)),i):(i.eventSystemFlags|=d,l=i.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),i)}function iD(i,l,o,d,m){switch(l){case"focusin":return xs=Mo(xs,i,l,o,d,m),!0;case"dragenter":return vs=Mo(vs,i,l,o,d,m),!0;case"mouseover":return ws=Mo(ws,i,l,o,d,m),!0;case"pointerover":var y=m.pointerId;return Eo.set(y,Mo(Eo.get(y)||null,i,l,o,d,m)),!0;case"gotpointercapture":return y=m.pointerId,Oo.set(y,Mo(Oo.get(y)||null,i,l,o,d,m)),!0}return!1}function wA(i){var l=dr(i.target);if(l!==null){var o=a(l);if(o!==null){if(l=o.tag,l===13){if(l=c(o),l!==null){i.blockedOn=l,bi(i.priority,function(){bA(o)});return}}else if(l===31){if(l=u(o),l!==null){i.blockedOn=l,bi(i.priority,function(){bA(o)});return}}else if(l===3&&o.stateNode.current.memoizedState.isDehydrated){i.blockedOn=o.tag===3?o.stateNode.containerInfo:null;return}}}i.blockedOn=null}function dd(i){if(i.blockedOn!==null)return!1;for(var l=i.targetContainers;0<l.length;){var o=yg(i.nativeEvent);if(o===null){o=i.nativeEvent;var d=new o.constructor(o.type,o);bp=d,o.target.dispatchEvent(d),bp=null}else return l=es(o),l!==null&&yA(l),i.blockedOn=o,!1;l.shift()}return!0}function SA(i,l,o){dd(i)&&o.delete(l)}function rD(){xg=!1,xs!==null&&dd(xs)&&(xs=null),vs!==null&&dd(vs)&&(vs=null),ws!==null&&dd(ws)&&(ws=null),Eo.forEach(SA),Oo.forEach(SA)}function fd(i,l){i.blockedOn===l&&(i.blockedOn=null,xg||(xg=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,rD)))}var hd=null;function AA(i){hd!==i&&(hd=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){hd===i&&(hd=null);for(var l=0;l<i.length;l+=3){var o=i[l],d=i[l+1],m=i[l+2];if(typeof d!="function"){if(bg(d||o)===null)continue;break}var y=es(o);y!==null&&(i.splice(l,3),l-=3,ym(y,{pending:!0,data:m,method:o.method,action:d},d,m))}}))}function ia(i){function l($){return fd($,i)}xs!==null&&fd(xs,i),vs!==null&&fd(vs,i),ws!==null&&fd(ws,i),Eo.forEach(l),Oo.forEach(l);for(var o=0;o<Ss.length;o++){var d=Ss[o];d.blockedOn===i&&(d.blockedOn=null)}for(;0<Ss.length&&(o=Ss[0],o.blockedOn===null);)wA(o),o.blockedOn===null&&Ss.shift();if(o=(i.ownerDocument||i).$$reactFormReplay,o!=null)for(d=0;d<o.length;d+=3){var m=o[d],y=o[d+1],S=m[Kt]||null;if(typeof y=="function")S||AA(o);else if(S){var N=null;if(y&&y.hasAttribute("formAction")){if(m=y,S=y[Kt]||null)N=S.formAction;else if(bg(m)!==null)continue}else N=S.action;typeof N=="function"?o[d+1]=N:(o.splice(d,3),d-=3),AA(o)}}}function kA(){function i(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(S){return m=S})},focusReset:"manual",scroll:"manual"})}function l(){m!==null&&(m(),m=null),d||setTimeout(o,20)}function o(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,m=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(o,100),function(){d=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),m!==null&&(m(),m=null)}}}function vg(i){this._internalRoot=i}pd.prototype.render=vg.prototype.render=function(i){var l=this._internalRoot;if(l===null)throw Error(r(409));var o=l.current,d=oi();mA(o,d,i,l,null,null)},pd.prototype.unmount=vg.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var l=i.containerInfo;mA(i.current,2,null,i,null,null),Gu(),l[Vn]=null}};function pd(i){this._internalRoot=i}pd.prototype.unstable_scheduleHydration=function(i){if(i){var l=Ln();i={blockedOn:null,target:i,priority:l};for(var o=0;o<Ss.length&&l!==0&&l<Ss[o].priority;o++);Ss.splice(o,0,i),o===0&&wA(i)}};var CA=e.version;if(CA!=="19.2.8")throw Error(r(527,CA,"19.2.8"));Q.findDOMNode=function(i){var l=i._reactInternals;if(l===void 0)throw typeof i.render=="function"?Error(r(188)):(i=Object.keys(i).join(","),Error(r(268,i)));return i=h(l),i=i!==null?g(i):null,i=i===null?null:i.stateNode,i};var sD={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:L,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var md=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!md.isDisabled&&md.supportsFiber)try{J=md.inject(sD),k=md}catch{}}return sa.createRoot=function(i,l){if(!s(i))throw Error(r(299));var o=!1,d="",m=RS,y=DS,S=_S;return l!=null&&(l.unstable_strictMode===!0&&(o=!0),l.identifierPrefix!==void 0&&(d=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(S=l.onRecoverableError)),l=hA(i,1,!1,null,null,o,d,null,m,y,S,kA),i[Vn]=l.current,tg(i),new vg(l)},sa.hydrateRoot=function(i,l,o){if(!s(i))throw Error(r(299));var d=!1,m="",y=RS,S=DS,N=_S,$=null;return o!=null&&(o.unstable_strictMode===!0&&(d=!0),o.identifierPrefix!==void 0&&(m=o.identifierPrefix),o.onUncaughtError!==void 0&&(y=o.onUncaughtError),o.onCaughtError!==void 0&&(S=o.onCaughtError),o.onRecoverableError!==void 0&&(N=o.onRecoverableError),o.formState!==void 0&&($=o.formState)),l=hA(i,1,!0,l,o??null,d,m,$,y,S,N,kA),l.context=pA(null),o=l.current,d=oi(),d=We(d),m=as(d),m.callback=null,os(o,m,d),o=d,l.current.lanes=o,jn(l,o),tr(l),i[Vn]=l.current,tg(i),new pd(l)},sa.version="19.2.8",sa}var Rg;function qA(){if(Rg)return yd.exports;Rg=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),yd.exports=LA(),yd.exports}var BA=qA(),I=wd();const Ad=Sg(I);const $A=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),IA=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase()),Dg=t=>{const e=IA(t);return e.charAt(0).toUpperCase()+e.slice(1)},_g=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim(),HA=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var zA={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const UA=I.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:a,iconNode:c,...u},f)=>I.createElement("svg",{ref:f,...zA,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:_g("lucide",s),...!a&&!HA(u)&&{"aria-hidden":"true"},...u},[...c.map(([h,g])=>I.createElement(h,g)),...Array.isArray(a)?a:[a]]));const lt=(t,e)=>{const n=I.forwardRef(({className:r,...s},a)=>I.createElement(UA,{ref:a,iconNode:e,className:_g(`lucide-${$A(Dg(t))}`,`lucide-${t}`,r),...s}));return n.displayName=Dg(t),n};const Lg=lt("activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);const Ro=lt("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);const qg=lt("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);const Bg=lt("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const $g=lt("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const kd=lt("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);const la=lt("circle-check",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);const VA=lt("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);const Cd=lt("clock-3",[["path",{d:"M12 6v6h4",key:"135r8i"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);const FA=lt("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Nd=lt("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const Td=lt("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);const Ig=lt("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const PA=lt("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);const YA=lt("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const KA=lt("library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);const GA=lt("link-2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);const XA=lt("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);const JA=lt("lock-open",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);const QA=lt("lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);const WA=lt("menu",[["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 18h16",key:"19g7jn"}],["path",{d:"M4 6h16",key:"1o0s65"}]]);const jd=lt("panel-left-close",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);const Ed=lt("panel-left-open",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);const aa=lt("play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);const Cs=lt("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const ZA=lt("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const ek=lt("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);const Hg=lt("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);const zg=lt("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);const tk=lt("settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);const nk=lt("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);const Ug=lt("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);const Vg=lt("tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);const ci=lt("trash-2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);const Od=lt("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);const Fg=lt("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);const ik=lt("wand-sparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);const Md=lt("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function rk(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var vn={},Do={},Rr={},Pg;function oa(){if(Pg)return Rr;Pg=1;function t(c){return typeof c>"u"||c===null}function e(c){return typeof c=="object"&&c!==null}function n(c){return Array.isArray(c)?c:t(c)?[]:[c]}function r(c,u){if(u){const f=Object.keys(u);for(let h=0,g=f.length;h<g;h+=1){const b=f[h];c[b]=u[b]}}return c}function s(c,u){let f="";for(let h=0;h<u;h+=1)f+=c;return f}function a(c){return c===0&&Number.NEGATIVE_INFINITY===1/c}return Rr.isNothing=t,Rr.isObject=e,Rr.toArray=n,Rr.repeat=s,Rr.isNegativeZero=a,Rr.extend=r,Rr}var Rd,Yg;function ca(){if(Yg)return Rd;Yg=1;function t(n,r){let s="";const a=n.reason||"(unknown reason)";return n.mark?(n.mark.name&&(s+='in "'+n.mark.name+'" '),s+="("+(n.mark.line+1)+":"+(n.mark.column+1)+")",!r&&n.mark.snippet&&(s+=`
|
|
10
10
|
|
|
11
|
-
`+n.mark.snippet),a+" "+s):a}function e(n,r){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=r,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(r){return this.name+": "+t(this,r)},
|
|
11
|
+
`+n.mark.snippet),a+" "+s):a}function e(n,r){Error.call(this),this.name="YAMLException",this.reason=n,this.mark=r,this.message=t(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e.prototype.toString=function(r){return this.name+": "+t(this,r)},Rd=e,Rd}var Dd,Kg;function sk(){if(Kg)return Dd;Kg=1;const t=oa();function e(s,a,c,u,f){let h="",g="";const b=Math.floor(f/2)-1;return u-a>b&&(h=" ... ",a=u-b+h.length),c-u>b&&(g=" ...",c=u+b-g.length),{str:h+s.slice(a,c).replace(/\t/g,"→")+g,pos:u-a+h.length}}function n(s,a){return t.repeat(" ",a-s.length)+s}function r(s,a){if(a=Object.create(a||null),!s.buffer)return null;a.maxLength||(a.maxLength=79),typeof a.indent!="number"&&(a.indent=1),typeof a.linesBefore!="number"&&(a.linesBefore=3),typeof a.linesAfter!="number"&&(a.linesAfter=2);const c=/\r?\n|\r|\0/g,u=[0],f=[];let h,g=-1;for(;h=c.exec(s.buffer);)f.push(h.index),u.push(h.index+h[0].length),s.position<=h.index&&g<0&&(g=u.length-2);g<0&&(g=u.length-1);let b="";const v=Math.min(s.line+a.linesAfter,f.length).toString().length,w=a.maxLength-(a.indent+v+3);for(let C=1;C<=a.linesBefore&&!(g-C<0);C++){const O=e(s.buffer,u[g-C],f[g-C],s.position-(u[g]-u[g-C]),w);b=t.repeat(" ",a.indent)+n((s.line-C+1).toString(),v)+" | "+O.str+`
|
|
12
12
|
`+b}const A=e(s.buffer,u[g],f[g],s.position,w);b+=t.repeat(" ",a.indent)+n((s.line+1).toString(),v)+" | "+A.str+`
|
|
13
13
|
`,b+=t.repeat("-",a.indent+v+3+A.pos)+`^
|
|
14
|
-
`;for(let C=1;C<=a.linesAfter&&!(g+C>=f.length);C++){const
|
|
15
|
-
`}return b.replace(/\n$/,"")}return
|
|
16
|
-
\r`;function n(c){if(c===null)return!1;let u=0;const f=c.length,h=e;for(let g=0;g<f;g++){const b=h.indexOf(c.charAt(g));if(!(b>64)){if(b<0)return!1;u+=6}}return u%8===0}function r(c){const u=c.replace(/[\r\n=]/g,""),f=u.length,h=e;let g=0;const b=[];for(let w=0;w<f;w++)w%4===0&&w&&(b.push(g>>16&255),b.push(g>>8&255),b.push(g&255)),g=g<<6|h.indexOf(u.charAt(w));const v=f%4*6;return v===0?(b.push(g>>16&255),b.push(g>>8&255),b.push(g&255)):v===18?(b.push(g>>10&255),b.push(g>>2&255)):v===12&&b.push(g>>4&255),new Uint8Array(b)}function s(c){let u="",f=0;const h=c.length,g=e;for(let v=0;v<h;v++)v%3===0&&v&&(u+=g[f>>18&63],u+=g[f>>12&63],u+=g[f>>6&63],u+=g[f&63]),f=(f<<8)+c[v];const b=h%3;return b===0?(u+=g[f>>18&63],u+=g[f>>12&63],u+=g[f>>6&63],u+=g[f&63]):b===2?(u+=g[f>>10&63],u+=g[f>>4&63],u+=g[f<<2&63],u+=g[64]):b===1&&(u+=g[f>>2&63],u+=g[f<<4&63],u+=g[64],u+=g[64]),u}function a(c){return Object.prototype.toString.call(c)==="[object Uint8Array]"}return
|
|
17
|
-
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"
";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function B(x){return x<=65535?String.fromCharCode(x):String.fromCharCode((x-65536>>10)+55296,(x-65536&1023)+56320)}function K(x,V,me){V==="__proto__"?Object.defineProperty(x,V,{configurable:!0,enumerable:!0,writable:!0,value:me}):x[V]=me}const W=new Array(256),ye=new Array(256);for(let x=0;x<256;x++)W[x]=U(x)?1:0,ye[x]=U(x);function pe(x,V){this.input=x,this.filename=V.filename||null,this.schema=V.schema||r,this.onWarning=V.onWarning||null,this.legacy=V.legacy||!1,this.json=V.json||!1,this.listener=V.listener||null,this.maxDepth=typeof V.maxDepth=="number"?V.maxDepth:100,this.maxTotalMergeKeys=typeof V.maxTotalMergeKeys=="number"?V.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=x.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function fe(x,V){const me={name:x.filename,buffer:x.input.slice(0,-1),position:x.position,line:x.line,column:x.position-x.lineStart};return me.snippet=n(me),new e(V,me)}function L(x,V){throw fe(x,V)}function Q(x,V){x.onWarning&&x.onWarning.call(null,fe(x,V))}function oe(x,V,me){const ae=x.anchorMapTransactions;if(ae.length!==0){const J=ae[ae.length-1];s.call(J,V)||(J[V]={existed:s.call(x.anchorMap,V),value:x.anchorMap[V]})}x.anchorMap[V]=me}function ce(x){x.anchorMapTransactions.push(Object.create(null))}function ve(x){const V=x.anchorMapTransactions.pop(),me=x.anchorMapTransactions;if(me.length===0)return;const ae=me[me.length-1],J=Object.keys(V);for(let k=0,Y=J.length;k<Y;k+=1){const Z=J[k];s.call(ae,Z)||(ae[Z]=V[Z])}}function T(x){const V=x.anchorMapTransactions.pop(),me=Object.keys(V);for(let ae=me.length-1;ae>=0;ae-=1){const J=V[me[ae]];J.existed?x.anchorMap[me[ae]]=J.value:delete x.anchorMap[me[ae]]}}function z(x){return{position:x.position,line:x.line,lineStart:x.lineStart,lineIndent:x.lineIndent,firstTabInLine:x.firstTabInLine,tag:x.tag,anchor:x.anchor,kind:x.kind,result:x.result}}function he(x,V){x.position=V.position,x.line=V.line,x.lineStart=V.lineStart,x.lineIndent=V.lineIndent,x.firstTabInLine=V.firstTabInLine,x.tag=V.tag,x.anchor=V.anchor,x.kind=V.kind,x.result=V.result}const ne={YAML:function(V,me,ae){V.version!==null&&L(V,"duplication of %YAML directive"),ae.length!==1&&L(V,"YAML directive accepts exactly one argument");const J=/^([0-9]+)\.([0-9]+)$/.exec(ae[0]);J===null&&L(V,"ill-formed argument of the YAML directive");const k=parseInt(J[1],10),Y=parseInt(J[2],10);k!==1&&L(V,"unacceptable YAML version of the document"),V.version=ae[0],V.checkLineBreaks=Y<2,Y!==1&&Y!==2&&Q(V,"unsupported YAML version of the document")},TAG:function(V,me,ae){let J;ae.length!==2&&L(V,"TAG directive accepts exactly two arguments");const k=ae[0];J=ae[1],C.test(k)||L(V,"ill-formed tag handle (first argument) of the TAG directive"),s.call(V.tagMap,k)&&L(V,'there is a previously declared suffix for "'+k+'" tag handle'),
|
|
18
|
-
`,V-1))}function Ce(x,V,me){let ae,J,k,Y,Z,xe;const F=x.kind,ue=x.result;let re=x.input.charCodeAt(x.position);if(
|
|
14
|
+
`;for(let C=1;C<=a.linesAfter&&!(g+C>=f.length);C++){const O=e(s.buffer,u[g+C],f[g+C],s.position-(u[g]-u[g+C]),w);b+=t.repeat(" ",a.indent)+n((s.line+C+1).toString(),v)+" | "+O.str+`
|
|
15
|
+
`}return b.replace(/\n$/,"")}return Dd=r,Dd}var _d,Gg;function En(){if(Gg)return _d;Gg=1;const t=ca(),e=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],n=["scalar","sequence","mapping"];function r(a){const c={};return a!==null&&Object.keys(a).forEach(function(u){a[u].forEach(function(f){c[String(f)]=u})}),c}function s(a,c){if(c=c||{},Object.keys(c).forEach(function(u){if(e.indexOf(u)===-1)throw new t('Unknown option "'+u+'" is met in definition of "'+a+'" YAML type.')}),this.options=c,this.tag=a,this.kind=c.kind||null,this.resolve=c.resolve||function(){return!0},this.construct=c.construct||function(u){return u},this.instanceOf=c.instanceOf||null,this.predicate=c.predicate||null,this.represent=c.represent||null,this.representName=c.representName||null,this.defaultStyle=c.defaultStyle||null,this.multi=c.multi||!1,this.styleAliases=r(c.styleAliases||null),n.indexOf(this.kind)===-1)throw new t('Unknown kind "'+this.kind+'" is specified for "'+a+'" YAML type.')}return _d=s,_d}var Ld,Xg;function Jg(){if(Xg)return Ld;Xg=1;const t=ca(),e=En();function n(a,c){const u=[];return a[c].forEach(function(f){let h=u.length;u.forEach(function(g,b){g.tag===f.tag&&g.kind===f.kind&&g.multi===f.multi&&(h=b)}),u[h]=f}),u}function r(){const a={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function c(u){u.multi?(a.multi[u.kind].push(u),a.multi.fallback.push(u)):a[u.kind][u.tag]=a.fallback[u.tag]=u}for(let u=0,f=arguments.length;u<f;u+=1)arguments[u].forEach(c);return a}function s(a){return this.extend(a)}return s.prototype.extend=function(c){let u=[],f=[];if(c instanceof e)f.push(c);else if(Array.isArray(c))f=f.concat(c);else if(c&&(Array.isArray(c.implicit)||Array.isArray(c.explicit)))c.implicit&&(u=u.concat(c.implicit)),c.explicit&&(f=f.concat(c.explicit));else throw new t("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");u.forEach(function(g){if(!(g instanceof e))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(g.loadKind&&g.loadKind!=="scalar")throw new t("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(g.multi)throw new t("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),f.forEach(function(g){if(!(g instanceof e))throw new t("Specified list of YAML types (or a single Type object) contains a non-Type object.")});const h=Object.create(s.prototype);return h.implicit=(this.implicit||[]).concat(u),h.explicit=(this.explicit||[]).concat(f),h.compiledImplicit=n(h,"implicit"),h.compiledExplicit=n(h,"explicit"),h.compiledTypeMap=r(h.compiledImplicit,h.compiledExplicit),h},Ld=s,Ld}var qd,Qg;function Wg(){if(Qg)return qd;Qg=1;const t=En();return qd=new t("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return e!==null?e:""}}),qd}var Bd,Zg;function e0(){if(Zg)return Bd;Zg=1;const t=En();return Bd=new t("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return e!==null?e:[]}}),Bd}var $d,t0;function n0(){if(t0)return $d;t0=1;const t=En();return $d=new t("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return e!==null?e:{}}}),$d}var Id,i0;function r0(){if(i0)return Id;i0=1;const t=Jg();return Id=new t({explicit:[Wg(),e0(),n0()]}),Id}var Hd,s0;function l0(){if(s0)return Hd;s0=1;const t=En();function e(s){if(s===null)return!0;const a=s.length;return a===1&&s==="~"||a===4&&(s==="null"||s==="Null"||s==="NULL")}function n(){return null}function r(s){return s===null}return Hd=new t("tag:yaml.org,2002:null",{kind:"scalar",resolve:e,construct:n,predicate:r,represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"}),Hd}var zd,a0;function o0(){if(a0)return zd;a0=1;const t=En();function e(s){if(s===null)return!1;const a=s.length;return a===4&&(s==="true"||s==="True"||s==="TRUE")||a===5&&(s==="false"||s==="False"||s==="FALSE")}function n(s){return s==="true"||s==="True"||s==="TRUE"}function r(s){return Object.prototype.toString.call(s)==="[object Boolean]"}return zd=new t("tag:yaml.org,2002:bool",{kind:"scalar",resolve:e,construct:n,predicate:r,represent:{lowercase:function(s){return s?"true":"false"},uppercase:function(s){return s?"TRUE":"FALSE"},camelcase:function(s){return s?"True":"False"}},defaultStyle:"lowercase"}),zd}var Ud,c0;function u0(){if(c0)return Ud;c0=1;const t=oa(),e=En();function n(h){return h>=48&&h<=57||h>=65&&h<=70||h>=97&&h<=102}function r(h){return h>=48&&h<=55}function s(h){return h>=48&&h<=57}function a(h){if(h===null)return!1;const g=h.length;let b=0,v=!1;if(!g)return!1;let w=h[b];if((w==="-"||w==="+")&&(w=h[++b]),w==="0"){if(b+1===g)return!0;if(w=h[++b],w==="b"){for(b++;b<g;b++){if(w=h[b],w!=="0"&&w!=="1")return!1;v=!0}return v&&isFinite(c(h))}if(w==="x"){for(b++;b<g;b++){if(!n(h.charCodeAt(b)))return!1;v=!0}return v&&isFinite(c(h))}if(w==="o"){for(b++;b<g;b++){if(!r(h.charCodeAt(b)))return!1;v=!0}return v&&isFinite(c(h))}}for(;b<g;b++){if(!s(h.charCodeAt(b)))return!1;v=!0}return v?isFinite(c(h)):!1}function c(h){let g=h,b=1,v=g[0];if((v==="-"||v==="+")&&(v==="-"&&(b=-1),g=g.slice(1),v=g[0]),g==="0")return 0;if(v==="0"){if(g[1]==="b")return b*parseInt(g.slice(2),2);if(g[1]==="x")return b*parseInt(g.slice(2),16);if(g[1]==="o")return b*parseInt(g.slice(2),8)}return b*parseInt(g,10)}function u(h){return c(h)}function f(h){return Object.prototype.toString.call(h)==="[object Number]"&&h%1===0&&!t.isNegativeZero(h)}return Ud=new e("tag:yaml.org,2002:int",{kind:"scalar",resolve:a,construct:u,predicate:f,represent:{binary:function(h){return h>=0?"0b"+h.toString(2):"-0b"+h.toString(2).slice(1)},octal:function(h){return h>=0?"0o"+h.toString(8):"-0o"+h.toString(8).slice(1)},decimal:function(h){return h.toString(10)},hexadecimal:function(h){return h>=0?"0x"+h.toString(16).toUpperCase():"-0x"+h.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),Ud}var Vd,d0;function f0(){if(d0)return Vd;d0=1;const t=oa(),e=En(),n=new RegExp("^(?:[-+]?(?:[0-9]+)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),r=new RegExp("^(?:[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");function s(h){return h===null||!n.test(h)?!1:isFinite(parseFloat(h,10))?!0:r.test(h)}function a(h){let g=h.toLowerCase();const b=g[0]==="-"?-1:1;return"+-".indexOf(g[0])>=0&&(g=g.slice(1)),g===".inf"?b===1?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:g===".nan"?NaN:b*parseFloat(g,10)}const c=/^[-+]?[0-9]+e/;function u(h,g){if(isNaN(h))switch(g){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===h)switch(g){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===h)switch(g){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(t.isNegativeZero(h))return"-0.0";const b=h.toString(10);return c.test(b)?b.replace("e",".e"):b}function f(h){return Object.prototype.toString.call(h)==="[object Number]"&&(h%1!==0||t.isNegativeZero(h))}return Vd=new e("tag:yaml.org,2002:float",{kind:"scalar",resolve:s,construct:a,predicate:f,represent:u,defaultStyle:"lowercase"}),Vd}var Fd,h0;function p0(){return h0||(h0=1,Fd=r0().extend({implicit:[l0(),o0(),u0(),f0()]})),Fd}var Pd,m0;function g0(){return m0||(m0=1,Pd=p0()),Pd}var Yd,y0;function b0(){if(y0)return Yd;y0=1;const t=En(),e=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),n=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");function r(c){return c===null?!1:e.exec(c)!==null||n.exec(c)!==null}function s(c){let u=0,f=null,h=e.exec(c);if(h===null&&(h=n.exec(c)),h===null)throw new Error("Date resolve error");const g=+h[1],b=+h[2]-1,v=+h[3];if(!h[4])return new Date(Date.UTC(g,b,v));const w=+h[4],A=+h[5],C=+h[6];if(h[7]){for(u=h[7].slice(0,3);u.length<3;)u+="0";u=+u}if(h[9]){const D=+h[10],E=+(h[11]||0);f=(D*60+E)*6e4,h[9]==="-"&&(f=-f)}const O=new Date(Date.UTC(g,b,v,w,A,C,u));return f&&O.setTime(O.getTime()-f),O}function a(c){return c.toISOString()}return Yd=new t("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:r,construct:s,instanceOf:Date,represent:a}),Yd}var Kd,x0;function v0(){if(x0)return Kd;x0=1;const t=En();function e(n){return n==="<<"||n===null}return Kd=new t("tag:yaml.org,2002:merge",{kind:"scalar",resolve:e}),Kd}var Gd,w0;function S0(){if(w0)return Gd;w0=1;const t=En(),e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
|
|
16
|
+
\r`;function n(c){if(c===null)return!1;let u=0;const f=c.length,h=e;for(let g=0;g<f;g++){const b=h.indexOf(c.charAt(g));if(!(b>64)){if(b<0)return!1;u+=6}}return u%8===0}function r(c){const u=c.replace(/[\r\n=]/g,""),f=u.length,h=e;let g=0;const b=[];for(let w=0;w<f;w++)w%4===0&&w&&(b.push(g>>16&255),b.push(g>>8&255),b.push(g&255)),g=g<<6|h.indexOf(u.charAt(w));const v=f%4*6;return v===0?(b.push(g>>16&255),b.push(g>>8&255),b.push(g&255)):v===18?(b.push(g>>10&255),b.push(g>>2&255)):v===12&&b.push(g>>4&255),new Uint8Array(b)}function s(c){let u="",f=0;const h=c.length,g=e;for(let v=0;v<h;v++)v%3===0&&v&&(u+=g[f>>18&63],u+=g[f>>12&63],u+=g[f>>6&63],u+=g[f&63]),f=(f<<8)+c[v];const b=h%3;return b===0?(u+=g[f>>18&63],u+=g[f>>12&63],u+=g[f>>6&63],u+=g[f&63]):b===2?(u+=g[f>>10&63],u+=g[f>>4&63],u+=g[f<<2&63],u+=g[64]):b===1&&(u+=g[f>>2&63],u+=g[f<<4&63],u+=g[64],u+=g[64]),u}function a(c){return Object.prototype.toString.call(c)==="[object Uint8Array]"}return Gd=new t("tag:yaml.org,2002:binary",{kind:"scalar",resolve:n,construct:r,predicate:a,represent:s}),Gd}var Xd,A0;function k0(){if(A0)return Xd;A0=1;const t=En(),e=Object.prototype.hasOwnProperty,n=Object.prototype.toString;function r(a){if(a===null)return!0;const c={},u=a;for(let f=0,h=u.length;f<h;f+=1){const g=u[f];let b=!1;if(n.call(g)!=="[object Object]")return!1;let v;for(v in g)if(e.call(g,v))if(!b)b=!0;else return!1;if(!b||e.call(c,v))return!1;Object.defineProperty(c,v,{value:!0})}return!0}function s(a){return a!==null?a:[]}return Xd=new t("tag:yaml.org,2002:omap",{kind:"sequence",resolve:r,construct:s}),Xd}var Jd,C0;function N0(){if(C0)return Jd;C0=1;const t=En(),e=Object.prototype.toString;function n(s){if(s===null)return!0;const a=s,c=new Array(a.length);for(let u=0,f=a.length;u<f;u+=1){const h=a[u];if(e.call(h)!=="[object Object]")return!1;const g=Object.keys(h);if(g.length!==1)return!1;c[u]=[g[0],h[g[0]]]}return!0}function r(s){if(s===null)return[];const a=s,c=new Array(a.length);for(let u=0,f=a.length;u<f;u+=1){const h=a[u],g=Object.keys(h);c[u]=[g[0],h[g[0]]]}return c}return Jd=new t("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:n,construct:r}),Jd}var Qd,T0;function j0(){if(T0)return Qd;T0=1;const t=En(),e=Object.prototype.hasOwnProperty;function n(s){if(s===null)return!0;const a=s;for(const c in a)if(e.call(a,c)&&a[c]!==null)return!1;return!0}function r(s){return s!==null?s:{}}return Qd=new t("tag:yaml.org,2002:set",{kind:"mapping",resolve:n,construct:r}),Qd}var Wd,E0;function Zd(){return E0||(E0=1,Wd=g0().extend({implicit:[b0(),v0()],explicit:[S0(),k0(),N0(),j0()]})),Wd}var O0;function lk(){if(O0)return Do;O0=1;const t=oa(),e=ca(),n=sk(),r=Zd(),s=Object.prototype.hasOwnProperty,a=1,c=2,u=3,f=4,h=1,g=2,b=3,v=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,w=/[\x85\u2028\u2029]/,A=/[,\[\]{}]/,C=/^(?:!|!!|![0-9A-Za-z-]+!)$/,O=/^(?:!|[^,\[\]{}])(?:%[0-9a-f]{2}|[0-9a-z\-#;/?:@&=+$,_.!~*'()\[\]])*$/i;function D(x){return Object.prototype.toString.call(x)}function E(x){return x===10||x===13}function j(x){return x===9||x===32}function M(x){return x===9||x===32||x===10||x===13}function _(x){return x===44||x===91||x===93||x===123||x===125}function q(x){if(x>=48&&x<=57)return x-48;const V=x|32;return V>=97&&V<=102?V-97+10:-1}function R(x){return x===120?2:x===117?4:x===85?8:0}function X(x){return x>=48&&x<=57?x-48:-1}function U(x){switch(x){case 48:return"\0";case 97:return"\x07";case 98:return"\b";case 116:return" ";case 9:return" ";case 110:return`
|
|
17
|
+
`;case 118:return"\v";case 102:return"\f";case 114:return"\r";case 101:return"\x1B";case 32:return" ";case 34:return'"';case 47:return"/";case 92:return"\\";case 78:return"
";case 95:return" ";case 76:return"\u2028";case 80:return"\u2029";default:return""}}function B(x){return x<=65535?String.fromCharCode(x):String.fromCharCode((x-65536>>10)+55296,(x-65536&1023)+56320)}function K(x,V,me){V==="__proto__"?Object.defineProperty(x,V,{configurable:!0,enumerable:!0,writable:!0,value:me}):x[V]=me}const W=new Array(256),ye=new Array(256);for(let x=0;x<256;x++)W[x]=U(x)?1:0,ye[x]=U(x);function pe(x,V){this.input=x,this.filename=V.filename||null,this.schema=V.schema||r,this.onWarning=V.onWarning||null,this.legacy=V.legacy||!1,this.json=V.json||!1,this.listener=V.listener||null,this.maxDepth=typeof V.maxDepth=="number"?V.maxDepth:100,this.maxTotalMergeKeys=typeof V.maxTotalMergeKeys=="number"?V.maxTotalMergeKeys:1e4,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=x.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.depth=0,this.totalMergeKeys=0,this.firstTabInLine=-1,this.documents=[],this.anchorMapTransactions=[]}function fe(x,V){const me={name:x.filename,buffer:x.input.slice(0,-1),position:x.position,line:x.line,column:x.position-x.lineStart};return me.snippet=n(me),new e(V,me)}function L(x,V){throw fe(x,V)}function Q(x,V){x.onWarning&&x.onWarning.call(null,fe(x,V))}function oe(x,V,me){const ae=x.anchorMapTransactions;if(ae.length!==0){const J=ae[ae.length-1];s.call(J,V)||(J[V]={existed:s.call(x.anchorMap,V),value:x.anchorMap[V]})}x.anchorMap[V]=me}function ce(x){x.anchorMapTransactions.push(Object.create(null))}function ve(x){const V=x.anchorMapTransactions.pop(),me=x.anchorMapTransactions;if(me.length===0)return;const ae=me[me.length-1],J=Object.keys(V);for(let k=0,Y=J.length;k<Y;k+=1){const Z=J[k];s.call(ae,Z)||(ae[Z]=V[Z])}}function T(x){const V=x.anchorMapTransactions.pop(),me=Object.keys(V);for(let ae=me.length-1;ae>=0;ae-=1){const J=V[me[ae]];J.existed?x.anchorMap[me[ae]]=J.value:delete x.anchorMap[me[ae]]}}function z(x){return{position:x.position,line:x.line,lineStart:x.lineStart,lineIndent:x.lineIndent,firstTabInLine:x.firstTabInLine,tag:x.tag,anchor:x.anchor,kind:x.kind,result:x.result}}function he(x,V){x.position=V.position,x.line=V.line,x.lineStart=V.lineStart,x.lineIndent=V.lineIndent,x.firstTabInLine=V.firstTabInLine,x.tag=V.tag,x.anchor=V.anchor,x.kind=V.kind,x.result=V.result}const ne={YAML:function(V,me,ae){V.version!==null&&L(V,"duplication of %YAML directive"),ae.length!==1&&L(V,"YAML directive accepts exactly one argument");const J=/^([0-9]+)\.([0-9]+)$/.exec(ae[0]);J===null&&L(V,"ill-formed argument of the YAML directive");const k=parseInt(J[1],10),Y=parseInt(J[2],10);k!==1&&L(V,"unacceptable YAML version of the document"),V.version=ae[0],V.checkLineBreaks=Y<2,Y!==1&&Y!==2&&Q(V,"unsupported YAML version of the document")},TAG:function(V,me,ae){let J;ae.length!==2&&L(V,"TAG directive accepts exactly two arguments");const k=ae[0];J=ae[1],C.test(k)||L(V,"ill-formed tag handle (first argument) of the TAG directive"),s.call(V.tagMap,k)&&L(V,'there is a previously declared suffix for "'+k+'" tag handle'),O.test(J)||L(V,"ill-formed tag prefix (second argument) of the TAG directive");try{J=decodeURIComponent(J)}catch{L(V,"tag prefix is malformed: "+J)}V.tagMap[k]=J}};function ke(x,V,me,ae){if(V<me){const J=x.input.slice(V,me);if(ae)for(let k=0,Y=J.length;k<Y;k+=1){const Z=J.charCodeAt(k);Z===9||Z>=32&&Z<=1114111||L(x,"expected valid JSON character")}else v.test(J)&&L(x,"the stream contains non-printable characters");x.result+=J}}function qe(x){x.totalMergeKeys++,x.maxTotalMergeKeys!==-1&&x.totalMergeKeys>x.maxTotalMergeKeys&&L(x,"merge keys exceeded maxTotalMergeKeys ("+x.maxTotalMergeKeys+")")}function $e(x,V,me,ae){t.isObject(me)||L(x,"cannot merge mappings; the provided source object is unacceptable"),qe(x);const J=Object.keys(me);for(let k=0,Y=J.length;k<Y;k+=1){const Z=J[k];qe(x),s.call(V,Z)||(K(V,Z,me[Z]),ae[Z]=!0)}}function Fe(x,V,me,ae,J,k,Y,Z,xe){if(Array.isArray(J)){J=Array.prototype.slice.call(J);for(let F=0,ue=J.length;F<ue;F+=1)Array.isArray(J[F])&&L(x,"nested arrays are not supported inside keys"),typeof J=="object"&&D(J[F])==="[object Object]"&&(J[F]="[object Object]")}if(typeof J=="object"&&D(J)==="[object Object]"&&(J="[object Object]"),J=String(J),V===null&&(V={}),ae==="tag:yaml.org,2002:merge")if(Array.isArray(k)){k.length>100&&L(x,"abnormal merge sequence size");for(let F=0,ue=k.length;F<ue;F+=1)$e(x,V,k[F],me)}else $e(x,V,k,me);else!x.json&&!s.call(me,J)&&s.call(V,J)&&(x.line=Y||x.line,x.lineStart=Z||x.lineStart,x.position=xe||x.position,L(x,"duplicated mapping key")),K(V,J,k),delete me[J];return V}function Ye(x){const V=x.input.charCodeAt(x.position);V===10?x.position++:V===13?(x.position++,x.input.charCodeAt(x.position)===10&&x.position++):L(x,"a line break is expected"),x.line+=1,x.lineStart=x.position,x.firstTabInLine=-1}function Ie(x,V,me){let ae=0,J=x.input.charCodeAt(x.position);for(;J!==0;){for(;j(J);)J===9&&x.firstTabInLine===-1&&(x.firstTabInLine=x.position),J=x.input.charCodeAt(++x.position);if(V&&J===35)do J=x.input.charCodeAt(++x.position);while(J!==10&&J!==13&&J!==0);if(E(J))for(Ye(x),J=x.input.charCodeAt(x.position),ae++,x.lineIndent=0;J===32;)x.lineIndent++,J=x.input.charCodeAt(++x.position);else break}return me!==-1&&ae!==0&&x.lineIndent<me&&Q(x,"deficient indentation"),ae}function ut(x){let V=x.position,me=x.input.charCodeAt(V);return!!((me===45||me===46)&&me===x.input.charCodeAt(V+1)&&me===x.input.charCodeAt(V+2)&&(V+=3,me=x.input.charCodeAt(V),me===0||M(me)))}function Rt(x,V){V===1?x.result+=" ":V>1&&(x.result+=t.repeat(`
|
|
18
|
+
`,V-1))}function Ce(x,V,me){let ae,J,k,Y,Z,xe;const F=x.kind,ue=x.result;let re=x.input.charCodeAt(x.position);if(M(re)||_(re)||re===35||re===38||re===42||re===33||re===124||re===62||re===39||re===34||re===37||re===64||re===96)return!1;if(re===63||re===45){const Se=x.input.charCodeAt(x.position+1);if(M(Se)||me&&_(Se))return!1}for(x.kind="scalar",x.result="",ae=J=x.position,k=!1;re!==0;){if(re===58){const Se=x.input.charCodeAt(x.position+1);if(M(Se)||me&&_(Se))break}else if(re===35){const Se=x.input.charCodeAt(x.position-1);if(M(Se))break}else{if(x.position===x.lineStart&&ut(x)||me&&_(re))break;if(E(re))if(Y=x.line,Z=x.lineStart,xe=x.lineIndent,Ie(x,!1,-1),x.lineIndent>=V){k=!0,re=x.input.charCodeAt(x.position);continue}else{x.position=J,x.line=Y,x.lineStart=Z,x.lineIndent=xe;break}}k&&(ke(x,ae,J,!1),Rt(x,x.line-Y),ae=J=x.position,k=!1),j(re)||(J=x.position+1),re=x.input.charCodeAt(++x.position)}return ke(x,ae,J,!1),x.result?!0:(x.kind=F,x.result=ue,!1)}function Oe(x,V){let me,ae,J=x.input.charCodeAt(x.position);if(J!==39)return!1;for(x.kind="scalar",x.result="",x.position++,me=ae=x.position;(J=x.input.charCodeAt(x.position))!==0;)if(J===39)if(ke(x,me,x.position,!0),J=x.input.charCodeAt(++x.position),J===39)me=x.position,x.position++,ae=x.position;else return!0;else E(J)?(ke(x,me,ae,!0),Rt(x,Ie(x,!1,V)),me=ae=x.position):x.position===x.lineStart&&ut(x)?L(x,"unexpected end of the document within a single quoted scalar"):(x.position++,j(J)||(ae=x.position));L(x,"unexpected end of the stream within a single quoted scalar")}function G(x,V){let me,ae,J,k=x.input.charCodeAt(x.position);if(k!==34)return!1;for(x.kind="scalar",x.result="",x.position++,me=ae=x.position;(k=x.input.charCodeAt(x.position))!==0;){if(k===34)return ke(x,me,x.position,!0),x.position++,!0;if(k===92){if(ke(x,me,x.position,!0),k=x.input.charCodeAt(++x.position),E(k))Ie(x,!1,V);else if(k<256&&W[k])x.result+=ye[k],x.position++;else if((J=R(k))>0){let Y=J,Z=0;for(;Y>0;Y--)k=x.input.charCodeAt(++x.position),(J=q(k))>=0?Z=(Z<<4)+J:L(x,"expected hexadecimal character");x.result+=B(Z),x.position++}else L(x,"unknown escape sequence");me=ae=x.position}else E(k)?(ke(x,me,ae,!0),Rt(x,Ie(x,!1,V)),me=ae=x.position):x.position===x.lineStart&&ut(x)?L(x,"unexpected end of the document within a double quoted scalar"):(x.position++,j(k)||(ae=x.position))}L(x,"unexpected end of the stream within a double quoted scalar")}function we(x,V){let me=!0,ae,J,k;const Y=x.tag;let Z;const xe=x.anchor;let F,ue,re,Se;const Me=Object.create(null);let je,_e,ze,Qe=x.input.charCodeAt(x.position);if(Qe===91)F=93,Se=!1,Z=[];else if(Qe===123)F=125,Se=!0,Z={};else return!1;for(x.anchor!==null&&oe(x,x.anchor,Z),Qe=x.input.charCodeAt(++x.position);Qe!==0;){if(Ie(x,!0,V),Qe=x.input.charCodeAt(x.position),Qe===F)return x.position++,x.tag=Y,x.anchor=xe,x.kind=Se?"mapping":"sequence",x.result=Z,!0;if(me?Qe===44&&L(x,"expected the node content, but found ','"):L(x,"missed comma between flow collection entries"),_e=je=ze=null,ue=re=!1,Qe===63){const pn=x.input.charCodeAt(x.position+1);M(pn)&&(ue=re=!0,x.position++,Ie(x,!0,V))}ae=x.line,J=x.lineStart,k=x.position,ht(x,V,a,!1,!0),_e=x.tag,je=x.result,Ie(x,!0,V),Qe=x.input.charCodeAt(x.position),(re||x.line===ae)&&Qe===58&&(ue=!0,Qe=x.input.charCodeAt(++x.position),Ie(x,!0,V),ht(x,V,a,!1,!0),ze=x.result),Se?Fe(x,Z,Me,_e,je,ze,ae,J,k):ue?Z.push(Fe(x,null,Me,_e,je,ze,ae,J,k)):Z.push(je),Ie(x,!0,V),Qe=x.input.charCodeAt(x.position),Qe===44?(me=!0,Qe=x.input.charCodeAt(++x.position)):me=!1}L(x,"unexpected end of the stream within a flow collection")}function Ne(x,V){let me,ae=h,J=!1,k=!1,Y=V,Z=0,xe=!1,F,ue=x.input.charCodeAt(x.position);if(ue===124)me=!1;else if(ue===62)me=!0;else return!1;for(x.kind="scalar",x.result="";ue!==0;)if(ue=x.input.charCodeAt(++x.position),ue===43||ue===45)h===ae?ae=ue===43?b:g:L(x,"repeat of a chomping mode identifier");else if((F=X(ue))>=0)F===0?L(x,"bad explicit indentation width of a block scalar; it cannot be less than one"):k?L(x,"repeat of an indentation width identifier"):(Y=V+F-1,k=!0);else break;if(j(ue)){do ue=x.input.charCodeAt(++x.position);while(j(ue));if(ue===35)do ue=x.input.charCodeAt(++x.position);while(!E(ue)&&ue!==0)}for(;ue!==0;){for(Ye(x),x.lineIndent=0,ue=x.input.charCodeAt(x.position);(!k||x.lineIndent<Y)&&ue===32;)x.lineIndent++,ue=x.input.charCodeAt(++x.position);if(!k&&x.lineIndent>Y&&(Y=x.lineIndent),E(ue)){Z++;continue}if(!k&&Y===0&&L(x,"missing indentation for block scalar"),x.lineIndent<Y){ae===b?x.result+=t.repeat(`
|
|
19
19
|
`,J?1+Z:Z):ae===h&&J&&(x.result+=`
|
|
20
|
-
`);break}me?
|
|
20
|
+
`);break}me?j(ue)?(xe=!0,x.result+=t.repeat(`
|
|
21
21
|
`,J?1+Z:Z)):xe?(xe=!1,x.result+=t.repeat(`
|
|
22
22
|
`,Z+1)):Z===0?J&&(x.result+=" "):x.result+=t.repeat(`
|
|
23
23
|
`,Z):x.result+=t.repeat(`
|
|
24
|
-
`,J?1+Z:Z),J=!0,k=!0,Z=0;const re=x.position;for(;!
|
|
25
|
-
`),x.charCodeAt(0)===65279&&(x=x.slice(1)));const me=new pe(x,V),ae=x.indexOf("\0");for(ae!==-1&&(me.position=ae,L(me,"null byte is not allowed in input")),me.input+="\0";me.input.charCodeAt(me.position)===32;)me.lineIndent+=1,me.position+=1;for(;me.position<me.length-1;)_n(me);return me.documents}function ei(x,V,me){V!==null&&typeof V=="object"&&typeof me>"u"&&(me=V,V=null);const ae=Tn(x,me);if(typeof V!="function")return ae;for(let J=0,k=ae.length;J<k;J+=1)V(ae[J])}function kt(x,V){const me=Tn(x,V);if(me.length!==0){if(me.length===1)return me[0];throw new e("expected a single document in the stream, but found more")}}return Do.loadAll=ei,Do.load=kt,Do}var
|
|
24
|
+
`,J?1+Z:Z),J=!0,k=!0,Z=0;const re=x.position;for(;!E(ue)&&ue!==0;)ue=x.input.charCodeAt(++x.position);ke(x,re,x.position,!1)}return!0}function De(x,V){const me=x.tag,ae=x.anchor,J=[];let k=!1;if(x.firstTabInLine!==-1)return!1;x.anchor!==null&&oe(x,x.anchor,J);let Y=x.input.charCodeAt(x.position);for(;Y!==0&&(x.firstTabInLine!==-1&&(x.position=x.firstTabInLine,L(x,"tab characters must not be used in indentation")),Y===45);){const Z=x.input.charCodeAt(x.position+1);if(!M(Z))break;if(k=!0,x.position++,Ie(x,!0,-1)&&x.lineIndent<=V){J.push(null),Y=x.input.charCodeAt(x.position);continue}const xe=x.line;if(ht(x,V,u,!1,!0),J.push(x.result),Ie(x,!0,-1),Y=x.input.charCodeAt(x.position),(x.line===xe||x.lineIndent>V)&&Y!==0)L(x,"bad indentation of a sequence entry");else if(x.lineIndent<V)break}return k?(x.tag=me,x.anchor=ae,x.kind="sequence",x.result=J,!0):!1}function Ke(x,V,me){let ae,J,k,Y;const Z=x.tag,xe=x.anchor,F={},ue=Object.create(null);let re=null,Se=null,Me=null,je=!1,_e=!1;if(x.firstTabInLine!==-1)return!1;x.anchor!==null&&oe(x,x.anchor,F);let ze=x.input.charCodeAt(x.position);for(;ze!==0;){!je&&x.firstTabInLine!==-1&&(x.position=x.firstTabInLine,L(x,"tab characters must not be used in indentation"));const Qe=x.input.charCodeAt(x.position+1),pn=x.line;if((ze===63||ze===58)&&M(Qe))ze===63?(je&&(Fe(x,F,ue,re,Se,null,J,k,Y),re=Se=Me=null),_e=!0,je=!0,ae=!0):je?(je=!1,ae=!0):L(x,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),x.position+=1,ze=Qe;else{if(J=x.line,k=x.lineStart,Y=x.position,!ht(x,me,c,!1,!0))break;if(x.line===pn){for(ze=x.input.charCodeAt(x.position);j(ze);)ze=x.input.charCodeAt(++x.position);if(ze===58)ze=x.input.charCodeAt(++x.position),M(ze)||L(x,"a whitespace character is expected after the key-value separator within a block mapping"),je&&(Fe(x,F,ue,re,Se,null,J,k,Y),re=Se=Me=null),_e=!0,je=!1,ae=!1,re=x.tag,Se=x.result;else if(_e)L(x,"can not read an implicit mapping pair; a colon is missed");else return x.tag=Z,x.anchor=xe,!0}else if(_e)L(x,"can not read a block mapping entry; a multiline key may not be an implicit key");else return x.tag=Z,x.anchor=xe,!0}if((x.line===pn||x.lineIndent>V)&&(je&&(J=x.line,k=x.lineStart,Y=x.position),ht(x,V,f,!0,ae)&&(je?Se=x.result:Me=x.result),je||(Fe(x,F,ue,re,Se,Me,J,k,Y),re=Se=Me=null),Ie(x,!0,-1),ze=x.input.charCodeAt(x.position)),(x.line===pn||x.lineIndent>V)&&ze!==0)L(x,"bad indentation of a mapping entry");else if(x.lineIndent<V)break}return je&&Fe(x,F,ue,re,Se,null,J,k,Y),_e&&(x.tag=Z,x.anchor=xe,x.kind="mapping",x.result=F),_e}function st(x){let V=!1,me=!1,ae,J,k=x.input.charCodeAt(x.position);if(k!==33)return!1;x.tag!==null&&L(x,"duplication of a tag property"),k=x.input.charCodeAt(++x.position),k===60?(V=!0,k=x.input.charCodeAt(++x.position)):k===33?(me=!0,ae="!!",k=x.input.charCodeAt(++x.position)):ae="!";let Y=x.position;if(V){do k=x.input.charCodeAt(++x.position);while(k!==0&&k!==62);x.position<x.length?(J=x.input.slice(Y,x.position),k=x.input.charCodeAt(++x.position)):L(x,"unexpected end of the stream within a verbatim tag")}else{for(;k!==0&&!M(k);)k===33&&(me?L(x,"tag suffix cannot contain exclamation marks"):(ae=x.input.slice(Y-1,x.position+1),C.test(ae)||L(x,"named tag handle cannot contain such characters"),me=!0,Y=x.position+1)),k=x.input.charCodeAt(++x.position);J=x.input.slice(Y,x.position),A.test(J)&&L(x,"tag suffix cannot contain flow indicator characters")}J&&!O.test(J)&&L(x,"tag name cannot contain such characters: "+J);try{J=decodeURIComponent(J)}catch{L(x,"tag name is malformed: "+J)}return V?x.tag=J:s.call(x.tagMap,ae)?x.tag=x.tagMap[ae]+J:ae==="!"?x.tag="!"+J:ae==="!!"?x.tag="tag:yaml.org,2002:"+J:L(x,'undeclared tag handle "'+ae+'"'),!0}function Et(x){let V=x.input.charCodeAt(x.position);if(V!==38)return!1;x.anchor!==null&&L(x,"duplication of an anchor property"),V=x.input.charCodeAt(++x.position);const me=x.position;for(;V!==0&&!M(V)&&!_(V);)V=x.input.charCodeAt(++x.position);return x.position===me&&L(x,"name of an anchor node must contain at least one character"),x.anchor=x.input.slice(me,x.position),!0}function Zn(x){let V=x.input.charCodeAt(x.position);if(V!==42)return!1;V=x.input.charCodeAt(++x.position);const me=x.position;for(;V!==0&&!M(V)&&!_(V);)V=x.input.charCodeAt(++x.position);x.position===me&&L(x,"name of an alias node must contain at least one character");const ae=x.input.slice(me,x.position);return s.call(x.anchorMap,ae)||L(x,'unidentified alias "'+ae+'"'),x.result=x.anchorMap[ae],Ie(x,!0,-1),!0}function Nn(x,V,me,ae){const J=z(x);return ce(x),he(x,V),x.tag=null,x.anchor=null,x.kind=null,x.result=null,Ke(x,me,ae)&&x.kind==="mapping"?(ve(x),!0):(T(x),he(x,J),!1)}function ht(x,V,me,ae,J){let k,Y,Z=1,xe=!1,F=!1,ue=null,re,Se,Me;x.depth>=x.maxDepth&&L(x,"nesting exceeded maxDepth ("+x.maxDepth+")"),x.depth+=1,x.listener!==null&&x.listener("open",x),x.tag=null,x.anchor=null,x.kind=null,x.result=null;const je=k=Y=f===me||u===me;if(ae&&Ie(x,!0,-1)&&(xe=!0,x.lineIndent>V?Z=1:x.lineIndent===V?Z=0:x.lineIndent<V&&(Z=-1)),Z===1)for(;;){const _e=x.input.charCodeAt(x.position),ze=z(x);if(xe&&(_e===33&&x.tag!==null||_e===38&&x.anchor!==null)||!st(x)&&!Et(x))break;ue===null&&(ue=ze),Ie(x,!0,-1)?(xe=!0,Y=je,x.lineIndent>V?Z=1:x.lineIndent===V?Z=0:x.lineIndent<V&&(Z=-1)):Y=!1}if(Y&&(Y=xe||J),Z===1||f===me)if(a===me||c===me?Se=V:Se=V+1,Me=x.position-x.lineStart,Z===1)if(Y&&(De(x,Me)||Ke(x,Me,Se))||we(x,Se))F=!0;else{const _e=x.input.charCodeAt(x.position);ue!==null&&je&&!Y&&_e!==124&&_e!==62&&Nn(x,ue,ue.position-ue.lineStart,Se)||k&&Ne(x,Se)||Oe(x,Se)||G(x,Se)?F=!0:Zn(x)?(F=!0,(x.tag!==null||x.anchor!==null)&&L(x,"alias node should not have any properties")):Ce(x,Se,a===me)&&(F=!0,x.tag===null&&(x.tag="?")),x.anchor!==null&&oe(x,x.anchor,x.result)}else Z===0&&(F=Y&&De(x,Me));if(x.tag===null)x.anchor!==null&&oe(x,x.anchor,x.result);else if(x.tag==="?"){x.result!==null&&x.kind!=="scalar"&&L(x,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+x.kind+'"');for(let _e=0,ze=x.implicitTypes.length;_e<ze;_e+=1)if(re=x.implicitTypes[_e],re.resolve(x.result)){x.result=re.construct(x.result),x.tag=re.tag,x.anchor!==null&&oe(x,x.anchor,x.result);break}}else if(x.tag!=="!"){if(s.call(x.typeMap[x.kind||"fallback"],x.tag))re=x.typeMap[x.kind||"fallback"][x.tag];else{re=null;const _e=x.typeMap.multi[x.kind||"fallback"];for(let ze=0,Qe=_e.length;ze<Qe;ze+=1)if(x.tag.slice(0,_e[ze].tag.length)===_e[ze].tag){re=_e[ze];break}}re||L(x,"unknown tag !<"+x.tag+">"),x.result!==null&&re.kind!==x.kind&&L(x,"unacceptable node kind for !<"+x.tag+'> tag; it should be "'+re.kind+'", not "'+x.kind+'"'),re.resolve(x.result,x.tag)?(x.result=re.construct(x.result,x.tag),x.anchor!==null&&oe(x,x.anchor,x.result)):L(x,"cannot resolve a node with !<"+x.tag+"> explicit tag")}return x.listener!==null&&x.listener("close",x),x.depth-=1,x.tag!==null||x.anchor!==null||F}function _n(x){const V=x.position;let me=!1,ae;for(x.version=null,x.checkLineBreaks=x.legacy,x.tagMap=Object.create(null),x.anchorMap=Object.create(null);(ae=x.input.charCodeAt(x.position))!==0&&(Ie(x,!0,-1),ae=x.input.charCodeAt(x.position),!(x.lineIndent>0||ae!==37));){me=!0,ae=x.input.charCodeAt(++x.position);let J=x.position;for(;ae!==0&&!M(ae);)ae=x.input.charCodeAt(++x.position);const k=x.input.slice(J,x.position),Y=[];for(k.length<1&&L(x,"directive name must not be less than one character in length");ae!==0;){for(;j(ae);)ae=x.input.charCodeAt(++x.position);if(ae===35){do ae=x.input.charCodeAt(++x.position);while(ae!==0&&!E(ae));break}if(E(ae))break;for(J=x.position;ae!==0&&!M(ae);)ae=x.input.charCodeAt(++x.position);Y.push(x.input.slice(J,x.position))}ae!==0&&Ye(x),s.call(ne,k)?ne[k](x,k,Y):Q(x,'unknown document directive "'+k+'"')}if(Ie(x,!0,-1),x.lineIndent===0&&x.input.charCodeAt(x.position)===45&&x.input.charCodeAt(x.position+1)===45&&x.input.charCodeAt(x.position+2)===45?(x.position+=3,Ie(x,!0,-1)):me&&L(x,"directives end mark is expected"),ht(x,x.lineIndent-1,f,!1,!0),Ie(x,!0,-1),x.checkLineBreaks&&w.test(x.input.slice(V,x.position))&&Q(x,"non-ASCII line breaks are interpreted as content"),x.documents.push(x.result),x.position===x.lineStart&&ut(x)){x.input.charCodeAt(x.position)===46&&(x.position+=3,Ie(x,!0,-1));return}x.position<x.length-1&&L(x,"end of the stream or a document separator is expected")}function Tn(x,V){x=String(x),V=V||{},x.length!==0&&(x.charCodeAt(x.length-1)!==10&&x.charCodeAt(x.length-1)!==13&&(x+=`
|
|
25
|
+
`),x.charCodeAt(0)===65279&&(x=x.slice(1)));const me=new pe(x,V),ae=x.indexOf("\0");for(ae!==-1&&(me.position=ae,L(me,"null byte is not allowed in input")),me.input+="\0";me.input.charCodeAt(me.position)===32;)me.lineIndent+=1,me.position+=1;for(;me.position<me.length-1;)_n(me);return me.documents}function ei(x,V,me){V!==null&&typeof V=="object"&&typeof me>"u"&&(me=V,V=null);const ae=Tn(x,me);if(typeof V!="function")return ae;for(let J=0,k=ae.length;J<k;J+=1)V(ae[J])}function kt(x,V){const me=Tn(x,V);if(me.length!==0){if(me.length===1)return me[0];throw new e("expected a single document in the stream, but found more")}}return Do.loadAll=ei,Do.load=kt,Do}var ef={},M0;function ak(){if(M0)return ef;M0=1;const t=oa(),e=ca(),n=Zd(),r=Object.prototype.toString,s=Object.prototype.hasOwnProperty,a=65279,c=9,u=10,f=13,h=32,g=33,b=34,v=35,w=37,A=38,C=39,O=42,D=44,E=45,j=58,M=61,_=62,q=63,R=64,X=91,U=93,B=96,K=123,W=124,ye=125,pe={};pe[0]="\\0",pe[7]="\\a",pe[8]="\\b",pe[9]="\\t",pe[10]="\\n",pe[11]="\\v",pe[12]="\\f",pe[13]="\\r",pe[27]="\\e",pe[34]='\\"',pe[92]="\\\\",pe[133]="\\N",pe[160]="\\_",pe[8232]="\\L",pe[8233]="\\P";const fe=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],L=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/;function Q(k,Y){if(Y===null)return{};const Z={},xe=Object.keys(Y);for(let F=0,ue=xe.length;F<ue;F+=1){let re=xe[F],Se=String(Y[re]);re.slice(0,2)==="!!"&&(re="tag:yaml.org,2002:"+re.slice(2));const Me=k.compiledTypeMap.fallback[re];Me&&s.call(Me.styleAliases,Se)&&(Se=Me.styleAliases[Se]),Z[re]=Se}return Z}function oe(k){let Y,Z;const xe=k.toString(16).toUpperCase();if(k<=255)Y="x",Z=2;else if(k<=65535)Y="u",Z=4;else if(k<=4294967295)Y="U",Z=8;else throw new e("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+Y+t.repeat("0",Z-xe.length)+xe}const ce=1,ve=2;function T(k){this.schema=k.schema||n,this.indent=Math.max(1,k.indent||2),this.noArrayIndent=k.noArrayIndent||!1,this.skipInvalid=k.skipInvalid||!1,this.flowLevel=t.isNothing(k.flowLevel)?-1:k.flowLevel,this.styleMap=Q(this.schema,k.styles||null),this.sortKeys=k.sortKeys||!1,this.lineWidth=k.lineWidth||80,this.noRefs=k.noRefs||!1,this.noCompatMode=k.noCompatMode||!1,this.condenseFlow=k.condenseFlow||!1,this.quotingType=k.quotingType==='"'?ve:ce,this.forceQuotes=k.forceQuotes||!1,this.replacer=typeof k.replacer=="function"?k.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function z(k,Y){const Z=t.repeat(" ",Y);let xe=0,F="";const ue=k.length;for(;xe<ue;){let re;const Se=k.indexOf(`
|
|
26
26
|
`,xe);Se===-1?(re=k.slice(xe),xe=ue):(re=k.slice(xe,Se+1),xe=Se+1),re.length&&re!==`
|
|
27
27
|
`&&(F+=Z),F+=re}return F}function he(k,Y){return`
|
|
28
|
-
`+t.repeat(" ",k.indent*Y)}function ne(k,Y){for(let Z=0,xe=k.implicitTypes.length;Z<xe;Z+=1)if(k.implicitTypes[Z].resolve(Y))return!0;return!1}function ke(k){return k===h||k===c}function qe(k){return k>=32&&k<=126||k>=161&&k<=55295&&k!==8232&&k!==8233||k>=57344&&k<=65533&&k!==a||k>=65536&&k<=1114111}function $e(k){return qe(k)&&k!==a&&k!==f&&k!==u}function Fe(k,Y,Z){const xe=$e(k),F=xe&&!ke(k);return(Z?xe:xe&&k!==D&&k!==X&&k!==U&&k!==K&&k!==ye)&&k!==v&&!(Y===
|
|
28
|
+
`+t.repeat(" ",k.indent*Y)}function ne(k,Y){for(let Z=0,xe=k.implicitTypes.length;Z<xe;Z+=1)if(k.implicitTypes[Z].resolve(Y))return!0;return!1}function ke(k){return k===h||k===c}function qe(k){return k>=32&&k<=126||k>=161&&k<=55295&&k!==8232&&k!==8233||k>=57344&&k<=65533&&k!==a||k>=65536&&k<=1114111}function $e(k){return qe(k)&&k!==a&&k!==f&&k!==u}function Fe(k,Y,Z){const xe=$e(k),F=xe&&!ke(k);return(Z?xe:xe&&k!==D&&k!==X&&k!==U&&k!==K&&k!==ye)&&k!==v&&!(Y===j&&!F)||$e(Y)&&!ke(Y)&&k===v||Y===j&&F}function Ye(k){return qe(k)&&k!==a&&!ke(k)&&k!==E&&k!==q&&k!==j&&k!==D&&k!==X&&k!==U&&k!==K&&k!==ye&&k!==v&&k!==A&&k!==O&&k!==g&&k!==W&&k!==M&&k!==_&&k!==C&&k!==b&&k!==w&&k!==R&&k!==B}function Ie(k){return!ke(k)&&k!==j}function ut(k,Y){const Z=k.charCodeAt(Y);let xe;return Z>=55296&&Z<=56319&&Y+1<k.length&&(xe=k.charCodeAt(Y+1),xe>=56320&&xe<=57343)?(Z-55296)*1024+xe-56320+65536:Z}function Rt(k){return/^\n* /.test(k)}const Ce=1,Oe=2,G=3,we=4,Ne=5;function De(k,Y,Z,xe,F,ue,re,Se){let Me,je=0,_e=null,ze=!1,Qe=!1;const pn=xe!==-1;let Un=-1,jn=Ye(ut(k,0))&&Ie(ut(k,k.length-1));if(Y||re)for(Me=0;Me<k.length;je>=65536?Me+=2:Me++){if(je=ut(k,Me),!qe(je))return Ne;jn=jn&&Fe(je,_e,Se),_e=je}else{for(Me=0;Me<k.length;je>=65536?Me+=2:Me++){if(je=ut(k,Me),je===u)ze=!0,pn&&(Qe=Qe||Me-Un-1>xe&&k[Un+1]!==" ",Un=Me);else if(!qe(je))return Ne;jn=jn&&Fe(je,_e,Se),_e=je}Qe=Qe||pn&&Me-Un-1>xe&&k[Un+1]!==" "}return!ze&&!Qe?jn&&!re&&!F(k)?Ce:ue===ve?Ne:Oe:Z>9&&Rt(k)?Ne:re?ue===ve?Ne:Oe:Qe?we:G}function Ke(k,Y,Z,xe,F){k.dump=(function(){if(Y.length===0)return k.quotingType===ve?'""':"''";if(!k.noCompatMode&&(fe.indexOf(Y)!==-1||L.test(Y)))return k.quotingType===ve?'"'+Y+'"':"'"+Y+"'";const ue=k.indent*Math.max(1,Z),re=k.lineWidth===-1?-1:Math.max(Math.min(k.lineWidth,40),k.lineWidth-ue),Se=xe||k.flowLevel>-1&&Z>=k.flowLevel;function Me(je){return ne(k,je)}switch(De(Y,Se,k.indent,re,Me,k.quotingType,k.forceQuotes&&!xe,F)){case Ce:return Y;case Oe:return"'"+Y.replace(/'/g,"''")+"'";case G:return"|"+st(Y,k.indent)+Et(z(Y,ue));case we:return">"+st(Y,k.indent)+Et(z(Zn(Y,re),ue));case Ne:return'"'+ht(Y)+'"';default:throw new e("impossible error: invalid scalar style")}})()}function st(k,Y){const Z=Rt(k)?String(Y):"",xe=k[k.length-1]===`
|
|
29
29
|
`,ue=xe&&(k[k.length-2]===`
|
|
30
30
|
`||k===`
|
|
31
31
|
`)?"+":xe?"":"-";return Z+ue+`
|
|
@@ -37,50 +37,50 @@ Error generating stack: `+d.message+`
|
|
|
37
37
|
`+k.slice(F,ue),F=ue+1),re=Se;return Me+=`
|
|
38
38
|
`,k.length-F>Y&&re>F?Me+=k.slice(F,re)+`
|
|
39
39
|
`+k.slice(re+1):Me+=k.slice(F),Me.slice(1)}function ht(k){let Y="",Z=0;for(let xe=0;xe<k.length;Z>=65536?xe+=2:xe++){Z=ut(k,xe);const F=pe[Z];!F&&qe(Z)?(Y+=k[xe],Z>=65536&&(Y+=k[xe+1])):Y+=F||oe(Z)}return Y}function _n(k,Y,Z){let xe="";const F=k.tag;for(let ue=0,re=Z.length;ue<re;ue+=1){let Se=Z[ue];k.replacer&&(Se=k.replacer.call(Z,String(ue),Se)),(V(k,Y,Se,!1,!1)||typeof Se>"u"&&V(k,Y,null,!1,!1))&&(xe!==""&&(xe+=","+(k.condenseFlow?"":" ")),xe+=k.dump)}k.tag=F,k.dump="["+xe+"]"}function Tn(k,Y,Z,xe){let F="";const ue=k.tag;for(let re=0,Se=Z.length;re<Se;re+=1){let Me=Z[re];k.replacer&&(Me=k.replacer.call(Z,String(re),Me)),(V(k,Y+1,Me,!0,!0,!1,!0)||typeof Me>"u"&&V(k,Y+1,null,!0,!0,!1,!0))&&((!xe||F!=="")&&(F+=he(k,Y)),k.dump&&u===k.dump.charCodeAt(0)?F+="-":F+="- ",F+=k.dump)}k.tag=ue,k.dump=F||"[]"}function ei(k,Y,Z){let xe="";const F=k.tag,ue=Object.keys(Z);for(let re=0,Se=ue.length;re<Se;re+=1){let Me="";xe!==""&&(Me+=", "),k.condenseFlow&&(Me+='"');const je=ue[re];let _e=Z[je];k.replacer&&(_e=k.replacer.call(Z,je,_e)),V(k,Y,je,!1,!1)&&(k.dump.length>1024&&(Me+="? "),Me+=k.dump+(k.condenseFlow?'"':"")+":"+(k.condenseFlow?"":" "),V(k,Y,_e,!1,!1)&&(Me+=k.dump,xe+=Me))}k.tag=F,k.dump="{"+xe+"}"}function kt(k,Y,Z,xe){let F="";const ue=k.tag,re=Object.keys(Z);if(k.sortKeys===!0)re.sort();else if(typeof k.sortKeys=="function")re.sort(k.sortKeys);else if(k.sortKeys)throw new e("sortKeys must be a boolean or a function");for(let Se=0,Me=re.length;Se<Me;Se+=1){let je="";(!xe||F!=="")&&(je+=he(k,Y));const _e=re[Se];let ze=Z[_e];if(k.replacer&&(ze=k.replacer.call(Z,_e,ze)),!V(k,Y+1,_e,!0,!0,!0))continue;const Qe=k.tag!==null&&k.tag!=="?"||k.dump&&k.dump.length>1024;Qe&&(k.dump&&u===k.dump.charCodeAt(0)?je+="?":je+="? "),je+=k.dump,Qe&&(je+=he(k,Y)),V(k,Y+1,ze,!0,Qe)&&(k.dump&&u===k.dump.charCodeAt(0)?je+=":":je+=": ",je+=k.dump,F+=je)}k.tag=ue,k.dump=F||"{}"}function x(k,Y,Z){const xe=Z?k.explicitTypes:k.implicitTypes;for(let F=0,ue=xe.length;F<ue;F+=1){const re=xe[F];if((re.instanceOf||re.predicate)&&(!re.instanceOf||typeof Y=="object"&&Y instanceof re.instanceOf)&&(!re.predicate||re.predicate(Y))){if(Z?re.multi&&re.representName?k.tag=re.representName(Y):k.tag=re.tag:k.tag="?",re.represent){const Se=k.styleMap[re.tag]||re.defaultStyle;let Me;if(r.call(re.represent)==="[object Function]")Me=re.represent(Y,Se);else if(s.call(re.represent,Se))Me=re.represent[Se](Y,Se);else throw new e("!<"+re.tag+'> tag resolver accepts not "'+Se+'" style');k.dump=Me}return!0}}return!1}function V(k,Y,Z,xe,F,ue,re){k.tag=null,k.dump=Z,x(k,Z,!1)||x(k,Z,!0);const Se=r.call(k.dump),Me=xe;xe&&(xe=k.flowLevel<0||k.flowLevel>Y);const je=Se==="[object Object]"||Se==="[object Array]";let _e,ze;if(je&&(_e=k.duplicates.indexOf(Z),ze=_e!==-1),(k.tag!==null&&k.tag!=="?"||ze||k.indent!==2&&Y>0)&&(F=!1),ze&&k.usedDuplicates[_e])k.dump="*ref_"+_e;else{if(je&&ze&&!k.usedDuplicates[_e]&&(k.usedDuplicates[_e]=!0),Se==="[object Object]")xe&&Object.keys(k.dump).length!==0?(kt(k,Y,k.dump,F),ze&&(k.dump="&ref_"+_e+k.dump)):(ei(k,Y,k.dump),ze&&(k.dump="&ref_"+_e+" "+k.dump));else if(Se==="[object Array]")xe&&k.dump.length!==0?(k.noArrayIndent&&!re&&Y>0?Tn(k,Y-1,k.dump,F):Tn(k,Y,k.dump,F),ze&&(k.dump="&ref_"+_e+k.dump)):(_n(k,Y,k.dump),ze&&(k.dump="&ref_"+_e+" "+k.dump));else if(Se==="[object String]")k.tag!=="?"&&Ke(k,k.dump,Y,ue,Me);else{if(Se==="[object Undefined]")return!1;if(k.skipInvalid)return!1;throw new e("unacceptable kind of an object to dump "+Se)}if(k.tag!==null&&k.tag!=="?"){let Qe=encodeURI(k.tag[0]==="!"?k.tag.slice(1):k.tag).replace(/!/g,"%21");k.tag[0]==="!"?Qe="!"+Qe:Qe.slice(0,18)==="tag:yaml.org,2002:"?Qe="!!"+Qe.slice(18):Qe="!<"+Qe+">",k.dump=Qe+" "+k.dump}}return!0}function me(k,Y){const Z=[],xe=[];ae(k,Z,xe);const F=xe.length;for(let ue=0;ue<F;ue+=1)Y.duplicates.push(Z[xe[ue]]);Y.usedDuplicates=new Array(F)}function ae(k,Y,Z){if(k!==null&&typeof k=="object"){const xe=Y.indexOf(k);if(xe!==-1)Z.indexOf(xe)===-1&&Z.push(xe);else if(Y.push(k),Array.isArray(k))for(let F=0,ue=k.length;F<ue;F+=1)ae(k[F],Y,Z);else{const F=Object.keys(k);for(let ue=0,re=F.length;ue<re;ue+=1)ae(k[F[ue]],Y,Z)}}}function J(k,Y){Y=Y||{};const Z=new T(Y);Z.noRefs||me(k,Z);let xe=k;return Z.replacer&&(xe=Z.replacer.call({"":xe},"",xe)),V(Z,0,xe,!0,!0)?Z.dump+`
|
|
40
|
-
`:""}return Zd.dump=J,Zd}var O0;function lk(){if(O0)return vn;O0=1;const t=rk(),e=sk();function n(r,s){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return vn.Type=En(),vn.Schema=Gg(),vn.FAILSAFE_SCHEMA=n0(),vn.JSON_SCHEMA=f0(),vn.CORE_SCHEMA=p0(),vn.DEFAULT_SCHEMA=Wd(),vn.load=t.load,vn.loadAll=t.loadAll,vn.dump=e.dump,vn.YAMLException=ca(),vn.types={binary:v0(),float:u0(),map:e0(),null:r0(),pairs:k0(),set:N0(),timestamp:g0(),bool:l0(),int:o0(),merge:b0(),omap:S0(),seq:Wg(),str:Jg()},vn.safeLoad=n("safeLoad","load"),vn.safeLoadAll=n("safeLoadAll","loadAll"),vn.safeDump=n("safeDump","dump"),vn}var ak=lk();const ok=nk(ak),{Type:LD,Schema:qD,FAILSAFE_SCHEMA:BD,JSON_SCHEMA:$D,CORE_SCHEMA:ID,DEFAULT_SCHEMA:HD,load:ck,loadAll:zD,dump:uk,YAMLException:UD,types:VD,safeLoad:FD,safeLoadAll:PD,safeDump:YD}=ok;let Hi=class kA{static async parseSpec(e){let n;if(typeof e=="string"){const r=e.trim();try{n=JSON.parse(r)}catch{try{n=ck(r)}catch{throw new Error("Invalid OpenAPI specification format")}}}else n=e;if(!n.openapi||!n.info||!n.paths)throw new Error("Invalid OpenAPI specification: missing required fields");return n}static getHttpMethods(e){return["get","post","put","delete","patch","options","head","trace"].filter(r=>e[r])}static decodePointerToken(e){return decodeURIComponent(e).replace(/~1/g,"/").replace(/~0/g,"~")}static encodePointerToken(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}static resolveReference(e,n){if(!n.startsWith("#/"))throw new Error(`Only local references are supported synchronously; bundle external references first: ${n}`);const r=n.substring(2).split("/").map(kA.decodePointerToken);let s=e;for(const a of r){if(s===null||typeof s!="object"||!(a in s))throw new Error(`Reference not found: ${n}`);s=s[a]}return s}static isReference(e){return!!e&&typeof e=="object"&&"$ref"in e&&typeof e.$ref=="string"}};class $n{static async parseSpec(e){return Hi.parseSpec(e)}static getHttpMethods(e){return Hi.getHttpMethods(e)}static getMethodColor(e,n){const a=n==="dark"?{get:"text-blue-300 bg-blue-900/30 border-blue-700",post:"text-green-300 bg-green-900/30 border-green-700",put:"text-orange-300 bg-orange-900/30 border-orange-700",delete:"text-red-300 bg-red-900/30 border-red-700",patch:"text-purple-300 bg-purple-900/30 border-purple-700",options:"text-cyan-100 bg-cyan-800/50 border-cyan-500",head:"text-gray-300 bg-gray-700/50 border-gray-600",trace:"text-gray-300 bg-gray-700/50 border-gray-600"}:{get:"text-blue-600 bg-blue-50 border-blue-200",post:"text-green-600 bg-green-50 border-green-200",put:"text-orange-600 bg-orange-50 border-orange-200",delete:"text-red-600 bg-red-50 border-red-200",patch:"text-purple-600 bg-purple-50 border-purple-200",options:"text-gray-600 bg-gray-50 border-gray-200",head:"text-gray-600 bg-gray-50 border-gray-200",trace:"text-gray-600 bg-gray-50 border-gray-200"},c=n==="dark"?"text-gray-300 bg-gray-700/50 border-gray-600":"text-gray-600 bg-gray-50 border-gray-200";return a[e.toLowerCase()]||c}static decodePointerToken(e){return Hi.decodePointerToken(e)}static encodePointerToken(e){return Hi.encodePointerToken(e)}static resolveReference(e,n){return Hi.resolveReference(e,n)}static isReference(e){return Hi.isReference(e)}}const dk=({spec:t,onEndpointSelect:e,selectedEndpoint:n=null,theme:r="light",expandedTags:s,onExpandedTagsChange:a,messages:c})=>{const[u,f]=I.useState(""),[h,g]=I.useState(new Set(s?.length?s:["default"])),b=I.useId(),v=I.useRef(null),w=s?new Set(s):h;I.useEffect(()=>{n&&requestAnimationFrame(()=>{v.current?.querySelector('[data-selected-endpoint="true"]')?.scrollIntoView({block:"nearest"})})},[n]);const A=r==="dark"?"bg-gray-900 border-r border-gray-800 text-white":"bg-white border-r border-gray-200 text-gray-700",C=r==="dark"?"bg-gray-800 border-gray-700 text-white placeholder-gray-400 focus:ring-blue-500 focus:border-blue-500 focus:ring-1":"border-gray-300 text-gray-700 placeholder-gray-400 focus:ring-blue-500 focus:border-blue-500 focus:ring-1",j=r==="dark"?"text-gray-300":"text-gray-500",D=r==="dark"?"bg-gray-800/50 border-gray-700 text-white":"bg-gray-50 border-gray-100 text-gray-700",M=X=>{const U="text-xs font-bold px-2 py-0.5 rounded border",B={dark:{get:"bg-blue-900/30 border-blue-700 text-blue-200",post:"bg-green-900/30 border-green-700 text-green-200",put:"bg-yellow-900/30 border-yellow-700 text-yellow-200",patch:"bg-purple-900/30 border-purple-700 text-purple-200",delete:"bg-red-900/30 border-red-700 text-red-200",default:"bg-gray-800/50 border-gray-700 text-gray-200"},light:{get:"bg-blue-50 border-blue-200 text-blue-700",post:"bg-green-50 border-green-200 text-green-700",put:"bg-yellow-50 border-yellow-200 text-yellow-700",patch:"bg-purple-50 border-purple-200 text-purple-700",delete:"bg-red-50 border-red-200 text-red-700",default:"bg-gray-100 border-gray-200 text-gray-600"}},K=r==="dark"?B.dark:B.light;return`${U} ${K[X.toLowerCase()]||K.default}`},E=Object.entries(t.paths).reduce((X,[U,B])=>($n.getHttpMethods(B).forEach(K=>{const W=B[K];(W?.tags||["default"]).forEach(pe=>{X[pe]||(X[pe]=[]),X[pe].push({path:U,method:K,operation:W})})}),X),{}),R=u.trim().toLowerCase(),_=R.length>0,q=Object.entries(E).reduce((X,[U,B])=>{const K=B.filter(W=>`${W.method} ${W.path} ${W.operation?.summary||""} ${U}`.toLowerCase().includes(R));return K.length&&(X[U]=K),X},{}),O=X=>{const U=new Set(w);U.has(X)?U.delete(X):U.add(X),s||g(U),a?.([...U])};return p.jsxs("div",{ref:v,className:`flex h-full w-full min-w-0 flex-col ${A}`,style:{backgroundColor:"var(--flexdoc-sidebar-bg)",color:"var(--flexdoc-sidebar-text)"},children:[p.jsxs("div",{className:`border-b p-4 ${r==="dark"?"border-gray-800":"border-gray-100"}`,children:[p.jsx("label",{className:"sr-only",htmlFor:b,children:c?.searchEndpoints||"Search endpoints"}),p.jsxs("div",{className:"relative",children:[p.jsx($g,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),p.jsx("input",{id:b,type:"search",placeholder:c?.searchEndpointsPlaceholder||"Search endpoints...",value:u,onChange:X=>f(X.target.value),className:`w-full rounded-lg border py-2 pl-10 pr-4 text-sm transition-colors ${C}`})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:p.jsxs("div",{className:"p-4",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h3",{className:`mb-2 text-xs font-semibold uppercase tracking-wider ${j}`,children:c?.apiInformation||"API Information"}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:`rounded-lg border p-3 ${D}`,children:[p.jsx("h4",{className:`truncate font-medium ${r==="dark"?"text-white":"text-gray-900"}`,children:t.info.title}),p.jsxs("p",{className:`text-sm ${r==="dark"?"text-gray-300":"text-gray-600"}`,children:[c?.versionLabel||"Version"," ",t.info.version]})]}),t.servers&&t.servers.length>0&&p.jsxs("div",{className:`rounded-lg border p-3 ${D}`,children:[p.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[p.jsx(Ig,{className:"h-4 w-4 text-gray-400"}),p.jsx("span",{className:"text-sm font-medium",children:c?.servers||"Servers"})]}),p.jsx("div",{className:"space-y-2",children:t.servers.map((X,U)=>p.jsxs("div",{className:"min-w-0 text-sm",children:[p.jsx("code",{className:`block max-w-full overflow-x-auto rounded px-1.5 py-0.5 text-xs ${r==="dark"?"bg-gray-700/50 text-blue-200":"bg-gray-100 text-blue-600"}`,children:X.url}),X.description&&p.jsx("p",{className:`mt-1.5 ${r==="dark"?"text-gray-300":"text-gray-600"}`,children:X.description})]},`${X.url}:${U}`))})]})]})]}),p.jsxs("div",{children:[p.jsx("h3",{className:`mb-3 text-xs font-semibold uppercase tracking-wider ${j}`,children:c?.endpoints||"Endpoints"}),Object.keys(q).length===0&&p.jsx("p",{className:`px-2 py-4 text-sm ${j}`,children:c?.noEndpointsMatch||"No endpoints match your search."}),Object.entries(q).map(([X,U])=>{const B=_||w.has(X);return p.jsxs("div",{className:"mb-4",children:[p.jsxs("button",{type:"button","aria-expanded":B,onClick:()=>O(X),className:`flex min-h-11 w-full items-center gap-2 rounded-lg p-2 text-left transition-colors ${r==="dark"?"hover:bg-gray-800/50 text-white":"hover:bg-gray-50 text-gray-700"}`,children:[B?p.jsx(Lg,{className:"h-4 w-4 shrink-0 text-gray-400"}):p.jsx(qg,{className:"h-4 w-4 shrink-0 text-gray-400"}),p.jsx(zg,{className:"h-4 w-4 shrink-0 text-gray-400"}),p.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:X==="default"?c?.generalTag||"General":X}),p.jsx("span",{className:`ml-auto shrink-0 rounded-full px-2 py-0.5 text-xs ${r==="dark"?"bg-gray-800 text-white":"bg-gray-100 text-gray-500"}`,children:U.length})]}),B&&p.jsx("div",{className:"ml-4 mt-1.5 space-y-1.5 sm:ml-6",children:U.map(({path:K,method:W,operation:ye})=>{const pe=n?.path===K&&n?.method===W;return p.jsxs("button",{type:"button","data-selected-endpoint":pe?"true":void 0,onClick:()=>e(K,W),className:`mb-2 min-h-11 w-full rounded-lg border p-2 text-left transition-all ${pe?r==="dark"?"bg-blue-900/20 border-blue-800/50 shadow-sm":"bg-blue-50 border-blue-100 shadow-sm":r==="dark"?"hover:bg-gray-800/50 border-transparent hover:border-gray-700":"hover:bg-gray-50 border-transparent hover:border-gray-100"}`,style:pe?{color:"var(--flexdoc-sidebar-active-text)"}:void 0,children:[p.jsx("div",{className:"mb-1 flex items-center gap-2",children:p.jsx("span",{className:M(W),children:W.toUpperCase()})}),p.jsx("div",{className:`break-all font-mono text-sm ${pe?r==="dark"?"text-blue-300":"text-blue-600":r==="dark"?"text-gray-300":"text-gray-800"}`,children:K}),ye?.summary&&p.jsx("div",{className:`mt-1 text-xs ${r==="dark"?"text-gray-400":"text-gray-600"}`,children:ye.summary})]},`${W}-${K}`)})})]},X)})]})]})})]})},Ns=["parameters","requestBody","responses","tryIt","codeSamples"],ef={all:Ns,none:[],minimal:[],documentation:["parameters","requestBody","responses"],interactive:["parameters","requestBody","tryIt","codeSamples"]},fk=["minimal","documentation","interactive"],hk=Object.keys(ef),pk=["light","dark","high-contrast"];function mk(t){return typeof t=="string"?hk.includes(t):Array.isArray(t)&&t.every(e=>typeof e=="string"&&(Ns.includes(e)||fk.includes(e)))}function tf(t,e){return t===void 0&&e!==void 0?Ns.filter(n=>e!=="none"||n!=="responses"):t===void 0?[]:typeof t=="string"?[...ef[t]]:Ns.filter(n=>t.some(r=>r===n||ef[r]?.includes(n)))}function gk(t,e){return`flexdoc:viewer:${encodeURIComponent(e?.trim()||"unknown-host")}:${encodeURIComponent(t?.trim()||"untitled")}`}function ua(t,e){const n=e??(typeof window<"u"?window.localStorage:void 0);if(!n)return{version:1};try{const r=n.getItem(t);if(!r)return{version:1};const s=JSON.parse(r);return s.version!==1?{version:1}:s.expand!==void 0&&!mk(s.expand)?{version:1}:s.sidebarCollapsed!==void 0&&typeof s.sidebarCollapsed!="boolean"?{version:1}:s.theme!==void 0&&(typeof s.theme!="string"||!pk.includes(s.theme))?{version:1}:s.expandedTags!==void 0&&(!Array.isArray(s.expandedTags)||!s.expandedTags.every(a=>typeof a=="string"))?{version:1}:{version:1,...s.expand!==void 0?{expand:s.expand}:{},...s.sidebarCollapsed!==void 0?{sidebarCollapsed:s.sidebarCollapsed}:{},...s.theme!==void 0?{theme:s.theme}:{},...s.expandedTags!==void 0?{expandedTags:[...new Set(s.expandedTags)]}:{}}}catch{return{version:1}}}function _o(t,e,n,r){const s=typeof window<"u"?window.localStorage:void 0;if(s)try{const a={...ua(t,s)},c=e==="expandedTags"&&Array.isArray(n)?[...new Set(n)]:n;c===void 0?delete a[e]:a[e]=c,a.expand===void 0&&a.sidebarCollapsed===void 0&&a.theme===void 0&&a.expandedTags===void 0?s.removeItem(t):s.setItem(t,JSON.stringify(a))}catch{}}function Dr(t,e){if(e)return Hi.isReference(e)?Hi.resolveReference(t,e.$ref):e}function yk(t,e){const n=t.paths[e];if(!n)throw new Error(`Path not found: ${e}`);return Dr(t,n)}function bk(t,e={}){return t.url.replace(/\{([^}]+)\}/g,(n,r)=>{const s=t.variables?.[r],a=e[r]??s?.default;if(a===void 0)throw new Error(`Missing server variable: ${r}`);if(s?.enum?.length&&!s.enum.includes(a))throw new Error(`Invalid value for server variable ${r}: ${a}`);return a})}function nf(t,e,n){const r=yk(t,e),s=r[n.toLowerCase()];if(!s||typeof s!="object"||!("responses"in s))throw new Error(`Operation not found: ${n.toUpperCase()} ${e}`);const a=[...r.parameters||[],...s.parameters||[]].map(f=>Dr(t,f)).filter(f=>!!f),c=new Map;for(const f of a)c.set(`${f.in}:${f.name}`,f);const u={};for(const[f,h]of Object.entries(s.responses||{})){const g=Dr(t,h);g&&(u[f]=g)}return{path:e,method:n.toUpperCase(),pathItem:r,operation:s,parameters:[...c.values()],requestBody:Dr(t,s.requestBody),responses:u,servers:s.servers||r.servers||t.servers||[],security:s.security!==void 0?s.security:t.security||[]}}function xk(t,e,n){return nf(t,e,n).parameters}function vk(t,e){return Dr(t,e.schema)}function wk(t,e){if(e.example!==void 0)return e.example;const n=vk(t,e);return n?.example!==void 0?n.example:n?.examples?.length?n.examples[0]:n?.default!==void 0?n.default:n?.enum?.length?n.enum[0]:n?.type==="array"?[]:n?.type==="object"?{}:n?.type==="integer"||n?.type==="number"?1:n?.type==="boolean"?!0:""}function Sk(t,e,n){const r=nf(t,e,n),s={parameters:{},headers:{},cookies:{},auth:{}};for(const u of r.parameters){const f=u.in==="header"?s.headers:u.in==="cookie"?s.cookies:s.parameters;f[u.name]=wk(t,u)}const a=r.requestBody,c=a?Object.keys(a.content||{})[0]:void 0;if(c){s.contentType=c;const u=a.content[c],f=Dr(t,u.schema),h=u.examples?Object.values(u.examples)[0]:void 0,g=Dr(t,h),b=u.example??g?.value??f?.example??f?.examples?.[0]??f?.default;s.body=b!==void 0?JSON.stringify(b,null,2):""}return s}function an(t){return t===null?"null":typeof t=="object"?JSON.stringify(t):String(t)}function rf(t){if(typeof t!="string")return t;const e=t.trim();if(!e||!e.startsWith("[")&&!e.startsWith("{"))return t;try{return JSON.parse(e)}catch{return t}}function M0(t,e=!1){const n=an(t);return e?encodeURI(n).replace(/%5B/g,"[").replace(/%5D/g,"]"):encodeURIComponent(n)}function R0(t,e=!1){const n=rf(t);if(Array.isArray(n))return n.map(an).join(",");if(n&&typeof n=="object"){const r=Object.entries(n);return e?r.map(([s,a])=>`${s}=${an(a)}`).join(","):r.flatMap(([s,a])=>[s,an(a)]).join(",")}return an(n)}function Ak(t,e){const n=t.style||"simple",r=t.explode??!1,s=rf(e),a=u=>M0(u,t.allowReserved);if(Array.isArray(s)){const u=s.map(a);return n==="label"?`.${u.join(r?".":",")}`:n==="matrix"?r?u.map(f=>`;${t.name}=${f}`).join(""):`;${t.name}=${u.join(",")}`:u.join(",")}if(s&&typeof s=="object"){const u=Object.entries(s).map(([f,h])=>[a(f),a(h)]);return n==="label"?r?`.${u.map(([f,h])=>`${f}=${h}`).join(".")}`:`.${u.flatMap(([f,h])=>[f,h]).join(",")}`:n==="matrix"?r?u.map(([f,h])=>`;${f}=${h}`).join(""):`;${t.name}=${u.flatMap(([f,h])=>[f,h]).join(",")}`:r?u.map(([f,h])=>`${f}=${h}`).join(","):u.flatMap(([f,h])=>[f,h]).join(",")}const c=a(s);return n==="label"?`.${c}`:n==="matrix"?`;${t.name}=${c}`:c}function kk(t,e){const n=t.style||"form",r=t.explode??n==="form",s=rf(e);if(n==="deepObject"&&s&&typeof s=="object"&&!Array.isArray(s))return Object.entries(s).map(([a,c])=>[`${t.name}[${a}]`,an(c)]);if(Array.isArray(s))return n==="spaceDelimited"?[[t.name,s.map(an).join(" ")]]:n==="pipeDelimited"?[[t.name,s.map(an).join("|")]]:r?s.map(a=>[t.name,an(a)]):[[t.name,s.map(an).join(",")]];if(s&&typeof s=="object"){const a=Object.entries(s);return r?a.map(([c,u])=>[c,an(u)]):[[t.name,a.flatMap(([c,u])=>[c,an(u)]).join(",")]]}return[[t.name,an(s)]]}function Ck(t){return typeof globalThis.btoa=="function"?globalThis.btoa(unescape(encodeURIComponent(t))):t}function Nk(t,e){return Object.keys(t).every(n=>!!e[n])}function Tk(t,e,n,r,s,a){if(!e.length||!t.components?.securitySchemes)return;const c=e.find(u=>Object.keys(u).length===0||Nk(u,a))||e[0];for(const u of Object.keys(c)){const f=Dr(t,t.components.securitySchemes[u]),h=a[u];!f||!h||(f.type==="http"&&f.scheme?.toLowerCase()==="bearer"?n.Authorization=`Bearer ${h}`:f.type==="http"&&f.scheme?.toLowerCase()==="basic"?n.Authorization=`Basic ${Ck(h)}`:f.type==="apiKey"&&f.in==="header"&&f.name?n[f.name]=h:f.type==="apiKey"&&f.in==="query"&&f.name?r.push(`${encodeURIComponent(f.name)}=${encodeURIComponent(h)}`):f.type==="apiKey"&&f.in==="cookie"&&f.name?s.push(`${f.name}=${encodeURIComponent(h)}`):(f.type==="oauth2"||f.type==="openIdConnect")&&(n.Authorization=`Bearer ${h}`))}}function D0(t){try{const e=JSON.parse(t);return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}catch{return}}function jk(t,e,n,r={}){const s=nf(t,e,n),a=s.servers[0],c=r.serverUrl||(a?bk(a,r.serverVariables):"");let u=e;const f=[],h={...r.headers||{}},g=[];for(const j of s.parameters){const D=j.in==="header"?r.headers?.[j.name]:j.in==="cookie"?r.cookies?.[j.name]:r.parameters?.[j.name];if(!(D===void 0||D===""))if(j.in==="path")u=u.replace(`{${j.name}}`,Ak(j,D));else if(j.in==="query")for(const[M,E]of kk(j,D))f.push(`${encodeURIComponent(M)}=${M0(E,j.allowReserved)}`);else j.in==="header"?h[j.name]=R0(D,j.explode):j.in==="cookie"&&g.push(`${j.name}=${encodeURIComponent(R0(D,j.explode))}`)}Tk(t,s.security,h,f,g,r.auth||{}),g.length&&(h.Cookie=g.join("; "));let b,v,w;if(r.body){const j=r.contentType||"application/json";if(b=r.body,j==="application/x-www-form-urlencoded"){const D=D0(r.body);b=D?Object.entries(D).flatMap(([M,E])=>Array.isArray(E)?E.map(R=>`${encodeURIComponent(M)}=${encodeURIComponent(an(R))}`):[`${encodeURIComponent(M)}=${encodeURIComponent(an(E))}`]).join("&"):r.body,w=b,v="form",h["Content-Type"]=j}else if(j.startsWith("multipart/form-data")){const D=D0(r.body);if(D&&typeof FormData<"u"){const M=new FormData;for(const[E,R]of Object.entries(D))Array.isArray(R)?R.forEach(_=>M.append(E,an(_))):M.append(E,an(R));w=M}else w=r.body;v="multipart"}else w=r.body,v=j.includes("json")?"json":"text",h["Content-Type"]=j}const A=f.join("&");return{url:`${c.replace(/\/$/,"")}${u}${A?`?${A}`:""}`,method:s.method,headers:h,body:b,bodyKind:v,init:{method:s.method,headers:h,body:w}}}function Ek(t,e,n){return xk(t,e,n)}function _0(t,e,n){return Sk(t,e,n)}function L0(t,e,n,r={}){return jk(t,e,n,r)}const on=t=>JSON.stringify(t);function Ok(t,e){const n=Object.entries(t.headers);if(e==="curl"){const a=[`curl -X ${t.method} ${on(t.url)}`];for(const[c,u]of n)a.push(` -H ${on(`${c}: ${u}`)}`);return t.body&&a.push(` --data-raw ${on(t.body)}`),a.join(` \\
|
|
40
|
+
`:""}return ef.dump=J,ef}var R0;function ok(){if(R0)return vn;R0=1;const t=lk(),e=ak();function n(r,s){return function(){throw new Error("Function yaml."+r+" is removed in js-yaml 4. Use yaml."+s+" instead, which is now safe by default.")}}return vn.Type=En(),vn.Schema=Jg(),vn.FAILSAFE_SCHEMA=r0(),vn.JSON_SCHEMA=p0(),vn.CORE_SCHEMA=g0(),vn.DEFAULT_SCHEMA=Zd(),vn.load=t.load,vn.loadAll=t.loadAll,vn.dump=e.dump,vn.YAMLException=ca(),vn.types={binary:S0(),float:f0(),map:n0(),null:l0(),pairs:N0(),set:j0(),timestamp:b0(),bool:o0(),int:u0(),merge:v0(),omap:k0(),seq:e0(),str:Wg()},vn.safeLoad=n("safeLoad","load"),vn.safeLoadAll=n("safeLoadAll","loadAll"),vn.safeDump=n("safeDump","dump"),vn}var ck=ok();const uk=rk(ck),{Type:PD,Schema:YD,FAILSAFE_SCHEMA:KD,JSON_SCHEMA:GD,CORE_SCHEMA:XD,DEFAULT_SCHEMA:JD,load:dk,loadAll:QD,dump:fk,YAMLException:WD,types:ZD,safeLoad:e5,safeLoadAll:t5,safeDump:n5}=uk;let Hi=class NA{static async parseSpec(e){let n;if(typeof e=="string"){const r=e.trim();try{n=JSON.parse(r)}catch{try{n=dk(r)}catch{throw new Error("Invalid OpenAPI specification format")}}}else n=e;if(!n.openapi||!n.info||!n.paths)throw new Error("Invalid OpenAPI specification: missing required fields");return n}static getHttpMethods(e){return["get","post","put","delete","patch","options","head","trace"].filter(r=>e[r])}static decodePointerToken(e){return decodeURIComponent(e).replace(/~1/g,"/").replace(/~0/g,"~")}static encodePointerToken(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}static resolveReference(e,n){if(!n.startsWith("#/"))throw new Error(`Only local references are supported synchronously; bundle external references first: ${n}`);const r=n.substring(2).split("/").map(NA.decodePointerToken);let s=e;for(const a of r){if(s===null||typeof s!="object"||!(a in s))throw new Error(`Reference not found: ${n}`);s=s[a]}return s}static isReference(e){return!!e&&typeof e=="object"&&"$ref"in e&&typeof e.$ref=="string"}};class $n{static async parseSpec(e){return Hi.parseSpec(e)}static getHttpMethods(e){return Hi.getHttpMethods(e)}static getMethodColor(e,n){const a=n==="dark"?{get:"text-blue-300 bg-blue-900/30 border-blue-700",post:"text-green-300 bg-green-900/30 border-green-700",put:"text-orange-300 bg-orange-900/30 border-orange-700",delete:"text-red-300 bg-red-900/30 border-red-700",patch:"text-purple-300 bg-purple-900/30 border-purple-700",options:"text-cyan-100 bg-cyan-800/50 border-cyan-500",head:"text-gray-300 bg-gray-700/50 border-gray-600",trace:"text-gray-300 bg-gray-700/50 border-gray-600"}:{get:"text-blue-600 bg-blue-50 border-blue-200",post:"text-green-600 bg-green-50 border-green-200",put:"text-orange-600 bg-orange-50 border-orange-200",delete:"text-red-600 bg-red-50 border-red-200",patch:"text-purple-600 bg-purple-50 border-purple-200",options:"text-gray-600 bg-gray-50 border-gray-200",head:"text-gray-600 bg-gray-50 border-gray-200",trace:"text-gray-600 bg-gray-50 border-gray-200"},c=n==="dark"?"text-gray-300 bg-gray-700/50 border-gray-600":"text-gray-600 bg-gray-50 border-gray-200";return a[e.toLowerCase()]||c}static decodePointerToken(e){return Hi.decodePointerToken(e)}static encodePointerToken(e){return Hi.encodePointerToken(e)}static resolveReference(e,n){return Hi.resolveReference(e,n)}static isReference(e){return Hi.isReference(e)}}const hk=({spec:t,onEndpointSelect:e,selectedEndpoint:n=null,theme:r="light",expandedTags:s,onExpandedTagsChange:a,messages:c})=>{const[u,f]=I.useState(""),[h,g]=I.useState(new Set(s?.length?s:["default"])),b=I.useId(),v=I.useRef(null),w=s?new Set(s):h;I.useEffect(()=>{n&&requestAnimationFrame(()=>{v.current?.querySelector('[data-selected-endpoint="true"]')?.scrollIntoView({block:"nearest"})})},[n]);const A=r==="dark"?"bg-gray-900 border-r border-gray-800 text-white":"bg-white border-r border-gray-200 text-gray-700",C=r==="dark"?"bg-gray-800 border-gray-700 text-white placeholder-gray-400 focus:ring-blue-500 focus:border-blue-500 focus:ring-1":"border-gray-300 text-gray-700 placeholder-gray-400 focus:ring-blue-500 focus:border-blue-500 focus:ring-1",O=r==="dark"?"text-gray-300":"text-gray-500",D=r==="dark"?"bg-gray-800/50 border-gray-700 text-white":"bg-gray-50 border-gray-100 text-gray-700",E=X=>{const U="text-xs font-bold px-2 py-0.5 rounded border",B={dark:{get:"bg-blue-900/30 border-blue-700 text-blue-200",post:"bg-green-900/30 border-green-700 text-green-200",put:"bg-yellow-900/30 border-yellow-700 text-yellow-200",patch:"bg-purple-900/30 border-purple-700 text-purple-200",delete:"bg-red-900/30 border-red-700 text-red-200",default:"bg-gray-800/50 border-gray-700 text-gray-200"},light:{get:"bg-blue-50 border-blue-200 text-blue-700",post:"bg-green-50 border-green-200 text-green-700",put:"bg-yellow-50 border-yellow-200 text-yellow-700",patch:"bg-purple-50 border-purple-200 text-purple-700",delete:"bg-red-50 border-red-200 text-red-700",default:"bg-gray-100 border-gray-200 text-gray-600"}},K=r==="dark"?B.dark:B.light;return`${U} ${K[X.toLowerCase()]||K.default}`},j=Object.entries(t.paths).reduce((X,[U,B])=>($n.getHttpMethods(B).forEach(K=>{const W=B[K];(W?.tags||["default"]).forEach(pe=>{X[pe]||(X[pe]=[]),X[pe].push({path:U,method:K,operation:W})})}),X),{}),M=u.trim().toLowerCase(),_=M.length>0,q=Object.entries(j).reduce((X,[U,B])=>{const K=B.filter(W=>`${W.method} ${W.path} ${W.operation?.summary||""} ${U}`.toLowerCase().includes(M));return K.length&&(X[U]=K),X},{}),R=X=>{const U=new Set(w);U.has(X)?U.delete(X):U.add(X),s||g(U),a?.([...U])};return p.jsxs("div",{ref:v,className:`flex h-full w-full min-w-0 flex-col ${A}`,style:{backgroundColor:"var(--flexdoc-sidebar-bg)",color:"var(--flexdoc-sidebar-text)"},children:[p.jsxs("div",{className:`border-b p-4 ${r==="dark"?"border-gray-800":"border-gray-100"}`,children:[p.jsx("label",{className:"sr-only",htmlFor:b,children:c?.searchEndpoints||"Search endpoints"}),p.jsxs("div",{className:"relative",children:[p.jsx(Hg,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),p.jsx("input",{id:b,type:"search",placeholder:c?.searchEndpointsPlaceholder||"Search endpoints...",value:u,onChange:X=>f(X.target.value),className:`w-full rounded-lg border py-2 pl-10 pr-4 text-sm transition-colors ${C}`})]})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain",children:p.jsxs("div",{className:"p-4",children:[p.jsxs("div",{className:"mb-6",children:[p.jsx("h3",{className:`mb-2 text-xs font-semibold uppercase tracking-wider ${O}`,children:c?.apiInformation||"API Information"}),p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:`rounded-lg border p-3 ${D}`,children:[p.jsx("h4",{className:`truncate font-medium ${r==="dark"?"text-white":"text-gray-900"}`,children:t.info.title}),p.jsxs("p",{className:`text-sm ${r==="dark"?"text-gray-300":"text-gray-600"}`,children:[c?.versionLabel||"Version"," ",t.info.version]})]}),t.servers&&t.servers.length>0&&p.jsxs("div",{className:`rounded-lg border p-3 ${D}`,children:[p.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[p.jsx(zg,{className:"h-4 w-4 text-gray-400"}),p.jsx("span",{className:"text-sm font-medium",children:c?.servers||"Servers"})]}),p.jsx("div",{className:"space-y-2",children:t.servers.map((X,U)=>p.jsxs("div",{className:"min-w-0 text-sm",children:[p.jsx("code",{className:`block max-w-full overflow-x-auto rounded px-1.5 py-0.5 text-xs ${r==="dark"?"bg-gray-700/50 text-blue-200":"bg-gray-100 text-blue-600"}`,children:X.url}),X.description&&p.jsx("p",{className:`mt-1.5 ${r==="dark"?"text-gray-300":"text-gray-600"}`,children:X.description})]},`${X.url}:${U}`))})]})]})]}),p.jsxs("div",{children:[p.jsx("h3",{className:`mb-3 text-xs font-semibold uppercase tracking-wider ${O}`,children:c?.endpoints||"Endpoints"}),Object.keys(q).length===0&&p.jsx("p",{className:`px-2 py-4 text-sm ${O}`,children:c?.noEndpointsMatch||"No endpoints match your search."}),Object.entries(q).map(([X,U])=>{const B=_||w.has(X);return p.jsxs("div",{className:"mb-4",children:[p.jsxs("button",{type:"button","aria-expanded":B,onClick:()=>R(X),className:`flex min-h-11 w-full items-center gap-2 rounded-lg p-2 text-left transition-colors ${r==="dark"?"hover:bg-gray-800/50 text-white":"hover:bg-gray-50 text-gray-700"}`,children:[B?p.jsx(Bg,{className:"h-4 w-4 shrink-0 text-gray-400"}):p.jsx($g,{className:"h-4 w-4 shrink-0 text-gray-400"}),p.jsx(Vg,{className:"h-4 w-4 shrink-0 text-gray-400"}),p.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:X==="default"?c?.generalTag||"General":X}),p.jsx("span",{className:`ml-auto shrink-0 rounded-full px-2 py-0.5 text-xs ${r==="dark"?"bg-gray-800 text-white":"bg-gray-100 text-gray-500"}`,children:U.length})]}),B&&p.jsx("div",{className:"ml-4 mt-1.5 space-y-1.5 sm:ml-6",children:U.map(({path:K,method:W,operation:ye})=>{const pe=n?.path===K&&n?.method===W;return p.jsxs("button",{type:"button","data-selected-endpoint":pe?"true":void 0,onClick:()=>e(K,W),className:`mb-2 min-h-11 w-full rounded-lg border p-2 text-left transition-all ${pe?r==="dark"?"bg-blue-900/20 border-blue-800/50 shadow-sm":"bg-blue-50 border-blue-100 shadow-sm":r==="dark"?"hover:bg-gray-800/50 border-transparent hover:border-gray-700":"hover:bg-gray-50 border-transparent hover:border-gray-100"}`,style:pe?{color:"var(--flexdoc-sidebar-active-text)"}:void 0,children:[p.jsx("div",{className:"mb-1 flex items-center gap-2",children:p.jsx("span",{className:E(W),children:W.toUpperCase()})}),p.jsx("div",{className:`break-all font-mono text-sm ${pe?r==="dark"?"text-blue-300":"text-blue-600":r==="dark"?"text-gray-300":"text-gray-800"}`,children:K}),ye?.summary&&p.jsx("div",{className:`mt-1 text-xs ${r==="dark"?"text-gray-400":"text-gray-600"}`,children:ye.summary})]},`${W}-${K}`)})})]},X)})]})]})})]})},Ns=["parameters","requestBody","responses","tryIt","codeSamples"],tf={all:Ns,none:[],minimal:[],documentation:["parameters","requestBody","responses"],interactive:["parameters","requestBody","tryIt","codeSamples"]},pk=["minimal","documentation","interactive"],mk=Object.keys(tf),gk=["light","dark","high-contrast"];function yk(t){return typeof t=="string"?mk.includes(t):Array.isArray(t)&&t.every(e=>typeof e=="string"&&(Ns.includes(e)||pk.includes(e)))}function nf(t,e){return t===void 0&&e!==void 0?Ns.filter(n=>e!=="none"||n!=="responses"):t===void 0?[]:typeof t=="string"?[...tf[t]]:Ns.filter(n=>t.some(r=>r===n||tf[r]?.includes(n)))}function bk(t,e){return`flexdoc:viewer:${encodeURIComponent(e?.trim()||"unknown-host")}:${encodeURIComponent(t?.trim()||"untitled")}`}function ua(t,e){const n=e??(typeof window<"u"?window.localStorage:void 0);if(!n)return{version:1};try{const r=n.getItem(t);if(!r)return{version:1};const s=JSON.parse(r);return s.version!==1?{version:1}:s.expand!==void 0&&!yk(s.expand)?{version:1}:s.sidebarCollapsed!==void 0&&typeof s.sidebarCollapsed!="boolean"?{version:1}:s.theme!==void 0&&(typeof s.theme!="string"||!gk.includes(s.theme))?{version:1}:s.expandedTags!==void 0&&(!Array.isArray(s.expandedTags)||!s.expandedTags.every(a=>typeof a=="string"))?{version:1}:{version:1,...s.expand!==void 0?{expand:s.expand}:{},...s.sidebarCollapsed!==void 0?{sidebarCollapsed:s.sidebarCollapsed}:{},...s.theme!==void 0?{theme:s.theme}:{},...s.expandedTags!==void 0?{expandedTags:[...new Set(s.expandedTags)]}:{}}}catch{return{version:1}}}function _o(t,e,n,r){const s=typeof window<"u"?window.localStorage:void 0;if(s)try{const a={...ua(t,s)},c=e==="expandedTags"&&Array.isArray(n)?[...new Set(n)]:n;c===void 0?delete a[e]:a[e]=c,a.expand===void 0&&a.sidebarCollapsed===void 0&&a.theme===void 0&&a.expandedTags===void 0?s.removeItem(t):s.setItem(t,JSON.stringify(a))}catch{}}function Dr(t,e){if(e)return Hi.isReference(e)?Hi.resolveReference(t,e.$ref):e}function xk(t,e){const n=t.paths[e];if(!n)throw new Error(`Path not found: ${e}`);return Dr(t,n)}function vk(t,e={}){return t.url.replace(/\{([^}]+)\}/g,(n,r)=>{const s=t.variables?.[r],a=e[r]??s?.default;if(a===void 0)throw new Error(`Missing server variable: ${r}`);if(s?.enum?.length&&!s.enum.includes(a))throw new Error(`Invalid value for server variable ${r}: ${a}`);return a})}function rf(t,e,n){const r=xk(t,e),s=r[n.toLowerCase()];if(!s||typeof s!="object"||!("responses"in s))throw new Error(`Operation not found: ${n.toUpperCase()} ${e}`);const a=[...r.parameters||[],...s.parameters||[]].map(f=>Dr(t,f)).filter(f=>!!f),c=new Map;for(const f of a)c.set(`${f.in}:${f.name}`,f);const u={};for(const[f,h]of Object.entries(s.responses||{})){const g=Dr(t,h);g&&(u[f]=g)}return{path:e,method:n.toUpperCase(),pathItem:r,operation:s,parameters:[...c.values()],requestBody:Dr(t,s.requestBody),responses:u,servers:s.servers||r.servers||t.servers||[],security:s.security!==void 0?s.security:t.security||[]}}function wk(t,e,n){return rf(t,e,n).parameters}function Sk(t,e){return Dr(t,e.schema)}function Ak(t,e){if(e.example!==void 0)return e.example;const n=Sk(t,e);return n?.example!==void 0?n.example:n?.examples?.length?n.examples[0]:n?.default!==void 0?n.default:n?.enum?.length?n.enum[0]:n?.type==="array"?[]:n?.type==="object"?{}:n?.type==="integer"||n?.type==="number"?1:n?.type==="boolean"?!0:""}function kk(t,e,n){const r=rf(t,e,n),s={parameters:{},headers:{},cookies:{},auth:{}};for(const u of r.parameters){const f=u.in==="header"?s.headers:u.in==="cookie"?s.cookies:s.parameters;f[u.name]=Ak(t,u)}const a=r.requestBody,c=a?Object.keys(a.content||{})[0]:void 0;if(c){s.contentType=c;const u=a.content[c],f=Dr(t,u.schema),h=u.examples?Object.values(u.examples)[0]:void 0,g=Dr(t,h),b=u.example??g?.value??f?.example??f?.examples?.[0]??f?.default;s.body=b!==void 0?JSON.stringify(b,null,2):""}return s}function an(t){return t===null?"null":typeof t=="object"?JSON.stringify(t):String(t)}function sf(t){if(typeof t!="string")return t;const e=t.trim();if(!e||!e.startsWith("[")&&!e.startsWith("{"))return t;try{return JSON.parse(e)}catch{return t}}function D0(t,e=!1){const n=an(t);return e?encodeURI(n).replace(/%5B/g,"[").replace(/%5D/g,"]"):encodeURIComponent(n)}function _0(t,e=!1){const n=sf(t);if(Array.isArray(n))return n.map(an).join(",");if(n&&typeof n=="object"){const r=Object.entries(n);return e?r.map(([s,a])=>`${s}=${an(a)}`).join(","):r.flatMap(([s,a])=>[s,an(a)]).join(",")}return an(n)}function Ck(t,e){const n=t.style||"simple",r=t.explode??!1,s=sf(e),a=u=>D0(u,t.allowReserved);if(Array.isArray(s)){const u=s.map(a);return n==="label"?`.${u.join(r?".":",")}`:n==="matrix"?r?u.map(f=>`;${t.name}=${f}`).join(""):`;${t.name}=${u.join(",")}`:u.join(",")}if(s&&typeof s=="object"){const u=Object.entries(s).map(([f,h])=>[a(f),a(h)]);return n==="label"?r?`.${u.map(([f,h])=>`${f}=${h}`).join(".")}`:`.${u.flatMap(([f,h])=>[f,h]).join(",")}`:n==="matrix"?r?u.map(([f,h])=>`;${f}=${h}`).join(""):`;${t.name}=${u.flatMap(([f,h])=>[f,h]).join(",")}`:r?u.map(([f,h])=>`${f}=${h}`).join(","):u.flatMap(([f,h])=>[f,h]).join(",")}const c=a(s);return n==="label"?`.${c}`:n==="matrix"?`;${t.name}=${c}`:c}function Nk(t,e){const n=t.style||"form",r=t.explode??n==="form",s=sf(e);if(n==="deepObject"&&s&&typeof s=="object"&&!Array.isArray(s))return Object.entries(s).map(([a,c])=>[`${t.name}[${a}]`,an(c)]);if(Array.isArray(s))return n==="spaceDelimited"?[[t.name,s.map(an).join(" ")]]:n==="pipeDelimited"?[[t.name,s.map(an).join("|")]]:r?s.map(a=>[t.name,an(a)]):[[t.name,s.map(an).join(",")]];if(s&&typeof s=="object"){const a=Object.entries(s);return r?a.map(([c,u])=>[c,an(u)]):[[t.name,a.flatMap(([c,u])=>[c,an(u)]).join(",")]]}return[[t.name,an(s)]]}function Tk(t){return typeof globalThis.btoa=="function"?globalThis.btoa(unescape(encodeURIComponent(t))):t}function jk(t,e){return Object.keys(t).every(n=>!!e[n])}function Ek(t,e,n,r,s,a){if(!e.length||!t.components?.securitySchemes)return;const c=e.find(u=>Object.keys(u).length===0||jk(u,a))||e[0];for(const u of Object.keys(c)){const f=Dr(t,t.components.securitySchemes[u]),h=a[u];!f||!h||(f.type==="http"&&f.scheme?.toLowerCase()==="bearer"?n.Authorization=`Bearer ${h}`:f.type==="http"&&f.scheme?.toLowerCase()==="basic"?n.Authorization=`Basic ${Tk(h)}`:f.type==="apiKey"&&f.in==="header"&&f.name?n[f.name]=h:f.type==="apiKey"&&f.in==="query"&&f.name?r.push(`${encodeURIComponent(f.name)}=${encodeURIComponent(h)}`):f.type==="apiKey"&&f.in==="cookie"&&f.name?s.push(`${f.name}=${encodeURIComponent(h)}`):(f.type==="oauth2"||f.type==="openIdConnect")&&(n.Authorization=`Bearer ${h}`))}}function L0(t){try{const e=JSON.parse(t);return e&&typeof e=="object"&&!Array.isArray(e)?e:void 0}catch{return}}function Ok(t,e,n,r={}){const s=rf(t,e,n),a=s.servers[0],c=r.serverUrl||(a?vk(a,r.serverVariables):"");let u=e;const f=[],h={...r.headers||{}},g=[];for(const O of s.parameters){const D=O.in==="header"?r.headers?.[O.name]:O.in==="cookie"?r.cookies?.[O.name]:r.parameters?.[O.name];if(!(D===void 0||D===""))if(O.in==="path")u=u.replace(`{${O.name}}`,Ck(O,D));else if(O.in==="query")for(const[E,j]of Nk(O,D))f.push(`${encodeURIComponent(E)}=${D0(j,O.allowReserved)}`);else O.in==="header"?h[O.name]=_0(D,O.explode):O.in==="cookie"&&g.push(`${O.name}=${encodeURIComponent(_0(D,O.explode))}`)}Ek(t,s.security,h,f,g,r.auth||{}),g.length&&(h.Cookie=g.join("; "));let b,v,w;if(r.body){const O=r.contentType||"application/json";if(b=r.body,O==="application/x-www-form-urlencoded"){const D=L0(r.body);b=D?Object.entries(D).flatMap(([E,j])=>Array.isArray(j)?j.map(M=>`${encodeURIComponent(E)}=${encodeURIComponent(an(M))}`):[`${encodeURIComponent(E)}=${encodeURIComponent(an(j))}`]).join("&"):r.body,w=b,v="form",h["Content-Type"]=O}else if(O.startsWith("multipart/form-data")){const D=L0(r.body);if(D&&typeof FormData<"u"){const E=new FormData;for(const[j,M]of Object.entries(D))Array.isArray(M)?M.forEach(_=>E.append(j,an(_))):E.append(j,an(M));w=E}else w=r.body;v="multipart"}else w=r.body,v=O.includes("json")?"json":"text",h["Content-Type"]=O}const A=f.join("&");return{url:`${c.replace(/\/$/,"")}${u}${A?`?${A}`:""}`,method:s.method,headers:h,body:b,bodyKind:v,init:{method:s.method,headers:h,body:w}}}function Mk(t,e,n){return wk(t,e,n)}function q0(t,e,n){return kk(t,e,n)}function B0(t,e,n,r={}){return Ok(t,e,n,r)}const on=t=>JSON.stringify(t);function Rk(t,e){const n=Object.entries(t.headers);if(e==="curl"){const a=[`curl -X ${t.method} ${on(t.url)}`];for(const[c,u]of n)a.push(` -H ${on(`${c}: ${u}`)}`);return t.body&&a.push(` --data-raw ${on(t.body)}`),a.join(` \\
|
|
41
41
|
`)}if(e==="javascript"){const a={method:t.method};return n.length&&(a.headers=t.headers),t.body&&(a.body=t.body),`const response = await fetch(${on(t.url)}, ${JSON.stringify(a,null,2)});
|
|
42
42
|
const data = await response.json();`}if(e==="python"){const a=["import requests","",`url = ${on(t.url)}`];return n.length&&a.push(`headers = ${JSON.stringify(t.headers,null,2)}`),t.body&&a.push(`body = ${on(t.body)}`),a.push(`response = requests.request(${on(t.method)}, url${n.length?", headers=headers":""}${t.body?", data=body":""})`,"print(response.text)"),a.join(`
|
|
43
43
|
`)}if(e==="go"){const a=t.body?`strings.NewReader(${on(t.body)})`:"nil",c=["package main","","import (",' "fmt"',' "io"',' "net/http"'];t.body&&c.push(' "strings"'),c.push(")","","func main() {",` req, _ := http.NewRequest(${on(t.method)}, ${on(t.url)}, ${a})`);for(const[u,f]of n)c.push(` req.Header.Set(${on(u)}, ${on(f)})`);return c.push(" res, err := http.DefaultClient.Do(req)"," if err != nil { panic(err) }"," defer res.Body.Close()"," data, _ := io.ReadAll(res.Body)"," fmt.Println(string(data))","}"),c.join(`
|
|
44
44
|
`)}const r=["import java.net.URI;","import java.net.http.*;","","var client = HttpClient.newHttpClient();","var builder = HttpRequest.newBuilder()",` .uri(URI.create(${on(t.url)}))`];for(const[a,c]of n)r.push(` .header(${on(a)}, ${on(c)})`);const s=t.body?`HttpRequest.BodyPublishers.ofString(${on(t.body)})`:"HttpRequest.BodyPublishers.noBody()";return r.push(` .method(${on(t.method)}, ${s});`,"var response = client.send(builder.build(), HttpResponse.BodyHandlers.ofString());","System.out.println(response.body());"),r.join(`
|
|
45
|
-
`)}function Mk(t){return{curl:"cURL",javascript:"JavaScript",python:"Python",go:"Go",java:"Java"}[t]}function Rk(t,e){return Ok(t,e)}function q0(t){return Mk(t)}var sf={exports:{}},B0;function Dk(){return B0||(B0=1,(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var n=(function(r){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,a=0,c={},u={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function M(E){return E instanceof f?new f(E.type,M(E.content),E.alias):Array.isArray(E)?E.map(M):E.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(M){return Object.prototype.toString.call(M).slice(8,-1)},objId:function(M){return M.__id||Object.defineProperty(M,"__id",{value:++a}),M.__id},clone:function M(E,R){R=R||{};var _,q;switch(u.util.type(E)){case"Object":if(q=u.util.objId(E),R[q])return R[q];_={},R[q]=_;for(var O in E)E.hasOwnProperty(O)&&(_[O]=M(E[O],R));return _;case"Array":return q=u.util.objId(E),R[q]?R[q]:(_=[],R[q]=_,E.forEach(function(X,U){_[U]=M(X,R)}),_);default:return E}},getLanguage:function(M){for(;M;){var E=s.exec(M.className);if(E)return E[1].toLowerCase();M=M.parentElement}return"none"},setLanguage:function(M,E){M.className=M.className.replace(RegExp(s,"gi"),""),M.classList.add("language-"+E)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(_){var M=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(_.stack)||[])[1];if(M){var E=document.getElementsByTagName("script");for(var R in E)if(E[R].src==M)return E[R]}return null}},isActive:function(M,E,R){for(var _="no-"+E;M;){var q=M.classList;if(q.contains(E))return!0;if(q.contains(_))return!1;M=M.parentElement}return!!R}},languages:{plain:c,plaintext:c,text:c,txt:c,extend:function(M,E){var R=u.util.clone(u.languages[M]);for(var _ in E)R[_]=E[_];return R},insertBefore:function(M,E,R,_){_=_||u.languages;var q=_[M],O={};for(var X in q)if(q.hasOwnProperty(X)){if(X==E)for(var U in R)R.hasOwnProperty(U)&&(O[U]=R[U]);R.hasOwnProperty(X)||(O[X]=q[X])}var B=_[M];return _[M]=O,u.languages.DFS(u.languages,function(K,W){W===B&&K!=M&&(this[K]=O)}),O},DFS:function M(E,R,_,q){q=q||{};var O=u.util.objId;for(var X in E)if(E.hasOwnProperty(X)){R.call(E,X,E[X],_||X);var U=E[X],B=u.util.type(U);B==="Object"&&!q[O(U)]?(q[O(U)]=!0,M(U,R,null,q)):B==="Array"&&!q[O(U)]&&(q[O(U)]=!0,M(U,R,X,q))}}},plugins:{},highlightAll:function(M,E){u.highlightAllUnder(document,M,E)},highlightAllUnder:function(M,E,R){var _={callback:R,container:M,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};u.hooks.run("before-highlightall",_),_.elements=Array.prototype.slice.apply(_.container.querySelectorAll(_.selector)),u.hooks.run("before-all-elements-highlight",_);for(var q=0,O;O=_.elements[q++];)u.highlightElement(O,E===!0,_.callback)},highlightElement:function(M,E,R){var _=u.util.getLanguage(M),q=u.languages[_];u.util.setLanguage(M,_);var O=M.parentElement;O&&O.nodeName.toLowerCase()==="pre"&&u.util.setLanguage(O,_);var X=M.textContent,U={element:M,language:_,grammar:q,code:X};function B(W){U.highlightedCode=W,u.hooks.run("before-insert",U),U.element.innerHTML=U.highlightedCode,u.hooks.run("after-highlight",U),u.hooks.run("complete",U),R&&R.call(U.element)}if(u.hooks.run("before-sanity-check",U),O=U.element.parentElement,O&&O.nodeName.toLowerCase()==="pre"&&!O.hasAttribute("tabindex")&&O.setAttribute("tabindex","0"),!U.code){u.hooks.run("complete",U),R&&R.call(U.element);return}if(u.hooks.run("before-highlight",U),!U.grammar){B(u.util.encode(U.code));return}if(E&&r.Worker){var K=new Worker(u.filename);K.onmessage=function(W){B(W.data)},K.postMessage(JSON.stringify({language:U.language,code:U.code,immediateClose:!0}))}else B(u.highlight(U.code,U.grammar,U.language))},highlight:function(M,E,R){var _={code:M,grammar:E,language:R};if(u.hooks.run("before-tokenize",_),!_.grammar)throw new Error('The language "'+_.language+'" has no grammar.');return _.tokens=u.tokenize(_.code,_.grammar),u.hooks.run("after-tokenize",_),f.stringify(u.util.encode(_.tokens),_.language)},tokenize:function(M,E){var R=E.rest;if(R){for(var _ in R)E[_]=R[_];delete E.rest}var q=new b;return v(q,q.head,M),g(M,q,E,q.head,0),A(q)},hooks:{all:{},add:function(M,E){var R=u.hooks.all;R[M]=R[M]||[],R[M].push(E)},run:function(M,E){var R=u.hooks.all[M];if(!(!R||!R.length))for(var _=0,q;q=R[_++];)q(E)}},Token:f};r.Prism=u;function f(M,E,R,_){this.type=M,this.content=E,this.alias=R,this.length=(_||"").length|0}f.stringify=function M(E,R){if(typeof E=="string")return E;if(Array.isArray(E)){var _="";return E.forEach(function(B){_+=M(B,R)}),_}var q={type:E.type,content:M(E.content,R),tag:"span",classes:["token",E.type],attributes:{},language:R},O=E.alias;O&&(Array.isArray(O)?Array.prototype.push.apply(q.classes,O):q.classes.push(O)),u.hooks.run("wrap",q);var X="";for(var U in q.attributes)X+=" "+U+'="'+(q.attributes[U]||"").replace(/"/g,""")+'"';return"<"+q.tag+' class="'+q.classes.join(" ")+'"'+X+">"+q.content+"</"+q.tag+">"};function h(M,E,R,_){M.lastIndex=E;var q=M.exec(R);if(q&&_&&q[1]){var O=q[1].length;q.index+=O,q[0]=q[0].slice(O)}return q}function g(M,E,R,_,q,O){for(var X in R)if(!(!R.hasOwnProperty(X)||!R[X])){var U=R[X];U=Array.isArray(U)?U:[U];for(var B=0;B<U.length;++B){if(O&&O.cause==X+","+B)return;var K=U[B],W=K.inside,ye=!!K.lookbehind,pe=!!K.greedy,fe=K.alias;if(pe&&!K.pattern.global){var L=K.pattern.toString().match(/[imsuy]*$/)[0];K.pattern=RegExp(K.pattern.source,L+"g")}for(var Q=K.pattern||K,oe=_.next,ce=q;oe!==E.tail&&!(O&&ce>=O.reach);ce+=oe.value.length,oe=oe.next){var ve=oe.value;if(E.length>M.length)return;if(!(ve instanceof f)){var T=1,z;if(pe){if(z=h(Q,ce,M,ye),!z||z.index>=M.length)break;var qe=z.index,he=z.index+z[0].length,ne=ce;for(ne+=oe.value.length;qe>=ne;)oe=oe.next,ne+=oe.value.length;if(ne-=oe.value.length,ce=ne,oe.value instanceof f)continue;for(var ke=oe;ke!==E.tail&&(ne<he||typeof ke.value=="string");ke=ke.next)T++,ne+=ke.value.length;T--,ve=M.slice(ce,ne),z.index-=ce}else if(z=h(Q,0,ve,ye),!z)continue;var qe=z.index,$e=z[0],Fe=ve.slice(0,qe),Ye=ve.slice(qe+$e.length),Ie=ce+ve.length;O&&Ie>O.reach&&(O.reach=Ie);var ut=oe.prev;Fe&&(ut=v(E,ut,Fe),ce+=Fe.length),w(E,ut,T);var Rt=new f(X,W?u.tokenize($e,W):$e,fe,$e);if(oe=v(E,ut,Rt),Ye&&v(E,oe,Ye),T>1){var Ce={cause:X+","+B,reach:Ie};g(M,E,R,oe.prev,ce,Ce),O&&Ce.reach>O.reach&&(O.reach=Ce.reach)}}}}}}function b(){var M={value:null,prev:null,next:null},E={value:null,prev:M,next:null};M.next=E,this.head=M,this.tail=E,this.length=0}function v(M,E,R){var _=E.next,q={value:R,prev:E,next:_};return E.next=q,_.prev=q,M.length++,q}function w(M,E,R){for(var _=E.next,q=0;q<R&&_!==M.tail;q++)_=_.next;E.next=_,_.prev=E,M.length-=q}function A(M){for(var E=[],R=M.head.next;R!==M.tail;)E.push(R.value),R=R.next;return E}if(!r.document)return r.addEventListener&&(u.disableWorkerMessageHandler||r.addEventListener("message",function(M){var E=JSON.parse(M.data),R=E.language,_=E.code,q=E.immediateClose;r.postMessage(u.highlight(_,u.languages[R],R)),q&&r.close()},!1)),u;var C=u.util.currentScript();C&&(u.filename=C.src,C.hasAttribute("data-manual")&&(u.manual=!0));function j(){u.manual||u.highlightAll()}if(!u.manual){var D=document.readyState;D==="loading"||D==="interactive"&&C&&C.defer?document.addEventListener("DOMContentLoaded",j):window.requestAnimationFrame?window.requestAnimationFrame(j):window.setTimeout(j,16)}return u})(e);t.exports&&(t.exports=n),typeof bg<"u"&&(bg.Prism=n)})(sf)),sf.exports}var _k=Dk();const Lk=xg(_k);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json,(function(t){var e=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ ]+"+e.source+")?|"+e.source+"(?:[ ]+"+n.source+")?)",s=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function c(u,f){f=(f||"").replace(/m/g,"")+"m";var h=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return u});return RegExp(h,f)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+s+"|"+a+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:c(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:c(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:c(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:c(a),lookbehind:!0,greedy:!0},number:{pattern:c(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:e,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism),Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,(function(t){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=t.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=r.variable[1].inside,c=0;c<s.length;c++)a[s[c]]=t.languages.bash[s[c]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);var $0={},I0;function qk(){return I0||(I0=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),$0}qk(),Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete Prism.languages.go["class-name"];var H0={},z0;function Bk(){return z0||(z0=1,(function(t){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:e,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),H0}Bk();const _r=({code:t,language:e,title:n,showCopy:r=!0,theme:s="dark",wrap:a=!1})=>{const[c,u]=Og.useState(!1),f=I.useRef(null);I.useEffect(()=>{f.current&&Lk.highlightElement(f.current)},[t,e,s]);const h=async()=>{try{await navigator.clipboard.writeText(t),u(!0),setTimeout(()=>u(!1),2e3)}catch(A){console.error("Failed to copy text: ",A)}},g=s==="dark"?"bg-gray-900 border-gray-700":"bg-gray-50 border-gray-200",b=s==="dark"?"bg-gray-800 border-gray-700 text-gray-300":"bg-gray-100 border-gray-200 text-gray-700",v=s==="dark"?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-900",w={"--fd-code-muted":s==="dark"?"#9ca3af":"#64748b","--fd-code-string":s==="dark"?"#86efac":"#15803d","--fd-code-keyword":s==="dark"?"#c4b5fd":"#6d28d9","--fd-code-number":s==="dark"?"#fb923c":"#c2410c","--fd-code-accent":s==="dark"?"#93c5fd":"#1d4ed8"};return p.jsxs("div",{className:`flexdoc-code min-w-0 rounded-lg overflow-hidden border ${g}`,"data-code-theme":s,style:w,children:[(n||r)&&p.jsxs("div",{className:`flex items-center justify-between gap-3 px-3 sm:px-4 py-2 border-b ${b}`,children:[n&&p.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:n}),r&&p.jsx("button",{onClick:h,className:`shrink-0 flex items-center gap-1 text-xs transition-colors ${v}`,"aria-label":"Copy code to clipboard",children:c?p.jsxs(p.Fragment,{children:[p.jsx(_g,{className:"w-3 h-3"}),p.jsx("span",{children:"Copied"})]}):p.jsxs(p.Fragment,{children:[p.jsx(UA,{className:"w-3 h-3"}),p.jsx("span",{children:"Copy"})]})})]}),p.jsx("div",{className:`p-3 sm:p-4 overflow-x-auto ${s==="dark"?"bg-gray-800":"bg-white"}`,children:p.jsx("pre",{className:`m-0 text-xs sm:text-sm ${a?"whitespace-pre-wrap break-words":""} ${s==="dark"?"text-gray-100":"text-gray-800"}`,children:p.jsx("code",{ref:f,className:`language-${e} bg-transparent`,children:t})})})]})};function $k(t){const e=Array.isArray(t.type)?t.type.join(" | "):t.type;return e?t.format?`${e} (${t.format})`:e:t.oneOf?"oneOf":t.anyOf?"anyOf":t.allOf?"allOf":t.const!==void 0?"const":"any"}const Lr=({spec:t,schema:e,theme:n,required:r=!1,level:s=0,seen:a=new Set,requiredPropsFirst:c=!1,sortPropsAlphabetically:u=!1})=>{const f={spec:t,theme:n,requiredPropsFirst:c,sortPropsAlphabetically:u};if($n.isReference(e)){if(a.has(e.$ref))return p.jsxs("div",{className:"py-1 text-sm opacity-70",children:["↳ ",p.jsx("code",{children:e.$ref.replace("#/components/schemas/","")})," (recursive reference)"]});const A=new Set(a);A.add(e.$ref);let C;try{C=$n.resolveReference(t,e.$ref)}catch{return p.jsxs("div",{className:"py-1 text-sm text-red-500",children:["Unresolved reference: ",p.jsx("code",{children:e.$ref})]})}return p.jsx(Lr,{...f,schema:C,required:r,level:s,seen:A})}const h=n==="dark"?"text-gray-400":"text-gray-600",g=n==="dark"?"border-gray-700":"border-gray-200",b=[["All of",e.allOf],["One of",e.oneOf],["Any of",e.anyOf]],v=new Set(e.required||[]),w=Object.entries(e.properties||{}).sort(([A],[C])=>{if(c){const j=Number(v.has(C))-Number(v.has(A));if(j)return j}return u?A.localeCompare(C):0});return p.jsxs("div",{className:s?`border-l-2 ${g} pl-3`:"",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-1",children:[p.jsx("span",{className:n==="dark"?"text-blue-300":"text-blue-600",children:$k(e)}),r&&p.jsx("span",{className:"rounded bg-red-100 px-2 py-0.5 text-xs text-red-700 dark:bg-red-900/30 dark:text-red-300",children:"required"}),(e.nullable||Array.isArray(e.type)&&e.type.includes("null"))&&p.jsx("span",{className:"rounded bg-gray-100 px-2 py-0.5 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:"nullable"}),e.deprecated&&p.jsx("span",{className:"rounded bg-orange-100 px-2 py-0.5 text-xs text-orange-700",children:"deprecated"}),e.readOnly&&p.jsx("span",{className:"text-xs opacity-60",children:"readOnly"}),e.writeOnly&&p.jsx("span",{className:"text-xs opacity-60",children:"writeOnly"})]}),e.description&&p.jsx("p",{className:`mt-1 text-sm leading-relaxed ${h}`,children:e.description}),e.enum&&p.jsxs("p",{className:`mt-1 text-xs ${h}`,children:["Allowed: ",e.enum.map(String).join(", ")]}),e.const!==void 0&&p.jsxs("p",{className:`mt-1 text-xs ${h}`,children:["Constant: ",JSON.stringify(e.const)]}),e.default!==void 0&&p.jsxs("p",{className:`mt-1 text-xs ${h}`,children:["Default: ",JSON.stringify(e.default)]}),(e.example!==void 0||e.examples?.length)&&p.jsx("div",{className:"mt-2",children:p.jsx(_r,{code:JSON.stringify(e.example??e.examples?.[0],null,2),language:"json",title:"Example",showCopy:!1,theme:n,wrap:!0})}),e.items&&p.jsxs("div",{className:"mt-3",children:[p.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide opacity-60",children:"Items"}),p.jsx(Lr,{...f,schema:e.items,level:s+1,seen:a})]}),b.map(([A,C])=>C?.length?p.jsxs("div",{className:"mt-3",children:[p.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide opacity-60",children:A}),p.jsx("div",{className:"space-y-3",children:C.map((j,D)=>p.jsx(Lr,{...f,schema:j,level:s+1,seen:a},D))})]},A):null),w.length>0&&p.jsx("div",{className:"mt-3 space-y-3",children:w.map(([A,C])=>p.jsxs("div",{children:[p.jsx("div",{className:"font-mono text-sm font-medium",children:A}),p.jsx(Lr,{...f,schema:C,required:v.has(A),level:s+1,seen:a})]},A))}),e.additionalProperties&&typeof e.additionalProperties=="object"&&p.jsxs("div",{className:"mt-3",children:[p.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide opacity-60",children:"Additional properties"}),p.jsx(Lr,{...f,schema:e.additionalProperties,level:s+1,seen:a})]})]})};function wn(t){return{preRequest:t?.preRequest||"",tests:t?.tests||""}}function Ik(t){return{...t,query:t.query?.map(e=>({...e})),headers:t.headers?.map(e=>({...e})),urlencoded:t.urlencoded?.map(e=>({...e})),formData:t.formData?.map(e=>({...e})),binary:t.binary?{...t.binary}:void 0,graphql:t.graphql?{...t.graphql}:void 0,auth:t.auth?{...t.auth}:void 0}}function Lo(t){return Object.assign(Object.create(null),t)}function Zt(t){if(typeof t=="string")return t;if(t instanceof Error)return t.message;try{return JSON.stringify(t)}catch{return String(t)}}function el(t,e){if(Object.is(t,e))return!0;if(typeof t!=typeof e||t===null||e===null)return!1;if(Array.isArray(t))return Array.isArray(e)&&t.length===e.length&&t.every((n,r)=>el(n,e[r]));if(typeof t=="object"&&typeof e=="object"){const n=t,r=e,s=Object.keys(n),a=Object.keys(r);return s.length===a.length&&s.every(c=>Object.prototype.hasOwnProperty.call(r,c)&&el(n[c],r[c]))}return!1}function ui(t){throw new Error(t)}function Hk(t){const e=h=>{Object.is(t,h)||ui(`expected ${Zt(t)} to equal ${Zt(h)}`)},n=h=>{el(t,h)||ui(`expected ${Zt(t)} to deeply equal ${Zt(h)}`)},r=h=>{(typeof t=="string"?t.includes(String(h)):Array.isArray(t)&&t.some(b=>el(b,h)))||ui(`expected ${Zt(t)} to include ${Zt(h)}`)},s=(h,...g)=>{(!t||typeof t!="object"||!Object.prototype.hasOwnProperty.call(t,h))&&ui(`expected value to have property ${h}`),g.length>0&&!el(t[h],g[0])&&ui(`expected property ${h} to equal ${Zt(g[0])}`)},f={above:h=>{(typeof t!="number"||t<=h)&&ui(`expected ${Zt(t)} to be above ${h}`)},below:h=>{(typeof t!="number"||t>=h)&&ui(`expected ${Zt(t)} to be below ${h}`)},oneOf:h=>{h.some(g=>el(t,g))||ui(`expected ${Zt(t)} to be one of ${Zt(h)}`)}};return Object.defineProperties(f,{ok:{get:()=>(t||ui(`expected ${Zt(t)} to be truthy`),!0)},true:{get:()=>(t!==!0&&ui(`expected ${Zt(t)} to be true`),!0)},false:{get:()=>(t!==!1&&ui(`expected ${Zt(t)} to be false`),!0)}}),{to:{equal:e,eql:n,include:r,match:h=>{(typeof t!="string"||!h.test(t))&&ui(`expected ${Zt(t)} to match ${h}`)},have:{property:s},be:f}}}function lf(t,e){return t.findIndex(n=>n.key.toLowerCase()===e.toLowerCase())}function zk(t){const e=()=>t.headers||(t.headers=[]),n=(r,s)=>{const a=e(),c=lf(a,r),u={key:r,value:String(s),enabled:!0};c>=0?a[c]=u:a.push(u)};return{get(r){const s=lf(e(),r);return s>=0?e()[s].value:void 0},has(r){return lf(e(),r)>=0},set:n,upsert({key:r,value:s}){n(r,s)},remove(r){t.headers=e().filter(s=>s.key.toLowerCase()!==r.toLowerCase())},toObject(){const r={};for(const s of e())s.enabled!==!1&&(r[s.key]=s.value);return r}}}function Uk(t){return{get(e){return t.find(([n])=>n.toLowerCase()===e.toLowerCase())?.[1]},has(e){return t.some(([n])=>n.toLowerCase()===e.toLowerCase())},toObject(){const e={};for(const[n,r]of t)e[n]=r;return e}}}async function U0(t){const e=Ik(t.draft),n=Lo(t.variables||{}),r=Lo(t.collectionVariables||{}),s=Lo(t.externalVariables||{}),a=Lo(t.environmentVariables||{}),c=[],u=[],f=[],h=[],g=[],b=R=>{Object.prototype.hasOwnProperty.call(a,R)?n[R]=a[R]:Object.prototype.hasOwnProperty.call(s,R)?n[R]=s[R]:Object.prototype.hasOwnProperty.call(r,R)?n[R]=r[R]:delete n[R]},v={get(R){return a[R]},has(R){return Object.prototype.hasOwnProperty.call(a,R)},set(R,_){const q=String(_);a[R]=q,n[R]=q,u.push({action:"set",key:R,value:q})},unset(R){delete a[R],b(R),u.push({action:"unset",key:R})},replaceIn(R){return R.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(_,q)=>{const O=q.trim();return Object.prototype.hasOwnProperty.call(a,O)?a[O]:_})}},w={get(R){return r[R]},has(R){return Object.prototype.hasOwnProperty.call(r,R)},set(R,_){const q=String(_);r[R]=q,b(R),c.push({action:"set",key:R,value:q})},unset(R){delete r[R],b(R),c.push({action:"unset",key:R})},replaceIn(R){return R.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(_,q)=>{const O=q.trim();return Object.prototype.hasOwnProperty.call(r,O)?r[O]:_})}},A={get(R){return n[R]},has(R){return Object.prototype.hasOwnProperty.call(n,R)},set(R,_){n[R]=String(_)},unset(R){delete n[R]},replaceIn(R){return R.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(_,q)=>{const O=q.trim();return Object.prototype.hasOwnProperty.call(n,O)?n[O]:_})}},C={get raw(){return e.body||""},set raw(R){e.body=String(R),e.bodyMode="raw"}},j={get method(){return e.method},set method(R){e.method=String(R)},get url(){return e.url},set url(R){e.url=String(R)},headers:zk(e),body:C},D=t.response?{code:t.response.status,status:t.response.statusText,responseTime:t.response.responseTime,headers:Uk(t.response.headers),text:()=>t.response?.body||"",json:()=>JSON.parse(t.response?.body||"")}:void 0,M={request:j,response:D,environment:v,collection:w,variables:A,expect:Hk,test(R,_){if(t.phase!=="tests")throw new Error("flex.test is only available in post-response test scripts.");const q=Promise.resolve().then(_).then(()=>{f.push({name:R,passed:!0})}).catch(O=>{f.push({name:R,passed:!1,error:O instanceof Error?O.message:String(O)})});g.push(q)}},E={log:(...R)=>h.push(R.map(Zt).join(" ")),info:(...R)=>h.push(R.map(Zt).join(" ")),warn:(...R)=>h.push(`WARN ${R.map(Zt).join(" ")}`),error:(...R)=>h.push(`ERROR ${R.map(Zt).join(" ")}`)};try{return await new Function("flex","console",`"use strict"; return (async () => {
|
|
45
|
+
`)}function Dk(t){return{curl:"cURL",javascript:"JavaScript",python:"Python",go:"Go",java:"Java"}[t]}function _k(t,e){return Rk(t,e)}function $0(t){return Dk(t)}var lf={exports:{}},I0;function Lk(){return I0||(I0=1,(function(t){var e=typeof window<"u"?window:typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?self:{};var n=(function(r){var s=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,a=0,c={},u={manual:r.Prism&&r.Prism.manual,disableWorkerMessageHandler:r.Prism&&r.Prism.disableWorkerMessageHandler,util:{encode:function E(j){return j instanceof f?new f(j.type,E(j.content),j.alias):Array.isArray(j)?j.map(E):j.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(E){return Object.prototype.toString.call(E).slice(8,-1)},objId:function(E){return E.__id||Object.defineProperty(E,"__id",{value:++a}),E.__id},clone:function E(j,M){M=M||{};var _,q;switch(u.util.type(j)){case"Object":if(q=u.util.objId(j),M[q])return M[q];_={},M[q]=_;for(var R in j)j.hasOwnProperty(R)&&(_[R]=E(j[R],M));return _;case"Array":return q=u.util.objId(j),M[q]?M[q]:(_=[],M[q]=_,j.forEach(function(X,U){_[U]=E(X,M)}),_);default:return j}},getLanguage:function(E){for(;E;){var j=s.exec(E.className);if(j)return j[1].toLowerCase();E=E.parentElement}return"none"},setLanguage:function(E,j){E.className=E.className.replace(RegExp(s,"gi"),""),E.classList.add("language-"+j)},currentScript:function(){if(typeof document>"u")return null;if(document.currentScript&&document.currentScript.tagName==="SCRIPT")return document.currentScript;try{throw new Error}catch(_){var E=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(_.stack)||[])[1];if(E){var j=document.getElementsByTagName("script");for(var M in j)if(j[M].src==E)return j[M]}return null}},isActive:function(E,j,M){for(var _="no-"+j;E;){var q=E.classList;if(q.contains(j))return!0;if(q.contains(_))return!1;E=E.parentElement}return!!M}},languages:{plain:c,plaintext:c,text:c,txt:c,extend:function(E,j){var M=u.util.clone(u.languages[E]);for(var _ in j)M[_]=j[_];return M},insertBefore:function(E,j,M,_){_=_||u.languages;var q=_[E],R={};for(var X in q)if(q.hasOwnProperty(X)){if(X==j)for(var U in M)M.hasOwnProperty(U)&&(R[U]=M[U]);M.hasOwnProperty(X)||(R[X]=q[X])}var B=_[E];return _[E]=R,u.languages.DFS(u.languages,function(K,W){W===B&&K!=E&&(this[K]=R)}),R},DFS:function E(j,M,_,q){q=q||{};var R=u.util.objId;for(var X in j)if(j.hasOwnProperty(X)){M.call(j,X,j[X],_||X);var U=j[X],B=u.util.type(U);B==="Object"&&!q[R(U)]?(q[R(U)]=!0,E(U,M,null,q)):B==="Array"&&!q[R(U)]&&(q[R(U)]=!0,E(U,M,X,q))}}},plugins:{},highlightAll:function(E,j){u.highlightAllUnder(document,E,j)},highlightAllUnder:function(E,j,M){var _={callback:M,container:E,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};u.hooks.run("before-highlightall",_),_.elements=Array.prototype.slice.apply(_.container.querySelectorAll(_.selector)),u.hooks.run("before-all-elements-highlight",_);for(var q=0,R;R=_.elements[q++];)u.highlightElement(R,j===!0,_.callback)},highlightElement:function(E,j,M){var _=u.util.getLanguage(E),q=u.languages[_];u.util.setLanguage(E,_);var R=E.parentElement;R&&R.nodeName.toLowerCase()==="pre"&&u.util.setLanguage(R,_);var X=E.textContent,U={element:E,language:_,grammar:q,code:X};function B(W){U.highlightedCode=W,u.hooks.run("before-insert",U),U.element.innerHTML=U.highlightedCode,u.hooks.run("after-highlight",U),u.hooks.run("complete",U),M&&M.call(U.element)}if(u.hooks.run("before-sanity-check",U),R=U.element.parentElement,R&&R.nodeName.toLowerCase()==="pre"&&!R.hasAttribute("tabindex")&&R.setAttribute("tabindex","0"),!U.code){u.hooks.run("complete",U),M&&M.call(U.element);return}if(u.hooks.run("before-highlight",U),!U.grammar){B(u.util.encode(U.code));return}if(j&&r.Worker){var K=new Worker(u.filename);K.onmessage=function(W){B(W.data)},K.postMessage(JSON.stringify({language:U.language,code:U.code,immediateClose:!0}))}else B(u.highlight(U.code,U.grammar,U.language))},highlight:function(E,j,M){var _={code:E,grammar:j,language:M};if(u.hooks.run("before-tokenize",_),!_.grammar)throw new Error('The language "'+_.language+'" has no grammar.');return _.tokens=u.tokenize(_.code,_.grammar),u.hooks.run("after-tokenize",_),f.stringify(u.util.encode(_.tokens),_.language)},tokenize:function(E,j){var M=j.rest;if(M){for(var _ in M)j[_]=M[_];delete j.rest}var q=new b;return v(q,q.head,E),g(E,q,j,q.head,0),A(q)},hooks:{all:{},add:function(E,j){var M=u.hooks.all;M[E]=M[E]||[],M[E].push(j)},run:function(E,j){var M=u.hooks.all[E];if(!(!M||!M.length))for(var _=0,q;q=M[_++];)q(j)}},Token:f};r.Prism=u;function f(E,j,M,_){this.type=E,this.content=j,this.alias=M,this.length=(_||"").length|0}f.stringify=function E(j,M){if(typeof j=="string")return j;if(Array.isArray(j)){var _="";return j.forEach(function(B){_+=E(B,M)}),_}var q={type:j.type,content:E(j.content,M),tag:"span",classes:["token",j.type],attributes:{},language:M},R=j.alias;R&&(Array.isArray(R)?Array.prototype.push.apply(q.classes,R):q.classes.push(R)),u.hooks.run("wrap",q);var X="";for(var U in q.attributes)X+=" "+U+'="'+(q.attributes[U]||"").replace(/"/g,""")+'"';return"<"+q.tag+' class="'+q.classes.join(" ")+'"'+X+">"+q.content+"</"+q.tag+">"};function h(E,j,M,_){E.lastIndex=j;var q=E.exec(M);if(q&&_&&q[1]){var R=q[1].length;q.index+=R,q[0]=q[0].slice(R)}return q}function g(E,j,M,_,q,R){for(var X in M)if(!(!M.hasOwnProperty(X)||!M[X])){var U=M[X];U=Array.isArray(U)?U:[U];for(var B=0;B<U.length;++B){if(R&&R.cause==X+","+B)return;var K=U[B],W=K.inside,ye=!!K.lookbehind,pe=!!K.greedy,fe=K.alias;if(pe&&!K.pattern.global){var L=K.pattern.toString().match(/[imsuy]*$/)[0];K.pattern=RegExp(K.pattern.source,L+"g")}for(var Q=K.pattern||K,oe=_.next,ce=q;oe!==j.tail&&!(R&&ce>=R.reach);ce+=oe.value.length,oe=oe.next){var ve=oe.value;if(j.length>E.length)return;if(!(ve instanceof f)){var T=1,z;if(pe){if(z=h(Q,ce,E,ye),!z||z.index>=E.length)break;var qe=z.index,he=z.index+z[0].length,ne=ce;for(ne+=oe.value.length;qe>=ne;)oe=oe.next,ne+=oe.value.length;if(ne-=oe.value.length,ce=ne,oe.value instanceof f)continue;for(var ke=oe;ke!==j.tail&&(ne<he||typeof ke.value=="string");ke=ke.next)T++,ne+=ke.value.length;T--,ve=E.slice(ce,ne),z.index-=ce}else if(z=h(Q,0,ve,ye),!z)continue;var qe=z.index,$e=z[0],Fe=ve.slice(0,qe),Ye=ve.slice(qe+$e.length),Ie=ce+ve.length;R&&Ie>R.reach&&(R.reach=Ie);var ut=oe.prev;Fe&&(ut=v(j,ut,Fe),ce+=Fe.length),w(j,ut,T);var Rt=new f(X,W?u.tokenize($e,W):$e,fe,$e);if(oe=v(j,ut,Rt),Ye&&v(j,oe,Ye),T>1){var Ce={cause:X+","+B,reach:Ie};g(E,j,M,oe.prev,ce,Ce),R&&Ce.reach>R.reach&&(R.reach=Ce.reach)}}}}}}function b(){var E={value:null,prev:null,next:null},j={value:null,prev:E,next:null};E.next=j,this.head=E,this.tail=j,this.length=0}function v(E,j,M){var _=j.next,q={value:M,prev:j,next:_};return j.next=q,_.prev=q,E.length++,q}function w(E,j,M){for(var _=j.next,q=0;q<M&&_!==E.tail;q++)_=_.next;j.next=_,_.prev=j,E.length-=q}function A(E){for(var j=[],M=E.head.next;M!==E.tail;)j.push(M.value),M=M.next;return j}if(!r.document)return r.addEventListener&&(u.disableWorkerMessageHandler||r.addEventListener("message",function(E){var j=JSON.parse(E.data),M=j.language,_=j.code,q=j.immediateClose;r.postMessage(u.highlight(_,u.languages[M],M)),q&&r.close()},!1)),u;var C=u.util.currentScript();C&&(u.filename=C.src,C.hasAttribute("data-manual")&&(u.manual=!0));function O(){u.manual||u.highlightAll()}if(!u.manual){var D=document.readyState;D==="loading"||D==="interactive"&&C&&C.defer?document.addEventListener("DOMContentLoaded",O):window.requestAnimationFrame?window.requestAnimationFrame(O):window.setTimeout(O,16)}return u})(e);t.exports&&(t.exports=n),typeof wg<"u"&&(wg.Prism=n)})(lf)),lf.exports}var qk=Lk();const Bk=Sg(qk);Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},Prism.languages.webmanifest=Prism.languages.json,(function(t){var e=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ ]+"+e.source+")?|"+e.source+"(?:[ ]+"+n.source+")?)",s=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-]<PLAIN>)(?:[ \t]*(?:(?![#:])<PLAIN>|:<PLAIN>))*/.source.replace(/<PLAIN>/g,function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source}),a=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function c(u,f){f=(f||"").replace(/m/g,"")+"m";var h=/([:\-,[{]\s*(?:\s<<prop>>[ \t]+)?)(?:<<value>>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<value>>/g,function(){return u});return RegExp(h,f)}t.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<<prop>>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<<prop>>/g,function(){return r})),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<<prop>>[ \t]+)?)<<key>>(?=\s*:\s)/.source.replace(/<<prop>>/g,function(){return r}).replace(/<<key>>/g,function(){return"(?:"+s+"|"+a+")"})),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:c(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:c(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:c(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:c(a),lookbehind:!0,greedy:!0},number:{pattern:c(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:e,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},t.languages.yml=t.languages.yaml})(Prism),Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+(/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source)+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:RegExp(/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)/.source+/\//.source+"(?:"+/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}/.source+"|"+/(?:\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.|\[(?:[^[\]\\\r\n]|\\.)*\])*\])*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}v[dgimyus]{0,7}/.source+")"+/(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/.source),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),Prism.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),Prism.languages.js=Prism.languages.javascript,(function(t){var e="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+e),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+e),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};t.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+e),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+e),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=t.languages.bash;for(var s=["comment","function-name","for-or-select","assign-left","parameter","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],a=r.variable[1].inside,c=0;c<s.length;c++)a[s[c]]=t.languages.bash[s[c]];t.languages.sh=t.languages.bash,t.languages.shell=t.languages.bash})(Prism);var H0={},z0;function $k(){return z0||(z0=1,Prism.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern://,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},Prism.languages.python["string-interpolation"].inside.interpolation.inside.rest=Prism.languages.python,Prism.languages.py=Prism.languages.python),H0}$k(),Prism.languages.go=Prism.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),Prism.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete Prism.languages.go["class-name"];var U0={},V0;function Ik(){return V0||(V0=1,(function(t){var e=/\b(?:abstract|assert|boolean|break|byte|case|catch|char|class|const|continue|default|do|double|else|enum|exports|extends|final|finally|float|for|goto|if|implements|import|instanceof|int|interface|long|module|native|new|non-sealed|null|open|opens|package|permits|private|protected|provides|public|record(?!\s*[(){}[\]<>=%~.:,;?+\-*/&|^])|requires|return|sealed|short|static|strictfp|super|switch|synchronized|this|throw|throws|to|transient|transitive|try|uses|var|void|volatile|while|with|yield)\b/,n=/(?:[a-z]\w*\s*\.\s*)*(?:[A-Z]\w*\s*\.\s*)*/.source,r={pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z](?:[\d_A-Z]*[a-z]\w*)?\b/.source),lookbehind:!0,inside:{namespace:{pattern:/^[a-z]\w*(?:\s*\.\s*[a-z]\w*)*(?:\s*\.)?/,inside:{punctuation:/\./}},punctuation:/\./}};t.languages.java=t.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"/,lookbehind:!0,greedy:!0},"class-name":[r,{pattern:RegExp(/(^|[^\w.])/.source+n+/[A-Z]\w*(?=\s+\w+\s*[;,=()]|\s*(?:\[[\s,]*\]\s*)?::\s*new\b)/.source),lookbehind:!0,inside:r.inside},{pattern:RegExp(/(\b(?:class|enum|extends|implements|instanceof|interface|new|record|throws)\s+)/.source+n+/[A-Z]\w*\b/.source),lookbehind:!0,inside:r.inside}],keyword:e,function:[t.languages.clike.function,{pattern:/(::\s*)[a-z_]\w*/,lookbehind:!0}],number:/\b0b[01][01_]*L?\b|\b0x(?:\.[\da-f_p+-]+|[\da-f_]+(?:\.[\da-f_p+-]+)?)\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?\d[\d_]*)?[dfl]?/i,operator:{pattern:/(^|[^.])(?:<<=?|>>>?=?|->|--|\+\+|&&|\|\||::|[?:~]|[-+*/%&|^!=<>]=?)/m,lookbehind:!0},constant:/\b[A-Z][A-Z_\d]+\b/}),t.languages.insertBefore("java","string",{"triple-quoted-string":{pattern:/"""[ \t]*[\r\n](?:(?:"|"")?(?:\\.|[^"\\]))*"""/,greedy:!0,alias:"string"},char:{pattern:/'(?:\\.|[^'\\\r\n]){1,6}'/,greedy:!0}}),t.languages.insertBefore("java","class-name",{annotation:{pattern:/(^|[^.])@\w+(?:\s*\.\s*\w+)*/,lookbehind:!0,alias:"punctuation"},generics:{pattern:/<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&)|<(?:[\w\s,.?]|&(?!&))*>)*>)*>)*>/,inside:{"class-name":r,keyword:e,punctuation:/[<>(),.:]/,operator:/[?&|]/}},import:[{pattern:RegExp(/(\bimport\s+)/.source+n+/(?:[A-Z]\w*|\*)(?=\s*;)/.source),lookbehind:!0,inside:{namespace:r.inside.namespace,punctuation:/\./,operator:/\*/,"class-name":/\w+/}},{pattern:RegExp(/(\bimport\s+static\s+)/.source+n+/(?:\w+|\*)(?=\s*;)/.source),lookbehind:!0,alias:"static",inside:{namespace:r.inside.namespace,static:/\b\w+$/,punctuation:/\./,operator:/\*/,"class-name":/\w+/}}],namespace:{pattern:RegExp(/(\b(?:exports|import(?:\s+static)?|module|open|opens|package|provides|requires|to|transitive|uses|with)\s+)(?!<keyword>)[a-z]\w*(?:\.[a-z]\w*)*\.?/.source.replace(/<keyword>/g,function(){return e.source})),lookbehind:!0,inside:{punctuation:/\./}}})})(Prism)),U0}Ik();const _r=({code:t,language:e,title:n,showCopy:r=!0,theme:s="dark",wrap:a=!1})=>{const[c,u]=Ad.useState(!1),f=I.useRef(null);I.useEffect(()=>{f.current&&Bk.highlightElement(f.current)},[t,e,s]);const h=async()=>{try{await navigator.clipboard.writeText(t),u(!0),setTimeout(()=>u(!1),2e3)}catch(A){console.error("Failed to copy text: ",A)}},g=s==="dark"?"bg-gray-900 border-gray-700":"bg-gray-50 border-gray-200",b=s==="dark"?"bg-gray-800 border-gray-700 text-gray-300":"bg-gray-100 border-gray-200 text-gray-700",v=s==="dark"?"text-gray-400 hover:text-gray-200":"text-gray-500 hover:text-gray-900",w={"--fd-code-muted":s==="dark"?"#9ca3af":"#64748b","--fd-code-string":s==="dark"?"#86efac":"#15803d","--fd-code-keyword":s==="dark"?"#c4b5fd":"#6d28d9","--fd-code-number":s==="dark"?"#fb923c":"#c2410c","--fd-code-accent":s==="dark"?"#93c5fd":"#1d4ed8"};return p.jsxs("div",{className:`flexdoc-code min-w-0 rounded-lg overflow-hidden border ${g}`,"data-code-theme":s,style:w,children:[(n||r)&&p.jsxs("div",{className:`flex items-center justify-between gap-3 px-3 sm:px-4 py-2 border-b ${b}`,children:[n&&p.jsx("span",{className:"min-w-0 truncate text-sm font-medium",children:n}),r&&p.jsx("button",{onClick:h,className:`shrink-0 flex items-center gap-1 text-xs transition-colors ${v}`,"aria-label":"Copy code to clipboard",children:c?p.jsxs(p.Fragment,{children:[p.jsx(qg,{className:"w-3 h-3"}),p.jsx("span",{children:"Copied"})]}):p.jsxs(p.Fragment,{children:[p.jsx(FA,{className:"w-3 h-3"}),p.jsx("span",{children:"Copy"})]})})]}),p.jsx("div",{className:`p-3 sm:p-4 overflow-x-auto ${s==="dark"?"bg-gray-800":"bg-white"}`,children:p.jsx("pre",{className:`m-0 text-xs sm:text-sm ${a?"whitespace-pre-wrap break-words":""} ${s==="dark"?"text-gray-100":"text-gray-800"}`,children:p.jsx("code",{ref:f,className:`language-${e} bg-transparent`,children:t})})})]})};function Hk(t){const e=Array.isArray(t.type)?t.type.join(" | "):t.type;return e?t.format?`${e} (${t.format})`:e:t.oneOf?"oneOf":t.anyOf?"anyOf":t.allOf?"allOf":t.const!==void 0?"const":"any"}const Lr=({spec:t,schema:e,theme:n,required:r=!1,level:s=0,seen:a=new Set,requiredPropsFirst:c=!1,sortPropsAlphabetically:u=!1})=>{const f={spec:t,theme:n,requiredPropsFirst:c,sortPropsAlphabetically:u};if($n.isReference(e)){if(a.has(e.$ref))return p.jsxs("div",{className:"py-1 text-sm opacity-70",children:["↳ ",p.jsx("code",{children:e.$ref.replace("#/components/schemas/","")})," (recursive reference)"]});const A=new Set(a);A.add(e.$ref);let C;try{C=$n.resolveReference(t,e.$ref)}catch{return p.jsxs("div",{className:"py-1 text-sm text-red-500",children:["Unresolved reference: ",p.jsx("code",{children:e.$ref})]})}return p.jsx(Lr,{...f,schema:C,required:r,level:s,seen:A})}const h=n==="dark"?"text-gray-400":"text-gray-600",g=n==="dark"?"border-gray-700":"border-gray-200",b=[["All of",e.allOf],["One of",e.oneOf],["Any of",e.anyOf]],v=new Set(e.required||[]),w=Object.entries(e.properties||{}).sort(([A],[C])=>{if(c){const O=Number(v.has(C))-Number(v.has(A));if(O)return O}return u?A.localeCompare(C):0});return p.jsxs("div",{className:s?`border-l-2 ${g} pl-3`:"",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2 py-1",children:[p.jsx("span",{className:n==="dark"?"text-blue-300":"text-blue-600",children:Hk(e)}),r&&p.jsx("span",{className:"rounded bg-red-100 px-2 py-0.5 text-xs text-red-700 dark:bg-red-900/30 dark:text-red-300",children:"required"}),(e.nullable||Array.isArray(e.type)&&e.type.includes("null"))&&p.jsx("span",{className:"rounded bg-gray-100 px-2 py-0.5 text-xs text-gray-700 dark:bg-gray-700 dark:text-gray-300",children:"nullable"}),e.deprecated&&p.jsx("span",{className:"rounded bg-orange-100 px-2 py-0.5 text-xs text-orange-700",children:"deprecated"}),e.readOnly&&p.jsx("span",{className:"text-xs opacity-60",children:"readOnly"}),e.writeOnly&&p.jsx("span",{className:"text-xs opacity-60",children:"writeOnly"})]}),e.description&&p.jsx("p",{className:`mt-1 text-sm leading-relaxed ${h}`,children:e.description}),e.enum&&p.jsxs("p",{className:`mt-1 text-xs ${h}`,children:["Allowed: ",e.enum.map(String).join(", ")]}),e.const!==void 0&&p.jsxs("p",{className:`mt-1 text-xs ${h}`,children:["Constant: ",JSON.stringify(e.const)]}),e.default!==void 0&&p.jsxs("p",{className:`mt-1 text-xs ${h}`,children:["Default: ",JSON.stringify(e.default)]}),(e.example!==void 0||e.examples?.length)&&p.jsx("div",{className:"mt-2",children:p.jsx(_r,{code:JSON.stringify(e.example??e.examples?.[0],null,2),language:"json",title:"Example",showCopy:!1,theme:n,wrap:!0})}),e.items&&p.jsxs("div",{className:"mt-3",children:[p.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide opacity-60",children:"Items"}),p.jsx(Lr,{...f,schema:e.items,level:s+1,seen:a})]}),b.map(([A,C])=>C?.length?p.jsxs("div",{className:"mt-3",children:[p.jsx("div",{className:"mb-2 text-xs font-semibold uppercase tracking-wide opacity-60",children:A}),p.jsx("div",{className:"space-y-3",children:C.map((O,D)=>p.jsx(Lr,{...f,schema:O,level:s+1,seen:a},D))})]},A):null),w.length>0&&p.jsx("div",{className:"mt-3 space-y-3",children:w.map(([A,C])=>p.jsxs("div",{children:[p.jsx("div",{className:"font-mono text-sm font-medium",children:A}),p.jsx(Lr,{...f,schema:C,required:v.has(A),level:s+1,seen:a})]},A))}),e.additionalProperties&&typeof e.additionalProperties=="object"&&p.jsxs("div",{className:"mt-3",children:[p.jsx("div",{className:"mb-1 text-xs font-semibold uppercase tracking-wide opacity-60",children:"Additional properties"}),p.jsx(Lr,{...f,schema:e.additionalProperties,level:s+1,seen:a})]})]})};function wn(t){return{preRequest:t?.preRequest||"",tests:t?.tests||""}}function zk(t){return{...t,query:t.query?.map(e=>({...e})),headers:t.headers?.map(e=>({...e})),urlencoded:t.urlencoded?.map(e=>({...e})),formData:t.formData?.map(e=>({...e})),binary:t.binary?{...t.binary}:void 0,graphql:t.graphql?{...t.graphql}:void 0,auth:t.auth?{...t.auth}:void 0}}function Lo(t){return Object.assign(Object.create(null),t)}function Zt(t){if(typeof t=="string")return t;if(t instanceof Error)return t.message;try{return JSON.stringify(t)}catch{return String(t)}}function el(t,e){if(Object.is(t,e))return!0;if(typeof t!=typeof e||t===null||e===null)return!1;if(Array.isArray(t))return Array.isArray(e)&&t.length===e.length&&t.every((n,r)=>el(n,e[r]));if(typeof t=="object"&&typeof e=="object"){const n=t,r=e,s=Object.keys(n),a=Object.keys(r);return s.length===a.length&&s.every(c=>Object.prototype.hasOwnProperty.call(r,c)&&el(n[c],r[c]))}return!1}function ui(t){throw new Error(t)}function Uk(t){const e=h=>{Object.is(t,h)||ui(`expected ${Zt(t)} to equal ${Zt(h)}`)},n=h=>{el(t,h)||ui(`expected ${Zt(t)} to deeply equal ${Zt(h)}`)},r=h=>{(typeof t=="string"?t.includes(String(h)):Array.isArray(t)&&t.some(b=>el(b,h)))||ui(`expected ${Zt(t)} to include ${Zt(h)}`)},s=(h,...g)=>{(!t||typeof t!="object"||!Object.prototype.hasOwnProperty.call(t,h))&&ui(`expected value to have property ${h}`),g.length>0&&!el(t[h],g[0])&&ui(`expected property ${h} to equal ${Zt(g[0])}`)},f={above:h=>{(typeof t!="number"||t<=h)&&ui(`expected ${Zt(t)} to be above ${h}`)},below:h=>{(typeof t!="number"||t>=h)&&ui(`expected ${Zt(t)} to be below ${h}`)},oneOf:h=>{h.some(g=>el(t,g))||ui(`expected ${Zt(t)} to be one of ${Zt(h)}`)}};return Object.defineProperties(f,{ok:{get:()=>(t||ui(`expected ${Zt(t)} to be truthy`),!0)},true:{get:()=>(t!==!0&&ui(`expected ${Zt(t)} to be true`),!0)},false:{get:()=>(t!==!1&&ui(`expected ${Zt(t)} to be false`),!0)}}),{to:{equal:e,eql:n,include:r,match:h=>{(typeof t!="string"||!h.test(t))&&ui(`expected ${Zt(t)} to match ${h}`)},have:{property:s},be:f}}}function af(t,e){return t.findIndex(n=>n.key.toLowerCase()===e.toLowerCase())}function Vk(t){const e=()=>t.headers||(t.headers=[]),n=(r,s)=>{const a=e(),c=af(a,r),u={key:r,value:String(s),enabled:!0};c>=0?a[c]=u:a.push(u)};return{get(r){const s=af(e(),r);return s>=0?e()[s].value:void 0},has(r){return af(e(),r)>=0},set:n,upsert({key:r,value:s}){n(r,s)},remove(r){t.headers=e().filter(s=>s.key.toLowerCase()!==r.toLowerCase())},toObject(){const r={};for(const s of e())s.enabled!==!1&&(r[s.key]=s.value);return r}}}function Fk(t){return{get(e){return t.find(([n])=>n.toLowerCase()===e.toLowerCase())?.[1]},has(e){return t.some(([n])=>n.toLowerCase()===e.toLowerCase())},toObject(){const e={};for(const[n,r]of t)e[n]=r;return e}}}async function F0(t){const e=zk(t.draft),n=Lo(t.variables||{}),r=Lo(t.collectionVariables||{}),s=Lo(t.externalVariables||{}),a=Lo(t.environmentVariables||{}),c=[],u=[],f=[],h=[],g=[],b=M=>{Object.prototype.hasOwnProperty.call(a,M)?n[M]=a[M]:Object.prototype.hasOwnProperty.call(s,M)?n[M]=s[M]:Object.prototype.hasOwnProperty.call(r,M)?n[M]=r[M]:delete n[M]},v={get(M){return a[M]},has(M){return Object.prototype.hasOwnProperty.call(a,M)},set(M,_){const q=String(_);a[M]=q,n[M]=q,u.push({action:"set",key:M,value:q})},unset(M){delete a[M],b(M),u.push({action:"unset",key:M})},replaceIn(M){return M.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(_,q)=>{const R=q.trim();return Object.prototype.hasOwnProperty.call(a,R)?a[R]:_})}},w={get(M){return r[M]},has(M){return Object.prototype.hasOwnProperty.call(r,M)},set(M,_){const q=String(_);r[M]=q,b(M),c.push({action:"set",key:M,value:q})},unset(M){delete r[M],b(M),c.push({action:"unset",key:M})},replaceIn(M){return M.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(_,q)=>{const R=q.trim();return Object.prototype.hasOwnProperty.call(r,R)?r[R]:_})}},A={get(M){return n[M]},has(M){return Object.prototype.hasOwnProperty.call(n,M)},set(M,_){n[M]=String(_)},unset(M){delete n[M]},replaceIn(M){return M.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(_,q)=>{const R=q.trim();return Object.prototype.hasOwnProperty.call(n,R)?n[R]:_})}},C={get raw(){return e.body||""},set raw(M){e.body=String(M),e.bodyMode="raw"}},O={get method(){return e.method},set method(M){e.method=String(M)},get url(){return e.url},set url(M){e.url=String(M)},headers:Vk(e),body:C},D=t.response?{code:t.response.status,status:t.response.statusText,responseTime:t.response.responseTime,headers:Fk(t.response.headers),text:()=>t.response?.body||"",json:()=>JSON.parse(t.response?.body||"")}:void 0,E={request:O,response:D,environment:v,collection:w,variables:A,expect:Uk,test(M,_){if(t.phase!=="tests")throw new Error("flex.test is only available in post-response test scripts.");const q=Promise.resolve().then(_).then(()=>{f.push({name:M,passed:!0})}).catch(R=>{f.push({name:M,passed:!1,error:R instanceof Error?R.message:String(R)})});g.push(q)}},j={log:(...M)=>h.push(M.map(Zt).join(" ")),info:(...M)=>h.push(M.map(Zt).join(" ")),warn:(...M)=>h.push(`WARN ${M.map(Zt).join(" ")}`),error:(...M)=>h.push(`ERROR ${M.map(Zt).join(" ")}`)};try{return await new Function("flex","console",`"use strict"; return (async () => {
|
|
46
46
|
${t.script}
|
|
47
|
-
})();`)(
|
|
48
|
-
`),g=j,h="multipart"}else if(b==="binary"){const j=n.binary;if(!j?.file)throw new Error("Binary body needs a file selection.");f=`[file: ${j.fileName||j.file.name}]`,g=j.file,A||u.push(["Content-Type",C||j.contentType||j.file.type||"application/octet-stream"]),h="binary"}else if(b==="graphql"){const j=n.graphql?.query||"",D=n.graphql?.variables?.trim()||"";let M={};if(D)try{M=JSON.parse(D)}catch{throw new Error("GraphQL variables must be valid JSON.")}f=JSON.stringify({query:j,variables:M}),g=f,A||u.push(["Content-Type",C||"application/json"]),h="json"}else{f=n.body||"",g=f;const j=b==="json"?"application/json":void 0;!A&&(C||j)&&u.push(["Content-Type",C||j]),h=b==="json"||(A||C||j)?.includes("json")?"json":"text"}}const v=Pk(u);return{url:Vk(s,c),method:r,headers:v,headerEntries:u,body:f,bodyKind:h,init:{method:r,headers:u,body:g}}}function Qk(t){const e=Yk(t),n=Fk(t.url),r=t.bodyKind==="binary"&&typeof File<"u"&&t.init.body instanceof File?t.init.body:void 0;return{method:t.method,url:n.url,query:n.query,headers:e.map(([s,a])=>({key:s,value:a})),body:t.body,contentType:of(e,"Content-Type"),bodyMode:t.bodyKind==="json"?"json":t.bodyKind==="form"?"urlencoded":t.bodyKind==="multipart"?"formdata":t.bodyKind==="binary"?"binary":t.body?"raw":"none",binary:t.bodyKind==="binary"?{file:r,fileName:r?.name,contentType:of(e,"Content-Type")}:void 0,urlencoded:t.bodyKind==="form"&&t.body?[...new URLSearchParams(t.body).entries()].map(([s,a])=>({key:s,value:a,enabled:!0})):void 0,auth:{type:"none"}}}function Y0(t,e={}){return Jk(t,e)}function da(t){return V0(t)}function Wk(t){return F0(t)}function Zk(t,e){return P0(t,e)}function eC(t){return Qk(t)}function tC(t,e,n){return t.paths[e]?.[n.toLowerCase()]}function nC(t,e){const n=t.components?.securitySchemes?.[e];if(!n)return;if(!("$ref"in n))return n;const r=n.$ref,s="#/components/securitySchemes/";if(!r.startsWith(s))return;const a=t.components?.securitySchemes?.[decodeURIComponent(r.slice(s.length))];return a&&!("$ref"in a)?a:void 0}function iC(t,e,n,r){const a=tC(t,e,n)?.security??t.security??[];if(!a.length)return;const c=a.find(f=>{const h=Object.keys(f);return h.length===1&&!!r[h[0]]});if(c)return c;const u=a.find(f=>{const h=Object.keys(f);return h.length>0&&h.every(g=>!!r[g])});return u||(a.find(f=>Object.keys(f).length===0)??a[0])}function rC(t,e,n=[]){if(e){if(t.type==="http"&&t.scheme?.toLowerCase()==="bearer")return{type:"bearer",token:e};if(t.type==="http"&&t.scheme?.toLowerCase()==="basic"){const r=e.indexOf(":");return r>=0?{type:"basic",username:e.slice(0,r),password:e.slice(r+1)}:{type:"basic",username:e,password:""}}if(t.type==="apiKey"&&(t.in==="header"||t.in==="query")&&t.name)return{type:"apiKey",key:t.name,value:e,in:t.in};if(t.type==="openIdConnect")return{type:"oauth2",accessToken:e,grantType:"accessToken",scopes:n};if(t.type==="oauth2"){const r=t.flows,s=r?.authorizationCode?["authorizationCode",r.authorizationCode]:r?.clientCredentials?["clientCredentials",r.clientCredentials]:r?.password?["password",r.password]:r?.implicit?["implicit",r.implicit]:void 0,a=s?.[1];return{type:"oauth2",accessToken:e,grantType:s?.[0]||"accessToken",authorizationUrl:a?.authorizationUrl,tokenUrl:a?.tokenUrl,scopes:n.length?n:Object.keys(a?.scopes||{})}}}}function K0(t,e){return{...t,headers:t.headers?.filter(n=>n.key.toLowerCase()!==e.toLowerCase())}}function sC(t,e){return{...t,query:t.query?.filter(n=>n.key!==e)}}function lC(t,e,n,r,s){let a=eC(s);const c=iC(t,e,n,r.auth||{});if(!c||Object.keys(c).length!==1)return a;const u=Object.keys(c)[0],f=nC(t,u),h=r.auth?.[u]||"";if(!f)return a;if(!h)return{...a,auth:{type:"inherit"}};const g=rC(f,h,c[u]||[]);return g?(g.type==="bearer"||g.type==="oauth2"||g.type==="basic"?a=K0(a,"Authorization"):g.type==="apiKey"&&g.in==="header"?a=K0(a,g.key):g.type==="apiKey"&&g.in==="query"&&(a=sC(a,g.key)),{...a,auth:g}):a}function aC(t,e,n,r,s){const a=L0(t,e,n,r);return{request:lC(t,e,n,r,a),serverUrl:r.serverUrl||s}}function Bo(t){if(t)return t.type==="bearer"?{...t,token:""}:t.type==="oauth2"?{...t,accessToken:"",...t.clientSecret!==void 0?{clientSecret:""}:{},...t.password!==void 0?{password:""}:{},...t.refreshToken!==void 0?{refreshToken:""}:{},scopes:t.scopes?[...t.scopes]:void 0}:t.type==="basic"||t.type==="digest"||t.type==="ntlm"?{...t,password:""}:t.type==="apiKey"?{...t,value:""}:t.type==="hawk"?{...t,key:""}:t.type==="oauth1"?{...t,consumerSecret:"",...t.token!==void 0?{token:""}:{},...t.tokenSecret!==void 0?{tokenSecret:""}:{}}:t.type==="awsv4"?{...t,secretKey:"",...t.sessionToken!==void 0?{sessionToken:""}:{}}:{...t}}const cf="[REDACTED]";function oC(t){return t.trim().toLowerCase().replace(/[^a-z0-9]/g,"")}function uf(t){const e=oC(t);return e.includes("authorization")||e.includes("cookie")||e.includes("token")||e.includes("signature")||e.includes("secret")||e.includes("password")||e.endsWith("key")}function G0(t){return t?.map(e=>uf(e.key)?{...e,value:cf}:e)}function cC(t){return t?.map(e=>uf(e[0])?[e[0],cf]:e)}function X0(t){const e=t.indexOf("#"),n=e>=0?t.slice(e):"",r=e>=0?t.slice(0,e):t,s=r.indexOf("?");if(s<0)return t;const a=r.slice(0,s),c=r.slice(s+1).split("&").map(u=>{if(!u)return u;const f=u.indexOf("="),h=f>=0?u.slice(0,f):u;let g=h;try{g=decodeURIComponent(h.replace(/\+/g," "))}catch{}return uf(g)?`${h}=${encodeURIComponent(cf)}`:u}).join("&");return`${a}?${c}${n}`}function uC(t,e){const n={...t,url:X0(t.url),query:G0(t.query),headers:G0(t.headers),auth:Bo(t.auth)};return e&&(delete n.body,delete n.urlencoded,delete n.formData,delete n.binary,delete n.graphql),n}const J0=new WeakMap;function dC(t){const e=J0.get(t.history);if(e&&e.historyBodies===t.historyBodies)return e.entries;const n=t.history.map(r=>{const s=t.historyBodies===!1&&r.transport!=="browser",a={...r,resolvedUrl:X0(r.resolvedUrl),request:uC(r.request,s),responseHeaders:cC(r.responseHeaders)};return s&&(delete a.responseBody,delete a.responseBodyTruncated,delete a.requestBodyTruncated),a});return J0.set(t.history,{historyBodies:t.historyBodies,entries:n}),n}function Q0(t){const e=t.credentialStorage!==void 0&&t.credentialStorage!=="remember";return{...t,...e?{collections:t.collections.map(n=>({...n,auth:Bo(n.auth)})),folders:t.folders.map(n=>({...n,auth:Bo(n.auth)})),requests:t.requests.map(n=>({...n,request:{...n.request,auth:Bo(n.request.auth)}}))}:{},history:dC(t)}}const fC="flexdoc-api-client",hC=1,tl="workspaces",pC="My Collection",W0=100,Z0=256*1024,mC=256*1024;function fa(){return new Date().toISOString()}function On(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Xe(t,e){return typeof t[e]=="string"}function $o(t,e){const n=t[e];return n===void 0||typeof n=="number"&&Number.isFinite(n)}function Io(t){return!On(t)||!Xe(t,"key")||!Xe(t,"value")?!1:t.enabled===void 0||typeof t.enabled=="boolean"}function gC(t){if(!Io(t))return!1;const e=t;return!(e.type!==void 0&&e.type!=="text"&&e.type!=="file"||e.fileName!==void 0&&typeof e.fileName!="string"||e.contentType!==void 0&&typeof e.contentType!="string"||e.file!==void 0&&typeof File<"u"&&!(e.file instanceof File))}function yC(t){return!(!On(t)||t.fileName!==void 0&&typeof t.fileName!="string"||t.contentType!==void 0&&typeof t.contentType!="string"||t.file!==void 0&&typeof File<"u"&&!(t.file instanceof File))}function Ho(t){if(!On(t)||typeof t.type!="string")return!1;if(t.type==="none"||t.type==="inherit")return!0;if(t.type==="bearer")return Xe(t,"token");if(t.type==="oauth2"){if(!Xe(t,"accessToken")||t.grantType!==void 0&&(typeof t.grantType!="string"||!["accessToken","authorizationCode","clientCredentials","password","implicit"].includes(t.grantType))||t.clientAuthentication!==void 0&&t.clientAuthentication!=="body"&&t.clientAuthentication!=="basic")return!1;for(const e of["authorizationUrl","tokenUrl","clientId","clientSecret","redirectUri","username","password","refreshToken"])if(t[e]!==void 0&&typeof t[e]!="string")return!1;return t.scopes===void 0||Array.isArray(t.scopes)&&t.scopes.every(e=>typeof e=="string")}return t.type==="basic"||t.type==="digest"?Xe(t,"username")&&Xe(t,"password"):t.type==="apiKey"?Xe(t,"key")&&Xe(t,"value")&&(t.in==="header"||t.in==="query"||t.in==="cookie"):t.type==="hawk"?Xe(t,"id")&&Xe(t,"key")&&(t.algorithm===void 0||t.algorithm==="sha1"||t.algorithm==="sha256")&&(t.ext===void 0||typeof t.ext=="string"):t.type==="ntlm"?Xe(t,"username")&&Xe(t,"password")&&(t.domain===void 0||typeof t.domain=="string")&&(t.workstation===void 0||typeof t.workstation=="string"):t.type==="oauth1"?Xe(t,"consumerKey")&&Xe(t,"consumerSecret")&&(t.token===void 0||typeof t.token=="string")&&(t.tokenSecret===void 0||typeof t.tokenSecret=="string")&&(t.realm===void 0||typeof t.realm=="string")&&(t.signatureMethod===void 0||["HMAC-SHA1","HMAC-SHA256","PLAINTEXT"].includes(String(t.signatureMethod))):t.type==="awsv4"?Xe(t,"accessKey")&&Xe(t,"secretKey")&&Xe(t,"region")&&Xe(t,"service")&&(t.sessionToken===void 0||typeof t.sessionToken=="string"):!1}function df(t){return`flexdoc:credentials:v1:${t}`}function bC(t){const e=[];for(const n of t.collections)e.push(["c",n.id,n.auth]);for(const n of t.folders)e.push(["f",n.id,n.auth]);for(const n of t.requests)n.request.auth&&e.push(["r",n.id,n.request.auth]);for(const n of t.history)n.request.auth&&e.push(["h",n.id,n.request.auth]);return e}function xC(t){const e=new Map;if(typeof sessionStorage>"u")return e;try{const n=JSON.parse(sessionStorage.getItem(df(t))||"[]");if(!Array.isArray(n))return e;for(const r of n)!Array.isArray(r)||r.length!==3||!["c","f","r","h"].includes(r[0])||typeof r[1]!="string"||!Ho(r[2])||e.set(`${r[0]}:${r[1]}`,r[2])}catch{}return e}function vC(t,e){if(e.credentialStorage!=="session")return e;const n=xC(t);return n.size===0?e:{...e,collections:e.collections.map(r=>({...r,auth:n.get(`c:${r.id}`)||r.auth})),folders:e.folders.map(r=>({...r,auth:n.get(`f:${r.id}`)||r.auth})),requests:e.requests.map(r=>({...r,request:{...r.request,auth:n.get(`r:${r.id}`)||r.request.auth}})),history:e.history.map(r=>({...r,request:{...r.request,auth:n.get(`h:${r.id}`)||r.request.auth}}))}}function wC(t,e){if(!(typeof sessionStorage>"u"))try{e.credentialStorage==="session"?sessionStorage.setItem(df(t),JSON.stringify(bC(e))):sessionStorage.removeItem(df(t))}catch{}}function ey(t){return!On(t)||!Xe(t,"method")||!Xe(t,"url")||t.query!==void 0&&(!Array.isArray(t.query)||!t.query.every(Io))||t.headers!==void 0&&(!Array.isArray(t.headers)||!t.headers.every(Io))||t.body!==void 0&&typeof t.body!="string"||t.contentType!==void 0&&typeof t.contentType!="string"||t.bodyMode!==void 0&&!["none","raw","json","urlencoded","formdata","binary","graphql"].includes(String(t.bodyMode))||t.urlencoded!==void 0&&(!Array.isArray(t.urlencoded)||!t.urlencoded.every(Io))||t.formData!==void 0&&(!Array.isArray(t.formData)||!t.formData.every(gC))||t.binary!==void 0&&!yC(t.binary)||t.graphql!==void 0&&(!On(t.graphql)||!Xe(t.graphql,"query")||!Xe(t.graphql,"variables"))||t.hostExecution!==void 0&&(!On(t.hostExecution)||t.hostExecution.certificateId!==void 0&&typeof t.hostExecution.certificateId!="string"||t.hostExecution.cookieJar!==void 0&&t.hostExecution.cookieJar!=="session"||t.hostExecution.preferHostExecution!==void 0&&typeof t.hostExecution.preferHostExecution!="boolean")?!1:t.auth===void 0||Ho(t.auth)}function ty(t){return On(t)&&Xe(t,"id")&&Xe(t,"key")&&Xe(t,"value")&&(t.enabled===void 0||typeof t.enabled=="boolean")}function SC(t){return!On(t)||!Xe(t,"id")||!Xe(t,"name")||!Xe(t,"createdAt")||!Xe(t,"updatedAt")?null:{id:t.id,name:t.name,auth:Ho(t.auth)?t.auth:{type:"none"},variables:Array.isArray(t.variables)?t.variables.filter(ty):[],createdAt:t.createdAt,updatedAt:t.updatedAt}}function AC(t){return!On(t)||!Xe(t,"id")||!Xe(t,"collectionId")||t.parentFolderId!==void 0&&typeof t.parentFolderId!="string"||!Xe(t,"name")||!Xe(t,"createdAt")||!Xe(t,"updatedAt")?null:{id:t.id,collectionId:t.collectionId,parentFolderId:t.parentFolderId,name:t.name,auth:Ho(t.auth)?t.auth:{type:"inherit"},createdAt:t.createdAt,updatedAt:t.updatedAt}}function kC(t,e){const n=t.map(AC).filter(s=>s!==null).filter(s=>e.has(s.collectionId)),r=new Map(n.map(s=>[s.id,s]));for(const s of n){if(!s.parentFolderId)continue;const a=r.get(s.parentFolderId);(!a||a.collectionId!==s.collectionId||a.id===s.id)&&(s.parentFolderId=void 0)}for(const s of n){if(!s.parentFolderId)continue;const a=new Set([s.id]);let c=s.parentFolderId;for(;c;){if(a.has(c)){s.parentFolderId=void 0;break}a.add(c),c=r.get(c)?.parentFolderId}}return n}function ny(t){if(!(!On(t)||!Xe(t,"preRequest")||!Xe(t,"tests")))return{preRequest:t.preRequest,tests:t.tests}}function CC(t){if(!On(t)||!Xe(t,"id")||!Xe(t,"collectionId")||t.folderId!==void 0&&typeof t.folderId!="string"||!Xe(t,"name")||!ey(t.request)||!Xe(t,"createdAt")||!Xe(t,"updatedAt"))return null;const e=ny(t.scripts);return{id:t.id,collectionId:t.collectionId,folderId:t.folderId,name:t.name,request:Ei(t.request),...e?{scripts:e}:{},createdAt:t.createdAt,updatedAt:t.updatedAt}}function NC(t){return!On(t)||!Xe(t,"id")||!Xe(t,"name")||!Array.isArray(t.variables)||!Xe(t,"createdAt")||!Xe(t,"updatedAt")?null:{id:t.id,name:t.name,variables:t.variables.filter(ty),createdAt:t.createdAt,updatedAt:t.updatedAt}}function TC(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&typeof t[1]=="string"}function jC(t){return!On(t)||!Xe(t,"name")||typeof t.passed!="boolean"||t.error!==void 0&&typeof t.error!="string"?null:{name:t.name,passed:t.passed,error:t.error}}function EC(t){if(!On(t)||!Xe(t,"id")||!ey(t.request)||!Xe(t,"executedMethod")||!Xe(t,"resolvedUrl")||!$o(t,"status")||t.statusText!==void 0&&typeof t.statusText!="string"||!$o(t,"responseTime")||t.responseHeaders!==void 0&&(!Array.isArray(t.responseHeaders)||!t.responseHeaders.every(TC))||t.responseBody!==void 0&&typeof t.responseBody!="string"||t.responseBodyTruncated!==void 0&&typeof t.responseBodyTruncated!="boolean"||t.requestBodyTruncated!==void 0&&typeof t.requestBodyTruncated!="boolean"||t.runId!==void 0&&typeof t.runId!="string"||t.runName!==void 0&&typeof t.runName!="string"||!$o(t,"runIndex")||!$o(t,"runTotal")||t.runPassed!==void 0&&typeof t.runPassed!="boolean"||t.runCancelled!==void 0&&typeof t.runCancelled!="boolean"||t.error!==void 0&&typeof t.error!="string"||t.scriptError!==void 0&&typeof t.scriptError!="string"||!Xe(t,"createdAt"))return null;const e=ny(t.scripts),n=Array.isArray(t.scriptTests)?t.scriptTests.map(jC).filter(s=>s!==null):[],r=Array.isArray(t.scriptLogs)?t.scriptLogs.filter(s=>typeof s=="string"):[];return{id:t.id,collectionId:typeof t.collectionId=="string"?t.collectionId:void 0,folderId:typeof t.folderId=="string"?t.folderId:void 0,request:Ei(t.request),...e?{scripts:e}:{},executedMethod:t.executedMethod,resolvedUrl:t.resolvedUrl,status:t.status,statusText:t.statusText,responseTime:t.responseTime,transport:t.transport==="browser"||t.transport==="api-host"?t.transport:void 0,responseHeaders:Array.isArray(t.responseHeaders)?t.responseHeaders.map(([s,a])=>[s,a]):void 0,responseBody:typeof t.responseBody=="string"?t.responseBody:void 0,responseBodyTruncated:t.responseBodyTruncated===!0?!0:void 0,requestBodyTruncated:t.requestBodyTruncated===!0?!0:void 0,runId:typeof t.runId=="string"?t.runId:void 0,runName:typeof t.runName=="string"?t.runName:void 0,runIndex:typeof t.runIndex=="number"?t.runIndex:void 0,runTotal:typeof t.runTotal=="number"?t.runTotal:void 0,runPassed:typeof t.runPassed=="boolean"?t.runPassed:void 0,runCancelled:t.runCancelled===!0?!0:void 0,error:t.error,...n.length?{scriptTests:n}:{},...r.length?{scriptLogs:r}:{},scriptError:t.scriptError,createdAt:t.createdAt}}function iy(t){const e=Object.create(null);for(const n of t){const r=n.key.trim();n.enabled===!1||!r||(e[r]=n.value)}return e}function Sn(t){const e=globalThis.crypto?.randomUUID?.();return e?`${t}-${e}`:`${t}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ry(t,e){const n=e?.trim()||"unknown-host",r=t?.trim()||"untitled";return`flexdoc:${encodeURIComponent(n)}:${encodeURIComponent(r)}`}function Ei(t){const e=t.auth?t.auth.type==="oauth2"?{...t.auth,scopes:t.auth.scopes?[...t.auth.scopes]:void 0}:{...t.auth}:void 0;return{...t,query:t.query?.map(n=>({...n})),headers:t.headers?.map(n=>({...n})),urlencoded:t.urlencoded?.map(n=>({...n})),formData:t.formData?.map(n=>({...n,file:void 0})),binary:t.binary?{...t.binary,file:void 0}:void 0,graphql:t.graphql?{...t.graphql}:void 0,auth:e,hostExecution:t.hostExecution?{...t.hostExecution}:void 0}}function nl(){const t=fa();return{version:6,credentialStorage:"session",collections:[{id:Sn("collection"),name:pC,auth:{type:"none"},variables:[],createdAt:t,updatedAt:t}],folders:[],requests:[],environments:[],history:[]}}function sy(t){if(!On(t)||![1,2,3,4,5,6].includes(t.version))return nl();const e=(Array.isArray(t.collections)?t.collections:[]).map(SC).filter(h=>h!==null);if(e.length===0)return nl();const n=new Set(e.map(h=>h.id)),r=kC(Array.isArray(t.folders)?t.folders:[],n),s=new Map(r.map(h=>[h.id,h])),a=(Array.isArray(t.requests)?t.requests:[]).map(CC).filter(h=>h!==null).filter(h=>n.has(h.collectionId)).map(h=>h.folderId?s.get(h.folderId)?.collectionId===h.collectionId?h:{...h,folderId:void 0}:h);if(t.version===1)return{version:6,collections:e,folders:r,requests:a,environments:[],history:[]};const c=(Array.isArray(t.environments)?t.environments:[]).map(NC).filter(h=>h!==null),u=typeof t.activeEnvironmentId=="string"&&c.some(h=>h.id===t.activeEnvironmentId)?t.activeEnvironmentId:void 0,f=(t.version===4||t.version===5||t.version===6)&&Array.isArray(t.history)?t.history.map(EC).filter(h=>h!==null).slice(0,W0):[];return{version:6,collections:e,folders:r,requests:a,environments:c,activeEnvironmentId:u,credentialStorage:t.credentialStorage==="session"||t.credentialStorage==="remember"||t.credentialStorage==="never"?t.credentialStorage:void 0,historyBodies:typeof t.historyBodies=="boolean"?t.historyBodies:void 0,history:f}}function OC(t){let e=mC,n=!1;const r=a=>{if(a.length<=e)return e-=a.length,a;const c=a.slice(0,e);return e=0,n=!0,c},s={...t};return s.body!==void 0&&(s.body=r(s.body)),s.graphql&&(s.graphql={query:r(s.graphql.query),variables:r(s.graphql.variables)}),s.urlencoded&&(s.urlencoded=s.urlencoded.map(a=>({...a,value:r(a.value)}))),s.formData&&(s.formData=s.formData.map(a=>({...a,value:r(a.value)}))),{request:s,truncated:n}}function ly(t,e){const n=e.responseBody===void 0?void 0:e.responseBody.slice(0,Z0),r=e.responseBodyTruncated===!0||(e.responseBody?.length||0)>Z0,s=OC(Ei(e.request)),a={id:Sn("history"),collectionId:e.collectionId,folderId:e.folderId,request:s.request,...s.truncated?{requestBodyTruncated:!0}:{},...e.scripts?{scripts:wn(e.scripts)}:{},executedMethod:e.executedMethod,resolvedUrl:e.resolvedUrl,status:e.status,statusText:e.statusText,responseTime:e.responseTime,transport:e.transport,...e.responseHeaders?.length?{responseHeaders:e.responseHeaders.map(([c,u])=>[c,u])}:{},...n!==void 0?{responseBody:n,...r?{responseBodyTruncated:!0}:{}}:{},runId:e.runId,runName:e.runName,runIndex:e.runIndex,runTotal:e.runTotal,runPassed:e.runPassed,...e.runCancelled?{runCancelled:!0}:{},error:e.error,...e.scriptTests?.length?{scriptTests:e.scriptTests.map(c=>({...c}))}:{},...e.scriptLogs?.length?{scriptLogs:[...e.scriptLogs]}:{},scriptError:e.scriptError,createdAt:fa()};return{...t,history:[a,...t.history].slice(0,W0)}}function ay(t,e,n,r={type:"none"}){if(r.type!=="inherit")return{...r};const s=new Map(t.folders.map(f=>[f.id,f])),a=new Set;let c=n?s.get(n):void 0;for(;c&&c.collectionId===e&&!a.has(c.id);){if(a.add(c.id),c.auth.type!=="inherit")return{...c.auth};c=c.parentFolderId?s.get(c.parentFolderId):void 0}const u=t.collections.find(f=>f.id===e);return u&&u.auth.type!=="inherit"?{...u.auth}:{type:"none"}}function oy(t,e){const n=t.collections.find(r=>r.id===e);return iy(n?.variables||[])}function ff(t){const e=t.environments.find(n=>n.id===t.activeEnvironmentId);return iy(e?.variables||[])}function hf(t,e){if(!t.activeEnvironmentId||e.length===0)return t;const n=t.environments.findIndex(u=>u.id===t.activeEnvironmentId);if(n<0)return t;let s=t.environments[n].variables.map(u=>({...u})),a=!1;for(const u of e){const f=u.key.trim();if(!f)continue;if(u.action==="unset"){const b=s.filter(v=>v.key.trim()!==f);b.length!==s.length&&(s=b,a=!0);continue}const h=s.map((b,v)=>b.key.trim()===f?v:-1).filter(b=>b>=0),g=u.value||"";if(h.length>0){const b=h[0];s[b]={...s[b],key:f,value:g,enabled:!0},h.length>1&&(s=s.filter((v,w)=>w===b||v.key.trim()!==f))}else s.push({id:Sn("variable"),key:f,value:g,enabled:!0});a=!0}if(!a)return t;const c=t.environments.map((u,f)=>f===n?{...u,variables:s,updatedAt:fa()}:u);return{...t,environments:c}}function cy(t,e,n){if(!e||n.length===0)return t;const r=t.collections.findIndex(f=>f.id===e);if(r<0)return t;let a=t.collections[r].variables.map(f=>({...f})),c=!1;for(const f of n){const h=f.key.trim();if(!h)continue;if(f.action==="unset"){const v=a.filter(w=>w.key.trim()!==h);v.length!==a.length&&(a=v,c=!0);continue}const g=a.map((v,w)=>v.key.trim()===h?w:-1).filter(v=>v>=0),b=f.value||"";if(g.length>0){const v=g[0];a[v]={...a[v],key:h,value:b,enabled:!0},g.length>1&&(a=a.filter((w,A)=>A===v||w.key.trim()!==h))}else a.push({id:Sn("variable"),key:h,value:b,enabled:!0});c=!0}if(!c)return t;const u=t.collections.map((f,h)=>h===r?{...f,variables:a,updatedAt:fa()}:f);return{...t,collections:u}}function MC(t,e){return{...t,environments:t.environments.filter(n=>n.id!==e),activeEnvironmentId:t.activeEnvironmentId===e?void 0:t.activeEnvironmentId}}function RC(t,e){const n=t.folders.find(s=>s.id===e);if(!n)return t;const r=fa();return{...t,folders:t.folders.filter(s=>s.id!==e).map(s=>s.parentFolderId===e?{...s,parentFolderId:n.parentFolderId,updatedAt:r}:s),requests:t.requests.map(s=>s.folderId===e?{...s,folderId:n.parentFolderId,updatedAt:r}:s)}}function DC(t,e){const n=t.collections.filter(r=>r.id!==e);return n.length===0?{...nl(),environments:t.environments,activeEnvironmentId:t.activeEnvironmentId,credentialStorage:t.credentialStorage,history:t.history}:{...t,collections:n,folders:t.folders.filter(r=>r.collectionId!==e),requests:t.requests.filter(r=>r.collectionId!==e)}}function uy(){return typeof indexedDB>"u"?Promise.resolve(null):new Promise((t,e)=>{const n=indexedDB.open(fC,hC);n.onupgradeneeded=()=>{const r=n.result;r.objectStoreNames.contains(tl)||r.createObjectStore(tl)},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error||new Error("Unable to open FlexDoc API Client storage"))})}async function dy(t){const e=await uy();if(!e)return nl();try{return await new Promise((n,r)=>{const a=e.transaction(tl,"readonly").objectStore(tl).get(t);a.onsuccess=()=>n(vC(t,sy(a.result))),a.onerror=()=>r(a.error||new Error("Unable to load FlexDoc API Client workspace"))})}finally{e.close()}}async function fy(t,e){wC(t,e);const n=await uy();if(n)try{await new Promise((r,s)=>{const a=n.transaction(tl,"readwrite");a.objectStore(tl).put(Q0(e),t),a.oncomplete=()=>r(),a.onerror=()=>s(a.error||new Error("Unable to save FlexDoc API Client workspace")),a.onabort=()=>s(a.error||new Error("Unable to save FlexDoc API Client workspace"))})}finally{n.close()}}const _C=300;function LC(t,e){return t.requests===e.requests&&t.folders===e.folders&&t.history===e.history&&t.version===e.version&&t.activeEnvironmentId===e.activeEnvironmentId&&t.credentialStorage===e.credentialStorage&&t.historyBodies===e.historyBodies}function hy(t,e,n){const[r,s]=I.useState(!1),a=I.useRef(e),c=I.useRef(t),u=I.useRef(n),f=I.useRef(!1),h=I.useRef(null);return I.useEffect(()=>{a.current=e,c.current=t,u.current=n}),I.useEffect(()=>{if(!n||t===!1)return;const g=()=>{f.current=!1,fy(t,e).then(()=>s(!1)).catch(()=>s(!0))},b=h.current;if(h.current=e,b&&LC(b,e)){f.current=!0;const v=setTimeout(g,_C);return()=>clearTimeout(v)}g()},[n,t,e]),I.useEffect(()=>{const g=()=>{const b=c.current;!f.current||!u.current||b===!1||(f.current=!1,fy(b,a.current).catch(()=>{}))};return typeof window<"u"&&window.addEventListener("pagehide",g),()=>{typeof window<"u"&&window.removeEventListener("pagehide",g),g()}},[]),r}const qC={cookies:"Cookie jar",clientCertificates:"Client certificates (mTLS)",digest:"Digest auth",hawk:"Hawk auth",ntlm:"NTLM auth",oauth1:"OAuth 1.0",awsv4:"AWS Signature V4"};function py(t){return qC[t]}function pf(t){const e=t.auth?t.auth.type==="oauth2"?{...t.auth,scopes:t.auth.scopes?[...t.auth.scopes]:void 0}:{...t.auth}:void 0;return{...t,query:t.query?.map(n=>({...n})),headers:t.headers?.map(n=>({...n})),urlencoded:t.urlencoded?.map(n=>({...n})),formData:t.formData?.map(n=>({...n})),binary:t.binary?{...t.binary}:void 0,graphql:t.graphql?{...t.graphql}:void 0,auth:e,hostExecution:t.hostExecution?{...t.hostExecution}:void 0}}function BC(t){const e=pf(t);return e.binary&&(e.binary={fileName:e.binary.fileName,contentType:e.binary.contentType}),e.formData&&(e.formData=e.formData.map(n=>{const r={...n};return delete r.file,r})),e}function zo(t){return Object.assign(Object.create(null),t||{})}function $C(t){return t instanceof Error?t.message:"Request failed"}function IC(t){return t?Array.isArray(t)?t.map(([e,n])=>[String(e),String(n)]):[...new Headers(t).entries()]:[]}function HC(t,e){if(e.body!=null&&typeof e.body!="string")return;const r=[`curl -X ${String(e.method||"GET").toUpperCase()} ${JSON.stringify(t)}`];for(const[s,a]of IC(e.headers))r.push(` -H ${JSON.stringify(`${s}: ${a}`)}`);return typeof e.body=="string"&&e.body.length>0&&r.push(` --data-raw ${JSON.stringify(e.body)}`),r.join(` \\
|
|
49
|
-
`)}function my(t,e){return e?.available?`The API host does not support: ${t.map(py).join(", ")}.`:"API-host execution is unavailable on this documentation server."}function Uo(t){const e=(t.request.method||"GET").toUpperCase(),n=[...new Set([...Wk(t.request),...t.additionalRequirements||[]])],r=["GET","HEAD"].includes(e)&&da(t.request)!=="none",s=t.request.hostExecution?.preferHostExecution,a=t.hostExecution?.preferHostExecution,c=a===!1?!1:t.preferHostExecution??s??a??!0,u=new Set(t.hostExecution?.capabilities||[]),f=n.filter(b=>!u.has(b)),h=n.length>0||r,g=t.hostExecution?.available===!0&&f.length===0;return[h?"host-required":c&&t.hostExecution?.available===!0?"api-host":"browser",g,r,f]}function zC(t){return t==="host-required"?"Host required":t==="api-host"?"API host":"Browser"}function UC(t,e,n){return t.failureKind!=="browser-network"||t.result?.transport!=="browser"?null:Uo({request:e,hostExecution:n,preferHostExecution:!0})[0]==="api-host"?"Browser request failed (possibly CORS). Try API host.":null}const VC=500;function FC(t,e,n){const r=t?.hostRoundTripTime??t?.responseTime;return t?.transport!=="api-host"||r==null||r<VC?null:Uo({request:e,hostExecution:n,preferHostExecution:!1})[0]==="browser"?`API-host round trip took ${Math.round(r)} ms. Browser may be faster.`:null}function PC(t,e,n,r){const[s,a,,c]=t;return s==="host-required"?a?n||"The browser cannot send this request. FlexDoc will execute it from the API host.":e?.available?my(c,e):r||"API-host execution is unavailable on this documentation server.":s==="api-host"?"This request runs from your API server.":null}function YC(t){if(typeof globalThis.btoa!="function")throw new Error("Host execution binary uploads require a Base64 encoder.");let e="";const n=32768;for(let r=0;r<t.length;r+=n)e+=String.fromCharCode(...t.subarray(r,Math.min(r+n,t.length)));return globalThis.btoa(e)}async function KC(t){const e={request:BC(t),...t.hostExecution?.certificateId?{certificateId:t.hostExecution.certificateId}:{},...t.hostExecution?.cookieJar?{cookieJar:t.hostExecution.cookieJar}:{}};t.bodyMode==="binary"&&t.binary?.file&&(e.bodyBase64=YC(new Uint8Array(await t.binary.file.arrayBuffer())));const n=(t.formData||[]).map((r,s)=>({entry:r,index:s})).filter(({entry:r})=>r.enabled!==!1&&r.type==="file"&&!!r.file);if(n.length>0){if(typeof FormData>"u")throw new Error("Host multipart execution requires FormData support.");const r=new FormData;r.append("descriptor",JSON.stringify(e));for(const{entry:s,index:a}of n){const c=s.file;r.append(`formData[${a}]`,c,s.fileName||c.name)}return{body:r,headers:{"X-FlexDoc-Execute":"1"}}}return{body:JSON.stringify(e),headers:{"X-FlexDoc-Execute":"1","Content-Type":"application/json"}}}async function gy(t){const e=pf(t.request),n=wn(t.scripts),r=t.fetcher||globalThis.fetch,s=t.now||Date.now;let a=pf(t.request),c=zo(t.variables),u=zo(t.collectionVariables);const f=zo(t.externalVariables);let h=zo(t.environmentVariables),g=[],b=[],v,w="",A="",C=0,j=!1,D,M;try{if(n.preRequest.trim()){const O=await U0({script:n.preRequest,phase:"pre-request",draft:a,variables:c,collectionVariables:u,externalVariables:f,environmentVariables:h});if(a=O.draft,c=O.variables,u=O.collectionVariables,h=O.environmentVariables,g=[...g,...O.logs],O.collectionChanges.length>0&&t.onCollectionChanges?.(O.collectionChanges),O.environmentChanges.length>0&&t.onEnvironmentChanges?.(O.environmentChanges),O.error)return{scriptTests:b,scriptLogs:g,scriptError:`Pre-request script: ${O.error}`}}t.resolveAuth&&(a={...a,auth:t.resolveAuth(a.auth)}),a=Zk(a,c),w=(a.method||"GET").toUpperCase(),A=a.url;const[E,,,R]=Uo({request:a,hostExecution:t.hostExecution,preferHostExecution:t.preferHostExecution});let _;if(E!=="browser"){if(!t.hostExecution?.available||R.length>0){const fe=my(R,t.hostExecution);return{error:fe,result:{request:e,scripts:n,executedMethod:w,resolvedUrl:A,error:fe,...g.length?{scriptLogs:[...g]}:{}},scriptTests:b,scriptLogs:g}}if(!r)throw new Error("Fetch API is not available");const O=await KC(a);C=s(),j=!0,D="api-host";const X=await r(t.hostExecution.endpoint,{method:"POST",credentials:"same-origin",headers:O.headers,body:O.body,...t.signal?{signal:t.signal}:{}}),U=await X.text(),B=s()-C;let K;try{const fe=U?JSON.parse(U):{};if(!fe||typeof fe!="object"||Array.isArray(fe))throw new Error("invalid");K=fe}catch{throw new Error("API host returned an invalid execution response.")}const W=typeof K.error=="string"?K.error:void 0;if(!X.ok)throw new Error(W||`API host execution failed with HTTP ${X.status}.`);if(typeof K.status!="number"||!Array.isArray(K.headers))throw new Error("API host returned an invalid execution response.");const ye=K.headers.map(fe=>Array.isArray(fe)?[String(fe[0]),String(fe[1])]:["",""]).filter(([fe])=>!!fe),pe=Array.isArray(K.cookies)?K.cookies:void 0;_={status:K.status,statusText:String(K.statusText||""),headers:ye,body:String(K.body||""),responseTime:typeof K.responseTime=="number"?K.responseTime:B,hostRoundTripTime:B,transport:"api-host",...pe?{cookies:pe}:{}}}else{const O=Y0(a);w=O.method,A=O.url,t.onRequestBuilt?.(O);let X={...O.init,url:O.url,credentials:t.credentials||"same-origin",...t.signal?{signal:t.signal}:{}};t.requestInterceptor&&(X=await t.requestInterceptor(X)),t.signal&&(X.signal=t.signal);const{url:U,...B}=X;if(A=U,M=HC(U,B),C=s(),j=!0,D="browser",!r)throw new Error("Fetch API is not available");const K=await r(U,B),W=await K.text();_={status:K.status,statusText:K.statusText,headers:[...K.headers.entries()],body:W,responseTime:s()-C,transport:"browser"}}if(n.tests.trim()){const O=await U0({script:n.tests,phase:"tests",draft:a,variables:c,collectionVariables:u,externalVariables:f,environmentVariables:h,response:_});g=[...g,...O.logs],b=O.tests.map(X=>({...X})),O.collectionChanges.length>0&&t.onCollectionChanges?.(O.collectionChanges),O.environmentChanges.length>0&&t.onEnvironmentChanges?.(O.environmentChanges),O.error&&(v=`Test script: ${O.error}`)}return{result:{request:e,scripts:n,executedMethod:w,resolvedUrl:A,status:_.status,statusText:_.statusText,responseTime:_.responseTime,transport:_.transport,responseHeaders:_.headers.map(([O,X])=>[O,X]),responseBody:_.body,...b.length?{scriptTests:b}:{},...g.length?{scriptLogs:[...g]}:{},...v?{scriptError:v}:{}},response:_,scriptTests:b,scriptLogs:g,...M?{curlCommand:M}:{},...v?{scriptError:v}:{}}}catch(E){const R=$C(E),_={error:R,scriptTests:b,scriptLogs:g,...D==="browser"&&E instanceof TypeError?{failureKind:"browser-network"}:{}};return j&&(_.result={request:e,scripts:n,executedMethod:w,resolvedUrl:A,responseTime:C?s()-C:void 0,transport:D,error:R,...g.length?{scriptLogs:[...g]}:{}}),_}}const GC=()=>p.jsx("span",{"aria-hidden":"true",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded bg-blue-600 text-xs font-bold text-white",children:"F"});function mf({message:t,capabilities:e=[],showCapabilities:n=!0,warning:r=!1,theme:s="light",label:a="Host execution status"}){const c=r?s==="dark"?"border-amber-800 bg-amber-950/40 text-amber-200":"border-amber-300 bg-amber-50 text-amber-800":s==="dark"?"border-blue-800 bg-blue-950/40 text-blue-200":"border-blue-300 bg-blue-50 text-blue-800";return p.jsx("div",{role:r?"alert":"status","aria-label":a,className:`rounded-md border p-3 text-sm ${c}`,children:p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx(GC,{}),p.jsxs("div",{children:[t,n&&p.jsxs("details",{className:"mt-1",children:[p.jsx("summary",{children:"API host capabilities"}),p.jsxs("div",{className:"mt-1 text-xs",children:["Universal: HTTP method, URL, query, headers, body · Host-specific: ",e.length?e.map(py).join(" · "):"None advertised."]})]})]})]})})}function il(t,e){const n=t?.trim();if(!n)throw new Error(`${e} is required for this OAuth flow.`);return n}function Vo(t){return(t.scopes||[]).map(e=>e.trim()).filter(Boolean).join(" ")}function XC(t){if(typeof TextEncoder>"u")throw new Error("OAuth Basic client authentication requires UTF-8 encoding support.");const e=new TextEncoder().encode(t);let n="";for(const a of e)n+=String.fromCharCode(a);const r=globalThis.Buffer,s=typeof btoa=="function"?btoa(n):r?.from(n,"binary").toString("base64");if(!s)throw new Error("OAuth Basic client authentication requires Base64 support in this runtime.");return s}function yy(t){let e="";for(const s of t)e+=String.fromCharCode(s);const n=globalThis.Buffer,r=typeof btoa=="function"?btoa(e):n?.from(e,"binary").toString("base64");if(!r)throw new Error("OAuth PKCE requires Base64 support in this runtime.");return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function by(t=32){if(!globalThis.crypto?.getRandomValues)throw new Error("OAuth requires cryptographic random-number support.");const e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),yy(e)}async function JC(t){if(!globalThis.crypto?.subtle||typeof TextEncoder>"u")throw new Error("OAuth authorization-code flow requires Web Crypto PKCE support.");const e=await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return yy(new Uint8Array(e))}function xy(t,e,n,r){const s=il(t.authorizationUrl,"Authorization URL"),a=il(t.clientId,"Client ID"),c=new URL(s),u=t.grantType||"accessToken";c.searchParams.set("response_type",u==="implicit"?"token":"code"),c.searchParams.set("client_id",a),c.searchParams.set("redirect_uri",n),c.searchParams.set("state",e);const f=Vo(t);return f&&c.searchParams.set("scope",f),r&&(c.searchParams.set("code_challenge",r),c.searchParams.set("code_challenge_method","S256")),c.toString()}function QC(t){const e=new URL(t.location.href);return e.search="",e.hash="",e.toString()}async function WC(t,e){const n=e??(typeof window>"u"?void 0:window);if(!n)throw new Error("Interactive OAuth requires a browser window.");const r=t.redirectUri?.trim()||QC(n);if(new URL(r).origin!==n.location.origin)throw new Error("Interactive OAuth redirect URI must use the same origin as the FlexDoc page so the popup result can be read.");const s=by(24);if((t.grantType||"accessToken")==="implicit")return{url:xy(t,s,r),state:s,redirectUri:r};const a=by(48),c=await JC(a);return{url:xy(t,s,r,c),state:s,redirectUri:r,codeVerifier:a}}async function ZC(t){const e=await t.text();let n;try{n=e?JSON.parse(e):{}}catch{n=Object.fromEntries(new URLSearchParams(e))}if(!t.ok){const c=String(n.error_description||n.error||`OAuth token endpoint returned ${t.status}`);throw new Error(c)}const r=typeof n.access_token=="string"?n.access_token:"";if(!r)throw new Error("OAuth token endpoint did not return access_token.");const s=n.expires_in,a=typeof s=="number"?s:typeof s=="string"&&s.trim()!==""&&Number.isFinite(Number(s))?Number(s):void 0;return{accessToken:r,refreshToken:typeof n.refresh_token=="string"?n.refresh_token:void 0,tokenType:typeof n.token_type=="string"?n.token_type:void 0,expiresIn:a,scope:typeof n.scope=="string"?n.scope:void 0}}async function Fo(t,e,n){const r=il(t.tokenUrl,"Token URL"),s={"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},a=t.clientId?.trim();(t.clientAuthentication||"body")==="basic"&&a?s.Authorization=`Basic ${XC(`${a}:${t.clientSecret||""}`)}`:(a&&e.set("client_id",a),t.clientSecret&&e.set("client_secret",t.clientSecret));const c=await n(r,{method:"POST",headers:s,body:e.toString()});return ZC(c)}async function eN(t,e){const n=e.windowObject??(typeof window>"u"?void 0:window);if(!n)throw new Error("Interactive OAuth requires a browser window.");const r=n.open(t.url,"flexdoc-oauth","popup,width=640,height=760");if(!r)throw new Error("OAuth popup was blocked. Allow popups for this documentation origin and try again.");const s=new URL(t.redirectUri),a=Date.now(),c=e.popupTimeoutMs??12e4,u=e.pollIntervalMs??200;for(;Date.now()-a<c;){if(r.closed)throw new Error("OAuth popup was closed before authorization completed.");try{const f=new URL(r.location.href);if(f.origin===s.origin&&f.pathname===s.pathname)return r.close(),f}catch{}await new Promise(f=>setTimeout(f,u))}throw r.close(),new Error("OAuth authorization timed out.")}async function tN(t,e={}){const n=t.grantType||"accessToken",r=e.fetchImpl??fetch;if(n==="accessToken")return{accessToken:il(t.accessToken,"Access token")};if(n==="clientCredentials"){const b=new URLSearchParams({grant_type:"client_credentials"}),v=Vo(t);return v&&b.set("scope",v),Fo(t,b,r)}if(n==="password"){const b=new URLSearchParams({grant_type:"password",username:il(t.username,"Username"),password:t.password||""}),v=Vo(t);return v&&b.set("scope",v),Fo(t,b,r)}const s=await WC(t,e.windowObject),a=await eN(s,e);if((a.searchParams.get("state")||new URLSearchParams(a.hash.replace(/^#/,"")).get("state"))!==s.state)throw new Error("OAuth state mismatch; authorization response was rejected.");const u=new URLSearchParams(a.hash.replace(/^#/,"")),f=a.searchParams.get("error")||u.get("error");if(f){const b=a.searchParams.get("error_description")||u.get("error_description");throw new Error(b||f)}if(n==="implicit"){const b=u.get("access_token")||"";if(!b)throw new Error("OAuth implicit response did not include access_token.");return{accessToken:b,tokenType:u.get("token_type")||void 0,expiresIn:u.get("expires_in")?Number(u.get("expires_in")):void 0,scope:u.get("scope")||void 0}}const h=a.searchParams.get("code");if(!h)throw new Error("OAuth authorization response did not include code.");const g=new URLSearchParams({grant_type:"authorization_code",code:h,redirect_uri:s.redirectUri});return s.codeVerifier&&g.set("code_verifier",s.codeVerifier),Fo(t,g,r)}async function nN(t,e={}){const n=il(t.refreshToken,"Refresh token"),r=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),s=Vo(t);return s&&r.set("scope",s),Fo(t,r,e.fetchImpl??fetch)}function iN(t){return t==="inherit"?{type:"inherit"}:t==="bearer"?{type:"bearer",token:""}:t==="oauth2"?{type:"oauth2",accessToken:"",grantType:"accessToken",scopes:[]}:t==="basic"?{type:"basic",username:"",password:""}:t==="apiKey"?{type:"apiKey",key:"",value:"",in:"header"}:t==="digest"?{type:"digest",username:"",password:""}:t==="hawk"?{type:"hawk",id:"",key:"",algorithm:"sha256"}:t==="ntlm"?{type:"ntlm",username:"",password:""}:t==="oauth1"?{type:"oauth1",consumerKey:"",consumerSecret:"",signatureMethod:"HMAC-SHA1"}:t==="awsv4"?{type:"awsv4",accessKey:"",secretKey:"",region:"",service:""}:{type:"none"}}function rN(t){return t.split(/\s+/).map(e=>e.trim()).filter(Boolean)}const sN=({auth:t,fieldClass:e,label:n,onChange:r})=>{const[s,a]=I.useState(!1),[c,u]=I.useState(null),f=t.grantType||"accessToken",h=f==="authorizationCode"||f==="implicit",g=f==="authorizationCode"||f==="clientCredentials"||f==="password",b=f!=="accessToken",v=async()=>{a(!0),u(null);try{const A=await tN(t);r({...t,accessToken:A.accessToken,refreshToken:A.refreshToken??t.refreshToken}),u(A.expiresIn?`Access token acquired; expires in ${A.expiresIn}s.`:"Access token acquired.")}catch(A){u(A instanceof Error?A.message:"OAuth authorization failed.")}finally{a(!1)}},w=async()=>{a(!0),u(null);try{const A=await nN(t);r({...t,accessToken:A.accessToken,refreshToken:A.refreshToken??t.refreshToken}),u("Access token refreshed.")}catch(A){u(A instanceof Error?A.message:"OAuth token refresh failed.")}finally{a(!1)}};return p.jsxs("div",{className:"space-y-2",children:[p.jsxs("select",{"aria-label":n?`${n} OAuth grant type`:"OAuth grant type",className:e,value:f,onChange:A=>r({...t,grantType:A.target.value}),children:[p.jsx("option",{value:"accessToken",children:"Manual access token"}),p.jsx("option",{value:"authorizationCode",children:"Authorization Code + PKCE"}),p.jsx("option",{value:"clientCredentials",children:"Client Credentials"}),p.jsx("option",{value:"password",children:"Password grant (legacy)"}),p.jsx("option",{value:"implicit",children:"Implicit grant (legacy)"})]}),h&&p.jsx("input",{"aria-label":n?`${n} OAuth authorization URL`:"OAuth authorization URL",className:e,placeholder:"Authorization URL",value:t.authorizationUrl||"",onChange:A=>r({...t,authorizationUrl:A.target.value})}),g&&p.jsx("input",{"aria-label":n?`${n} OAuth token URL`:"OAuth token URL",className:e,placeholder:"Token URL",value:t.tokenUrl||"",onChange:A=>r({...t,tokenUrl:A.target.value})}),b&&p.jsx("input",{"aria-label":n?`${n} OAuth client ID`:"OAuth client ID",className:e,placeholder:"Client ID",value:t.clientId||"",onChange:A=>r({...t,clientId:A.target.value})}),(f==="authorizationCode"||f==="clientCredentials"||f==="password")&&p.jsx("input",{"aria-label":n?`${n} OAuth client secret`:"OAuth client secret",type:"password",autoComplete:"off",className:e,placeholder:f==="authorizationCode"?"Client secret (optional for PKCE/public clients)":"Client secret (optional)",value:t.clientSecret||"",onChange:A=>r({...t,clientSecret:A.target.value})}),g&&p.jsxs("select",{"aria-label":n?`${n} OAuth client authentication`:"OAuth client authentication",className:e,value:t.clientAuthentication||"body",onChange:A=>r({...t,clientAuthentication:A.target.value}),children:[p.jsx("option",{value:"body",children:"Send client credentials in body"}),p.jsx("option",{value:"basic",children:"Send as Basic Auth header"})]}),h&&p.jsx("input",{"aria-label":n?`${n} OAuth redirect URI`:"OAuth redirect URI",className:e,placeholder:"Redirect URI (defaults to this page)",value:t.redirectUri||"",onChange:A=>r({...t,redirectUri:A.target.value})}),b&&p.jsx("input",{"aria-label":n?`${n} OAuth scopes`:"OAuth scopes",className:e,placeholder:"Scopes separated by spaces",value:(t.scopes||[]).join(" "),onChange:A=>r({...t,scopes:rN(A.target.value)})}),f==="password"&&p.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[p.jsx("input",{"aria-label":n?`${n} OAuth username`:"OAuth username",className:e,placeholder:"Resource owner username",value:t.username||"",onChange:A=>r({...t,username:A.target.value})}),p.jsx("input",{"aria-label":n?`${n} OAuth password`:"OAuth password",type:"password",autoComplete:"off",className:e,placeholder:"Resource owner password",value:t.password||"",onChange:A=>r({...t,password:A.target.value})})]}),p.jsx("input",{"aria-label":n?`${n} OAuth access token`:"OAuth access token",type:"password",autoComplete:"off",className:e,placeholder:"Access token",value:t.accessToken,onChange:A=>r({...t,accessToken:A.target.value})}),f!=="accessToken"&&p.jsxs("div",{className:"flex flex-wrap gap-2",children:[p.jsx("button",{type:"button",disabled:s,onClick:v,className:"rounded-md border px-2.5 py-1.5 text-xs font-medium disabled:opacity-60",children:s?"Authorizing…":"Get access token"}),t.refreshToken&&t.tokenUrl&&p.jsx("button",{type:"button",disabled:s,onClick:w,className:"rounded-md border px-2.5 py-1.5 text-xs font-medium disabled:opacity-60",children:"Refresh access token"})]}),f!=="accessToken"&&p.jsx("p",{className:"text-[11px] opacity-70",children:"Authorization Code uses PKCE. Popup callbacks must return to this page origin; token endpoints must allow browser CORS. Client secrets entered here are browser-visible and should only be used when the OAuth provider permits it."}),c&&p.jsx("p",{role:"status",className:"text-xs",children:c})]})},gf=({auth:t,label:e,allowInherit:n=!1,advanced:r=!0,hostExecution:s,onChange:a,theme:c})=>{const f=`w-full rounded-md border ${e?"px-2 py-1.5 text-xs":"px-3 py-2 text-sm"} ${c==="dark"?"bg-gray-900 border-gray-700 text-gray-100":"bg-white border-gray-300 text-gray-900"}`,h=(w,A=w)=>e?`${e} ${w}`:A,g=new Set(s?.capabilities||[]),b=w=>s?.available===!0&&g.has(w),v=t.type==="digest"?"digest":t.type==="hawk"?"hawk":t.type==="ntlm"?"ntlm":t.type==="oauth1"?"oauth1":t.type==="awsv4"?"awsv4":t.type==="apiKey"&&t.in==="cookie"?"cookies":void 0;return p.jsxs("div",{className:"space-y-2",children:[p.jsxs("select",{"aria-label":h("authorization type","Authorization type"),className:f,value:t.type==="inherit"&&!n?"none":t.type,onChange:w=>a(iN(w.target.value)),children:[n&&p.jsx("option",{value:"inherit",children:"Inherit from parent"}),p.jsx("option",{value:"none",children:"No auth"}),p.jsx("option",{value:"bearer",children:"Bearer token"}),p.jsx("option",{value:"basic",children:"Basic auth"}),p.jsx("option",{value:"apiKey",children:"API key"}),(r||t.type==="oauth2")&&p.jsx("option",{value:"oauth2",children:"OAuth 2.0"}),r&&p.jsxs(p.Fragment,{children:[p.jsx("option",{value:"digest",disabled:!b("digest"),children:"Digest (API host)"}),p.jsx("option",{value:"hawk",disabled:!b("hawk"),children:"Hawk (API host)"}),p.jsx("option",{value:"ntlm",disabled:!b("ntlm"),children:"NTLM / Negotiate (API host)"}),p.jsx("option",{value:"oauth1",disabled:!b("oauth1"),children:"OAuth 1.0 (API host)"}),p.jsx("option",{value:"awsv4",disabled:!b("awsv4"),children:"AWS Signature v4 (API host)"})]})]}),t.type==="bearer"&&p.jsx("input",{"aria-label":h("bearer token","Bearer token"),type:"password",autoComplete:"off",className:f,value:t.token,onChange:w=>a({...t,token:w.target.value})}),t.type==="oauth2"&&p.jsx(sN,{auth:t,fieldClass:f,label:e,onChange:a}),(t.type==="basic"||t.type==="digest")&&p.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[p.jsx("input",{"aria-label":h(t.type+" username",t.type==="basic"?"Basic auth username":"Digest username"),className:f,placeholder:"Username",value:t.username,onChange:w=>a({...t,username:w.target.value})}),p.jsx("input",{"aria-label":h(t.type+" password",t.type==="basic"?"Basic auth password":"Digest password"),type:"password",autoComplete:"off",className:f,placeholder:"Password",value:t.password,onChange:w=>a({...t,password:w.target.value})})]}),t.type==="apiKey"&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("input",{"aria-label":h("API key name"),className:f,placeholder:"Key name",value:t.key,onChange:w=>a({...t,key:w.target.value})}),p.jsx("input",{"aria-label":h("API key value"),type:"password",autoComplete:"off",className:f,placeholder:"Value",value:t.value,onChange:w=>a({...t,value:w.target.value})}),p.jsxs("select",{"aria-label":h("API key location"),className:f,value:t.in,onChange:w=>a({...t,in:w.target.value}),children:[p.jsx("option",{value:"header",children:"Header"}),p.jsx("option",{value:"query",children:"Query"}),p.jsx("option",{value:"cookie",disabled:!b("cookies"),children:"Cookie (API host)"})]})]}),t.type==="hawk"&&p.jsxs("div",{className:"grid gap-2",children:[p.jsx("input",{"aria-label":h("Hawk id"),className:f,placeholder:"ID",value:t.id,onChange:w=>a({...t,id:w.target.value})}),p.jsx("input",{"aria-label":h("Hawk key"),type:"password",autoComplete:"off",className:f,placeholder:"Key",value:t.key,onChange:w=>a({...t,key:w.target.value})}),p.jsxs("select",{"aria-label":h("Hawk algorithm"),className:f,value:t.algorithm||"sha256",onChange:w=>a({...t,algorithm:w.target.value}),children:[p.jsx("option",{value:"sha256",children:"SHA-256"}),p.jsx("option",{value:"sha1",children:"SHA-1"})]}),p.jsx("input",{"aria-label":h("Hawk ext"),className:f,placeholder:"ext (optional)",value:t.ext||"",onChange:w=>a({...t,ext:w.target.value})})]}),t.type==="ntlm"&&p.jsxs("div",{className:"grid gap-2",children:[p.jsx("input",{"aria-label":h("NTLM username"),className:f,placeholder:"Username",value:t.username,onChange:w=>a({...t,username:w.target.value})}),p.jsx("input",{"aria-label":h("NTLM password"),type:"password",autoComplete:"off",className:f,placeholder:"Password",value:t.password,onChange:w=>a({...t,password:w.target.value})}),p.jsx("input",{"aria-label":h("NTLM domain"),className:f,placeholder:"Domain (optional)",value:t.domain||"",onChange:w=>a({...t,domain:w.target.value})}),p.jsx("input",{"aria-label":h("NTLM workstation"),className:f,placeholder:"Workstation (optional)",value:t.workstation||"",onChange:w=>a({...t,workstation:w.target.value})})]}),t.type==="oauth1"&&p.jsxs("div",{className:"grid gap-2",children:[p.jsx("input",{"aria-label":h("OAuth1 consumer key"),className:f,placeholder:"Consumer key",value:t.consumerKey,onChange:w=>a({...t,consumerKey:w.target.value})}),p.jsx("input",{"aria-label":h("OAuth1 consumer secret"),type:"password",autoComplete:"off",className:f,placeholder:"Consumer secret",value:t.consumerSecret,onChange:w=>a({...t,consumerSecret:w.target.value})}),p.jsx("input",{"aria-label":h("OAuth1 token"),className:f,placeholder:"Token (optional)",value:t.token||"",onChange:w=>a({...t,token:w.target.value})}),p.jsx("input",{"aria-label":h("OAuth1 token secret"),type:"password",autoComplete:"off",className:f,placeholder:"Token secret (optional)",value:t.tokenSecret||"",onChange:w=>a({...t,tokenSecret:w.target.value})}),p.jsxs("select",{"aria-label":h("OAuth1 signature method"),className:f,value:t.signatureMethod||"HMAC-SHA1",onChange:w=>a({...t,signatureMethod:w.target.value}),children:[p.jsx("option",{children:"HMAC-SHA1"}),p.jsx("option",{children:"HMAC-SHA256"}),p.jsx("option",{children:"PLAINTEXT"})]}),p.jsx("input",{"aria-label":h("OAuth1 realm"),className:f,placeholder:"Realm (optional)",value:t.realm||"",onChange:w=>a({...t,realm:w.target.value})})]}),t.type==="awsv4"&&p.jsxs("div",{className:"grid gap-2",children:[p.jsx("input",{"aria-label":h("AWS access key"),className:f,placeholder:"Access key",value:t.accessKey,onChange:w=>a({...t,accessKey:w.target.value})}),p.jsx("input",{"aria-label":h("AWS secret key"),type:"password",autoComplete:"off",className:f,placeholder:"Secret key",value:t.secretKey,onChange:w=>a({...t,secretKey:w.target.value})}),p.jsx("input",{"aria-label":h("AWS session token"),type:"password",autoComplete:"off",className:f,placeholder:"Session token (optional)",value:t.sessionToken||"",onChange:w=>a({...t,sessionToken:w.target.value})}),p.jsx("input",{"aria-label":h("AWS region"),className:f,placeholder:"Region",value:t.region,onChange:w=>a({...t,region:w.target.value})}),p.jsx("input",{"aria-label":h("AWS service"),className:f,placeholder:"Service",value:t.service,onChange:w=>a({...t,service:w.target.value})})]}),e&&v&&p.jsx("p",{role:b(v)?"status":"alert",className:"text-[11px] opacity-75",children:b(v)?"This authorization mode is executed by the FlexDoc API host.":s?.available?"Requests run from your API server, but this authorization mode is not supported.":"API-host execution is unavailable on this documentation server."})]})};let yf=[],vy=[];(()=>{let t="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,n=0;e<t.length;e++)(e%2?vy:yf).push(n=n+t[e])})();function lN(t){if(t<768)return!1;for(let e=0,n=yf.length;;){let r=e+n>>1;if(t<yf[r])n=r;else if(t>=vy[r])e=r+1;else return!0;if(e==n)return!1}}function wy(t){return t>=127462&&t<=127487}const Sy=8205;function aN(t,e,n=!0,r=!0){return(n?Ay:oN)(t,e,r)}function Ay(t,e,n){if(e==t.length)return e;e&&ky(t.charCodeAt(e))&&Cy(t.charCodeAt(e-1))&&e--;let r=bf(t,e);for(e+=Ny(r);e<t.length;){let s=bf(t,e);if(r==Sy||s==Sy||n&&lN(s))e+=Ny(s),r=s;else if(wy(s)){let a=0,c=e-2;for(;c>=0&&wy(bf(t,c));)a++,c-=2;if(a%2==0)break;e+=2}else break}return e}function oN(t,e,n){for(;e>1;){let r=Ay(t,e-2,n);if(r<e)return r;e--}return 0}function bf(t,e){let n=t.charCodeAt(e);if(!Cy(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return ky(r)?(n-55296<<10)+(r-56320)+65536:n}function ky(t){return t>=56320&&t<57344}function Cy(t){return t>=55296&&t<56320}function Ny(t){return t<65536?1:2}class gt{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,n,r){[e,n]=rl(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),zi.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=rl(this,e,n);let r=[];return this.decompose(e,n,r,0),zi.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new ha(this),a=new ha(e);for(let c=n,u=n;;){if(s.next(c),a.next(c),c=0,s.lineBreak!=a.lineBreak||s.done!=a.done||s.value!=a.value)return!1;if(u+=s.value.length,s.done||u>=r)return!0}}iter(e=1){return new ha(this,e)}iterRange(e,n=this.length){return new jy(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new Ey(r)}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]?gt.empty:e.length<=32?new Ht(e):zi.from(Ht.split(e,[]))}}class Ht extends gt{constructor(e,n=cN(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let a=0;;a++){let c=this.text[a],u=s+c.length;if((n?r:u)>=e)return new uN(s,u,r,c);s=u+1,r++}}decompose(e,n,r,s){let a=e<=0&&n>=this.length?this:new Ht(Ty(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let c=r.pop(),u=Po(a.text,c.text.slice(),0,a.length);if(u.length<=32)r.push(new Ht(u,c.length+a.length));else{let f=u.length>>1;r.push(new Ht(u.slice(0,f)),new Ht(u.slice(f)))}}else r.push(a)}replace(e,n,r){if(!(r instanceof Ht))return super.replace(e,n,r);[e,n]=rl(this,e,n);let s=Po(this.text,Po(r.text,Ty(this.text,0,e)),n),a=this.length+r.length-(n-e);return s.length<=32?new Ht(s,a):zi.from(Ht.split(s,[]),a)}sliceString(e,n=this.length,r=`
|
|
47
|
+
})();`)(E,j),await Promise.all(g),{draft:e,variables:n,collectionVariables:r,externalVariables:s,environmentVariables:a,collectionChanges:c,environmentChanges:u,tests:f,logs:h}}catch(M){return await Promise.all(g),{draft:e,variables:n,collectionVariables:r,externalVariables:s,environmentVariables:a,collectionChanges:c,environmentChanges:u,tests:f,logs:h,error:M instanceof Error?M.message:String(M)}}}function of(t){return(t||[]).filter(e=>e.enabled!==!1&&e.key.trim()!=="")}function P0(t){if(t.bodyMode)return t.bodyMode;if(t.binary?.file||t.binary?.fileName)return"binary";if(t.formData?.length)return"formdata";if(t.urlencoded?.length)return"urlencoded";if(t.graphql&&(t.graphql.query||t.graphql.variables))return"graphql";if(!t.body)return"none";const e=(t.contentType||"").toLowerCase();return e.includes("application/x-www-form-urlencoded")?"urlencoded":e.includes("multipart/form-data")?"formdata":e.includes("json")?"json":"raw"}function Y0(t){const e=new Set,n=t.auth;return n?.type==="apiKey"&&n.in==="cookie"?e.add("cookies"):n?.type==="digest"?e.add("digest"):n?.type==="hawk"?e.add("hawk"):n?.type==="ntlm"?e.add("ntlm"):n?.type==="oauth1"?e.add("oauth1"):n?.type==="awsv4"&&e.add("awsv4"),t.headers?.some(r=>r.enabled!==!1&&r.key.trim().toLowerCase()==="cookie")&&e.add("cookies"),t.hostExecution?.cookieJar==="session"&&e.add("cookies"),t.hostExecution?.certificateId&&e.add("clientCertificates"),[...e]}function Pk(t,e){if(!e.length)return t;const n=t.indexOf("#"),r=n>=0?t.slice(0,n):t,s=n>=0?t.slice(n):"",a=e.map(({key:u,value:f})=>`${encodeURIComponent(u)}=${encodeURIComponent(f)}`).join("&"),c=r.includes("?")?r.endsWith("?")||r.endsWith("&")?"":"&":"?";return`${r}${c}${a}${s}`}function Yk(t){const e=t.indexOf("#"),n=e>=0?t.slice(0,e):t,r=e>=0?t.slice(e):"",s=n.indexOf("?");if(s<0)return{url:t,query:[]};const a=[];return new URLSearchParams(n.slice(s+1)).forEach((u,f)=>a.push({key:f,value:u})),{url:`${n.slice(0,s)}${r}`,query:a}}function cf(t,e){return t.find(([n])=>n.toLowerCase()===e.toLowerCase())?.[1]}function qo(t,e,n){for(let r=t.length-1;r>=0;r-=1)t[r][0].toLowerCase()===e.toLowerCase()&&t.splice(r,1);t.push([e,n])}function Kk(t){const e={};for(const[n,r]of t)e[n]=r;return e}function Gk(t){const e=t.headerEntries;if(!Array.isArray(e))return Object.entries(t.headers||{});const n=[];for(const r of e){if(Array.isArray(r)&&r.length>=2){n.push([String(r[0]),String(r[1])]);continue}if(r&&typeof r=="object"&&"key"in r&&"value"in r){const s=r;s.enabled!==!1&&n.push([String(s.key),String(s.value)])}}return n.length||e.length===0?n:Object.entries(t.headers||{})}function Xk(t){if(typeof globalThis.btoa=="function"){if(typeof TextEncoder>"u")throw new Error("Basic auth requires UTF-8 encoding support.");const n=new TextEncoder().encode(t);let r="";for(const s of n)r+=String.fromCharCode(s);return globalThis.btoa(r)}const e=globalThis.Buffer;if(e?.from)return e.from(t,"utf8").toString("base64");throw new Error("Basic auth requires a Base64 encoder in this runtime.")}function Pe(t,e){return t===void 0||t===""?t:t.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(n,r)=>{const s=r.trim();return Object.prototype.hasOwnProperty.call(e,s)?e[s]:n})}function Jk(t,e){if(!t||t.type==="none"||t.type==="inherit")return t;if(t.type==="bearer")return{type:"bearer",token:Pe(t.token,e)||""};if(t.type==="oauth2"){const n={...t,accessToken:Pe(t.accessToken,e)||""};return t.authorizationUrl!==void 0&&(n.authorizationUrl=Pe(t.authorizationUrl,e)),t.tokenUrl!==void 0&&(n.tokenUrl=Pe(t.tokenUrl,e)),t.clientId!==void 0&&(n.clientId=Pe(t.clientId,e)),t.clientSecret!==void 0&&(n.clientSecret=Pe(t.clientSecret,e)),t.redirectUri!==void 0&&(n.redirectUri=Pe(t.redirectUri,e)),t.scopes!==void 0&&(n.scopes=t.scopes.map(r=>Pe(r,e)||"")),t.username!==void 0&&(n.username=Pe(t.username,e)),t.password!==void 0&&(n.password=Pe(t.password,e)),t.refreshToken!==void 0&&(n.refreshToken=Pe(t.refreshToken,e)),n}return t.type==="basic"?{type:"basic",username:Pe(t.username,e)||"",password:Pe(t.password,e)||""}:t.type==="apiKey"?{type:"apiKey",key:Pe(t.key,e)||"",value:Pe(t.value,e)||"",in:t.in}:t.type==="digest"?{type:"digest",username:Pe(t.username,e)||"",password:Pe(t.password,e)||""}:t.type==="hawk"?{...t,id:Pe(t.id,e)||"",key:Pe(t.key,e)||"",ext:Pe(t.ext,e)}:t.type==="ntlm"?{...t,username:Pe(t.username,e)||"",password:Pe(t.password,e)||"",domain:Pe(t.domain,e),workstation:Pe(t.workstation,e)}:t.type==="oauth1"?{...t,consumerKey:Pe(t.consumerKey,e)||"",consumerSecret:Pe(t.consumerSecret,e)||"",token:Pe(t.token,e),tokenSecret:Pe(t.tokenSecret,e),realm:Pe(t.realm,e)}:{...t,accessKey:Pe(t.accessKey,e)||"",secretKey:Pe(t.secretKey,e)||"",sessionToken:Pe(t.sessionToken,e),region:Pe(t.region,e)||"",service:Pe(t.service,e)||""}}function K0(t,e){return{method:Pe(t.method,e)??t.method,url:Pe(t.url,e)??t.url,query:t.query?.map(n=>({...n,key:Pe(n.key,e)||"",value:Pe(n.value,e)||""})),headers:t.headers?.map(n=>({...n,key:Pe(n.key,e)||"",value:Pe(n.value,e)||""})),body:Pe(t.body,e),contentType:Pe(t.contentType,e),bodyMode:t.bodyMode,urlencoded:t.urlencoded?.map(n=>({...n,key:Pe(n.key,e)||"",value:Pe(n.value,e)||""})),formData:t.formData?.map(n=>({...n,key:Pe(n.key,e)||"",value:Pe(n.value,e)||"",fileName:Pe(n.fileName,e),contentType:Pe(n.contentType,e)})),binary:t.binary?{...t.binary,fileName:Pe(t.binary.fileName,e),contentType:Pe(t.binary.contentType,e)}:void 0,graphql:t.graphql?{query:Pe(t.graphql.query,e)||"",variables:Pe(t.graphql.variables,e)||""}:void 0,auth:Jk(t.auth,e),hostExecution:t.hostExecution?{...t.hostExecution}:void 0}}function Qk(t,e,n){const r=t.auth;if(!(!r||r.type==="none"||r.type==="inherit")){if(r.type==="bearer"){r.token&&qo(e,"Authorization",`Bearer ${r.token}`);return}if(r.type==="oauth2"){r.accessToken&&qo(e,"Authorization",`Bearer ${r.accessToken}`);return}if(r.type==="basic"){(r.username||r.password)&&qo(e,"Authorization",`Basic ${Xk(`${r.username}:${r.password}`)}`);return}r.type!=="apiKey"||!r.key||(r.in==="query"?n.push({key:r.key,value:r.value}):r.in==="header"&&qo(e,r.key,r.value))}}function Wk(t,e={}){const n=e.variables?K0(t,e.variables):t,r=(n.method||"GET").trim().toUpperCase(),s=n.url.trim();if(!s)throw new Error("Request URL is required.");const a=Y0(n);if(a.length>0)throw new Error(`This request requires API host execution (${a.join(", ")}).`);const c=of(n.query),u=of(n.headers).map(({key:A,value:C})=>[A,C]);Qk(n,u,c);let f,h,g;const b=P0(n);if(b!=="none"){if(b==="formdata")for(let O=u.length-1;O>=0;O-=1)u[O][0].toLowerCase()==="content-type"&&u.splice(O,1);const A=cf(u,"Content-Type"),C=n.contentType?.trim();if(b==="urlencoded")f=of(n.urlencoded).map(({key:D,value:E})=>`${encodeURIComponent(D)}=${encodeURIComponent(E)}`).join("&"),g=f,A||u.push(["Content-Type",C||"application/x-www-form-urlencoded"]),h="form";else if(b==="formdata"){const O=new FormData,D=[];for(const E of(n.formData||[]).filter(j=>j.enabled!==!1&&j.key.trim()!==""))if(E.type==="file"){if(!E.file)throw new Error(`File field "${E.key}" needs a file selection.`);O.append(E.key,E.file,E.fileName||E.file.name),D.push(`${E.key}=[file: ${E.fileName||E.file.name}]`)}else O.append(E.key,E.value),D.push(`${E.key}=${E.value}`);f=D.join(`
|
|
48
|
+
`),g=O,h="multipart"}else if(b==="binary"){const O=n.binary;if(!O?.file)throw new Error("Binary body needs a file selection.");f=`[file: ${O.fileName||O.file.name}]`,g=O.file,A||u.push(["Content-Type",C||O.contentType||O.file.type||"application/octet-stream"]),h="binary"}else if(b==="graphql"){const O=n.graphql?.query||"",D=n.graphql?.variables?.trim()||"";let E={};if(D)try{E=JSON.parse(D)}catch{throw new Error("GraphQL variables must be valid JSON.")}f=JSON.stringify({query:O,variables:E}),g=f,A||u.push(["Content-Type",C||"application/json"]),h="json"}else{f=n.body||"",g=f;const O=b==="json"?"application/json":void 0;!A&&(C||O)&&u.push(["Content-Type",C||O]),h=b==="json"||(A||C||O)?.includes("json")?"json":"text"}}const v=Kk(u);return{url:Pk(s,c),method:r,headers:v,headerEntries:u,body:f,bodyKind:h,init:{method:r,headers:u,body:g}}}function Zk(t){const e=Gk(t),n=Yk(t.url),r=t.bodyKind==="binary"&&typeof File<"u"&&t.init.body instanceof File?t.init.body:void 0;return{method:t.method,url:n.url,query:n.query,headers:e.map(([s,a])=>({key:s,value:a})),body:t.body,contentType:cf(e,"Content-Type"),bodyMode:t.bodyKind==="json"?"json":t.bodyKind==="form"?"urlencoded":t.bodyKind==="multipart"?"formdata":t.bodyKind==="binary"?"binary":t.body?"raw":"none",binary:t.bodyKind==="binary"?{file:r,fileName:r?.name,contentType:cf(e,"Content-Type")}:void 0,urlencoded:t.bodyKind==="form"&&t.body?[...new URLSearchParams(t.body).entries()].map(([s,a])=>({key:s,value:a,enabled:!0})):void 0,auth:{type:"none"}}}function G0(t,e={}){return Wk(t,e)}function da(t){return P0(t)}function eC(t){return Y0(t)}function tC(t,e){return K0(t,e)}function nC(t){return Zk(t)}function iC(t,e,n){return t.paths[e]?.[n.toLowerCase()]}function rC(t,e){const n=t.components?.securitySchemes?.[e];if(!n)return;if(!("$ref"in n))return n;const r=n.$ref,s="#/components/securitySchemes/";if(!r.startsWith(s))return;const a=t.components?.securitySchemes?.[decodeURIComponent(r.slice(s.length))];return a&&!("$ref"in a)?a:void 0}function sC(t,e,n,r){const a=iC(t,e,n)?.security??t.security??[];if(!a.length)return;const c=a.find(f=>{const h=Object.keys(f);return h.length===1&&!!r[h[0]]});if(c)return c;const u=a.find(f=>{const h=Object.keys(f);return h.length>0&&h.every(g=>!!r[g])});return u||(a.find(f=>Object.keys(f).length===0)??a[0])}function lC(t,e,n=[]){if(e){if(t.type==="http"&&t.scheme?.toLowerCase()==="bearer")return{type:"bearer",token:e};if(t.type==="http"&&t.scheme?.toLowerCase()==="basic"){const r=e.indexOf(":");return r>=0?{type:"basic",username:e.slice(0,r),password:e.slice(r+1)}:{type:"basic",username:e,password:""}}if(t.type==="apiKey"&&(t.in==="header"||t.in==="query")&&t.name)return{type:"apiKey",key:t.name,value:e,in:t.in};if(t.type==="openIdConnect")return{type:"oauth2",accessToken:e,grantType:"accessToken",scopes:n};if(t.type==="oauth2"){const r=t.flows,s=r?.authorizationCode?["authorizationCode",r.authorizationCode]:r?.clientCredentials?["clientCredentials",r.clientCredentials]:r?.password?["password",r.password]:r?.implicit?["implicit",r.implicit]:void 0,a=s?.[1];return{type:"oauth2",accessToken:e,grantType:s?.[0]||"accessToken",authorizationUrl:a?.authorizationUrl,tokenUrl:a?.tokenUrl,scopes:n.length?n:Object.keys(a?.scopes||{})}}}}function X0(t,e){return{...t,headers:t.headers?.filter(n=>n.key.toLowerCase()!==e.toLowerCase())}}function aC(t,e){return{...t,query:t.query?.filter(n=>n.key!==e)}}function oC(t,e,n,r,s){let a=nC(s);const c=sC(t,e,n,r.auth||{});if(!c||Object.keys(c).length!==1)return a;const u=Object.keys(c)[0],f=rC(t,u),h=r.auth?.[u]||"";if(!f)return a;if(!h)return{...a,auth:{type:"inherit"}};const g=lC(f,h,c[u]||[]);return g?(g.type==="bearer"||g.type==="oauth2"||g.type==="basic"?a=X0(a,"Authorization"):g.type==="apiKey"&&g.in==="header"?a=X0(a,g.key):g.type==="apiKey"&&g.in==="query"&&(a=aC(a,g.key)),{...a,auth:g}):a}function cC(t,e,n,r,s){const a=B0(t,e,n,r);return{request:oC(t,e,n,r,a),serverUrl:r.serverUrl||s}}function Bo(t){if(t)return t.type==="bearer"?{...t,token:""}:t.type==="oauth2"?{...t,accessToken:"",...t.clientSecret!==void 0?{clientSecret:""}:{},...t.password!==void 0?{password:""}:{},...t.refreshToken!==void 0?{refreshToken:""}:{},scopes:t.scopes?[...t.scopes]:void 0}:t.type==="basic"||t.type==="digest"||t.type==="ntlm"?{...t,password:""}:t.type==="apiKey"?{...t,value:""}:t.type==="hawk"?{...t,key:""}:t.type==="oauth1"?{...t,consumerSecret:"",...t.token!==void 0?{token:""}:{},...t.tokenSecret!==void 0?{tokenSecret:""}:{}}:t.type==="awsv4"?{...t,secretKey:"",...t.sessionToken!==void 0?{sessionToken:""}:{}}:{...t}}const uf="[REDACTED]";function uC(t){return t.trim().toLowerCase().replace(/[^a-z0-9]/g,"")}function df(t){const e=uC(t);return e.includes("authorization")||e.includes("cookie")||e.includes("token")||e.includes("signature")||e.includes("secret")||e.includes("password")||e.endsWith("key")}function J0(t){return t?.map(e=>df(e.key)?{...e,value:uf}:e)}function dC(t){return t?.map(e=>df(e[0])?[e[0],uf]:e)}function Q0(t){const e=t.indexOf("#"),n=e>=0?t.slice(e):"",r=e>=0?t.slice(0,e):t,s=r.indexOf("?");if(s<0)return t;const a=r.slice(0,s),c=r.slice(s+1).split("&").map(u=>{if(!u)return u;const f=u.indexOf("="),h=f>=0?u.slice(0,f):u;let g=h;try{g=decodeURIComponent(h.replace(/\+/g," "))}catch{}return df(g)?`${h}=${encodeURIComponent(uf)}`:u}).join("&");return`${a}?${c}${n}`}function fC(t,e){const n={...t,url:Q0(t.url),query:J0(t.query),headers:J0(t.headers),auth:Bo(t.auth)};return e&&(delete n.body,delete n.urlencoded,delete n.formData,delete n.binary,delete n.graphql),n}const W0=new WeakMap;function hC(t){const e=W0.get(t.history);if(e&&e.historyBodies===t.historyBodies)return e.entries;const n=t.history.map(r=>{const s=t.historyBodies===!1&&r.transport!=="browser",a={...r,resolvedUrl:Q0(r.resolvedUrl),request:fC(r.request,s),responseHeaders:dC(r.responseHeaders)};return s&&(delete a.responseBody,delete a.responseBodyTruncated,delete a.requestBodyTruncated),a});return W0.set(t.history,{historyBodies:t.historyBodies,entries:n}),n}function Z0(t){const e=t.credentialStorage!==void 0&&t.credentialStorage!=="remember";return{...t,...e?{collections:t.collections.map(n=>({...n,auth:Bo(n.auth)})),folders:t.folders.map(n=>({...n,auth:Bo(n.auth)})),requests:t.requests.map(n=>({...n,request:{...n.request,auth:Bo(n.request.auth)}}))}:{},history:hC(t)}}const pC="flexdoc-api-client",mC=1,tl="workspaces",gC="My Collection",ey=100,ty=256*1024,yC=256*1024;function fa(){return new Date().toISOString()}function On(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Xe(t,e){return typeof t[e]=="string"}function $o(t,e){const n=t[e];return n===void 0||typeof n=="number"&&Number.isFinite(n)}function Io(t){return!On(t)||!Xe(t,"key")||!Xe(t,"value")?!1:t.enabled===void 0||typeof t.enabled=="boolean"}function bC(t){if(!Io(t))return!1;const e=t;return!(e.type!==void 0&&e.type!=="text"&&e.type!=="file"||e.fileName!==void 0&&typeof e.fileName!="string"||e.contentType!==void 0&&typeof e.contentType!="string"||e.file!==void 0&&typeof File<"u"&&!(e.file instanceof File))}function xC(t){return!(!On(t)||t.fileName!==void 0&&typeof t.fileName!="string"||t.contentType!==void 0&&typeof t.contentType!="string"||t.file!==void 0&&typeof File<"u"&&!(t.file instanceof File))}function Ho(t){if(!On(t)||typeof t.type!="string")return!1;if(t.type==="none"||t.type==="inherit")return!0;if(t.type==="bearer")return Xe(t,"token");if(t.type==="oauth2"){if(!Xe(t,"accessToken")||t.grantType!==void 0&&(typeof t.grantType!="string"||!["accessToken","authorizationCode","clientCredentials","password","implicit"].includes(t.grantType))||t.clientAuthentication!==void 0&&t.clientAuthentication!=="body"&&t.clientAuthentication!=="basic")return!1;for(const e of["authorizationUrl","tokenUrl","clientId","clientSecret","redirectUri","username","password","refreshToken"])if(t[e]!==void 0&&typeof t[e]!="string")return!1;return t.scopes===void 0||Array.isArray(t.scopes)&&t.scopes.every(e=>typeof e=="string")}return t.type==="basic"||t.type==="digest"?Xe(t,"username")&&Xe(t,"password"):t.type==="apiKey"?Xe(t,"key")&&Xe(t,"value")&&(t.in==="header"||t.in==="query"||t.in==="cookie"):t.type==="hawk"?Xe(t,"id")&&Xe(t,"key")&&(t.algorithm===void 0||t.algorithm==="sha1"||t.algorithm==="sha256")&&(t.ext===void 0||typeof t.ext=="string"):t.type==="ntlm"?Xe(t,"username")&&Xe(t,"password")&&(t.domain===void 0||typeof t.domain=="string")&&(t.workstation===void 0||typeof t.workstation=="string"):t.type==="oauth1"?Xe(t,"consumerKey")&&Xe(t,"consumerSecret")&&(t.token===void 0||typeof t.token=="string")&&(t.tokenSecret===void 0||typeof t.tokenSecret=="string")&&(t.realm===void 0||typeof t.realm=="string")&&(t.signatureMethod===void 0||["HMAC-SHA1","HMAC-SHA256","PLAINTEXT"].includes(String(t.signatureMethod))):t.type==="awsv4"?Xe(t,"accessKey")&&Xe(t,"secretKey")&&Xe(t,"region")&&Xe(t,"service")&&(t.sessionToken===void 0||typeof t.sessionToken=="string"):!1}function ff(t){return`flexdoc:credentials:v1:${t}`}function vC(t){const e=[];for(const n of t.collections)e.push(["c",n.id,n.auth]);for(const n of t.folders)e.push(["f",n.id,n.auth]);for(const n of t.requests)n.request.auth&&e.push(["r",n.id,n.request.auth]);for(const n of t.history)n.request.auth&&e.push(["h",n.id,n.request.auth]);return e}function wC(t){const e=new Map;if(typeof sessionStorage>"u")return e;try{const n=JSON.parse(sessionStorage.getItem(ff(t))||"[]");if(!Array.isArray(n))return e;for(const r of n)!Array.isArray(r)||r.length!==3||!["c","f","r","h"].includes(r[0])||typeof r[1]!="string"||!Ho(r[2])||e.set(`${r[0]}:${r[1]}`,r[2])}catch{}return e}function SC(t,e){if(e.credentialStorage!=="session")return e;const n=wC(t);return n.size===0?e:{...e,collections:e.collections.map(r=>({...r,auth:n.get(`c:${r.id}`)||r.auth})),folders:e.folders.map(r=>({...r,auth:n.get(`f:${r.id}`)||r.auth})),requests:e.requests.map(r=>({...r,request:{...r.request,auth:n.get(`r:${r.id}`)||r.request.auth}})),history:e.history.map(r=>({...r,request:{...r.request,auth:n.get(`h:${r.id}`)||r.request.auth}}))}}function AC(t,e){if(!(typeof sessionStorage>"u"))try{e.credentialStorage==="session"?sessionStorage.setItem(ff(t),JSON.stringify(vC(e))):sessionStorage.removeItem(ff(t))}catch{}}function ny(t){return!On(t)||!Xe(t,"method")||!Xe(t,"url")||t.query!==void 0&&(!Array.isArray(t.query)||!t.query.every(Io))||t.headers!==void 0&&(!Array.isArray(t.headers)||!t.headers.every(Io))||t.body!==void 0&&typeof t.body!="string"||t.contentType!==void 0&&typeof t.contentType!="string"||t.bodyMode!==void 0&&!["none","raw","json","urlencoded","formdata","binary","graphql"].includes(String(t.bodyMode))||t.urlencoded!==void 0&&(!Array.isArray(t.urlencoded)||!t.urlencoded.every(Io))||t.formData!==void 0&&(!Array.isArray(t.formData)||!t.formData.every(bC))||t.binary!==void 0&&!xC(t.binary)||t.graphql!==void 0&&(!On(t.graphql)||!Xe(t.graphql,"query")||!Xe(t.graphql,"variables"))||t.hostExecution!==void 0&&(!On(t.hostExecution)||t.hostExecution.certificateId!==void 0&&typeof t.hostExecution.certificateId!="string"||t.hostExecution.cookieJar!==void 0&&t.hostExecution.cookieJar!=="session"||t.hostExecution.preferHostExecution!==void 0&&typeof t.hostExecution.preferHostExecution!="boolean")?!1:t.auth===void 0||Ho(t.auth)}function iy(t){return On(t)&&Xe(t,"id")&&Xe(t,"key")&&Xe(t,"value")&&(t.enabled===void 0||typeof t.enabled=="boolean")}function kC(t){return!On(t)||!Xe(t,"id")||!Xe(t,"name")||!Xe(t,"createdAt")||!Xe(t,"updatedAt")?null:{id:t.id,name:t.name,auth:Ho(t.auth)?t.auth:{type:"none"},variables:Array.isArray(t.variables)?t.variables.filter(iy):[],createdAt:t.createdAt,updatedAt:t.updatedAt}}function CC(t){return!On(t)||!Xe(t,"id")||!Xe(t,"collectionId")||t.parentFolderId!==void 0&&typeof t.parentFolderId!="string"||!Xe(t,"name")||!Xe(t,"createdAt")||!Xe(t,"updatedAt")?null:{id:t.id,collectionId:t.collectionId,parentFolderId:t.parentFolderId,name:t.name,auth:Ho(t.auth)?t.auth:{type:"inherit"},createdAt:t.createdAt,updatedAt:t.updatedAt}}function NC(t,e){const n=t.map(CC).filter(s=>s!==null).filter(s=>e.has(s.collectionId)),r=new Map(n.map(s=>[s.id,s]));for(const s of n){if(!s.parentFolderId)continue;const a=r.get(s.parentFolderId);(!a||a.collectionId!==s.collectionId||a.id===s.id)&&(s.parentFolderId=void 0)}for(const s of n){if(!s.parentFolderId)continue;const a=new Set([s.id]);let c=s.parentFolderId;for(;c;){if(a.has(c)){s.parentFolderId=void 0;break}a.add(c),c=r.get(c)?.parentFolderId}}return n}function ry(t){if(!(!On(t)||!Xe(t,"preRequest")||!Xe(t,"tests")))return{preRequest:t.preRequest,tests:t.tests}}function TC(t){if(!On(t)||!Xe(t,"id")||!Xe(t,"collectionId")||t.folderId!==void 0&&typeof t.folderId!="string"||!Xe(t,"name")||!ny(t.request)||!Xe(t,"createdAt")||!Xe(t,"updatedAt"))return null;const e=ry(t.scripts);return{id:t.id,collectionId:t.collectionId,folderId:t.folderId,name:t.name,request:Ei(t.request),...e?{scripts:e}:{},createdAt:t.createdAt,updatedAt:t.updatedAt}}function jC(t){return!On(t)||!Xe(t,"id")||!Xe(t,"name")||!Array.isArray(t.variables)||!Xe(t,"createdAt")||!Xe(t,"updatedAt")?null:{id:t.id,name:t.name,variables:t.variables.filter(iy),createdAt:t.createdAt,updatedAt:t.updatedAt}}function EC(t){return Array.isArray(t)&&t.length===2&&typeof t[0]=="string"&&typeof t[1]=="string"}function OC(t){return!On(t)||!Xe(t,"name")||typeof t.passed!="boolean"||t.error!==void 0&&typeof t.error!="string"?null:{name:t.name,passed:t.passed,error:t.error}}function MC(t){if(!On(t)||!Xe(t,"id")||!ny(t.request)||!Xe(t,"executedMethod")||!Xe(t,"resolvedUrl")||!$o(t,"status")||t.statusText!==void 0&&typeof t.statusText!="string"||!$o(t,"responseTime")||t.responseHeaders!==void 0&&(!Array.isArray(t.responseHeaders)||!t.responseHeaders.every(EC))||t.responseBody!==void 0&&typeof t.responseBody!="string"||t.responseBodyTruncated!==void 0&&typeof t.responseBodyTruncated!="boolean"||t.requestBodyTruncated!==void 0&&typeof t.requestBodyTruncated!="boolean"||t.runId!==void 0&&typeof t.runId!="string"||t.runName!==void 0&&typeof t.runName!="string"||!$o(t,"runIndex")||!$o(t,"runTotal")||t.runPassed!==void 0&&typeof t.runPassed!="boolean"||t.runCancelled!==void 0&&typeof t.runCancelled!="boolean"||t.error!==void 0&&typeof t.error!="string"||t.scriptError!==void 0&&typeof t.scriptError!="string"||!Xe(t,"createdAt"))return null;const e=ry(t.scripts),n=Array.isArray(t.scriptTests)?t.scriptTests.map(OC).filter(s=>s!==null):[],r=Array.isArray(t.scriptLogs)?t.scriptLogs.filter(s=>typeof s=="string"):[];return{id:t.id,collectionId:typeof t.collectionId=="string"?t.collectionId:void 0,folderId:typeof t.folderId=="string"?t.folderId:void 0,request:Ei(t.request),...e?{scripts:e}:{},executedMethod:t.executedMethod,resolvedUrl:t.resolvedUrl,status:t.status,statusText:t.statusText,responseTime:t.responseTime,transport:t.transport==="browser"||t.transport==="api-host"?t.transport:void 0,responseHeaders:Array.isArray(t.responseHeaders)?t.responseHeaders.map(([s,a])=>[s,a]):void 0,responseBody:typeof t.responseBody=="string"?t.responseBody:void 0,responseBodyTruncated:t.responseBodyTruncated===!0?!0:void 0,requestBodyTruncated:t.requestBodyTruncated===!0?!0:void 0,runId:typeof t.runId=="string"?t.runId:void 0,runName:typeof t.runName=="string"?t.runName:void 0,runIndex:typeof t.runIndex=="number"?t.runIndex:void 0,runTotal:typeof t.runTotal=="number"?t.runTotal:void 0,runPassed:typeof t.runPassed=="boolean"?t.runPassed:void 0,runCancelled:t.runCancelled===!0?!0:void 0,error:t.error,...n.length?{scriptTests:n}:{},...r.length?{scriptLogs:r}:{},scriptError:t.scriptError,createdAt:t.createdAt}}function sy(t){const e=Object.create(null);for(const n of t){const r=n.key.trim();n.enabled===!1||!r||(e[r]=n.value)}return e}function Sn(t){const e=globalThis.crypto?.randomUUID?.();return e?`${t}-${e}`:`${t}-${Date.now()}-${Math.random().toString(36).slice(2,10)}`}function ly(t,e){const n=e?.trim()||"unknown-host",r=t?.trim()||"untitled";return`flexdoc:${encodeURIComponent(n)}:${encodeURIComponent(r)}`}function Ei(t){const e=t.auth?t.auth.type==="oauth2"?{...t.auth,scopes:t.auth.scopes?[...t.auth.scopes]:void 0}:{...t.auth}:void 0;return{...t,query:t.query?.map(n=>({...n})),headers:t.headers?.map(n=>({...n})),urlencoded:t.urlencoded?.map(n=>({...n})),formData:t.formData?.map(n=>({...n,file:void 0})),binary:t.binary?{...t.binary,file:void 0}:void 0,graphql:t.graphql?{...t.graphql}:void 0,auth:e,hostExecution:t.hostExecution?{...t.hostExecution}:void 0}}function nl(){const t=fa();return{version:6,credentialStorage:"session",collections:[{id:Sn("collection"),name:gC,auth:{type:"none"},variables:[],createdAt:t,updatedAt:t}],folders:[],requests:[],environments:[],history:[]}}function ay(t){if(!On(t)||![1,2,3,4,5,6].includes(t.version))return nl();const e=(Array.isArray(t.collections)?t.collections:[]).map(kC).filter(h=>h!==null);if(e.length===0)return nl();const n=new Set(e.map(h=>h.id)),r=NC(Array.isArray(t.folders)?t.folders:[],n),s=new Map(r.map(h=>[h.id,h])),a=(Array.isArray(t.requests)?t.requests:[]).map(TC).filter(h=>h!==null).filter(h=>n.has(h.collectionId)).map(h=>h.folderId?s.get(h.folderId)?.collectionId===h.collectionId?h:{...h,folderId:void 0}:h);if(t.version===1)return{version:6,collections:e,folders:r,requests:a,environments:[],history:[]};const c=(Array.isArray(t.environments)?t.environments:[]).map(jC).filter(h=>h!==null),u=typeof t.activeEnvironmentId=="string"&&c.some(h=>h.id===t.activeEnvironmentId)?t.activeEnvironmentId:void 0,f=(t.version===4||t.version===5||t.version===6)&&Array.isArray(t.history)?t.history.map(MC).filter(h=>h!==null).slice(0,ey):[];return{version:6,collections:e,folders:r,requests:a,environments:c,activeEnvironmentId:u,credentialStorage:t.credentialStorage==="session"||t.credentialStorage==="remember"||t.credentialStorage==="never"?t.credentialStorage:void 0,historyBodies:typeof t.historyBodies=="boolean"?t.historyBodies:void 0,history:f}}function RC(t){let e=yC,n=!1;const r=a=>{if(a.length<=e)return e-=a.length,a;const c=a.slice(0,e);return e=0,n=!0,c},s={...t};return s.body!==void 0&&(s.body=r(s.body)),s.graphql&&(s.graphql={query:r(s.graphql.query),variables:r(s.graphql.variables)}),s.urlencoded&&(s.urlencoded=s.urlencoded.map(a=>({...a,value:r(a.value)}))),s.formData&&(s.formData=s.formData.map(a=>({...a,value:r(a.value)}))),{request:s,truncated:n}}function oy(t,e){const n=e.responseBody===void 0?void 0:e.responseBody.slice(0,ty),r=e.responseBodyTruncated===!0||(e.responseBody?.length||0)>ty,s=RC(Ei(e.request)),a={id:Sn("history"),collectionId:e.collectionId,folderId:e.folderId,request:s.request,...s.truncated?{requestBodyTruncated:!0}:{},...e.scripts?{scripts:wn(e.scripts)}:{},executedMethod:e.executedMethod,resolvedUrl:e.resolvedUrl,status:e.status,statusText:e.statusText,responseTime:e.responseTime,transport:e.transport,...e.responseHeaders?.length?{responseHeaders:e.responseHeaders.map(([c,u])=>[c,u])}:{},...n!==void 0?{responseBody:n,...r?{responseBodyTruncated:!0}:{}}:{},runId:e.runId,runName:e.runName,runIndex:e.runIndex,runTotal:e.runTotal,runPassed:e.runPassed,...e.runCancelled?{runCancelled:!0}:{},error:e.error,...e.scriptTests?.length?{scriptTests:e.scriptTests.map(c=>({...c}))}:{},...e.scriptLogs?.length?{scriptLogs:[...e.scriptLogs]}:{},scriptError:e.scriptError,createdAt:fa()};return{...t,history:[a,...t.history].slice(0,ey)}}function cy(t,e,n,r={type:"none"}){if(r.type!=="inherit")return{...r};const s=new Map(t.folders.map(f=>[f.id,f])),a=new Set;let c=n?s.get(n):void 0;for(;c&&c.collectionId===e&&!a.has(c.id);){if(a.add(c.id),c.auth.type!=="inherit")return{...c.auth};c=c.parentFolderId?s.get(c.parentFolderId):void 0}const u=t.collections.find(f=>f.id===e);return u&&u.auth.type!=="inherit"?{...u.auth}:{type:"none"}}function uy(t,e){const n=t.collections.find(r=>r.id===e);return sy(n?.variables||[])}function hf(t){const e=t.environments.find(n=>n.id===t.activeEnvironmentId);return sy(e?.variables||[])}function pf(t,e){if(!t.activeEnvironmentId||e.length===0)return t;const n=t.environments.findIndex(u=>u.id===t.activeEnvironmentId);if(n<0)return t;let s=t.environments[n].variables.map(u=>({...u})),a=!1;for(const u of e){const f=u.key.trim();if(!f)continue;if(u.action==="unset"){const b=s.filter(v=>v.key.trim()!==f);b.length!==s.length&&(s=b,a=!0);continue}const h=s.map((b,v)=>b.key.trim()===f?v:-1).filter(b=>b>=0),g=u.value||"";if(h.length>0){const b=h[0];s[b]={...s[b],key:f,value:g,enabled:!0},h.length>1&&(s=s.filter((v,w)=>w===b||v.key.trim()!==f))}else s.push({id:Sn("variable"),key:f,value:g,enabled:!0});a=!0}if(!a)return t;const c=t.environments.map((u,f)=>f===n?{...u,variables:s,updatedAt:fa()}:u);return{...t,environments:c}}function dy(t,e,n){if(!e||n.length===0)return t;const r=t.collections.findIndex(f=>f.id===e);if(r<0)return t;let a=t.collections[r].variables.map(f=>({...f})),c=!1;for(const f of n){const h=f.key.trim();if(!h)continue;if(f.action==="unset"){const v=a.filter(w=>w.key.trim()!==h);v.length!==a.length&&(a=v,c=!0);continue}const g=a.map((v,w)=>v.key.trim()===h?w:-1).filter(v=>v>=0),b=f.value||"";if(g.length>0){const v=g[0];a[v]={...a[v],key:h,value:b,enabled:!0},g.length>1&&(a=a.filter((w,A)=>A===v||w.key.trim()!==h))}else a.push({id:Sn("variable"),key:h,value:b,enabled:!0});c=!0}if(!c)return t;const u=t.collections.map((f,h)=>h===r?{...f,variables:a,updatedAt:fa()}:f);return{...t,collections:u}}function DC(t,e){return{...t,environments:t.environments.filter(n=>n.id!==e),activeEnvironmentId:t.activeEnvironmentId===e?void 0:t.activeEnvironmentId}}function _C(t,e){const n=t.folders.find(s=>s.id===e);if(!n)return t;const r=fa();return{...t,folders:t.folders.filter(s=>s.id!==e).map(s=>s.parentFolderId===e?{...s,parentFolderId:n.parentFolderId,updatedAt:r}:s),requests:t.requests.map(s=>s.folderId===e?{...s,folderId:n.parentFolderId,updatedAt:r}:s)}}function LC(t,e){const n=t.collections.filter(r=>r.id!==e);return n.length===0?{...nl(),environments:t.environments,activeEnvironmentId:t.activeEnvironmentId,credentialStorage:t.credentialStorage,history:t.history}:{...t,collections:n,folders:t.folders.filter(r=>r.collectionId!==e),requests:t.requests.filter(r=>r.collectionId!==e)}}function fy(){return typeof indexedDB>"u"?Promise.resolve(null):new Promise((t,e)=>{const n=indexedDB.open(pC,mC);n.onupgradeneeded=()=>{const r=n.result;r.objectStoreNames.contains(tl)||r.createObjectStore(tl)},n.onsuccess=()=>t(n.result),n.onerror=()=>e(n.error||new Error("Unable to open FlexDoc API Client storage"))})}async function hy(t){const e=await fy();if(!e)return nl();try{return await new Promise((n,r)=>{const a=e.transaction(tl,"readonly").objectStore(tl).get(t);a.onsuccess=()=>n(SC(t,ay(a.result))),a.onerror=()=>r(a.error||new Error("Unable to load FlexDoc API Client workspace"))})}finally{e.close()}}async function py(t,e){AC(t,e);const n=await fy();if(n)try{await new Promise((r,s)=>{const a=n.transaction(tl,"readwrite");a.objectStore(tl).put(Z0(e),t),a.oncomplete=()=>r(),a.onerror=()=>s(a.error||new Error("Unable to save FlexDoc API Client workspace")),a.onabort=()=>s(a.error||new Error("Unable to save FlexDoc API Client workspace"))})}finally{n.close()}}const qC=300;function BC(t,e){return t.requests===e.requests&&t.folders===e.folders&&t.history===e.history&&t.version===e.version&&t.activeEnvironmentId===e.activeEnvironmentId&&t.credentialStorage===e.credentialStorage&&t.historyBodies===e.historyBodies}function my(t,e,n){const[r,s]=I.useState(!1),a=I.useRef(e),c=I.useRef(t),u=I.useRef(n),f=I.useRef(!1),h=I.useRef(null);return I.useEffect(()=>{a.current=e,c.current=t,u.current=n}),I.useEffect(()=>{if(!n||t===!1)return;const g=()=>{f.current=!1,py(t,e).then(()=>s(!1)).catch(()=>s(!0))},b=h.current;if(h.current=e,b&&BC(b,e)){f.current=!0;const v=setTimeout(g,qC);return()=>clearTimeout(v)}g()},[n,t,e]),I.useEffect(()=>{const g=()=>{const b=c.current;!f.current||!u.current||b===!1||(f.current=!1,py(b,a.current).catch(()=>{}))};return typeof window<"u"&&window.addEventListener("pagehide",g),()=>{typeof window<"u"&&window.removeEventListener("pagehide",g),g()}},[]),r}const $C=["browser","api-host"];function mf(t,e){if(t.length===1)return t[0];const n=Math.ceil(e*t.length);return t[Math.min(Math.max(n,1),t.length)-1]}function IC(t){return t>=200&&t<300?"2xx":t>=300&&t<400?"3xx":t>=400&&t<500?"4xx":t>=500&&t<600?"5xx":"other"}function HC(t={}){const e=Math.max(1,Math.floor(t.durationSampleCapacity??2048)),n=t.now??(()=>Date.now()),r=t.random??Math.random;let s=null,a=null,c=0,u={},f;const h=()=>({observed:0,retained:[]}),g=()=>({attempts:0,responses:0,failures:0,networkFailures:0,statusClasses:{"2xx":0,"3xx":0,"4xx":0,"5xx":0,other:0},total:h(),target:h(),overhead:h()}),b=()=>{f={browser:g(),"api-host":g()}};b();const v=(D,E)=>{if(typeof E!="number"||!Number.isFinite(E))return;const j=Math.max(0,E);if(D.observed+=1,D.retained.length<e){D.retained.push(j);return}const M=Math.floor(r()*D.observed);M<e&&(D.retained[M]=j)},w=D=>{if(D.retained.length===0)return null;const E=[...D.retained].sort((j,M)=>j-M);return{sampleCount:E.length,sampled:D.observed>E.length,minMs:E[0],p50Ms:mf(E,.5),p95Ms:mf(E,.95),p99Ms:mf(E,.99),maxMs:E[E.length-1]}};return{record:D=>{const E=n();s===null&&(s=E),a=E,c+=1;const j=D.response?.transport??D.result?.transport;if(j!=="browser"&&j!=="api-host"){const R=D.result?"host-unavailable":D.scriptError?"script-error":"request-invalid";u[R]=(u[R]??0)+1;return}const M=f[j];M.attempts+=1;const _=D.response;if(!_){M.failures+=1,D.failureKind==="browser-network"&&(M.networkFailures+=1);return}if(M.responses+=1,M.statusClasses[IC(_.status)]+=1,j==="browser"){v(M.total,_.responseTime);return}const q=_.hostRoundTripTime??_.responseTime;v(M.total,q),v(M.target,_.responseTime),typeof _.hostRoundTripTime=="number"&&typeof _.responseTime=="number"&&v(M.overhead,Math.max(0,_.hostRoundTripTime-_.responseTime))},snapshot:()=>({windowStart:s===null?null:new Date(s).toISOString(),windowEnd:a===null?null:new Date(a).toISOString(),executions:c,byTransport:$C.reduce((D,E)=>{const j=f[E];return D[E]={attempts:j.attempts,responses:j.responses,failures:j.failures,networkFailures:j.networkFailures,statusClasses:{...j.statusClasses},totalDurations:w(j.total),targetDurations:w(j.target),hostOverhead:w(j.overhead)},D},{}),unexecuted:{...u}}),reset:()=>{s=null,a=null,c=0,u={},b()}}}function zC(t,e=new Date().toISOString()){return{schema:"flexdoc.api-client.transport-observation/1",generatedAt:e,observation:t,pairsWith:"flexdoc.host-execution.observation/1",gaps:["host-side-rejection-reasons"]}}const gf=HC();function UC(t){gf.record(t)}function VC(){return gf.snapshot()}function FC(){gf.reset()}const PC={cookies:"Cookie jar",clientCertificates:"Client certificates (mTLS)",digest:"Digest auth",hawk:"Hawk auth",ntlm:"NTLM auth",oauth1:"OAuth 1.0",awsv4:"AWS Signature V4"};function gy(t){return PC[t]}function yf(t){const e=t.auth?t.auth.type==="oauth2"?{...t.auth,scopes:t.auth.scopes?[...t.auth.scopes]:void 0}:{...t.auth}:void 0;return{...t,query:t.query?.map(n=>({...n})),headers:t.headers?.map(n=>({...n})),urlencoded:t.urlencoded?.map(n=>({...n})),formData:t.formData?.map(n=>({...n})),binary:t.binary?{...t.binary}:void 0,graphql:t.graphql?{...t.graphql}:void 0,auth:e,hostExecution:t.hostExecution?{...t.hostExecution}:void 0}}function YC(t){const e=yf(t);return e.binary&&(e.binary={fileName:e.binary.fileName,contentType:e.binary.contentType}),e.formData&&(e.formData=e.formData.map(n=>{const r={...n};return delete r.file,r})),e}function zo(t){return Object.assign(Object.create(null),t||{})}function KC(t){return t instanceof Error?t.message:"Request failed"}function GC(t){return t?Array.isArray(t)?t.map(([e,n])=>[String(e),String(n)]):[...new Headers(t).entries()]:[]}function XC(t,e){if(e.body!=null&&typeof e.body!="string")return;const r=[`curl -X ${String(e.method||"GET").toUpperCase()} ${JSON.stringify(t)}`];for(const[s,a]of GC(e.headers))r.push(` -H ${JSON.stringify(`${s}: ${a}`)}`);return typeof e.body=="string"&&e.body.length>0&&r.push(` --data-raw ${JSON.stringify(e.body)}`),r.join(` \\
|
|
49
|
+
`)}function yy(t,e){return e?.available?`The API host does not support: ${t.map(gy).join(", ")}.`:"API-host execution is unavailable on this documentation server."}function Uo(t){const e=(t.request.method||"GET").toUpperCase(),n=[...new Set([...eC(t.request),...t.additionalRequirements||[]])],r=["GET","HEAD"].includes(e)&&da(t.request)!=="none",s=t.request.hostExecution?.preferHostExecution,a=t.hostExecution?.preferHostExecution,c=a===!1?!1:t.preferHostExecution??s??a??!0,u=new Set(t.hostExecution?.capabilities||[]),f=n.filter(b=>!u.has(b)),h=n.length>0||r,g=t.hostExecution?.available===!0&&f.length===0;return[h?"host-required":c&&t.hostExecution?.available===!0?"api-host":"browser",g,r,f]}function JC(t){return t==="host-required"?"Host required":t==="api-host"?"API host":"Browser"}function QC(t,e,n){return t.failureKind!=="browser-network"||t.result?.transport!=="browser"?null:Uo({request:e,hostExecution:n,preferHostExecution:!0})[0]==="api-host"?"Browser request failed (possibly CORS). Try API host.":null}const WC=500;function ZC(t,e,n){const r=t?.hostRoundTripTime??t?.responseTime;return t?.transport!=="api-host"||r==null||r<WC?null:Uo({request:e,hostExecution:n,preferHostExecution:!1})[0]==="browser"?`API-host round trip took ${Math.round(r)} ms. Browser may be faster.`:null}function eN(t,e,n,r){const[s,a,,c]=t;return s==="host-required"?a?n||"The browser cannot send this request. FlexDoc will execute it from the API host.":e?.available?yy(c,e):r||"API-host execution is unavailable on this documentation server.":s==="api-host"?"This request runs from your API server.":null}function tN(t){if(typeof globalThis.btoa!="function")throw new Error("Host execution binary uploads require a Base64 encoder.");let e="";const n=32768;for(let r=0;r<t.length;r+=n)e+=String.fromCharCode(...t.subarray(r,Math.min(r+n,t.length)));return globalThis.btoa(e)}async function nN(t){const e={request:YC(t),...t.hostExecution?.certificateId?{certificateId:t.hostExecution.certificateId}:{},...t.hostExecution?.cookieJar?{cookieJar:t.hostExecution.cookieJar}:{}};t.bodyMode==="binary"&&t.binary?.file&&(e.bodyBase64=tN(new Uint8Array(await t.binary.file.arrayBuffer())));const n=(t.formData||[]).map((r,s)=>({entry:r,index:s})).filter(({entry:r})=>r.enabled!==!1&&r.type==="file"&&!!r.file);if(n.length>0){if(typeof FormData>"u")throw new Error("Host multipart execution requires FormData support.");const r=new FormData;r.append("descriptor",JSON.stringify(e));for(const{entry:s,index:a}of n){const c=s.file;r.append(`formData[${a}]`,c,s.fileName||c.name)}return{body:r,headers:{"X-FlexDoc-Execute":"1"}}}return{body:JSON.stringify(e),headers:{"X-FlexDoc-Execute":"1","Content-Type":"application/json"}}}async function by(t){const e=await iN(t);return UC(e),e}async function iN(t){const e=yf(t.request),n=wn(t.scripts),r=t.fetcher||globalThis.fetch,s=t.now||Date.now;let a=yf(t.request),c=zo(t.variables),u=zo(t.collectionVariables);const f=zo(t.externalVariables);let h=zo(t.environmentVariables),g=[],b=[],v,w="",A="",C=0,O=!1,D,E;try{if(n.preRequest.trim()){const R=await F0({script:n.preRequest,phase:"pre-request",draft:a,variables:c,collectionVariables:u,externalVariables:f,environmentVariables:h});if(a=R.draft,c=R.variables,u=R.collectionVariables,h=R.environmentVariables,g=[...g,...R.logs],R.collectionChanges.length>0&&t.onCollectionChanges?.(R.collectionChanges),R.environmentChanges.length>0&&t.onEnvironmentChanges?.(R.environmentChanges),R.error)return{scriptTests:b,scriptLogs:g,scriptError:`Pre-request script: ${R.error}`}}t.resolveAuth&&(a={...a,auth:t.resolveAuth(a.auth)}),a=tC(a,c),w=(a.method||"GET").toUpperCase(),A=a.url;const[j,,,M]=Uo({request:a,hostExecution:t.hostExecution,preferHostExecution:t.preferHostExecution});let _;if(j!=="browser"){if(!t.hostExecution?.available||M.length>0){const fe=yy(M,t.hostExecution);return{error:fe,result:{request:e,scripts:n,executedMethod:w,resolvedUrl:A,error:fe,...g.length?{scriptLogs:[...g]}:{}},scriptTests:b,scriptLogs:g}}if(!r)throw new Error("Fetch API is not available");const R=await nN(a);C=s(),O=!0,D="api-host";const X=await r(t.hostExecution.endpoint,{method:"POST",credentials:"same-origin",headers:R.headers,body:R.body,...t.signal?{signal:t.signal}:{}}),U=await X.text(),B=s()-C;let K;try{const fe=U?JSON.parse(U):{};if(!fe||typeof fe!="object"||Array.isArray(fe))throw new Error("invalid");K=fe}catch{throw new Error("API host returned an invalid execution response.")}const W=typeof K.error=="string"?K.error:void 0;if(!X.ok)throw new Error(W||`API host execution failed with HTTP ${X.status}.`);if(typeof K.status!="number"||!Array.isArray(K.headers))throw new Error("API host returned an invalid execution response.");const ye=K.headers.map(fe=>Array.isArray(fe)?[String(fe[0]),String(fe[1])]:["",""]).filter(([fe])=>!!fe),pe=Array.isArray(K.cookies)?K.cookies:void 0;_={status:K.status,statusText:String(K.statusText||""),headers:ye,body:String(K.body||""),responseTime:typeof K.responseTime=="number"?K.responseTime:B,hostRoundTripTime:B,transport:"api-host",...pe?{cookies:pe}:{}}}else{const R=G0(a);w=R.method,A=R.url,t.onRequestBuilt?.(R);let X={...R.init,url:R.url,credentials:t.credentials||"same-origin",...t.signal?{signal:t.signal}:{}};t.requestInterceptor&&(X=await t.requestInterceptor(X)),t.signal&&(X.signal=t.signal);const{url:U,...B}=X;if(A=U,E=XC(U,B),C=s(),O=!0,D="browser",!r)throw new Error("Fetch API is not available");const K=await r(U,B),W=await K.text();_={status:K.status,statusText:K.statusText,headers:[...K.headers.entries()],body:W,responseTime:s()-C,transport:"browser"}}if(n.tests.trim()){const R=await F0({script:n.tests,phase:"tests",draft:a,variables:c,collectionVariables:u,externalVariables:f,environmentVariables:h,response:_});g=[...g,...R.logs],b=R.tests.map(X=>({...X})),R.collectionChanges.length>0&&t.onCollectionChanges?.(R.collectionChanges),R.environmentChanges.length>0&&t.onEnvironmentChanges?.(R.environmentChanges),R.error&&(v=`Test script: ${R.error}`)}return{result:{request:e,scripts:n,executedMethod:w,resolvedUrl:A,status:_.status,statusText:_.statusText,responseTime:_.responseTime,transport:_.transport,responseHeaders:_.headers.map(([R,X])=>[R,X]),responseBody:_.body,...b.length?{scriptTests:b}:{},...g.length?{scriptLogs:[...g]}:{},...v?{scriptError:v}:{}},response:_,scriptTests:b,scriptLogs:g,...E?{curlCommand:E}:{},...v?{scriptError:v}:{}}}catch(j){const M=KC(j),_={error:M,scriptTests:b,scriptLogs:g,...D==="browser"&&j instanceof TypeError?{failureKind:"browser-network"}:{}};return O&&(_.result={request:e,scripts:n,executedMethod:w,resolvedUrl:A,responseTime:C?s()-C:void 0,transport:D,error:M,...g.length?{scriptLogs:[...g]}:{}}),_}}const rN=()=>p.jsx("span",{"aria-hidden":"true",className:"flex h-5 w-5 shrink-0 items-center justify-center rounded bg-blue-600 text-xs font-bold text-white",children:"F"});function bf({message:t,capabilities:e=[],showCapabilities:n=!0,warning:r=!1,theme:s="light",label:a="Host execution status"}){const c=r?s==="dark"?"border-amber-800 bg-amber-950/40 text-amber-200":"border-amber-300 bg-amber-50 text-amber-800":s==="dark"?"border-blue-800 bg-blue-950/40 text-blue-200":"border-blue-300 bg-blue-50 text-blue-800";return p.jsx("div",{role:r?"alert":"status","aria-label":a,className:`rounded-md border p-3 text-sm ${c}`,children:p.jsxs("div",{className:"flex items-start gap-2",children:[p.jsx(rN,{}),p.jsxs("div",{children:[t,n&&p.jsxs("details",{className:"mt-1",children:[p.jsx("summary",{children:"API host capabilities"}),p.jsxs("div",{className:"mt-1 text-xs",children:["Universal: HTTP method, URL, query, headers, body · Host-specific: ",e.length?e.map(gy).join(" · "):"None advertised."]})]})]})]})})}function il(t,e){const n=t?.trim();if(!n)throw new Error(`${e} is required for this OAuth flow.`);return n}function Vo(t){return(t.scopes||[]).map(e=>e.trim()).filter(Boolean).join(" ")}function sN(t){if(typeof TextEncoder>"u")throw new Error("OAuth Basic client authentication requires UTF-8 encoding support.");const e=new TextEncoder().encode(t);let n="";for(const a of e)n+=String.fromCharCode(a);const r=globalThis.Buffer,s=typeof btoa=="function"?btoa(n):r?.from(n,"binary").toString("base64");if(!s)throw new Error("OAuth Basic client authentication requires Base64 support in this runtime.");return s}function xy(t){let e="";for(const s of t)e+=String.fromCharCode(s);const n=globalThis.Buffer,r=typeof btoa=="function"?btoa(e):n?.from(e,"binary").toString("base64");if(!r)throw new Error("OAuth PKCE requires Base64 support in this runtime.");return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")}function vy(t=32){if(!globalThis.crypto?.getRandomValues)throw new Error("OAuth requires cryptographic random-number support.");const e=new Uint8Array(t);return globalThis.crypto.getRandomValues(e),xy(e)}async function lN(t){if(!globalThis.crypto?.subtle||typeof TextEncoder>"u")throw new Error("OAuth authorization-code flow requires Web Crypto PKCE support.");const e=await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(t));return xy(new Uint8Array(e))}function wy(t,e,n,r){const s=il(t.authorizationUrl,"Authorization URL"),a=il(t.clientId,"Client ID"),c=new URL(s),u=t.grantType||"accessToken";c.searchParams.set("response_type",u==="implicit"?"token":"code"),c.searchParams.set("client_id",a),c.searchParams.set("redirect_uri",n),c.searchParams.set("state",e);const f=Vo(t);return f&&c.searchParams.set("scope",f),r&&(c.searchParams.set("code_challenge",r),c.searchParams.set("code_challenge_method","S256")),c.toString()}function aN(t){const e=new URL(t.location.href);return e.search="",e.hash="",e.toString()}async function oN(t,e){const n=e??(typeof window>"u"?void 0:window);if(!n)throw new Error("Interactive OAuth requires a browser window.");const r=t.redirectUri?.trim()||aN(n);if(new URL(r).origin!==n.location.origin)throw new Error("Interactive OAuth redirect URI must use the same origin as the FlexDoc page so the popup result can be read.");const s=vy(24);if((t.grantType||"accessToken")==="implicit")return{url:wy(t,s,r),state:s,redirectUri:r};const a=vy(48),c=await lN(a);return{url:wy(t,s,r,c),state:s,redirectUri:r,codeVerifier:a}}async function cN(t){const e=await t.text();let n;try{n=e?JSON.parse(e):{}}catch{n=Object.fromEntries(new URLSearchParams(e))}if(!t.ok){const c=String(n.error_description||n.error||`OAuth token endpoint returned ${t.status}`);throw new Error(c)}const r=typeof n.access_token=="string"?n.access_token:"";if(!r)throw new Error("OAuth token endpoint did not return access_token.");const s=n.expires_in,a=typeof s=="number"?s:typeof s=="string"&&s.trim()!==""&&Number.isFinite(Number(s))?Number(s):void 0;return{accessToken:r,refreshToken:typeof n.refresh_token=="string"?n.refresh_token:void 0,tokenType:typeof n.token_type=="string"?n.token_type:void 0,expiresIn:a,scope:typeof n.scope=="string"?n.scope:void 0}}async function Fo(t,e,n){const r=il(t.tokenUrl,"Token URL"),s={"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json"},a=t.clientId?.trim();(t.clientAuthentication||"body")==="basic"&&a?s.Authorization=`Basic ${sN(`${a}:${t.clientSecret||""}`)}`:(a&&e.set("client_id",a),t.clientSecret&&e.set("client_secret",t.clientSecret));const c=await n(r,{method:"POST",headers:s,body:e.toString()});return cN(c)}async function uN(t,e){const n=e.windowObject??(typeof window>"u"?void 0:window);if(!n)throw new Error("Interactive OAuth requires a browser window.");const r=n.open(t.url,"flexdoc-oauth","popup,width=640,height=760");if(!r)throw new Error("OAuth popup was blocked. Allow popups for this documentation origin and try again.");const s=new URL(t.redirectUri),a=Date.now(),c=e.popupTimeoutMs??12e4,u=e.pollIntervalMs??200;for(;Date.now()-a<c;){if(r.closed)throw new Error("OAuth popup was closed before authorization completed.");try{const f=new URL(r.location.href);if(f.origin===s.origin&&f.pathname===s.pathname)return r.close(),f}catch{}await new Promise(f=>setTimeout(f,u))}throw r.close(),new Error("OAuth authorization timed out.")}async function dN(t,e={}){const n=t.grantType||"accessToken",r=e.fetchImpl??fetch;if(n==="accessToken")return{accessToken:il(t.accessToken,"Access token")};if(n==="clientCredentials"){const b=new URLSearchParams({grant_type:"client_credentials"}),v=Vo(t);return v&&b.set("scope",v),Fo(t,b,r)}if(n==="password"){const b=new URLSearchParams({grant_type:"password",username:il(t.username,"Username"),password:t.password||""}),v=Vo(t);return v&&b.set("scope",v),Fo(t,b,r)}const s=await oN(t,e.windowObject),a=await uN(s,e);if((a.searchParams.get("state")||new URLSearchParams(a.hash.replace(/^#/,"")).get("state"))!==s.state)throw new Error("OAuth state mismatch; authorization response was rejected.");const u=new URLSearchParams(a.hash.replace(/^#/,"")),f=a.searchParams.get("error")||u.get("error");if(f){const b=a.searchParams.get("error_description")||u.get("error_description");throw new Error(b||f)}if(n==="implicit"){const b=u.get("access_token")||"";if(!b)throw new Error("OAuth implicit response did not include access_token.");return{accessToken:b,tokenType:u.get("token_type")||void 0,expiresIn:u.get("expires_in")?Number(u.get("expires_in")):void 0,scope:u.get("scope")||void 0}}const h=a.searchParams.get("code");if(!h)throw new Error("OAuth authorization response did not include code.");const g=new URLSearchParams({grant_type:"authorization_code",code:h,redirect_uri:s.redirectUri});return s.codeVerifier&&g.set("code_verifier",s.codeVerifier),Fo(t,g,r)}async function fN(t,e={}){const n=il(t.refreshToken,"Refresh token"),r=new URLSearchParams({grant_type:"refresh_token",refresh_token:n}),s=Vo(t);return s&&r.set("scope",s),Fo(t,r,e.fetchImpl??fetch)}function hN(t){return t==="inherit"?{type:"inherit"}:t==="bearer"?{type:"bearer",token:""}:t==="oauth2"?{type:"oauth2",accessToken:"",grantType:"accessToken",scopes:[]}:t==="basic"?{type:"basic",username:"",password:""}:t==="apiKey"?{type:"apiKey",key:"",value:"",in:"header"}:t==="digest"?{type:"digest",username:"",password:""}:t==="hawk"?{type:"hawk",id:"",key:"",algorithm:"sha256"}:t==="ntlm"?{type:"ntlm",username:"",password:""}:t==="oauth1"?{type:"oauth1",consumerKey:"",consumerSecret:"",signatureMethod:"HMAC-SHA1"}:t==="awsv4"?{type:"awsv4",accessKey:"",secretKey:"",region:"",service:""}:{type:"none"}}function pN(t){return t.split(/\s+/).map(e=>e.trim()).filter(Boolean)}const mN=({auth:t,fieldClass:e,label:n,onChange:r})=>{const[s,a]=I.useState(!1),[c,u]=I.useState(null),f=t.grantType||"accessToken",h=f==="authorizationCode"||f==="implicit",g=f==="authorizationCode"||f==="clientCredentials"||f==="password",b=f!=="accessToken",v=async()=>{a(!0),u(null);try{const A=await dN(t);r({...t,accessToken:A.accessToken,refreshToken:A.refreshToken??t.refreshToken}),u(A.expiresIn?`Access token acquired; expires in ${A.expiresIn}s.`:"Access token acquired.")}catch(A){u(A instanceof Error?A.message:"OAuth authorization failed.")}finally{a(!1)}},w=async()=>{a(!0),u(null);try{const A=await fN(t);r({...t,accessToken:A.accessToken,refreshToken:A.refreshToken??t.refreshToken}),u("Access token refreshed.")}catch(A){u(A instanceof Error?A.message:"OAuth token refresh failed.")}finally{a(!1)}};return p.jsxs("div",{className:"space-y-2",children:[p.jsxs("select",{"aria-label":n?`${n} OAuth grant type`:"OAuth grant type",className:e,value:f,onChange:A=>r({...t,grantType:A.target.value}),children:[p.jsx("option",{value:"accessToken",children:"Manual access token"}),p.jsx("option",{value:"authorizationCode",children:"Authorization Code + PKCE"}),p.jsx("option",{value:"clientCredentials",children:"Client Credentials"}),p.jsx("option",{value:"password",children:"Password grant (legacy)"}),p.jsx("option",{value:"implicit",children:"Implicit grant (legacy)"})]}),h&&p.jsx("input",{"aria-label":n?`${n} OAuth authorization URL`:"OAuth authorization URL",className:e,placeholder:"Authorization URL",value:t.authorizationUrl||"",onChange:A=>r({...t,authorizationUrl:A.target.value})}),g&&p.jsx("input",{"aria-label":n?`${n} OAuth token URL`:"OAuth token URL",className:e,placeholder:"Token URL",value:t.tokenUrl||"",onChange:A=>r({...t,tokenUrl:A.target.value})}),b&&p.jsx("input",{"aria-label":n?`${n} OAuth client ID`:"OAuth client ID",className:e,placeholder:"Client ID",value:t.clientId||"",onChange:A=>r({...t,clientId:A.target.value})}),(f==="authorizationCode"||f==="clientCredentials"||f==="password")&&p.jsx("input",{"aria-label":n?`${n} OAuth client secret`:"OAuth client secret",type:"password",autoComplete:"off",className:e,placeholder:f==="authorizationCode"?"Client secret (optional for PKCE/public clients)":"Client secret (optional)",value:t.clientSecret||"",onChange:A=>r({...t,clientSecret:A.target.value})}),g&&p.jsxs("select",{"aria-label":n?`${n} OAuth client authentication`:"OAuth client authentication",className:e,value:t.clientAuthentication||"body",onChange:A=>r({...t,clientAuthentication:A.target.value}),children:[p.jsx("option",{value:"body",children:"Send client credentials in body"}),p.jsx("option",{value:"basic",children:"Send as Basic Auth header"})]}),h&&p.jsx("input",{"aria-label":n?`${n} OAuth redirect URI`:"OAuth redirect URI",className:e,placeholder:"Redirect URI (defaults to this page)",value:t.redirectUri||"",onChange:A=>r({...t,redirectUri:A.target.value})}),b&&p.jsx("input",{"aria-label":n?`${n} OAuth scopes`:"OAuth scopes",className:e,placeholder:"Scopes separated by spaces",value:(t.scopes||[]).join(" "),onChange:A=>r({...t,scopes:pN(A.target.value)})}),f==="password"&&p.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[p.jsx("input",{"aria-label":n?`${n} OAuth username`:"OAuth username",className:e,placeholder:"Resource owner username",value:t.username||"",onChange:A=>r({...t,username:A.target.value})}),p.jsx("input",{"aria-label":n?`${n} OAuth password`:"OAuth password",type:"password",autoComplete:"off",className:e,placeholder:"Resource owner password",value:t.password||"",onChange:A=>r({...t,password:A.target.value})})]}),p.jsx("input",{"aria-label":n?`${n} OAuth access token`:"OAuth access token",type:"password",autoComplete:"off",className:e,placeholder:"Access token",value:t.accessToken,onChange:A=>r({...t,accessToken:A.target.value})}),f!=="accessToken"&&p.jsxs("div",{className:"flex flex-wrap gap-2",children:[p.jsx("button",{type:"button",disabled:s,onClick:v,className:"rounded-md border px-2.5 py-1.5 text-xs font-medium disabled:opacity-60",children:s?"Authorizing…":"Get access token"}),t.refreshToken&&t.tokenUrl&&p.jsx("button",{type:"button",disabled:s,onClick:w,className:"rounded-md border px-2.5 py-1.5 text-xs font-medium disabled:opacity-60",children:"Refresh access token"})]}),f!=="accessToken"&&p.jsx("p",{className:"text-[11px] opacity-70",children:"Authorization Code uses PKCE. Popup callbacks must return to this page origin; token endpoints must allow browser CORS. Client secrets entered here are browser-visible and should only be used when the OAuth provider permits it."}),c&&p.jsx("p",{role:"status",className:"text-xs",children:c})]})},xf=({auth:t,label:e,allowInherit:n=!1,advanced:r=!0,hostExecution:s,onChange:a,theme:c})=>{const f=`w-full rounded-md border ${e?"px-2 py-1.5 text-xs":"px-3 py-2 text-sm"} ${c==="dark"?"bg-gray-900 border-gray-700 text-gray-100":"bg-white border-gray-300 text-gray-900"}`,h=(w,A=w)=>e?`${e} ${w}`:A,g=new Set(s?.capabilities||[]),b=w=>s?.available===!0&&g.has(w),v=t.type==="digest"?"digest":t.type==="hawk"?"hawk":t.type==="ntlm"?"ntlm":t.type==="oauth1"?"oauth1":t.type==="awsv4"?"awsv4":t.type==="apiKey"&&t.in==="cookie"?"cookies":void 0;return p.jsxs("div",{className:"space-y-2",children:[p.jsxs("select",{"aria-label":h("authorization type","Authorization type"),className:f,value:t.type==="inherit"&&!n?"none":t.type,onChange:w=>a(hN(w.target.value)),children:[n&&p.jsx("option",{value:"inherit",children:"Inherit from parent"}),p.jsx("option",{value:"none",children:"No auth"}),p.jsx("option",{value:"bearer",children:"Bearer token"}),p.jsx("option",{value:"basic",children:"Basic auth"}),p.jsx("option",{value:"apiKey",children:"API key"}),(r||t.type==="oauth2")&&p.jsx("option",{value:"oauth2",children:"OAuth 2.0"}),r&&p.jsxs(p.Fragment,{children:[p.jsx("option",{value:"digest",disabled:!b("digest"),children:"Digest (API host)"}),p.jsx("option",{value:"hawk",disabled:!b("hawk"),children:"Hawk (API host)"}),p.jsx("option",{value:"ntlm",disabled:!b("ntlm"),children:"NTLM / Negotiate (API host)"}),p.jsx("option",{value:"oauth1",disabled:!b("oauth1"),children:"OAuth 1.0 (API host)"}),p.jsx("option",{value:"awsv4",disabled:!b("awsv4"),children:"AWS Signature v4 (API host)"})]})]}),t.type==="bearer"&&p.jsx("input",{"aria-label":h("bearer token","Bearer token"),type:"password",autoComplete:"off",className:f,value:t.token,onChange:w=>a({...t,token:w.target.value})}),t.type==="oauth2"&&p.jsx(mN,{auth:t,fieldClass:f,label:e,onChange:a}),(t.type==="basic"||t.type==="digest")&&p.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[p.jsx("input",{"aria-label":h(t.type+" username",t.type==="basic"?"Basic auth username":"Digest username"),className:f,placeholder:"Username",value:t.username,onChange:w=>a({...t,username:w.target.value})}),p.jsx("input",{"aria-label":h(t.type+" password",t.type==="basic"?"Basic auth password":"Digest password"),type:"password",autoComplete:"off",className:f,placeholder:"Password",value:t.password,onChange:w=>a({...t,password:w.target.value})})]}),t.type==="apiKey"&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("input",{"aria-label":h("API key name"),className:f,placeholder:"Key name",value:t.key,onChange:w=>a({...t,key:w.target.value})}),p.jsx("input",{"aria-label":h("API key value"),type:"password",autoComplete:"off",className:f,placeholder:"Value",value:t.value,onChange:w=>a({...t,value:w.target.value})}),p.jsxs("select",{"aria-label":h("API key location"),className:f,value:t.in,onChange:w=>a({...t,in:w.target.value}),children:[p.jsx("option",{value:"header",children:"Header"}),p.jsx("option",{value:"query",children:"Query"}),p.jsx("option",{value:"cookie",disabled:!b("cookies"),children:"Cookie (API host)"})]})]}),t.type==="hawk"&&p.jsxs("div",{className:"grid gap-2",children:[p.jsx("input",{"aria-label":h("Hawk id"),className:f,placeholder:"ID",value:t.id,onChange:w=>a({...t,id:w.target.value})}),p.jsx("input",{"aria-label":h("Hawk key"),type:"password",autoComplete:"off",className:f,placeholder:"Key",value:t.key,onChange:w=>a({...t,key:w.target.value})}),p.jsxs("select",{"aria-label":h("Hawk algorithm"),className:f,value:t.algorithm||"sha256",onChange:w=>a({...t,algorithm:w.target.value}),children:[p.jsx("option",{value:"sha256",children:"SHA-256"}),p.jsx("option",{value:"sha1",children:"SHA-1"})]}),p.jsx("input",{"aria-label":h("Hawk ext"),className:f,placeholder:"ext (optional)",value:t.ext||"",onChange:w=>a({...t,ext:w.target.value})})]}),t.type==="ntlm"&&p.jsxs("div",{className:"grid gap-2",children:[p.jsx("input",{"aria-label":h("NTLM username"),className:f,placeholder:"Username",value:t.username,onChange:w=>a({...t,username:w.target.value})}),p.jsx("input",{"aria-label":h("NTLM password"),type:"password",autoComplete:"off",className:f,placeholder:"Password",value:t.password,onChange:w=>a({...t,password:w.target.value})}),p.jsx("input",{"aria-label":h("NTLM domain"),className:f,placeholder:"Domain (optional)",value:t.domain||"",onChange:w=>a({...t,domain:w.target.value})}),p.jsx("input",{"aria-label":h("NTLM workstation"),className:f,placeholder:"Workstation (optional)",value:t.workstation||"",onChange:w=>a({...t,workstation:w.target.value})})]}),t.type==="oauth1"&&p.jsxs("div",{className:"grid gap-2",children:[p.jsx("input",{"aria-label":h("OAuth1 consumer key"),className:f,placeholder:"Consumer key",value:t.consumerKey,onChange:w=>a({...t,consumerKey:w.target.value})}),p.jsx("input",{"aria-label":h("OAuth1 consumer secret"),type:"password",autoComplete:"off",className:f,placeholder:"Consumer secret",value:t.consumerSecret,onChange:w=>a({...t,consumerSecret:w.target.value})}),p.jsx("input",{"aria-label":h("OAuth1 token"),className:f,placeholder:"Token (optional)",value:t.token||"",onChange:w=>a({...t,token:w.target.value})}),p.jsx("input",{"aria-label":h("OAuth1 token secret"),type:"password",autoComplete:"off",className:f,placeholder:"Token secret (optional)",value:t.tokenSecret||"",onChange:w=>a({...t,tokenSecret:w.target.value})}),p.jsxs("select",{"aria-label":h("OAuth1 signature method"),className:f,value:t.signatureMethod||"HMAC-SHA1",onChange:w=>a({...t,signatureMethod:w.target.value}),children:[p.jsx("option",{children:"HMAC-SHA1"}),p.jsx("option",{children:"HMAC-SHA256"}),p.jsx("option",{children:"PLAINTEXT"})]}),p.jsx("input",{"aria-label":h("OAuth1 realm"),className:f,placeholder:"Realm (optional)",value:t.realm||"",onChange:w=>a({...t,realm:w.target.value})})]}),t.type==="awsv4"&&p.jsxs("div",{className:"grid gap-2",children:[p.jsx("input",{"aria-label":h("AWS access key"),className:f,placeholder:"Access key",value:t.accessKey,onChange:w=>a({...t,accessKey:w.target.value})}),p.jsx("input",{"aria-label":h("AWS secret key"),type:"password",autoComplete:"off",className:f,placeholder:"Secret key",value:t.secretKey,onChange:w=>a({...t,secretKey:w.target.value})}),p.jsx("input",{"aria-label":h("AWS session token"),type:"password",autoComplete:"off",className:f,placeholder:"Session token (optional)",value:t.sessionToken||"",onChange:w=>a({...t,sessionToken:w.target.value})}),p.jsx("input",{"aria-label":h("AWS region"),className:f,placeholder:"Region",value:t.region,onChange:w=>a({...t,region:w.target.value})}),p.jsx("input",{"aria-label":h("AWS service"),className:f,placeholder:"Service",value:t.service,onChange:w=>a({...t,service:w.target.value})})]}),e&&v&&p.jsx("p",{role:b(v)?"status":"alert",className:"text-[11px] opacity-75",children:b(v)?"This authorization mode is executed by the FlexDoc API host.":s?.available?"Requests run from your API server, but this authorization mode is not supported.":"API-host execution is unavailable on this documentation server."})]})};let vf=[],Sy=[];(()=>{let t="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,n=0;e<t.length;e++)(e%2?Sy:vf).push(n=n+t[e])})();function gN(t){if(t<768)return!1;for(let e=0,n=vf.length;;){let r=e+n>>1;if(t<vf[r])n=r;else if(t>=Sy[r])e=r+1;else return!0;if(e==n)return!1}}function Ay(t){return t>=127462&&t<=127487}const ky=8205;function yN(t,e,n=!0,r=!0){return(n?Cy:bN)(t,e,r)}function Cy(t,e,n){if(e==t.length)return e;e&&Ny(t.charCodeAt(e))&&Ty(t.charCodeAt(e-1))&&e--;let r=wf(t,e);for(e+=jy(r);e<t.length;){let s=wf(t,e);if(r==ky||s==ky||n&&gN(s))e+=jy(s),r=s;else if(Ay(s)){let a=0,c=e-2;for(;c>=0&&Ay(wf(t,c));)a++,c-=2;if(a%2==0)break;e+=2}else break}return e}function bN(t,e,n){for(;e>1;){let r=Cy(t,e-2,n);if(r<e)return r;e--}return 0}function wf(t,e){let n=t.charCodeAt(e);if(!Ty(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return Ny(r)?(n-55296<<10)+(r-56320)+65536:n}function Ny(t){return t>=56320&&t<57344}function Ty(t){return t>=55296&&t<56320}function jy(t){return t<65536?1:2}class gt{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,n,r){[e,n]=rl(this,e,n);let s=[];return this.decompose(0,e,s,2),r.length&&r.decompose(0,r.length,s,3),this.decompose(n,this.length,s,1),zi.from(s,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){[e,n]=rl(this,e,n);let r=[];return this.decompose(e,n,r,0),zi.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),s=new ha(this),a=new ha(e);for(let c=n,u=n;;){if(s.next(c),a.next(c),c=0,s.lineBreak!=a.lineBreak||s.done!=a.done||s.value!=a.value)return!1;if(u+=s.value.length,s.done||u>=r)return!0}}iter(e=1){return new ha(this,e)}iterRange(e,n=this.length){return new Oy(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let s=this.line(e).from;r=this.iterRange(s,Math.max(s,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new My(r)}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]?gt.empty:e.length<=32?new Ht(e):zi.from(Ht.split(e,[]))}}class Ht extends gt{constructor(e,n=xN(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,s){for(let a=0;;a++){let c=this.text[a],u=s+c.length;if((n?r:u)>=e)return new vN(s,u,r,c);s=u+1,r++}}decompose(e,n,r,s){let a=e<=0&&n>=this.length?this:new Ht(Ey(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(s&1){let c=r.pop(),u=Po(a.text,c.text.slice(),0,a.length);if(u.length<=32)r.push(new Ht(u,c.length+a.length));else{let f=u.length>>1;r.push(new Ht(u.slice(0,f)),new Ht(u.slice(f)))}}else r.push(a)}replace(e,n,r){if(!(r instanceof Ht))return super.replace(e,n,r);[e,n]=rl(this,e,n);let s=Po(this.text,Po(r.text,Ey(this.text,0,e)),n),a=this.length+r.length-(n-e);return s.length<=32?new Ht(s,a):zi.from(Ht.split(s,[]),a)}sliceString(e,n=this.length,r=`
|
|
50
50
|
`){[e,n]=rl(this,e,n);let s="";for(let a=0,c=0;a<=n&&c<this.text.length;c++){let u=this.text[c],f=a+u.length;a>e&&c&&(s+=r),e<f&&n>a&&(s+=u.slice(Math.max(0,e-a),n-a)),a=f+1}return s}flatten(e){for(let n of this.text)e.push(n)}scanIdentical(){return 0}static split(e,n){let r=[],s=-1;for(let a of e)r.push(a),s+=a.length+1,r.length==32&&(n.push(new Ht(r,s)),r=[],s=-1);return s>-1&&n.push(new Ht(r,s)),n}}class zi extends gt{constructor(e,n){super(),this.children=e,this.length=n,this.lines=0;for(let r of e)this.lines+=r.lines}lineInner(e,n,r,s){for(let a=0;;a++){let c=this.children[a],u=s+c.length,f=r+c.lines-1;if((n?f:u)>=e)return c.lineInner(e,n,r,s);s=u+1,r=f+1}}decompose(e,n,r,s){for(let a=0,c=0;c<=n&&a<this.children.length;a++){let u=this.children[a],f=c+u.length;if(e<=f&&n>=c){let h=s&((c<=e?1:0)|(f>=n?2:0));c>=e&&f<=n&&!h?r.push(u):u.decompose(e-c,n-c,r,h)}c=f+1}}replace(e,n,r){if([e,n]=rl(this,e,n),r.lines<this.lines)for(let s=0,a=0;s<this.children.length;s++){let c=this.children[s],u=a+c.length;if(e>=a&&n<=u){let f=c.replace(e-a,n-a,r),h=this.lines-c.lines+f.lines;if(f.lines<h>>4&&f.lines>h>>6){let g=this.children.slice();return g[s]=f,new zi(g,this.length-(n-e)+r.length)}return super.replace(a,u,f)}a=u+1}return super.replace(e,n,r)}sliceString(e,n=this.length,r=`
|
|
51
|
-
`){[e,n]=rl(this,e,n);let s="";for(let a=0,c=0;a<this.children.length&&c<=n;a++){let u=this.children[a],f=c+u.length;c>e&&a&&(s+=r),e<f&&n>c&&(s+=u.sliceString(e-c,n-c,r)),c=f+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof zi))return 0;let r=0,[s,a,c,u]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,a+=n){if(s==c||a==u)return r;let f=this.children[s],h=e.children[a];if(f!=h)return r+f.scanIdentical(h,n);r+=f.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let w of e)r+=w.lines;if(r<32){let w=[];for(let A of e)A.flatten(w);return new Ht(w,n)}let s=Math.max(32,r>>5),a=s<<1,c=s>>1,u=[],f=0,h=-1,g=[];function b(w){let A;if(w.lines>a&&w instanceof zi)for(let C of w.children)b(C);else w.lines>c&&(f>c||!f)?(v(),u.push(w)):w instanceof Ht&&f&&(A=g[g.length-1])instanceof Ht&&w.lines+A.lines<=32?(f+=w.lines,h+=w.length+1,g[g.length-1]=new Ht(A.text.concat(w.text),A.length+1+w.length)):(f+w.lines>s&&v(),f+=w.lines,h+=w.length+1,g.push(w))}function v(){f!=0&&(u.push(g.length==1?g[0]:zi.from(g,h)),h=-1,f=g.length=0)}for(let w of e)b(w);return v(),u.length==1?u[0]:new zi(u,n)}}gt.empty=new Ht([""],0);function
|
|
52
|
-
`,this;e--}else if(s instanceof Ht){let f=s.text[c+(n<0?-1:0)];if(this.offsets[r]+=n,f.length>Math.max(0,e))return this.value=e==0?f:n>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=s.children[c+(n<0?-1:0)];e>f.length?(e-=f.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(f),this.offsets.push(n>0?1:(f instanceof Ht?f.text.length:f.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class jy{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new ha(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),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 Ey{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(gt.prototype[Symbol.iterator]=function(){return this.iter()},ha.prototype[Symbol.iterator]=jy.prototype[Symbol.iterator]=Ey.prototype[Symbol.iterator]=function(){return this});class uN{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function rl(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function An(t,e,n=!0,r=!0){return aN(t,e,n,r)}function dN(t){return t>=56320&&t<57344}function fN(t){return t>=55296&&t<56320}function hN(t,e){let n=t.charCodeAt(e);if(!fN(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return dN(r)?(n-55296<<10)+(r-56320)+65536:n}function pN(t){return t<65536?1:2}const xf=/\r\n?|\n/;var Jn=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Jn||(Jn={}));class Ui{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,s=0;n<this.sections.length;){let a=this.sections[n++],c=this.sections[n++];c<0?(e(r,s,a),s+=a):s+=c,r+=a}}iterChangedRanges(e,n=!1){vf(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?e.push(r,s):e.push(s,r)}return new Ui(e)}composeDesc(e){return this.empty?e:e.empty?this:Oy(this,e)}mapDesc(e,n=!1){return e.empty?this:wf(this,e,n)}mapPos(e,n=-1,r=Jn.Simple){let s=0,a=0;for(let c=0;c<this.sections.length;){let u=this.sections[c++],f=this.sections[c++],h=s+u;if(f<0){if(h>e)return a+(e-s);a+=u}else{if(r!=Jn.Simple&&h>=e&&(r==Jn.TrackDel&&s<e&&h>e||r==Jn.TrackBefore&&s<e||r==Jn.TrackAfter&&h>e))return null;if(h>e||h==e&&n<0&&!u)return e==s||n<0?a:a+f;a+=f}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return a}touchesRange(e,n=e){for(let r=0,s=0;r<this.sections.length&&s<=n;){let a=this.sections[r++],c=this.sections[r++],u=s+a;if(c>=0&&s<=n&&u>=e)return s<e&&u>n?"cover":!0;s=u}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];e+=(e?" ":"")+r+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ui(e)}static create(e){return new Ui(e)}}class en extends Ui{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return vf(this,(n,r,s,a,c)=>e=e.replace(s,s+(r-n),c),!1),e}mapDesc(e,n=!1){return wf(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,a=0;s<n.length;s+=2){let c=n[s],u=n[s+1];if(u>=0){n[s]=u,n[s+1]=c;let f=s>>1;for(;r.length<f;)r.push(gt.empty);r.push(c?e.slice(a,a+c):gt.empty)}a+=c}return new en(n,r)}compose(e){return this.empty?e:e.empty?this:Oy(this,e,!0)}map(e,n=!1){return e.empty?this:wf(this,e,n,!0)}iterChanges(e,n=!1){vf(this,e,n)}get desc(){return Ui.create(this.sections)}filter(e){let n=[],r=[],s=[],a=new pa(this);e:for(let c=0,u=0;;){let f=c==e.length?1e9:e[c++];for(;u<f||u==f&&a.len==0;){if(a.done)break e;let g=Math.min(a.len,f-u);kn(s,g,-1);let b=a.ins==-1?-1:a.off==0?a.ins:0;kn(n,g,b),b>0&&qr(r,n,a.text),a.forward(g),u+=g}let h=e[c++];for(;u<h;){if(a.done)break e;let g=Math.min(a.len,h-u);kn(n,g,-1),kn(s,g,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(g),u+=g}}return{changes:new en(n,r),filtered:Ui.create(s)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let s=[],a=[],c=0,u=null;function f(g=!1){if(!g&&!s.length)return;c<n&&kn(s,n-c,-1);let b=new en(s,a);u=u?u.compose(b.map(u)):b,s=[],a=[],c=0}function h(g){if(Array.isArray(g))for(let b of g)h(b);else if(g instanceof en){if(g.length!=n)throw new RangeError(`Mismatched change set length (got ${g.length}, expected ${n})`);f(),u=u?u.compose(g.map(u)):g}else{let{from:b,to:v=b,insert:w}=g;if(b>v||b<0||v>n)throw new RangeError(`Invalid change range ${b} to ${v} (in doc of length ${n})`);let A=w?typeof w=="string"?gt.of(w.split(r||xf)):w:gt.empty,C=A.length;if(b==v&&C==0)return;b<c&&f(),b>c&&kn(s,b-c,-1),kn(s,v-b,C),qr(a,s,A),c=v}}return h(e),f(!u),u}static empty(e){return new en(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<e.length;s++){let a=e[s];if(typeof a=="number")n.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((c,u)=>u&&typeof c!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)n.push(a[0],0);else{for(;r.length<s;)r.push(gt.empty);r[s]=gt.of(a.slice(1)),n.push(a[0],r[s].length)}}}return new en(n,r)}static createSet(e,n){return new en(e,n)}}function kn(t,e,n,r=!1){if(e==0&&n<=0)return;let s=t.length-2;s>=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function qr(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(gt.empty);t.push(n)}}function vf(t,e,n){let r=t.inserted;for(let s=0,a=0,c=0;c<t.sections.length;){let u=t.sections[c++],f=t.sections[c++];if(f<0)s+=u,a+=u;else{let h=s,g=a,b=gt.empty;for(;h+=u,g+=f,f&&r&&(b=b.append(r[c-2>>1])),!(n||c==t.sections.length||t.sections[c+1]<0);)u=t.sections[c++],f=t.sections[c++];e(s,h,a,g,b),s=h,a=g}}}function wf(t,e,n,r=!1){let s=[],a=r?[]:null,c=new pa(t),u=new pa(e);for(let f=-1;;){if(c.done&&u.len||u.done&&c.len)throw new Error("Mismatched change set lengths");if(c.ins==-1&&u.ins==-1){let h=Math.min(c.len,u.len);kn(s,h,-1),c.forward(h),u.forward(h)}else if(u.ins>=0&&(c.ins<0||f==c.i||c.off==0&&(u.len<c.len||u.len==c.len&&!n))){let h=u.len;for(kn(s,u.ins,-1);h;){let g=Math.min(c.len,h);c.ins>=0&&f<c.i&&c.len<=g&&(kn(s,0,c.ins),a&&qr(a,s,c.text),f=c.i),c.forward(g),h-=g}u.next()}else if(c.ins>=0){let h=0,g=c.len;for(;g;)if(u.ins==-1){let b=Math.min(g,u.len);h+=b,g-=b,u.forward(b)}else if(u.ins==0&&u.len<g)g-=u.len,u.next();else break;kn(s,h,f<c.i?c.ins:0),a&&f<c.i&&qr(a,s,c.text),f=c.i,c.forward(c.len-g)}else{if(c.done&&u.done)return a?en.createSet(s,a):Ui.create(s);throw new Error("Mismatched change set lengths")}}}function Oy(t,e,n=!1){let r=[],s=n?[]:null,a=new pa(t),c=new pa(e);for(let u=!1;;){if(a.done&&c.done)return s?en.createSet(r,s):Ui.create(r);if(a.ins==0)kn(r,a.len,0,u),a.next();else if(c.len==0&&!c.done)kn(r,0,c.ins,u),s&&qr(s,r,c.text),c.next();else{if(a.done||c.done)throw new Error("Mismatched change set lengths");{let f=Math.min(a.len2,c.len),h=r.length;if(a.ins==-1){let g=c.ins==-1?-1:c.off?0:c.ins;kn(r,f,g,u),s&&g&&qr(s,r,c.text)}else c.ins==-1?(kn(r,a.off?0:a.len,f,u),s&&qr(s,r,a.textBit(f))):(kn(r,a.off?0:a.len,c.off?0:c.ins,u),s&&!c.off&&qr(s,r,c.text));u=(a.ins>f||c.ins>=0&&c.len>f)&&(u||r.length>h),a.forward2(f),c.forward(f)}}}}class pa{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,n=this.i-2>>1;return n>=e.length?gt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?gt.empty:n[r].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 Br{constructor(e,n,r,s){this.from=e,this.to=n,this.flags=r,this.goalColumn=s}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,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new Br(r,s,this.flags,this.goalColumn)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return Ae.range(e,n,void 0,void 0,r);let s=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ae.range(this.anchor,s,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!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 Ae.range(e.anchor,e.head)}static create(e,n,r,s){return new Br(e,n,r,s)}}class Ae{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ae.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Ae([this.main],0)}addRange(e,n=!0){return Ae.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,Ae.create(r,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 Ae(e.ranges.map(n=>Br.fromJSON(n)),e.main)}static single(e,n=e){return new Ae([Ae.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<e.length;s++){let a=e[s];if(a.empty?a.from<=r:a.from<r)return Ae.normalized(e.slice(),n);r=a.to}return new Ae(e,n)}static cursor(e,n=0,r,s){return Br.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r)),s)}static range(e,n,r,s,a){let c=s==null?7:Math.min(6,s);return!a&&e!=n&&(a=n<e?1:-1),a&&(c|=a<0?8:16),n<e?Br.create(n,e,c|32,r):Br.create(e,n,c,r)}static undirectionalRange(e,n){return Br.create(e,n,64,void 0)}static normalized(e,n=0){let r=e[n];e.sort((s,a)=>s.from-a.from),n=e.indexOf(r);for(let s=1;s<e.length;s++){let a=e[s],c=e[s-1];if(a.empty?a.from<=c.to:a.from<c.to){let u=c.from,f=Math.max(a.to,c.to);s<=n&&n--,e.splice(--s,2,a.anchor>a.head?Ae.range(f,u):Ae.range(u,f))}}return new Ae(e,n)}}function My(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Sf=0;class Ue{constructor(e,n,r,s,a){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=Sf++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new Ue(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Af),!!e.static,e.enables)}of(e){return new Yo([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yo(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yo(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Af(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yo{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=Sf++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,a=this.id,c=e[a]>>1,u=this.type==2,f=!1,h=!1,g=[];for(let b of this.dependencies)b=="doc"?f=!0:b=="selection"?h=!0:(((n=e[b.id])!==null&&n!==void 0?n:1)&1)==0&&g.push(e[b.id]);return{create(b){return b.values[c]=r(b),1},update(b,v){if(f&&v.docChanged||h&&(v.docChanged||v.selection)||kf(b,g)){let w=r(b);if(u?!Ry(w,b.values[c],s):!s(w,b.values[c]))return b.values[c]=w,1}return 0},reconfigure:(b,v)=>{let w,A=v.config.address[a];if(A!=null){let C=Jo(v,A);if(this.dependencies.every(j=>j instanceof Ue?v.facet(j)===b.facet(j):j instanceof $r?v.field(j,!1)==b.field(j,!1):!0)||(u?Ry(w=r(b),C,s):s(w=r(b),C)))return b.values[c]=C,0}else w=r(b);return b.values[c]=w,1}}}get extension(){return this}}function Ry(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function kf(t,e){let n=!1;for(let r of e)ga(t,r)&1&&(n=!0);return n}function mN(t,e,n){let r=n.map(f=>t[f.id]),s=n.map(f=>f.type),a=r.filter(f=>!(f&1)),c=t[e.id]>>1;function u(f){let h=[];for(let g=0;g<r.length;g++){let b=Jo(f,r[g]);if(s[g]==2)for(let v of b)h.push(v);else h.push(b)}return e.combine(h)}return{create(f){for(let h of r)ga(f,h);return f.values[c]=u(f),1},update(f,h){if(!kf(f,a))return 0;let g=u(f);return e.compare(g,f.values[c])?0:(f.values[c]=g,1)},reconfigure(f,h){let g=kf(f,r),b=h.config.facets[e.id],v=h.facet(e);if(b&&!g&&Af(n,b))return f.values[c]=v,0;let w=u(f);return e.compare(w,v)?(f.values[c]=v,0):(f.values[c]=w,1)}}}const Ko=Ue.define({static:!0});class $r{constructor(e,n,r,s,a){this.id=e,this.createF=n,this.updateF=r,this.compareF=s,this.spec=a,this.provides=void 0}static define(e){let n=new $r(Sf++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Ko).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let a=r.values[n],c=this.updateF(a,s);return this.compareF(a,c)?0:(r.values[n]=c,1)},reconfigure:(r,s)=>{let a=r.facet(Ko),c=s.facet(Ko),u;return(u=a.find(f=>f.field==this))&&u!=c.find(f=>f.field==this)?(r.values[n]=u.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Ko.of({field:this,create:e})]}get extension(){return this}}const Ts={lowest:4,low:3,default:2,high:1,highest:0};function ma(t){return e=>new Dy(e,t)}const Go={highest:ma(Ts.highest),high:ma(Ts.high),default:ma(Ts.default),low:ma(Ts.low),lowest:ma(Ts.lowest)};class Dy{constructor(e,n){this.inner=e,this.prec=n}get extension(){return this}}class nr{of(e){return new Cf(this,e)}reconfigure(e){return nr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Cf{constructor(e,n){this.compartment=e,this.inner=n}get extension(){return this}}class Xo{constructor(e,n,r,s,a,c){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=a,this.facets=c,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let s=[],a=Object.create(null),c=new Map;for(let v of gN(e,n,c))v instanceof $r?s.push(v):(a[v.facet.id]||(a[v.facet.id]=[])).push(v);let u=Object.create(null),f=[],h=[];for(let v of s)u[v.id]=h.length<<1,h.push(w=>v.slot(w));let g=r?.config.facets;for(let v in a){let w=a[v],A=w[0].facet,C=g&&g[v]||[];if(w.every(j=>j.type==0))if(u[A.id]=f.length<<1|1,Af(C,w))f.push(r.facet(A));else{let j=A.combine(w.map(D=>D.value));f.push(r&&A.compare(j,r.facet(A))?r.facet(A):j)}else{for(let j of w)j.type==0?(u[j.id]=f.length<<1|1,f.push(j.value)):(u[j.id]=h.length<<1,h.push(D=>j.dynamicSlot(D)));u[A.id]=h.length<<1,h.push(j=>mN(j,A,w))}}let b=h.map(v=>v(u));return new Xo(e,c,b,u,f,a)}}function gN(t,e,n){let r=[[],[],[],[],[]],s=new Map;function a(c,u){let f=s.get(c);if(f!=null){if(f<=u)return;let h=r[f].indexOf(c);h>-1&&r[f].splice(h,1),c instanceof Cf&&n.delete(c.compartment)}if(s.set(c,u),Array.isArray(c))for(let h of c)a(h,u);else if(c instanceof Cf){if(n.has(c.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(c.compartment)||c.inner;n.set(c.compartment,h),a(h,u)}else if(c instanceof Dy)a(c.inner,c.prec);else if(c instanceof $r)r[u].push(c),c.provides&&a(c.provides,u);else if(c instanceof Yo)r[u].push(c),c.facet.extensions&&a(c.facet.extensions,Ts.default);else{let h=c.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${c}).`);if(h==c)throw new Error(`Unrecognized extension value in extension set (${c}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(h,u)}}return a(t,Ts.default),r.reduce((c,u)=>c.concat(u))}function ga(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function Jo(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const _y=Ue.define(),Nf=Ue.define({combine:t=>t.some(e=>e),static:!0}),Ly=Ue.define({combine:t=>t.length?t[0]:void 0,static:!0}),qy=Ue.define(),By=Ue.define(),$y=Ue.define(),Iy=Ue.define({combine:t=>t.length?t[0]:!1});class Ir{constructor(e,n){this.type=e,this.value=n}static define(){return new yN}}class yN{of(e){return new Ir(this,e)}}class bN{constructor(e){this.map=e}of(e){return new zt(this,e)}}class zt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new zt(this.type,n)}is(e){return this.type==e}static define(e={}){return new bN(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let a=s.map(n);a&&r.push(a)}return r}}zt.reconfigure=zt.define(),zt.appendConfig=zt.define();class tn{constructor(e,n,r,s,a,c){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=a,this.scrollIntoView=c,this._doc=null,this._state=null,r&&My(r,n.newLength),a.some(u=>u.type==tn.time)||(this.annotations=a.concat(tn.time.of(Date.now())))}static create(e,n,r,s,a,c){return new tn(e,n,r,s,a,c)}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 n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(tn.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}tn.time=Ir.define(),tn.userEvent=Ir.define(),tn.addToHistory=Ir.define(),tn.remote=Ir.define();function xN(t,e){let n=[];for(let r=0,s=0;;){let a,c;if(r<t.length&&(s==e.length||e[s]>=t[r]))a=t[r++],c=t[r++];else if(s<e.length)a=e[s++],c=e[s++];else return n;!n.length||n[n.length-1]<a?n.push(a,c):n[n.length-1]<c&&(n[n.length-1]=c)}}function Hy(t,e,n){var r;let s,a,c;return n?(s=e.changes,a=en.empty(e.changes.length),c=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),a=t.changes.mapDesc(e.changes,!0),c=t.changes.compose(s)),{changes:c,selection:e.selection?e.selection.map(a):(r=t.selection)===null||r===void 0?void 0:r.map(s),effects:zt.mapEffects(t.effects,s).concat(zt.mapEffects(e.effects,a)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Tf(t,e,n){let r=e.selection,s=sl(e.annotations);return e.userEvent&&(s=s.concat(tn.userEvent.of(e.userEvent))),{changes:e.changes instanceof en?e.changes:en.of(e.changes||[],n,t.facet(Ly)),selection:r&&(r instanceof Ae?r:Ae.single(r.anchor,r.head)),effects:sl(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function zy(t,e,n){let r=Tf(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(n=!1);let c=!!e[a].sequential;r=Hy(r,Tf(t,e[a],c?r.changes.newLength:t.doc.length),c)}let s=tn.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return wN(n?vN(s):s)}function vN(t){let e=t.startState,n=!0;for(let s of e.facet(qy)){let a=s(t);if(a===!1){n=!1;break}Array.isArray(a)&&(n=n===!0?a:xN(n,a))}if(n!==!0){let s,a;if(n===!1)a=t.changes.invertedDesc,s=en.empty(e.doc.length);else{let c=t.changes.filter(n);s=c.changes,a=c.filtered.mapDesc(c.changes).invertedDesc}t=tn.create(e,s,t.selection&&t.selection.map(a),zt.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)}let r=e.facet(By);for(let s=r.length-1;s>=0;s--){let a=r[s](t);a instanceof tn?t=a:Array.isArray(a)&&a.length==1&&a[0]instanceof tn?t=a[0]:t=zy(e,sl(a),!1)}return t}function wN(t){let e=t.startState,n=e.facet($y),r=t;for(let s=n.length-1;s>=0;s--){let a=n[s](t);a&&Object.keys(a).length&&(r=Hy(r,Tf(e,a,t.changes.newLength),!0))}return r==t?t:tn.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const SN=[];function sl(t){return t==null?SN:Array.isArray(t)?t:[t]}var ir=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(ir||(ir={}));const AN=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let jf;try{jf=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function kN(t){if(jf)return jf.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||AN.test(n)))return!0}return!1}function CN(t){return e=>{if(!/\S/.test(e))return ir.Space;if(kN(e))return ir.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return ir.Word;return ir.Other}}class wt{constructor(e,n,r,s,a,c){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=a,c&&(c._state=this);for(let u=0;u<this.config.dynamicSlots.length;u++)ga(this,u<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return ga(this,r),Jo(this,r)}update(...e){return zy(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:s}=n;for(let u of e.effects)u.is(nr.reconfigure)?(n&&(s=new Map,n.compartments.forEach((f,h)=>s.set(h,f)),n=null),s.set(u.value.compartment,u.value.extension)):u.is(zt.reconfigure)?(n=null,r=u.value):u.is(zt.appendConfig)&&(n=null,r=sl(r).concat(u.value));let a;n?a=e.startState.values.slice():(n=Xo.resolve(r,s,this),a=new wt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(f,h)=>h.reconfigure(f,this),null).values);let c=e.startState.facet(Nf)?e.newSelection:e.newSelection.asSingle();new wt(n,e.newDoc,c,a,(u,f)=>f.update(u,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ae.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),a=[r.range],c=sl(r.effects);for(let u=1;u<n.ranges.length;u++){let f=e(n.ranges[u]),h=this.changes(f.changes),g=h.map(s);for(let v=0;v<u;v++)a[v]=a[v].map(g);let b=s.mapDesc(h,!0);a.push(f.range.map(b)),s=s.compose(g),c=zt.mapEffects(c,g).concat(zt.mapEffects(sl(f.effects),b))}return{changes:s,selection:Ae.create(a,n.mainIndex),effects:c}}changes(e=[]){return e instanceof en?e:en.of(e,this.doc.length,this.facet(wt.lineSeparator))}toText(e){return gt.of(e.split(this.facet(wt.lineSeparator)||xf))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(ga(this,n),Jo(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof $r&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let a in r)if(Object.prototype.hasOwnProperty.call(e,a)){let c=r[a],u=e[a];s.push(c.init(f=>c.spec.fromJSON(u,f)))}}return wt.create({doc:e.doc,selection:Ae.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Xo.resolve(e.extensions||[],new Map),r=e.doc instanceof gt?e.doc:gt.of((e.doc||"").split(n.staticFacet(wt.lineSeparator)||xf)),s=e.selection?e.selection instanceof Ae?e.selection:Ae.single(e.selection.anchor,e.selection.head):Ae.single(0);return My(s,r.length),n.staticFacet(Nf)||(s=s.asSingle()),new wt(n,r,s,n.dynamicSlots.map(()=>null),(a,c)=>c.create(a),null)}get tabSize(){return this.facet(wt.tabSize)}get lineBreak(){return this.facet(wt.lineSeparator)||`
|
|
53
|
-
`}get readOnly(){return this.facet(Iy)}phrase(e,...n){for(let r of this.facet(wt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let a=+(s||1);return!a||a>n.length?r:n[a-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let a of this.facet(_y))for(let c of a(this,n,r))Object.prototype.hasOwnProperty.call(c,e)&&s.push(c[e]);return s}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return CN(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),a=this.charCategorizer(e),c=e-r,u=e-r;for(;c>0;){let f=An(n,c,!1);if(a(n.slice(f,c))!=ir.Word)break;c=f}for(;u<s;){let f=An(n,u);if(a(n.slice(u,f))!=ir.Word)break;u=f}return c==u?null:Ae.range(c+r,u+r)}}wt.allowMultipleSelections=Nf,wt.tabSize=Ue.define({combine:t=>t.length?t[0]:4}),wt.lineSeparator=Ly,wt.readOnly=Iy,wt.phrases=Ue.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}}),wt.languageData=_y,wt.changeFilter=qy,wt.transactionFilter=By,wt.transactionExtender=$y,nr.reconfigure=zt.define();function Ef(t,e,n={}){let r={};for(let s of t)for(let a of Object.keys(s)){let c=s[a],u=r[a];if(u===void 0)r[a]=c;else if(!(u===c||c===void 0))if(Object.hasOwnProperty.call(n,a))r[a]=n[a](u,c);else throw new Error("Config merge conflict for field "+a)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class js{eq(e){return this==e}range(e,n=e){return Mf.create(e,n,this)}}js.prototype.startSide=js.prototype.endSide=0,js.prototype.point=!1,js.prototype.mapMode=Jn.TrackDel;function Of(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let Mf=class CA{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new CA(e,n,r)}};function Rf(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class Df{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return ll(this.to)}findIndex(e,n,r,s=0){let a=r?this.to:this.from;for(let c=s,u=a.length;;){if(c==u)return c;let f=c+u>>1,h=a[f]-e||(r?this.value[f].endSide:this.value[f].startSide)-n;if(f==c)return h>=0?c:u;h>=0?u=f:c=f+1}}between(e,n,r,s){for(let a=this.findIndex(n,-1e9,!0),c=this.findIndex(r,1e9,!1,a);a<c;a++)if(s(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,n,r,s,a){let c=[],u=[],f=[],h=-1,g=-1;e:for(let b=0;b<this.value.length;b++){let v=this.value[b],w=this.from[b]+e,A=this.to[b]+e,C,j;if(w==A){let D=n.mapPos(w,v.startSide,v.mapMode);if(D==null||(C=j=D,v.startSide!=v.endSide&&(j=n.mapPos(w,v.endSide),j<C)))continue}else if(C=n.mapPos(w,v.startSide),j=n.mapPos(A,v.endSide),C>j||C==j&&v.startSide>0&&v.endSide<=0)continue;if(!((j-C||v.endSide-v.startSide)<0))if(h<0&&(h=C),v.point&&(g=Math.max(g,j-C)),(C-r||v.startSide-s)>=0)c.push(v),u.push(C-h),f.push(j-h),r=j,s=v.endSide;else{if(C==j)for(let D=c.length;D>0;D--){if((C-(f[D-1]+h)||v.startSide-c[D-1].endSide)>=0){c.splice(D,0,v),u.splice(D,0,C-h),f.splice(D,0,j-h);continue e}if((C-(u[D-1]+h)||v.endSide-c[D-1].startSide)>0)break}a(C,j,v)}}return{mapped:c.length?new Df(u,f,c,g):null,pos:h}}}class mt{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new mt(e,n,r,s)}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 n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:a=this.length}=e,c=e.filter;if(n.length==0&&!c)return this;if(r&&(n=n.slice().sort(Rf)),this.isEmpty)return n.length?mt.of(n):this;let u=new Vy(this,null,-1).goto(0),f=0,h=[],g=new ya;for(;u.value||f<n.length;)if(f<n.length&&(u.from-n[f].from||u.startSide-n[f].value.startSide)>=0){let b=n[f++];g.addInner(b.from,b.to,b.value,!1)||h.push(b)}else u.rangeIndex==1&&u.chunkIndex<this.chunk.length&&(f==n.length||this.chunkEnd(u.chunkIndex)<n[f].from)&&(!c||s>this.chunkEnd(u.chunkIndex)||a<this.chunkPos[u.chunkIndex])&&g.addChunk(this.chunkPos[u.chunkIndex],this.chunk[u.chunkIndex])?u.nextChunk():((!c||s>u.to||a<u.from||c(u.from,u.to,u.value))&&(g.addInner(u.from,u.to,u.value,!1)||h.push(Mf.create(u.from,u.to,u.value))),u.next());return g.finishInner(this.nextLayer.isEmpty&&!h.length?mt.empty:this.nextLayer.update({add:h,filter:c,filterFrom:s,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],s=-1,a,c=(f,h,g)=>{a||(a=new ya),a.addRange(f,h,g,!1)};for(let f=0;f<this.chunk.length;f++){let h=this.chunkPos[f],g=this.chunk[f],b=e.touchesRange(h,h+g.length);if(b===!1)s=Math.max(s,g.maxPoint),n.push(g),r.push(e.mapPos(h));else if(b===!0){let[v,w]=n.length?[ll(r)+ll(n).length,ll(ll(n).value).endSide]:[-1,-1],{mapped:A,pos:C}=g.map(h,e,v,w,c);A&&(s=Math.max(s,A.maxPoint),n.push(A),r.push(C))}}let u=this.nextLayer.map(e);return a&&(u=a.finishInner(u)),n.length==0?u:new mt(r,n,u||mt.empty,s)}between(e,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let a=this.chunkPos[s],c=this.chunk[s];if(n>=a&&e<=a+c.length&&c.between(a,e-a,n-a,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return ba.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return ba.from(e).goto(n)}static compare(e,n,r,s,a=-1){let c=e.filter(b=>b.maxPoint>0||!b.isEmpty&&b.maxPoint>=a),u=n.filter(b=>b.maxPoint>0||!b.isEmpty&&b.maxPoint>=a),f=Uy(c,u,r),h=new xa(c,f,a),g=new xa(u,f,a);r.iterGaps((b,v,w)=>Fy(h,b,g,v,w,s)),r.empty&&r.length==0&&Fy(h,0,g,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let a=e.filter(g=>!g.isEmpty&&n.indexOf(g)<0),c=n.filter(g=>!g.isEmpty&&e.indexOf(g)<0);if(a.length!=c.length)return!1;if(!a.length)return!0;let u=Uy(a,c),f=new xa(a,u,0).goto(r),h=new xa(c,u,0).goto(r);for(;;){if(f.to!=h.to||!Lf(f.active,h.active)||f.point&&(!h.point||!Of(f.point,h.point)))return!1;if(f.to>s)return!0;f.next(),h.next()}}static spans(e,n,r,s,a=-1){let c=new xa(e,null,a).goto(n),u=n,f=c.openStart;for(;;){let h=Math.min(c.to,r);if(c.point){let g=c.activeForPoint(c.to),b=c.pointFrom<n?g.length+1:c.point.startSide<0?g.length:Math.min(g.length,f);s.point(u,h,c.point,g,b,c.pointRank),f=Math.min(c.openEnd(h),g.length)}else h>u&&(s.span(u,h,c.active,f),f=c.openEnd(h));if(c.to>r)return f+(c.point&&c.to>r?1:0);u=c.to,c.next()}}static of(e,n=!1){let r=new ya;for(let s of e instanceof Mf?[e]:n?NN(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return mt.empty;let n=ll(e);for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=mt.empty;s=s.nextLayer)n=new mt(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}mt.empty=new mt([],[],null,-1);function ll(t){return t[t.length-1]}function NN(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Rf(e,r)>0)return t.slice().sort(Rf);e=r}return t}mt.empty.nextLayer=mt.empty;class ya{finishChunk(e){this.chunks.push(new Df(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,n,r){this.addRange(e,n,r,!0)}addRange(e,n,r,s){this.addInner(e,n,r,s)||(this.nextLayer||(this.nextLayer=new ya)).addRange(e,n,r,s)}addInner(e,n,r,s){let a=e-this.lastTo||r.startSide-this.last.endSide;if(s&&a<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return a<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(mt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=mt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Uy(t,e,n){let r=new Map;for(let a of t)for(let c=0;c<a.chunk.length;c++)a.chunk[c].maxPoint<=0&&r.set(a.chunk[c],a.chunkPos[c]);let s=new Set;for(let a of e)for(let c=0;c<a.chunk.length;c++){let u=r.get(a.chunk[c]);u!=null&&(n?n.mapPos(u):u)==a.chunkPos[c]&&!n?.touchesRange(u,u+a.chunk[c].length)&&s.add(a.chunk[c])}return s}class Vy{constructor(e,n,r,s=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!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],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.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 ba{constructor(e){this.heap=e}static from(e,n=null,r=-1){let s=[];for(let a=0;a<e.length;a++)for(let c=e[a];!c.isEmpty;c=c.nextLayer)c.maxPoint>=r&&s.push(new Vy(c,n,r,a));return s.length==1?s[0]:new ba(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)_f(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)_f(this.heap,r);(this.to-e||this.value.endSide-n)<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(),_f(this.heap,0)}}}function _f(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1<t.length&&s.compare(t[r+1])>=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class xa{constructor(e,n,r){this.minPoint=r,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=ba.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Qo(this.active,e),Qo(this.activeTo,e),Qo(this.activeRank,e),this.minActive=Py(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:a}=this.cursor;for(;n<this.activeRank.length&&(a-this.activeRank[n]||s-this.activeTo[n])>0;)n++;Wo(this.active,n,r),Wo(this.activeTo,n,s),Wo(this.activeRank,n,a),e&&Wo(e,n,this.cursor.from),this.minActive=Py(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Qo(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function Fy(t,e,n,r,s,a){t.goto(e),n.goto(r);let c=r+s,u=r,f=r-e,h=!!a.boundChange;for(let g=!1;;){let b=t.to+f-n.to,v=b||t.endSide-n.endSide,w=v<0?t.to+f:n.to,A=Math.min(w,c);if(t.point||n.point?(t.point&&n.point&&Of(t.point,n.point)&&Lf(t.activeForPoint(t.to),n.activeForPoint(n.to))||a.comparePoint(u,A,t.point,n.point),g=!1):(g&&a.boundChange(u),A>u&&!Lf(t.active,n.active)&&a.compareRange(u,A,t.active,n.active),h&&A<c&&(b||t.openEnd(w)!=n.openEnd(w))&&(g=!0)),w>c)break;u=w,v<=0&&t.next(),v>=0&&n.next()}}function Lf(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!Of(t[n],e[n]))return!1;return!0}function Qo(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Wo(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function Py(t,e){let n=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||t[s].endSide-t[n].endSide)<0&&(n=s,r=e[s]);return n}function Zo(t,e,n=t.length){let r=0;for(let s=0;s<n&&s<t.length;)t.charCodeAt(s)==9?(r+=e-r%e,s++):(r++,s=An(t,s));return r}function TN(t,e,n,r){for(let s=0,a=0;;){if(a>=e)return s;if(s==t.length)break;a+=t.charCodeAt(s)==9?n-a%n:1,s=An(t,s)}return t.length}const qf="ͼ",Yy=typeof Symbol>"u"?"__"+qf:Symbol.for(qf),Bf=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Ky=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class al{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(c){return/^@/.test(c)?[c]:c.split(/,\s*/)}function a(c,u,f,h){let g=[],b=/^@(\w+)\b/.exec(c[0]),v=b&&b[1]=="keyframes";if(b&&u==null)return f.push(c[0]+";");for(let w in u){let A=u[w];if(/&/.test(w))a(w.split(/,\s*/).map(C=>c.map(j=>C.replace(/&/,j))).reduce((C,j)=>C.concat(j)),A,f);else if(A&&typeof A=="object"){if(!b)throw new RangeError("The value of a property ("+w+") should be a primitive value.");a(s(w),A,g,v)}else A!=null&&g.push(w.replace(/_.*/,"").replace(/[A-Z]/g,C=>"-"+C.toLowerCase())+": "+A+";")}(g.length||v)&&f.push((r&&!b&&!h?c.map(r):c).join(", ")+" {"+g.join(" ")+"}")}for(let c in e)a(s(c),e[c],this.rules)}getRules(){return this.rules.join(`
|
|
54
|
-
`)}static newName(){let e=
|
|
55
|
-
`;this.styleTag.textContent=c;let u=n.head||n;this.styleTag.parentNode!=u&&u.insertBefore(this.styleTag,u.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Hr={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:"'"},va={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},EN=typeof navigator<"u"&&/Mac/.test(navigator.platform),ON=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),cn=0;cn<10;cn++)Hr[48+cn]=Hr[96+cn]=String(cn);for(var cn=1;cn<=24;cn++)Hr[cn+111]="F"+cn;for(var cn=65;cn<=90;cn++)Hr[cn]=String.fromCharCode(cn+32),va[cn]=String.fromCharCode(cn);for(var $f in Hr)va.hasOwnProperty($f)||(va[$f]=Hr[$f]);function MN(t){var e=EN&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||ON&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?va:Hr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}let Mn=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},If=typeof document<"u"?document:{documentElement:{style:{}}};const Hf=/Edge\/(\d+)/.exec(Mn.userAgent),Xy=/MSIE \d/.test(Mn.userAgent),zf=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mn.userAgent),ec=!!(Xy||zf||Hf),Jy=!ec&&/gecko\/(\d+)/i.test(Mn.userAgent),Uf=!ec&&/Chrome\/(\d+)/.exec(Mn.userAgent),Qy="webkitFontSmoothing"in If.documentElement.style,Vf=!ec&&/Apple Computer/.test(Mn.vendor),Wy=Vf&&(/Mobile\/\w+/.test(Mn.userAgent)||Mn.maxTouchPoints>2);var Re={mac:Wy||/Mac/.test(Mn.platform),windows:/Win/.test(Mn.platform),linux:/Linux|X11/.test(Mn.platform),ie:ec,ie_version:Xy?If.documentMode||6:zf?+zf[1]:Hf?+Hf[1]:0,gecko:Jy,gecko_version:Jy?+(/Firefox\/(\d+)/.exec(Mn.userAgent)||[0,0])[1]:0,chrome:!!Uf,chrome_version:Uf?+Uf[1]:0,ios:Wy,android:/Android\b/.test(Mn.userAgent),webkit:Qy,webkit_version:Qy?+(/\bAppleWebKit\/(\d+)/.exec(Mn.userAgent)||[0,0])[1]:0,safari:Vf,safari_version:Vf?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Mn.userAgent)||[0,0])[1]:0,tabSize:If.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Ff(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const tc=Object.create(null);function Pf(t,e,n){if(t==e)return!0;t||(t=tc),e||(e=tc);let r=Object.keys(t),s=Object.keys(e);if(r.length-0!=s.length-0)return!1;for(let a of r)if(a!=n&&(s.indexOf(a)==-1||t[a]!==e[a]))return!1;return!0}function RN(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function Zy(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function DN(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class nc{eq(e){return!1}updateDOM(e,n,r){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,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var un=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(un||(un={}));class rn extends js{constructor(e,n,r,s){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new wa(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Es(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:a,end:c}=eb(e,n);r=(a?n?-3e8:-1:5e8)-1,s=(c?n?2e8:1:-6e8)+1}return new Es(e,r,s,n,e.widget||null,!0)}static line(e){return new Sa(e)}static set(e,n=!1){return mt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}rn.none=mt.empty;class wa extends rn{constructor(e){let{start:n,end:r}=eb(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Ff(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||tc}eq(e){return this==e||e instanceof wa&&this.tagName==e.tagName&&Pf(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}wa.prototype.point=!1;class Sa extends rn{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Sa&&this.spec.class==e.spec.class&&Pf(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}Sa.prototype.mapMode=Jn.TrackBefore,Sa.prototype.point=!0;class Es extends rn{constructor(e,n,r,s,a,c){super(n,r,a,e),this.block=s,this.isReplace=c,this.mapMode=s?n<=0?Jn.TrackBefore:Jn.TrackAfter:Jn.TrackDel}get type(){return this.startSide!=this.endSide?un.WidgetRange:this.startSide<=0?un.WidgetBefore:un.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Es&&_N(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Es.prototype.point=!0;function eb(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function _N(t,e){return t==e||!!(t&&e&&t.compare(e))}function ol(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class Aa extends js{constructor(e,n,r){super(),this.tagName=e,this.attributes=n,this.rank=r}eq(e){return e==this||e instanceof Aa&&this.tagName==e.tagName&&Pf(this.attributes,e.attributes)}static create(e){return new Aa(e.tagName,e.attributes||tc,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return mt.of(e,n)}}Aa.prototype.startSide=Aa.prototype.endSide=-1;function ka(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Yf(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ca(t,e){if(!e.anchorNode)return!1;try{return Yf(t,e.anchorNode)}catch{return!1}}function ic(t){return t.nodeType==3?Ta(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Na(t,e,n,r){return n?tb(t,e,n,r,-1)||tb(t,e,n,r,1):!1}function zr(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function rc(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function tb(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:rr(t))){if(t.nodeName=="DIV")return!1;let a=t.parentNode;if(!a||a.nodeType!=1)return!1;e=zr(t)+(s<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?rr(t):0}else return!1}}function rr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function sc(t,e){let{left:n,right:r}=t;if(n==r)return t;let s=e?n:r;return{left:s,right:s,top:t.top,bottom:t.bottom}}function LN(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function nb(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function qN(t,e,n,r,s,a,c,u){let f=t.ownerDocument,h=f.defaultView||window;for(let g=t,b=!1;g&&!b;)if(g.nodeType==1){let v,w=g==f.body,A=1,C=1;if(w)v=LN(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(g).position)&&(b=!0),g.scrollHeight<=g.clientHeight&&g.scrollWidth<=g.clientWidth){g=g.assignedSlot||g.parentNode;continue}let M=g.getBoundingClientRect();({scaleX:A,scaleY:C}=nb(g,M)),v={left:M.left,right:M.left+g.clientWidth*A,top:M.top,bottom:M.top+g.clientHeight*C}}let j=0,D=0;if(s=="nearest")e.top<v.top+c?(D=e.top-(v.top+c),n>0&&e.bottom>v.bottom+D&&(D=e.bottom-v.bottom+c)):e.bottom>v.bottom-c&&(D=e.bottom-v.bottom+c,n<0&&e.top-D<v.top&&(D=e.top-(v.top+c)));else{let M=e.bottom-e.top,E=v.bottom-v.top;D=(s=="center"&&M<=E?e.top+M/2-E/2:s=="start"||s=="center"&&n<0?e.top-c:e.bottom-E+c)-v.top}if(r=="nearest"?e.left<v.left+a?(j=e.left-(v.left+a),n>0&&e.right>v.right+j&&(j=e.right-v.right+a)):e.right>v.right-a&&(j=e.right-v.right+a,n<0&&e.left<v.left+j&&(j=e.left-(v.left+a))):j=(r=="center"?e.left+(e.right-e.left)/2-(v.right-v.left)/2:r=="start"==u?e.left-a:e.right-(v.right-v.left)+a)-v.left,j||D)if(w)h.scrollBy(j,D);else{let M=0,E=0;if(D){let R=g.scrollTop;g.scrollTop+=D/C,E=(g.scrollTop-R)*C}if(j){let R=g.scrollLeft;g.scrollLeft+=j/A,M=(g.scrollLeft-R)*A}e={left:e.left-M,top:e.top-E,right:e.right-M,bottom:e.bottom-E},M&&Math.abs(M-j)<1&&(r="nearest"),E&&Math.abs(E-D)<1&&(s="nearest")}if(w)break;(e.top<v.top||e.bottom>v.bottom||e.left<v.left||e.right>v.right)&&(e={left:Math.max(e.left,v.left),right:Math.min(e.right,v.right),top:Math.max(e.top,v.top),bottom:Math.min(e.bottom,v.bottom)}),g=g.assignedSlot||g.parentNode}else if(g.nodeType==11)g=g.host;else break}function ib(t,e=!0){let n=t.ownerDocument,r=null,s=null;for(let a=t.parentNode;a&&!(a==n.body||(!e||r)&&s);)if(a.nodeType==1)!s&&a.scrollHeight>a.clientHeight&&(s=a),e&&!r&&a.scrollWidth>a.clientWidth&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:s}}class BN{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:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?rr(n):0),r,Math.min(e.focusOffset,r?rr(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}function rb(t){let e=[];for(let n=t;n;n=n.nodeType==11?n.host:n.parentNode)n.nodeType==1&&e.push({node:n,left:n.scrollLeft,top:n.scrollTop});return e}function sb(t,e=!0){for(let{node:n,left:r,top:s}of t)e&&n.scrollTop!=s&&(n.scrollTop=s),n.scrollLeft!=r&&(n.scrollLeft=r)}let Os=null;Re.safari&&Re.safari_version>=26&&(Os=!1);function lb(t){if(t.setActive)return t.setActive();if(Os)return t.focus(Os);let e=rb(t);t.focus(Os==null?{get preventScroll(){return Os={preventScroll:!0},!0}}:void 0),Os||(Os=!1,sb(e))}let ab;function Ta(t,e,n=e){let r=ab||(ab=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function cl(t,e,n,r){let s={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let a=new KeyboardEvent("keydown",s);a.synthetic=!0,t.dispatchEvent(a);let c=new KeyboardEvent("keyup",s);return c.synthetic=!0,t.dispatchEvent(c),a.defaultPrevented||c.defaultPrevented}function $N(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function IN(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,rr(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=rr(n))}else{if(n==t)return!0;r=zr(n),n=n.parentNode}}function ob(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function cb(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=rr(n)}else if(n.parentNode&&!rc(n))r=zr(n),n=n.parentNode;else return null}}function ub(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!rc(n))r=zr(n)+1,n=n.parentNode;else return null}}class Oi{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Oi(e.parentNode,zr(e),n)}static after(e,n){return new Oi(e.parentNode,zr(e)+1,n)}}var Lt=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Lt||(Lt={}));const Ms=Lt.LTR,Kf=Lt.RTL;function db(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const HN=db("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),zN=db("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Gf=Object.create(null),Vi=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Gf[e]=n,Gf[n]=-e}function fb(t){return t<=247?HN[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?zN[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const UN=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Fi{get dir(){return this.level%2?Kf:Ms}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,s){let a=-1;for(let c=0;c<e.length;c++){let u=e[c];if(u.from<=n&&u.to>=n){if(u.level==r)return c;(a<0||(s!=0?s<0?u.from<n:u.to>n:e[a].level>u.level))&&(a=c)}}if(a<0)throw new RangeError("Index out of range");return a}}function hb(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],s=e[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!hb(r.inner,s.inner))return!1}return!0}const jt=[];function VN(t,e,n,r,s){for(let a=0;a<=r.length;a++){let c=a?r[a-1].to:e,u=a<r.length?r[a].from:n,f=a?256:s;for(let h=c,g=f,b=f;h<u;h++){let v=fb(t.charCodeAt(h));v==512?v=g:v==8&&b==4&&(v=16),jt[h]=v==4?2:v,v&7&&(b=v),g=v}for(let h=c,g=f,b=f;h<u;h++){let v=jt[h];if(v==128)h<u-1&&g==jt[h+1]&&g&24?v=jt[h]=g:jt[h]=256;else if(v==64){let w=h+1;for(;w<u&&jt[w]==64;)w++;let A=h&&g==8||w<n&&jt[w]==8?b==1?1:8:256;for(let C=h;C<w;C++)jt[C]=A;h=w-1}else v==8&&b==1&&(jt[h]=1);g=v,v&7&&(b=v)}}}function FN(t,e,n,r,s){let a=s==1?2:1;for(let c=0,u=0,f=0;c<=r.length;c++){let h=c?r[c-1].to:e,g=c<r.length?r[c].from:n;for(let b=h,v,w,A;b<g;b++)if(w=Gf[v=t.charCodeAt(b)])if(w<0){for(let C=u-3;C>=0;C-=3)if(Vi[C+1]==-w){let j=Vi[C+2],D=j&2?s:j&4?j&1?a:s:0;D&&(jt[b]=jt[Vi[C]]=D),u=C;break}}else{if(Vi.length==189)break;Vi[u++]=b,Vi[u++]=v,Vi[u++]=f}else if((A=jt[b])==2||A==1){let C=A==s;f=C?0:1;for(let j=u-3;j>=0;j-=3){let D=Vi[j+2];if(D&2)break;if(C)Vi[j+2]|=2;else{if(D&4)break;Vi[j+2]|=4}}}}}function PN(t,e,n,r){for(let s=0,a=r;s<=n.length;s++){let c=s?n[s-1].to:t,u=s<n.length?n[s].from:e;for(let f=c;f<u;){let h=jt[f];if(h==256){let g=f+1;for(;;)if(g==u){if(s==n.length)break;g=n[s++].to,u=s<n.length?n[s].from:e}else if(jt[g]==256)g++;else break;let b=a==1,v=(g<e?jt[g]:r)==1,w=b==v?b?1:2:r;for(let A=g,C=s,j=C?n[C-1].to:t;A>f;)A==j&&(A=n[--C].from,j=C?n[C-1].to:t),jt[--A]=w;f=g}else a=h,f++}}}function Xf(t,e,n,r,s,a,c){let u=r%2?2:1;if(r%2==s%2)for(let f=e,h=0;f<n;){let g=!0,b=!1;if(h==a.length||f<a[h].from){let C=jt[f];C!=u&&(g=!1,b=C==16)}let v=!g&&u==1?[]:null,w=g?r:r+1,A=f;e:for(;;)if(h<a.length&&A==a[h].from){if(b)break e;let C=a[h];if(!g)for(let j=C.to,D=h+1;;){if(j==n)break e;if(D<a.length&&a[D].from==j)j=a[D++].to;else{if(jt[j]==u)break e;break}}if(h++,v)v.push(C);else{C.from>f&&c.push(new Fi(f,C.from,w));let j=C.direction==Ms!=!(w%2);Jf(t,j?r+1:r,s,C.inner,C.from,C.to,c),f=C.to}A=C.to}else{if(A==n||(g?jt[A]!=u:jt[A]==u))break;A++}v?Xf(t,f,A,r+1,s,v,c):f<A&&c.push(new Fi(f,A,w)),f=A}else for(let f=n,h=a.length;f>e;){let g=!0,b=!1;if(!h||f>a[h-1].to){let C=jt[f-1];C!=u&&(g=!1,b=C==16)}let v=!g&&u==1?[]:null,w=g?r:r+1,A=f;e:for(;;)if(h&&A==a[h-1].to){if(b)break e;let C=a[--h];if(!g)for(let j=C.from,D=h;;){if(j==e)break e;if(D&&a[D-1].to==j)j=a[--D].from;else{if(jt[j-1]==u)break e;break}}if(v)v.push(C);else{C.to<f&&c.push(new Fi(C.to,f,w));let j=C.direction==Ms!=!(w%2);Jf(t,j?r+1:r,s,C.inner,C.from,C.to,c),f=C.from}A=C.from}else{if(A==e||(g?jt[A-1]!=u:jt[A-1]==u))break;A--}v?Xf(t,A,f,r+1,s,v,c):A<f&&c.push(new Fi(A,f,w)),f=A}}function Jf(t,e,n,r,s,a,c){let u=e%2?2:1;VN(t,s,a,r,u),FN(t,s,a,r,u),PN(s,a,r,u),Xf(t,s,a,e,n,r,c)}function YN(t,e,n){if(!t)return[new Fi(0,0,e==Kf?1:0)];if(e==Ms&&!n.length&&!UN.test(t))return pb(t.length);if(n.length)for(;t.length>jt.length;)jt[jt.length]=256;let r=[],s=e==Ms?0:1;return Jf(t,s,s,n,0,t.length,r),r}function pb(t){return[new Fi(0,t,0)]}let mb="";function KN(t,e,n,r,s){var a;let c=r.head-t.from,u=Fi.find(e,c,(a=r.bidiLevel)!==null&&a!==void 0?a:-1,r.assoc),f=e[u],h=f.side(s,n);if(c==h){let v=u+=s?1:-1;if(v<0||v>=e.length)return null;f=e[u=v],c=f.side(!s,n),h=f.side(s,n)}let g=An(t.text,c,f.forward(s,n));(g<f.from||g>f.to)&&(g=h),mb=t.text.slice(Math.min(c,g),Math.max(c,g));let b=u==(s?e.length-1:0)?null:e[u+(s?1:-1)];return b&&g==h&&b.level+(s?0:1)<f.level?Ae.cursor(b.side(!s,n)+t.from,b.forward(s,n)?1:-1,b.level):Ae.cursor(g+t.from,f.forward(s,n)?-1:1,f.level)}function GN(t,e,n){for(let r=e;r<n;r++){let s=fb(t.charCodeAt(r));if(s==1)return Ms;if(s==2||s==4)return Kf}return Ms}const gb=Ue.define(),yb=Ue.define(),bb=Ue.define(),xb=Ue.define(),Qf=Ue.define(),vb=Ue.define(),wb=Ue.define(),Wf=Ue.define(),Zf=Ue.define(),Sb=Ue.define({combine:t=>t.some(e=>e)}),Ab=Ue.define({combine:t=>t.some(e=>e)}),kb=Ue.define();class ul{constructor(e,n,r,s,a,c=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=a,this.isSnapshot=c}map(e){return e.empty?this:new ul(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 ul(Ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const lc=zt.define({map:(t,e)=>t.map(e)}),Cb=zt.define();function Pi(t,e,n){let r=t.facet(xb);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const sr=Ue.define({combine:t=>t.length?t[0]:!0});let XN=0;const dl=Ue.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class lr{constructor(e,n,r,s,a){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(dl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(dl.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:s,provide:a,decorations:c}=n||{};return new lr(XN++,e,r,s,u=>{let f=[];return c&&f.push(ac.of(h=>{let g=h.plugin(u);return g?c(g):rn.none})),a&&f.push(a(u)),f})}static fromClass(e,n){return lr.define((r,s)=>new e(r,s),n)}}class eh{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 n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Pi(n.state,r,"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(n){Pi(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Pi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Nb=Ue.define(),th=Ue.define(),ac=Ue.define(),Tb=Ue.define(),nh=Ue.define(),ja=Ue.define(),jb=Ue.define();function Eb(t,e){let n=t.state.facet(jb);if(!n.length)return n;let r=n.map(a=>a instanceof Function?a(t):a),s=[];return mt.spans(r,e.from,e.to,{point(){},span(a,c,u,f){let h=a-e.from,g=c-e.from,b=s;for(let v=u.length-1;v>=0;v--,f--){let w=u[v].spec.bidiIsolate,A;if(w==null&&(w=GN(e.text,h,g)),f>0&&b.length&&(A=b[b.length-1]).to==h&&A.direction==w)A.to=g,b=A.inner;else{let C={from:h,to:g,direction:w,inner:[]};b.push(C),b=C.inner}}}}),s}const Ob=Ue.define();function Mb(t){let e=0,n=0,r=0,s=0;for(let a of t.state.facet(Ob)){let c=a(t);c&&(c.left!=null&&(e=Math.max(e,c.left)),c.right!=null&&(n=Math.max(n,c.right)),c.top!=null&&(r=Math.max(r,c.top)),c.bottom!=null&&(s=Math.max(s,c.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Ea=Ue.define();class di{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new di(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 n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let s=0,a=0,c=0;;){let u=s<e.length?e[s].fromB:1e9,f=a<n.length?n[a]:1e9,h=Math.min(u,f);if(h==1e9)break;let g=h+c,b=h,v=g;for(;;)if(a<n.length&&n[a]<=b){let w=n[a+1];a+=2,b=Math.max(b,w);for(let A=s;A<e.length&&e[A].fromB<=b;A++)c=e[A].toA-e[A].toB;v=Math.max(v,w+c)}else if(s<e.length&&e[s].fromB<=b){let w=e[s++];b=Math.max(b,w.toB),v=Math.max(v,w.toA),c=w.toA-w.toB}else break;r.push(new di(g,v,h,b))}return r}}class oc{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=en.empty(this.startState.doc.length);for(let a of r)this.changes=this.changes.compose(a.changes);let s=[];this.changes.iterChangedRanges((a,c,u,f)=>s.push(new di(a,c,u,f))),this.changedRanges=s}static create(e,n,r){return new oc(e,n,r)}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 JN=[];class Bt{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return JN}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 n=this.domAttrs;n&&RN(this.dom,n)}}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,n=this.posAtStart){let r=n;for(let s of this.children){if(s==e)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n,r){return null}domPosFor(e,n){let r=zr(this.dom),s=this.length?e>0:n>0;return new Oi(this.parent.dom,r+(s?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 uc)return e;return null}static get(e){return e.cmTile}}class cc extends Bt{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 n=this.dom,r=null,s,a=e?.node==n?e:null,c=0;for(let u of this.children){if(u.sync(e),c+=u.length+u.breakAfter,s=r?r.nextSibling:n.firstChild,a&&s!=u.dom&&(a.written=!0),u.dom.parentNode==n)for(;s&&s!=u.dom;)s=Rb(s);else n.insertBefore(u.dom,s);r=u.dom}for(s=r?r.nextSibling:n.firstChild,a&&s&&(a.written=!0);s;)s=Rb(s);this.length=c}}function Rb(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class uc extends cc{constructor(e,n){super(n),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 n=Bt.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,s=0,a=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&a++,s=n.pop()}else{let c=r.children[s++];if(c instanceof ar)n.push(s),r=c,s=0;else{let u=a+c.length,f=e(c,a);if(f!==void 0)return f;a=u+c.breakAfter}}}resolveBlock(e,n){let r,s=-1,a,c=-1;if(this.blockTiles((u,f)=>{let h=f+u.length;if(e>=f&&e<=h){if(u.isWidget()&&n>=-1&&n<=1){if(u.flags&32)return!0;u.flags&16&&(r=void 0)}(f<e||e==h&&(n<-1?u.length:u.covers(1)))&&(!r||!u.isWidget()&&r.isWidget())&&(r=u,s=e-f),(h>e||e==f&&(n>1?u.length:u.covers(-1)))&&(!a||!u.isWidget()&&a.isWidget())&&(a=u,c=e-f)}}),!r&&!a)throw new Error("No tile at position "+e);return r&&n<0||!a?{tile:r,offset:s}:{tile:a,offset:c}}}class ar extends cc{constructor(e,n){super(e),this.wrapper=n}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,n){let r=new ar(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class fl extends cc{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let s=new fl(n||document.createElement("div"),e);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,n,r){let s=null,a=-1,c=null,u=-1;function f(g,b){for(let v=0,w=0;v<g.children.length&&w<=b;v++){let A=g.children[v],C=w+A.length;C>=b&&(A.isComposite()?f(A,b-w):(!c||c.isHidden&&(n>0&&!(c.flags&32)||r&&WN(c,A)))&&(C>b||A.flags&32&&n<=1)?(c=A,u=b-w):(w<b||A.flags&16&&!A.isHidden&&n>=-1)&&(s=A,a=b-w)),w=C}}f(this,e);let h=(n<0?s:c)||s||c;return h?{tile:h,offset:h==s?a:u}:null}coordsIn(e,n,r){let s=this.resolveInline(e,n,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),n,r):QN(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:s,offset:a}=r;if(this.dom.contains(s.dom))return s.isText()?new Oi(s.dom,Math.min(s.dom.nodeValue.length,a)):s.domPosFor(a,s.flags&16?1:s.flags&32?-1:n);let c=r.tile.parent,u=!1;for(let f of c.children){if(u)return new Oi(f.dom,0);f==r.tile&&(u=!0)}}return new Oi(this.dom,0)}}function QN(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=ic(e);return n[n.length-1]||null}function WN(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class In extends cc{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new In(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Rs extends Bt{constructor(e,n){super(e,n.length),this.text=n}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,n,r){let s=this.dom.nodeValue.length;e>s&&(e=s);let a=e,c=e,u=0;e==0&&n<0||e==s&&n>=0?Re.chrome||Re.gecko||(e?(a--,u=1):c<s&&(c++,u=-1)):n<0?a--:c<s&&c++;let f=Ta(this.dom,a,c).getClientRects();if(!f.length)return null;let h=f[(u?u<0:n>=0)?0:f.length-1];return Re.safari&&!u&&h.width==0&&(h=Array.prototype.find.call(f,g=>g.width)||h),r==null?h:sc(h,(u?u>0:n<0)==r)}static of(e,n){let r=new Rs(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class Ds extends Bt{constructor(e,n,r,s){super(e,n,s),this.widget=r}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,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let s=this.widget.coordsAt(this.dom,e,n);if(s)return s;if(r)return sc(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let a=this.dom.getClientRects(),c=null;if(!a.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?a.length-1:0;c=a[f],!(e>0?f==0:f==a.length-1||c.top<c.bottom);f+=u?-1:1);return sc(c,!u)}}get overrideDOMText(){if(!this.length)return gt.empty;let{root:e}=this;if(!e)return gt.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,s,a){return a||(a=e.toDOM(n),e.editable||(a.contentEditable="false")),new Ds(a,r,e,s)}}class dc extends Bt{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!0}get overrideDOMText(){return gt.empty}coordsIn(e,n,r){let s=this.dom.getBoundingClientRect();return r==null?s:sc(s,n>0==r)}}class ZN{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:s,index:a,beforeBreak:c,parents:u}=this;for(;e||n>0;)if(s.isComposite())if(c){if(!e)break;r&&r.break(),e--,c=!1}else if(a==s.children.length){if(!e&&!u.length)break;r&&r.leave(s),c=!!s.breakAfter,{tile:s,index:a}=u.pop(),a++}else{let f=s.children[a],h=f.breakAfter;(n>0?f.length<=e:f.length<e)&&(!r||r.skip(f,0,f.length)!==!1||!f.isComposite)?(c=!!h,a++,e-=f.length):(u.push({tile:s,index:a}),s=f,a=0,r&&f.isComposite()&&r.enter(f))}else{let f=s.length;if(a<f&&e){let h=Math.min(e,f-a);r&&r.skip(s,a,a+h),e-=h,a+=h}if(a==f)c=!!s.breakAfter,{tile:s,index:a}=u.pop(),a++;else if(!e)break}return this.tile=s,this.index=a,this.beforeBreak=c,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class eT{constructor(e,n,r,s){this.from=e,this.to=n,this.wrapper=r,this.rank=s}}class tT{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,s){var a;this.flushBuffer();let c=this.ensureMarks(n,r),u=c.lastChild;if(u&&u.isText()&&!(u.flags&8)&&u.length+e.length<512){this.cache.reused.set(u,2);let f=c.children[c.children.length-1]=new Rs(u.dom,u.text+e);f.parent=c}else c.append(s||Rs.of(e,(a=this.cache.find(Rs))===null||a===void 0?void 0:a.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?ih(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let u=n.marks.length-1;u>=0;u--){let f=n.marks[u],h=s.lastChild;if(h instanceof In&&h.mark.eq(f.mark))h.dom!=f.dom&&h.setDOM(ih(f.dom)),s=h;else{if(this.cache.reused.get(f)){let b=Bt.get(f.dom);b&&b.setDOM(ih(f.dom))}let g=In.of(f.mark,f.dom);s.append(g),s=g}this.cache.reused.set(f,2)}let a=Bt.get(e.text);a&&this.cache.reused.set(a,2);let c=new Rs(e.text,e.text.nodeValue);c.flags|=8,this.pos=e.range.toB,s.append(c)}addInlineWidget(e,n,r){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let a=this.ensureMarks(n,r);!s&&!(e.flags&16)&&a.append(this.getBuffer(1)),a.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).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 n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=_b);let s=fl.start(e,n||((r=this.cache.find(fl))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}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,n){var r;let s=this.curLine;for(let a=e.length-1;a>=0;a--){let c=e[a],u;if(n>0&&(u=s.lastChild)&&u instanceof In&&u.mark.eq(c))s=u,n--;else{let f=In.of(c,(r=this.cache.find(In,h=>h.mark.eq(c)))===null||r===void 0?void 0:r.dom);s.append(f),s=f,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Db(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Re.ios&&Db(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(rh,0,32)||new Ds(rh.toDOM(),0,rh,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 n=e.rank*102+e.value.rank,r=new eT(e.from,e.to,e.value,n),s=this.wrappers.length;for(;s>0&&(this.wrappers[s-1].rank-r.rank||this.wrappers[s-1].to-r.to)<0;)s--;this.wrappers.splice(s,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let s=n.lastChild;if(r.from<this.pos&&s instanceof ar&&s.wrapper.eq(r.wrapper))n=s;else{let a=ar.of(r.wrapper,(e=this.cache.find(ar,c=>c.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(a),n=a}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(dc,void 0,1);return r&&(r.flags=n),r||new dc(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class nT{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:s,lineBreak:a,done:c}=this.cursor.next(this.skipCount);if(this.skipCount=0,c)throw new Error("Ran out of text content when drawing inline views");this.text=s;let u=this.textOff=Math.min(e,s.length);return a?null:s.slice(0,u)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const fc=[Ds,fl,Rs,In,dc,ar,uc];for(let t=0;t<fc.length;t++)fc[t].bucket=t;class iT{constructor(e){this.view=e,this.buckets=fc.map(()=>[]),this.index=fc.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let s=e.bucket,a=this.buckets[s],c=this.index[s];for(let u=0;u<a.length;u++){let f=(u+c)%a.length,h=a[f];if((!n||n(h))&&!this.reused.has(h))return a.splice(f,1),f<c&&this.index[s]--,this.reused.set(h,r),h}return null}findWidget(e,n,r){let s=this.buckets[0];if(s.length)for(let a=0,c=0;;a++){if(a==s.length){if(c)return null;c=1,a=0}let u=s[a];if(!this.reused.has(u)&&(c==0?u.widget.compare(e):u.widget.constructor==e.constructor&&e.updateDOM(u.dom,this.view,u.widget)))return s.splice(a,1),a<this.index[0]&&this.index[0]--,u.widget==e&&u.length==n&&(u.flags&497)==r?(this.reused.set(u,1),u):(this.reused.set(u,2),new Ds(u.dom,n,e,u.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class rT{constructor(e,n,r,s,a){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new iT(e),this.text=new nT(e.state.doc),this.builder=new tT(this.cache,new uc(e,e.contentDOM),mt.iter(r)),this.cache.reused.set(n,2),this.old=new ZN(n),this.reuseWalker={skip:(c,u,f)=>{if(this.cache.add(c),c.isComposite())return!1},enter:c=>this.cache.add(c),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let s=0,a=0,c=0;;){let u=c<e.length?e[c++]:null,f=u?u.fromA:this.old.root.length;if(f>s){let h=f-s;this.preserve(h,!c,!u),s=f,a+=h}if(!u)break;n&&u.fromA<=n.range.fromA&&u.toA>=n.range.toA?(this.forward(u.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(a,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,u.toA),this.emit(n.range.toB,u.toB)):(this.forward(u.fromA,u.toA),this.emit(a,u.toB)),a=u.toB,s=u.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let s=aT(this.old),a=this.openMarks;this.old.advance(e,r?1:-1,{skip:(c,u,f)=>{if(c.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let h=f>0||u<c.length?Ds.of(c.widget,this.view,f-u,c.flags&496,this.cache.maybeReuse(c)):this.cache.reuse(c);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,s,a),a=s.length)}else if(c.isText())this.builder.ensureLine(null),!u&&f==c.length&&!this.cache.reused.has(c)?this.builder.addText(c.text,s,a,this.cache.reuse(c)):(this.cache.add(c),this.builder.addText(c.text.slice(u,f),s,a)),a=s.length;else if(c.isLine())c.flags&=-2,this.cache.reused.set(c,1),this.builder.addLine(c);else if(c instanceof dc)this.cache.add(c);else if(c instanceof In)this.builder.ensureLine(null),this.builder.addMark(c,s,a),this.cache.reused.set(c,1),a=s.length;else return!1;this.openWidget=!1},enter:c=>{c.isLine()?this.builder.addLineStart(c.attrs,this.cache.maybeReuse(c)):(this.cache.add(c),c instanceof In&&s.unshift(c.mark)),this.openWidget=!1},leave:c=>{c.isLine()?s.length&&(s.length=a=0):c instanceof In&&(s.shift(),a=Math.min(a,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,s=this.builder,a=-1,c=mt.spans(this.decorations,e,n,{point:(u,f,h,g,b,v)=>{if(h instanceof Es){if(this.disallowBlockEffectsFor[v]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(f>this.view.state.doc.lineAt(u).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=g.length,b>g.length)s.continueWidget(f-u);else{let w=h.widget||(h.block?hl.block:hl.inline),A=sT(h),C=this.cache.findWidget(w,f-u,A)||Ds.of(w,this.view,f-u,A);h.block?(h.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(C)):(s.ensureLine(r),s.addInlineWidget(C,g,b))}r=null}else r=lT(r,h);f>u&&this.text.skip(f-u)},span:(u,f,h,g)=>{for(let b=u;b<f;){let v=this.text.next(Math.min(512,f-b));v==null?(s.addLineStartIfNotCovered(r),s.addBreak(),b++):(s.ensureLine(r),s.addText(v,h,b==u?g:h.length),b+=v.length),r=null}a=h.length}});a>-1&&(this.openWidget=c>a),this.openWidget||s.addLineStartIfNotCovered(r),this.openMarks=c}forward(e,n,r=1){n-e<=10?this.old.advance(n-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let s=e.parentNode;;s=s.parentNode){let a=Bt.get(s);if(s==this.view.contentDOM)break;a instanceof In?n.push(a):a?.isLine()?r=a:a instanceof ar||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new fl(s,_b):r||n.push(In.of(new wa({tagName:s.nodeName.toLowerCase(),attributes:DN(s)}),s)))}return{line:r,marks:n}}}function Db(t,e){let n=r=>{for(let s of r.children)if((e?s.isText():s.length)||n(s))return!0;return!1};return n(t)}function sT(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const _b={class:"cm-line"};function lT(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&Ff(n,t),r&&(t.class+=" "+r)),t}function aT(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof In&&e.push(r.mark)}return e}function ih(t){let e=Bt.get(t);return e&&e.setDOM(t.cloneNode()),t}class hl extends nc{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}}hl.inline=new hl("span"),hl.block=new hl("div");const rh=new class extends nc{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Lb{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=rn.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 uc(e,e.contentDOM),this.updateInner([new di(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:g,toA:b})=>b<this.minWidthFrom||g>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 s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!gT(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let a=s>-1?cT(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:g,to:b}=this.hasComposition;r=new di(g,b,e.changes.mapPos(g,-1),e.changes.mapPos(b,1)).addToSet(r.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(Re.ie||Re.chrome)&&!a&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let c=this.decorations,u=this.blockWrappers;this.updateDeco();let f=fT(c,this.decorations,e.changes);f.length&&(r=di.extendWithRanges(r,f));let h=pT(u,this.blockWrappers,e.changes);return h.length&&(r=di.extendWithRanges(r,h)),a&&!r.some(g=>g.fromA<=a.range.fromA&&g.toA>=a.range.toA)&&(r=a.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,a),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let c=this.tile,u=new rT(this.view,c,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Bt.get(n.text)&&u.cache.reused.set(Bt.get(n.text),2),this.tile=u.run(e,n),sh(c,u.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 a=Re.chrome||Re.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||r.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof lh&&s.push(a.dom);r.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Cb)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,a=s==r,c=!a&&!(this.view.state.facet(sr)||r.tabIndex>-1)&&Ca(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(a||n||c))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,h,g;if(f.empty?g=h=this.inlineDOMNearPos(f.anchor,f.assoc||1):(g=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),h=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),Re.gecko&&f.empty&&!this.hasComposition&&oT(h)){let v=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(v,h.node.childNodes[h.offset]||null)),h=g=new Oi(v,0),u=!0}let b=this.view.observer.selectionRange;(u||!b.focusNode||(!Na(h.node,h.offset,b.anchorNode,b.anchorOffset)||!Na(g.node,g.offset,b.focusNode,b.focusOffset))&&!this.suppressWidgetCursorChange(b,f))&&(this.view.observer.ignore(()=>{Re.android&&Re.chrome&&r.contains(b.focusNode)&&mT(b.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let v=ka(this.view.root);if(v)if(f.empty){if(Re.gecko){let w=uT(h.node,h.offset);if(w&&w!=3){let A=(w==1?cb:ub)(h.node,h.offset);A&&(h=new Oi(A.node,A.offset))}}v.collapse(h.node,h.offset),f.bidiLevel!=null&&v.caretBidiLevel!==void 0&&(v.caretBidiLevel=f.bidiLevel)}else if(v.extend){v.collapse(h.node,h.offset);try{v.extend(g.node,g.offset)}catch{}}else{let w=document.createRange();f.anchor>f.head&&([h,g]=[g,h]),w.setEnd(g.node,g.offset),w.setStart(h.node,h.offset),v.removeAllRanges(),v.addRange(w)}c&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(h,g)),this.impreciseAnchor=h.precise?null:new Oi(b.anchorNode,b.anchorOffset),this.impreciseHead=g.precise?null:new Oi(b.focusNode,b.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Na(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=ka(e.root),{anchorNode:s,anchorOffset:a}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let c=this.lineAt(n.head,n.assoc);if(!c)return;let u=c.posAtStart;if(n.head==u||n.head==u+c.length)return;let f=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!f||!h||f.bottom>h.top)return;let g=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(g.node,g.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let b=e.observer.selectionRange;e.docView.posFromDOM(b.anchorNode,b.anchorOffset)!=n.from&&r.collapse(s,a)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let a;if(e==r.dom)a=r.dom.childNodes[n];else{let c=rr(e)==0?0:n==0?-1:1;for(;;){let u=e.parentNode;if(u==r.dom)break;c==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?c=-1:c=1),e=u}c<0?a=e:a=e.nextSibling}if(a==r.dom.firstChild)return s;for(;a&&!Bt.get(a);)a=a.nextSibling;if(!a)return s+r.length;for(let c=0,u=s;;c++){let f=r.children[c];if(f.dom==a)return u;u+=f.length+f.breakAfter}}else return r.isText()?e==r.dom?s+n:s+(n?r.length:0):s}domAtPos(e,n){let{tile:r,offset:s}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(s,n):r.domIn(s,n)}inlineDOMNearPos(e,n){let r,s=-1,a=!1,c,u=-1,f=!1;return this.tile.blockTiles((h,g)=>{if(h.isWidget()){if(h.flags&32&&g>=e)return!0;h.flags&16&&(a=!0)}else{let b=g+h.length;if(g<=e&&(r=h,s=e-g,a=b<e),b>=e&&!c&&(c=h,u=e-g,f=g>e),g>e&&c)return!0}}),!r&&!c?this.domAtPos(e,n):(a&&c?r=null:f&&r&&(c=null),r&&n<0||!c?r.domIn(s,n):c.domIn(u,n))}coordsAt(e,n,r){let{tile:s,offset:a}=this.tile.resolveBlock(e,n);return s.isWidget()?s.widget instanceof lh?null:s.coordsInWidget(a,n,!0):s.coordsIn(a,n,r)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function s(a,c){if(a.isComposite())for(let u of a.children){if(u.length>=c){let f=s(u,c);if(f)return f}if(c-=u.length,c<0)break}else if(a.isText()&&c<a.length){let u=An(a.text,c);if(u==c)return null;let f=Ta(a.dom,c,u).getClientRects();for(let h=0;h<f.length;h++){let g=f[h];if(h==f.length-1||g.top<g.bottom&&g.left<g.right)return g}}return null}return s(n,r)}measureVisibleLineHeights(e){let n=[],{from:r,to:s}=e,a=this.view.contentDOM.clientWidth,c=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==Lt.LTR,h=0,g=(b,v,w)=>{for(let A=0;A<b.children.length&&!(v>s);A++){let C=b.children[A],j=v+C.length,D=C.dom.getBoundingClientRect(),{height:M}=D;if(w&&!A&&(h+=D.top-w.top),C instanceof ar)j>r&&g(C,v,D);else if(v>=r&&(h>0&&n.push(-h),n.push(M+h),h=0,c)){let E=C.dom.lastChild,R=E?ic(E):[];if(R.length){let _=R[R.length-1],q=f?_.right-D.left:D.right-_.left;q>u&&(u=q,this.minWidth=a,this.minWidthFrom=v,this.minWidthTo=j)}}w&&A==b.children.length-1&&(h+=w.bottom-D.bottom),v=j+C.breakAfter}};return g(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Lt.RTL:Lt.LTR}measureTextSize(){let e=this.tile.blockTiles(c=>{if(c.isLine()&&c.children.length&&c.length<=20){let u=0,f;for(let h of c.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let g=ic(h.dom);if(g.length!=1)return;u+=g[0].width,f=g[0].height}if(u)return{lineHeight:c.dom.getBoundingClientRect().height,charWidth:u/c.length,textHeight:f}}});if(e)return e;let n=document.createElement("div"),r,s,a;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let c=ic(n.firstChild)[0];r=n.getBoundingClientRect().height,s=c&&c.width?c.width/27:7,a=c&&c.height?c.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:a}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let a=s==n.viewports.length?null:n.viewports[s],c=a?a.from-1:this.view.state.doc.length;if(c>r){let u=(n.lineBlockAt(c).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(rn.replace({widget:new lh(u),block:!0,inclusive:!0,isBlockGap:!0}).range(r,c))}if(!a)break;r=a.to+1}return rn.set(e)}updateDeco(){let e=1,n=this.view.state.facet(ac).map(a=>(this.dynamicDecorationMap[e++]=typeof a=="function")?a(this.view):a),r=!1,s=this.view.state.facet(nh).map((a,c)=>{let u=typeof a=="function";return u&&(r=!0),u?a(this.view):a});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(mt.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Tb).map(a=>typeof a=="function"?a(this.view):a)}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(kb))try{if(h(this.view,e.range,e))return!0}catch(g){Pi(this.view.state,g,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let a=Mb(this.view),c={left:r.left-a.left,top:r.top-a.top,right:r.right+a.right,bottom:r.bottom+a.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(qN(this.view.scrollDOM,c,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,u),-u),Math.max(Math.min(e.yMargin,f),-f),this.view.textDirection==Lt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.visualViewport.offsetTop)){let h=this.view.docView.lineAt(n.head,1);if(h){let g=rb(h.dom);h.dom.scrollIntoView({block:"nearest"}),sb(g,!1)}}}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){sh(this.tile)}}function sh(t,e){let n=e?.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)sh(r,e)}}function oT(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function qb(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=cb(n.focusNode,n.focusOffset),s=ub(n.focusNode,n.focusOffset),a=r||s;if(s&&r&&s.node!=r.node){let u=Bt.get(s.node);if(!u||u.isText()&&u.text!=s.node.nodeValue)a=s;else if(t.docView.lastCompositionAfterCursor){let f=Bt.get(r.node);!f||f.isText()&&f.text!=r.node.nodeValue||(a=s)}}if(t.docView.lastCompositionAfterCursor=a!=r,!a)return null;let c=e-a.offset;return{from:c,to:c+a.node.nodeValue.length,node:a.node}}function cT(t,e,n){let r=qb(t,n);if(!r)return null;let{node:s,from:a,to:c}=r,u=s.nodeValue;if(/[\n\r]/.test(u)||t.state.doc.sliceString(r.from,r.to)!=u)return null;let f=e.invertedDesc;return{range:new di(f.mapPos(a),f.mapPos(c),a,c),text:s}}function uT(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let dT=class{constructor(){this.changes=[]}compareRange(e,n){ol(e,n,this.changes)}comparePoint(e,n){ol(e,n,this.changes)}boundChange(e){ol(e,e,this.changes)}};function fT(t,e,n){let r=new dT;return mt.compare(t,e,n,r),r.changes}class hT{constructor(){this.changes=[]}compareRange(e,n){ol(e,n,this.changes)}comparePoint(){}boundChange(e){ol(e,e,this.changes)}}function pT(t,e,n){let r=new hT;return mt.compare(t,e,n,r),r.changes}function mT(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function gT(t,e){let n=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(n=!0)}),n}class lh extends nc{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 yT(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),a=e-s.from;if(s.length==0)return Ae.cursor(e);a==0?n=1:a==s.length&&(n=-1);let c=a,u=a;n<0?c=An(s.text,a,!1):u=An(s.text,a);let f=r(s.text.slice(c,u));for(;c>0;){let h=An(s.text,c,!1);if(r(s.text.slice(h,c))!=f)break;c=h}for(;u<s.length;){let h=An(s.text,u);if(r(s.text.slice(u,h))!=f)break;u=h}return Ae.undirectionalRange(c+s.from,u+s.from)}function bT(t,e,n,r,s){let a=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let u=t.viewState.heightOracle.textHeight,f=Math.floor((s-n.top-(t.defaultLineHeight-u)*.5)/u);a+=f*t.viewState.heightOracle.lineLength}let c=t.state.sliceDoc(n.from,n.to);return n.from+TN(c,a,t.state.tabSize)}function ah(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let a of r.type){if(a.from>e)break;if(!(a.to<e)){if(a.from<e&&a.to>e)return a;(!s||a.type==un.Text&&(s.type!=a.type||(n<0?a.from<e:a.to>e)))&&(s=a)}}return s||r}return r}function xT(t,e,n,r){let s=ah(t,e.head,e.assoc||-1),a=!r||s.type!=un.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(a){let c=t.dom.getBoundingClientRect(),u=t.textDirectionAt(s.from),f=t.posAtCoords({x:n==(u==Lt.LTR)?c.right-1:c.left+1,y:(a.top+a.bottom)/2});if(f!=null)return Ae.cursor(f,n?-1:1)}return Ae.cursor(n?s.to:s.from,n?-1:1)}function Bb(t,e,n,r){let s=t.state.doc.lineAt(e.head),a=t.bidiSpans(s),c=t.textDirectionAt(s.from);for(let u=e,f=null;;){let h=KN(s,a,c,u,n),g=mb;if(!h){if(s.number==(n?t.state.doc.lines:1))return u;g=`
|
|
56
|
-
`,s=t.state.doc.line(s.number+(n?1:-1)),a=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(f){if(!f(g))return u}else{if(!r)return h;f=r(g)}u=h}}function vT(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return a=>{let c=r(a);return s==ir.Space&&(s=c),s==c}}function wT(t,e,n,r){let s=e.head,a=n?1:-1;if(s==(n?t.state.doc.length:0))return Ae.cursor(s,e.assoc);let c=e.goalColumn,u,f=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),g=t.documentTop;if(h)c==null&&(c=h.left-f.left),u=a<0?h.top:h.bottom;else{let A=t.viewState.lineBlockAt(s);c==null&&(c=Math.min(f.right-f.left,t.defaultCharacterWidth*(s-A.from))),u=(a<0?A.top:A.bottom)+g}let b=f.left+c,v=t.viewState.heightOracle.textHeight>>1,w=r??v;for(let A=0;;A+=v){let C=u+(w+A)*a,j=ch(t,{x:b,y:C},!1,a);if(n?C>f.bottom:C<f.top)return Ae.cursor(j.pos,j.assoc);let D=t.coordsAtPos(j.pos,j.assoc),M=D?(D.top+D.bottom)/2:0;if(!D||(n?M>u:M<u))return Ae.cursor(j.pos,j.assoc,void 0,c)}}function Oa(t,e,n){for(;;){let r=0;for(let s of t)s.between(e-1,e+1,(a,c,u)=>{if(e>a&&e<c){let f=r||n||(e-a<c-e?-1:1);e=f<0?a:c,r=f}});if(!r)return e}}function $b(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],a=null;if(s.empty){let c=Oa(t,s.from,0);c!=s.from&&(a=Ae.cursor(c,-1))}else{let c=Oa(t,s.from,-1),u=Oa(t,s.to,1);(c!=s.from||u!=s.to)&&(s.undirectional?a=Ae.undirectionalRange(s.from,s.to):a=Ae.range(s.from==s.anchor?c:u,s.from==s.head?c:u))}a&&(n||(n=e.ranges.slice()),n[r]=a)}return n?Ae.create(n,e.mainIndex):e}function oh(t,e,n){let r=Oa(t.state.facet(ja).map(s=>s(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ae.cursor(r,r<n.from?1:-1)}class Yi{constructor(e,n){this.pos=e,this.assoc=n}}function ch(t,e,n,r){let s=t.contentDOM.getBoundingClientRect(),a=s.top+t.viewState.paddingTop,{x:c,y:u}=e,f=u-a,h;for(;;){if(f<0)return new Yi(0,1);if(f>t.viewState.docHeight)return new Yi(t.state.doc.length,-1);if(h=t.elementAtHeight(f),r==null)break;if(h.type==un.Text){if(r<0?h.to<t.viewport.from:h.from>t.viewport.to)break;let v=t.docView.coordsAt(r<0?h.from:h.to,r>0?-1:1);if(v&&(r<0?v.top<=f+a:v.bottom>=f+a))break}let b=t.viewState.heightOracle.textHeight/2;f=r>0?h.bottom+b:h.top-b}if(t.viewport.from>=h.to||t.viewport.to<=h.from){if(n)return null;if(h.type==un.Text){let b=bT(t,s,h,c,u);return new Yi(b,b==h.from?1:-1)}}if(h.type!=un.Text)return f<(h.top+h.bottom)/2?new Yi(h.from,1):new Yi(h.to,-1);let g=t.docView.lineAt(h.from,2);return(!g||g.length!=h.length)&&(g=t.docView.lineAt(h.from,-2)),new ST(t,c,u,t.textDirectionAt(h.from)).scanTile(g,h.from)}class ST{constructor(e,n,r,s){this.view=e,this.x=n,this.y=r,this.baseDir=s,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,n){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Fi.find(s,e-r.from,-1,n)].level==this.baseDir}dirAt(e,n){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Fi.find(s,e-r.from,-1,n)].dir}bidiIn(e,n){let{spans:r,line:s}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<n)}scan(e,n,r=!1){let s=0,a=e.length-1,c=new Set,u=this.bidiIn(e[0],e[a]),f,h,g=-1,b=1e9,v;e:for(;s<a;){let A=a-s,C=s+a>>1;t:if(c.has(C)){for(let M=1;M<A;M++){let E=C+M;if(E>=a&&(E-=A),!c.has(E)){C=E;break t}}break e}c.add(C);let j=n(C),D=0;if(j)for(let M=0;M<j.length;M++){let E=j[M];if(!(E.width==0&&j.length>1))if(E.bottom<this.y)(!f||f.bottom<E.bottom)&&(f=E),D=1;else if(E.top>this.y)(!h||h.top>E.top)&&(h=E),D=-1;else{let R=E.left>this.x?this.x-E.left:E.right<this.x?this.x-E.right:0,_=Math.abs(R);_<b&&(g=C,b=_,v=E),R&&(D=R<0==(this.baseDir==Lt.LTR)?-1:1)}}D==-1&&(!u||this.baseDirAt(e[C],1))?a=C:D==1&&(!u||this.baseDirAt(e[C+1],-1))&&(s=C+1)}if(!v){if(!h&&!f)return{i:0,after:!1};let A=f&&(!h||this.y-f.bottom<h.top-this.y)?f:h;return this.y=(A.top+A.bottom)/2,this.scan(e,n,!0)}if(b&&!r){let{top:A,bottom:C}=v;if(f&&f.bottom>(A+A+C)/3)return this.y=f.bottom-1,this.scan(e,n,!0);if(h&&h.top<(A+C+C)/3)return this.y=h.top+1,this.scan(e,n,!0)}let w=(u?this.dirAt(e[g],1):this.baseDir)==Lt.LTR;return{i:g,after:this.x>(v.left+v.right)/2==w}}scanText(e,n){let r=[];for(let a=0;a<e.length;a=An(e.text,a))r.push(n+a);r.push(n+e.length);let s=this.scan(r,a=>{let c=r[a]-n,u=r[a+1]-n;return Ta(e.dom,c,u).getClientRects()});return s.after?new Yi(r[s.i+1],-1):new Yi(r[s.i],1)}scanTile(e,n){if(!e.length)return new Yi(n,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,n);if(u.isComposite())return this.scanTile(u,n)}let r=[n];for(let u=0,f=n;u<e.children.length;u++)r.push(f+=e.children[u].length);let s=this.scan(r,u=>{let f=e.children[u];return f.flags&48?null:(f.dom.nodeType==1?f.dom:Ta(f.dom,0,f.length)).getClientRects()}),a=e.children[s.i],c=r[s.i];return a.isText()?this.scanText(a,c):a.isComposite()?this.scanTile(a,c):s.after?new Yi(r[s.i+1],-1):new Yi(c,1)}}const pl="";class AT{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(wt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=pl}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let a=this.text.length;this.readNode(s);let c=Bt.get(s),u=s.nextSibling;if(u==n){c?.breakAfter&&!u&&r!=this.view.contentDOM&&this.lineBreak();break}let f=Bt.get(u);(c&&f?c.breakAfter:(c?c.breakAfter:rc(s))||rc(u)&&(s.nodeName!="BR"||c?.isWidget())&&this.text.length>a)&&!CT(u,n)&&this.lineBreak(),s=u}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,c=1,u;if(this.lineSeparator?(a=n.indexOf(this.lineSeparator,r),c=this.lineSeparator.length):(u=s.exec(n))&&(a=u.index,c=u[0].length),this.append(n.slice(r,a<0?n.length:a)),a<0)break;if(this.lineBreak(),c>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=c-1);r=a+c}}readNode(e){let n=Bt.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(kT(e,r.node,r.offset)?n:0))}}function kT(t,e,n){for(;;){if(!e||n<rr(e))return!1;if(e==t)return!0;n=zr(e)+1,e=e.parentNode}}function CT(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=Bt.get(t);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class Ib{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class NT{constructor(e,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:a,impreciseAnchor:c}=e.docView,u=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=Hb(e.docView.tile,n,r,0))){let f=a||c?[]:jT(e),h=new AT(f,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=ET(f,this.bounds.from)}else{let f=e.observer.selectionRange,h=a&&a.node==f.focusNode&&a.offset==f.focusOffset||!Yf(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),g=c&&c.node==f.anchorNode&&c.offset==f.anchorOffset||!Yf(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),b=e.viewport;if((Re.ios||Re.chrome)&&h!=g&&Math.min(h,g)<=u.main.from&&Math.max(h,g)>=u.main.to&&(b.from>0||b.to<e.state.doc.length)){let v=Math.min(h,g),w=Math.max(h,g),A=b.from-v,C=b.to-w;(A==0||A==1||v==0)&&(C==0||C==-1||w==e.state.doc.length)&&(h=0,g=e.state.doc.length)}if(e.inputState.composing>-1&&u.ranges.length>1)this.newSel=u.replaceRange(Ae.range(g,h));else if(e.lineWrapping&&g==h&&!(u.main.empty&&u.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let v=e.coordsAtPos(h,-1),w=0;v&&(w=e.inputState.lastTouchY<=v.bottom?-1:1),this.newSel=Ae.create([Ae.cursor(h,w)])}else this.newSel=Ae.single(g,h)}}}function Hb(t,e,n,r){if(t.isComposite()){let s=-1,a=-1,c=-1,u=-1;for(let f=0,h=r,g=r;f<t.children.length;f++){let b=t.children[f],v=h+b.length;if(h<e&&v>n)return Hb(b,e,n,h);if(v>=e&&s==-1&&(s=f,a=h),h>n&&b.dom.parentNode==t.dom){c=f,u=g;break}g=v,h=v+b.breakAfter}return{from:a,to:u<0?r+t.length:u,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:c<t.children.length&&c>=0?t.children[c].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function zb(t,e){let n,{newSel:r}=e,{state:s}=t,a=s.selection.main,c=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,h=a.from,g=null;(c===8||Re.android&&e.text.length<f-u)&&(h=a.to,g="end");let b=s.doc.sliceString(u,f,pl),v,w;!a.empty&&a.from>=u&&a.to<=f&&(e.typeOver||b!=e.text)&&b.slice(0,a.from-u)==e.text.slice(0,a.from-u)&&b.slice(a.to-u)==e.text.slice(v=e.text.length-(b.length-(a.to-u)))?n={from:a.from,to:a.to,insert:gt.of(e.text.slice(a.from-u,v).split(pl))}:(w=Ub(b,e.text,h-u,g))&&(Re.chrome&&c==13&&w.toB==w.from+2&&e.text.slice(w.from,w.toB)==pl+pl&&w.toB--,n={from:u+w.from,to:u+w.toA,insert:gt.of(e.text.slice(w.from,w.toB).split(pl))})}else r&&(!t.hasFocus&&s.facet(sr)||hc(r,a))&&(r=null);if(!n&&!r)return!1;if((Re.mac||Re.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:gt.of([n.insert.toString().replace("."," ")])}):s.doc.lineAt(a.from).to<a.to&&t.docView.lineHasWidget(a.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:s.toText(t.inputState.insertingText)}:Re.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
57
|
-
`&&t.lineWrapping&&(r&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:a.from,to:a.to,insert:gt.of([" "])}),n)return uh(t,n,r,c);if(r&&!hc(r,a)){let u=!1,f="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(u=!0),f=t.inputState.lastSelectionOrigin,f=="select.pointer"&&(r=$b(s.facet(ja).map(h=>h(t)),r))),t.dispatch({selection:r,scrollIntoView:u,userEvent:f}),!0}else return!1}function uh(t,e,n,r=-1){if(Re.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Re.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&cl(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&cl(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&cl(t.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let c,u=()=>c||(c=TT(t,e,n));return t.state.facet(vb).some(f=>f(t,e.from,e.to,a,u))||t.dispatch(u()),!0}function TT(t,e,n){let r,s=t.state,a=s.selection.main,c=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let f=e.from<a.from?-1:1,h=f<0?a.from:a.to,g=Oa(s.facet(ja).map(b=>b(t)),h,f);e.from==g&&(c=g)}if(c>-1)r={changes:e,selection:Ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=a.from&&e.to<=a.to&&e.to-e.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let f=a.from<e.from?s.sliceDoc(a.from,e.from):"",h=a.to>e.to?s.sliceDoc(e.to,a.to):"";r=s.replaceSelection(t.state.toText(f+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let f=s.changes(e),h=n&&n.main.to<=f.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let g=t.state.sliceDoc(e.from,e.to),b,v=n&&qb(t,n.main.head);if(v){let A=e.insert.length-(e.to-e.from);b={from:v.from,to:v.to-A}}else b=t.state.doc.lineAt(a.head);let w=a.to-e.to;r=s.changeByRange(A=>{if(A.from==a.from&&A.to==a.to)return{changes:f,range:h||A.map(f)};let C=A.to-w,j=C-g.length;if(t.state.sliceDoc(j,C)!=g||C>=b.from&&j<=b.to)return{range:A};let D=s.changes({from:j,to:C,insert:e.insert}),M=A.to-a.to;return{changes:D,range:h?Ae.range(Math.max(0,h.anchor+M),Math.max(0,h.head+M)):A.map(D)}})}else r={changes:f,selection:h&&s.selection.replaceRange(h)}}let u="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,u+=".compose",t.inputState.compositionFirstChange&&(u+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:u,scrollIntoView:!0})}function Ub(t,e,n,r){let s=Math.min(t.length,e.length),a=0;for(;a<s&&t.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==s&&t.length==e.length)return null;let c=t.length,u=e.length;for(;c>0&&u>0&&t.charCodeAt(c-1)==e.charCodeAt(u-1);)c--,u--;if(r=="end"){let f=Math.max(0,a-Math.min(c,u));n-=c+f-a}if(c<a&&t.length<e.length){let f=n<=a&&n>=c?a-n:0;a-=f,u=a+(u-c),c=a}else if(u<a){let f=n<=a&&n>=u?a-n:0;a-=f,c=a+(c-u),u=a}return{from:a,toA:c,toB:u}}function jT(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:a}=t.observer.selectionRange;return n&&(e.push(new Ib(n,r)),(s!=n||a!=r)&&e.push(new Ib(s,a))),e}function ET(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ae.single(n+e,r+e):null}function hc(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class OT{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.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Re.safari&&e.contentDOM.addEventListener("input",()=>null),Re.gecko&&YT(e.contentDOM.ownerDocument)}handleEvent(e){!IT(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,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=RT(e),r=this.handlers,s=this.view.contentDOM;for(let a in n)if(a!="scroll"){let c=!n[a].handlers.length,u=r[a];u&&c!=!u.handlers.length&&(s.removeEventListener(a,this.handleEvent),u=null),u||s.addEventListener(a,this.handleEvent,{passive:c})}for(let a in r)a!="scroll"&&!n[a]&&s.removeEventListener(a,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Pb.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Re.android&&Re.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Re.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(Fb.some(n=>n.keyCode==e.keyCode)&&!e.ctrlKey||DT.indexOf(e.key)>-1&&e.ctrlKey)){let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&Re.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&MT(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let n=this.pendingIOSKey;return!n||this.view.observer.pendingRecords().length||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,cl(this.view.contentDOM,n.key,n.keyCode,n.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Re.safari&&!Re.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()}}function MT(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function Vb(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Pi(n.state,s)}}}function RT(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,a=s&&s.plugin.domEventHandlers,c=s&&s.plugin.domEventObservers;if(a)for(let u in a){let f=a[u];f&&n(u).handlers.push(Vb(r.value,f))}if(c)for(let u in c){let f=c[u];f&&n(u).observers.push(Vb(r.value,f))}}for(let r in Mi)n(r).handlers.push(Mi[r]);for(let r in Rn)n(r).observers.push(Rn[r]);return e}const Fb=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],DT="dthko",Pb=[16,17,18,20,91,92,224,225],pc=6;function mc(t){return Math.max(0,t)*.7+8}function _T(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class LT{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=ib(e.contentDOM),this.atoms=e.state.facet(ja).map(c=>c(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(wt.allowMultipleSelections)&&qT(e,n),this.dragging=$T(e,n)&&Wb(n)==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&&_T(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,a=0,c=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:c}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=Mb(this.view);e.clientX-f.left<=s+pc?n=-mc(s-e.clientX):e.clientX+f.right>=c-pc&&(n=mc(e.clientX-c)),e.clientY-f.top<=a+pc?r=-mc(a-e.clientY):e.clientY+f.bottom>=u-pc&&(r=mc(e.clientY-u)),this.setScrollSpeed(n,r)}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,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=$b(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function qT(t,e){let n=t.state.facet(gb);return n.length?n[0](e):Re.mac?e.metaKey:e.ctrlKey}function BT(t,e){let n=t.state.facet(yb);return n.length?n[0](e):Re.mac?!e.altKey:!e.ctrlKey}function $T(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=ka(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let a=0;a<s.length;a++){let c=s[a];if(c.left<=e.clientX&&c.right>=e.clientX&&c.top<=e.clientY&&c.bottom>=e.clientY)return!0}return!1}function IT(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Bt.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Mi=Object.create(null),Rn=Object.create(null),Yb=Re.ie&&Re.ie_version<15||Re.ios&&Re.webkit_version<604;function HT(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),Kb(t,n.value)},50)}function gc(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function Kb(t,e){e=gc(t.state,Wf,e);let{state:n}=t,r,s=1,a=n.toText(e),c=a.lines==n.selection.ranges.length;if(dh!=null&&n.selection.ranges.every(f=>f.empty)&&dh==a.toString()){let f=-1;r=n.changeByRange(h=>{let g=n.doc.lineAt(h.from);if(g.from==f)return{range:h};f=g.from;let b=n.toText((c?a.line(s++).text:e)+n.lineBreak);return{changes:{from:g.from,insert:b},range:Ae.cursor(h.from+b.length)}})}else c?r=n.changeByRange(f=>{let h=a.line(s++);return{changes:{from:f.from,to:f.to,insert:h.text},range:Ae.cursor(f.from+h.length)}}):r=n.replaceSelection(a);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Rn.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,Re.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())},Rn.wheel=Rn.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()},Mi.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),Rn.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")},Rn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Rn.touchend=(t,e)=>{t.inputState.touchActive=!1},Mi.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(bb))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=UT(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new LT(t,e,n,r)),r&&t.observer.ignore(()=>{lb(t.contentDOM);let a=t.root.activeElement;a&&!a.contains(t.contentDOM)&&a.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Gb(t,e,n,r){if(r==1)return Ae.cursor(e,n);if(r==2)return yT(t.state,e,n);{let s=t.docView.lineAt(e,n),a=t.state.doc.lineAt(s?s.posAtEnd:e),c=s?s.posAtStart:a.from,u=s?s.posAtEnd:a.to;return u<t.state.doc.length&&u==a.to&&u++,Ae.undirectionalRange(c,u)}}const zT=Re.ie&&Re.ie_version<=11;let Xb=null,Jb=0,Qb=0;function Wb(t){if(!zT)return t.detail;let e=Xb,n=Qb;return Xb=t,Qb=Date.now(),Jb=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Jb+1)%3:1}function UT(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=Wb(e),s=t.state.selection;return{update(a){a.docChanged&&(n.pos=a.changes.mapPos(n.pos),s=s.map(a.changes))},get(a,c,u){let f=t.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),h,g=Gb(t,f.pos,f.assoc,r);if(n.pos!=f.pos&&!c){let b=Gb(t,n.pos,n.assoc,r),v=Math.min(b.from,g.from),w=Math.max(b.to,g.to);g=v<g.from?Ae.range(v,w,g.assoc):Ae.range(w,v,g.assoc)}return c?s.replaceRange(s.main.extend(g.from,g.to,g.assoc)):u&&r==1&&s.ranges.length>1&&(h=VT(s,f.pos))?h:u?s.addRange(g):Ae.create([g])}}}function VT(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:s}=t.ranges[n];if(r<=e&&s>=e)return Ae.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Mi.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.tile.nearest(e.target);if(s&&s.isWidget()){let a=s.posAtStart,c=a+s.length;(a>=n.to||c<=n.from)&&(n=Ae.undirectionalRange(a,c))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",gc(t.state,Zf,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Mi.dragend=t=>(t.inputState.draggedContent=null,!1);function Zb(t,e,n,r){if(n=gc(t.state,Wf,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:a}=t.inputState,c=r&&a&&BT(t,e)?{from:a.from,to:a.to}:null,u={from:s,insert:n},f=t.state.changes(c?[c,u]:u);t.focus(),t.dispatch({changes:f,selection:{anchor:f.mapPos(s,-1),head:f.mapPos(s,1)},userEvent:c?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Mi.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,a=()=>{++s==n.length&&Zb(t,e,r.filter(c=>c!=null).join(t.state.lineBreak),!1)};for(let c=0;c<n.length;c++){let u=new FileReader;u.onerror=a,u.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(r[c]=u.result),a()},u.readAsText(n[c])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return Zb(t,e,r,!0),!0}return!1},Mi.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=Yb?null:e.clipboardData;return n?(Kb(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(HT(t),!1)};function FT(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function PT(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:a}of t.selection.ranges){let c=t.doc.lineAt(a);c.number>s&&(e.push(c.text),n.push({from:c.from,to:Math.min(t.doc.length,c.to+1)})),s=c.number}r=!0}return{text:gc(t,Zf,e.join(t.lineBreak)),ranges:n,linewise:r}}let dh=null;Mi.copy=Mi.cut=(t,e)=>{if(!Ca(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=PT(t.state);if(!n&&!s)return!1;dh=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let a=Yb?null:e.clipboardData;return a?(a.clearData(),a.setData("text/plain",n),!0):(FT(t,n),!1)};const ex=Ir.define();function tx(t,e){let n=[];for(let r of t.facet(wb)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:ex.of(!0)}):null}function nx(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=tx(t.state,e);n?t.dispatch(n):t.update([])}},10)}Rn.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),nx(t)},Rn.blur=t=>{t.observer.clearSelectionRange(),nx(t)},Rn.compositionstart=Rn.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},Rn.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Re.chrome&&Re.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},Rn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Mi.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let a=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),c=e.getTargetRanges();if(a&&c.length){let u=c[0],f=t.posAtDOM(u.startContainer,u.startOffset),h=t.posAtDOM(u.endContainer,u.endOffset);return uh(t,{from:f,to:h,insert:t.state.toText(a)},null),!0}}let s;if(Re.chrome&&Re.android&&(s=Fb.find(a=>a.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let a=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var c;(((c=window.visualViewport)===null||c===void 0?void 0:c.height)||0)>a+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Re.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Re.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Rn.compositionend(t,e),20),!1};const ix=new Set;function YT(t){ix.has(t)||(ix.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const rx=["pre-wrap","normal","pre-line","break-spaces"];let ml=!1;function sx(){ml=!1}class KT{constructor(e){this.lineWrapping=e,this.doc=gt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}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 rx.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(e,n,r,s,a,c){let u=rx.indexOf(e)>-1,f=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=a,f){this.heightSamples={};for(let h=0;h<c.length;h++){let g=c[h];g<0?h++:this.heightSamples[Math.floor(g*10)]=!0}}return f}}class GT{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Ri{constructor(e,n,r,s,a){this.from=e,this.length=n,this.top=r,this.height=s,this._content=a}get type(){return typeof this._content=="number"?un.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 Es?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Ri(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Mt=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(Mt||(Mt={}));const yc=.001;class Dn{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}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)>yc&&(ml=!0),this.height=e)}replace(e,n,r){return Dn.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let a=this,c=r.doc;for(let u=s.length-1;u>=0;u--){let{fromA:f,toA:h,fromB:g,toB:b}=s[u],v=a.lineAt(f,Mt.ByPosNoHeight,r.setDoc(n),0,0),w=v.to>=h?v:a.lineAt(h,Mt.ByPosNoHeight,r,0,0);for(b+=w.to-h,h=w.to;u>0&&v.from<=s[u-1].toA;)f=s[u-1].fromA,g=s[u-1].fromB,u--,f<v.from&&(v=a.lineAt(f,Mt.ByPosNoHeight,r,0,0));g+=v.from-f,f=v.from;let A=fh.build(r.setDoc(c),e,g,b);a=bc(a,a.replace(f,h,A))}return a.updateHeight(r,0)}static empty(){return new Qn(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,s=0,a=0;for(;;)if(n==r)if(s>a*2){let u=e[n-1];u.break?e.splice(--n,1,u.left,null,u.right):e.splice(--n,1,u.left,u.right),r+=1+u.break,s-=u.size}else if(a>s*2){let u=e[r];u.break?e.splice(r,1,u.left,null,u.right):e.splice(r,1,u.left,u.right),r+=2+u.break,a-=u.size}else break;else if(s<a){let u=e[n++];u&&(s+=u.size)}else{let u=e[--r];u&&(a+=u.size)}let c=0;return e[n-1]==null?(c=1,n--):e[n]==null&&(c=1,r++),new JT(Dn.of(e.slice(0,n)),c,Dn.of(e.slice(r)))}}function bc(t,e){return t==e?t:(t.constructor!=e.constructor&&(ml=!0),e)}Dn.prototype.size=1;const XT=rn.replace({});class lx extends Dn{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new Ri(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,s){return this.spaceAbove&&e<r+this.spaceAbove?new Ri(s,0,r,this.spaceAbove,XT):this.mainBlock(r,s)}lineAt(e,n,r,s,a){let c=this.mainBlock(s,a);return this.spaceAbove?this.blockAt(0,r,s,a).join(c):c}forEachLine(e,n,r,s,a,c){e<=a+this.length&&n>=a&&c(this.lineAt(0,Mt.ByPos,r,s,a))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Qn extends lx{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Ri(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof Qn||s instanceof dn&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof dn?s=new Qn(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Dn.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(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 dn extends Dn{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,a=s-r+1,c,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*a);c=f/a,this.length>a+1&&(u=(this.height-f)/(this.length-a-1))}else c=this.height/a;return{firstLine:r,lastLine:s,perLine:c,perChar:u}}blockAt(e,n,r,s){let{firstLine:a,lastLine:c,perLine:u,perChar:f}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),g=n.doc.lineAt(h),b=u+g.length*f,v=Math.max(r,e-b/2);return new Ri(g.from,g.length,v,b,0)}else{let h=Math.max(0,Math.min(c-a,Math.floor((e-r)/u))),{from:g,length:b}=n.doc.line(a+h);return new Ri(g,b,r+u*h,u,0)}}lineAt(e,n,r,s,a){if(n==Mt.ByHeight)return this.blockAt(e,r,s,a);if(n==Mt.ByPosNoHeight){let{from:w,to:A}=r.doc.lineAt(e);return new Ri(w,A-w,0,0,0)}let{firstLine:c,perLine:u,perChar:f}=this.heightMetrics(r,a),h=r.doc.lineAt(e),g=u+h.length*f,b=h.number-c,v=s+u*b+f*(h.from-a-b);return new Ri(h.from,h.length,Math.max(s,Math.min(v,s+this.height-g)),g,0)}forEachLine(e,n,r,s,a,c){e=Math.max(e,a),n=Math.min(n,a+this.length);let{firstLine:u,perLine:f,perChar:h}=this.heightMetrics(r,a);for(let g=e,b=s;g<=n;){let v=r.doc.lineAt(g);if(g==e){let A=v.number-u;b+=f*A+h*(e-a-A)}let w=f+h*v.length;c(new Ri(v.from,v.length,b,w,0)),b+=w,g=v.to+1}}replace(e,n,r){let s=this.length-n;if(s>0){let a=r[r.length-1];a instanceof dn?r[r.length-1]=new dn(a.length+s):r.push(null,new dn(s-1))}if(e>0){let a=r[0];a instanceof dn?r[0]=new dn(e+a.length):r.unshift(new dn(e-1),null)}return Dn.of(r)}decomposeLeft(e,n){n.push(new dn(e-1),null)}decomposeRight(e,n){n.push(null,new dn(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let a=n+this.length;if(s&&s.from<=n+this.length&&s.more){let c=[],u=Math.max(n,s.from),f=-1;for(s.from>n&&c.push(new dn(s.from-n-1).updateHeight(e,n));u<=a&&s.more;){let g=e.doc.lineAt(u).length;c.length&&c.push(null);let b=s.heights[s.index++],v=0;b<0&&(v=-b,b=s.heights[s.index++]),f==-1?f=b:Math.abs(b-f)>=yc&&(f=-2);let w=new Qn(g,b,v);w.outdated=!1,c.push(w),u+=g+1}u<=a&&c.push(null,new dn(a-u).updateHeight(e,u));let h=Dn.of(c);return(f<0||Math.abs(h.height-this.height)>=yc||Math.abs(f-this.heightMetrics(e,n).perLine)>=yc)&&(ml=!0),bc(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class JT extends Dn{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let a=r+this.left.height;return e<a?this.left.blockAt(e,n,r,s):this.right.blockAt(e,n,a,s+this.left.length+this.break)}lineAt(e,n,r,s,a){let c=s+this.left.height,u=a+this.left.length+this.break,f=n==Mt.ByHeight?e<c:e<u,h=f?this.left.lineAt(e,n,r,s,a):this.right.lineAt(e,n,r,c,u);if(this.break||(f?h.to<u:h.from>u))return h;let g=n==Mt.ByPosNoHeight?Mt.ByPosNoHeight:Mt.ByPos;return f?h.join(this.right.lineAt(u,g,r,c,u)):this.left.lineAt(u,g,r,s,a).join(h)}forEachLine(e,n,r,s,a,c){let u=s+this.left.height,f=a+this.left.length+this.break;if(this.break)e<f&&this.left.forEachLine(e,n,r,s,a,c),n>=f&&this.right.forEachLine(e,n,r,u,f,c);else{let h=this.lineAt(f,Mt.ByPos,r,s,a);e<h.from&&this.left.forEachLine(e,h.from-1,r,s,a,c),h.to>=e&&h.from<=n&&c(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,u,f,c)}}replace(e,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let a=[];e>0&&this.decomposeLeft(e,a);let c=a.length;for(let u of r)a.push(u);if(e>0&&ax(a,c-1),n<this.length){let u=a.length;this.decomposeRight(n,a),ax(a,u)}return Dn.of(a)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<s&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Dn.of(this.break?[e,null,n]:[e,n]):(this.left=bc(this.left,e),this.right=bc(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:a,right:c}=this,u=n+a.length+this.break,f=null;return s&&s.from<=n+a.length&&s.more?f=a=a.updateHeight(e,n,r,s):a.updateHeight(e,n,r),s&&s.from<=u+c.length&&s.more?f=c=c.updateHeight(e,u,r,s):c.updateHeight(e,u,r),f?this.balanced(a,c):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function ax(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof dn&&(r=t[e+1])instanceof dn&&t.splice(e-1,3,new dn(n.length+1+r.length))}const QT=5;class fh{constructor(e,n){this.pos=e,this.oracle=n,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,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Qn?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Qn(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,a=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let c=n-e;r.block?this.addBlock(new lx(c,s,r)):(c||a||s>=QT)&&this.addLineDeco(s,a,c)}else n>e&&this.span(e,n);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:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,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 Qn(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new dn(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Qn)return e;let n=new Qn(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Qn)&&!this.isCovered?this.nodes.push(new Qn(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof Qn&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,n,r,s){let a=new fh(r,e);return mt.spans(n,r,s,a,0),a.finish(r)}}function WT(t,e,n){let r=new ZT;return mt.compare(t,e,n,r,0),r.changes}class ZT{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,s){(e<n||r&&r.heightRelevant||s&&s.heightRelevant)&&ol(e,n,this.changes,5)}}function ej(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,s=r.defaultView||window,a=Math.max(0,n.left),c=Math.min(s.innerWidth,n.right),u=Math.max(0,n.top),f=Math.min(s.innerHeight,n.bottom);for(let h=t.parentNode;h&&h!=r.body;)if(h.nodeType==1){let g=h,b=window.getComputedStyle(g);if((g.scrollHeight>g.clientHeight||g.scrollWidth>g.clientWidth)&&b.overflow!="visible"){let v=g.getBoundingClientRect();a=Math.max(a,v.left),c=Math.min(c,v.right),u=Math.max(u,v.top),f=Math.min(h==t.parentNode?s.innerHeight:f,v.bottom)}h=b.position=="absolute"||b.position=="fixed"?g.offsetParent:g.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:a-n.left,right:Math.max(a,c)-n.left,top:u-(n.top+e),bottom:Math.max(u,f)-(n.top+e)}}function tj(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function nj(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class hh{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let s=e[r],a=n[r];if(s.from!=a.from||s.to!=a.to||s.size!=a.size)return!1}return!0}draw(e,n){return rn.replace({widget:new ij(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class ij extends nc{constructor(e,n){super(),this.size=e,this.vertical=n}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 ox{constructor(e,n){this.view=e,this.state=n,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=cx,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Lt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(th).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new KT(r),this.stateDeco=ux(n),this.heightMap=Dn.empty().applyChanges(this.stateDeco,gt.empty,this.heightOracle.setDoc(n.doc),[new di(0,0,0,n.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=rn.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:a,to:c})=>s>=a&&s<=c)){let{from:a,to:c}=this.lineBlockAt(s);e.push(new xc(a,c))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?cx:new ph(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(Ma(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=ux(this.state);let s=e.changedRanges,a=di.extendWithRanges(s,WT(r,this.stateDeco,e?e.changes:en.empty(this.state.doc.length))),c=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);sx(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=c||ml)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=c);let f=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<f.from||n.range.head>f.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,n));let h=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(h||!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),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Ab)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,a=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Lt.RTL:Lt.LTR;let c=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",u=n.getBoundingClientRect(),f=c||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let h=0,g=0;if(u.width&&u.height){let{scaleX:_,scaleY:q}=nb(n,u);(_>.005&&Math.abs(this.scaleX-_)>.005||q>.005&&Math.abs(this.scaleY-q)>.005)&&(this.scaleX=_,this.scaleY=q,h|=16,c=f=!0)}let b=(parseInt(r.paddingTop)||0)*this.scaleY,v=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=b||this.paddingBottom!=v)&&(this.paddingTop=b,this.paddingBottom=v,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let w=ib(this.view.contentDOM,!1).y;w!=this.scrollParent&&(this.scrollParent=w,this.scrollAnchorHeight=-1,this.scrollOffset=0);let A=this.getScrollOffset();this.scrollOffset!=A&&(this.scrollAnchorHeight=-1,this.scrollOffset=A),this.scrolledToBottom=ob(this.scrollParent||e.win);let C=(this.printing?nj:ej)(n,this.paddingTop),j=C.top-this.pixelViewport.top,D=C.bottom-this.pixelViewport.bottom;this.pixelViewport=C;let M=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(M!=this.inView&&(this.inView=M,M&&(f=!0)),!this.inView&&!this.scrollTarget&&!tj(e.dom))return 0;let E=u.width;if((this.contentDOMWidth!=E||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),f){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(c=!0),c||s.lineWrapping&&Math.abs(E-this.contentDOMWidth)>s.charWidth){let{lineHeight:q,charWidth:O,textHeight:X}=e.docView.measureTextSize();c=q>0&&s.refresh(a,q,O,X,Math.max(5,E/O),_),c&&(e.docView.minWidth=0,h|=16)}j>0&&D>0?g=Math.max(j,D):j<0&&D<0&&(g=Math.min(j,D)),sx();for(let q of this.viewports){let O=q.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(q);this.heightMap=(c?Dn.empty().applyChanges(this.stateDeco,gt.empty,this.heightOracle,[new di(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,c,new GT(q.from,O))}ml&&(h|=2)}let R=!this.viewportIsAppropriate(this.viewport,g)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return R&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(g,this.scrollTarget),h|=this.updateForViewport()),(h&2||R)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(c?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,a=this.heightOracle,{visibleTop:c,visibleBottom:u}=this,f=new xc(s.lineAt(c-r*1e3,Mt.ByHeight,a,0,0).from,s.lineAt(u+(1-r)*1e3,Mt.ByHeight,a,0,0).to);if(n){let{head:h}=n.range;if(h<f.from||h>f.to){let g=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),b=s.lineAt(h,Mt.ByPos,a,0,0),v;n.y=="center"?v=(b.top+b.bottom)/2-g/2:n.y=="start"||n.y=="nearest"&&h<f.from?v=b.top:v=b.bottom-g,f=new xc(s.lineAt(v-500,Mt.ByHeight,a,0,0).from,s.lineAt(v+g+500,Mt.ByHeight,a,0,0).to)}}return f}mapViewport(e,n){let r=n.mapPos(e.from,-1),s=n.mapPos(e.to,1);return new xc(this.heightMap.lineAt(r,Mt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Mt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,Mt.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(n,Mt.ByPos,this.heightOracle,0,0),{visibleTop:c,visibleBottom:u}=this;return(e==0||s<=c-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||a>=u+Math.max(10,Math.min(r,250)))&&s>c-2e3&&a<u+2e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let s of e)n.touchesRange(s.from,s.to)||r.push(new hh(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,a=s>>1,c=s<<1;if(this.defaultTextDirection!=Lt.LTR&&!r)return[];let u=[],f=(g,b,v,w)=>{if(b-g<a)return;let A=this.state.selection.main,C=[A.from];A.empty||C.push(A.to);for(let D of C)if(D>g&&D<b){f(g,D-10,v,w),f(D+10,b,v,w);return}let j=sj(e,D=>D.from>=v.from&&D.to<=v.to&&Math.abs(D.from-g)<a&&Math.abs(D.to-b)<a&&!C.some(M=>D.from<M&&D.to>M));if(!j){if(b<v.to&&n&&r&&n.visibleRanges.some(E=>E.from<=b&&E.to>=b)){let E=n.moveToLineBoundary(Ae.cursor(b),!1,!0).head;E>g&&(b=E)}let D=this.gapSize(v,g,b,w),M=r||D<2e6?D:2e6;j=new hh(g,b,D,M)}u.push(j)},h=g=>{if(g.length<c||g.type!=un.Text)return;let b=rj(g.from,g.to,this.stateDeco);if(b.total<c)return;let v=this.scrollTarget?this.scrollTarget.range.head:null,w,A;if(r){let C=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,j,D;if(v!=null){let M=wc(b,v),E=((this.visibleBottom-this.visibleTop)/2+C)/g.height;j=M-E,D=M+E}else j=(this.visibleTop-g.top-C)/g.height,D=(this.visibleBottom-g.top+C)/g.height;w=vc(b,j),A=vc(b,D)}else{let C=b.total*this.heightOracle.charWidth,j=s*this.heightOracle.charWidth,D=0;if(C>2e6)for(let q of e)q.from>=g.from&&q.from<g.to&&q.size!=q.displaySize&&q.from*this.heightOracle.charWidth+D<this.pixelViewport.left&&(D=q.size-q.displaySize);let M=this.pixelViewport.left+D,E=this.pixelViewport.right+D,R,_;if(v!=null){let q=wc(b,v),O=((E-M)/2+j)/C;R=q-O,_=q+O}else R=(M-j)/C,_=(E+j)/C;w=vc(b,R),A=vc(b,_)}w>g.from&&f(g.from,w,g,b),A<g.to&&f(A,g.to,g,b)};for(let g of this.viewportLines)Array.isArray(g.type)?g.type.forEach(h):h(g);return u}gapSize(e,n,r,s){let a=wc(s,r)-wc(s,n);return this.heightOracle.lineWrapping?e.height*a:s.total*this.heightOracle.charWidth*a}updateLineGaps(e){hh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=rn.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];mt.spans(n,this.viewport.from,this.viewport.to,{span(a,c){r.push({from:a,to:c})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let a=0;a<r.length&&!(s&8);a++){let c=this.visibleRanges[a],u=r[a];(c.from!=u.from||c.to!=u.to)&&(s|=4,e&&e.mapPos(c.from,-1)==u.from&&e.mapPos(c.to,1)==u.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Ma(this.heightMap.lineAt(e,Mt.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(n=>n.top<=e&&n.bottom>=e)||Ma(this.heightMap.lineAt(this.scaler.fromDOM(e),Mt.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 n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Ma(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 xc{constructor(e,n){this.from=e,this.to=n}}function rj(t,e,n){let r=[],s=t,a=0;return mt.spans(n,t,e,{span(){},point(c,u){c>s&&(r.push({from:s,to:c}),a+=c-s),s=u}},20),s<e&&(r.push({from:s,to:e}),a+=e-s),{total:a,ranges:r}}function vc({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:a,to:c}=e[s],u=c-a;if(r<=u)return a+r;r-=u}}function wc(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function sj(t,e){for(let n of t)if(e(n))return n}const cx={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function ux(t){let e=t.facet(ac).filter(r=>typeof r!="function"),n=t.facet(nh).filter(r=>typeof r!="function");return n.length&&e.push(mt.join(n)),e}class ph{constructor(e,n,r){let s=0,a=0,c=0;this.viewports=r.map(({from:u,to:f})=>{let h=n.lineAt(u,Mt.ByPos,e,0,0).top,g=n.lineAt(f,Mt.ByPos,e,0,0).bottom;return s+=g-h,{from:u,to:f,top:h,bottom:g,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let u of this.viewports)u.domTop=c+(u.top-a)*this.scale,c=u.domBottom=u.domTop+(u.bottom-u.top),a=u.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let a=n<this.viewports.length?this.viewports[n]:null;if(!a||e<a.top)return s+(e-r)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);r=a.bottom,s=a.domBottom}}fromDOM(e){for(let n=0,r=0,s=0;;n++){let a=n<this.viewports.length?this.viewports[n]:null;if(!a||e<a.domTop)return r+(e-s)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);r=a.bottom,s=a.domBottom}}eq(e){return e instanceof ph?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Ma(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ri(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Ma(s,e)):t._content)}const Sc=Ue.define({combine:t=>t.join(" ")}),mh=Ue.define({combine:t=>t.indexOf(!0)>-1}),gh=al.newName(),dx=al.newName(),fx=al.newName(),hx={"&light":"."+dx,"&dark":"."+fx};function yh(t,e,n){return new al(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const lj=yh("."+gh,{"&":{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:"text-top",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"}},hx),aj={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},bh=Re.ie&&Re.ie_version<=11;class oj{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new BN,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(n=>{for(let r of n)this.queue.push(r);(Re.ie&&Re.ie_version<=11||Re.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Re.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Re.chrome&&Re.chrome_version<126)&&(this.editContext=new uj(e),e.state.facet(sr)&&(e.contentDOM.editContext=this.editContext.editContext)),bh&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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 n;((n=this.view.docView)===null||n===void 0?void 0:n.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(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.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(n=>{n.length>0&&n[n.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(!1),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((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(sr)?r.root.activeElement!=this.dom:!Ca(this.dom,s))return;let a=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Re.ie&&Re.ie_version<=11||Re.android&&Re.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Na(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=ka(e.root);if(!n)return!1;let r=Re.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&cj(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Ca(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&IN(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.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,aj),bh&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),bh&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let s=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&cl(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.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()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),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=[]);let n=-1,r=-1,s=!1;for(let a of e){let c=this.readMutation(a);c&&(c.typeOver&&(s=!0),n==-1?{from:n,to:r}=c:(n=Math.min(c.from,n),r=Math.max(c.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Ca(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new NT(this.view,e,n,r);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=zb(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!hc(this.view.state.selection,n.newSel.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=px(n,e.previousSibling||e.target.previousSibling,-1),s=px(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.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(sr)!=e.state.facet(sr)&&(e.view.contentDOM.editContext=e.state.facet(sr)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.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 px(t,e,n){for(;e;){let r=Bt.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function mx(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,a=e.endOffset,c=t.docView.domAtPos(t.state.selection.main.anchor,1);return Na(c.node,c.offset,s,a)&&([n,r,s,a]=[s,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:a}}function cj(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return mx(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?mx(t,n):null}class uj{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=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=r=>{let s=e.state.selection.main,{anchor:a,head:c}=s,u=this.toEditorPos(r.updateRangeStart),f=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:u,drifted:!1});let h=f-u>r.text.length;u==this.from&&a<this.from?u=a:f==this.to&&a>this.to&&(f=a);let g=Ub(e.state.sliceDoc(u,f),r.text,(h?s.from:s.to)-u,h?"end":null);if(!g){let v=Ae.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));hc(v,s)||e.dispatch({selection:v,userEvent:"select"});return}let b={from:g.from+u,to:g.toA+u,insert:gt.of(r.text.slice(g.from,g.toB).split(`
|
|
58
|
-
`))};if((Re.mac||Re.android)&&b.from==c-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(b={from:u,to:f,insert:gt.of([r.text.replace("."," ")])}),this.pendingContextChange=b,!e.state.readOnly){let v=this.to-this.from+(b.to-b.from+b.insert.length);uh(e,b,Ae.single(this.toEditorPos(r.selectionStart,v),this.toEditorPos(r.selectionEnd,v)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),b.from<b.to&&!b.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],a=null;for(let c=this.toEditorPos(r.rangeStart),u=this.toEditorPos(r.rangeEnd);c<u;c++){let f=e.coordsForChar(c);a=f&&new DOMRect(f.left,f.top,f.right-f.left,f.bottom-f.top)||a||new DOMRect,s.push(a)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let a of r.getTextFormats()){let c=a.underlineStyle,u=a.underlineThickness;if(!/none/i.test(c)&&!/none/i.test(u)){let f=this.toEditorPos(a.rangeStart),h=this.toEditorPos(a.rangeEnd);if(f<h){let g=`text-decoration: underline ${/^[a-z]/.test(c)?c+" ":c=="Dashed"?"dashed ":c=="Squiggle"?"wavy ":""}${/thin/i.test(u)?1:2}px`;s.push(rn.mark({attributes:{style:g}}).range(f,h))}}}e.dispatch({effects:Cb.of(rn.set(s))})},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:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let s=ka(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((a,c,u,f,h)=>{if(r)return;let g=h.length-(c-a);if(s&&c>=s.to)if(s.from==a&&s.to==c&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=g,this.to+=g;return}else s=null,this.revertPending(e.state);if(a+=n,c+=n,c<=this.from)this.from+=g,this.to+=g;else if(a<this.to){if(a<this.from||c>this.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(c),h.toString()),this.to+=g}n+=g}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+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 n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>3e4)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Je{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 n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],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:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(a=>r(a,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||$N(e.parent)||document,this.viewState=new ox(this,e.state||wt.create(e)),e.scrollTo&&e.scrollTo.is(lc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(dl).map(s=>new eh(s));for(let s of this.plugins)s.update(this);this.observer=new oj(this),this.inputState=new OT(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Lb(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof tn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,a=this.state;for(let v of e){if(v.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=v.state}if(this.destroyed){this.viewState.state=a;return}let c=this.hasFocus,u=0,f=null;e.some(v=>v.annotation(ex))?(this.inputState.notifiedFocused=c,u=1):c!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=c,f=tx(a,c),f||(u=1));let h=this.observer.delayedAndroidKey,g=null;if(h?(this.observer.clearDelayedAndroidKey(),g=this.observer.readChange(),(g&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(g=null)):this.observer.clear(),a.facet(wt.phrases)!=this.state.facet(wt.phrases))return this.setState(a);s=oc.create(this,a,e),s.flags|=u;let b=this.viewState.scrollTarget;try{this.updateState=2;for(let v of e){if(b&&(b=b.map(v.changes)),v.scrollIntoView){let{main:w}=v.state.selection,{x:A,y:C}=this.state.facet(Je.cursorScrollMargin);b=new ul(w.empty?w:Ae.cursor(w.head,w.head>w.anchor?-1:1),"nearest","nearest",C,A)}for(let w of v.effects)w.is(lc)&&(b=w.value.clip(this.state))}this.viewState.update(s,b),this.bidiCache=Ac.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Ea)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(v=>v.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Sc)!=s.state.facet(Sc)&&(this.viewState.mustMeasureContent=!0),(n||r||b||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let v of this.state.facet(Qf))try{v(s)}catch(w){Pi(this.state,w,"update listener")}(f||g)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),g&&!zb(this,g)&&h.force&&cl(this.contentDOM,h.key,h.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 n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new ox(this,e),this.plugins=e.facet(dl).map(r=>new eh(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Lb(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(dl),r=e.state.facet(dl);if(n!=r){let s=[];for(let a of r){let c=n.indexOf(a);if(c<0)s.push(new eh(a));else{let u=this.plugins[c];u.mustUpdate=e,s.push(u)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){Pi(this.state,r,"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 n=null,r=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:a,scrollAnchorHeight:c,scaleY:u}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(c=-1),this.viewState.scrollAnchorHeight=-1;try{for(let f=0;;f++){if(c<0){if(ob(r||this.win))a=-1,c=this.viewState.heightMap.height/this.viewState.scaleY;else{let A=this.viewState.scrollAnchorAt(s);a=A.from,c=A.top}u=this.viewState.scaleY}this.updateState=1;let h=this.viewState.measure();if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(f>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let g=[];h&4||([this.measureRequests,g]=[g,this.measureRequests]);let b=g.map(A=>{try{return A.read(this)}catch(C){return Pi(this.state,C),gx}}),v=oc.create(this,this.state,[]),w=!1;v.flags|=h,n?n.flags|=h:n=v,this.updateState=2,v.empty||(this.updatePlugins(v),this.inputState.update(v),this.updateAttrs(),w=this.docView.update(v),w&&this.docViewUpdate());for(let A=0;A<g.length;A++)if(b[A]!=gx)try{let C=g[A];C.write&&C.write(b[A],this)}catch(C){Pi(this.state,C)}if(w&&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,c=-1;continue}else{let C=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)/this.viewState.scaleY-c/u;if((C>1||C<-1)&&!(Re.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+C,r?a<0?r.scrollTop=r.scrollHeight:r.scrollTop+=C:this.win.scrollBy(0,C),c=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let f of this.state.facet(Qf))f(n)}get themeClasses(){return gh+" "+(this.state.facet(mh)?fx:dx)+" "+this.state.facet(Sc)}updateAttrs(){let e=yx(this,Nb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(sr)?"true":"false",class:"cm-content",style:`${Re.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),yx(this,th,n);let r=this.observer.ignore(()=>{let s=Zy(this.contentDOM,this.contentAttrs,n),a=Zy(this.dom,this.editorAttrs,e);return s||a});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(Je.announce)){n&&(this.announceDOM.textContent=""),n=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ea);let e=this.state.facet(Je.cspNonce);al.mount(this.root,this.styleModules.concat(lj).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 n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.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,n,r){return oh(this,e,Bb(this,e,n,r))}moveByGroup(e,n){return oh(this,e,Bb(this,e,n,r=>vT(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),a=r[n?r.length-1:0];return Ae.cursor(a.side(n,s)+e.from,a.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return xT(this,e,n,r)}moveVertically(e,n,r){return oh(this,e,wT(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=ch(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),ch(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.state.doc.lineAt(e),s=this.bidiSpans(r),a=s[Fi.find(s,e-r.from,-1,n)];return this.docView.coordsAt(e,n,a.dir==Lt.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(Sb)||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>dj)return pb(e.length);let n=this.textDirectionAt(e.from),r;for(let a of this.bidiCache)if(a.from==e.from&&a.dir==n&&(a.fresh||hb(a.isolates,r=Eb(this,e))))return a.order;r||(r=Eb(this,e));let s=YN(e.text,n,r);return this.bidiCache.push(new Ac(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Re.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{lb(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.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){var r,s,a,c;return lc.of(new ul(typeof e=="number"?Ae.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(s=n.x)!==null&&s!==void 0?s:"nearest",(a=n.yMargin)!==null&&a!==void 0?a:5,(c=n.xMargin)!==null&&c!==void 0?c:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return lc.of(new ul(Ae.cursor(r.from),"start","start",r.top-e,n,!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 lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=al.newName(),s=[Sc.of(r),Ea.of(yh(`.${r}`,e))];return n&&n.dark&&s.push(mh.of(!0)),s}static baseTheme(e){return Go.lowest(Ea.of(yh("."+gh,e,hx)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&Bt.get(r)||Bt.get(e);return((n=s?.root)===null||n===void 0?void 0:n.view)||null}}Je.styleModule=Ea,Je.inputHandler=vb,Je.clipboardInputFilter=Wf,Je.clipboardOutputFilter=Zf,Je.scrollHandler=kb,Je.focusChangeEffect=wb,Je.perLineTextDirection=Sb,Je.exceptionSink=xb,Je.updateListener=Qf,Je.editable=sr,Je.mouseSelectionStyle=bb,Je.dragMovesSelection=yb,Je.clickAddsSelectionRange=gb,Je.decorations=ac,Je.blockWrappers=Tb,Je.outerDecorations=nh,Je.atomicRanges=ja,Je.bidiIsolatedRanges=jb,Je.cursorScrollMargin=Ue.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}}),Je.scrollMargins=Ob,Je.darkTheme=mh,Je.cspNonce=Ue.define({combine:t=>t.length?t[0]:""}),Je.contentAttributes=th,Je.editorAttributes=Nb,Je.lineWrapping=Je.contentAttributes.of({class:"cm-lineWrapping"}),Je.announce=zt.define();const dj=4096,gx={};class Ac{constructor(e,n,r,s,a,c){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=a,this.order=c}static update(e,n){if(n.empty&&!e.some(a=>a.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Lt.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let c=e[a];c.dir==s&&!n.touchesRange(c.from,c.to)&&r.push(new Ac(n.mapPos(c.from,1),n.mapPos(c.to,-1),c.dir,c.isolates,!1,c.order))}return r}}function yx(t,e,n){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let a=r[s],c=typeof a=="function"?a(t):a;c&&Ff(c,n)}return n}const fj=Re.mac?"mac":Re.windows?"win":Re.linux?"linux":"key";function hj(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,a,c,u;for(let f=0;f<n.length-1;++f){const h=n[f];if(/^(cmd|meta|m)$/i.test(h))u=!0;else if(/^a(lt)?$/i.test(h))s=!0;else if(/^(c|ctrl|control)$/i.test(h))a=!0;else if(/^s(hift)?$/i.test(h))c=!0;else if(/^mod$/i.test(h))e=="mac"?u=!0:a=!0;else throw new Error("Unrecognized modifier name: "+h)}return s&&(r="Alt-"+r),a&&(r="Ctrl-"+r),u&&(r="Meta-"+r),c&&(r="Shift-"+r),r}function kc(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const pj=Go.default(Je.domEventHandlers({keydown(t,e){return bj(mj(e.state),t,e,"editor")}})),bx=Ue.define({enables:pj}),xx=new WeakMap;function mj(t){let e=t.facet(bx),n=xx.get(e);return n||xx.set(e,n=yj(e.reduce((r,s)=>r.concat(s),[]))),n}let Ur=null;const gj=4e3;function yj(t,e=fj){let n=Object.create(null),r=Object.create(null),s=(c,u)=>{let f=r[c];if(f==null)r[c]=u;else if(f!=u)throw new Error("Key binding "+c+" is used both as a regular binding and as a multi-stroke prefix")},a=(c,u,f,h,g)=>{var b,v;let w=n[c]||(n[c]=Object.create(null)),A=u.split(/ (?!$)/).map(D=>hj(D,e));for(let D=1;D<A.length;D++){let M=A.slice(0,D).join(" ");s(M,!0),w[M]||(w[M]={preventDefault:!0,stopPropagation:!1,run:[E=>{let R=Ur={view:E,prefix:M,scope:c};return setTimeout(()=>{Ur==R&&(Ur=null)},gj),!0}]})}let C=A.join(" ");s(C,!1);let j=w[C]||(w[C]={preventDefault:!1,stopPropagation:!1,run:((v=(b=w._any)===null||b===void 0?void 0:b.run)===null||v===void 0?void 0:v.slice())||[]});f&&j.run.push(f),h&&(j.preventDefault=!0),g&&(j.stopPropagation=!0)};for(let c of t){let u=c.scope?c.scope.split(" "):["editor"];if(c.any)for(let h of u){let g=n[h]||(n[h]=Object.create(null));g._any||(g._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:b}=c;for(let v in g)g[v].run.push(w=>b(w,xh))}let f=c[e]||c.key;if(f)for(let h of u)a(h,f,c.run,c.preventDefault,c.stopPropagation),c.shift&&a(h,"Shift-"+f,c.shift,c.preventDefault,c.stopPropagation)}return n}let xh=null;function bj(t,e,n,r){xh=e;let s=MN(e),a=hN(s,0),c=pN(a)==s.length&&s!=" ",u="",f=!1,h=!1,g=!1;Ur&&Ur.view==n&&Ur.scope==r&&(u=Ur.prefix+" ",Pb.indexOf(e.keyCode)<0&&(h=!0,Ur=null));let b=new Set,v=j=>{if(j){for(let D of j.run)if(!b.has(D)&&(b.add(D),D(n)))return j.stopPropagation&&(g=!0),!0;j.preventDefault&&(j.stopPropagation&&(g=!0),h=!0)}return!1},w=t[r],A,C;return w&&(v(w[u+kc(s,e,!c)])?f=!0:c&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Re.windows&&e.ctrlKey&&e.altKey)&&!(Re.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(A=Hr[e.keyCode])&&A!=s?(v(w[u+kc(A,e,!0)])||e.shiftKey&&(C=va[e.keyCode])!=s&&C!=A&&v(w[u+kc(C,e,!1)]))&&(f=!0):c&&e.shiftKey&&v(w[u+kc(s,e,!0)])&&(f=!0),!f&&v(w._any)&&(f=!0)),h&&(f=!0),f&&g&&e.stopPropagation(),xh=null,f}class _s{constructor(e,n,r,s,a){this.className=e,this.left=n,this.top=r,this.width=s,this.height=a}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let a=vx(e);return[new _s(n,s.left-a.left,s.top-a.top,null,s.bottom-s.top)]}else return xj(e,n,r)}}function vx(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Lt.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function wx(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let a=t.dom.getBoundingClientRect(),c=(s.top+s.bottom)/2,u=t.posAtCoords({x:a.left+1,y:c}),f=t.posAtCoords({x:a.right-1,y:c});return u==null||f==null?r:{from:Math.max(r.from,Math.min(u,f)),to:Math.min(r.to,Math.max(u,f))}}function xj(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),a=t.textDirection==Lt.LTR,c=t.contentDOM,u=c.getBoundingClientRect(),f=vx(t),h=c.querySelector(".cm-line"),g=h&&window.getComputedStyle(h),b=u.left+(g?parseInt(g.paddingLeft)+Math.min(0,parseInt(g.textIndent)):0),v=u.right-(g?parseInt(g.paddingRight):0),w=ah(t,r,1),A=ah(t,s,-1),C=w.type==un.Text?w:null,j=A.type==un.Text?A:null;if(C&&(t.lineWrapping||w.widgetLineBreaks)&&(C=wx(t,r,1,C)),j&&(t.lineWrapping||A.widgetLineBreaks)&&(j=wx(t,s,-1,j)),C&&j&&C.from==j.from&&C.to==j.to)return M(E(n.from,n.to,C));{let _=C?E(n.from,null,C):R(w,!1),q=j?E(null,n.to,j):R(A,!0),O=[];return(C||w).to<(j||A).from-(C&&j?1:0)||w.widgetLineBreaks>1&&_.bottom+t.defaultLineHeight/2<q.top?O.push(D(b,_.bottom,v,q.top)):_.bottom<q.top&&t.elementAtHeight((_.bottom+q.top)/2).type==un.Text&&(_.bottom=q.top=(_.bottom+q.top)/2),M(_).concat(O).concat(M(q))}function D(_,q,O,X){return new _s(e,_-f.left,q-f.top,Math.max(0,O-_),X-q)}function M({top:_,bottom:q,horizontal:O}){let X=[];for(let U=0;U<O.length;U+=2)X.push(D(O[U],_,O[U+1],q));return X}function E(_,q,O){let X=1e9,U=-1e9,B=[];function K(pe,fe,L,Q,oe){let ce=t.coordsAtPos(pe,pe==O.to?-2:2),ve=t.coordsAtPos(L,L==O.from?2:-2);!ce||!ve||(X=Math.min(ce.top,ve.top,X),U=Math.max(ce.bottom,ve.bottom,U),oe==Lt.LTR?B.push(a&&fe?b:ce.left,a&&Q?v:ve.right):B.push(!a&&Q?b:ve.left,!a&&fe?v:ce.right))}let W=_??O.from,ye=q??O.to;for(let pe of t.visibleRanges)if(pe.to>W&&pe.from<ye)for(let fe=Math.max(pe.from,W),L=Math.min(pe.to,ye);;){let Q=t.state.doc.lineAt(fe);for(let oe of t.bidiSpans(Q)){let ce=oe.from+Q.from,ve=oe.to+Q.from;if(ce>=L)break;ve>fe&&K(Math.max(ce,fe),_==null&&ce<=W,Math.min(ve,L),q==null&&ve>=ye,oe.dir)}if(fe=Q.to+1,fe>=L)break}return B.length==0&&K(W,_==null,ye,q==null,t.textDirection),{top:X,bottom:U,horizontal:B}}function R(_,q){let O=u.top+(q?_.top:_.bottom);return{top:O,bottom:O,horizontal:[]}}}function vj(t,e){return t.constructor==e.constructor&&t.eq(e)}class wj{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Cc)!=e.state.facet(Cc)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Cc);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!vj(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Re.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Cc=Ue.define();function Sx(t){return[lr.define(e=>new wj(e,t)),Cc.of(t)]}const gl=Ue.define({combine(t){return Ef(t,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Sj(t={}){return[gl.of(t),Aj,kj,Nj,Ab.of(!0)]}function Ax(t){return t.startState.facet(gl)!=t.state.facet(gl)}const Aj=Sx({above:!0,markers(t){let{state:e}=t,n=e.facet(gl),r=[];for(let s of e.selection.ranges){let a=s==e.selection.main;if(s.empty||n.drawRangeCursor&&!(a&&Re.ios&&n.iosSelectionHandles)){let c=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=s.empty?s:Ae.cursor(s.head,s.assoc);for(let f of _s.forRange(t,c,u))r.push(f)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=Ax(t);return n&&kx(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){kx(e.state,t)},class:"cm-cursorLayer"});function kx(t,e){e.style.animationDuration=t.facet(gl).cursorBlinkRate+"ms"}const kj=Sx({above:!1,markers(t){let e=[],{main:n,ranges:r}=t.state.selection;for(let s of r)if(!s.empty)for(let a of _s.forRange(t,"cm-selectionBackground",s))e.push(a);if(Re.ios&&!n.empty&&t.state.facet(gl).iosSelectionHandles){for(let s of _s.forRange(t,"cm-selectionHandle cm-selectionHandle-start",Ae.cursor(n.from,1)))e.push(s);for(let s of _s.forRange(t,"cm-selectionHandle cm-selectionHandle-end",Ae.cursor(n.to,1)))e.push(s)}return e},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||Ax(t)},class:"cm-selectionLayer"}),Cj=Re.gecko&&Re.gecko_version==153?"#ffffff01":"transparent",Nj=Go.highest(Je.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${Cj} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function Cx(){return jj}const Tj=rn.line({class:"cm-activeLine"}),jj=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(Tj.range(s.from)),e=s.from)}return rn.set(n)}},{decorations:t=>t.decorations});class Vr extends js{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Vr.prototype.elementClass="",Vr.prototype.toDOM=void 0,Vr.prototype.mapMode=Jn.TrackBefore,Vr.prototype.startSide=Vr.prototype.endSide=-1,Vr.prototype.point=!0;const Nc=Ue.define(),Ej=Ue.define(),Tc=Ue.define(),Nx=Ue.define({combine:t=>t.some(e=>e)});function Oj(t){return[Mj]}const Mj=lr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.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=t.state.facet(Tc).map(e=>new jx(t,e)),this.fixed=!t.state.facet(Nx);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),t.scrollDOM.insertBefore(this.dom,t.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(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.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(Nx)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=mt.iter(this.view.state.facet(Nc),this.view.viewport.from),r=[],s=this.gutters.map(a=>new Rj(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(a.type)){let c=!0;for(let u of a.type)if(u.type==un.Text&&c){vh(n,r,u.from);for(let f of s)f.line(this.view,u,r);c=!1}else if(u.widget)for(let f of s)f.widget(this.view,u)}else if(a.type==un.Text){vh(n,r,a.from);for(let c of s)c.line(this.view,a,r)}else if(a.widget)for(let c of s)c.widget(this.view,a);for(let a of s)a.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Tc),n=t.state.facet(Tc),r=t.docChanged||t.heightChanged||t.viewportChanged||!mt.eq(t.startState.facet(Nc),t.state.facet(Nc),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let a of n){let c=e.indexOf(a);c<0?s.push(new jx(this.view,a)):(this.gutters[c].update(t),s.push(this.gutters[c]))}for(let a of this.gutters)a.dom.remove(),s.indexOf(a)<0&&a.destroy();for(let a of s)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Je.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Lt.LTR?{left:r,right:s}:{right:r,left:s}})});function Tx(t){return Array.isArray(t)?t:[t]}function vh(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Rj{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=mt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,a=(n.top-this.height)/e.scaleY,c=n.height/e.scaleY;if(this.i==s.elements.length){let u=new Ex(e,c,a,r);s.elements.push(u),s.dom.appendChild(u.dom)}else s.elements[this.i].update(e,c,a,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];vh(this.cursor,s,n.from),r.length&&(s=s.concat(r));let a=this.gutter.config.lineMarker(e,n,s);a&&s.unshift(a);let c=this.gutter;s.length==0&&!c.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let a of e.state.facet(Ej)){let c=a(e,n.widget,n);c&&(s||(s=[])).push(c)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class jx{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let a=s.target,c;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let f=a.getBoundingClientRect();c=(f.top+f.bottom)/2}else c=s.clientY;let u=e.lineBlockAtHeight(c-e.documentTop);n.domEventHandlers[r](e,u,s)&&s.preventDefault()});this.markers=Tx(n.markers(e)),n.initialSpacer&&(this.spacer=new Ex(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Tx(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!mt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Ex{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Dj(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let a=0,c=0;;){let u=c,f=a<n.length?n[a++]:null,h=!1;if(f){let g=f.elementClass;g&&(r+=" "+g);for(let b=c;b<this.markers.length;b++)if(this.markers[b].compare(f)){u=b,h=!0;break}}else u=this.markers.length;for(;c<u;){let g=this.markers[c++];if(g.toDOM){g.destroy(s);let b=s.nextSibling;s.remove(),s=b}}if(!f)break;f.toDOM&&(h?s=s.nextSibling:this.dom.insertBefore(f.toDOM(e),s)),h&&c++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function Dj(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const _j=Ue.define(),Lj=Ue.define(),yl=Ue.define({combine(t){return Ef(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let s in n){let a=r[s],c=n[s];r[s]=a?(u,f,h)=>a(u,f,h)||c(u,f,h):c}return r}})}});class wh extends Vr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Sh(t,e){return t.state.facet(yl).formatNumber(e,t.state)}const qj=Tc.compute([yl],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(_j)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new wh(Sh(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(Lj)){let a=s(e,n,r);if(a)return a}return null},lineMarkerChange:e=>e.startState.facet(yl)!=e.state.facet(yl),initialSpacer(e){return new wh(Sh(e,Mx(e.state.doc.lines)))},updateSpacer(e,n){let r=Sh(n.view,Mx(n.view.state.doc.lines));return r==e.number?e:new wh(r)},domEventHandlers:t.facet(yl).domEventHandlers,side:"before"}));function Ox(t={}){return[yl.of(t),Oj(),qj]}function Mx(t){let e=9;for(;e<t;)e=e*10+9;return e}const Bj=new class extends Vr{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},$j=Nc.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(Bj.range(s)))}return mt.of(e)});function Rx(){return $j}const Ij=1024;let Hj=0;class Ah{constructor(e,n){this.from=e,this.to=n}}class yt{constructor(e={}){this.id=Hj++,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=fi.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}yt.closedBy=new yt({deserialize:t=>t.split(" ")}),yt.openedBy=new yt({deserialize:t=>t.split(" ")}),yt.group=new yt({deserialize:t=>t.split(" ")}),yt.isolate=new yt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),yt.contextHash=new yt({perNode:!0}),yt.lookAhead=new yt({perNode:!0}),yt.mounted=new yt({perNode:!0});class Ra{constructor(e,n,r,s=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[yt.mounted.id]}}const zj=Object.create(null);class fi{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):zj,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new fi(e.name||"",n,e.id,r);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(s)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[a[0].id]=a[1]}}return s}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 n=this.prop(yt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(yt.group),a=-1;a<(s?s.length:0);a++){let c=n[a<0?r.name:s[a]];if(c)return c}}}}fi.none=new fi("",Object.create(null),0,8);const jc=new WeakMap,Dx=new WeakMap;var Ut;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(Ut||(Ut={}));class fn{constructor(e,n,r,s,a){if(this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,a&&a.length){this.props=Object.create(null);for(let[c,u]of a)this.props[typeof c=="number"?c:c.id]=u}}toString(){let e=Ra.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Nh(this.topNode,e)}cursorAt(e,n=0,r=0){let s=jc.get(this)||this.topNode,a=new Nh(s);return a.moveTo(e,n),jc.set(this,a._tree),a}get topNode(){return new hi(this,0,0,null)}resolve(e,n=0){let r=Da(jc.get(this)||this.topNode,e,n,!1);return jc.set(this,r),r}resolveInner(e,n=0){let r=Da(Dx.get(this)||this.topNode,e,n,!0);return Dx.set(this,r),r}resolveStack(e,n=0){return Fj(this,e,n)}iterate(e){let{enter:n,leave:r,from:s=0,to:a=this.length}=e,c=e.mode||0,u=(c&Ut.IncludeAnonymous)>0;for(let f=this.cursor(c|Ut.IncludeAnonymous);;){let h=!1;if(f.from<=a&&f.to>=s&&(!u&&f.type.isAnonymous||n(f)!==!1)){if(f.firstChild())continue;h=!0}for(;h&&r&&(u||!f.type.isAnonymous)&&r(f),!f.nextSibling();){if(!f.parent())return;h=!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 n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:jh(fi.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new fn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new fn(fi.none,n,r,s)))}static build(e){return Pj(e)}}fn.empty=new fn(fi.none,[],[],0);class kh{constructor(e,n){this.buffer=e,this.index=n}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 kh(this.buffer,this.index)}}class Fr{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return fi.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],s=this.set.types[n],a=s.name;if(/\W/.test(a)&&!s.isError&&(a=JSON.stringify(a)),e+=4,r==e)return a;let c=[];for(;e<r;)c.push(this.childString(e)),e=this.buffer[e+3];return a+"("+c.join(",")+")"}findChild(e,n,r,s,a){let{buffer:c}=this,u=-1;for(let f=e;f!=n&&!(_x(a,s,c[f+1],c[f+2])&&(u=f,r>0));f=c[f+3]);return u}slice(e,n,r){let s=this.buffer,a=new Uint16Array(n-e),c=0;for(let u=e,f=0;u<n;){a[f++]=s[u++],a[f++]=s[u++]-r;let h=a[f++]=s[u++]-r;a[f++]=s[u++]-e,c=Math.max(c,h)}return new Fr(a,c,this.set)}}function _x(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Da(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let c=!r&&t instanceof hi&&t.index<0?null:t.parent;if(!c)return t;t=c}let a=r?0:Ut.IgnoreOverlays;if(r)for(let c=t,u=c.parent;u;c=u,u=c.parent)c instanceof hi&&c.index<0&&((s=u.enter(e,n,a))===null||s===void 0?void 0:s.from)!=c.from&&(t=u);for(;;){let c=t.enter(e,n,a);if(!c)return t;t=c}}class Lx{cursor(e=0){return new Nh(this,e)}getChild(e,n=null,r=null){let s=qx(this,e,n,r);return s.length?s[0]:null}getChildren(e,n=null,r=null){return qx(this,e,n,r)}resolve(e,n=0){return Da(this,e,n,!1)}resolveInner(e,n=0){return Da(this,e,n,!0)}matchContext(e){return Ch(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class hi extends Lx{constructor(e,n,r,s){super(),this._tree=e,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,s,a=0){for(let c=this;;){for(let{children:u,positions:f}=c._tree,h=n>0?u.length:-1;e!=h;e+=n){let g=u[e],b=f[e]+c.from,v;if(!(!(a&Ut.EnterBracketed&&g instanceof fn&&(v=Ra.get(g))&&!v.overlay&&v.bracketed&&r>=b&&r<=b+g.length)&&!_x(s,r,b,b+g.length))){if(g instanceof Fr){if(a&Ut.ExcludeBuffers)continue;let w=g.findChild(0,g.buffer.length,n,r-b,s);if(w>-1)return new Pr(new Uj(c,g,e,b),null,w)}else if(a&Ut.IncludeAnonymous||!g.type.isAnonymous||Th(g)){let w;if(!(a&Ut.IgnoreMounts)&&(w=Ra.get(g))&&!w.overlay)return new hi(w.tree,b,e,c);let A=new hi(g,b,e,c);return a&Ut.IncludeAnonymous||!A.type.isAnonymous?A:A.nextChild(n<0?g.children.length-1:0,n,r,s,a)}}}if(a&Ut.IncludeAnonymous||!c.type.isAnonymous||(c.index>=0?e=c.index+n:e=n<0?-1:c._parent._tree.children.length,c=c._parent,!c))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,n,r=0){let s;if(!(r&Ut.IgnoreOverlays)&&(s=Ra.get(this._tree))&&s.overlay){let a=e-this.from,c=r&Ut.EnterBracketed&&s.bracketed;for(let{from:u,to:f}of s.overlay)if((n>0||c?u<=a:u<a)&&(n<0||c?f>=a:f>a))return new hi(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}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 qx(t,e,n,r){let s=t.cursor(),a=[];if(!s.firstChild())return a;if(n!=null){for(let c=!1;!c;)if(c=s.type.is(n),!s.nextSibling())return a}for(;;){if(r!=null&&s.type.is(r))return a;if(s.type.is(e)&&a.push(s.node),!s.nextSibling())return r==null?a:[]}}function Ch(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class Uj{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Pr extends Lx{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,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return a<0?null:new Pr(this.context,this,a)}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,n,r=0){if(r&Ut.ExcludeBuffers)return null;let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return a<0?null:new Pr(this.context,this,a)}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,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Pr(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Pr(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,a=r.buffer[this.index+3];if(a>s){let c=r.buffer[this.index+1];e.push(r.slice(s,a,c)),n.push(0)}return new fn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Bx(t){if(!t.length)return null;let e=0,n=t[0];for(let a=1;a<t.length;a++){let c=t[a];(c.from>n.from||c.to<n.to)&&(n=c,e=a)}let r=n instanceof hi&&n.index<0?null:n.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new Vj(s,n)}class Vj{constructor(e,n){this.heads=e,this.node=n}get next(){return Bx(this.heads)}}function Fj(t,e,n){let r=t.resolveInner(e,n),s=null;for(let a=r instanceof hi?r:r.context.parent;a;a=a.parent)if(a.index<0){let c=a.parent;(s||(s=[r])).push(c.resolve(e,n)),a=c}else{let c=Ra.get(a.tree);if(c&&c.overlay&&c.overlay[0].from<=e&&c.overlay[c.overlay.length-1].to>=e){let u=new hi(c.tree,c.overlay[0].from+a.from,-1,a);(s||(s=[r])).push(Da(u,e,n,!1))}}return s?Bx(s):r}class Nh{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Ut.EnterBracketed,e instanceof hi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.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,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof hi?(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,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,a=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}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,n,r=this.mode){return this.buffer?r&Ut.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ut.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ut.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:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<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 n,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(s.buffer.buffer[a+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let a=n+e,c=e<0?-1:r._tree.children.length;a!=c;a+=e){let u=r._tree.children[a];if(this.mode&Ut.IncludeAnonymous||u instanceof Fr||!u.type.isAnonymous||Th(u))return!1}return!0}move(e,n){if(n&&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,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,a=this.stack.length;a>=0;){for(let c=e;c;c=c._parent)if(c.index==s){if(s==this.index)return c;n=c,r=a+1;break e}s=this.stack[--a]}for(let s=r;s<this.stack.length;s++)n=new Pr(this.buffer,n,this.stack[s]);return this.bufferNode=new Pr(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return Ch(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=e.length-1,a=this.stack.length-1;s>=0;a--){if(a<0)return Ch(this._tree,e,s);let c=r[n.buffer[this.stack[a]]];if(!c.isAnonymous){if(e[s]&&e[s]!=c.name)return!1;s--}}return!0}}function Th(t){return t.children.some(e=>e instanceof Fr||!e.type.isAnonymous||Th(e))}function Pj(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=Ij,reused:a=[],minRepeatType:c=r.types.length}=t,u=Array.isArray(n)?new kh(n,n.length):n,f=r.types,h=0,g=0;function b(_,q,O,X,U,B){let{id:K,start:W,end:ye,size:pe}=u,fe=g,L=h;if(pe<0)if(u.next(),pe==-1){let T=a[K];O.push(T),X.push(W-_);return}else if(pe==-3){h=K;return}else if(pe==-4){g=K;return}else throw new RangeError(`Unrecognized record size: ${pe}`);let Q=f[K],oe,ce,ve=W-_;if(ye-W<=s&&(ce=j(u.pos-q,U))){let T=new Uint16Array(ce.size-ce.skip),z=u.pos-ce.size,he=T.length;for(;u.pos>z;)he=D(ce.start,T,he);oe=new Fr(T,ye-ce.start,r),ve=ce.start-_}else{let T=u.pos-pe;u.next();let z=[],he=[],ne=K>=c?K:-1,ke=0,qe=ye;for(;u.pos>T;)ne>=0&&u.id==ne&&u.size>=0?(u.end<=qe-s&&(A(z,he,W,ke,u.end,qe,ne,fe,L),ke=z.length,qe=u.end),u.next()):B>2500?v(W,T,z,he):b(W,T,z,he,ne,B+1);if(ne>=0&&ke>0&&ke<z.length&&A(z,he,W,ke,W,qe,ne,fe,L),z.reverse(),he.reverse(),ne>-1&&ke>0){let $e=w(Q,L);oe=jh(Q,z,he,0,z.length,0,ye-W,$e,$e)}else oe=C(Q,z,he,ye-W,fe-ye,L)}O.push(oe),X.push(ve)}function v(_,q,O,X){let U=[],B=0,K=-1;for(;u.pos>q;){let{id:W,start:ye,end:pe,size:fe}=u;if(fe>4)u.next();else{if(K>-1&&ye<K)break;K<0&&(K=pe-s),U.push(W,ye,pe),B++,u.next()}}if(B){let W=new Uint16Array(B*4),ye=U[U.length-2];for(let pe=U.length-3,fe=0;pe>=0;pe-=3)W[fe++]=U[pe],W[fe++]=U[pe+1]-ye,W[fe++]=U[pe+2]-ye,W[fe++]=fe;O.push(new Fr(W,U[2]-ye,r)),X.push(ye-_)}}function w(_,q){return(O,X,U)=>{let B=0,K=O.length-1,W,ye;if(K>=0&&(W=O[K])instanceof fn){if(!K&&W.type==_&&W.length==U)return W;(ye=W.prop(yt.lookAhead))&&(B=X[K]+W.length+ye)}return C(_,O,X,U,B,q)}}function A(_,q,O,X,U,B,K,W,ye){let pe=[],fe=[];for(;_.length>X;)pe.push(_.pop()),fe.push(q.pop()+O-U);_.push(C(r.types[K],pe,fe,B-U,W-B,ye)),q.push(U-O)}function C(_,q,O,X,U,B,K){if(B){let W=[yt.contextHash,B];K=K?[W].concat(K):[W]}if(U>25){let W=[yt.lookAhead,U];K=K?[W].concat(K):[W]}return new fn(_,q,O,X,K)}function j(_,q){let O=u.fork(),X=0,U=0,B=0,K=O.end-s,W={size:0,start:0,skip:0};e:for(let ye=O.pos-_;O.pos>ye;){let pe=O.size;if(O.id==q&&pe>=0){W.size=X,W.start=U,W.skip=B,B+=4,X+=4,O.next();continue}let fe=O.pos-pe;if(pe<0||fe<ye||O.start<K)break;let L=O.id>=c?4:0,Q=O.start;for(O.next();O.pos>fe;){if(O.size<0)if(O.size==-3||O.size==-4)L+=4;else break e;else O.id>=c&&(L+=4);O.next()}U=Q,X+=pe,B+=L}return(q<0||X==_)&&(W.size=X,W.start=U,W.skip=B),W.size>4?W:void 0}function D(_,q,O){let{id:X,start:U,end:B,size:K}=u;if(u.next(),K>=0&&X<c){let W=O;if(K>4){let ye=u.pos-(K-4);for(;u.pos>ye;)O=D(_,q,O)}q[--O]=W,q[--O]=B-_,q[--O]=U-_,q[--O]=X}else K==-3?h=X:K==-4&&(g=X);return O}let M=[],E=[];for(;u.pos>0;)b(t.start||0,t.bufferStart||0,M,E,-1,0);let R=(e=t.length)!==null&&e!==void 0?e:M.length?E[0]+M[0].length:0;return new fn(f[t.topID],M.reverse(),E.reverse(),R)}const $x=new WeakMap;function Ec(t,e){if(!t.isAnonymous||e instanceof Fr||e.type!=t)return 1;let n=$x.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof fn)){n=1;break}n+=Ec(t,r)}$x.set(e,n)}return n}function jh(t,e,n,r,s,a,c,u,f){let h=0;for(let A=r;A<s;A++)h+=Ec(t,e[A]);let g=Math.ceil(h*1.5/8),b=[],v=[];function w(A,C,j,D,M){for(let E=j;E<D;){let R=E,_=C[E],q=Ec(t,A[E]);for(E++;E<D;E++){let O=Ec(t,A[E]);if(q+O>=g)break;q+=O}if(E==R+1){if(q>g){let O=A[R];w(O.children,O.positions,0,O.children.length,C[R]+M);continue}b.push(A[R])}else{let O=C[E-1]+A[E-1].length-_;b.push(jh(t,A,C,R,E,_,O,null,f))}v.push(_+M-a)}}return w(e,n,r,s,0),(u||f)(b,v,c)}class Ls{constructor(e,n,r,s,a=!1,c=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(a?1:0)|(c?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new Ls(0,e.length,e,0,!1,r)];for(let a of n)a.to>e.length&&s.push(a);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],a=1,c=e.length?e[0]:null;for(let u=0,f=0,h=0;;u++){let g=u<n.length?n[u]:null,b=g?g.fromA:1e9;if(b-f>=r)for(;c&&c.from<b;){let v=c;if(f>=v.from||b<=v.to||h){let w=Math.max(v.from,f)-h,A=Math.min(v.to,b)-h;v=w>=A?null:new Ls(w,A,v.tree,v.offset+h,u>0,!!g)}if(v&&s.push(v),c.to>b)break;c=a<e.length?e[a++]:null}if(!g)break;f=g.toA,h=g.toA-g.toB}return s}}class Yj{startParse(e,n,r){return typeof e=="string"&&(e=new Kj(e)),r=r?r.length?r.map(s=>new Ah(s.from,s.to)):[new Ah(0,0)]:[new Ah(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let a=s.advance();if(a)return a}}}class Kj{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new yt({perNode:!0});let Gj=0;class pi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=Gj++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof pi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new pi(r,[],null,[]);if(s.set.push(s),n)for(let a of n.set)s.set.push(a);return s}static defineModifier(e){let n=new Oc(e);return r=>r.modified.indexOf(n)>-1?r:Oc.get(r.base||r,r.modified.concat(n).sort((s,a)=>s.id-a.id))}}let Xj=0;class Oc{constructor(e){this.name=e,this.instances=[],this.id=Xj++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(u=>u.base==e&&Jj(n,u.modified));if(r)return r;let s=[],a=new pi(e.name,s,e,n);for(let u of n)u.instances.push(a);let c=Qj(n);for(let u of e.set)if(!u.modified.length)for(let f of c)s.push(Oc.get(u,f));return a}}function Jj(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function Qj(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function Wj(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let a=[],c=2,u=s;for(let b=0;;){if(u=="..."&&b>0&&b+3==s.length){c=1;break}let v=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!v)throw new RangeError("Invalid path: "+s);if(a.push(v[0]=="*"?"":v[0][0]=='"'?JSON.parse(v[0]):v[0]),b+=v[0].length,b==s.length)break;let w=s[b++];if(b==s.length&&w=="!"){c=0;break}if(w!="/")throw new RangeError("Invalid path: "+s);u=s.slice(b)}let f=a.length-1,h=a[f];if(!h)throw new RangeError("Invalid path: "+s);let g=new Mc(r,c,f>0?a.slice(0,f):null);e[h]=g.sort(e[h])}}return Zj.add(e)}const Zj=new yt({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let a=new Mc(s.tags,s.mode,s.context);n?n.next=a:r=a,n=a}return r}});class Mc{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}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}}Mc.empty=new Mc([],2,null);function eE(t,e){let n=Object.create(null);for(let a of t)if(!Array.isArray(a.tag))n[a.tag.id]=a.class;else for(let c of a.tag)n[c.id]=a.class;let{scope:r,all:s=null}={};return{style:a=>{let c=s;for(let u of a)for(let f of u.set){let h=n[f.id];if(h){c=c?c+" "+h:h;break}}return c},scope:r}}const Te=pi.define,Rc=Te(),Yr=Te(),Ix=Te(Yr),Hx=Te(Yr),Kr=Te(),Dc=Te(Kr),Eh=Te(Kr),Ki=Te(),qs=Te(Ki),Gi=Te(),Xi=Te(),Oh=Te(),_a=Te(Oh),_c=Te(),rt={comment:Rc,lineComment:Te(Rc),blockComment:Te(Rc),docComment:Te(Rc),name:Yr,variableName:Te(Yr),typeName:Ix,tagName:Te(Ix),propertyName:Hx,attributeName:Te(Hx),className:Te(Yr),labelName:Te(Yr),namespace:Te(Yr),macroName:Te(Yr),literal:Kr,string:Dc,docString:Te(Dc),character:Te(Dc),attributeValue:Te(Dc),number:Eh,integer:Te(Eh),float:Te(Eh),bool:Te(Kr),regexp:Te(Kr),escape:Te(Kr),color:Te(Kr),url:Te(Kr),keyword:Gi,self:Te(Gi),null:Te(Gi),atom:Te(Gi),unit:Te(Gi),modifier:Te(Gi),operatorKeyword:Te(Gi),controlKeyword:Te(Gi),definitionKeyword:Te(Gi),moduleKeyword:Te(Gi),operator:Xi,derefOperator:Te(Xi),arithmeticOperator:Te(Xi),logicOperator:Te(Xi),bitwiseOperator:Te(Xi),compareOperator:Te(Xi),updateOperator:Te(Xi),definitionOperator:Te(Xi),typeOperator:Te(Xi),controlOperator:Te(Xi),punctuation:Oh,separator:Te(Oh),bracket:_a,angleBracket:Te(_a),squareBracket:Te(_a),paren:Te(_a),brace:Te(_a),content:Ki,heading:qs,heading1:Te(qs),heading2:Te(qs),heading3:Te(qs),heading4:Te(qs),heading5:Te(qs),heading6:Te(qs),contentSeparator:Te(Ki),list:Te(Ki),quote:Te(Ki),emphasis:Te(Ki),strong:Te(Ki),link:Te(Ki),monospace:Te(Ki),strikethrough:Te(Ki),inserted:Te(),deleted:Te(),changed:Te(),invalid:Te(),meta:_c,documentMeta:Te(_c),annotation:Te(_c),processingInstruction:Te(_c),definition:pi.defineModifier("definition"),constant:pi.defineModifier("constant"),function:pi.defineModifier("function"),standard:pi.defineModifier("standard"),local:pi.defineModifier("local"),special:pi.defineModifier("special")};for(let t in rt){let e=rt[t];e instanceof pi&&(e.name=t)}eE([{tag:rt.link,class:"tok-link"},{tag:rt.heading,class:"tok-heading"},{tag:rt.emphasis,class:"tok-emphasis"},{tag:rt.strong,class:"tok-strong"},{tag:rt.keyword,class:"tok-keyword"},{tag:rt.atom,class:"tok-atom"},{tag:rt.bool,class:"tok-bool"},{tag:rt.url,class:"tok-url"},{tag:rt.labelName,class:"tok-labelName"},{tag:rt.inserted,class:"tok-inserted"},{tag:rt.deleted,class:"tok-deleted"},{tag:rt.literal,class:"tok-literal"},{tag:rt.string,class:"tok-string"},{tag:rt.number,class:"tok-number"},{tag:[rt.regexp,rt.escape,rt.special(rt.string)],class:"tok-string2"},{tag:rt.variableName,class:"tok-variableName"},{tag:rt.local(rt.variableName),class:"tok-variableName tok-local"},{tag:rt.definition(rt.variableName),class:"tok-variableName tok-definition"},{tag:rt.special(rt.variableName),class:"tok-variableName2"},{tag:rt.definition(rt.propertyName),class:"tok-propertyName tok-definition"},{tag:rt.typeName,class:"tok-typeName"},{tag:rt.namespace,class:"tok-namespace"},{tag:rt.className,class:"tok-className"},{tag:rt.macroName,class:"tok-macroName"},{tag:rt.propertyName,class:"tok-propertyName"},{tag:rt.operator,class:"tok-operator"},{tag:rt.comment,class:"tok-comment"},{tag:rt.meta,class:"tok-meta"},{tag:rt.invalid,class:"tok-invalid"},{tag:rt.punctuation,class:"tok-punctuation"}]);var Mh;const Lc=new yt,tE=new yt;class or{constructor(e,n,r=[],s=""){this.data=e,this.name=s,wt.prototype.hasOwnProperty("tree")||Object.defineProperty(wt.prototype,"tree",{get(){return Gr(this)}}),this.parser=n,this.extension=[xl.of(this),wt.languageData.of((a,c,u)=>{let f=zx(a,c,u),h=f.type.prop(Lc);if(!h)return[];let g=a.facet(h),b=f.type.prop(tE);if(b){let v=f.resolve(c-f.from,u);for(let w of b)if(w.test(v,a)){let A=a.facet(w.facet);return w.type=="replace"?A:A.concat(g)}}return g})].concat(r)}isActiveAt(e,n,r=-1){return zx(e,n,r).type.prop(Lc)==this.data}findRegions(e){let n=e.facet(xl);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(a,c)=>{if(a.prop(Lc)==this.data){r.push({from:c,to:c+a.length});return}let u=a.prop(yt.mounted);if(u){if(u.tree.prop(Lc)==this.data){if(u.overlay)for(let f of u.overlay)r.push({from:f.from+c,to:f.to+c});else r.push({from:c,to:c+a.length});return}else if(u.overlay){let f=r.length;if(s(u.tree,u.overlay[0].from+c),r.length>f)return}}for(let f=0;f<a.children.length;f++){let h=a.children[f];h instanceof fn&&s(h,a.positions[f]+c)}};return s(Gr(e),0),r}get allowsNesting(){return!0}}or.setState=zt.define();function zx(t,e,n){let r=t.facet(xl),s=Gr(t).topNode;if(!r||r.allowsNesting)for(let a=s;a;a=a.enter(e,n,Ut.ExcludeBuffers|Ut.EnterBracketed))a.type.isTop&&(s=a);return s}function Gr(t){let e=t.field(or.state,!1);return e?e.tree:fn.empty}class nE{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,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let La=null;class qc{constructor(e,n,r=[],s,a,c,u,f){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=a,this.viewport=c,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new qc(e,n,[],fn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new nE(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=fn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Ls.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Ls.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=La;La=this;try{return e()}finally{La=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=Ux(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:a,viewport:c,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((h,g,b,v)=>f.push({fromA:h,toA:g,fromB:b,toB:v})),r=Ls.applyChanges(r,f),s=fn.empty,a=0,c={from:e.mapPos(c.from,-1),to:e.mapPos(c.to,1)},this.skipped.length){u=[];for(let h of this.skipped){let g=e.mapPos(h.from,1),b=e.mapPos(h.to,-1);g<b&&u.push({from:g,to:b})}}}return new qc(this.parser,n,r,s,a,c,u,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:a}=this.skipped[r];s<e.to&&a>e.from&&(this.fragments=Ux(this.fragments,s,a),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Yj{createParse(n,r,s){let a=s[0].from,c=s[s.length-1].to;return{parsedPos:a,advance(){let f=La;if(f){for(let h of s)f.tempSkipped.push(h);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=c,new fn(fi.none,[],[],c-a)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return La}}function Ux(t,e,n){return Ls.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class bl{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new bl(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=qc.create(e.facet(xl).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new bl(r)}}or.state=$r.define({create:bl.init,update(t,e){for(let n of e.effects)if(n.is(or.setState))return n.value;return e.startState.facet(xl)!=e.state.facet(xl)?bl.init(e.state):t.apply(e)}});let Vx=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Vx=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Rh=typeof navigator<"u"&&(!((Mh=navigator.scheduling)===null||Mh===void 0)&&Mh.isInputPending)?()=>navigator.scheduling.isInputPending():null,iE=lr.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 n=this.view.state.field(or.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(or.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Vx(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,a=r.field(or.state);if(a.tree==a.context.tree&&a.context.isDone(s+1e5))return;let c=Date.now()+Math.min(this.chunkBudget,100,e&&!Rh?Math.max(25,e.timeRemaining()-5):1e9),u=a.context.treeLen<s&&r.doc.length>s+1e3,f=a.context.work(()=>Rh&&Rh()||Date.now()>c,s+(u?0:1e5));this.chunkBudget-=Date.now()-n,(f||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:or.setState.of(new bl(a.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Pi(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xl=Ue.define({combine(t){return t.length?t[0]:null},enables:t=>[or.state,iE,Je.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]}),rE=Ue.define(),Dh=Ue.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Bc(t){let e=t.facet(Dh);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function $c(t,e){let n="",r=t.tabSize,s=t.facet(Dh)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let a=0;a<e;a++)n+=s;return n}function Fx(t,e){t instanceof wt&&(t=new Ic(t));for(let r of t.state.facet(rE)){let s=r(t,e);if(s!==void 0)return s}let n=Gr(t.state);return n.length>=e?lE(t,n,e):null}class Ic{constructor(e,n={}){this.state=e,this.options=n,this.unit=Bc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:a}=this.options;return s!=null&&s>=r.from&&s<=r.to?a&&s==e?{text:"",from:e}:(n<0?s<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,n);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,n=1){let{text:r,from:s}=this.lineAt(e,n),a=this.countColumn(r,e-s),c=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return c>-1&&(a+=c-this.countColumn(r,r.search(/\S|$/))),a}countColumn(e,n=e.length){return Zo(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),a=this.options.overrideIndentation;if(a){let c=a(s);if(c>-1)return c}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const sE=new yt;function lE(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let a=[];for(let c=s;c&&!(c.from<r.node.from||c.to>r.node.to||c.from==r.node.from&&c.type==r.node.type);c=c.parent)a.push(c);for(let c=a.length-1;c>=0;c--)r={node:a[c],next:r}}return Px(r,t,n)}function Px(t,e,n){for(let r=t;r;r=r.next){let s=oE(r.node);if(s)return s(_h.create(e,n,r))}return 0}function aE(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function oE(t){let e=t.type.prop(sE);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(yt.closedBy))){let s=t.lastChild,a=s&&r.indexOf(s.name)>-1;return c=>fE(c,!0,1,void 0,a&&!aE(c)?s.from:void 0)}return t.parent==null?cE:null}function cE(){return 0}class _h extends Ic{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new _h(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(uE(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Px(this.context.next,this.base,this.pos)}}function uE(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function dE(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,a=t.state.doc.lineAt(n.from),c=s==null||s<=a.from?a.to:Math.min(a.to,s);for(let u=n.to;;){let f=e.childAfter(u);if(!f||f==r)return null;if(!f.type.isSkipped){if(f.from>=c)return null;let h=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+h}}u=f.to}}function fE(t,e,n,r,s){let a=t.textAfter,c=a.match(/^\s*/)[0].length,u=r&&a.slice(c,c+r.length)==r||s==t.pos+c,f=dE(t);return f?u?t.column(f.from):t.column(f.to):t.baseIndent+(u?0:t.unit*n)}const hE=1e4,pE="()[]{}",mE=new yt;function Lh(t,e,n){let r=t.prop(e<0?yt.openedBy:yt.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function qh(t){let e=t.type.prop(mE);return e?e(t.node):t}function vl(t,e,n,r={}){let s=r.maxScanDistance||hE,a=r.brackets||pE,c=Gr(t),u=c.resolveInner(e,n);for(let f=u;f;f=f.parent){let h=Lh(f.type,n,a);if(h&&f.from<f.to){let g=qh(f);if(g&&(n>0?e>=g.from&&e<g.to:e>g.from&&e<=g.to))return gE(t,e,n,f,g,h,a)}}return yE(t,e,n,c,u.type,s,a)}function gE(t,e,n,r,s,a,c){let u=r.parent,f={from:s.from,to:s.to},h=0,g=u?.cursor();if(g&&(n<0?g.childBefore(r.from):g.childAfter(r.to)))do if(n<0?g.to<=r.from:g.from>=r.to){if(h==0&&a.indexOf(g.type.name)>-1&&g.from<g.to){let b=qh(g);return{start:f,end:b?{from:b.from,to:b.to}:void 0,matched:!0}}else if(Lh(g.type,n,c))h++;else if(Lh(g.type,-n,c)){if(h==0){let b=qh(g);return{start:f,end:b&&b.from<b.to?{from:b.from,to:b.to}:void 0,matched:!1}}h--}}while(n<0?g.prevSibling():g.nextSibling());return{start:f,matched:!1}}function yE(t,e,n,r,s,a,c){if(n<0?!e:e==t.doc.length)return null;let u=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),f=c.indexOf(u);if(f<0||f%2==0!=n>0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},g=t.doc.iterRange(e,n>0?t.doc.length:0),b=0;for(let v=0;!g.next().done&&v<=a;){let w=g.value;n<0&&(v+=w.length);let A=e+v*n;for(let C=n>0?0:w.length-1,j=n>0?w.length:-1;C!=j;C+=n){let D=c.indexOf(w[C]);if(!(D<0||r.resolveInner(A+C,1).type!=s))if(D%2==0==n>0)b++;else{if(b==1)return{start:h,end:{from:A+C,to:A+C+1},matched:D>>1==f>>1};b--}}n>0&&(v+=w.length)}return g.done?{start:h,matched:!1}:null}const bE=Object.create(null),Yx=[fi.none],Kx=[],Gx=Object.create(null),xE=Object.create(null);for(let[t,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"]])xE[t]=vE(bE,e);function Bh(t,e){Kx.indexOf(t)>-1||(Kx.push(t),console.warn(e))}function vE(t,e){let n=[];for(let u of e.split(" ")){let f=[];for(let h of u.split(".")){let g=t[h]||rt[h];g?typeof g=="function"?f.length?f=f.map(g):Bh(h,`Modifier ${h} used at start of tag`):f.length?Bh(h,`Tag ${h} used as modifier`):f=Array.isArray(g)?g:[g]:Bh(h,`Unknown highlighting tag ${h}`)}for(let h of f)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(u=>u.id),a=Gx[s];if(a)return a.id;let c=Gx[s]=fi.define({id:Yx.length,name:r,props:[Wj({[r]:n})]});return Yx.push(c),c.id}Lt.RTL,Lt.LTR;const wE=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Ih(t.state,n.from);return r.line?SE(t):r.block?kE(t):!1};function $h(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const SE=$h(TE,0),AE=$h(Xx,0),kE=$h((t,e)=>Xx(t,e,NE(e)),0);function Ih(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const qa=50;function CE(t,{open:e,close:n},r,s){let a=t.sliceDoc(r-qa,r),c=t.sliceDoc(s,s+qa),u=/\s*$/.exec(a)[0].length,f=/^\s*/.exec(c)[0].length,h=a.length-u;if(a.slice(h-e.length,h)==e&&c.slice(f,f+n.length)==n)return{open:{pos:r-u,margin:u&&1},close:{pos:s+f,margin:f&&1}};let g,b;s-r<=2*qa?g=b=t.sliceDoc(r,s):(g=t.sliceDoc(r,r+qa),b=t.sliceDoc(s-qa,s));let v=/^\s*/.exec(g)[0].length,w=/\s*$/.exec(b)[0].length,A=b.length-w-n.length;return g.slice(v,v+e.length)==e&&b.slice(A,A+n.length)==n?{open:{pos:r+v+e.length,margin:/\s/.test(g.charAt(v+e.length))?1:0},close:{pos:s-w-n.length,margin:/\s/.test(b.charAt(A-1))?1:0}}:null}function NE(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let a=e.length-1;a>=0&&e[a].to>r.from?e[a].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function Xx(t,e,n=e.selection.ranges){let r=n.map(a=>Ih(e,a.from).block);if(!r.every(a=>a))return null;let s=n.map((a,c)=>CE(e,r[c],a.from,a.to));if(t!=2&&!s.every(a=>a))return{changes:e.changes(n.map((a,c)=>s[c]?[]:[{from:a.from,insert:r[c].open+" "},{from:a.to,insert:" "+r[c].close}]))};if(t!=1&&s.some(a=>a)){let a=[];for(let c=0,u;c<s.length;c++)if(u=s[c]){let f=r[c],{open:h,close:g}=u;a.push({from:h.pos-f.open.length,to:h.pos+h.margin},{from:g.pos-g.margin,to:g.pos+f.close.length})}return{changes:a}}return null}function TE(t,e,n=e.selection.ranges){let r=[],s=-1;e:for(let{from:a,to:c}of n){let u=r.length,f=1e9,h;for(let g=a;g<=c;){let b=e.doc.lineAt(g);if(h==null&&(h=Ih(e,b.from).line,!h))continue e;if(b.from>s&&(a==c||c>b.from)){s=b.from;let v=/^\s*/.exec(b.text)[0].length,w=v==b.length,A=b.text.slice(v,v+h.length)==h?v:-1;v<b.text.length&&v<f&&(f=v),r.push({line:b,comment:A,token:h,indent:v,empty:w,single:!1})}g=b.to+1}if(f<1e9)for(let g=u;g<r.length;g++)r[g].indent<r[g].line.text.length&&(r[g].indent=f);r.length==u+1&&(r[u].single=!0)}if(t!=2&&r.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:u,token:f,indent:h,empty:g,single:b}of r)(b||!g)&&a.push({from:u.from+h,insert:f+" "});let c=e.changes(a);return{changes:c,selection:e.selection.map(c,1)}}else if(t!=1&&r.some(a=>a.comment>=0)){let a=[];for(let{line:c,comment:u,token:f}of r)if(u>=0){let h=c.from+u,g=h+f.length;c.text[g-c.from]==" "&&g++,a.push({from:h,to:g})}return{changes:a}}return null}const Hh=Ir.define(),jE=Ir.define(),EE=Ue.define(),Jx=Ue.define({combine(t){return Ef(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),Qx=$r.define({create(){return Ji.empty},update(t,e){let n=e.state.facet(Jx),r=e.annotation(Hh);if(r){let f=Hn.fromTransaction(e,r.selection),h=r.side,g=h==0?t.undone:t.done;return f?g=zc(g,g.length,n.minDepth,f):g=ev(g,e.startState.selection),new Ji(h==0?r.rest:g,h==0?g:r.rest)}let s=e.annotation(jE);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(tn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let a=Hn.fromTransaction(e),c=e.annotation(tn.time),u=e.annotation(tn.userEvent);return a?t=t.addChanges(a,c,u,n,e):e.selection&&(t=t.addSelection(e.startState.selection,c,u,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Ji(t.done.map(Hn.fromJSON),t.undone.map(Hn.fromJSON))}});function OE(t={}){return[Qx,Jx.of(t),Je.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?Wx:e.inputType=="historyRedo"?zh:null;return r?(e.preventDefault(),r(n)):!1}})]}function Hc(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(Qx,!1);if(!s)return!1;let a=s.pop(t,n,e);return a?(r(a),!0):!1}}const Wx=Hc(0,!1),zh=Hc(1,!1),ME=Hc(0,!0),RE=Hc(1,!0);class Hn{constructor(e,n,r,s,a){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=a}setSelAfter(e){return new Hn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Hn(e.changes&&en.fromJSON(e.changes),[],e.mapped&&Ui.fromJSON(e.mapped),e.startSelection&&Ae.fromJSON(e.startSelection),e.selectionsAfter.map(Ae.fromJSON))}static fromTransaction(e,n){let r=mi;for(let s of e.startState.facet(EE)){let a=s(e);a.length&&(r=r.concat(a))}return!r.length&&e.changes.empty?null:new Hn(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,mi)}static selection(e){return new Hn(void 0,mi,void 0,void 0,e)}}function zc(t,e,n,r){let s=e+1>n+20?e-n-1:0,a=t.slice(s,e);return a.push(r),a}function DE(t,e){let n=[],r=!1;return t.iterChangedRanges((s,a)=>n.push(s,a)),e.iterChangedRanges((s,a,c,u)=>{for(let f=0;f<n.length;){let h=n[f++],g=n[f++];u>=h&&c<=g&&(r=!0)}}),r}function _E(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Zx(t,e){return t.length?e.length?t.concat(e):t:e}const mi=[],LE=200;function ev(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-LE));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),zc(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Hn.selection([e])]}function qE(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Uh(t,e){if(!t.length)return t;let n=t.length,r=mi;for(;n;){let s=BE(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let a=t.slice(0,n);return a[n-1]=s,a}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[Hn.selection(r)]:mi}function BE(t,e,n){let r=Zx(t.selectionsAfter.length?t.selectionsAfter.map(u=>u.map(e)):mi,n);if(!t.changes)return Hn.selection(r);let s=t.changes.map(e),a=e.mapDesc(t.changes,!0),c=t.mapped?t.mapped.composeDesc(a):a;return new Hn(s,zt.mapEffects(t.effects,e),c,t.startSelection.map(a),r)}const $E=/^(input\.type|delete)($|\.)/;class Ji{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Ji(this.done,this.undone):this}addChanges(e,n,r,s,a){let c=this.done,u=c[c.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!r||$E.test(r))&&(!u.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,DE(u.changes,e.changes))||r=="input.type.compose")?c=zc(c,c.length-1,s.minDepth,new Hn(e.changes.compose(u.changes),Zx(zt.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,mi)):c=zc(c,c.length,s.minDepth,e),new Ji(c,mi,n,r)}addSelection(e,n,r,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:mi;return a.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&_E(a[a.length-1],e)?this:new Ji(ev(this.done,e),this.undone,n,r)}addMapping(e){return new Ji(Uh(this.done,e),Uh(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],c=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):n.selection);if(r&&a.selectionsAfter.length)return n.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:Hh.of({side:e,rest:qE(s),selection:c}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let u=s.length==1?mi:s.slice(0,s.length-1);return a.mapped&&(u=Uh(u,a.mapped)),n.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:Hh.of({side:e,rest:u,selection:c}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Ji.empty=new Ji(mi,mi);const tv=[{key:"Mod-z",run:Wx,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:zh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:zh,preventDefault:!0},{key:"Mod-u",run:ME,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:RE,preventDefault:!0}];function wl(t,e){return Ae.create(t.ranges.map(e),t.mainIndex)}function Di(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function _i({state:t,dispatch:e},n){let r=wl(t.selection,n);return r.eq(t.selection,!0)?!1:(e(Di(t,r)),!0)}function Uc(t,e){return Ae.cursor(e?t.to:t.from)}function nv(t,e){return _i(t,n=>n.empty?t.moveByChar(n,e):Uc(n,e))}function Cn(t){return t.textDirectionAt(t.state.selection.main.head)==Lt.LTR}const iv=t=>nv(t,!Cn(t)),rv=t=>nv(t,Cn(t));function sv(t,e){return _i(t,n=>n.empty?t.moveByGroup(n,e):Uc(n,e))}const IE=t=>sv(t,!Cn(t)),HE=t=>sv(t,Cn(t));function zE(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Vc(t,e,n){let r=Gr(t).resolveInner(e.head),s=n?yt.closedBy:yt.openedBy;for(let f=e.head;;){let h=n?r.childAfter(f):r.childBefore(f);if(!h)break;zE(t,h,s)?r=h:f=n?h.to:h.from}let a=r.type.prop(s),c,u;return a&&(c=n?vl(t,r.from,1):vl(t,r.to,-1))&&c.matched?u=n?c.end.to:c.end.from:u=n?r.to:r.from,Ae.cursor(u,n?-1:1)}const UE=t=>_i(t,e=>Vc(t.state,e,!Cn(t))),VE=t=>_i(t,e=>Vc(t.state,e,Cn(t)));function lv(t,e){return _i(t,n=>{if(!n.empty)return Uc(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const av=t=>lv(t,!1),ov=t=>lv(t,!0);function cv(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let a of t.state.facet(Je.scrollMargins)){let c=a(t);c?.top&&(n=Math.max(c?.top,n)),c?.bottom&&(r=Math.max(c?.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function uv(t,e){let n=cv(t),{state:r}=t,s=wl(r.selection,c=>c.empty?t.moveVertically(c,e,n.height):Uc(c,e));if(s.eq(r.selection))return!1;let a;if(n.selfScroll){let c=t.coordsAtPos(r.selection.main.head),u=t.scrollDOM.getBoundingClientRect(),f=u.top+n.marginTop,h=u.bottom-n.marginBottom;c&&c.top>f&&c.bottom<h&&(a=Je.scrollIntoView(s.main.head,{y:"start",yMargin:c.top-f}))}return t.dispatch(Di(r,s),{effects:a}),!0}const dv=t=>uv(t,!1),Vh=t=>uv(t,!0);function Xr(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let a=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;a&&e.head!=r.from+a&&(s=Ae.cursor(r.from+a))}return s}const FE=t=>_i(t,e=>Xr(t,e,!0)),PE=t=>_i(t,e=>Xr(t,e,!1)),YE=t=>_i(t,e=>Xr(t,e,!Cn(t))),KE=t=>_i(t,e=>Xr(t,e,Cn(t))),GE=t=>_i(t,e=>Ae.cursor(t.lineBlockAt(e.head).from,1)),XE=t=>_i(t,e=>Ae.cursor(t.lineBlockAt(e.head).to,-1));function JE(t,e,n){let r=!1,s=wl(t.selection,a=>{let c=vl(t,a.head,-1)||vl(t,a.head,1)||a.head>0&&vl(t,a.head-1,1)||a.head<t.doc.length&&vl(t,a.head+1,-1);if(!c||!c.end)return a;r=!0;let u=c.start.from==a.head?c.end.to:c.end.from;return Ae.cursor(u)});return r?(e(Di(t,s)),!0):!1}const QE=({state:t,dispatch:e})=>JE(t,e);function gi(t,e,n){let r=wl(t.state.selection,s=>{s.undirectional&&s.head>=s.anchor!=e&&(s=Ae.range(s.head,s.anchor));let a=n(s);return Ae.range(s.anchor,a.head,a.goalColumn,a.bidiLevel||void 0,a.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(Di(t.state,r)),!0)}function fv(t,e){return gi(t,e,n=>t.moveByChar(n,e))}const hv=t=>fv(t,!Cn(t)),pv=t=>fv(t,Cn(t));function mv(t,e){return gi(t,e,n=>t.moveByGroup(n,e))}const WE=t=>mv(t,!Cn(t)),ZE=t=>mv(t,Cn(t)),eO=t=>{let e=!Cn(t);return gi(t,e,n=>Vc(t.state,n,e))},tO=t=>{let e=Cn(t);return gi(t,e,n=>Vc(t.state,n,e))};function gv(t,e){return gi(t,e,n=>t.moveVertically(n,e))}const yv=t=>gv(t,!1),bv=t=>gv(t,!0);function xv(t,e){return gi(t,e,n=>t.moveVertically(n,e,cv(t).height))}const vv=t=>xv(t,!1),wv=t=>xv(t,!0),nO=t=>gi(t,!0,e=>Xr(t,e,!0)),iO=t=>gi(t,!1,e=>Xr(t,e,!1)),rO=t=>{let e=!Cn(t);return gi(t,e,n=>Xr(t,n,e))},sO=t=>{let e=Cn(t);return gi(t,e,n=>Xr(t,n,e))},lO=t=>gi(t,!1,e=>Ae.cursor(t.lineBlockAt(e.head).from)),aO=t=>gi(t,!0,e=>Ae.cursor(t.lineBlockAt(e.head).to)),Sv=({state:t,dispatch:e})=>(e(Di(t,{anchor:0})),!0),Av=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.doc.length})),!0),kv=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.selection.main.anchor,head:0})),!0),Cv=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),oO=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),cO=({state:t,dispatch:e})=>{let n=Pc(t).map(({from:r,to:s})=>Ae.undirectionalRange(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ae.create(n),userEvent:"select"})),!0},uO=({state:t,dispatch:e})=>{let n=wl(t.selection,r=>{let s=Gr(t),a=s.resolveStack(r.from,1);if(r.empty){let c=s.resolveStack(r.from,-1);c.node.from>=a.node.from&&c.node.to<=a.node.to&&(a=c)}for(let c=a;c;c=c.next){let{node:u}=c;if((u.from<r.from&&u.to>=r.to||u.to>r.to&&u.from<=r.from)&&c.next)return Ae.undirectionalRange(u.from,u.to)}return r});return n.eq(t.selection)?!1:(e(Di(t,n)),!0)};function Nv(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let a of n.selection.ranges){let c=n.doc.lineAt(a.head);if(e?c.to<t.state.doc.length:c.from>0)for(let u=a;;){let f=t.moveVertically(u,e);if(f.head<c.from||f.head>c.to){s.some(h=>h.head==f.head)||s.push(f);break}else{if(f.head==u.head)break;u=f}}}return s.length==r.ranges.length?!1:(t.dispatch(Di(n,Ae.create(s,s.length-1))),!0)}const dO=t=>Nv(t,!1),fO=t=>Nv(t,!0),hO=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ae.create([n.main]):n.main.empty||(r=Ae.create([Ae.cursor(n.main.head)])),r?(e(Di(t,r)),!0):!1};function Ba(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(a=>{let{from:c,to:u}=a;if(c==u){let f=e(a);f<c?(n="delete.backward",f=Fc(t,f,!1)):f>c&&(n="delete.forward",f=Fc(t,f,!0)),c=Math.min(c,f),u=Math.max(u,f)}else c=Fc(t,c,!1),u=Fc(t,u,!0);return c==u?{range:a}:{changes:{from:c,to:u},range:Ae.cursor(c,c<a.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Je.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Fc(t,e,n){if(t instanceof Je)for(let r of t.state.facet(Je.atomicRanges).map(s=>s(t)))r.between(e,e,(s,a)=>{s<e&&a>e&&(e=n?a:s)});return e}const Tv=(t,e,n)=>Ba(t,r=>{let s=r.from,{state:a}=t,c=a.doc.lineAt(s),u,f;if(n&&!e&&s>c.from&&s<c.from+200&&!/[^ \t]/.test(u=c.text.slice(0,s-c.from))){if(u[u.length-1]==" ")return s-1;let h=Zo(u,a.tabSize),g=h%Bc(a)||Bc(a);for(let b=0;b<g&&u[u.length-1-b]==" ";b++)s--;f=s}else f=An(c.text,s-c.from,e,e)+c.from,f==s&&c.number!=(e?a.doc.lines:1)?f+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(c.text.slice(f-c.from,s-c.from))&&(f=An(c.text,f-c.from,!1,!1)+c.from);return f}),Fh=t=>Tv(t,!1,!0),jv=t=>Tv(t,!0,!1),Ev=(t,e)=>Ba(t,n=>{let r=n.head,{state:s}=t,a=s.doc.lineAt(r),c=s.charCategorizer(r);for(let u=null;;){if(r==(e?a.to:a.from)){r==n.head&&a.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let f=An(a.text,r-a.from,e)+a.from,h=a.text.slice(Math.min(r,f)-a.from,Math.max(r,f)-a.from),g=c(h);if(u!=null&&g!=u)break;(h!=" "||r!=n.head)&&(u=g),r=f}return r}),Ov=t=>Ev(t,!1),pO=t=>Ev(t,!0),mO=t=>Ba(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),gO=t=>Ba(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),yO=t=>Ba(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),bO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:gt.of(["",""])},range:Ae.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},xO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,a=t.doc.lineAt(s),c=s==a.from?s-1:An(a.text,s-a.from,!1)+a.from,u=s==a.to?s+1:An(a.text,s-a.from,!0)+a.from;return{changes:{from:c,to:u,insert:t.doc.slice(s,u).append(t.doc.slice(c,s))},range:Ae.cursor(u)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Pc(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),a=t.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=t.doc.lineAt(r.to-1)),n>=s.number){let c=e[e.length-1];c.to=a.to,c.ranges.push(r)}else e.push({from:s.from,to:a.to,ranges:[r]});n=a.number+1}return e}function Mv(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let a of Pc(t)){if(n?a.to==t.doc.length:a.from==0)continue;let c=t.doc.lineAt(n?a.to+1:a.from-1),u=c.length+1;if(n){r.push({from:a.to,to:c.to},{from:a.from,insert:c.text+t.lineBreak});for(let f of a.ranges)s.push(Ae.range(Math.min(t.doc.length,f.anchor+u),Math.min(t.doc.length,f.head+u)))}else{r.push({from:c.from,to:a.from},{from:a.to,insert:t.lineBreak+c.text});for(let f of a.ranges)s.push(Ae.range(f.anchor-u,f.head-u))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ae.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const vO=({state:t,dispatch:e})=>Mv(t,e,!1),wO=({state:t,dispatch:e})=>Mv(t,e,!0);function Rv(t,e,n){if(t.readOnly)return!1;let r=[];for(let a of Pc(t))n?r.push({from:a.from,insert:t.doc.slice(a.from,a.to)+t.lineBreak}):r.push({from:a.to,insert:t.lineBreak+t.doc.slice(a.from,a.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const SO=({state:t,dispatch:e})=>Rv(t,e,!1),AO=({state:t,dispatch:e})=>Rv(t,e,!0),kO=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Pc(e).map(({from:s,to:a})=>(s>0?s--:a<e.doc.length&&a++,{from:s,to:a}))),r=wl(e.selection,s=>{let a;if(t.lineWrapping){let c=t.lineBlockAt(s.head),u=t.coordsAtPos(s.head,s.assoc||1);u&&(a=c.bottom+t.documentTop-u.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,a)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function CO(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Gr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),a;return r&&s&&r.to<=e&&s.from>=e&&(a=r.type.prop(yt.closedBy))&&a.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const Dv=_v(!1),NO=_v(!0);function _v(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:a,to:c}=s,u=e.doc.lineAt(a),f=!t&&a==c&&CO(e,a);t&&(a=c=(c<=u.to?u:e.doc.lineAt(c)).to);let h=new Ic(e,{simulateBreak:a,simulateDoubleBreak:!!f}),g=Fx(h,a);for(g==null&&(g=Zo(/^\s*/.exec(e.doc.lineAt(a).text)[0],e.tabSize));c<u.to&&/\s/.test(u.text[c-u.from]);)c++;f?{from:a,to:c}=f:a>u.from&&a<u.from+100&&!/\S/.test(u.text.slice(0,a))&&(a=u.from);let b=["",$c(e,g)];return f&&b.push($c(e,h.lineIndent(u.from,-1))),{changes:{from:a,to:c,insert:gt.of(b)},range:Ae.cursor(a+1+b[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Ph(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let c=r.from;c<=r.to;){let u=t.doc.lineAt(c);u.number>n&&(r.empty||r.to>u.from)&&(e(u,s,r),n=u.number),c=u.to+1}let a=t.changes(s);return{changes:s,range:Ae.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}const TO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Ic(t,{overrideIndentation:a=>{let c=n[a];return c??-1}}),s=Ph(t,(a,c,u)=>{let f=Fx(r,a.from);if(f==null)return;/\S/.test(a.text)||(f=0);let h=/^\s*/.exec(a.text)[0],g=$c(t,f);(h!=g||u.from<a.from+h.length)&&(n[a.from]=f,c.push({from:a.from,to:a.from+h.length,insert:g}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},Lv=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Ph(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Dh)})}),{userEvent:"input.indent"})),!0),qv=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Ph(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let a=Zo(s,t.tabSize),c=0,u=$c(t,Math.max(0,a-Bc(t)));for(;c<s.length&&c<u.length&&s.charCodeAt(c)==u.charCodeAt(c);)c++;r.push({from:n.from+c,to:n.from+s.length,insert:u.slice(c)})}),{userEvent:"delete.dedent"})),!0),jO=t=>(t.setTabFocusMode(),!0),EO=[{key:"Ctrl-b",run:iv,shift:hv,preventDefault:!0},{key:"Ctrl-f",run:rv,shift:pv},{key:"Ctrl-p",run:av,shift:yv},{key:"Ctrl-n",run:ov,shift:bv},{key:"Ctrl-a",run:GE,shift:lO},{key:"Ctrl-e",run:XE,shift:aO},{key:"Ctrl-d",run:jv},{key:"Ctrl-h",run:Fh},{key:"Ctrl-k",run:mO},{key:"Ctrl-Alt-h",run:Ov},{key:"Ctrl-o",run:bO},{key:"Ctrl-t",run:xO},{key:"Ctrl-v",run:Vh}],OO=[{key:"ArrowLeft",run:iv,shift:hv,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:IE,shift:WE,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:YE,shift:rO,preventDefault:!0},{key:"ArrowRight",run:rv,shift:pv,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:HE,shift:ZE,preventDefault:!0},{mac:"Cmd-ArrowRight",run:KE,shift:sO,preventDefault:!0},{key:"ArrowUp",run:av,shift:yv,preventDefault:!0},{mac:"Cmd-ArrowUp",run:Sv,shift:kv},{mac:"Ctrl-ArrowUp",run:dv,shift:vv},{key:"ArrowDown",run:ov,shift:bv,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Av,shift:Cv},{mac:"Ctrl-ArrowDown",run:Vh,shift:wv},{key:"PageUp",run:dv,shift:vv},{key:"PageDown",run:Vh,shift:wv},{key:"Home",run:PE,shift:iO,preventDefault:!0},{key:"Mod-Home",run:Sv,shift:kv},{key:"End",run:FE,shift:nO,preventDefault:!0},{key:"Mod-End",run:Av,shift:Cv},{key:"Enter",run:Dv,shift:Dv},{key:"Mod-a",run:oO},{key:"Backspace",run:Fh,shift:Fh,preventDefault:!0},{key:"Delete",run:jv,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Ov,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:pO,preventDefault:!0},{mac:"Mod-Backspace",run:gO,preventDefault:!0},{mac:"Mod-Delete",run:yO,preventDefault:!0}].concat(EO.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Bv=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:UE,shift:eO},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:VE,shift:tO},{key:"Alt-ArrowUp",run:vO},{key:"Shift-Alt-ArrowUp",run:SO},{key:"Alt-ArrowDown",run:wO},{key:"Shift-Alt-ArrowDown",run:AO},{key:"Mod-Alt-ArrowUp",run:dO},{key:"Mod-Alt-ArrowDown",run:fO},{key:"Escape",run:hO},{key:"Mod-Enter",run:NO},{key:"Alt-l",mac:"Ctrl-l",run:cO},{key:"Mod-i",run:uO,preventDefault:!0},{key:"Mod-[",run:qv},{key:"Mod-]",run:Lv},{key:"Mod-Alt-\\",run:TO},{key:"Shift-Mod-k",run:kO},{key:"Shift-Mod-\\",run:QE},{key:"Mod-/",run:wE},{key:"Alt-A",mac:"Ctrl-A",run:AE},{key:"Ctrl-m",mac:"Shift-Alt-m",run:jO}].concat(OO),MO={key:"Tab",run:Lv,shift:qv};function $v({ariaLabel:t,dataTestId:e,ariaControls:n,ariaActiveDescendant:r,ariaAutocomplete:s,ariaExpanded:a}){const c={"aria-label":t,"aria-multiline":"true",role:"textbox",spellcheck:"false"};return e&&(c["data-testid"]=e),n&&(c["aria-controls"]=n),r&&(c["aria-activedescendant"]=r),s&&(c["aria-autocomplete"]=s),a!==void 0&&(c["aria-expanded"]=String(a)),c}function Iv(t){const e=t==="dark";return Je.theme({"&":{height:"100%",backgroundColor:e?"#030712":"#ffffff",color:e?"#f3f4f6":"#111827"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:"12px",lineHeight:"24px",overflow:"auto"},".cm-content":{minHeight:"100%",padding:"8px 12px",caretColor:e?"#f9fafb":"#111827"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:e?"#f9fafb":"#111827"},".cm-gutters":{backgroundColor:e?"#111827":"#f9fafb",color:e?"#6b7280":"#9ca3af",borderRight:`1px solid ${e?"#1f2937":"#e5e7eb"}`},".cm-activeLine":{backgroundColor:e?"#11182780":"#f3f4f680"},".cm-activeLineGutter":{backgroundColor:e?"#1f2937":"#f3f4f6"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:e?"#1d4ed880":"#bfdbfe"}},{dark:e})}const RO={key:"Enter",run:t=>(t.dispatch(t.state.replaceSelection(`
|
|
59
|
-
`)),!0)};function
|
|
60
|
-
`).length),fe=Math.min(c,Math.max(a,ye))*24+16,L=s==="dark";return p.jsx("div",{className:`api-client-code-editor min-w-0 overflow-hidden rounded-md border focus-within:ring-2 focus-within:ring-inset focus-within:ring-blue-500 ${L?"border-gray-700 bg-gray-950":"border-gray-300 bg-white"}`,"data-editor":"codemirror","data-language":r,"data-wrap":f?"soft":"off",style:{height:fe},children:p.jsx("div",{ref:D,className:"h-full min-w-0"})})});$a.displayName="ApiClientCodeEditor";const zv=()=>({key:"",value:"",enabled:!0}),Yh=()=>({key:"",value:"",enabled:!0,type:"text"}),Uv=[["application/json","JSON — application/json"],["application/problem+json","Problem JSON — application/problem+json"],["application/ld+json","JSON-LD — application/ld+json"],["text/plain","Text — text/plain"],["application/xml","XML — application/xml"],["text/html","HTML — text/html"],["application/javascript","JavaScript — application/javascript"],["application/octet-stream","Binary — application/octet-stream"]];function DO(t){const e=(t||"").toLowerCase();return e.includes("json")?"json":e.includes("xml")?"xml":e.includes("html")?"html":e.includes("javascript")?"javascript":"text"}function _O({label:t,entries:e,onChange:n,inputClass:r}){const s=(a,c)=>n(e.map((u,f)=>f===a?{...u,...c}:u));return p.jsxs("div",{className:"space-y-2",children:[e.map((a,c)=>p.jsxs("div",{className:"grid grid-cols-[auto_1fr_1fr_auto] items-center gap-2",children:[p.jsx("input",{"aria-label":`${t} ${c+1} enabled`,type:"checkbox",checked:a.enabled!==!1,onChange:u=>s(c,{enabled:u.target.checked})}),p.jsx("input",{"aria-label":`${t} ${c+1} key`,className:`min-w-0 rounded-md border px-3 py-2 text-sm ${r}`,placeholder:"Key",value:a.key,onChange:u=>s(c,{key:u.target.value})}),p.jsx("input",{"aria-label":`${t} ${c+1} value`,className:`min-w-0 rounded-md border px-3 py-2 text-sm ${r}`,placeholder:"Value",value:a.value,onChange:u=>s(c,{value:u.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove ${t.toLowerCase()} ${c+1}`,className:"rounded-md border p-2",onClick:()=>n(e.filter((u,f)=>f!==c)),children:p.jsx(ci,{className:"h-4 w-4"})})]},c)),p.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 rounded-md border px-3 py-2 text-xs",onClick:()=>n([...e,zv()]),children:[p.jsx(Cs,{className:"h-3.5 w-3.5"})," Add field"]})]})}const LO=({draft:t,onChange:e,theme:n="light"})=>{const r=t.bodyMode||da(t),s=n==="dark",a=s?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",u=Uv.some(([v])=>v===t.contentType)?t.contentType||"application/json":"__custom__",f=I.useMemo(()=>{if(r!=="json"||!(t.body||"").trim())return null;try{return JSON.parse(t.body||""),""}catch(v){return v instanceof Error?v.message:"Invalid JSON"}},[t.body,r]),h=I.useMemo(()=>{const v=t.graphql?.variables?.trim();if(r!=="graphql"||!v)return null;try{return JSON.parse(v),""}catch(w){return w instanceof Error?w.message:"Invalid JSON"}},[t.graphql?.variables,r]),g=v=>{const w={bodyMode:v};v==="json"&&(!t.contentType||!t.contentType.includes("json"))&&(w.contentType="application/json"),v==="raw"&&!t.contentType&&(w.contentType="text/plain"),v==="urlencoded"&&(w.contentType="application/x-www-form-urlencoded"),v==="formdata"&&(w.contentType=void 0),v==="binary"&&!t.contentType&&(w.contentType="application/octet-stream"),v==="graphql"&&(w.contentType="application/json"),e({...t,...w})},b=(v,w)=>{const A=t.formData||[Yh()];e({...t,formData:A.map((C,j)=>j===v?{...C,...w}:C)})};return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-body-heading",children:[p.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[p.jsxs("label",{className:"text-sm font-medium",children:["Body type",p.jsxs("select",{"aria-label":"Request body type",className:`ml-2 rounded-md border px-3 py-2 text-sm ${a}`,value:r,onChange:v=>g(v.target.value),children:[p.jsx("option",{value:"none",children:"None"}),p.jsx("option",{value:"json",children:"JSON"}),p.jsx("option",{value:"raw",children:"Raw"}),p.jsx("option",{value:"urlencoded",children:"x-www-form-urlencoded"}),p.jsx("option",{value:"formdata",children:"form-data"}),p.jsx("option",{value:"binary",children:"Binary"}),p.jsx("option",{value:"graphql",children:"GraphQL"})]})]}),(r==="json"||r==="raw"||r==="binary")&&p.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[p.jsxs("label",{className:"text-sm font-medium",children:["Content type",p.jsxs("select",{"aria-label":"Content type",className:`ml-2 rounded-md border px-3 py-2 text-sm ${a}`,value:u,onChange:v=>{const w=v.target.value==="__custom__"?"":v.target.value;e({...t,contentType:w})},children:[Uv.map(([v,w])=>p.jsx("option",{value:v,children:w},v)),p.jsx("option",{value:"__custom__",children:"Custom…"})]})]}),u==="__custom__"&&p.jsx("input",{"aria-label":"Custom content type",className:`rounded-md border px-3 py-2 text-sm ${a}`,placeholder:"application/vnd.example+json",value:t.contentType||"",onChange:v=>e({...t,contentType:v.target.value})})]})]}),r==="none"&&p.jsx("div",{className:`rounded-md border border-dashed p-4 text-sm ${s?"border-gray-700 text-gray-400":"border-gray-300 text-gray-500"}`,children:"This request has no body."}),(r==="json"||r==="raw")&&p.jsxs("div",{className:"space-y-2",children:[p.jsx($a,{ariaLabel:"Request body",language:r==="json"?"json":DO(t.contentType),theme:n,value:t.body||"",onChange:v=>e({...t,body:v}),minLines:9,maxLines:20}),p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[p.jsx("span",{className:`text-xs ${f?"text-red-600":r==="json"&&f===""?"text-green-600":s?"text-gray-400":"text-gray-500"}`,children:r==="json"?f?`Invalid JSON: ${f}`:(t.body||"").trim()?"Valid JSON":"Enter a JSON object, array, or value.":"Raw body is sent exactly as entered."}),r==="json"&&p.jsx("button",{type:"button",className:"rounded-md border px-3 py-1.5 text-xs",disabled:!!f||!(t.body||"").trim(),onClick:()=>{try{e({...t,body:JSON.stringify(JSON.parse(t.body||""),null,2)})}catch{}},children:"Beautify JSON"})]})]}),r==="urlencoded"&&p.jsxs("div",{className:"space-y-2",children:[p.jsx(_O,{label:"Form field",entries:t.urlencoded?.length?t.urlencoded:[zv()],inputClass:a,onChange:v=>e({...t,urlencoded:v,contentType:"application/x-www-form-urlencoded"})}),p.jsx("p",{className:`text-xs ${s?"text-gray-400":"text-gray-500"}`,children:"Enabled fields are URL-encoded at send time. Variable substitution still applies to keys and values."})]}),r==="formdata"&&p.jsxs("div",{className:"space-y-2",children:[(t.formData?.length?t.formData:[Yh()]).map((v,w)=>p.jsxs("div",{className:"grid gap-2 md:grid-cols-[auto_7rem_1fr_1fr_auto]",children:[p.jsx("input",{"aria-label":`Form data ${w+1} enabled`,type:"checkbox",checked:v.enabled!==!1,onChange:A=>b(w,{enabled:A.target.checked})}),p.jsxs("select",{"aria-label":`Form data ${w+1} type`,className:`rounded-md border px-2 py-2 text-sm ${a}`,value:v.type||"text",onChange:A=>b(w,{type:A.target.value,file:void 0,fileName:void 0}),children:[p.jsx("option",{value:"text",children:"Text"}),p.jsx("option",{value:"file",children:"File"})]}),p.jsx("input",{"aria-label":`Form data ${w+1} key`,className:`min-w-0 rounded-md border px-3 py-2 text-sm ${a}`,placeholder:"Key",value:v.key,onChange:A=>b(w,{key:A.target.value})}),v.type==="file"?p.jsxs("label",{className:`flex min-w-0 cursor-pointer items-center rounded-md border px-3 py-2 text-sm ${a}`,children:[p.jsx("span",{className:"truncate",children:v.file?.name||v.fileName||"Choose file…"}),p.jsx("input",{"aria-label":`Form data ${w+1} file`,className:"sr-only",type:"file",onChange:A=>{const C=A.target.files?.[0];b(w,{file:C,fileName:C?.name,contentType:C?.type||void 0})}})]}):p.jsx("input",{"aria-label":`Form data ${w+1} value`,className:`min-w-0 rounded-md border px-3 py-2 text-sm ${a}`,placeholder:"Value",value:v.value,onChange:A=>b(w,{value:A.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove form data ${w+1}`,className:"rounded-md border p-2",onClick:()=>e({...t,formData:(t.formData||[]).filter((A,C)=>C!==w)}),children:p.jsx(ci,{className:"h-4 w-4"})})]},w)),p.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 rounded-md border px-3 py-2 text-xs",onClick:()=>e({...t,formData:[...t.formData||[],Yh()]}),children:[p.jsx(Cs,{className:"h-3.5 w-3.5"})," Add form-data field"]}),p.jsx("p",{className:`text-xs ${s?"text-gray-400":"text-gray-500"}`,children:"The browser supplies the multipart boundary automatically. Imported Postman file paths must be re-selected from this browser."})]}),r==="binary"&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs("label",{className:`flex cursor-pointer items-center justify-between gap-3 rounded-md border px-3 py-3 text-sm ${a}`,children:[p.jsx("span",{className:"min-w-0 truncate",children:t.binary?.file?.name||t.binary?.fileName||"Choose binary file…"}),p.jsx("span",{className:"shrink-0 text-xs font-medium",children:"Browse"}),p.jsx("input",{"aria-label":"Binary file",className:"sr-only",type:"file",onChange:v=>{const w=v.target.files?.[0];e({...t,contentType:w?.type||t.contentType||"application/octet-stream",binary:{file:w,fileName:w?.name||t.binary?.fileName,contentType:w?.type||t.binary?.contentType}})}})]}),p.jsx("p",{className:`text-xs ${s?"text-gray-400":"text-gray-500"}`,children:"The selected file is sent as the request body without text conversion. Saved requests retain only file metadata, so the browser asks you to re-select the file before a later send or collection run."})]}),r==="graphql"&&p.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"text-xs font-medium",children:"Query"}),p.jsx($a,{ariaLabel:"GraphQL query",language:"graphql",theme:n,value:t.graphql?.query||"",onChange:v=>e({...t,graphql:{query:v,variables:t.graphql?.variables||""}}),minLines:9,maxLines:20})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"text-xs font-medium",children:"Variables (JSON)"}),p.jsx($a,{ariaLabel:"GraphQL variables",language:"json",theme:n,value:t.graphql?.variables||"",onChange:v=>e({...t,graphql:{query:t.graphql?.query||"",variables:v}}),minLines:9,maxLines:20}),p.jsx("div",{className:`text-xs ${h?"text-red-600":s?"text-gray-400":"text-gray-500"}`,children:h?`Invalid variables JSON: ${h}`:"Variables are serialized with the query as application/json."})]})]})]})};function qO(t,e){return t.find(([n])=>n.toLowerCase()===e.toLowerCase())?.[1]||""}function BO(t,e){const n=e.toLowerCase();if(n.includes("json"))try{return{body:JSON.stringify(JSON.parse(t),null,2),language:"json"}}catch{return{body:t,language:"json",invalidJson:!0}}return n.includes("html")?{body:t,language:"markup"}:n.includes("xml")?{body:t,language:"markup"}:n.includes("javascript")?{body:t,language:"javascript"}:{body:t,language:"text"}}function $O(t,e){const n=e.trim().toLowerCase();if(!n)return 0;let r=0,s=0;const a=t.toLowerCase();for(;s<a.length;){const c=a.indexOf(n,s);if(c<0)break;r+=1,s=c+Math.max(1,n.length)}return r}function IO(t,e){const n=e.trim().toLowerCase();return n?t.split(`
|
|
51
|
+
`){[e,n]=rl(this,e,n);let s="";for(let a=0,c=0;a<this.children.length&&c<=n;a++){let u=this.children[a],f=c+u.length;c>e&&a&&(s+=r),e<f&&n>c&&(s+=u.sliceString(e-c,n-c,r)),c=f+1}return s}flatten(e){for(let n of this.children)n.flatten(e)}scanIdentical(e,n){if(!(e instanceof zi))return 0;let r=0,[s,a,c,u]=n>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=n,a+=n){if(s==c||a==u)return r;let f=this.children[s],h=e.children[a];if(f!=h)return r+f.scanIdentical(h,n);r+=f.length+1}}static from(e,n=e.reduce((r,s)=>r+s.length+1,-1)){let r=0;for(let w of e)r+=w.lines;if(r<32){let w=[];for(let A of e)A.flatten(w);return new Ht(w,n)}let s=Math.max(32,r>>5),a=s<<1,c=s>>1,u=[],f=0,h=-1,g=[];function b(w){let A;if(w.lines>a&&w instanceof zi)for(let C of w.children)b(C);else w.lines>c&&(f>c||!f)?(v(),u.push(w)):w instanceof Ht&&f&&(A=g[g.length-1])instanceof Ht&&w.lines+A.lines<=32?(f+=w.lines,h+=w.length+1,g[g.length-1]=new Ht(A.text.concat(w.text),A.length+1+w.length)):(f+w.lines>s&&v(),f+=w.lines,h+=w.length+1,g.push(w))}function v(){f!=0&&(u.push(g.length==1?g[0]:zi.from(g,h)),h=-1,f=g.length=0)}for(let w of e)b(w);return v(),u.length==1?u[0]:new zi(u,n)}}gt.empty=new Ht([""],0);function xN(t){let e=-1;for(let n of t)e+=n.length+1;return e}function Po(t,e,n=0,r=1e9){for(let s=0,a=0,c=!0;a<t.length&&s<=r;a++){let u=t[a],f=s+u.length;f>=n&&(f>r&&(u=u.slice(0,r-s)),s<n&&(u=u.slice(n-s)),c?(e[e.length-1]+=u,c=!1):e.push(u)),s=f+1}return e}function Ey(t,e,n){return Po(t,[""],e,n)}class ha{constructor(e,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[n>0?1:(e instanceof Ht?e.text.length:e.children.length)<<1]}nextInner(e,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,s=this.nodes[r],a=this.offsets[r],c=a>>1,u=s instanceof Ht?s.text.length:s.children.length;if(c==(n>0?u:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(n>0?0:1)){if(this.offsets[r]+=n,e==0)return this.lineBreak=!0,this.value=`
|
|
52
|
+
`,this;e--}else if(s instanceof Ht){let f=s.text[c+(n<0?-1:0)];if(this.offsets[r]+=n,f.length>Math.max(0,e))return this.value=e==0?f:n>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=s.children[c+(n<0?-1:0)];e>f.length?(e-=f.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(f),this.offsets.push(n>0?1:(f instanceof Ht?f.text.length:f.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Oy{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new ha(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*n,this.value=s.length<=r?s:n<0?s.slice(s.length-r):s.slice(0,r),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 My{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:s}=this.inner.next(e);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(gt.prototype[Symbol.iterator]=function(){return this.iter()},ha.prototype[Symbol.iterator]=Oy.prototype[Symbol.iterator]=My.prototype[Symbol.iterator]=function(){return this});class vN{constructor(e,n,r,s){this.from=e,this.to=n,this.number=r,this.text=s}get length(){return this.to-this.from}}function rl(t,e,n){return e=Math.max(0,Math.min(t.length,e)),[e,Math.max(e,Math.min(t.length,n))]}function An(t,e,n=!0,r=!0){return yN(t,e,n,r)}function wN(t){return t>=56320&&t<57344}function SN(t){return t>=55296&&t<56320}function AN(t,e){let n=t.charCodeAt(e);if(!SN(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return wN(r)?(n-55296<<10)+(r-56320)+65536:n}function kN(t){return t<65536?1:2}const Sf=/\r\n?|\n/;var Jn=(function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t})(Jn||(Jn={}));class Ui{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,s=0;n<this.sections.length;){let a=this.sections[n++],c=this.sections[n++];c<0?(e(r,s,a),s+=a):s+=c,r+=a}}iterChangedRanges(e,n=!1){Af(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];s<0?e.push(r,s):e.push(s,r)}return new Ui(e)}composeDesc(e){return this.empty?e:e.empty?this:Ry(this,e)}mapDesc(e,n=!1){return e.empty?this:kf(this,e,n)}mapPos(e,n=-1,r=Jn.Simple){let s=0,a=0;for(let c=0;c<this.sections.length;){let u=this.sections[c++],f=this.sections[c++],h=s+u;if(f<0){if(h>e)return a+(e-s);a+=u}else{if(r!=Jn.Simple&&h>=e&&(r==Jn.TrackDel&&s<e&&h>e||r==Jn.TrackBefore&&s<e||r==Jn.TrackAfter&&h>e))return null;if(h>e||h==e&&n<0&&!u)return e==s||n<0?a:a+f;a+=f}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return a}touchesRange(e,n=e){for(let r=0,s=0;r<this.sections.length&&s<=n;){let a=this.sections[r++],c=this.sections[r++],u=s+a;if(c>=0&&s<=n&&u>=e)return s<e&&u>n?"cover":!0;s=u}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],s=this.sections[n++];e+=(e?" ":"")+r+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ui(e)}static create(e){return new Ui(e)}}class en extends Ui{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Af(this,(n,r,s,a,c)=>e=e.replace(s,s+(r-n),c),!1),e}mapDesc(e,n=!1){return kf(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let s=0,a=0;s<n.length;s+=2){let c=n[s],u=n[s+1];if(u>=0){n[s]=u,n[s+1]=c;let f=s>>1;for(;r.length<f;)r.push(gt.empty);r.push(c?e.slice(a,a+c):gt.empty)}a+=c}return new en(n,r)}compose(e){return this.empty?e:e.empty?this:Ry(this,e,!0)}map(e,n=!1){return e.empty?this:kf(this,e,n,!0)}iterChanges(e,n=!1){Af(this,e,n)}get desc(){return Ui.create(this.sections)}filter(e){let n=[],r=[],s=[],a=new pa(this);e:for(let c=0,u=0;;){let f=c==e.length?1e9:e[c++];for(;u<f||u==f&&a.len==0;){if(a.done)break e;let g=Math.min(a.len,f-u);kn(s,g,-1);let b=a.ins==-1?-1:a.off==0?a.ins:0;kn(n,g,b),b>0&&qr(r,n,a.text),a.forward(g),u+=g}let h=e[c++];for(;u<h;){if(a.done)break e;let g=Math.min(a.len,h-u);kn(n,g,-1),kn(s,g,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(g),u+=g}}return{changes:new en(n,r),filtered:Ui.create(s)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],s=this.sections[n+1];s<0?e.push(r):s==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let s=[],a=[],c=0,u=null;function f(g=!1){if(!g&&!s.length)return;c<n&&kn(s,n-c,-1);let b=new en(s,a);u=u?u.compose(b.map(u)):b,s=[],a=[],c=0}function h(g){if(Array.isArray(g))for(let b of g)h(b);else if(g instanceof en){if(g.length!=n)throw new RangeError(`Mismatched change set length (got ${g.length}, expected ${n})`);f(),u=u?u.compose(g.map(u)):g}else{let{from:b,to:v=b,insert:w}=g;if(b>v||b<0||v>n)throw new RangeError(`Invalid change range ${b} to ${v} (in doc of length ${n})`);let A=w?typeof w=="string"?gt.of(w.split(r||Sf)):w:gt.empty,C=A.length;if(b==v&&C==0)return;b<c&&f(),b>c&&kn(s,b-c,-1),kn(s,v-b,C),qr(a,s,A),c=v}}return h(e),f(!u),u}static empty(e){return new en(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let s=0;s<e.length;s++){let a=e[s];if(typeof a=="number")n.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((c,u)=>u&&typeof c!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)n.push(a[0],0);else{for(;r.length<s;)r.push(gt.empty);r[s]=gt.of(a.slice(1)),n.push(a[0],r[s].length)}}}return new en(n,r)}static createSet(e,n){return new en(e,n)}}function kn(t,e,n,r=!1){if(e==0&&n<=0)return;let s=t.length-2;s>=0&&n<=0&&n==t[s+1]?t[s]+=e:s>=0&&e==0&&t[s]==0?t[s+1]+=n:r?(t[s]+=e,t[s+1]+=n):t.push(e,n)}function qr(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(gt.empty);t.push(n)}}function Af(t,e,n){let r=t.inserted;for(let s=0,a=0,c=0;c<t.sections.length;){let u=t.sections[c++],f=t.sections[c++];if(f<0)s+=u,a+=u;else{let h=s,g=a,b=gt.empty;for(;h+=u,g+=f,f&&r&&(b=b.append(r[c-2>>1])),!(n||c==t.sections.length||t.sections[c+1]<0);)u=t.sections[c++],f=t.sections[c++];e(s,h,a,g,b),s=h,a=g}}}function kf(t,e,n,r=!1){let s=[],a=r?[]:null,c=new pa(t),u=new pa(e);for(let f=-1;;){if(c.done&&u.len||u.done&&c.len)throw new Error("Mismatched change set lengths");if(c.ins==-1&&u.ins==-1){let h=Math.min(c.len,u.len);kn(s,h,-1),c.forward(h),u.forward(h)}else if(u.ins>=0&&(c.ins<0||f==c.i||c.off==0&&(u.len<c.len||u.len==c.len&&!n))){let h=u.len;for(kn(s,u.ins,-1);h;){let g=Math.min(c.len,h);c.ins>=0&&f<c.i&&c.len<=g&&(kn(s,0,c.ins),a&&qr(a,s,c.text),f=c.i),c.forward(g),h-=g}u.next()}else if(c.ins>=0){let h=0,g=c.len;for(;g;)if(u.ins==-1){let b=Math.min(g,u.len);h+=b,g-=b,u.forward(b)}else if(u.ins==0&&u.len<g)g-=u.len,u.next();else break;kn(s,h,f<c.i?c.ins:0),a&&f<c.i&&qr(a,s,c.text),f=c.i,c.forward(c.len-g)}else{if(c.done&&u.done)return a?en.createSet(s,a):Ui.create(s);throw new Error("Mismatched change set lengths")}}}function Ry(t,e,n=!1){let r=[],s=n?[]:null,a=new pa(t),c=new pa(e);for(let u=!1;;){if(a.done&&c.done)return s?en.createSet(r,s):Ui.create(r);if(a.ins==0)kn(r,a.len,0,u),a.next();else if(c.len==0&&!c.done)kn(r,0,c.ins,u),s&&qr(s,r,c.text),c.next();else{if(a.done||c.done)throw new Error("Mismatched change set lengths");{let f=Math.min(a.len2,c.len),h=r.length;if(a.ins==-1){let g=c.ins==-1?-1:c.off?0:c.ins;kn(r,f,g,u),s&&g&&qr(s,r,c.text)}else c.ins==-1?(kn(r,a.off?0:a.len,f,u),s&&qr(s,r,a.textBit(f))):(kn(r,a.off?0:a.len,c.off?0:c.ins,u),s&&!c.off&&qr(s,r,c.text));u=(a.ins>f||c.ins>=0&&c.len>f)&&(u||r.length>h),a.forward2(f),c.forward(f)}}}}class pa{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,n=this.i-2>>1;return n>=e.length?gt.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?gt.empty:n[r].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 Br{constructor(e,n,r,s){this.from=e,this.to=n,this.flags=r,this.goalColumn=s}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,n=-1){let r,s;return this.empty?r=s=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),r==this.from&&s==this.to?this:new Br(r,s,this.flags,this.goalColumn)}extend(e,n=e,r=0){if(e<=this.anchor&&n>=this.anchor)return Ae.range(e,n,void 0,void 0,r);let s=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return Ae.range(this.anchor,s,void 0,void 0,r)}eq(e,n=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!n||!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 Ae.range(e.anchor,e.head)}static create(e,n,r,s){return new Br(e,n,r,s)}}class Ae{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:Ae.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e,n=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(e.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Ae([this.main],0)}addRange(e,n=!0){return Ae.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,Ae.create(r,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 Ae(e.ranges.map(n=>Br.fromJSON(n)),e.main)}static single(e,n=e){return new Ae([Ae.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,s=0;s<e.length;s++){let a=e[s];if(a.empty?a.from<=r:a.from<r)return Ae.normalized(e.slice(),n);r=a.to}return new Ae(e,n)}static cursor(e,n=0,r,s){return Br.create(e,e,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r)),s)}static range(e,n,r,s,a){let c=s==null?7:Math.min(6,s);return!a&&e!=n&&(a=n<e?1:-1),a&&(c|=a<0?8:16),n<e?Br.create(n,e,c|32,r):Br.create(e,n,c,r)}static undirectionalRange(e,n){return Br.create(e,n,64,void 0)}static normalized(e,n=0){let r=e[n];e.sort((s,a)=>s.from-a.from),n=e.indexOf(r);for(let s=1;s<e.length;s++){let a=e[s],c=e[s-1];if(a.empty?a.from<=c.to:a.from<c.to){let u=c.from,f=Math.max(a.to,c.to);s<=n&&n--,e.splice(--s,2,a.anchor>a.head?Ae.range(f,u):Ae.range(u,f))}}return new Ae(e,n)}}function Dy(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}let Cf=0;class Ue{constructor(e,n,r,s,a){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=s,this.id=Cf++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new Ue(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Nf),!!e.static,e.enables)}of(e){return new Yo([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yo(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Yo(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}}function Nf(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}class Yo{constructor(e,n,r,s){this.dependencies=e,this.facet=n,this.type=r,this.value=s,this.id=Cf++}dynamicSlot(e){var n;let r=this.value,s=this.facet.compareInput,a=this.id,c=e[a]>>1,u=this.type==2,f=!1,h=!1,g=[];for(let b of this.dependencies)b=="doc"?f=!0:b=="selection"?h=!0:(((n=e[b.id])!==null&&n!==void 0?n:1)&1)==0&&g.push(e[b.id]);return{create(b){return b.values[c]=r(b),1},update(b,v){if(f&&v.docChanged||h&&(v.docChanged||v.selection)||Tf(b,g)){let w=r(b);if(u?!_y(w,b.values[c],s):!s(w,b.values[c]))return b.values[c]=w,1}return 0},reconfigure:(b,v)=>{let w,A=v.config.address[a];if(A!=null){let C=Jo(v,A);if(this.dependencies.every(O=>O instanceof Ue?v.facet(O)===b.facet(O):O instanceof $r?v.field(O,!1)==b.field(O,!1):!0)||(u?_y(w=r(b),C,s):s(w=r(b),C)))return b.values[c]=C,0}else w=r(b);return b.values[c]=w,1}}}get extension(){return this}}function _y(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function Tf(t,e){let n=!1;for(let r of e)ga(t,r)&1&&(n=!0);return n}function CN(t,e,n){let r=n.map(f=>t[f.id]),s=n.map(f=>f.type),a=r.filter(f=>!(f&1)),c=t[e.id]>>1;function u(f){let h=[];for(let g=0;g<r.length;g++){let b=Jo(f,r[g]);if(s[g]==2)for(let v of b)h.push(v);else h.push(b)}return e.combine(h)}return{create(f){for(let h of r)ga(f,h);return f.values[c]=u(f),1},update(f,h){if(!Tf(f,a))return 0;let g=u(f);return e.compare(g,f.values[c])?0:(f.values[c]=g,1)},reconfigure(f,h){let g=Tf(f,r),b=h.config.facets[e.id],v=h.facet(e);if(b&&!g&&Nf(n,b))return f.values[c]=v,0;let w=u(f);return e.compare(w,v)?(f.values[c]=v,0):(f.values[c]=w,1)}}}const Ko=Ue.define({static:!0});class $r{constructor(e,n,r,s,a){this.id=e,this.createF=n,this.updateF=r,this.compareF=s,this.spec=a,this.provides=void 0}static define(e){let n=new $r(Cf++,e.create,e.update,e.compare||((r,s)=>r===s),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(Ko).find(r=>r.field==this);return(n?.create||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,s)=>{let a=r.values[n],c=this.updateF(a,s);return this.compareF(a,c)?0:(r.values[n]=c,1)},reconfigure:(r,s)=>{let a=r.facet(Ko),c=s.facet(Ko),u;return(u=a.find(f=>f.field==this))&&u!=c.find(f=>f.field==this)?(r.values[n]=u.create(r),1):s.config.address[this.id]!=null?(r.values[n]=s.field(this),0):(r.values[n]=this.create(r),1)}}}init(e){return[this,Ko.of({field:this,create:e})]}get extension(){return this}}const Ts={lowest:4,low:3,default:2,high:1,highest:0};function ma(t){return e=>new Ly(e,t)}const Go={highest:ma(Ts.highest),high:ma(Ts.high),default:ma(Ts.default),low:ma(Ts.low),lowest:ma(Ts.lowest)};class Ly{constructor(e,n){this.inner=e,this.prec=n}get extension(){return this}}class nr{of(e){return new jf(this,e)}reconfigure(e){return nr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class jf{constructor(e,n){this.compartment=e,this.inner=n}get extension(){return this}}class Xo{constructor(e,n,r,s,a,c){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=s,this.staticValues=a,this.facets=c,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let s=[],a=Object.create(null),c=new Map;for(let v of NN(e,n,c))v instanceof $r?s.push(v):(a[v.facet.id]||(a[v.facet.id]=[])).push(v);let u=Object.create(null),f=[],h=[];for(let v of s)u[v.id]=h.length<<1,h.push(w=>v.slot(w));let g=r?.config.facets;for(let v in a){let w=a[v],A=w[0].facet,C=g&&g[v]||[];if(w.every(O=>O.type==0))if(u[A.id]=f.length<<1|1,Nf(C,w))f.push(r.facet(A));else{let O=A.combine(w.map(D=>D.value));f.push(r&&A.compare(O,r.facet(A))?r.facet(A):O)}else{for(let O of w)O.type==0?(u[O.id]=f.length<<1|1,f.push(O.value)):(u[O.id]=h.length<<1,h.push(D=>O.dynamicSlot(D)));u[A.id]=h.length<<1,h.push(O=>CN(O,A,w))}}let b=h.map(v=>v(u));return new Xo(e,c,b,u,f,a)}}function NN(t,e,n){let r=[[],[],[],[],[]],s=new Map;function a(c,u){let f=s.get(c);if(f!=null){if(f<=u)return;let h=r[f].indexOf(c);h>-1&&r[f].splice(h,1),c instanceof jf&&n.delete(c.compartment)}if(s.set(c,u),Array.isArray(c))for(let h of c)a(h,u);else if(c instanceof jf){if(n.has(c.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(c.compartment)||c.inner;n.set(c.compartment,h),a(h,u)}else if(c instanceof Ly)a(c.inner,c.prec);else if(c instanceof $r)r[u].push(c),c.provides&&a(c.provides,u);else if(c instanceof Yo)r[u].push(c),c.facet.extensions&&a(c.facet.extensions,Ts.default);else{let h=c.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${c}).`);if(h==c)throw new Error(`Unrecognized extension value in extension set (${c}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(h,u)}}return a(t,Ts.default),r.reduce((c,u)=>c.concat(u))}function ga(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let s=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|s}function Jo(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}const qy=Ue.define(),Ef=Ue.define({combine:t=>t.some(e=>e),static:!0}),By=Ue.define({combine:t=>t.length?t[0]:void 0,static:!0}),$y=Ue.define(),Iy=Ue.define(),Hy=Ue.define(),zy=Ue.define({combine:t=>t.length?t[0]:!1});class Ir{constructor(e,n){this.type=e,this.value=n}static define(){return new TN}}class TN{of(e){return new Ir(this,e)}}class jN{constructor(e){this.map=e}of(e){return new zt(this,e)}}class zt{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new zt(this.type,n)}is(e){return this.type==e}static define(e={}){return new jN(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let s of e){let a=s.map(n);a&&r.push(a)}return r}}zt.reconfigure=zt.define(),zt.appendConfig=zt.define();class tn{constructor(e,n,r,s,a,c){this.startState=e,this.changes=n,this.selection=r,this.effects=s,this.annotations=a,this.scrollIntoView=c,this._doc=null,this._state=null,r&&Dy(r,n.newLength),a.some(u=>u.type==tn.time)||(this.annotations=a.concat(tn.time.of(Date.now())))}static create(e,n,r,s,a,c){return new tn(e,n,r,s,a,c)}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 n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(tn.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}}tn.time=Ir.define(),tn.userEvent=Ir.define(),tn.addToHistory=Ir.define(),tn.remote=Ir.define();function EN(t,e){let n=[];for(let r=0,s=0;;){let a,c;if(r<t.length&&(s==e.length||e[s]>=t[r]))a=t[r++],c=t[r++];else if(s<e.length)a=e[s++],c=e[s++];else return n;!n.length||n[n.length-1]<a?n.push(a,c):n[n.length-1]<c&&(n[n.length-1]=c)}}function Uy(t,e,n){var r;let s,a,c;return n?(s=e.changes,a=en.empty(e.changes.length),c=t.changes.compose(e.changes)):(s=e.changes.map(t.changes),a=t.changes.mapDesc(e.changes,!0),c=t.changes.compose(s)),{changes:c,selection:e.selection?e.selection.map(a):(r=t.selection)===null||r===void 0?void 0:r.map(s),effects:zt.mapEffects(t.effects,s).concat(zt.mapEffects(e.effects,a)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function Of(t,e,n){let r=e.selection,s=sl(e.annotations);return e.userEvent&&(s=s.concat(tn.userEvent.of(e.userEvent))),{changes:e.changes instanceof en?e.changes:en.of(e.changes||[],n,t.facet(By)),selection:r&&(r instanceof Ae?r:Ae.single(r.anchor,r.head)),effects:sl(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function Vy(t,e,n){let r=Of(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(n=!1);let c=!!e[a].sequential;r=Uy(r,Of(t,e[a],c?r.changes.newLength:t.doc.length),c)}let s=tn.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return MN(n?ON(s):s)}function ON(t){let e=t.startState,n=!0;for(let s of e.facet($y)){let a=s(t);if(a===!1){n=!1;break}Array.isArray(a)&&(n=n===!0?a:EN(n,a))}if(n!==!0){let s,a;if(n===!1)a=t.changes.invertedDesc,s=en.empty(e.doc.length);else{let c=t.changes.filter(n);s=c.changes,a=c.filtered.mapDesc(c.changes).invertedDesc}t=tn.create(e,s,t.selection&&t.selection.map(a),zt.mapEffects(t.effects,a),t.annotations,t.scrollIntoView)}let r=e.facet(Iy);for(let s=r.length-1;s>=0;s--){let a=r[s](t);a instanceof tn?t=a:Array.isArray(a)&&a.length==1&&a[0]instanceof tn?t=a[0]:t=Vy(e,sl(a),!1)}return t}function MN(t){let e=t.startState,n=e.facet(Hy),r=t;for(let s=n.length-1;s>=0;s--){let a=n[s](t);a&&Object.keys(a).length&&(r=Uy(r,Of(e,a,t.changes.newLength),!0))}return r==t?t:tn.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}const RN=[];function sl(t){return t==null?RN:Array.isArray(t)?t:[t]}var ir=(function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t})(ir||(ir={}));const DN=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Mf;try{Mf=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function _N(t){if(Mf)return Mf.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||DN.test(n)))return!0}return!1}function LN(t){return e=>{if(!/\S/.test(e))return ir.Space;if(_N(e))return ir.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return ir.Word;return ir.Other}}class wt{constructor(e,n,r,s,a,c){this.config=e,this.doc=n,this.selection=r,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=a,c&&(c._state=this);for(let u=0;u<this.config.dynamicSlots.length;u++)ga(this,u<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return ga(this,r),Jo(this,r)}update(...e){return Vy(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:s}=n;for(let u of e.effects)u.is(nr.reconfigure)?(n&&(s=new Map,n.compartments.forEach((f,h)=>s.set(h,f)),n=null),s.set(u.value.compartment,u.value.extension)):u.is(zt.reconfigure)?(n=null,r=u.value):u.is(zt.appendConfig)&&(n=null,r=sl(r).concat(u.value));let a;n?a=e.startState.values.slice():(n=Xo.resolve(r,s,this),a=new wt(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(f,h)=>h.reconfigure(f,this),null).values);let c=e.startState.facet(Ef)?e.newSelection:e.newSelection.asSingle();new wt(n,e.newDoc,c,a,(u,f)=>f.update(u,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:Ae.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),s=this.changes(r.changes),a=[r.range],c=sl(r.effects);for(let u=1;u<n.ranges.length;u++){let f=e(n.ranges[u]),h=this.changes(f.changes),g=h.map(s);for(let v=0;v<u;v++)a[v]=a[v].map(g);let b=s.mapDesc(h,!0);a.push(f.range.map(b)),s=s.compose(g),c=zt.mapEffects(c,g).concat(zt.mapEffects(sl(f.effects),b))}return{changes:s,selection:Ae.create(a,n.mainIndex),effects:c}}changes(e=[]){return e instanceof en?e:en.of(e,this.doc.length,this.facet(wt.lineSeparator))}toText(e){return gt.of(e.split(this.facet(wt.lineSeparator)||Sf))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(ga(this,n),Jo(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let s=e[r];s instanceof $r&&this.config.address[s.id]!=null&&(n[r]=s.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(r){for(let a in r)if(Object.prototype.hasOwnProperty.call(e,a)){let c=r[a],u=e[a];s.push(c.init(f=>c.spec.fromJSON(u,f)))}}return wt.create({doc:e.doc,selection:Ae.fromJSON(e.selection),extensions:n.extensions?s.concat([n.extensions]):s})}static create(e={}){let n=Xo.resolve(e.extensions||[],new Map),r=e.doc instanceof gt?e.doc:gt.of((e.doc||"").split(n.staticFacet(wt.lineSeparator)||Sf)),s=e.selection?e.selection instanceof Ae?e.selection:Ae.single(e.selection.anchor,e.selection.head):Ae.single(0);return Dy(s,r.length),n.staticFacet(Ef)||(s=s.asSingle()),new wt(n,r,s,n.dynamicSlots.map(()=>null),(a,c)=>c.create(a),null)}get tabSize(){return this.facet(wt.tabSize)}get lineBreak(){return this.facet(wt.lineSeparator)||`
|
|
53
|
+
`}get readOnly(){return this.facet(zy)}phrase(e,...n){for(let r of this.facet(wt.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,s)=>{if(s=="$")return"$";let a=+(s||1);return!a||a>n.length?r:n[a-1]})),e}languageDataAt(e,n,r=-1){let s=[];for(let a of this.facet(qy))for(let c of a(this,n,r))Object.prototype.hasOwnProperty.call(c,e)&&s.push(c[e]);return s}charCategorizer(e){let n=this.languageDataAt("wordChars",e);return LN(n.length?n[0]:"")}wordAt(e){let{text:n,from:r,length:s}=this.doc.lineAt(e),a=this.charCategorizer(e),c=e-r,u=e-r;for(;c>0;){let f=An(n,c,!1);if(a(n.slice(f,c))!=ir.Word)break;c=f}for(;u<s;){let f=An(n,u);if(a(n.slice(u,f))!=ir.Word)break;u=f}return c==u?null:Ae.range(c+r,u+r)}}wt.allowMultipleSelections=Ef,wt.tabSize=Ue.define({combine:t=>t.length?t[0]:4}),wt.lineSeparator=By,wt.readOnly=zy,wt.phrases=Ue.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(s=>t[s]==e[s])}}),wt.languageData=qy,wt.changeFilter=$y,wt.transactionFilter=Iy,wt.transactionExtender=Hy,nr.reconfigure=zt.define();function Rf(t,e,n={}){let r={};for(let s of t)for(let a of Object.keys(s)){let c=s[a],u=r[a];if(u===void 0)r[a]=c;else if(!(u===c||c===void 0))if(Object.hasOwnProperty.call(n,a))r[a]=n[a](u,c);else throw new Error("Config merge conflict for field "+a)}for(let s in e)r[s]===void 0&&(r[s]=e[s]);return r}class js{eq(e){return this==e}range(e,n=e){return _f.create(e,n,this)}}js.prototype.startSide=js.prototype.endSide=0,js.prototype.point=!1,js.prototype.mapMode=Jn.TrackDel;function Df(t,e){return t==e||t.constructor==e.constructor&&t.eq(e)}let _f=class TA{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new TA(e,n,r)}};function Lf(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}class qf{constructor(e,n,r,s){this.from=e,this.to=n,this.value=r,this.maxPoint=s}get length(){return ll(this.to)}findIndex(e,n,r,s=0){let a=r?this.to:this.from;for(let c=s,u=a.length;;){if(c==u)return c;let f=c+u>>1,h=a[f]-e||(r?this.value[f].endSide:this.value[f].startSide)-n;if(f==c)return h>=0?c:u;h>=0?u=f:c=f+1}}between(e,n,r,s){for(let a=this.findIndex(n,-1e9,!0),c=this.findIndex(r,1e9,!1,a);a<c;a++)if(s(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,n,r,s,a){let c=[],u=[],f=[],h=-1,g=-1;e:for(let b=0;b<this.value.length;b++){let v=this.value[b],w=this.from[b]+e,A=this.to[b]+e,C,O;if(w==A){let D=n.mapPos(w,v.startSide,v.mapMode);if(D==null||(C=O=D,v.startSide!=v.endSide&&(O=n.mapPos(w,v.endSide),O<C)))continue}else if(C=n.mapPos(w,v.startSide),O=n.mapPos(A,v.endSide),C>O||C==O&&v.startSide>0&&v.endSide<=0)continue;if(!((O-C||v.endSide-v.startSide)<0))if(h<0&&(h=C),v.point&&(g=Math.max(g,O-C)),(C-r||v.startSide-s)>=0)c.push(v),u.push(C-h),f.push(O-h),r=O,s=v.endSide;else{if(C==O)for(let D=c.length;D>0;D--){if((C-(f[D-1]+h)||v.startSide-c[D-1].endSide)>=0){c.splice(D,0,v),u.splice(D,0,C-h),f.splice(D,0,O-h);continue e}if((C-(u[D-1]+h)||v.endSide-c[D-1].startSide)>0)break}a(C,O,v)}}return{mapped:c.length?new qf(u,f,c,g):null,pos:h}}}class mt{constructor(e,n,r,s){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=s}static create(e,n,r,s){return new mt(e,n,r,s)}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 n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:s=0,filterTo:a=this.length}=e,c=e.filter;if(n.length==0&&!c)return this;if(r&&(n=n.slice().sort(Lf)),this.isEmpty)return n.length?mt.of(n):this;let u=new Py(this,null,-1).goto(0),f=0,h=[],g=new ya;for(;u.value||f<n.length;)if(f<n.length&&(u.from-n[f].from||u.startSide-n[f].value.startSide)>=0){let b=n[f++];g.addInner(b.from,b.to,b.value,!1)||h.push(b)}else u.rangeIndex==1&&u.chunkIndex<this.chunk.length&&(f==n.length||this.chunkEnd(u.chunkIndex)<n[f].from)&&(!c||s>this.chunkEnd(u.chunkIndex)||a<this.chunkPos[u.chunkIndex])&&g.addChunk(this.chunkPos[u.chunkIndex],this.chunk[u.chunkIndex])?u.nextChunk():((!c||s>u.to||a<u.from||c(u.from,u.to,u.value))&&(g.addInner(u.from,u.to,u.value,!1)||h.push(_f.create(u.from,u.to,u.value))),u.next());return g.finishInner(this.nextLayer.isEmpty&&!h.length?mt.empty:this.nextLayer.update({add:h,filter:c,filterFrom:s,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],s=-1,a,c=(f,h,g)=>{a||(a=new ya),a.addRange(f,h,g,!1)};for(let f=0;f<this.chunk.length;f++){let h=this.chunkPos[f],g=this.chunk[f],b=e.touchesRange(h,h+g.length);if(b===!1)s=Math.max(s,g.maxPoint),n.push(g),r.push(e.mapPos(h));else if(b===!0){let[v,w]=n.length?[ll(r)+ll(n).length,ll(ll(n).value).endSide]:[-1,-1],{mapped:A,pos:C}=g.map(h,e,v,w,c);A&&(s=Math.max(s,A.maxPoint),n.push(A),r.push(C))}}let u=this.nextLayer.map(e);return a&&(u=a.finishInner(u)),n.length==0?u:new mt(r,n,u||mt.empty,s)}between(e,n,r){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let a=this.chunkPos[s],c=this.chunk[s];if(n>=a&&e<=a+c.length&&c.between(a,e-a,n-a,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return ba.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return ba.from(e).goto(n)}static compare(e,n,r,s,a=-1){let c=e.filter(b=>b.maxPoint>0||!b.isEmpty&&b.maxPoint>=a),u=n.filter(b=>b.maxPoint>0||!b.isEmpty&&b.maxPoint>=a),f=Fy(c,u,r),h=new xa(c,f,a),g=new xa(u,f,a);r.iterGaps((b,v,w)=>Yy(h,b,g,v,w,s)),r.empty&&r.length==0&&Yy(h,0,g,0,0,s)}static eq(e,n,r=0,s){s==null&&(s=999999999);let a=e.filter(g=>!g.isEmpty&&n.indexOf(g)<0),c=n.filter(g=>!g.isEmpty&&e.indexOf(g)<0);if(a.length!=c.length)return!1;if(!a.length)return!0;let u=Fy(a,c),f=new xa(a,u,0).goto(r),h=new xa(c,u,0).goto(r);for(;;){if(f.to!=h.to||!$f(f.active,h.active)||f.point&&(!h.point||!Df(f.point,h.point)))return!1;if(f.to>s)return!0;f.next(),h.next()}}static spans(e,n,r,s,a=-1){let c=new xa(e,null,a).goto(n),u=n,f=c.openStart;for(;;){let h=Math.min(c.to,r);if(c.point){let g=c.activeForPoint(c.to),b=c.pointFrom<n?g.length+1:c.point.startSide<0?g.length:Math.min(g.length,f);s.point(u,h,c.point,g,b,c.pointRank),f=Math.min(c.openEnd(h),g.length)}else h>u&&(s.span(u,h,c.active,f),f=c.openEnd(h));if(c.to>r)return f+(c.point&&c.to>r?1:0);u=c.to,c.next()}}static of(e,n=!1){let r=new ya;for(let s of e instanceof _f?[e]:n?qN(e):e)r.add(s.from,s.to,s.value);return r.finish()}static join(e){if(!e.length)return mt.empty;let n=ll(e);for(let r=e.length-2;r>=0;r--)for(let s=e[r];s!=mt.empty;s=s.nextLayer)n=new mt(s.chunkPos,s.chunk,n,Math.max(s.maxPoint,n.maxPoint));return n}}mt.empty=new mt([],[],null,-1);function ll(t){return t[t.length-1]}function qN(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Lf(e,r)>0)return t.slice().sort(Lf);e=r}return t}mt.empty.nextLayer=mt.empty;class ya{finishChunk(e){this.chunks.push(new qf(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,n,r){this.addRange(e,n,r,!0)}addRange(e,n,r,s){this.addInner(e,n,r,s)||(this.nextLayer||(this.nextLayer=new ya)).addRange(e,n,r,s)}addInner(e,n,r,s){let a=e-this.lastTo||r.startSide-this.last.endSide;if(s&&a<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return a<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(mt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=mt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}}function Fy(t,e,n){let r=new Map;for(let a of t)for(let c=0;c<a.chunk.length;c++)a.chunk[c].maxPoint<=0&&r.set(a.chunk[c],a.chunkPos[c]);let s=new Set;for(let a of e)for(let c=0;c<a.chunk.length;c++){let u=r.get(a.chunk[c]);u!=null&&(n?n.mapPos(u):u)==a.chunkPos[c]&&!n?.touchesRange(u,u+a.chunk[c].length)&&s.add(a.chunk[c])}return s}class Py{constructor(e,n,r,s=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=s}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!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],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.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 ba{constructor(e){this.heap=e}static from(e,n=null,r=-1){let s=[];for(let a=0;a<e.length;a++)for(let c=e[a];!c.isEmpty;c=c.nextLayer)c.maxPoint>=r&&s.push(new Py(c,n,r,a));return s.length==1?s[0]:new ba(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Bf(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)Bf(this.heap,r);(this.to-e||this.value.endSide-n)<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(),Bf(this.heap,0)}}}function Bf(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let s=t[r];if(r+1<t.length&&s.compare(t[r+1])>=0&&(s=t[r+1],r++),n.compare(s)<0)break;t[r]=n,t[e]=s,e=r}}class xa{constructor(e,n,r){this.minPoint=r,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=ba.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Qo(this.active,e),Qo(this.activeTo,e),Qo(this.activeRank,e),this.minActive=Ky(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:s,rank:a}=this.cursor;for(;n<this.activeRank.length&&(a-this.activeRank[n]||s-this.activeTo[n])>0;)n++;Wo(this.active,n,r),Wo(this.activeTo,n,s),Wo(this.activeRank,n,a),e&&Wo(e,n,this.cursor.from),this.minActive=Ky(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),r&&Qo(r,s)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let s=r.length-1;s>=0&&r[s]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}}function Yy(t,e,n,r,s,a){t.goto(e),n.goto(r);let c=r+s,u=r,f=r-e,h=!!a.boundChange;for(let g=!1;;){let b=t.to+f-n.to,v=b||t.endSide-n.endSide,w=v<0?t.to+f:n.to,A=Math.min(w,c);if(t.point||n.point?(t.point&&n.point&&Df(t.point,n.point)&&$f(t.activeForPoint(t.to),n.activeForPoint(n.to))||a.comparePoint(u,A,t.point,n.point),g=!1):(g&&a.boundChange(u),A>u&&!$f(t.active,n.active)&&a.compareRange(u,A,t.active,n.active),h&&A<c&&(b||t.openEnd(w)!=n.openEnd(w))&&(g=!0)),w>c)break;u=w,v<=0&&t.next(),v>=0&&n.next()}}function $f(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!Df(t[n],e[n]))return!1;return!0}function Qo(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Wo(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function Ky(t,e){let n=-1,r=1e9;for(let s=0;s<e.length;s++)(e[s]-r||t[s].endSide-t[n].endSide)<0&&(n=s,r=e[s]);return n}function Zo(t,e,n=t.length){let r=0;for(let s=0;s<n&&s<t.length;)t.charCodeAt(s)==9?(r+=e-r%e,s++):(r++,s=An(t,s));return r}function BN(t,e,n,r){for(let s=0,a=0;;){if(a>=e)return s;if(s==t.length)break;a+=t.charCodeAt(s)==9?n-a%n:1,s=An(t,s)}return t.length}const If="ͼ",Gy=typeof Symbol>"u"?"__"+If:Symbol.for(If),Hf=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Xy=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class al{constructor(e,n){this.rules=[];let{finish:r}=n||{};function s(c){return/^@/.test(c)?[c]:c.split(/,\s*/)}function a(c,u,f,h){let g=[],b=/^@(\w+)\b/.exec(c[0]),v=b&&b[1]=="keyframes";if(b&&u==null)return f.push(c[0]+";");for(let w in u){let A=u[w];if(/&/.test(w))a(w.split(/,\s*/).map(C=>c.map(O=>C.replace(/&/,O))).reduce((C,O)=>C.concat(O)),A,f);else if(A&&typeof A=="object"){if(!b)throw new RangeError("The value of a property ("+w+") should be a primitive value.");a(s(w),A,g,v)}else A!=null&&g.push(w.replace(/_.*/,"").replace(/[A-Z]/g,C=>"-"+C.toLowerCase())+": "+A+";")}(g.length||v)&&f.push((r&&!b&&!h?c.map(r):c).join(", ")+" {"+g.join(" ")+"}")}for(let c in e)a(s(c),e[c],this.rules)}getRules(){return this.rules.join(`
|
|
54
|
+
`)}static newName(){let e=Xy[Gy]||1;return Xy[Gy]=e+1,If+e.toString(36)}static mount(e,n,r){let s=e[Hf],a=r&&r.nonce;s?a&&s.setNonce(a):s=new $N(e,a),s.mount(Array.isArray(n)?n:[n],e)}}let Jy=new Map;class $N{constructor(e,n){let r=e.ownerDocument||e,s=r.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let a=Jy.get(r);if(a)return e[Hf]=a;this.sheet=new s.CSSStyleSheet,Jy.set(r,this)}else this.styleTag=r.createElement("style"),n&&this.styleTag.setAttribute("nonce",n);this.modules=[],e[Hf]=this}mount(e,n){let r=this.sheet,s=0,a=0;for(let c=0;c<e.length;c++){let u=e[c],f=this.modules.indexOf(u);if(f<a&&f>-1&&(this.modules.splice(f,1),a--,f=-1),f==-1){if(this.modules.splice(a++,0,u),r)for(let h=0;h<u.rules.length;h++)r.insertRule(u.rules[h],s++)}else{for(;a<f;)s+=this.modules[a++].rules.length;s+=u.rules.length,a++}}if(r)n.adoptedStyleSheets.indexOf(this.sheet)<0&&(n.adoptedStyleSheets=[this.sheet,...n.adoptedStyleSheets]);else{let c="";for(let f=0;f<this.modules.length;f++)c+=this.modules[f].getRules()+`
|
|
55
|
+
`;this.styleTag.textContent=c;let u=n.head||n;this.styleTag.parentNode!=u&&u.insertBefore(this.styleTag,u.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}for(var Hr={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:"'"},va={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},IN=typeof navigator<"u"&&/Mac/.test(navigator.platform),HN=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),cn=0;cn<10;cn++)Hr[48+cn]=Hr[96+cn]=String(cn);for(var cn=1;cn<=24;cn++)Hr[cn+111]="F"+cn;for(var cn=65;cn<=90;cn++)Hr[cn]=String.fromCharCode(cn+32),va[cn]=String.fromCharCode(cn);for(var zf in Hr)va.hasOwnProperty(zf)||(va[zf]=Hr[zf]);function zN(t){var e=IN&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||HN&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?va:Hr)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}let Mn=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},Uf=typeof document<"u"?document:{documentElement:{style:{}}};const Vf=/Edge\/(\d+)/.exec(Mn.userAgent),Qy=/MSIE \d/.test(Mn.userAgent),Ff=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Mn.userAgent),ec=!!(Qy||Ff||Vf),Wy=!ec&&/gecko\/(\d+)/i.test(Mn.userAgent),Pf=!ec&&/Chrome\/(\d+)/.exec(Mn.userAgent),Zy="webkitFontSmoothing"in Uf.documentElement.style,Yf=!ec&&/Apple Computer/.test(Mn.vendor),eb=Yf&&(/Mobile\/\w+/.test(Mn.userAgent)||Mn.maxTouchPoints>2);var Re={mac:eb||/Mac/.test(Mn.platform),windows:/Win/.test(Mn.platform),linux:/Linux|X11/.test(Mn.platform),ie:ec,ie_version:Qy?Uf.documentMode||6:Ff?+Ff[1]:Vf?+Vf[1]:0,gecko:Wy,gecko_version:Wy?+(/Firefox\/(\d+)/.exec(Mn.userAgent)||[0,0])[1]:0,chrome:!!Pf,chrome_version:Pf?+Pf[1]:0,ios:eb,android:/Android\b/.test(Mn.userAgent),webkit:Zy,webkit_version:Zy?+(/\bAppleWebKit\/(\d+)/.exec(Mn.userAgent)||[0,0])[1]:0,safari:Yf,safari_version:Yf?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Mn.userAgent)||[0,0])[1]:0,tabSize:Uf.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Kf(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}const tc=Object.create(null);function Gf(t,e,n){if(t==e)return!0;t||(t=tc),e||(e=tc);let r=Object.keys(t),s=Object.keys(e);if(r.length-0!=s.length-0)return!1;for(let a of r)if(a!=n&&(s.indexOf(a)==-1||t[a]!==e[a]))return!1;return!0}function UN(t,e){for(let n=t.attributes.length-1;n>=0;n--){let r=t.attributes[n].name;e[r]==null&&t.removeAttribute(r)}for(let n in e){let r=e[n];n=="style"?t.style.cssText=r:t.getAttribute(n)!=r&&t.setAttribute(n,r)}}function tb(t,e,n){let r=!1;if(e)for(let s in e)n&&s in n||(r=!0,s=="style"?t.style.cssText="":t.removeAttribute(s));if(n)for(let s in n)e&&e[s]==n[s]||(r=!0,s=="style"?t.style.cssText=n[s]:t.setAttribute(s,n[s]));return r}function VN(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}class nc{eq(e){return!1}updateDOM(e,n,r){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,n,r){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var un=(function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t})(un||(un={}));class rn extends js{constructor(e,n,r,s){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=s}get heightRelevant(){return!1}static mark(e){return new wa(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Es(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,s;if(e.isBlockGap)r=-5e8,s=4e8;else{let{start:a,end:c}=nb(e,n);r=(a?n?-3e8:-1:5e8)-1,s=(c?n?2e8:1:-6e8)+1}return new Es(e,r,s,n,e.widget||null,!0)}static line(e){return new Sa(e)}static set(e,n=!1){return mt.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}rn.none=mt.empty;class wa extends rn{constructor(e){let{start:n,end:r}=nb(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Kf(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||tc}eq(e){return this==e||e instanceof wa&&this.tagName==e.tagName&&Gf(this.attrs,e.attrs)}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}}wa.prototype.point=!1;class Sa extends rn{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Sa&&this.spec.class==e.spec.class&&Gf(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}}Sa.prototype.mapMode=Jn.TrackBefore,Sa.prototype.point=!0;class Es extends rn{constructor(e,n,r,s,a,c){super(n,r,a,e),this.block=s,this.isReplace=c,this.mapMode=s?n<=0?Jn.TrackBefore:Jn.TrackAfter:Jn.TrackDel}get type(){return this.startSide!=this.endSide?un.WidgetRange:this.startSide<=0?un.WidgetBefore:un.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Es&&FN(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}}Es.prototype.point=!0;function nb(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n??e,end:r??e}}function FN(t,e){return t==e||!!(t&&e&&t.compare(e))}function ol(t,e,n,r=0){let s=n.length-1;s>=0&&n[s]+r>=t?n[s]=Math.max(n[s],e):n.push(t,e)}class Aa extends js{constructor(e,n,r){super(),this.tagName=e,this.attributes=n,this.rank=r}eq(e){return e==this||e instanceof Aa&&this.tagName==e.tagName&&Gf(this.attributes,e.attributes)}static create(e){return new Aa(e.tagName,e.attributes||tc,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,n=!1){return mt.of(e,n)}}Aa.prototype.startSide=Aa.prototype.endSide=-1;function ka(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function Xf(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function Ca(t,e){if(!e.anchorNode)return!1;try{return Xf(t,e.anchorNode)}catch{return!1}}function ic(t){return t.nodeType==3?Ta(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Na(t,e,n,r){return n?ib(t,e,n,r,-1)||ib(t,e,n,r,1):!1}function zr(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function rc(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}function ib(t,e,n,r,s){for(;;){if(t==n&&e==r)return!0;if(e==(s<0?0:rr(t))){if(t.nodeName=="DIV")return!1;let a=t.parentNode;if(!a||a.nodeType!=1)return!1;e=zr(t)+(s<0?0:1),t=a}else if(t.nodeType==1){if(t=t.childNodes[e+(s<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=s<0?rr(t):0}else return!1}}function rr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function sc(t,e){let{left:n,right:r}=t;if(n==r)return t;let s=e?n:r;return{left:s,right:s,top:t.top,bottom:t.bottom}}function PN(t){let e=t.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function rb(t,e){let n=e.width/t.offsetWidth,r=e.height/t.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.width-t.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(e.height-t.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function YN(t,e,n,r,s,a,c,u){let f=t.ownerDocument,h=f.defaultView||window;for(let g=t,b=!1;g&&!b;)if(g.nodeType==1){let v,w=g==f.body,A=1,C=1;if(w)v=PN(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(g).position)&&(b=!0),g.scrollHeight<=g.clientHeight&&g.scrollWidth<=g.clientWidth){g=g.assignedSlot||g.parentNode;continue}let E=g.getBoundingClientRect();({scaleX:A,scaleY:C}=rb(g,E)),v={left:E.left,right:E.left+g.clientWidth*A,top:E.top,bottom:E.top+g.clientHeight*C}}let O=0,D=0;if(s=="nearest")e.top<v.top+c?(D=e.top-(v.top+c),n>0&&e.bottom>v.bottom+D&&(D=e.bottom-v.bottom+c)):e.bottom>v.bottom-c&&(D=e.bottom-v.bottom+c,n<0&&e.top-D<v.top&&(D=e.top-(v.top+c)));else{let E=e.bottom-e.top,j=v.bottom-v.top;D=(s=="center"&&E<=j?e.top+E/2-j/2:s=="start"||s=="center"&&n<0?e.top-c:e.bottom-j+c)-v.top}if(r=="nearest"?e.left<v.left+a?(O=e.left-(v.left+a),n>0&&e.right>v.right+O&&(O=e.right-v.right+a)):e.right>v.right-a&&(O=e.right-v.right+a,n<0&&e.left<v.left+O&&(O=e.left-(v.left+a))):O=(r=="center"?e.left+(e.right-e.left)/2-(v.right-v.left)/2:r=="start"==u?e.left-a:e.right-(v.right-v.left)+a)-v.left,O||D)if(w)h.scrollBy(O,D);else{let E=0,j=0;if(D){let M=g.scrollTop;g.scrollTop+=D/C,j=(g.scrollTop-M)*C}if(O){let M=g.scrollLeft;g.scrollLeft+=O/A,E=(g.scrollLeft-M)*A}e={left:e.left-E,top:e.top-j,right:e.right-E,bottom:e.bottom-j},E&&Math.abs(E-O)<1&&(r="nearest"),j&&Math.abs(j-D)<1&&(s="nearest")}if(w)break;(e.top<v.top||e.bottom>v.bottom||e.left<v.left||e.right>v.right)&&(e={left:Math.max(e.left,v.left),right:Math.min(e.right,v.right),top:Math.max(e.top,v.top),bottom:Math.min(e.bottom,v.bottom)}),g=g.assignedSlot||g.parentNode}else if(g.nodeType==11)g=g.host;else break}function sb(t,e=!0){let n=t.ownerDocument,r=null,s=null;for(let a=t.parentNode;a&&!(a==n.body||(!e||r)&&s);)if(a.nodeType==1)!s&&a.scrollHeight>a.clientHeight&&(s=a),e&&!r&&a.scrollWidth>a.clientWidth&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:s}}class KN{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:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?rr(n):0),r,Math.min(e.focusOffset,r?rr(r):0))}set(e,n,r,s){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=s}}function lb(t){let e=[];for(let n=t;n;n=n.nodeType==11?n.host:n.parentNode)n.nodeType==1&&e.push({node:n,left:n.scrollLeft,top:n.scrollTop});return e}function ab(t,e=!0){for(let{node:n,left:r,top:s}of t)e&&n.scrollTop!=s&&(n.scrollTop=s),n.scrollLeft!=r&&(n.scrollLeft=r)}let Os=null;Re.safari&&Re.safari_version>=26&&(Os=!1);function ob(t){if(t.setActive)return t.setActive();if(Os)return t.focus(Os);let e=lb(t);t.focus(Os==null?{get preventScroll(){return Os={preventScroll:!0},!0}}:void 0),Os||(Os=!1,ab(e))}let cb;function Ta(t,e,n=e){let r=cb||(cb=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function cl(t,e,n,r){let s={key:e,code:e,keyCode:n,which:n,cancelable:!0};r&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=r);let a=new KeyboardEvent("keydown",s);a.synthetic=!0,t.dispatchEvent(a);let c=new KeyboardEvent("keyup",s);return c.synthetic=!0,t.dispatchEvent(c),a.defaultPrevented||c.defaultPrevented}function GN(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function XN(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,rr(n));;)if(r){if(n.nodeType!=1)return!1;let s=n.childNodes[r-1];s.contentEditable=="false"?r--:(n=s,r=rr(n))}else{if(n==t)return!0;r=zr(n),n=n.parentNode}}function ub(t){return t instanceof Window?t.pageYOffset>Math.max(0,t.document.documentElement.scrollHeight-t.innerHeight-4):t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}function db(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r>0)return{node:n,offset:r};if(n.nodeType==1&&r>0){if(n.contentEditable=="false")return null;n=n.childNodes[r-1],r=rr(n)}else if(n.parentNode&&!rc(n))r=zr(n),n=n.parentNode;else return null}}function fb(t,e){for(let n=t,r=e;;){if(n.nodeType==3&&r<n.nodeValue.length)return{node:n,offset:r};if(n.nodeType==1&&r<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!rc(n))r=zr(n)+1,n=n.parentNode;else return null}}class Oi{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new Oi(e.parentNode,zr(e),n)}static after(e,n){return new Oi(e.parentNode,zr(e)+1,n)}}var Lt=(function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t})(Lt||(Lt={}));const Ms=Lt.LTR,Jf=Lt.RTL;function hb(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}const JN=hb("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),QN=hb("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Qf=Object.create(null),Vi=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Qf[e]=n,Qf[n]=-e}function pb(t){return t<=247?JN[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?QN[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8204?256:64336<=t&&t<=65023?4:1}const WN=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class Fi{get dir(){return this.level%2?Jf:Ms}constructor(e,n,r){this.from=e,this.to=n,this.level=r}side(e,n){return this.dir==n==e?this.to:this.from}forward(e,n){return e==(this.dir==n)}static find(e,n,r,s){let a=-1;for(let c=0;c<e.length;c++){let u=e[c];if(u.from<=n&&u.to>=n){if(u.level==r)return c;(a<0||(s!=0?s<0?u.from<n:u.to>n:e[a].level>u.level))&&(a=c)}}if(a<0)throw new RangeError("Index out of range");return a}}function mb(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++){let r=t[n],s=e[n];if(r.from!=s.from||r.to!=s.to||r.direction!=s.direction||!mb(r.inner,s.inner))return!1}return!0}const jt=[];function ZN(t,e,n,r,s){for(let a=0;a<=r.length;a++){let c=a?r[a-1].to:e,u=a<r.length?r[a].from:n,f=a?256:s;for(let h=c,g=f,b=f;h<u;h++){let v=pb(t.charCodeAt(h));v==512?v=g:v==8&&b==4&&(v=16),jt[h]=v==4?2:v,v&7&&(b=v),g=v}for(let h=c,g=f,b=f;h<u;h++){let v=jt[h];if(v==128)h<u-1&&g==jt[h+1]&&g&24?v=jt[h]=g:jt[h]=256;else if(v==64){let w=h+1;for(;w<u&&jt[w]==64;)w++;let A=h&&g==8||w<n&&jt[w]==8?b==1?1:8:256;for(let C=h;C<w;C++)jt[C]=A;h=w-1}else v==8&&b==1&&(jt[h]=1);g=v,v&7&&(b=v)}}}function eT(t,e,n,r,s){let a=s==1?2:1;for(let c=0,u=0,f=0;c<=r.length;c++){let h=c?r[c-1].to:e,g=c<r.length?r[c].from:n;for(let b=h,v,w,A;b<g;b++)if(w=Qf[v=t.charCodeAt(b)])if(w<0){for(let C=u-3;C>=0;C-=3)if(Vi[C+1]==-w){let O=Vi[C+2],D=O&2?s:O&4?O&1?a:s:0;D&&(jt[b]=jt[Vi[C]]=D),u=C;break}}else{if(Vi.length==189)break;Vi[u++]=b,Vi[u++]=v,Vi[u++]=f}else if((A=jt[b])==2||A==1){let C=A==s;f=C?0:1;for(let O=u-3;O>=0;O-=3){let D=Vi[O+2];if(D&2)break;if(C)Vi[O+2]|=2;else{if(D&4)break;Vi[O+2]|=4}}}}}function tT(t,e,n,r){for(let s=0,a=r;s<=n.length;s++){let c=s?n[s-1].to:t,u=s<n.length?n[s].from:e;for(let f=c;f<u;){let h=jt[f];if(h==256){let g=f+1;for(;;)if(g==u){if(s==n.length)break;g=n[s++].to,u=s<n.length?n[s].from:e}else if(jt[g]==256)g++;else break;let b=a==1,v=(g<e?jt[g]:r)==1,w=b==v?b?1:2:r;for(let A=g,C=s,O=C?n[C-1].to:t;A>f;)A==O&&(A=n[--C].from,O=C?n[C-1].to:t),jt[--A]=w;f=g}else a=h,f++}}}function Wf(t,e,n,r,s,a,c){let u=r%2?2:1;if(r%2==s%2)for(let f=e,h=0;f<n;){let g=!0,b=!1;if(h==a.length||f<a[h].from){let C=jt[f];C!=u&&(g=!1,b=C==16)}let v=!g&&u==1?[]:null,w=g?r:r+1,A=f;e:for(;;)if(h<a.length&&A==a[h].from){if(b)break e;let C=a[h];if(!g)for(let O=C.to,D=h+1;;){if(O==n)break e;if(D<a.length&&a[D].from==O)O=a[D++].to;else{if(jt[O]==u)break e;break}}if(h++,v)v.push(C);else{C.from>f&&c.push(new Fi(f,C.from,w));let O=C.direction==Ms!=!(w%2);Zf(t,O?r+1:r,s,C.inner,C.from,C.to,c),f=C.to}A=C.to}else{if(A==n||(g?jt[A]!=u:jt[A]==u))break;A++}v?Wf(t,f,A,r+1,s,v,c):f<A&&c.push(new Fi(f,A,w)),f=A}else for(let f=n,h=a.length;f>e;){let g=!0,b=!1;if(!h||f>a[h-1].to){let C=jt[f-1];C!=u&&(g=!1,b=C==16)}let v=!g&&u==1?[]:null,w=g?r:r+1,A=f;e:for(;;)if(h&&A==a[h-1].to){if(b)break e;let C=a[--h];if(!g)for(let O=C.from,D=h;;){if(O==e)break e;if(D&&a[D-1].to==O)O=a[--D].from;else{if(jt[O-1]==u)break e;break}}if(v)v.push(C);else{C.to<f&&c.push(new Fi(C.to,f,w));let O=C.direction==Ms!=!(w%2);Zf(t,O?r+1:r,s,C.inner,C.from,C.to,c),f=C.from}A=C.from}else{if(A==e||(g?jt[A-1]!=u:jt[A-1]==u))break;A--}v?Wf(t,A,f,r+1,s,v,c):A<f&&c.push(new Fi(A,f,w)),f=A}}function Zf(t,e,n,r,s,a,c){let u=e%2?2:1;ZN(t,s,a,r,u),eT(t,s,a,r,u),tT(s,a,r,u),Wf(t,s,a,e,n,r,c)}function nT(t,e,n){if(!t)return[new Fi(0,0,e==Jf?1:0)];if(e==Ms&&!n.length&&!WN.test(t))return gb(t.length);if(n.length)for(;t.length>jt.length;)jt[jt.length]=256;let r=[],s=e==Ms?0:1;return Zf(t,s,s,n,0,t.length,r),r}function gb(t){return[new Fi(0,t,0)]}let yb="";function iT(t,e,n,r,s){var a;let c=r.head-t.from,u=Fi.find(e,c,(a=r.bidiLevel)!==null&&a!==void 0?a:-1,r.assoc),f=e[u],h=f.side(s,n);if(c==h){let v=u+=s?1:-1;if(v<0||v>=e.length)return null;f=e[u=v],c=f.side(!s,n),h=f.side(s,n)}let g=An(t.text,c,f.forward(s,n));(g<f.from||g>f.to)&&(g=h),yb=t.text.slice(Math.min(c,g),Math.max(c,g));let b=u==(s?e.length-1:0)?null:e[u+(s?1:-1)];return b&&g==h&&b.level+(s?0:1)<f.level?Ae.cursor(b.side(!s,n)+t.from,b.forward(s,n)?1:-1,b.level):Ae.cursor(g+t.from,f.forward(s,n)?-1:1,f.level)}function rT(t,e,n){for(let r=e;r<n;r++){let s=pb(t.charCodeAt(r));if(s==1)return Ms;if(s==2||s==4)return Jf}return Ms}const bb=Ue.define(),xb=Ue.define(),vb=Ue.define(),wb=Ue.define(),eh=Ue.define(),Sb=Ue.define(),Ab=Ue.define(),th=Ue.define(),nh=Ue.define(),kb=Ue.define({combine:t=>t.some(e=>e)}),Cb=Ue.define({combine:t=>t.some(e=>e)}),Nb=Ue.define();class ul{constructor(e,n,r,s,a,c=!1){this.range=e,this.y=n,this.x=r,this.yMargin=s,this.xMargin=a,this.isSnapshot=c}map(e){return e.empty?this:new ul(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 ul(Ae.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const lc=zt.define({map:(t,e)=>t.map(e)}),Tb=zt.define();function Pi(t,e,n){let r=t.facet(wb);r.length?r[0](e):window.onerror&&window.onerror(String(e),n,void 0,void 0,e)||(n?console.error(n+":",e):console.error(e))}const sr=Ue.define({combine:t=>t.length?t[0]:!0});let sT=0;const dl=Ue.define({combine(t){return t.filter((e,n)=>{for(let r=0;r<n;r++)if(t[r].plugin==e.plugin)return!1;return!0})}});class lr{constructor(e,n,r,s,a){this.id=e,this.create=n,this.domEventHandlers=r,this.domEventObservers=s,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(dl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(dl.of({plugin:this,arg:e}))}static define(e,n){const{eventHandlers:r,eventObservers:s,provide:a,decorations:c}=n||{};return new lr(sT++,e,r,s,u=>{let f=[];return c&&f.push(ac.of(h=>{let g=h.plugin(u);return g?c(g):rn.none})),a&&f.push(a(u)),f})}static fromClass(e,n){return lr.define((r,s)=>new e(r,s),n)}}class ih{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 n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Pi(n.state,r,"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(n){Pi(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Pi(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const jb=Ue.define(),rh=Ue.define(),ac=Ue.define(),Eb=Ue.define(),sh=Ue.define(),ja=Ue.define(),Ob=Ue.define();function Mb(t,e){let n=t.state.facet(Ob);if(!n.length)return n;let r=n.map(a=>a instanceof Function?a(t):a),s=[];return mt.spans(r,e.from,e.to,{point(){},span(a,c,u,f){let h=a-e.from,g=c-e.from,b=s;for(let v=u.length-1;v>=0;v--,f--){let w=u[v].spec.bidiIsolate,A;if(w==null&&(w=rT(e.text,h,g)),f>0&&b.length&&(A=b[b.length-1]).to==h&&A.direction==w)A.to=g,b=A.inner;else{let C={from:h,to:g,direction:w,inner:[]};b.push(C),b=C.inner}}}}),s}const Rb=Ue.define();function Db(t){let e=0,n=0,r=0,s=0;for(let a of t.state.facet(Rb)){let c=a(t);c&&(c.left!=null&&(e=Math.max(e,c.left)),c.right!=null&&(n=Math.max(n,c.right)),c.top!=null&&(r=Math.max(r,c.top)),c.bottom!=null&&(s=Math.max(s,c.bottom)))}return{left:e,right:n,top:r,bottom:s}}const Ea=Ue.define();class di{constructor(e,n,r,s){this.fromA=e,this.toA=n,this.fromB=r,this.toB=s}join(e){return new di(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 n=e.length,r=this;for(;n>0;n--){let s=e[n-1];if(!(s.fromA>r.toA)){if(s.toA<r.fromA)break;r=r.join(s),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let s=0,a=0,c=0;;){let u=s<e.length?e[s].fromB:1e9,f=a<n.length?n[a]:1e9,h=Math.min(u,f);if(h==1e9)break;let g=h+c,b=h,v=g;for(;;)if(a<n.length&&n[a]<=b){let w=n[a+1];a+=2,b=Math.max(b,w);for(let A=s;A<e.length&&e[A].fromB<=b;A++)c=e[A].toA-e[A].toB;v=Math.max(v,w+c)}else if(s<e.length&&e[s].fromB<=b){let w=e[s++];b=Math.max(b,w.toB),v=Math.max(v,w.toA),c=w.toA-w.toB}else break;r.push(new di(g,v,h,b))}return r}}class oc{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=en.empty(this.startState.doc.length);for(let a of r)this.changes=this.changes.compose(a.changes);let s=[];this.changes.iterChangedRanges((a,c,u,f)=>s.push(new di(a,c,u,f))),this.changedRanges=s}static create(e,n,r){return new oc(e,n,r)}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 lT=[];class Bt{constructor(e,n,r=0){this.dom=e,this.length=n,this.flags=r,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return lT}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 n=this.domAttrs;n&&UN(this.dom,n)}}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,n=this.posAtStart){let r=n;for(let s of this.children){if(s==e)return r;r+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,n,r){return null}domPosFor(e,n){let r=zr(this.dom),s=this.length?e>0:n>0;return new Oi(this.parent.dom,r+(s?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 uc)return e;return null}static get(e){return e.cmTile}}class cc extends Bt{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 n=this.dom,r=null,s,a=e?.node==n?e:null,c=0;for(let u of this.children){if(u.sync(e),c+=u.length+u.breakAfter,s=r?r.nextSibling:n.firstChild,a&&s!=u.dom&&(a.written=!0),u.dom.parentNode==n)for(;s&&s!=u.dom;)s=_b(s);else n.insertBefore(u.dom,s);r=u.dom}for(s=r?r.nextSibling:n.firstChild,a&&s&&(a.written=!0);s;)s=_b(s);this.length=c}}function _b(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class uc extends cc{constructor(e,n){super(n),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 n=Bt.get(e);if(n&&this.owns(n))return n;e=e.parentNode}}blockTiles(e){for(let n=[],r=this,s=0,a=0;;)if(s==r.children.length){if(!n.length)return;r=r.parent,r.breakAfter&&a++,s=n.pop()}else{let c=r.children[s++];if(c instanceof ar)n.push(s),r=c,s=0;else{let u=a+c.length,f=e(c,a);if(f!==void 0)return f;a=u+c.breakAfter}}}resolveBlock(e,n){let r,s=-1,a,c=-1;if(this.blockTiles((u,f)=>{let h=f+u.length;if(e>=f&&e<=h){if(u.isWidget()&&n>=-1&&n<=1){if(u.flags&32)return!0;u.flags&16&&(r=void 0)}(f<e||e==h&&(n<-1?u.length:u.covers(1)))&&(!r||!u.isWidget()&&r.isWidget())&&(r=u,s=e-f),(h>e||e==f&&(n>1?u.length:u.covers(-1)))&&(!a||!u.isWidget()&&a.isWidget())&&(a=u,c=e-f)}}),!r&&!a)throw new Error("No tile at position "+e);return r&&n<0||!a?{tile:r,offset:s}:{tile:a,offset:c}}}class ar extends cc{constructor(e,n){super(e),this.wrapper=n}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,n){let r=new ar(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class fl extends cc{constructor(e,n){super(e),this.attrs=n}isLine(){return!0}static start(e,n,r){let s=new fl(n||document.createElement("div"),e);return(!n||!r)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,n,r){let s=null,a=-1,c=null,u=-1;function f(g,b){for(let v=0,w=0;v<g.children.length&&w<=b;v++){let A=g.children[v],C=w+A.length;C>=b&&(A.isComposite()?f(A,b-w):(!c||c.isHidden&&(n>0&&!(c.flags&32)||r&&oT(c,A)))&&(C>b||A.flags&32&&n<=1)?(c=A,u=b-w):(w<b||A.flags&16&&!A.isHidden&&n>=-1)&&(s=A,a=b-w)),w=C}}f(this,e);let h=(n<0?s:c)||s||c;return h?{tile:h,offset:h==s?a:u}:null}coordsIn(e,n,r){let s=this.resolveInline(e,n,!0);return s?s.tile.coordsIn(Math.max(0,s.offset),n,r):aT(this)}domIn(e,n){let r=this.resolveInline(e,n);if(r){let{tile:s,offset:a}=r;if(this.dom.contains(s.dom))return s.isText()?new Oi(s.dom,Math.min(s.dom.nodeValue.length,a)):s.domPosFor(a,s.flags&16?1:s.flags&32?-1:n);let c=r.tile.parent,u=!1;for(let f of c.children){if(u)return new Oi(f.dom,0);f==r.tile&&(u=!0)}}return new Oi(this.dom,0)}}function aT(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=ic(e);return n[n.length-1]||null}function oT(t,e){let n=t.coordsIn(0,1),r=e.coordsIn(0,1);return n&&r&&r.top<n.bottom}class In extends cc{constructor(e,n){super(e),this.mark=n}get domAttrs(){return this.mark.attrs}static of(e,n){let r=new In(n||document.createElement(e.tagName),e);return n||(r.flags|=4),r}}class Rs extends Bt{constructor(e,n){super(e,n.length),this.text=n}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,n,r){let s=this.dom.nodeValue.length;e>s&&(e=s);let a=e,c=e,u=0;e==0&&n<0||e==s&&n>=0?Re.chrome||Re.gecko||(e?(a--,u=1):c<s&&(c++,u=-1)):n<0?a--:c<s&&c++;let f=Ta(this.dom,a,c).getClientRects();if(!f.length)return null;let h=f[(u?u<0:n>=0)?0:f.length-1];return Re.safari&&!u&&h.width==0&&(h=Array.prototype.find.call(f,g=>g.width)||h),r==null?h:sc(h,(u?u>0:n<0)==r)}static of(e,n){let r=new Rs(n||document.createTextNode(e),e);return n||(r.flags|=2),r}}class Ds extends Bt{constructor(e,n,r,s){super(e,n,s),this.widget=r}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,n){return this.coordsInWidget(e,n,!1)}coordsInWidget(e,n,r){let s=this.widget.coordsAt(this.dom,e,n);if(s)return s;if(r)return sc(this.dom.getBoundingClientRect(),this.length?e==0:n<=0);{let a=this.dom.getClientRects(),c=null;if(!a.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?a.length-1:0;c=a[f],!(e>0?f==0:f==a.length-1||c.top<c.bottom);f+=u?-1:1);return sc(c,!u)}}get overrideDOMText(){if(!this.length)return gt.empty;let{root:e}=this;if(!e)return gt.empty;let n=this.posAtStart;return e.view.state.doc.slice(n,n+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,n,r,s,a){return a||(a=e.toDOM(n),e.editable||(a.contentEditable="false")),new Ds(a,r,e,s)}}class dc extends Bt{constructor(e){let n=document.createElement("img");n.className="cm-widgetBuffer",n.setAttribute("aria-hidden","true"),super(n,0,e)}get isHidden(){return!0}get overrideDOMText(){return gt.empty}coordsIn(e,n,r){let s=this.dom.getBoundingClientRect();return r==null?s:sc(s,n>0==r)}}class cT{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,n,r){let{tile:s,index:a,beforeBreak:c,parents:u}=this;for(;e||n>0;)if(s.isComposite())if(c){if(!e)break;r&&r.break(),e--,c=!1}else if(a==s.children.length){if(!e&&!u.length)break;r&&r.leave(s),c=!!s.breakAfter,{tile:s,index:a}=u.pop(),a++}else{let f=s.children[a],h=f.breakAfter;(n>0?f.length<=e:f.length<e)&&(!r||r.skip(f,0,f.length)!==!1||!f.isComposite)?(c=!!h,a++,e-=f.length):(u.push({tile:s,index:a}),s=f,a=0,r&&f.isComposite()&&r.enter(f))}else{let f=s.length;if(a<f&&e){let h=Math.min(e,f-a);r&&r.skip(s,a,a+h),e-=h,a+=h}if(a==f)c=!!s.breakAfter,{tile:s,index:a}=u.pop(),a++;else if(!e)break}return this.tile=s,this.index=a,this.beforeBreak=c,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class uT{constructor(e,n,r,s){this.from=e,this.to=n,this.wrapper=r,this.rank=s}}class dT{constructor(e,n,r){this.cache=e,this.root=n,this.blockWrappers=r,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,n,r,s){var a;this.flushBuffer();let c=this.ensureMarks(n,r),u=c.lastChild;if(u&&u.isText()&&!(u.flags&8)&&u.length+e.length<512){this.cache.reused.set(u,2);let f=c.children[c.children.length-1]=new Rs(u.dom,u.text+e);f.parent=c}else c.append(s||Rs.of(e,(a=this.cache.find(Rs))===null||a===void 0?void 0:a.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,n){let r=this.curLine;r.dom!=n.line.dom&&(r.setDOM(this.cache.reused.has(n.line)?lh(n.line.dom):n.line.dom),this.cache.reused.set(n.line,2));let s=r;for(let u=n.marks.length-1;u>=0;u--){let f=n.marks[u],h=s.lastChild;if(h instanceof In&&h.mark.eq(f.mark))h.dom!=f.dom&&h.setDOM(lh(f.dom)),s=h;else{if(this.cache.reused.get(f)){let b=Bt.get(f.dom);b&&b.setDOM(lh(f.dom))}let g=In.of(f.mark,f.dom);s.append(g),s=g}this.cache.reused.set(f,2)}let a=Bt.get(e.text);a&&this.cache.reused.set(a,2);let c=new Rs(e.text,e.text.nodeValue);c.flags|=8,this.pos=e.range.toB,s.append(c)}addInlineWidget(e,n,r){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let a=this.ensureMarks(n,r);!s&&!(e.flags&16)&&a.append(this.getBuffer(1)),a.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,n,r){this.flushBuffer(),this.ensureMarks(n,r).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 n=this.afterWidget||this.lastBlock;n.length+=e,this.pos+=e}addLineStart(e,n){var r;e||(e=qb);let s=fl.start(e,n||((r=this.cache.find(fl))===null||r===void 0?void 0:r.dom),!!n);this.getBlockPos().append(this.lastBlock=this.curLine=s)}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,n){var r;let s=this.curLine;for(let a=e.length-1;a>=0;a--){let c=e[a],u;if(n>0&&(u=s.lastChild)&&u instanceof In&&u.mark.eq(c))s=u,n--;else{let f=In.of(c,(r=this.cache.find(In,h=>h.mark.eq(c)))===null||r===void 0?void 0:r.dom);s.append(f),s=f,n=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Lb(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Re.ios&&Lb(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(ah,0,32)||new Ds(ah.toDOM(),0,ah,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 n=e.rank*102+e.value.rank,r=new uT(e.from,e.to,e.value,n),s=this.wrappers.length;for(;s>0&&(this.wrappers[s-1].rank-r.rank||this.wrappers[s-1].to-r.to)<0;)s--;this.wrappers.splice(s,0,r)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let n=this.root;for(let r of this.wrappers){let s=n.lastChild;if(r.from<this.pos&&s instanceof ar&&s.wrapper.eq(r.wrapper))n=s;else{let a=ar.of(r.wrapper,(e=this.cache.find(ar,c=>c.wrapper.eq(r.wrapper)))===null||e===void 0?void 0:e.dom);n.append(a),n=a}}return n}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let n=2|(e<0?16:32),r=this.cache.find(dc,void 0,1);return r&&(r.flags=n),r||new dc(n)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class fT{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:s,lineBreak:a,done:c}=this.cursor.next(this.skipCount);if(this.skipCount=0,c)throw new Error("Ran out of text content when drawing inline views");this.text=s;let u=this.textOff=Math.min(e,s.length);return a?null:s.slice(0,u)}let n=Math.min(this.text.length,this.textOff+e),r=this.text.slice(this.textOff,n);return this.textOff=n,r}}const fc=[Ds,fl,Rs,In,dc,ar,uc];for(let t=0;t<fc.length;t++)fc[t].bucket=t;class hT{constructor(e){this.view=e,this.buckets=fc.map(()=>[]),this.index=fc.map(()=>0),this.reused=new Map}add(e){let n=e.constructor.bucket,r=this.buckets[n];r.length<6?r.push(e):r[this.index[n]=(this.index[n]+1)%6]=e}find(e,n,r=2){let s=e.bucket,a=this.buckets[s],c=this.index[s];for(let u=0;u<a.length;u++){let f=(u+c)%a.length,h=a[f];if((!n||n(h))&&!this.reused.has(h))return a.splice(f,1),f<c&&this.index[s]--,this.reused.set(h,r),h}return null}findWidget(e,n,r){let s=this.buckets[0];if(s.length)for(let a=0,c=0;;a++){if(a==s.length){if(c)return null;c=1,a=0}let u=s[a];if(!this.reused.has(u)&&(c==0?u.widget.compare(e):u.widget.constructor==e.constructor&&e.updateDOM(u.dom,this.view,u.widget)))return s.splice(a,1),a<this.index[0]&&this.index[0]--,u.widget==e&&u.length==n&&(u.flags&497)==r?(this.reused.set(u,1),u):(this.reused.set(u,2),new Ds(u.dom,n,e,u.flags&-498|r))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,n=2){if(!this.reused.has(e))return this.reused.set(e,n),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class pT{constructor(e,n,r,s,a){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new hT(e),this.text=new fT(e.state.doc),this.builder=new dT(this.cache,new uc(e,e.contentDOM),mt.iter(r)),this.cache.reused.set(n,2),this.old=new cT(n),this.reuseWalker={skip:(c,u,f)=>{if(this.cache.add(c),c.isComposite())return!1},enter:c=>this.cache.add(c),leave:()=>{},break:()=>{}}}run(e,n){let r=n&&this.getCompositionContext(n.text);for(let s=0,a=0,c=0;;){let u=c<e.length?e[c++]:null,f=u?u.fromA:this.old.root.length;if(f>s){let h=f-s;this.preserve(h,!c,!u),s=f,a+=h}if(!u)break;n&&u.fromA<=n.range.fromA&&u.toA>=n.range.toA?(this.forward(u.fromA,n.range.fromA,n.range.fromA<n.range.toA?1:-1),this.emit(a,n.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(n,r),this.text.skip(n.range.toB-n.range.fromB),this.forward(n.range.fromA,u.toA),this.emit(n.range.toB,u.toB)):(this.forward(u.fromA,u.toA),this.emit(a,u.toB)),a=u.toB,s=u.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,n,r){let s=yT(this.old),a=this.openMarks;this.old.advance(e,r?1:-1,{skip:(c,u,f)=>{if(c.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let h=f>0||u<c.length?Ds.of(c.widget,this.view,f-u,c.flags&496,this.cache.maybeReuse(c)):this.cache.reuse(c);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,s,a),a=s.length)}else if(c.isText())this.builder.ensureLine(null),!u&&f==c.length&&!this.cache.reused.has(c)?this.builder.addText(c.text,s,a,this.cache.reuse(c)):(this.cache.add(c),this.builder.addText(c.text.slice(u,f),s,a)),a=s.length;else if(c.isLine())c.flags&=-2,this.cache.reused.set(c,1),this.builder.addLine(c);else if(c instanceof dc)this.cache.add(c);else if(c instanceof In)this.builder.ensureLine(null),this.builder.addMark(c,s,a),this.cache.reused.set(c,1),a=s.length;else return!1;this.openWidget=!1},enter:c=>{c.isLine()?this.builder.addLineStart(c.attrs,this.cache.maybeReuse(c)):(this.cache.add(c),c instanceof In&&s.unshift(c.mark)),this.openWidget=!1},leave:c=>{c.isLine()?s.length&&(s.length=a=0):c instanceof In&&(s.shift(),a=Math.min(a,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,n){let r=null,s=this.builder,a=-1,c=mt.spans(this.decorations,e,n,{point:(u,f,h,g,b,v)=>{if(h instanceof Es){if(this.disallowBlockEffectsFor[v]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(f>this.view.state.doc.lineAt(u).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=g.length,b>g.length)s.continueWidget(f-u);else{let w=h.widget||(h.block?hl.block:hl.inline),A=mT(h),C=this.cache.findWidget(w,f-u,A)||Ds.of(w,this.view,f-u,A);h.block?(h.startSide>0&&s.addLineStartIfNotCovered(r),s.addBlockWidget(C)):(s.ensureLine(r),s.addInlineWidget(C,g,b))}r=null}else r=gT(r,h);f>u&&this.text.skip(f-u)},span:(u,f,h,g)=>{for(let b=u;b<f;){let v=this.text.next(Math.min(512,f-b));v==null?(s.addLineStartIfNotCovered(r),s.addBreak(),b++):(s.ensureLine(r),s.addText(v,h,b==u?g:h.length),b+=v.length),r=null}a=h.length}});a>-1&&(this.openWidget=c>a),this.openWidget||s.addLineStartIfNotCovered(r),this.openMarks=c}forward(e,n,r=1){n-e<=10?this.old.advance(n-e,r,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(n-e-10,-1),this.old.advance(5,r,this.reuseWalker))}getCompositionContext(e){let n=[],r=null;for(let s=e.parentNode;;s=s.parentNode){let a=Bt.get(s);if(s==this.view.contentDOM)break;a instanceof In?n.push(a):a?.isLine()?r=a:a instanceof ar||(s.nodeName=="DIV"&&!r&&s!=this.view.contentDOM?r=new fl(s,qb):r||n.push(In.of(new wa({tagName:s.nodeName.toLowerCase(),attributes:VN(s)}),s)))}return{line:r,marks:n}}}function Lb(t,e){let n=r=>{for(let s of r.children)if((e?s.isText():s.length)||n(s))return!0;return!1};return n(t)}function mT(t){let e=t.isReplace?(t.startSide<0?64:0)|(t.endSide>0?128:0):t.startSide>0?32:16;return t.block&&(e|=256),e}const qb={class:"cm-line"};function gT(t,e){let n=e.spec.attributes,r=e.spec.class;return!n&&!r||(t||(t={class:"cm-line"}),n&&Kf(n,t),r&&(t.class+=" "+r)),t}function yT(t){let e=[];for(let n=t.parents.length;n>1;n--){let r=n==t.parents.length?t.tile:t.parents[n].tile;r instanceof In&&e.push(r.mark)}return e}function lh(t){let e=Bt.get(t);return e&&e.setDOM(t.cloneNode()),t}class hl extends nc{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}}hl.inline=new hl("span"),hl.block=new hl("div");const ah=new class extends nc{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Bb{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=rn.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 uc(e,e.contentDOM),this.updateInner([new di(0,0,0,e.state.doc.length)],null)}update(e){var n;let r=e.changedRanges;this.minWidth>0&&r.length&&(r.every(({fromA:g,toA:b})=>b<this.minWidthFrom||g>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 s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((n=this.domChanged)===null||n===void 0)&&n.newSel?s=this.domChanged.newSel.head:!NT(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let a=s>-1?xT(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:g,to:b}=this.hasComposition;r=new di(g,b,e.changes.mapPos(g,-1),e.changes.mapPos(b,1)).addToSet(r.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(Re.ie||Re.chrome)&&!a&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let c=this.decorations,u=this.blockWrappers;this.updateDeco();let f=ST(c,this.decorations,e.changes);f.length&&(r=di.extendWithRanges(r,f));let h=kT(u,this.blockWrappers,e.changes);return h.length&&(r=di.extendWithRanges(r,h)),a&&!r.some(g=>g.fromA<=a.range.fromA&&g.toA>=a.range.toA)&&(r=a.range.addToSet(r.slice())),this.tile.flags&2&&r.length==0?!1:(this.updateInner(r,a),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n){this.view.viewState.mustMeasureContent=!0;let{observer:r}=this.view;r.ignore(()=>{if(n||e.length){let c=this.tile,u=new pT(this.view,c,this.blockWrappers,this.decorations,this.dynamicDecorationMap);n&&Bt.get(n.text)&&u.cache.reused.set(Bt.get(n.text),2),this.tile=u.run(e,n),oh(c,u.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 a=Re.chrome||Re.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||r.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof ch&&s.push(a.dom);r.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let n of e.transactions)for(let r of n.effects)r.is(Tb)&&(this.editContextFormatting=r.value)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:r}=this.tile,s=this.view.root.activeElement,a=s==r,c=!a&&!(this.view.state.facet(sr)||r.tabIndex>-1)&&Ca(r,this.view.observer.selectionRange)&&!(s&&r.contains(s));if(!(a||n||c))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,h,g;if(f.empty?g=h=this.inlineDOMNearPos(f.anchor,f.assoc||1):(g=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),h=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),Re.gecko&&f.empty&&!this.hasComposition&&bT(h)){let v=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(v,h.node.childNodes[h.offset]||null)),h=g=new Oi(v,0),u=!0}let b=this.view.observer.selectionRange;(u||!b.focusNode||(!Na(h.node,h.offset,b.anchorNode,b.anchorOffset)||!Na(g.node,g.offset,b.focusNode,b.focusOffset))&&!this.suppressWidgetCursorChange(b,f))&&(this.view.observer.ignore(()=>{Re.android&&Re.chrome&&r.contains(b.focusNode)&&CT(b.focusNode,r)&&(r.blur(),r.focus({preventScroll:!0}));let v=ka(this.view.root);if(v)if(f.empty){if(Re.gecko){let w=vT(h.node,h.offset);if(w&&w!=3){let A=(w==1?db:fb)(h.node,h.offset);A&&(h=new Oi(A.node,A.offset))}}v.collapse(h.node,h.offset),f.bidiLevel!=null&&v.caretBidiLevel!==void 0&&(v.caretBidiLevel=f.bidiLevel)}else if(v.extend){v.collapse(h.node,h.offset);try{v.extend(g.node,g.offset)}catch{}}else{let w=document.createRange();f.anchor>f.head&&([h,g]=[g,h]),w.setEnd(g.node,g.offset),w.setStart(h.node,h.offset),v.removeAllRanges(),v.addRange(w)}c&&this.view.root.activeElement==r&&(r.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(h,g)),this.impreciseAnchor=h.precise?null:new Oi(b.anchorNode,b.anchorOffset),this.impreciseHead=g.precise?null:new Oi(b.focusNode,b.focusOffset)}suppressWidgetCursorChange(e,n){return this.hasComposition&&n.empty&&Na(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==n.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=ka(e.root),{anchorNode:s,anchorOffset:a}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let c=this.lineAt(n.head,n.assoc);if(!c)return;let u=c.posAtStart;if(n.head==u||n.head==u+c.length)return;let f=this.coordsAt(n.head,-1),h=this.coordsAt(n.head,1);if(!f||!h||f.bottom>h.top)return;let g=this.domAtPos(n.head+n.assoc,n.assoc);r.collapse(g.node,g.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let b=e.observer.selectionRange;e.docView.posFromDOM(b.anchorNode,b.anchorOffset)!=n.from&&r.collapse(s,a)}posFromDOM(e,n){let r=this.tile.nearest(e);if(!r)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=r.posAtStart;if(r.isComposite()){let a;if(e==r.dom)a=r.dom.childNodes[n];else{let c=rr(e)==0?0:n==0?-1:1;for(;;){let u=e.parentNode;if(u==r.dom)break;c==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?c=-1:c=1),e=u}c<0?a=e:a=e.nextSibling}if(a==r.dom.firstChild)return s;for(;a&&!Bt.get(a);)a=a.nextSibling;if(!a)return s+r.length;for(let c=0,u=s;;c++){let f=r.children[c];if(f.dom==a)return u;u+=f.length+f.breakAfter}}else return r.isText()?e==r.dom?s+n:s+(n?r.length:0):s}domAtPos(e,n){let{tile:r,offset:s}=this.tile.resolveBlock(e,n);return r.isWidget()?r.domPosFor(s,n):r.domIn(s,n)}inlineDOMNearPos(e,n){let r,s=-1,a=!1,c,u=-1,f=!1;return this.tile.blockTiles((h,g)=>{if(h.isWidget()){if(h.flags&32&&g>=e)return!0;h.flags&16&&(a=!0)}else{let b=g+h.length;if(g<=e&&(r=h,s=e-g,a=b<e),b>=e&&!c&&(c=h,u=e-g,f=g>e),g>e&&c)return!0}}),!r&&!c?this.domAtPos(e,n):(a&&c?r=null:f&&r&&(c=null),r&&n<0||!c?r.domIn(s,n):c.domIn(u,n))}coordsAt(e,n,r){let{tile:s,offset:a}=this.tile.resolveBlock(e,n);return s.isWidget()?s.widget instanceof ch?null:s.coordsInWidget(a,n,!0):s.coordsIn(a,n,r)}lineAt(e,n){let{tile:r}=this.tile.resolveBlock(e,n);return r.isLine()?r:null}coordsForChar(e){let{tile:n,offset:r}=this.tile.resolveBlock(e,1);if(!n.isLine())return null;function s(a,c){if(a.isComposite())for(let u of a.children){if(u.length>=c){let f=s(u,c);if(f)return f}if(c-=u.length,c<0)break}else if(a.isText()&&c<a.length){let u=An(a.text,c);if(u==c)return null;let f=Ta(a.dom,c,u).getClientRects();for(let h=0;h<f.length;h++){let g=f[h];if(h==f.length-1||g.top<g.bottom&&g.left<g.right)return g}}return null}return s(n,r)}measureVisibleLineHeights(e){let n=[],{from:r,to:s}=e,a=this.view.contentDOM.clientWidth,c=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==Lt.LTR,h=0,g=(b,v,w)=>{for(let A=0;A<b.children.length&&!(v>s);A++){let C=b.children[A],O=v+C.length,D=C.dom.getBoundingClientRect(),{height:E}=D;if(w&&!A&&(h+=D.top-w.top),C instanceof ar)O>r&&g(C,v,D);else if(v>=r&&(h>0&&n.push(-h),n.push(E+h),h=0,c)){let j=C.dom.lastChild,M=j?ic(j):[];if(M.length){let _=M[M.length-1],q=f?_.right-D.left:D.right-_.left;q>u&&(u=q,this.minWidth=a,this.minWidthFrom=v,this.minWidthTo=O)}}w&&A==b.children.length-1&&(h+=w.bottom-D.bottom),v=O+C.breakAfter}};return g(this.tile,0,null),n}textDirectionAt(e){let{tile:n}=this.tile.resolveBlock(e,1);return getComputedStyle(n.dom).direction=="rtl"?Lt.RTL:Lt.LTR}measureTextSize(){let e=this.tile.blockTiles(c=>{if(c.isLine()&&c.children.length&&c.length<=20){let u=0,f;for(let h of c.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let g=ic(h.dom);if(g.length!=1)return;u+=g[0].width,f=g[0].height}if(u)return{lineHeight:c.dom.getBoundingClientRect().height,charWidth:u/c.length,textHeight:f}}});if(e)return e;let n=document.createElement("div"),r,s,a;return n.className="cm-line",n.style.width="99999px",n.style.position="absolute",n.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(n);let c=ic(n.firstChild)[0];r=n.getBoundingClientRect().height,s=c&&c.width?c.width/27:7,a=c&&c.height?c.height:r,n.remove()}),{lineHeight:r,charWidth:s,textHeight:a}}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,s=0;;s++){let a=s==n.viewports.length?null:n.viewports[s],c=a?a.from-1:this.view.state.doc.length;if(c>r){let u=(n.lineBlockAt(c).bottom-n.lineBlockAt(r).top)/this.view.scaleY;e.push(rn.replace({widget:new ch(u),block:!0,inclusive:!0,isBlockGap:!0}).range(r,c))}if(!a)break;r=a.to+1}return rn.set(e)}updateDeco(){let e=1,n=this.view.state.facet(ac).map(a=>(this.dynamicDecorationMap[e++]=typeof a=="function")?a(this.view):a),r=!1,s=this.view.state.facet(sh).map((a,c)=>{let u=typeof a=="function";return u&&(r=!0),u?a(this.view):a});for(s.length&&(this.dynamicDecorationMap[e++]=r,n.push(mt.join(s))),this.decorations=[this.editContextFormatting,...n,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(Eb).map(a=>typeof a=="function"?a(this.view):a)}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(Nb))try{if(h(this.view,e.range,e))return!0}catch(g){Pi(this.view.state,g,"scroll handler")}let{range:n}=e,r=this.coordsAt(n.head,n.assoc||(n.head>n.anchor?-1:1)),s;if(!r)return;!n.empty&&(s=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,s.left),top:Math.min(r.top,s.top),right:Math.max(r.right,s.right),bottom:Math.max(r.bottom,s.bottom)});let a=Db(this.view),c={left:r.left-a.left,top:r.top-a.top,right:r.right+a.right,bottom:r.bottom+a.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(YN(this.view.scrollDOM,c,n.head<n.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,u),-u),Math.max(Math.min(e.yMargin,f),-f),this.view.textDirection==Lt.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(r.top>window.visualViewport.offsetTop+window.visualViewport.height||r.bottom<window.visualViewport.offsetTop)){let h=this.view.docView.lineAt(n.head,1);if(h){let g=lb(h.dom);h.dom.scrollIntoView({block:"nearest"}),ab(g,!1)}}}lineHasWidget(e){let n=r=>r.isWidget()||r.children.some(n);return n(this.tile.resolveBlock(e,1).tile)}destroy(){oh(this.tile)}}function oh(t,e){let n=e?.get(t);if(n!=1){n==null&&t.destroy();for(let r of t.children)oh(r,e)}}function bT(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}function $b(t,e){let n=t.observer.selectionRange;if(!n.focusNode)return null;let r=db(n.focusNode,n.focusOffset),s=fb(n.focusNode,n.focusOffset),a=r||s;if(s&&r&&s.node!=r.node){let u=Bt.get(s.node);if(!u||u.isText()&&u.text!=s.node.nodeValue)a=s;else if(t.docView.lastCompositionAfterCursor){let f=Bt.get(r.node);!f||f.isText()&&f.text!=r.node.nodeValue||(a=s)}}if(t.docView.lastCompositionAfterCursor=a!=r,!a)return null;let c=e-a.offset;return{from:c,to:c+a.node.nodeValue.length,node:a.node}}function xT(t,e,n){let r=$b(t,n);if(!r)return null;let{node:s,from:a,to:c}=r,u=s.nodeValue;if(/[\n\r]/.test(u)||t.state.doc.sliceString(r.from,r.to)!=u)return null;let f=e.invertedDesc;return{range:new di(f.mapPos(a),f.mapPos(c),a,c),text:s}}function vT(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}let wT=class{constructor(){this.changes=[]}compareRange(e,n){ol(e,n,this.changes)}comparePoint(e,n){ol(e,n,this.changes)}boundChange(e){ol(e,e,this.changes)}};function ST(t,e,n){let r=new wT;return mt.compare(t,e,n,r),r.changes}class AT{constructor(){this.changes=[]}compareRange(e,n){ol(e,n,this.changes)}comparePoint(){}boundChange(e){ol(e,e,this.changes)}}function kT(t,e,n){let r=new AT;return mt.compare(t,e,n,r),r.changes}function CT(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function NT(t,e){let n=!1;return e&&t.iterChangedRanges((r,s)=>{r<e.to&&s>e.from&&(n=!0)}),n}class ch extends nc{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 TT(t,e,n=1){let r=t.charCategorizer(e),s=t.doc.lineAt(e),a=e-s.from;if(s.length==0)return Ae.cursor(e);a==0?n=1:a==s.length&&(n=-1);let c=a,u=a;n<0?c=An(s.text,a,!1):u=An(s.text,a);let f=r(s.text.slice(c,u));for(;c>0;){let h=An(s.text,c,!1);if(r(s.text.slice(h,c))!=f)break;c=h}for(;u<s.length;){let h=An(s.text,u);if(r(s.text.slice(u,h))!=f)break;u=h}return Ae.undirectionalRange(c+s.from,u+s.from)}function jT(t,e,n,r,s){let a=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let u=t.viewState.heightOracle.textHeight,f=Math.floor((s-n.top-(t.defaultLineHeight-u)*.5)/u);a+=f*t.viewState.heightOracle.lineLength}let c=t.state.sliceDoc(n.from,n.to);return n.from+BN(c,a,t.state.tabSize)}function uh(t,e,n){let r=t.lineBlockAt(e);if(Array.isArray(r.type)){let s;for(let a of r.type){if(a.from>e)break;if(!(a.to<e)){if(a.from<e&&a.to>e)return a;(!s||a.type==un.Text&&(s.type!=a.type||(n<0?a.from<e:a.to>e)))&&(s=a)}}return s||r}return r}function ET(t,e,n,r){let s=uh(t,e.head,e.assoc||-1),a=!r||s.type!=un.Text||!(t.lineWrapping||s.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(a){let c=t.dom.getBoundingClientRect(),u=t.textDirectionAt(s.from),f=t.posAtCoords({x:n==(u==Lt.LTR)?c.right-1:c.left+1,y:(a.top+a.bottom)/2});if(f!=null)return Ae.cursor(f,n?-1:1)}return Ae.cursor(n?s.to:s.from,n?-1:1)}function Ib(t,e,n,r){let s=t.state.doc.lineAt(e.head),a=t.bidiSpans(s),c=t.textDirectionAt(s.from);for(let u=e,f=null;;){let h=iT(s,a,c,u,n),g=yb;if(!h){if(s.number==(n?t.state.doc.lines:1))return u;g=`
|
|
56
|
+
`,s=t.state.doc.line(s.number+(n?1:-1)),a=t.bidiSpans(s),h=t.visualLineSide(s,!n)}if(f){if(!f(g))return u}else{if(!r)return h;f=r(g)}u=h}}function OT(t,e,n){let r=t.state.charCategorizer(e),s=r(n);return a=>{let c=r(a);return s==ir.Space&&(s=c),s==c}}function MT(t,e,n,r){let s=e.head,a=n?1:-1;if(s==(n?t.state.doc.length:0))return Ae.cursor(s,e.assoc);let c=e.goalColumn,u,f=t.contentDOM.getBoundingClientRect(),h=t.coordsAtPos(s,e.assoc||((e.empty?n:e.head==e.from)?1:-1)),g=t.documentTop;if(h)c==null&&(c=h.left-f.left),u=a<0?h.top:h.bottom;else{let A=t.viewState.lineBlockAt(s);c==null&&(c=Math.min(f.right-f.left,t.defaultCharacterWidth*(s-A.from))),u=(a<0?A.top:A.bottom)+g}let b=f.left+c,v=t.viewState.heightOracle.textHeight>>1,w=r??v;for(let A=0;;A+=v){let C=u+(w+A)*a,O=fh(t,{x:b,y:C},!1,a);if(n?C>f.bottom:C<f.top)return Ae.cursor(O.pos,O.assoc);let D=t.coordsAtPos(O.pos,O.assoc),E=D?(D.top+D.bottom)/2:0;if(!D||(n?E>u:E<u))return Ae.cursor(O.pos,O.assoc,void 0,c)}}function Oa(t,e,n){for(;;){let r=0;for(let s of t)s.between(e-1,e+1,(a,c,u)=>{if(e>a&&e<c){let f=r||n||(e-a<c-e?-1:1);e=f<0?a:c,r=f}});if(!r)return e}}function Hb(t,e){let n=null;for(let r=0;r<e.ranges.length;r++){let s=e.ranges[r],a=null;if(s.empty){let c=Oa(t,s.from,0);c!=s.from&&(a=Ae.cursor(c,-1))}else{let c=Oa(t,s.from,-1),u=Oa(t,s.to,1);(c!=s.from||u!=s.to)&&(s.undirectional?a=Ae.undirectionalRange(s.from,s.to):a=Ae.range(s.from==s.anchor?c:u,s.from==s.head?c:u))}a&&(n||(n=e.ranges.slice()),n[r]=a)}return n?Ae.create(n,e.mainIndex):e}function dh(t,e,n){let r=Oa(t.state.facet(ja).map(s=>s(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:Ae.cursor(r,r<n.from?1:-1)}class Yi{constructor(e,n){this.pos=e,this.assoc=n}}function fh(t,e,n,r){let s=t.contentDOM.getBoundingClientRect(),a=s.top+t.viewState.paddingTop,{x:c,y:u}=e,f=u-a,h;for(;;){if(f<0)return new Yi(0,1);if(f>t.viewState.docHeight)return new Yi(t.state.doc.length,-1);if(h=t.elementAtHeight(f),r==null)break;if(h.type==un.Text){if(r<0?h.to<t.viewport.from:h.from>t.viewport.to)break;let v=t.docView.coordsAt(r<0?h.from:h.to,r>0?-1:1);if(v&&(r<0?v.top<=f+a:v.bottom>=f+a))break}let b=t.viewState.heightOracle.textHeight/2;f=r>0?h.bottom+b:h.top-b}if(t.viewport.from>=h.to||t.viewport.to<=h.from){if(n)return null;if(h.type==un.Text){let b=jT(t,s,h,c,u);return new Yi(b,b==h.from?1:-1)}}if(h.type!=un.Text)return f<(h.top+h.bottom)/2?new Yi(h.from,1):new Yi(h.to,-1);let g=t.docView.lineAt(h.from,2);return(!g||g.length!=h.length)&&(g=t.docView.lineAt(h.from,-2)),new RT(t,c,u,t.textDirectionAt(h.from)).scanTile(g,h.from)}class RT{constructor(e,n,r,s){this.view=e,this.x=n,this.y=r,this.baseDir=s,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,n){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Fi.find(s,e-r.from,-1,n)].level==this.baseDir}dirAt(e,n){let{line:r,spans:s}=this.bidiSpansAt(e);return s[Fi.find(s,e-r.from,-1,n)].dir}bidiIn(e,n){let{spans:r,line:s}=this.bidiSpansAt(e);return r.length>1||r.length&&(r[0].level!=this.baseDir||r[0].to+s.from<n)}scan(e,n,r=!1){let s=0,a=e.length-1,c=new Set,u=this.bidiIn(e[0],e[a]),f,h,g=-1,b=1e9,v;e:for(;s<a;){let A=a-s,C=s+a>>1;t:if(c.has(C)){for(let E=1;E<A;E++){let j=C+E;if(j>=a&&(j-=A),!c.has(j)){C=j;break t}}break e}c.add(C);let O=n(C),D=0;if(O)for(let E=0;E<O.length;E++){let j=O[E];if(!(j.width==0&&O.length>1))if(j.bottom<this.y)(!f||f.bottom<j.bottom)&&(f=j),D=1;else if(j.top>this.y)(!h||h.top>j.top)&&(h=j),D=-1;else{let M=j.left>this.x?this.x-j.left:j.right<this.x?this.x-j.right:0,_=Math.abs(M);_<b&&(g=C,b=_,v=j),M&&(D=M<0==(this.baseDir==Lt.LTR)?-1:1)}}D==-1&&(!u||this.baseDirAt(e[C],1))?a=C:D==1&&(!u||this.baseDirAt(e[C+1],-1))&&(s=C+1)}if(!v){if(!h&&!f)return{i:0,after:!1};let A=f&&(!h||this.y-f.bottom<h.top-this.y)?f:h;return this.y=(A.top+A.bottom)/2,this.scan(e,n,!0)}if(b&&!r){let{top:A,bottom:C}=v;if(f&&f.bottom>(A+A+C)/3)return this.y=f.bottom-1,this.scan(e,n,!0);if(h&&h.top<(A+C+C)/3)return this.y=h.top+1,this.scan(e,n,!0)}let w=(u?this.dirAt(e[g],1):this.baseDir)==Lt.LTR;return{i:g,after:this.x>(v.left+v.right)/2==w}}scanText(e,n){let r=[];for(let a=0;a<e.length;a=An(e.text,a))r.push(n+a);r.push(n+e.length);let s=this.scan(r,a=>{let c=r[a]-n,u=r[a+1]-n;return Ta(e.dom,c,u).getClientRects()});return s.after?new Yi(r[s.i+1],-1):new Yi(r[s.i],1)}scanTile(e,n){if(!e.length)return new Yi(n,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,n);if(u.isComposite())return this.scanTile(u,n)}let r=[n];for(let u=0,f=n;u<e.children.length;u++)r.push(f+=e.children[u].length);let s=this.scan(r,u=>{let f=e.children[u];return f.flags&48?null:(f.dom.nodeType==1?f.dom:Ta(f.dom,0,f.length)).getClientRects()}),a=e.children[s.i],c=r[s.i];return a.isText()?this.scanText(a,c):a.isComposite()?this.scanTile(a,c):s.after?new Yi(r[s.i+1],-1):new Yi(c,1)}}const pl="";class DT{constructor(e,n){this.points=e,this.view=n,this.text="",this.lineSeparator=n.state.facet(wt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=pl}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let s=e;;){this.findPointBefore(r,s);let a=this.text.length;this.readNode(s);let c=Bt.get(s),u=s.nextSibling;if(u==n){c?.breakAfter&&!u&&r!=this.view.contentDOM&&this.lineBreak();break}let f=Bt.get(u);(c&&f?c.breakAfter:(c?c.breakAfter:rc(s))||rc(u)&&(s.nodeName!="BR"||c?.isWidget())&&this.text.length>a)&&!LT(u,n)&&this.lineBreak(),s=u}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,c=1,u;if(this.lineSeparator?(a=n.indexOf(this.lineSeparator,r),c=this.lineSeparator.length):(u=s.exec(n))&&(a=u.index,c=u[0].length),this.append(n.slice(r,a<0?n.length:a)),a<0)break;if(this.lineBreak(),c>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=c-1);r=a+c}}readNode(e){let n=Bt.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let s=r.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+(_T(e,r.node,r.offset)?n:0))}}function _T(t,e,n){for(;;){if(!e||n<rr(e))return!1;if(e==t)return!0;n=zr(e)+1,e=e.parentNode}}function LT(t,e){let n;for(;!(t==e||!t);t=t.nextSibling){let r=Bt.get(t);if(!r?.isWidget())return!1;r&&(n||(n=[])).push(r)}if(n)for(let r of n){let s=r.overrideDOMText;if(s?.length)return!1}return!0}class zb{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}}class qT{constructor(e,n,r,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=n>-1;let{impreciseHead:a,impreciseAnchor:c}=e.docView,u=e.state.selection;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=Ub(e.docView.tile,n,r,0))){let f=a||c?[]:$T(e),h=new DT(f,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=IT(f,this.bounds.from)}else{let f=e.observer.selectionRange,h=a&&a.node==f.focusNode&&a.offset==f.focusOffset||!Xf(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),g=c&&c.node==f.anchorNode&&c.offset==f.anchorOffset||!Xf(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),b=e.viewport;if((Re.ios||Re.chrome)&&h!=g&&Math.min(h,g)<=u.main.from&&Math.max(h,g)>=u.main.to&&(b.from>0||b.to<e.state.doc.length)){let v=Math.min(h,g),w=Math.max(h,g),A=b.from-v,C=b.to-w;(A==0||A==1||v==0)&&(C==0||C==-1||w==e.state.doc.length)&&(h=0,g=e.state.doc.length)}if(e.inputState.composing>-1&&u.ranges.length>1)this.newSel=u.replaceRange(Ae.range(g,h));else if(e.lineWrapping&&g==h&&!(u.main.empty&&u.main.head==h)&&e.inputState.lastTouchTime>Date.now()-100){let v=e.coordsAtPos(h,-1),w=0;v&&(w=e.inputState.lastTouchY<=v.bottom?-1:1),this.newSel=Ae.create([Ae.cursor(h,w)])}else this.newSel=Ae.single(g,h)}}}function Ub(t,e,n,r){if(t.isComposite()){let s=-1,a=-1,c=-1,u=-1;for(let f=0,h=r,g=r;f<t.children.length;f++){let b=t.children[f],v=h+b.length;if(h<e&&v>n)return Ub(b,e,n,h);if(v>=e&&s==-1&&(s=f,a=h),h>n&&b.dom.parentNode==t.dom){c=f,u=g;break}g=v,h=v+b.breakAfter}return{from:a,to:u<0?r+t.length:u,startDOM:(s?t.children[s-1].dom.nextSibling:null)||t.dom.firstChild,endDOM:c<t.children.length&&c>=0?t.children[c].dom:null}}else return t.isText()?{from:r,to:r+t.length,startDOM:t.dom,endDOM:t.dom.nextSibling}:null}function Vb(t,e){let n,{newSel:r}=e,{state:s}=t,a=s.selection.main,c=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,h=a.from,g=null;(c===8||Re.android&&e.text.length<f-u)&&(h=a.to,g="end");let b=s.doc.sliceString(u,f,pl),v,w;!a.empty&&a.from>=u&&a.to<=f&&(e.typeOver||b!=e.text)&&b.slice(0,a.from-u)==e.text.slice(0,a.from-u)&&b.slice(a.to-u)==e.text.slice(v=e.text.length-(b.length-(a.to-u)))?n={from:a.from,to:a.to,insert:gt.of(e.text.slice(a.from-u,v).split(pl))}:(w=Fb(b,e.text,h-u,g))&&(Re.chrome&&c==13&&w.toB==w.from+2&&e.text.slice(w.from,w.toB)==pl+pl&&w.toB--,n={from:u+w.from,to:u+w.toA,insert:gt.of(e.text.slice(w.from,w.toB).split(pl))})}else r&&(!t.hasFocus&&s.facet(sr)||hc(r,a))&&(r=null);if(!n&&!r)return!1;if((Re.mac||Re.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:gt.of([n.insert.toString().replace("."," ")])}):s.doc.lineAt(a.from).to<a.to&&t.docView.lineHasWidget(a.to)&&t.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:s.toText(t.inputState.insertingText)}:Re.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
|
|
57
|
+
`&&t.lineWrapping&&(r&&(r=Ae.single(r.main.anchor-1,r.main.head-1)),n={from:a.from,to:a.to,insert:gt.of([" "])}),n)return hh(t,n,r,c);if(r&&!hc(r,a)){let u=!1,f="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(u=!0),f=t.inputState.lastSelectionOrigin,f=="select.pointer"&&(r=Hb(s.facet(ja).map(h=>h(t)),r))),t.dispatch({selection:r,scrollIntoView:u,userEvent:f}),!0}else return!1}function hh(t,e,n,r=-1){if(Re.ios&&t.inputState.flushIOSKey(e))return!0;let s=t.state.selection.main;if(Re.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&t.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&cl(t.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||r==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&cl(t.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&cl(t.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();t.inputState.composing>=0&&t.inputState.composing++;let c,u=()=>c||(c=BT(t,e,n));return t.state.facet(Sb).some(f=>f(t,e.from,e.to,a,u))||t.dispatch(u()),!0}function BT(t,e,n){let r,s=t.state,a=s.selection.main,c=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let f=e.from<a.from?-1:1,h=f<0?a.from:a.to,g=Oa(s.facet(ja).map(b=>b(t)),h,f);e.from==g&&(c=g)}if(c>-1)r={changes:e,selection:Ae.cursor(e.from+e.insert.length,-1)};else if(e.from>=a.from&&e.to<=a.to&&e.to-e.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==e.from+e.insert.length)&&t.inputState.composing<0){let f=a.from<e.from?s.sliceDoc(a.from,e.from):"",h=a.to>e.to?s.sliceDoc(e.to,a.to):"";r=s.replaceSelection(t.state.toText(f+e.insert.sliceString(0,void 0,t.state.lineBreak)+h))}else{let f=s.changes(e),h=n&&n.main.to<=f.newLength?n.main:void 0;if(s.selection.ranges.length>1&&(t.inputState.composing>=0||t.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let g=t.state.sliceDoc(e.from,e.to),b,v=n&&$b(t,n.main.head);if(v){let A=e.insert.length-(e.to-e.from);b={from:v.from,to:v.to-A}}else b=t.state.doc.lineAt(a.head);let w=a.to-e.to;r=s.changeByRange(A=>{if(A.from==a.from&&A.to==a.to)return{changes:f,range:h||A.map(f)};let C=A.to-w,O=C-g.length;if(t.state.sliceDoc(O,C)!=g||C>=b.from&&O<=b.to)return{range:A};let D=s.changes({from:O,to:C,insert:e.insert}),E=A.to-a.to;return{changes:D,range:h?Ae.range(Math.max(0,h.anchor+E),Math.max(0,h.head+E)):A.map(D)}})}else r={changes:f,selection:h&&s.selection.replaceRange(h)}}let u="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,u+=".compose",t.inputState.compositionFirstChange&&(u+=".start",t.inputState.compositionFirstChange=!1)),s.update(r,{userEvent:u,scrollIntoView:!0})}function Fb(t,e,n,r){let s=Math.min(t.length,e.length),a=0;for(;a<s&&t.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==s&&t.length==e.length)return null;let c=t.length,u=e.length;for(;c>0&&u>0&&t.charCodeAt(c-1)==e.charCodeAt(u-1);)c--,u--;if(r=="end"){let f=Math.max(0,a-Math.min(c,u));n-=c+f-a}if(c<a&&t.length<e.length){let f=n<=a&&n>=c?a-n:0;a-=f,u=a+(u-c),c=a}else if(u<a){let f=n<=a&&n>=u?a-n:0;a-=f,c=a+(c-u),u=a}return{from:a,toA:c,toB:u}}function $T(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:a}=t.observer.selectionRange;return n&&(e.push(new zb(n,r)),(s!=n||a!=r)&&e.push(new zb(s,a))),e}function IT(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?Ae.single(n+e,r+e):null}function hc(t,e){return e.head==t.main.head&&e.anchor==t.main.anchor}class HT{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.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Re.safari&&e.contentDOM.addEventListener("input",()=>null),Re.gecko&&nj(e.contentDOM.ownerDocument)}handleEvent(e){!XT(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,n){let r=this.handlers[e];if(r){for(let s of r.observers)s(this.view,n);for(let s of r.handlers){if(n.defaultPrevented)break;if(s(this.view,n)){n.preventDefault();break}}}}ensureHandlers(e){let n=UT(e),r=this.handlers,s=this.view.contentDOM;for(let a in n)if(a!="scroll"){let c=!n[a].handlers.length,u=r[a];u&&c!=!u.handlers.length&&(s.removeEventListener(a,this.handleEvent),u=null),u||s.addEventListener(a,this.handleEvent,{passive:c})}for(let a in r)a!="scroll"&&!n[a]&&s.removeEventListener(a,this.handleEvent);this.handlers=n}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Kb.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Re.android&&Re.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Re.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(Yb.some(n=>n.keyCode==e.keyCode)&&!e.ctrlKey||VT.indexOf(e.key)>-1&&e.ctrlKey)){let n={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return n.shiftKey&&Re.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&zT(this.view.win)&&(n.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:n},setTimeout(()=>this.flushIOSKey(),50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let n=this.pendingIOSKey;return!n||this.view.observer.pendingRecords().length||n.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,cl(this.view.contentDOM,n.key,n.keyCode,n.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Re.safari&&!Re.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()}}function zT(t){return t.visualViewport?t.visualViewport.height*t.visualViewport.scale/t.document.documentElement.clientHeight<.85:!1}function Pb(t,e){return(n,r)=>{try{return e.call(t,r,n)}catch(s){Pi(n.state,s)}}}function UT(t){let e=Object.create(null);function n(r){return e[r]||(e[r]={observers:[],handlers:[]})}for(let r of t){let s=r.spec,a=s&&s.plugin.domEventHandlers,c=s&&s.plugin.domEventObservers;if(a)for(let u in a){let f=a[u];f&&n(u).handlers.push(Pb(r.value,f))}if(c)for(let u in c){let f=c[u];f&&n(u).observers.push(Pb(r.value,f))}}for(let r in Mi)n(r).handlers.push(Mi[r]);for(let r in Rn)n(r).observers.push(Rn[r]);return e}const Yb=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],VT="dthko",Kb=[16,17,18,20,91,92,224,225],pc=6;function mc(t){return Math.max(0,t)*.7+8}function FT(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}class PT{constructor(e,n,r,s){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParents=sb(e.contentDOM),this.atoms=e.state.facet(ja).map(c=>c(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(wt.allowMultipleSelections)&&YT(e,n),this.dragging=GT(e,n)&&ex(n)==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&&FT(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let n=0,r=0,s=0,a=0,c=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:c}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=Db(this.view);e.clientX-f.left<=s+pc?n=-mc(s-e.clientX):e.clientX+f.right>=c-pc&&(n=mc(e.clientX-c)),e.clientY-f.top<=a+pc?r=-mc(a-e.clientY):e.clientY+f.bottom>=u-pc&&(r=mc(e.clientY-u)),this.setScrollSpeed(n,r)}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,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:n}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),n&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=n,n=0),(e||n)&&this.view.win.scrollBy(e,n),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:n}=this,r=Hb(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection,this.dragging===!1))&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(n=>n.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function YT(t,e){let n=t.state.facet(bb);return n.length?n[0](e):Re.mac?e.metaKey:e.ctrlKey}function KT(t,e){let n=t.state.facet(xb);return n.length?n[0](e):Re.mac?!e.altKey:!e.ctrlKey}function GT(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=ka(t.root);if(!r||r.rangeCount==0)return!0;let s=r.getRangeAt(0).getClientRects();for(let a=0;a<s.length;a++){let c=s[a];if(c.left<=e.clientX&&c.right>=e.clientX&&c.top<=e.clientY&&c.bottom>=e.clientY)return!0}return!1}function XT(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Bt.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(e))return!1;return!0}const Mi=Object.create(null),Rn=Object.create(null),Gb=Re.ie&&Re.ie_version<15||Re.ios&&Re.webkit_version<604;function JT(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),Xb(t,n.value)},50)}function gc(t,e,n){for(let r of t.facet(e))n=r(n,t);return n}function Xb(t,e){e=gc(t.state,th,e);let{state:n}=t,r,s=1,a=n.toText(e),c=a.lines==n.selection.ranges.length;if(ph!=null&&n.selection.ranges.every(f=>f.empty)&&ph==a.toString()){let f=-1;r=n.changeByRange(h=>{let g=n.doc.lineAt(h.from);if(g.from==f)return{range:h};f=g.from;let b=n.toText((c?a.line(s++).text:e)+n.lineBreak);return{changes:{from:g.from,insert:b},range:Ae.cursor(h.from+b.length)}})}else c?r=n.changeByRange(f=>{let h=a.line(s++);return{changes:{from:f.from,to:f.to,insert:h.text},range:Ae.cursor(f.from+h.length)}}):r=n.replaceSelection(a);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Rn.scroll=t=>{let e=t.inputState;e.lastScrollTop=t.scrollDOM.scrollTop,e.lastScrollLeft=t.scrollDOM.scrollLeft,Re.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())},Rn.wheel=Rn.mousewheel=t=>{t.inputState.lastWheelEvent=Date.now()},Mi.keydown=(t,e)=>(t.inputState.setSelectionOrigin("select"),e.keyCode==27&&t.inputState.tabFocusMode!=0&&(t.inputState.tabFocusMode=Date.now()+2e3),!1),Rn.touchstart=(t,e)=>{let n=t.inputState,r=e.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin("select.pointer")},Rn.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")},Rn.touchend=(t,e)=>{t.inputState.touchActive=!1},Mi.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of t.state.facet(vb))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=WT(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new PT(t,e,n,r)),r&&t.observer.ignore(()=>{ob(t.contentDOM);let a=t.root.activeElement;a&&!a.contains(t.contentDOM)&&a.blur()});let s=t.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else t.inputState.setSelectionOrigin("select.pointer");return!1};function Jb(t,e,n,r){if(r==1)return Ae.cursor(e,n);if(r==2)return TT(t.state,e,n);{let s=t.docView.lineAt(e,n),a=t.state.doc.lineAt(s?s.posAtEnd:e),c=s?s.posAtStart:a.from,u=s?s.posAtEnd:a.to;return u<t.state.doc.length&&u==a.to&&u++,Ae.undirectionalRange(c,u)}}const QT=Re.ie&&Re.ie_version<=11;let Qb=null,Wb=0,Zb=0;function ex(t){if(!QT)return t.detail;let e=Qb,n=Zb;return Qb=t,Zb=Date.now(),Wb=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(Wb+1)%3:1}function WT(t,e){let n=t.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),r=ex(e),s=t.state.selection;return{update(a){a.docChanged&&(n.pos=a.changes.mapPos(n.pos),s=s.map(a.changes))},get(a,c,u){let f=t.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),h,g=Jb(t,f.pos,f.assoc,r);if(n.pos!=f.pos&&!c){let b=Jb(t,n.pos,n.assoc,r),v=Math.min(b.from,g.from),w=Math.max(b.to,g.to);g=v<g.from?Ae.range(v,w,g.assoc):Ae.range(w,v,g.assoc)}return c?s.replaceRange(s.main.extend(g.from,g.to,g.assoc)):u&&r==1&&s.ranges.length>1&&(h=ZT(s,f.pos))?h:u?s.addRange(g):Ae.create([g])}}}function ZT(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:s}=t.ranges[n];if(r<=e&&s>=e)return Ae.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Mi.dragstart=(t,e)=>{let{selection:{main:n}}=t.state;if(e.target.draggable){let s=t.docView.tile.nearest(e.target);if(s&&s.isWidget()){let a=s.posAtStart,c=a+s.length;(a>=n.to||c<=n.from)&&(n=Ae.undirectionalRange(a,c))}}let{inputState:r}=t;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,e.dataTransfer&&(e.dataTransfer.setData("Text",gc(t.state,nh,t.state.sliceDoc(n.from,n.to))),e.dataTransfer.effectAllowed="copyMove"),!1},Mi.dragend=t=>(t.inputState.draggedContent=null,!1);function tx(t,e,n,r){if(n=gc(t.state,th,n),!n)return;let s=t.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:a}=t.inputState,c=r&&a&&KT(t,e)?{from:a.from,to:a.to}:null,u={from:s,insert:n},f=t.state.changes(c?[c,u]:u);t.focus(),t.dispatch({changes:f,selection:{anchor:f.mapPos(s,-1),head:f.mapPos(s,1)},userEvent:c?"move.drop":"input.drop"}),t.inputState.draggedContent=null}Mi.drop=(t,e)=>{if(!e.dataTransfer)return!1;if(t.state.readOnly)return!0;let n=e.dataTransfer.files;if(n&&n.length){let r=Array(n.length),s=0,a=()=>{++s==n.length&&tx(t,e,r.filter(c=>c!=null).join(t.state.lineBreak),!1)};for(let c=0;c<n.length;c++){let u=new FileReader;u.onerror=a,u.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(r[c]=u.result),a()},u.readAsText(n[c])}return!0}else{let r=e.dataTransfer.getData("Text");if(r)return tx(t,e,r,!0),!0}return!1},Mi.paste=(t,e)=>{if(t.state.readOnly)return!0;t.observer.flush();let n=Gb?null:e.clipboardData;return n?(Xb(t,n.getData("text/plain")||n.getData("text/uri-list")),!0):(JT(t),!1)};function ej(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function tj(t){let e=[],n=[],r=!1;for(let s of t.selection.ranges)s.empty||(e.push(t.sliceDoc(s.from,s.to)),n.push(s));if(!e.length){let s=-1;for(let{from:a}of t.selection.ranges){let c=t.doc.lineAt(a);c.number>s&&(e.push(c.text),n.push({from:c.from,to:Math.min(t.doc.length,c.to+1)})),s=c.number}r=!0}return{text:gc(t,nh,e.join(t.lineBreak)),ranges:n,linewise:r}}let ph=null;Mi.copy=Mi.cut=(t,e)=>{if(!Ca(t.contentDOM,t.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:s}=tj(t.state);if(!n&&!s)return!1;ph=s?n:null,e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"});let a=Gb?null:e.clipboardData;return a?(a.clearData(),a.setData("text/plain",n),!0):(ej(t,n),!1)};const nx=Ir.define();function ix(t,e){let n=[];for(let r of t.facet(Ab)){let s=r(t,e);s&&n.push(s)}return n.length?t.update({effects:n,annotations:nx.of(!0)}):null}function rx(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=ix(t.state,e);n?t.dispatch(n):t.update([])}},10)}Rn.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),rx(t)},Rn.blur=t=>{t.observer.clearSelectionRange(),rx(t)},Rn.compositionstart=Rn.compositionupdate=t=>{t.observer.editContext||(t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0))},Rn.compositionend=t=>{t.observer.editContext||(t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Re.chrome&&Re.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50))},Rn.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()},Mi.beforeinput=(t,e)=>{var n,r;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(t.inputState.insertingText=e.data,t.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&t.observer.editContext){let a=(n=e.dataTransfer)===null||n===void 0?void 0:n.getData("text/plain"),c=e.getTargetRanges();if(a&&c.length){let u=c[0],f=t.posAtDOM(u.startContainer,u.startOffset),h=t.posAtDOM(u.endContainer,u.endOffset);return hh(t,{from:f,to:h,insert:t.state.toText(a)},null),!0}}let s;if(Re.chrome&&Re.android&&(s=Yb.find(a=>a.inputType==e.inputType))&&(t.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let a=((r=window.visualViewport)===null||r===void 0?void 0:r.height)||0;setTimeout(()=>{var c;(((c=window.visualViewport)===null||c===void 0?void 0:c.height)||0)>a+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}return Re.ios&&e.inputType=="deleteContentForward"&&t.observer.flushSoon(),Re.safari&&e.inputType=="insertText"&&t.inputState.composing>=0&&setTimeout(()=>Rn.compositionend(t,e),20),!1};const sx=new Set;function nj(t){sx.has(t)||(sx.add(t),t.addEventListener("copy",()=>{}),t.addEventListener("cut",()=>{}))}const lx=["pre-wrap","normal","pre-line","break-spaces"];let ml=!1;function ax(){ml=!1}class ij{constructor(e){this.lineWrapping=e,this.doc=gt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}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 lx.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let s=e[r];s<0?r++:this.heightSamples[Math.floor(s*10)]||(n=!0,this.heightSamples[Math.floor(s*10)]=!0)}return n}refresh(e,n,r,s,a,c){let u=lx.indexOf(e)>-1,f=Math.abs(n-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=n,this.charWidth=r,this.textHeight=s,this.lineLength=a,f){this.heightSamples={};for(let h=0;h<c.length;h++){let g=c[h];g<0?h++:this.heightSamples[Math.floor(g*10)]=!0}}return f}}class rj{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}}class Ri{constructor(e,n,r,s,a){this.from=e,this.length=n,this.top=r,this.height=s,this._content=a}get type(){return typeof this._content=="number"?un.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 Es?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Ri(this.from,this.length+e.length,this.top,this.height+e.height,n)}}var Mt=(function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t})(Mt||(Mt={}));const yc=.001;class Dn{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}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)>yc&&(ml=!0),this.height=e)}replace(e,n,r){return Dn.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,s){let a=this,c=r.doc;for(let u=s.length-1;u>=0;u--){let{fromA:f,toA:h,fromB:g,toB:b}=s[u],v=a.lineAt(f,Mt.ByPosNoHeight,r.setDoc(n),0,0),w=v.to>=h?v:a.lineAt(h,Mt.ByPosNoHeight,r,0,0);for(b+=w.to-h,h=w.to;u>0&&v.from<=s[u-1].toA;)f=s[u-1].fromA,g=s[u-1].fromB,u--,f<v.from&&(v=a.lineAt(f,Mt.ByPosNoHeight,r,0,0));g+=v.from-f,f=v.from;let A=mh.build(r.setDoc(c),e,g,b);a=bc(a,a.replace(f,h,A))}return a.updateHeight(r,0)}static empty(){return new Qn(0,0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,s=0,a=0;for(;;)if(n==r)if(s>a*2){let u=e[n-1];u.break?e.splice(--n,1,u.left,null,u.right):e.splice(--n,1,u.left,u.right),r+=1+u.break,s-=u.size}else if(a>s*2){let u=e[r];u.break?e.splice(r,1,u.left,null,u.right):e.splice(r,1,u.left,u.right),r+=2+u.break,a-=u.size}else break;else if(s<a){let u=e[n++];u&&(s+=u.size)}else{let u=e[--r];u&&(a+=u.size)}let c=0;return e[n-1]==null?(c=1,n--):e[n]==null&&(c=1,r++),new lj(Dn.of(e.slice(0,n)),c,Dn.of(e.slice(r)))}}function bc(t,e){return t==e?t:(t.constructor!=e.constructor&&(ml=!0),e)}Dn.prototype.size=1;const sj=rn.replace({});class ox extends Dn{constructor(e,n,r){super(e,n),this.deco=r,this.spaceAbove=0}mainBlock(e,n){return new Ri(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,n,r,s){return this.spaceAbove&&e<r+this.spaceAbove?new Ri(s,0,r,this.spaceAbove,sj):this.mainBlock(r,s)}lineAt(e,n,r,s,a){let c=this.mainBlock(s,a);return this.spaceAbove?this.blockAt(0,r,s,a).join(c):c}forEachLine(e,n,r,s,a,c){e<=a+this.length&&n>=a&&c(this.lineAt(0,Mt.ByPos,r,s,a))}setMeasuredHeight(e){let n=e.heights[e.index++];n<0?(this.spaceAbove=-n,n=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(n)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Qn extends ox{constructor(e,n,r){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=r}mainBlock(e,n){return new Ri(n,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,n,r){let s=r[0];return r.length==1&&(s instanceof Qn||s instanceof dn&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof dn?s=new Qn(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):Dn.of(r)}updateHeight(e,n=0,r=!1,s){return s&&s.from<=n&&s.more?this.setMeasuredHeight(s):(r||this.outdated)&&(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 dn extends Dn{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,s=e.doc.lineAt(n+this.length).number,a=s-r+1,c,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*a);c=f/a,this.length>a+1&&(u=(this.height-f)/(this.length-a-1))}else c=this.height/a;return{firstLine:r,lastLine:s,perLine:c,perChar:u}}blockAt(e,n,r,s){let{firstLine:a,lastLine:c,perLine:u,perChar:f}=this.heightMetrics(n,s);if(n.lineWrapping){let h=s+(e<n.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length)),g=n.doc.lineAt(h),b=u+g.length*f,v=Math.max(r,e-b/2);return new Ri(g.from,g.length,v,b,0)}else{let h=Math.max(0,Math.min(c-a,Math.floor((e-r)/u))),{from:g,length:b}=n.doc.line(a+h);return new Ri(g,b,r+u*h,u,0)}}lineAt(e,n,r,s,a){if(n==Mt.ByHeight)return this.blockAt(e,r,s,a);if(n==Mt.ByPosNoHeight){let{from:w,to:A}=r.doc.lineAt(e);return new Ri(w,A-w,0,0,0)}let{firstLine:c,perLine:u,perChar:f}=this.heightMetrics(r,a),h=r.doc.lineAt(e),g=u+h.length*f,b=h.number-c,v=s+u*b+f*(h.from-a-b);return new Ri(h.from,h.length,Math.max(s,Math.min(v,s+this.height-g)),g,0)}forEachLine(e,n,r,s,a,c){e=Math.max(e,a),n=Math.min(n,a+this.length);let{firstLine:u,perLine:f,perChar:h}=this.heightMetrics(r,a);for(let g=e,b=s;g<=n;){let v=r.doc.lineAt(g);if(g==e){let A=v.number-u;b+=f*A+h*(e-a-A)}let w=f+h*v.length;c(new Ri(v.from,v.length,b,w,0)),b+=w,g=v.to+1}}replace(e,n,r){let s=this.length-n;if(s>0){let a=r[r.length-1];a instanceof dn?r[r.length-1]=new dn(a.length+s):r.push(null,new dn(s-1))}if(e>0){let a=r[0];a instanceof dn?r[0]=new dn(e+a.length):r.unshift(new dn(e-1),null)}return Dn.of(r)}decomposeLeft(e,n){n.push(new dn(e-1),null)}decomposeRight(e,n){n.push(null,new dn(this.length-e-1))}updateHeight(e,n=0,r=!1,s){let a=n+this.length;if(s&&s.from<=n+this.length&&s.more){let c=[],u=Math.max(n,s.from),f=-1;for(s.from>n&&c.push(new dn(s.from-n-1).updateHeight(e,n));u<=a&&s.more;){let g=e.doc.lineAt(u).length;c.length&&c.push(null);let b=s.heights[s.index++],v=0;b<0&&(v=-b,b=s.heights[s.index++]),f==-1?f=b:Math.abs(b-f)>=yc&&(f=-2);let w=new Qn(g,b,v);w.outdated=!1,c.push(w),u+=g+1}u<=a&&c.push(null,new dn(a-u).updateHeight(e,u));let h=Dn.of(c);return(f<0||Math.abs(h.height-this.height)>=yc||Math.abs(f-this.heightMetrics(e,n).perLine)>=yc)&&(ml=!0),bc(this,h)}else(r||this.outdated)&&(this.setHeight(e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class lj extends Dn{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,s){let a=r+this.left.height;return e<a?this.left.blockAt(e,n,r,s):this.right.blockAt(e,n,a,s+this.left.length+this.break)}lineAt(e,n,r,s,a){let c=s+this.left.height,u=a+this.left.length+this.break,f=n==Mt.ByHeight?e<c:e<u,h=f?this.left.lineAt(e,n,r,s,a):this.right.lineAt(e,n,r,c,u);if(this.break||(f?h.to<u:h.from>u))return h;let g=n==Mt.ByPosNoHeight?Mt.ByPosNoHeight:Mt.ByPos;return f?h.join(this.right.lineAt(u,g,r,c,u)):this.left.lineAt(u,g,r,s,a).join(h)}forEachLine(e,n,r,s,a,c){let u=s+this.left.height,f=a+this.left.length+this.break;if(this.break)e<f&&this.left.forEachLine(e,n,r,s,a,c),n>=f&&this.right.forEachLine(e,n,r,u,f,c);else{let h=this.lineAt(f,Mt.ByPos,r,s,a);e<h.from&&this.left.forEachLine(e,h.from-1,r,s,a,c),h.to>=e&&h.from<=n&&c(h),n>h.to&&this.right.forEachLine(h.to+1,n,r,u,f,c)}}replace(e,n,r){let s=this.left.length+this.break;if(n<s)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,n-s,r));let a=[];e>0&&this.decomposeLeft(e,a);let c=a.length;for(let u of r)a.push(u);if(e>0&&cx(a,c-1),n<this.length){let u=a.length;this.decomposeRight(n,a),cx(a,u)}return Dn.of(a)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,s=r+this.break;if(e>=s)return this.right.decomposeRight(e-s,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<s&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Dn.of(this.break?[e,null,n]:[e,n]):(this.left=bc(this.left,e),this.right=bc(this.right,n),this.setHeight(e.height+n.height),this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,s){let{left:a,right:c}=this,u=n+a.length+this.break,f=null;return s&&s.from<=n+a.length&&s.more?f=a=a.updateHeight(e,n,r,s):a.updateHeight(e,n,r),s&&s.from<=u+c.length&&s.more?f=c=c.updateHeight(e,u,r,s):c.updateHeight(e,u,r),f?this.balanced(a,c):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function cx(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof dn&&(r=t[e+1])instanceof dn&&t.splice(e-1,3,new dn(n.length+1+r.length))}const aj=5;class mh{constructor(e,n){this.pos=e,this.oracle=n,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,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Qn?s.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Qn(r-this.pos,-1,0)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let s=r.widget?r.widget.estimatedHeight:0,a=r.widget?r.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let c=n-e;r.block?this.addBlock(new ox(c,s,r)):(c||a||s>=aj)&&this.addLineDeco(s,a,c)}else n>e&&this.span(e,n);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:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,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 Qn(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,n){let r=new dn(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Qn)return e;let n=new Qn(0,-1,0);return this.nodes.push(n),n}addBlock(e){this.enterLine();let n=e.deco;n&&n.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,n&&n.endSide>0&&(this.covering=e)}addLineDeco(e,n,r){let s=this.ensureLine();s.length+=r,s.collapsed+=r,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Qn)&&!this.isCovered?this.nodes.push(new Qn(0,-1,0)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let s of this.nodes)s instanceof Qn&&s.updateHeight(this.oracle,r),r+=s?s.length:1;return this.nodes}static build(e,n,r,s){let a=new mh(r,e);return mt.spans(n,r,s,a,0),a.finish(r)}}function oj(t,e,n){let r=new cj;return mt.compare(t,e,n,r,0),r.changes}class cj{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,s){(e<n||r&&r.heightRelevant||s&&s.heightRelevant)&&ol(e,n,this.changes,5)}}function uj(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,s=r.defaultView||window,a=Math.max(0,n.left),c=Math.min(s.innerWidth,n.right),u=Math.max(0,n.top),f=Math.min(s.innerHeight,n.bottom);for(let h=t.parentNode;h&&h!=r.body;)if(h.nodeType==1){let g=h,b=window.getComputedStyle(g);if((g.scrollHeight>g.clientHeight||g.scrollWidth>g.clientWidth)&&b.overflow!="visible"){let v=g.getBoundingClientRect();a=Math.max(a,v.left),c=Math.min(c,v.right),u=Math.max(u,v.top),f=Math.min(h==t.parentNode?s.innerHeight:f,v.bottom)}h=b.position=="absolute"||b.position=="fixed"?g.offsetParent:g.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:a-n.left,right:Math.max(a,c)-n.left,top:u-(n.top+e),bottom:Math.max(u,f)-(n.top+e)}}function dj(t){let e=t.getBoundingClientRect(),n=t.ownerDocument.defaultView||window;return e.left<n.innerWidth&&e.right>0&&e.top<n.innerHeight&&e.bottom>0}function fj(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}class gh{constructor(e,n,r,s){this.from=e,this.to=n,this.size=r,this.displaySize=s}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let s=e[r],a=n[r];if(s.from!=a.from||s.to!=a.to||s.size!=a.size)return!1}return!0}draw(e,n){return rn.replace({widget:new hj(this.displaySize*(n?e.scaleY:e.scaleX),n)}).range(this.from,this.to)}}class hj extends nc{constructor(e,n){super(),this.size=e,this.vertical=n}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 ux{constructor(e,n){this.view=e,this.state=n,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=dx,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Lt.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let r=n.facet(rh).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new ij(r),this.stateDeco=fx(n),this.heightMap=Dn.empty().applyChanges(this.stateDeco,gt.empty,this.heightOracle.setDoc(n.doc),[new di(0,0,0,n.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=rn.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let s=r?n.head:n.anchor;if(!e.some(({from:a,to:c})=>s>=a&&s<=c)){let{from:a,to:c}=this.lineBlockAt(s);e.push(new xc(a,c))}}return this.viewports=e.sort((r,s)=>r.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?dx:new yh(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(Ma(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=fx(this.state);let s=e.changedRanges,a=di.extendWithRanges(s,oj(r,this.stateDeco,e?e.changes:en.empty(this.state.doc.length))),c=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);ax(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=c||ml)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=c);let f=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<f.from||n.range.head>f.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,n));let h=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(h||!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),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Cb)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,n=e.contentDOM,r=window.getComputedStyle(n),s=this.heightOracle,a=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Lt.RTL:Lt.LTR;let c=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent==="refresh",u=n.getBoundingClientRect(),f=c||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let h=0,g=0;if(u.width&&u.height){let{scaleX:_,scaleY:q}=rb(n,u);(_>.005&&Math.abs(this.scaleX-_)>.005||q>.005&&Math.abs(this.scaleY-q)>.005)&&(this.scaleX=_,this.scaleY=q,h|=16,c=f=!0)}let b=(parseInt(r.paddingTop)||0)*this.scaleY,v=(parseInt(r.paddingBottom)||0)*this.scaleY;(this.paddingTop!=b||this.paddingBottom!=v)&&(this.paddingTop=b,this.paddingBottom=v,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let w=sb(this.view.contentDOM,!1).y;w!=this.scrollParent&&(this.scrollParent=w,this.scrollAnchorHeight=-1,this.scrollOffset=0);let A=this.getScrollOffset();this.scrollOffset!=A&&(this.scrollAnchorHeight=-1,this.scrollOffset=A),this.scrolledToBottom=ub(this.scrollParent||e.win);let C=(this.printing?fj:uj)(n,this.paddingTop),O=C.top-this.pixelViewport.top,D=C.bottom-this.pixelViewport.bottom;this.pixelViewport=C;let E=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(E!=this.inView&&(this.inView=E,E&&(f=!0)),!this.inView&&!this.scrollTarget&&!dj(e.dom))return 0;let j=u.width;if((this.contentDOMWidth!=j||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),f){let _=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(_)&&(c=!0),c||s.lineWrapping&&Math.abs(j-this.contentDOMWidth)>s.charWidth){let{lineHeight:q,charWidth:R,textHeight:X}=e.docView.measureTextSize();c=q>0&&s.refresh(a,q,R,X,Math.max(5,j/R),_),c&&(e.docView.minWidth=0,h|=16)}O>0&&D>0?g=Math.max(O,D):O<0&&D<0&&(g=Math.min(O,D)),ax();for(let q of this.viewports){let R=q.from==this.viewport.from?_:e.docView.measureVisibleLineHeights(q);this.heightMap=(c?Dn.empty().applyChanges(this.stateDeco,gt.empty,this.heightOracle,[new di(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,c,new rj(q.from,R))}ml&&(h|=2)}let M=!this.viewportIsAppropriate(this.viewport,g)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return M&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(g,this.scrollTarget),h|=this.updateForViewport()),(h&2||M)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(c?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,a=this.heightOracle,{visibleTop:c,visibleBottom:u}=this,f=new xc(s.lineAt(c-r*1e3,Mt.ByHeight,a,0,0).from,s.lineAt(u+(1-r)*1e3,Mt.ByHeight,a,0,0).to);if(n){let{head:h}=n.range;if(h<f.from||h>f.to){let g=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),b=s.lineAt(h,Mt.ByPos,a,0,0),v;n.y=="center"?v=(b.top+b.bottom)/2-g/2:n.y=="start"||n.y=="nearest"&&h<f.from?v=b.top:v=b.bottom-g,f=new xc(s.lineAt(v-500,Mt.ByHeight,a,0,0).from,s.lineAt(v+g+500,Mt.ByHeight,a,0,0).to)}}return f}mapViewport(e,n){let r=n.mapPos(e.from,-1),s=n.mapPos(e.to,1);return new xc(this.heightMap.lineAt(r,Mt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,Mt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,Mt.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(n,Mt.ByPos,this.heightOracle,0,0),{visibleTop:c,visibleBottom:u}=this;return(e==0||s<=c-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||a>=u+Math.max(10,Math.min(r,250)))&&s>c-2e3&&a<u+2e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let s of e)n.touchesRange(s.from,s.to)||r.push(new gh(n.mapPos(s.from),n.mapPos(s.to),s.size,s.displaySize));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,s=r?1e4:2e3,a=s>>1,c=s<<1;if(this.defaultTextDirection!=Lt.LTR&&!r)return[];let u=[],f=(g,b,v,w)=>{if(b-g<a)return;let A=this.state.selection.main,C=[A.from];A.empty||C.push(A.to);for(let D of C)if(D>g&&D<b){f(g,D-10,v,w),f(D+10,b,v,w);return}let O=mj(e,D=>D.from>=v.from&&D.to<=v.to&&Math.abs(D.from-g)<a&&Math.abs(D.to-b)<a&&!C.some(E=>D.from<E&&D.to>E));if(!O){if(b<v.to&&n&&r&&n.visibleRanges.some(j=>j.from<=b&&j.to>=b)){let j=n.moveToLineBoundary(Ae.cursor(b),!1,!0).head;j>g&&(b=j)}let D=this.gapSize(v,g,b,w),E=r||D<2e6?D:2e6;O=new gh(g,b,D,E)}u.push(O)},h=g=>{if(g.length<c||g.type!=un.Text)return;let b=pj(g.from,g.to,this.stateDeco);if(b.total<c)return;let v=this.scrollTarget?this.scrollTarget.range.head:null,w,A;if(r){let C=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,O,D;if(v!=null){let E=wc(b,v),j=((this.visibleBottom-this.visibleTop)/2+C)/g.height;O=E-j,D=E+j}else O=(this.visibleTop-g.top-C)/g.height,D=(this.visibleBottom-g.top+C)/g.height;w=vc(b,O),A=vc(b,D)}else{let C=b.total*this.heightOracle.charWidth,O=s*this.heightOracle.charWidth,D=0;if(C>2e6)for(let q of e)q.from>=g.from&&q.from<g.to&&q.size!=q.displaySize&&q.from*this.heightOracle.charWidth+D<this.pixelViewport.left&&(D=q.size-q.displaySize);let E=this.pixelViewport.left+D,j=this.pixelViewport.right+D,M,_;if(v!=null){let q=wc(b,v),R=((j-E)/2+O)/C;M=q-R,_=q+R}else M=(E-O)/C,_=(j+O)/C;w=vc(b,M),A=vc(b,_)}w>g.from&&f(g.from,w,g,b),A<g.to&&f(A,g.to,g,b)};for(let g of this.viewportLines)Array.isArray(g.type)?g.type.forEach(h):h(g);return u}gapSize(e,n,r,s){let a=wc(s,r)-wc(s,n);return this.heightOracle.lineWrapping?e.height*a:s.total*this.heightOracle.charWidth*a}updateLineGaps(e){gh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=rn.set(e.map(n=>n.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let n=this.stateDeco;this.lineGaps.length&&(n=n.concat(this.lineGapDeco));let r=[];mt.spans(n,this.viewport.from,this.viewport.to,{span(a,c){r.push({from:a,to:c})},point(){}},20);let s=0;if(r.length!=this.visibleRanges.length)s=12;else for(let a=0;a<r.length&&!(s&8);a++){let c=this.visibleRanges[a],u=r[a];(c.from!=u.from||c.to!=u.to)&&(s|=4,e&&e.mapPos(c.from,-1)==u.from&&e.mapPos(c.to,1)==u.to||(s|=8))}return this.visibleRanges=r,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||Ma(this.heightMap.lineAt(e,Mt.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(n=>n.top<=e&&n.bottom>=e)||Ma(this.heightMap.lineAt(this.scaler.fromDOM(e),Mt.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 n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return Ma(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 xc{constructor(e,n){this.from=e,this.to=n}}function pj(t,e,n){let r=[],s=t,a=0;return mt.spans(n,t,e,{span(){},point(c,u){c>s&&(r.push({from:s,to:c}),a+=c-s),s=u}},20),s<e&&(r.push({from:s,to:e}),a+=e-s),{total:a,ranges:r}}function vc({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let s=0;;s++){let{from:a,to:c}=e[s],u=c-a;if(r<=u)return a+r;r-=u}}function wc(t,e){let n=0;for(let{from:r,to:s}of t.ranges){if(e<=s){n+=e-r;break}n+=s-r}return n/t.total}function mj(t,e){for(let n of t)if(e(n))return n}const dx={toDOM(t){return t},fromDOM(t){return t},scale:1,eq(t){return t==this}};function fx(t){let e=t.facet(ac).filter(r=>typeof r!="function"),n=t.facet(sh).filter(r=>typeof r!="function");return n.length&&e.push(mt.join(n)),e}class yh{constructor(e,n,r){let s=0,a=0,c=0;this.viewports=r.map(({from:u,to:f})=>{let h=n.lineAt(u,Mt.ByPos,e,0,0).top,g=n.lineAt(f,Mt.ByPos,e,0,0).bottom;return s+=g-h,{from:u,to:f,top:h,bottom:g,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(n.height-s);for(let u of this.viewports)u.domTop=c+(u.top-a)*this.scale,c=u.domBottom=u.domTop+(u.bottom-u.top),a=u.bottom}toDOM(e){for(let n=0,r=0,s=0;;n++){let a=n<this.viewports.length?this.viewports[n]:null;if(!a||e<a.top)return s+(e-r)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);r=a.bottom,s=a.domBottom}}fromDOM(e){for(let n=0,r=0,s=0;;n++){let a=n<this.viewports.length?this.viewports[n]:null;if(!a||e<a.domTop)return r+(e-s)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);r=a.bottom,s=a.domBottom}}eq(e){return e instanceof yh?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((n,r)=>n.from==e.viewports[r].from&&n.to==e.viewports[r].to):!1}}function Ma(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new Ri(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(s=>Ma(s,e)):t._content)}const Sc=Ue.define({combine:t=>t.join(" ")}),bh=Ue.define({combine:t=>t.indexOf(!0)>-1}),xh=al.newName(),hx=al.newName(),px=al.newName(),mx={"&light":"."+hx,"&dark":"."+px};function vh(t,e,n){return new al(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,s=>{if(s=="&")return t;if(!n||!n[s])throw new RangeError(`Unsupported selector: ${s}`);return n[s]}):t+" "+r}})}const gj=vh("."+xh,{"&":{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:"text-top",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"}},mx),yj={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},wh=Re.ie&&Re.ie_version<=11;class bj{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new KN,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(n=>{for(let r of n)this.queue.push(r);(Re.ie&&Re.ie_version<=11||Re.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Re.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Re.chrome&&Re.chrome_version<126)&&(this.editContext=new vj(e),e.state.facet(sr)&&(e.contentDOM.editContext=this.editContext.editContext)),wh&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.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 n;((n=this.view.docView)===null||n===void 0?void 0:n.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(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.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(n=>{n.length>0&&n[n.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(!1),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((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,s=this.selectionRange;if(r.state.facet(sr)?r.root.activeElement!=this.dom:!Ca(this.dom,s))return;let a=s.anchorNode&&r.docView.tile.nearest(s.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Re.ie&&Re.ie_version<=11||Re.android&&Re.chrome)&&!r.state.selection.main.empty&&s.focusNode&&Na(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=ka(e.root);if(!n)return!1;let r=Re.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&xj(this.view,n)||n;if(!r||this.selectionRange.eq(r))return!1;let s=Ca(this.dom,r);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&XN(this.dom,r)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(r),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.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,yj),wh&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),wh&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let s=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&cl(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.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()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),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=[]);let n=-1,r=-1,s=!1;for(let a of e){let c=this.readMutation(a);c&&(c.typeOver&&(s=!0),n==-1?{from:n,to:r}=c:(n=Math.min(c.from,n),r=Math.max(c.to,r)))}return{from:n,to:r,typeOver:s}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),s=this.selectionChanged&&Ca(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new qT(this.view,e,n,r);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,s=Vb(this.view,n);return this.view.state==r&&(n.domChanged||n.newSel&&!hc(this.view.state.selection,n.newSel.main))&&this.view.update([]),s}readMutation(e){let n=this.view.docView.tile.nearest(e.target);if(!n||n.isWidget())return null;if(n.markDirty(e.type=="attributes"),e.type=="childList"){let r=gx(n,e.previousSibling||e.target.previousSibling,-1),s=gx(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:s?n.posBefore(s):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.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(sr)!=e.state.facet(sr)&&(e.view.contentDOM.editContext=e.state.facet(sr)?this.editContext.editContext:null))}destroy(){var e,n,r;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect();for(let s of this.scrollTargets)s.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 gx(t,e,n){for(;e;){let r=Bt.get(e);if(r&&r.parent==t)return r;let s=e.parentNode;e=s!=t.dom?s:n>0?e.nextSibling:e.previousSibling}return null}function yx(t,e){let n=e.startContainer,r=e.startOffset,s=e.endContainer,a=e.endOffset,c=t.docView.domAtPos(t.state.selection.main.anchor,1);return Na(c.node,c.offset,s,a)&&([n,r,s,a]=[s,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:a}}function xj(t,e){if(e.getComposedRanges){let s=e.getComposedRanges(t.root)[0];if(s)return yx(t,s)}let n=null;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return t.contentDOM.addEventListener("beforeinput",r,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",r,!0),n?yx(t,n):null}class vj{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let n=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=r=>{let s=e.state.selection.main,{anchor:a,head:c}=s,u=this.toEditorPos(r.updateRangeStart),f=this.toEditorPos(r.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:r.updateRangeStart,editorBase:u,drifted:!1});let h=f-u>r.text.length;u==this.from&&a<this.from?u=a:f==this.to&&a>this.to&&(f=a);let g=Fb(e.state.sliceDoc(u,f),r.text,(h?s.from:s.to)-u,h?"end":null);if(!g){let v=Ae.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));hc(v,s)||e.dispatch({selection:v,userEvent:"select"});return}let b={from:g.from+u,to:g.toA+u,insert:gt.of(r.text.slice(g.from,g.toB).split(`
|
|
58
|
+
`))};if((Re.mac||Re.android)&&b.from==c-1&&/^\. ?$/.test(r.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(b={from:u,to:f,insert:gt.of([r.text.replace("."," ")])}),this.pendingContextChange=b,!e.state.readOnly){let v=this.to-this.from+(b.to-b.from+b.insert.length);hh(e,b,Ae.single(this.toEditorPos(r.selectionStart,v),this.toEditorPos(r.selectionEnd,v)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),b.from<b.to&&!b.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(n.text.slice(Math.max(0,r.updateRangeStart-1),Math.min(n.text.length,r.updateRangeStart+1)))&&this.handlers.compositionend(r)},this.handlers.characterboundsupdate=r=>{let s=[],a=null;for(let c=this.toEditorPos(r.rangeStart),u=this.toEditorPos(r.rangeEnd);c<u;c++){let f=e.coordsForChar(c);a=f&&new DOMRect(f.left,f.top,f.right-f.left,f.bottom-f.top)||a||new DOMRect,s.push(a)}n.updateCharacterBounds(r.rangeStart,s)},this.handlers.textformatupdate=r=>{let s=[];for(let a of r.getTextFormats()){let c=a.underlineStyle,u=a.underlineThickness;if(!/none/i.test(c)&&!/none/i.test(u)){let f=this.toEditorPos(a.rangeStart),h=this.toEditorPos(a.rangeEnd);if(f<h){let g=`text-decoration: underline ${/^[a-z]/.test(c)?c+" ":c=="Dashed"?"dashed ":c=="Squiggle"?"wavy ":""}${/thin/i.test(u)?1:2}px`;s.push(rn.mark({attributes:{style:g}}).range(f,h))}}}e.dispatch({effects:Tb.of(rn.set(s))})},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:r}=this.composing;this.composing=null,r&&this.reset(e.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{let s=ka(r.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let n=0,r=!1,s=this.pendingContextChange;return e.changes.iterChanges((a,c,u,f,h)=>{if(r)return;let g=h.length-(c-a);if(s&&c>=s.to)if(s.from==a&&s.to==c&&s.insert.eq(h)){s=this.pendingContextChange=null,n+=g,this.to+=g;return}else s=null,this.revertPending(e.state);if(a+=n,c+=n,c<=this.from)this.from+=g,this.to+=g;else if(a<this.to){if(a<this.from||c>this.to||this.to-this.from+h.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(c),h.toString()),this.to+=g}n+=g}),s&&!r&&this.revertPending(e.state),!r}update(e){let n=this.pendingContextChange,r=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(r.from,r.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.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||n)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:n}=e.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(e.doc.length,n+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 n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),e.doc.sliceString(n.from,n.to))}setSelection(e){let{main:n}=e.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),s=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(r,s)}rangeIsValid(e){let{head:n}=e.selection.main;return!(this.from>0&&n-this.from<500||this.to<e.doc.length&&this.to-n<500||this.to-this.from>3e4)}toEditorPos(e,n=this.to-this.from){e=Math.min(e,n);let r=this.composing;return r&&r.drifted?r.editorBase+(e-r.contextBase):e+this.from}toContextPos(e){let n=this.composing;return n&&n.drifted?n.contextBase+(e-n.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Je{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 n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],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:r}=e;this.dispatchTransactions=e.dispatchTransactions||r&&(s=>s.forEach(a=>r(a,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||GN(e.parent)||document,this.viewState=new ux(this,e.state||wt.create(e)),e.scrollTo&&e.scrollTo.is(lc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(dl).map(s=>new ih(s));for(let s of this.plugins)s.update(this);this.observer=new bj(this),this.inputState=new HT(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Bb(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let n=e.length==1&&e[0]instanceof tn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,s,a=this.state;for(let v of e){if(v.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=v.state}if(this.destroyed){this.viewState.state=a;return}let c=this.hasFocus,u=0,f=null;e.some(v=>v.annotation(nx))?(this.inputState.notifiedFocused=c,u=1):c!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=c,f=ix(a,c),f||(u=1));let h=this.observer.delayedAndroidKey,g=null;if(h?(this.observer.clearDelayedAndroidKey(),g=this.observer.readChange(),(g&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(g=null)):this.observer.clear(),a.facet(wt.phrases)!=this.state.facet(wt.phrases))return this.setState(a);s=oc.create(this,a,e),s.flags|=u;let b=this.viewState.scrollTarget;try{this.updateState=2;for(let v of e){if(b&&(b=b.map(v.changes)),v.scrollIntoView){let{main:w}=v.state.selection,{x:A,y:C}=this.state.facet(Je.cursorScrollMargin);b=new ul(w.empty?w:Ae.cursor(w.head,w.head>w.anchor?-1:1),"nearest","nearest",C,A)}for(let w of v.effects)w.is(lc)&&(b=w.value.clip(this.state))}this.viewState.update(s,b),this.bidiCache=Ac.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),n=this.docView.update(s),this.state.facet(Ea)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(v=>v.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Sc)!=s.state.facet(Sc)&&(this.viewState.mustMeasureContent=!0),(n||r||b||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!s.empty)for(let v of this.state.facet(eh))try{v(s)}catch(w){Pi(this.state,w,"update listener")}(f||g)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),g&&!Vb(this,g)&&h.force&&cl(this.contentDOM,h.key,h.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 n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new ux(this,e),this.plugins=e.facet(dl).map(r=>new ih(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new Bb(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(dl),r=e.state.facet(dl);if(n!=r){let s=[];for(let a of r){let c=n.indexOf(a);if(c<0)s.push(new ih(a));else{let u=this.plugins[c];u.mustUpdate=e,s.push(u)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let n=e.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){Pi(this.state,r,"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 n=null,r=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:a,scrollAnchorHeight:c,scaleY:u}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(c=-1),this.viewState.scrollAnchorHeight=-1;try{for(let f=0;;f++){if(c<0){if(ub(r||this.win))a=-1,c=this.viewState.heightMap.height/this.viewState.scaleY;else{let A=this.viewState.scrollAnchorAt(s);a=A.from,c=A.top}u=this.viewState.scaleY}this.updateState=1;let h=this.viewState.measure();if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(f>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let g=[];h&4||([this.measureRequests,g]=[g,this.measureRequests]);let b=g.map(A=>{try{return A.read(this)}catch(C){return Pi(this.state,C),bx}}),v=oc.create(this,this.state,[]),w=!1;v.flags|=h,n?n.flags|=h:n=v,this.updateState=2,v.empty||(this.updatePlugins(v),this.inputState.update(v),this.updateAttrs(),w=this.docView.update(v),w&&this.docViewUpdate());for(let A=0;A<g.length;A++)if(b[A]!=bx)try{let C=g[A];C.write&&C.write(b[A],this)}catch(C){Pi(this.state,C)}if(w&&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,c=-1;continue}else{let C=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)/this.viewState.scaleY-c/u;if((C>1||C<-1)&&!(Re.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(r==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+C,r?a<0?r.scrollTop=r.scrollHeight:r.scrollTop+=C:this.win.scrollBy(0,C),c=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let f of this.state.facet(eh))f(n)}get themeClasses(){return xh+" "+(this.state.facet(bh)?px:hx)+" "+this.state.facet(Sc)}updateAttrs(){let e=xx(this,jb,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(sr)?"true":"false",class:"cm-content",style:`${Re.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),xx(this,rh,n);let r=this.observer.ignore(()=>{let s=tb(this.contentDOM,this.contentAttrs,n),a=tb(this.dom,this.editorAttrs,e);return s||a});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let s of r.effects)if(s.is(Je.announce)){n&&(this.announceDOM.textContent=""),n=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Ea);let e=this.state.facet(Je.cspNonce);al.mount(this.root,this.styleModules.concat(gj).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 n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.plugin!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.plugin==e)||null),n&&n.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,n,r){return dh(this,e,Ib(this,e,n,r))}moveByGroup(e,n){return dh(this,e,Ib(this,e,n,r=>OT(this,e.head,r)))}visualLineSide(e,n){let r=this.bidiSpans(e),s=this.textDirectionAt(e.from),a=r[n?r.length-1:0];return Ae.cursor(a.side(n,s)+e.from,a.forward(!n,s)?1:-1)}moveToLineBoundary(e,n,r=!0){return ET(this,e,n,r)}moveVertically(e,n,r){return dh(this,e,MT(this,e,n,r))}domAtPos(e,n=1){return this.docView.domAtPos(e,n)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){this.readMeasured();let r=fh(this,e,n);return r&&r.pos}posAndSideAtCoords(e,n=!0){return this.readMeasured(),fh(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.state.doc.lineAt(e),s=this.bidiSpans(r),a=s[Fi.find(s,e-r.from,-1,n)];return this.docView.coordsAt(e,n,a.dir==Lt.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(kb)||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>wj)return gb(e.length);let n=this.textDirectionAt(e.from),r;for(let a of this.bidiCache)if(a.from==e.from&&a.dir==n&&(a.fresh||mb(a.isolates,r=Mb(this,e))))return a.order;r||(r=Mb(this,e));let s=nT(e.text,n,r);return this.bidiCache.push(new Ac(e.from,e.to,n,r,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Re.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{ob(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.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){var r,s,a,c;return lc.of(new ul(typeof e=="number"?Ae.cursor(e):e,(r=n.y)!==null&&r!==void 0?r:"nearest",(s=n.x)!==null&&s!==void 0?s:"nearest",(a=n.yMargin)!==null&&a!==void 0?a:5,(c=n.xMargin)!==null&&c!==void 0?c:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(e);return lc.of(new ul(Ae.cursor(r.from),"start","start",r.top-e,n,!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 lr.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return lr.define(()=>({}),{eventObservers:e})}static theme(e,n){let r=al.newName(),s=[Sc.of(r),Ea.of(vh(`.${r}`,e))];return n&&n.dark&&s.push(bh.of(!0)),s}static baseTheme(e){return Go.lowest(Ea.of(vh("."+xh,e,mx)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),s=r&&Bt.get(r)||Bt.get(e);return((n=s?.root)===null||n===void 0?void 0:n.view)||null}}Je.styleModule=Ea,Je.inputHandler=Sb,Je.clipboardInputFilter=th,Je.clipboardOutputFilter=nh,Je.scrollHandler=Nb,Je.focusChangeEffect=Ab,Je.perLineTextDirection=kb,Je.exceptionSink=wb,Je.updateListener=eh,Je.editable=sr,Je.mouseSelectionStyle=vb,Je.dragMovesSelection=xb,Je.clickAddsSelectionRange=bb,Je.decorations=ac,Je.blockWrappers=Eb,Je.outerDecorations=sh,Je.atomicRanges=ja,Je.bidiIsolatedRanges=Ob,Je.cursorScrollMargin=Ue.define({combine:t=>{let e=5,n=5;for(let r of t)typeof r=="number"?e=n=r:{x:e,y:n}=r;return{x:e,y:n}}}),Je.scrollMargins=Rb,Je.darkTheme=bh,Je.cspNonce=Ue.define({combine:t=>t.length?t[0]:""}),Je.contentAttributes=rh,Je.editorAttributes=jb,Je.lineWrapping=Je.contentAttributes.of({class:"cm-lineWrapping"}),Je.announce=zt.define();const wj=4096,bx={};class Ac{constructor(e,n,r,s,a,c){this.from=e,this.to=n,this.dir=r,this.isolates=s,this.fresh=a,this.order=c}static update(e,n){if(n.empty&&!e.some(a=>a.fresh))return e;let r=[],s=e.length?e[e.length-1].dir:Lt.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let c=e[a];c.dir==s&&!n.touchesRange(c.from,c.to)&&r.push(new Ac(n.mapPos(c.from,1),n.mapPos(c.to,-1),c.dir,c.isolates,!1,c.order))}return r}}function xx(t,e,n){for(let r=t.state.facet(e),s=r.length-1;s>=0;s--){let a=r[s],c=typeof a=="function"?a(t):a;c&&Kf(c,n)}return n}const Sj=Re.mac?"mac":Re.windows?"win":Re.linux?"linux":"key";function Aj(t,e){const n=t.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let s,a,c,u;for(let f=0;f<n.length-1;++f){const h=n[f];if(/^(cmd|meta|m)$/i.test(h))u=!0;else if(/^a(lt)?$/i.test(h))s=!0;else if(/^(c|ctrl|control)$/i.test(h))a=!0;else if(/^s(hift)?$/i.test(h))c=!0;else if(/^mod$/i.test(h))e=="mac"?u=!0:a=!0;else throw new Error("Unrecognized modifier name: "+h)}return s&&(r="Alt-"+r),a&&(r="Ctrl-"+r),u&&(r="Meta-"+r),c&&(r="Shift-"+r),r}function kc(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}const kj=Go.default(Je.domEventHandlers({keydown(t,e){return jj(Cj(e.state),t,e,"editor")}})),vx=Ue.define({enables:kj}),wx=new WeakMap;function Cj(t){let e=t.facet(vx),n=wx.get(e);return n||wx.set(e,n=Tj(e.reduce((r,s)=>r.concat(s),[]))),n}let Ur=null;const Nj=4e3;function Tj(t,e=Sj){let n=Object.create(null),r=Object.create(null),s=(c,u)=>{let f=r[c];if(f==null)r[c]=u;else if(f!=u)throw new Error("Key binding "+c+" is used both as a regular binding and as a multi-stroke prefix")},a=(c,u,f,h,g)=>{var b,v;let w=n[c]||(n[c]=Object.create(null)),A=u.split(/ (?!$)/).map(D=>Aj(D,e));for(let D=1;D<A.length;D++){let E=A.slice(0,D).join(" ");s(E,!0),w[E]||(w[E]={preventDefault:!0,stopPropagation:!1,run:[j=>{let M=Ur={view:j,prefix:E,scope:c};return setTimeout(()=>{Ur==M&&(Ur=null)},Nj),!0}]})}let C=A.join(" ");s(C,!1);let O=w[C]||(w[C]={preventDefault:!1,stopPropagation:!1,run:((v=(b=w._any)===null||b===void 0?void 0:b.run)===null||v===void 0?void 0:v.slice())||[]});f&&O.run.push(f),h&&(O.preventDefault=!0),g&&(O.stopPropagation=!0)};for(let c of t){let u=c.scope?c.scope.split(" "):["editor"];if(c.any)for(let h of u){let g=n[h]||(n[h]=Object.create(null));g._any||(g._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:b}=c;for(let v in g)g[v].run.push(w=>b(w,Sh))}let f=c[e]||c.key;if(f)for(let h of u)a(h,f,c.run,c.preventDefault,c.stopPropagation),c.shift&&a(h,"Shift-"+f,c.shift,c.preventDefault,c.stopPropagation)}return n}let Sh=null;function jj(t,e,n,r){Sh=e;let s=zN(e),a=AN(s,0),c=kN(a)==s.length&&s!=" ",u="",f=!1,h=!1,g=!1;Ur&&Ur.view==n&&Ur.scope==r&&(u=Ur.prefix+" ",Kb.indexOf(e.keyCode)<0&&(h=!0,Ur=null));let b=new Set,v=O=>{if(O){for(let D of O.run)if(!b.has(D)&&(b.add(D),D(n)))return O.stopPropagation&&(g=!0),!0;O.preventDefault&&(O.stopPropagation&&(g=!0),h=!0)}return!1},w=t[r],A,C;return w&&(v(w[u+kc(s,e,!c)])?f=!0:c&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Re.windows&&e.ctrlKey&&e.altKey)&&!(Re.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(A=Hr[e.keyCode])&&A!=s?(v(w[u+kc(A,e,!0)])||e.shiftKey&&(C=va[e.keyCode])!=s&&C!=A&&v(w[u+kc(C,e,!1)]))&&(f=!0):c&&e.shiftKey&&v(w[u+kc(s,e,!0)])&&(f=!0),!f&&v(w._any)&&(f=!0)),h&&(f=!0),f&&g&&e.stopPropagation(),Sh=null,f}class _s{constructor(e,n,r,s,a){this.className=e,this.left=n,this.top=r,this.width=s,this.height=a}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let s=e.coordsAtPos(r.head,r.assoc||1);if(!s)return[];let a=Sx(e);return[new _s(n,s.left-a.left,s.top-a.top,null,s.bottom-s.top)]}else return Ej(e,n,r)}}function Sx(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Lt.LTR?e.left:e.right-t.scrollDOM.clientWidth*t.scaleX)-t.scrollDOM.scrollLeft*t.scaleX,top:e.top-t.scrollDOM.scrollTop*t.scaleY}}function Ax(t,e,n,r){let s=t.coordsAtPos(e,n*2);if(!s)return r;let a=t.dom.getBoundingClientRect(),c=(s.top+s.bottom)/2,u=t.posAtCoords({x:a.left+1,y:c}),f=t.posAtCoords({x:a.right-1,y:c});return u==null||f==null?r:{from:Math.max(r.from,Math.min(u,f)),to:Math.min(r.to,Math.max(u,f))}}function Ej(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),s=Math.min(n.to,t.viewport.to),a=t.textDirection==Lt.LTR,c=t.contentDOM,u=c.getBoundingClientRect(),f=Sx(t),h=c.querySelector(".cm-line"),g=h&&window.getComputedStyle(h),b=u.left+(g?parseInt(g.paddingLeft)+Math.min(0,parseInt(g.textIndent)):0),v=u.right-(g?parseInt(g.paddingRight):0),w=uh(t,r,1),A=uh(t,s,-1),C=w.type==un.Text?w:null,O=A.type==un.Text?A:null;if(C&&(t.lineWrapping||w.widgetLineBreaks)&&(C=Ax(t,r,1,C)),O&&(t.lineWrapping||A.widgetLineBreaks)&&(O=Ax(t,s,-1,O)),C&&O&&C.from==O.from&&C.to==O.to)return E(j(n.from,n.to,C));{let _=C?j(n.from,null,C):M(w,!1),q=O?j(null,n.to,O):M(A,!0),R=[];return(C||w).to<(O||A).from-(C&&O?1:0)||w.widgetLineBreaks>1&&_.bottom+t.defaultLineHeight/2<q.top?R.push(D(b,_.bottom,v,q.top)):_.bottom<q.top&&t.elementAtHeight((_.bottom+q.top)/2).type==un.Text&&(_.bottom=q.top=(_.bottom+q.top)/2),E(_).concat(R).concat(E(q))}function D(_,q,R,X){return new _s(e,_-f.left,q-f.top,Math.max(0,R-_),X-q)}function E({top:_,bottom:q,horizontal:R}){let X=[];for(let U=0;U<R.length;U+=2)X.push(D(R[U],_,R[U+1],q));return X}function j(_,q,R){let X=1e9,U=-1e9,B=[];function K(pe,fe,L,Q,oe){let ce=t.coordsAtPos(pe,pe==R.to?-2:2),ve=t.coordsAtPos(L,L==R.from?2:-2);!ce||!ve||(X=Math.min(ce.top,ve.top,X),U=Math.max(ce.bottom,ve.bottom,U),oe==Lt.LTR?B.push(a&&fe?b:ce.left,a&&Q?v:ve.right):B.push(!a&&Q?b:ve.left,!a&&fe?v:ce.right))}let W=_??R.from,ye=q??R.to;for(let pe of t.visibleRanges)if(pe.to>W&&pe.from<ye)for(let fe=Math.max(pe.from,W),L=Math.min(pe.to,ye);;){let Q=t.state.doc.lineAt(fe);for(let oe of t.bidiSpans(Q)){let ce=oe.from+Q.from,ve=oe.to+Q.from;if(ce>=L)break;ve>fe&&K(Math.max(ce,fe),_==null&&ce<=W,Math.min(ve,L),q==null&&ve>=ye,oe.dir)}if(fe=Q.to+1,fe>=L)break}return B.length==0&&K(W,_==null,ye,q==null,t.textDirection),{top:X,bottom:U,horizontal:B}}function M(_,q){let R=u.top+(q?_.top:_.bottom);return{top:R,bottom:R,horizontal:[]}}}function Oj(t,e){return t.constructor==e.constructor&&t.eq(e)}class Mj{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(Cc)!=e.state.facet(Cc)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(Cc);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:n}=this.view;(e!=this.scaleX||n!=this.scaleY)&&(this.scaleX=e,this.scaleY=n,this.dom.style.transform=`scale(${1/e}, ${1/n})`)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!Oj(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let s of e)s.update&&n&&s.constructor&&this.drawn[r].constructor&&s.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(s.draw(),n);for(;n;){let s=n.nextSibling;n.remove(),n=s}this.drawn=e,Re.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Cc=Ue.define();function kx(t){return[lr.define(e=>new Mj(e,t)),Cc.of(t)]}const gl=Ue.define({combine(t){return Rf(t,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Rj(t={}){return[gl.of(t),Dj,_j,qj,Cb.of(!0)]}function Cx(t){return t.startState.facet(gl)!=t.state.facet(gl)}const Dj=kx({above:!0,markers(t){let{state:e}=t,n=e.facet(gl),r=[];for(let s of e.selection.ranges){let a=s==e.selection.main;if(s.empty||n.drawRangeCursor&&!(a&&Re.ios&&n.iosSelectionHandles)){let c=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=s.empty?s:Ae.cursor(s.head,s.assoc);for(let f of _s.forRange(t,c,u))r.push(f)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=Cx(t);return n&&Nx(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){Nx(e.state,t)},class:"cm-cursorLayer"});function Nx(t,e){e.style.animationDuration=t.facet(gl).cursorBlinkRate+"ms"}const _j=kx({above:!1,markers(t){let e=[],{main:n,ranges:r}=t.state.selection;for(let s of r)if(!s.empty)for(let a of _s.forRange(t,"cm-selectionBackground",s))e.push(a);if(Re.ios&&!n.empty&&t.state.facet(gl).iosSelectionHandles){for(let s of _s.forRange(t,"cm-selectionHandle cm-selectionHandle-start",Ae.cursor(n.from,1)))e.push(s);for(let s of _s.forRange(t,"cm-selectionHandle cm-selectionHandle-end",Ae.cursor(n.to,1)))e.push(s)}return e},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||Cx(t)},class:"cm-selectionLayer"}),Lj=Re.gecko&&Re.gecko_version==153?"#ffffff01":"transparent",qj=Go.highest(Je.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:`${Lj} !important`},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}}));function Tx(){return $j}const Bj=rn.line({class:"cm-activeLine"}),$j=lr.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.docChanged||t.selectionSet)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=-1,n=[];for(let r of t.state.selection.ranges){let s=t.lineBlockAt(r.head);s.from>e&&(n.push(Bj.range(s.from)),e=s.from)}return rn.set(n)}},{decorations:t=>t.decorations});class Vr extends js{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Vr.prototype.elementClass="",Vr.prototype.toDOM=void 0,Vr.prototype.mapMode=Jn.TrackBefore,Vr.prototype.startSide=Vr.prototype.endSide=-1,Vr.prototype.point=!0;const Nc=Ue.define(),Ij=Ue.define(),Tc=Ue.define(),jx=Ue.define({combine:t=>t.some(e=>e)});function Hj(t){return[zj]}const zj=lr.fromClass(class{constructor(t){this.view=t,this.domAfter=null,this.prevViewport=t.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=t.state.facet(Tc).map(e=>new Ox(t,e)),this.fixed=!t.state.facet(jx);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),t.scrollDOM.insertBefore(this.dom,t.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(t){if(this.updateGutters(t)){let e=this.prevViewport,n=t.view.viewport,r=Math.min(e.to,n.to)-Math.max(e.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}if(t.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(jx)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=t.view.viewport}syncGutters(t){let e=this.dom.nextSibling;t&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let n=mt.iter(this.view.state.facet(Nc),this.view.viewport.from),r=[],s=this.gutters.map(a=>new Uj(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(a.type)){let c=!0;for(let u of a.type)if(u.type==un.Text&&c){Ah(n,r,u.from);for(let f of s)f.line(this.view,u,r);c=!1}else if(u.widget)for(let f of s)f.widget(this.view,u)}else if(a.type==un.Text){Ah(n,r,a.from);for(let c of s)c.line(this.view,a,r)}else if(a.widget)for(let c of s)c.widget(this.view,a);for(let a of s)a.finish();t&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(t){let e=t.startState.facet(Tc),n=t.state.facet(Tc),r=t.docChanged||t.heightChanged||t.viewportChanged||!mt.eq(t.startState.facet(Nc),t.state.facet(Nc),t.view.viewport.from,t.view.viewport.to);if(e==n)for(let s of this.gutters)s.update(t)&&(r=!0);else{r=!0;let s=[];for(let a of n){let c=e.indexOf(a);c<0?s.push(new Ox(this.view,a)):(this.gutters[c].update(t),s.push(this.gutters[c]))}for(let a of this.gutters)a.dom.remove(),s.indexOf(a)<0&&a.destroy();for(let a of s)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=s}return r}destroy(){for(let t of this.gutters)t.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:t=>Je.scrollMargins.of(e=>{let n=e.plugin(t);if(!n||n.gutters.length==0||!n.fixed)return null;let r=n.dom.offsetWidth*e.scaleX,s=n.domAfter?n.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Lt.LTR?{left:r,right:s}:{right:r,left:s}})});function Ex(t){return Array.isArray(t)?t:[t]}function Ah(t,e,n){for(;t.value&&t.from<=n;)t.from==n&&e.push(t.value),t.next()}class Uj{constructor(e,n,r){this.gutter=e,this.height=r,this.i=0,this.cursor=mt.iter(e.markers,n.from)}addElement(e,n,r){let{gutter:s}=this,a=(n.top-this.height)/e.scaleY,c=n.height/e.scaleY;if(this.i==s.elements.length){let u=new Mx(e,c,a,r);s.elements.push(u),s.dom.appendChild(u.dom)}else s.elements[this.i].update(e,c,a,r);this.height=n.bottom,this.i++}line(e,n,r){let s=[];Ah(this.cursor,s,n.from),r.length&&(s=s.concat(r));let a=this.gutter.config.lineMarker(e,n,s);a&&s.unshift(a);let c=this.gutter;s.length==0&&!c.config.renderEmptyElements||this.addElement(e,n,s)}widget(e,n){let r=this.gutter.config.widgetMarker(e,n.widget,n),s=r?[r]:null;for(let a of e.state.facet(Ij)){let c=a(e,n.widget,n);c&&(s||(s=[])).push(c)}s&&this.addElement(e,n,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let n=e.elements.pop();e.dom.removeChild(n.dom),n.destroy()}}}class Ox{constructor(e,n){this.view=e,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,s=>{let a=s.target,c;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let f=a.getBoundingClientRect();c=(f.top+f.bottom)/2}else c=s.clientY;let u=e.lineBlockAtHeight(c-e.documentTop);n.domEventHandlers[r](e,u,s)&&s.preventDefault()});this.markers=Ex(n.markers(e)),n.initialSpacer&&(this.spacer=new Mx(e,0,0,[n.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let n=this.markers;if(this.markers=Ex(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let r=e.view.viewport;return!mt.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Mx{constructor(e,n,r,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,n,r,s)}update(e,n,r,s){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),Vj(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,n){let r="cm-gutterElement",s=this.dom.firstChild;for(let a=0,c=0;;){let u=c,f=a<n.length?n[a++]:null,h=!1;if(f){let g=f.elementClass;g&&(r+=" "+g);for(let b=c;b<this.markers.length;b++)if(this.markers[b].compare(f)){u=b,h=!0;break}}else u=this.markers.length;for(;c<u;){let g=this.markers[c++];if(g.toDOM){g.destroy(s);let b=s.nextSibling;s.remove(),s=b}}if(!f)break;f.toDOM&&(h?s=s.nextSibling:this.dom.insertBefore(f.toDOM(e),s)),h&&c++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function Vj(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].compare(e[n]))return!1;return!0}const Fj=Ue.define(),Pj=Ue.define(),yl=Ue.define({combine(t){return Rf(t,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,n){let r=Object.assign({},e);for(let s in n){let a=r[s],c=n[s];r[s]=a?(u,f,h)=>a(u,f,h)||c(u,f,h):c}return r}})}});class kh extends Vr{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function Ch(t,e){return t.state.facet(yl).formatNumber(e,t.state)}const Yj=Tc.compute([yl],t=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Fj)},lineMarker(e,n,r){return r.some(s=>s.toDOM)?null:new kh(Ch(e,e.state.doc.lineAt(n.from).number))},widgetMarker:(e,n,r)=>{for(let s of e.state.facet(Pj)){let a=s(e,n,r);if(a)return a}return null},lineMarkerChange:e=>e.startState.facet(yl)!=e.state.facet(yl),initialSpacer(e){return new kh(Ch(e,Dx(e.state.doc.lines)))},updateSpacer(e,n){let r=Ch(n.view,Dx(n.view.state.doc.lines));return r==e.number?e:new kh(r)},domEventHandlers:t.facet(yl).domEventHandlers,side:"before"}));function Rx(t={}){return[yl.of(t),Hj(),Yj]}function Dx(t){let e=9;for(;e<t;)e=e*10+9;return e}const Kj=new class extends Vr{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Gj=Nc.compute(["selection"],t=>{let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.head).from;s>n&&(n=s,e.push(Kj.range(s)))}return mt.of(e)});function _x(){return Gj}const Xj=1024;let Jj=0;class Nh{constructor(e,n){this.from=e,this.to=n}}class yt{constructor(e={}){this.id=Jj++,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=fi.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}}yt.closedBy=new yt({deserialize:t=>t.split(" ")}),yt.openedBy=new yt({deserialize:t=>t.split(" ")}),yt.group=new yt({deserialize:t=>t.split(" ")}),yt.isolate=new yt({deserialize:t=>{if(t&&t!="rtl"&&t!="ltr"&&t!="auto")throw new RangeError("Invalid value for isolate: "+t);return t||"auto"}}),yt.contextHash=new yt({perNode:!0}),yt.lookAhead=new yt({perNode:!0}),yt.mounted=new yt({perNode:!0});class Ra{constructor(e,n,r,s=!1){this.tree=e,this.overlay=n,this.parser=r,this.bracketed=s}static get(e){return e&&e.props&&e.props[yt.mounted.id]}}const Qj=Object.create(null);class fi{constructor(e,n,r,s=0){this.name=e,this.props=n,this.id=r,this.flags=s}static define(e){let n=e.props&&e.props.length?Object.create(null):Qj,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new fi(e.name||"",n,e.id,r);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(s)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[a[0].id]=a[1]}}return s}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 n=this.prop(yt.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let s of r.split(" "))n[s]=e[r];return r=>{for(let s=r.prop(yt.group),a=-1;a<(s?s.length:0);a++){let c=n[a<0?r.name:s[a]];if(c)return c}}}}fi.none=new fi("",Object.create(null),0,8);const jc=new WeakMap,Lx=new WeakMap;var Ut;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays",t[t.EnterBracketed=16]="EnterBracketed"})(Ut||(Ut={}));class fn{constructor(e,n,r,s,a){if(this.type=e,this.children=n,this.positions=r,this.length=s,this.props=null,a&&a.length){this.props=Object.create(null);for(let[c,u]of a)this.props[typeof c=="number"?c:c.id]=u}}toString(){let e=Ra.get(this);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let s=r.toString();s&&(n&&(n+=","),n+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Eh(this.topNode,e)}cursorAt(e,n=0,r=0){let s=jc.get(this)||this.topNode,a=new Eh(s);return a.moveTo(e,n),jc.set(this,a._tree),a}get topNode(){return new hi(this,0,0,null)}resolve(e,n=0){let r=Da(jc.get(this)||this.topNode,e,n,!1);return jc.set(this,r),r}resolveInner(e,n=0){let r=Da(Lx.get(this)||this.topNode,e,n,!0);return Lx.set(this,r),r}resolveStack(e,n=0){return eE(this,e,n)}iterate(e){let{enter:n,leave:r,from:s=0,to:a=this.length}=e,c=e.mode||0,u=(c&Ut.IncludeAnonymous)>0;for(let f=this.cursor(c|Ut.IncludeAnonymous);;){let h=!1;if(f.from<=a&&f.to>=s&&(!u&&f.type.isAnonymous||n(f)!==!1)){if(f.firstChild())continue;h=!0}for(;h&&r&&(u||!f.type.isAnonymous)&&r(f),!f.nextSibling();){if(!f.parent())return;h=!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 n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Mh(fi.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,s)=>new fn(this.type,n,r,s,this.propValues),e.makeTree||((n,r,s)=>new fn(fi.none,n,r,s)))}static build(e){return tE(e)}}fn.empty=new fn(fi.none,[],[],0);class Th{constructor(e,n){this.buffer=e,this.index=n}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 Th(this.buffer,this.index)}}class Fr{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return fi.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],s=this.set.types[n],a=s.name;if(/\W/.test(a)&&!s.isError&&(a=JSON.stringify(a)),e+=4,r==e)return a;let c=[];for(;e<r;)c.push(this.childString(e)),e=this.buffer[e+3];return a+"("+c.join(",")+")"}findChild(e,n,r,s,a){let{buffer:c}=this,u=-1;for(let f=e;f!=n&&!(qx(a,s,c[f+1],c[f+2])&&(u=f,r>0));f=c[f+3]);return u}slice(e,n,r){let s=this.buffer,a=new Uint16Array(n-e),c=0;for(let u=e,f=0;u<n;){a[f++]=s[u++],a[f++]=s[u++]-r;let h=a[f++]=s[u++]-r;a[f++]=s[u++]-e,c=Math.max(c,h)}return new Fr(a,c,this.set)}}function qx(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function Da(t,e,n,r){for(var s;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let c=!r&&t instanceof hi&&t.index<0?null:t.parent;if(!c)return t;t=c}let a=r?0:Ut.IgnoreOverlays;if(r)for(let c=t,u=c.parent;u;c=u,u=c.parent)c instanceof hi&&c.index<0&&((s=u.enter(e,n,a))===null||s===void 0?void 0:s.from)!=c.from&&(t=u);for(;;){let c=t.enter(e,n,a);if(!c)return t;t=c}}class Bx{cursor(e=0){return new Eh(this,e)}getChild(e,n=null,r=null){let s=$x(this,e,n,r);return s.length?s[0]:null}getChildren(e,n=null,r=null){return $x(this,e,n,r)}resolve(e,n=0){return Da(this,e,n,!1)}resolveInner(e,n=0){return Da(this,e,n,!0)}matchContext(e){return jh(this.parent,e)}enterUnfinishedNodesBefore(e){let n=this.childBefore(e),r=this;for(;n;){let s=n.lastChild;if(!s||s.to!=n.to)break;s.type.isError&&s.from==s.to?(r=n,n=s.prevSibling):n=s}return r}get node(){return this}get next(){return this.parent}}class hi extends Bx{constructor(e,n,r,s){super(),this._tree=e,this.from=n,this.index=r,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,s,a=0){for(let c=this;;){for(let{children:u,positions:f}=c._tree,h=n>0?u.length:-1;e!=h;e+=n){let g=u[e],b=f[e]+c.from,v;if(!(!(a&Ut.EnterBracketed&&g instanceof fn&&(v=Ra.get(g))&&!v.overlay&&v.bracketed&&r>=b&&r<=b+g.length)&&!qx(s,r,b,b+g.length))){if(g instanceof Fr){if(a&Ut.ExcludeBuffers)continue;let w=g.findChild(0,g.buffer.length,n,r-b,s);if(w>-1)return new Pr(new Wj(c,g,e,b),null,w)}else if(a&Ut.IncludeAnonymous||!g.type.isAnonymous||Oh(g)){let w;if(!(a&Ut.IgnoreMounts)&&(w=Ra.get(g))&&!w.overlay)return new hi(w.tree,b,e,c);let A=new hi(g,b,e,c);return a&Ut.IncludeAnonymous||!A.type.isAnonymous?A:A.nextChild(n<0?g.children.length-1:0,n,r,s,a)}}}if(a&Ut.IncludeAnonymous||!c.type.isAnonymous||(c.index>=0?e=c.index+n:e=n<0?-1:c._parent._tree.children.length,c=c._parent,!c))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,n,r=0){let s;if(!(r&Ut.IgnoreOverlays)&&(s=Ra.get(this._tree))&&s.overlay){let a=e-this.from,c=r&Ut.EnterBracketed&&s.bracketed;for(let{from:u,to:f}of s.overlay)if((n>0||c?u<=a:u<a)&&(n<0||c?f>=a:f>a))return new hi(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}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 $x(t,e,n,r){let s=t.cursor(),a=[];if(!s.firstChild())return a;if(n!=null){for(let c=!1;!c;)if(c=s.type.is(n),!s.nextSibling())return a}for(;;){if(r!=null&&s.type.is(r))return a;if(s.type.is(e)&&a.push(s.node),!s.nextSibling())return r==null?a:[]}}function jh(t,e,n=e.length-1){for(let r=t;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}class Wj{constructor(e,n,r,s){this.parent=e,this.buffer=n,this.index=r,this.start=s}}class Pr extends Bx{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,n,r){super(),this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.context.start,r);return a<0?null:new Pr(this.context,this,a)}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,n,r=0){if(r&Ut.ExcludeBuffers)return null;let{buffer:s}=this.context,a=s.findChild(this.index+4,s.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return a<0?null:new Pr(this.context,this,a)}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,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Pr(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Pr(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,s=this.index+4,a=r.buffer[this.index+3];if(a>s){let c=r.buffer[this.index+1];e.push(r.slice(s,a,c)),n.push(0)}return new fn(this.type,e,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Ix(t){if(!t.length)return null;let e=0,n=t[0];for(let a=1;a<t.length;a++){let c=t[a];(c.from>n.from||c.to<n.to)&&(n=c,e=a)}let r=n instanceof hi&&n.index<0?null:n.parent,s=t.slice();return r?s[e]=r:s.splice(e,1),new Zj(s,n)}class Zj{constructor(e,n){this.heads=e,this.node=n}get next(){return Ix(this.heads)}}function eE(t,e,n){let r=t.resolveInner(e,n),s=null;for(let a=r instanceof hi?r:r.context.parent;a;a=a.parent)if(a.index<0){let c=a.parent;(s||(s=[r])).push(c.resolve(e,n)),a=c}else{let c=Ra.get(a.tree);if(c&&c.overlay&&c.overlay[0].from<=e&&c.overlay[c.overlay.length-1].to>=e){let u=new hi(c.tree,c.overlay[0].from+a.from,-1,a);(s||(s=[r])).push(Da(u,e,n,!1))}}return s?Ix(s):r}class Eh{get name(){return this.type.name}constructor(e,n=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=n&~Ut.EnterBracketed,e instanceof hi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.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,n){this.index=e;let{start:r,buffer:s}=this.buffer;return this.type=n||s.set.types[s.buffer[e]],this.from=r+s.buffer[e+1],this.to=r+s.buffer[e+2],!0}yield(e){return e?e instanceof hi?(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,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:s}=this.buffer,a=s.findChild(this.index+4,s.buffer[this.index+3],e,n-this.buffer.start,r);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}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,n,r=this.mode){return this.buffer?r&Ut.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ut.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ut.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:n}=this.buffer,r=this.stack.length-1;if(e<0){let s=r<0?0:this.stack[r]+4;if(this.index!=s)return this.yieldBuf(n.findChild(s,this.index,-1,0,4))}else{let s=n.buffer[this.index+3];if(s<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(s)}return r<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 n,r,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(s.buffer.buffer[a+3]<this.index)return!1;({index:n,parent:r}=s)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let a=n+e,c=e<0?-1:r._tree.children.length;a!=c;a+=e){let u=r._tree.children[a];if(this.mode&Ut.IncludeAnonymous||u instanceof Fr||!u.type.isAnonymous||Oh(u))return!1}return!0}move(e,n){if(n&&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,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let s=this.index,a=this.stack.length;a>=0;){for(let c=e;c;c=c._parent)if(c.index==s){if(s==this.index)return c;n=c,r=a+1;break e}s=this.stack[--a]}for(let s=r;s<this.stack.length;s++)n=new Pr(this.buffer,n,this.stack[s]);return this.bufferNode=new Pr(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&n&&n(this),s=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,s=!0}}}matchContext(e){if(!this.buffer)return jh(this.node.parent,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let s=e.length-1,a=this.stack.length-1;s>=0;a--){if(a<0)return jh(this._tree,e,s);let c=r[n.buffer[this.stack[a]]];if(!c.isAnonymous){if(e[s]&&e[s]!=c.name)return!1;s--}}return!0}}function Oh(t){return t.children.some(e=>e instanceof Fr||!e.type.isAnonymous||Oh(e))}function tE(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:s=Xj,reused:a=[],minRepeatType:c=r.types.length}=t,u=Array.isArray(n)?new Th(n,n.length):n,f=r.types,h=0,g=0;function b(_,q,R,X,U,B){let{id:K,start:W,end:ye,size:pe}=u,fe=g,L=h;if(pe<0)if(u.next(),pe==-1){let T=a[K];R.push(T),X.push(W-_);return}else if(pe==-3){h=K;return}else if(pe==-4){g=K;return}else throw new RangeError(`Unrecognized record size: ${pe}`);let Q=f[K],oe,ce,ve=W-_;if(ye-W<=s&&(ce=O(u.pos-q,U))){let T=new Uint16Array(ce.size-ce.skip),z=u.pos-ce.size,he=T.length;for(;u.pos>z;)he=D(ce.start,T,he);oe=new Fr(T,ye-ce.start,r),ve=ce.start-_}else{let T=u.pos-pe;u.next();let z=[],he=[],ne=K>=c?K:-1,ke=0,qe=ye;for(;u.pos>T;)ne>=0&&u.id==ne&&u.size>=0?(u.end<=qe-s&&(A(z,he,W,ke,u.end,qe,ne,fe,L),ke=z.length,qe=u.end),u.next()):B>2500?v(W,T,z,he):b(W,T,z,he,ne,B+1);if(ne>=0&&ke>0&&ke<z.length&&A(z,he,W,ke,W,qe,ne,fe,L),z.reverse(),he.reverse(),ne>-1&&ke>0){let $e=w(Q,L);oe=Mh(Q,z,he,0,z.length,0,ye-W,$e,$e)}else oe=C(Q,z,he,ye-W,fe-ye,L)}R.push(oe),X.push(ve)}function v(_,q,R,X){let U=[],B=0,K=-1;for(;u.pos>q;){let{id:W,start:ye,end:pe,size:fe}=u;if(fe>4)u.next();else{if(K>-1&&ye<K)break;K<0&&(K=pe-s),U.push(W,ye,pe),B++,u.next()}}if(B){let W=new Uint16Array(B*4),ye=U[U.length-2];for(let pe=U.length-3,fe=0;pe>=0;pe-=3)W[fe++]=U[pe],W[fe++]=U[pe+1]-ye,W[fe++]=U[pe+2]-ye,W[fe++]=fe;R.push(new Fr(W,U[2]-ye,r)),X.push(ye-_)}}function w(_,q){return(R,X,U)=>{let B=0,K=R.length-1,W,ye;if(K>=0&&(W=R[K])instanceof fn){if(!K&&W.type==_&&W.length==U)return W;(ye=W.prop(yt.lookAhead))&&(B=X[K]+W.length+ye)}return C(_,R,X,U,B,q)}}function A(_,q,R,X,U,B,K,W,ye){let pe=[],fe=[];for(;_.length>X;)pe.push(_.pop()),fe.push(q.pop()+R-U);_.push(C(r.types[K],pe,fe,B-U,W-B,ye)),q.push(U-R)}function C(_,q,R,X,U,B,K){if(B){let W=[yt.contextHash,B];K=K?[W].concat(K):[W]}if(U>25){let W=[yt.lookAhead,U];K=K?[W].concat(K):[W]}return new fn(_,q,R,X,K)}function O(_,q){let R=u.fork(),X=0,U=0,B=0,K=R.end-s,W={size:0,start:0,skip:0};e:for(let ye=R.pos-_;R.pos>ye;){let pe=R.size;if(R.id==q&&pe>=0){W.size=X,W.start=U,W.skip=B,B+=4,X+=4,R.next();continue}let fe=R.pos-pe;if(pe<0||fe<ye||R.start<K)break;let L=R.id>=c?4:0,Q=R.start;for(R.next();R.pos>fe;){if(R.size<0)if(R.size==-3||R.size==-4)L+=4;else break e;else R.id>=c&&(L+=4);R.next()}U=Q,X+=pe,B+=L}return(q<0||X==_)&&(W.size=X,W.start=U,W.skip=B),W.size>4?W:void 0}function D(_,q,R){let{id:X,start:U,end:B,size:K}=u;if(u.next(),K>=0&&X<c){let W=R;if(K>4){let ye=u.pos-(K-4);for(;u.pos>ye;)R=D(_,q,R)}q[--R]=W,q[--R]=B-_,q[--R]=U-_,q[--R]=X}else K==-3?h=X:K==-4&&(g=X);return R}let E=[],j=[];for(;u.pos>0;)b(t.start||0,t.bufferStart||0,E,j,-1,0);let M=(e=t.length)!==null&&e!==void 0?e:E.length?j[0]+E[0].length:0;return new fn(f[t.topID],E.reverse(),j.reverse(),M)}const Hx=new WeakMap;function Ec(t,e){if(!t.isAnonymous||e instanceof Fr||e.type!=t)return 1;let n=Hx.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof fn)){n=1;break}n+=Ec(t,r)}Hx.set(e,n)}return n}function Mh(t,e,n,r,s,a,c,u,f){let h=0;for(let A=r;A<s;A++)h+=Ec(t,e[A]);let g=Math.ceil(h*1.5/8),b=[],v=[];function w(A,C,O,D,E){for(let j=O;j<D;){let M=j,_=C[j],q=Ec(t,A[j]);for(j++;j<D;j++){let R=Ec(t,A[j]);if(q+R>=g)break;q+=R}if(j==M+1){if(q>g){let R=A[M];w(R.children,R.positions,0,R.children.length,C[M]+E);continue}b.push(A[M])}else{let R=C[j-1]+A[j-1].length-_;b.push(Mh(t,A,C,M,j,_,R,null,f))}v.push(_+E-a)}}return w(e,n,r,s,0),(u||f)(b,v,c)}class Ls{constructor(e,n,r,s,a=!1,c=!1){this.from=e,this.to=n,this.tree=r,this.offset=s,this.open=(a?1:0)|(c?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let s=[new Ls(0,e.length,e,0,!1,r)];for(let a of n)a.to>e.length&&s.push(a);return s}static applyChanges(e,n,r=128){if(!n.length)return e;let s=[],a=1,c=e.length?e[0]:null;for(let u=0,f=0,h=0;;u++){let g=u<n.length?n[u]:null,b=g?g.fromA:1e9;if(b-f>=r)for(;c&&c.from<b;){let v=c;if(f>=v.from||b<=v.to||h){let w=Math.max(v.from,f)-h,A=Math.min(v.to,b)-h;v=w>=A?null:new Ls(w,A,v.tree,v.offset+h,u>0,!!g)}if(v&&s.push(v),c.to>b)break;c=a<e.length?e[a++]:null}if(!g)break;f=g.toA,h=g.toA-g.toB}return s}}class nE{startParse(e,n,r){return typeof e=="string"&&(e=new iE(e)),r=r?r.length?r.map(s=>new Nh(s.from,s.to)):[new Nh(0,0)]:[new Nh(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let s=this.startParse(e,n,r);for(;;){let a=s.advance();if(a)return a}}}class iE{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}}new yt({perNode:!0});let rE=0;class pi{constructor(e,n,r,s){this.name=e,this.set=n,this.base=r,this.modified=s,this.id=rE++}toString(){let{name:e}=this;for(let n of this.modified)n.name&&(e=`${n.name}(${e})`);return e}static define(e,n){let r=typeof e=="string"?e:"?";if(e instanceof pi&&(n=e),n?.base)throw new Error("Can not derive from a modified tag");let s=new pi(r,[],null,[]);if(s.set.push(s),n)for(let a of n.set)s.set.push(a);return s}static defineModifier(e){let n=new Oc(e);return r=>r.modified.indexOf(n)>-1?r:Oc.get(r.base||r,r.modified.concat(n).sort((s,a)=>s.id-a.id))}}let sE=0;class Oc{constructor(e){this.name=e,this.instances=[],this.id=sE++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(u=>u.base==e&&lE(n,u.modified));if(r)return r;let s=[],a=new pi(e.name,s,e,n);for(let u of n)u.instances.push(a);let c=aE(n);for(let u of e.set)if(!u.modified.length)for(let f of c)s.push(Oc.get(u,f));return a}}function lE(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function aE(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,s=e.length;r<s;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function oE(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let s of n.split(" "))if(s){let a=[],c=2,u=s;for(let b=0;;){if(u=="..."&&b>0&&b+3==s.length){c=1;break}let v=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!v)throw new RangeError("Invalid path: "+s);if(a.push(v[0]=="*"?"":v[0][0]=='"'?JSON.parse(v[0]):v[0]),b+=v[0].length,b==s.length)break;let w=s[b++];if(b==s.length&&w=="!"){c=0;break}if(w!="/")throw new RangeError("Invalid path: "+s);u=s.slice(b)}let f=a.length-1,h=a[f];if(!h)throw new RangeError("Invalid path: "+s);let g=new Mc(r,c,f>0?a.slice(0,f):null);e[h]=g.sort(e[h])}}return cE.add(e)}const cE=new yt({combine(t,e){let n,r,s;for(;t||e;){if(!t||e&&t.depth>=e.depth?(s=e,e=e.next):(s=t,t=t.next),n&&n.mode==s.mode&&!s.context&&!n.context)continue;let a=new Mc(s.tags,s.mode,s.context);n?n.next=a:r=a,n=a}return r}});class Mc{constructor(e,n,r,s){this.tags=e,this.mode=n,this.context=r,this.next=s}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}}Mc.empty=new Mc([],2,null);function uE(t,e){let n=Object.create(null);for(let a of t)if(!Array.isArray(a.tag))n[a.tag.id]=a.class;else for(let c of a.tag)n[c.id]=a.class;let{scope:r,all:s=null}={};return{style:a=>{let c=s;for(let u of a)for(let f of u.set){let h=n[f.id];if(h){c=c?c+" "+h:h;break}}return c},scope:r}}const Te=pi.define,Rc=Te(),Yr=Te(),zx=Te(Yr),Ux=Te(Yr),Kr=Te(),Dc=Te(Kr),Rh=Te(Kr),Ki=Te(),qs=Te(Ki),Gi=Te(),Xi=Te(),Dh=Te(),_a=Te(Dh),_c=Te(),rt={comment:Rc,lineComment:Te(Rc),blockComment:Te(Rc),docComment:Te(Rc),name:Yr,variableName:Te(Yr),typeName:zx,tagName:Te(zx),propertyName:Ux,attributeName:Te(Ux),className:Te(Yr),labelName:Te(Yr),namespace:Te(Yr),macroName:Te(Yr),literal:Kr,string:Dc,docString:Te(Dc),character:Te(Dc),attributeValue:Te(Dc),number:Rh,integer:Te(Rh),float:Te(Rh),bool:Te(Kr),regexp:Te(Kr),escape:Te(Kr),color:Te(Kr),url:Te(Kr),keyword:Gi,self:Te(Gi),null:Te(Gi),atom:Te(Gi),unit:Te(Gi),modifier:Te(Gi),operatorKeyword:Te(Gi),controlKeyword:Te(Gi),definitionKeyword:Te(Gi),moduleKeyword:Te(Gi),operator:Xi,derefOperator:Te(Xi),arithmeticOperator:Te(Xi),logicOperator:Te(Xi),bitwiseOperator:Te(Xi),compareOperator:Te(Xi),updateOperator:Te(Xi),definitionOperator:Te(Xi),typeOperator:Te(Xi),controlOperator:Te(Xi),punctuation:Dh,separator:Te(Dh),bracket:_a,angleBracket:Te(_a),squareBracket:Te(_a),paren:Te(_a),brace:Te(_a),content:Ki,heading:qs,heading1:Te(qs),heading2:Te(qs),heading3:Te(qs),heading4:Te(qs),heading5:Te(qs),heading6:Te(qs),contentSeparator:Te(Ki),list:Te(Ki),quote:Te(Ki),emphasis:Te(Ki),strong:Te(Ki),link:Te(Ki),monospace:Te(Ki),strikethrough:Te(Ki),inserted:Te(),deleted:Te(),changed:Te(),invalid:Te(),meta:_c,documentMeta:Te(_c),annotation:Te(_c),processingInstruction:Te(_c),definition:pi.defineModifier("definition"),constant:pi.defineModifier("constant"),function:pi.defineModifier("function"),standard:pi.defineModifier("standard"),local:pi.defineModifier("local"),special:pi.defineModifier("special")};for(let t in rt){let e=rt[t];e instanceof pi&&(e.name=t)}uE([{tag:rt.link,class:"tok-link"},{tag:rt.heading,class:"tok-heading"},{tag:rt.emphasis,class:"tok-emphasis"},{tag:rt.strong,class:"tok-strong"},{tag:rt.keyword,class:"tok-keyword"},{tag:rt.atom,class:"tok-atom"},{tag:rt.bool,class:"tok-bool"},{tag:rt.url,class:"tok-url"},{tag:rt.labelName,class:"tok-labelName"},{tag:rt.inserted,class:"tok-inserted"},{tag:rt.deleted,class:"tok-deleted"},{tag:rt.literal,class:"tok-literal"},{tag:rt.string,class:"tok-string"},{tag:rt.number,class:"tok-number"},{tag:[rt.regexp,rt.escape,rt.special(rt.string)],class:"tok-string2"},{tag:rt.variableName,class:"tok-variableName"},{tag:rt.local(rt.variableName),class:"tok-variableName tok-local"},{tag:rt.definition(rt.variableName),class:"tok-variableName tok-definition"},{tag:rt.special(rt.variableName),class:"tok-variableName2"},{tag:rt.definition(rt.propertyName),class:"tok-propertyName tok-definition"},{tag:rt.typeName,class:"tok-typeName"},{tag:rt.namespace,class:"tok-namespace"},{tag:rt.className,class:"tok-className"},{tag:rt.macroName,class:"tok-macroName"},{tag:rt.propertyName,class:"tok-propertyName"},{tag:rt.operator,class:"tok-operator"},{tag:rt.comment,class:"tok-comment"},{tag:rt.meta,class:"tok-meta"},{tag:rt.invalid,class:"tok-invalid"},{tag:rt.punctuation,class:"tok-punctuation"}]);var _h;const Lc=new yt,dE=new yt;class or{constructor(e,n,r=[],s=""){this.data=e,this.name=s,wt.prototype.hasOwnProperty("tree")||Object.defineProperty(wt.prototype,"tree",{get(){return Gr(this)}}),this.parser=n,this.extension=[xl.of(this),wt.languageData.of((a,c,u)=>{let f=Vx(a,c,u),h=f.type.prop(Lc);if(!h)return[];let g=a.facet(h),b=f.type.prop(dE);if(b){let v=f.resolve(c-f.from,u);for(let w of b)if(w.test(v,a)){let A=a.facet(w.facet);return w.type=="replace"?A:A.concat(g)}}return g})].concat(r)}isActiveAt(e,n,r=-1){return Vx(e,n,r).type.prop(Lc)==this.data}findRegions(e){let n=e.facet(xl);if(n?.data==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],s=(a,c)=>{if(a.prop(Lc)==this.data){r.push({from:c,to:c+a.length});return}let u=a.prop(yt.mounted);if(u){if(u.tree.prop(Lc)==this.data){if(u.overlay)for(let f of u.overlay)r.push({from:f.from+c,to:f.to+c});else r.push({from:c,to:c+a.length});return}else if(u.overlay){let f=r.length;if(s(u.tree,u.overlay[0].from+c),r.length>f)return}}for(let f=0;f<a.children.length;f++){let h=a.children[f];h instanceof fn&&s(h,a.positions[f]+c)}};return s(Gr(e),0),r}get allowsNesting(){return!0}}or.setState=zt.define();function Vx(t,e,n){let r=t.facet(xl),s=Gr(t).topNode;if(!r||r.allowsNesting)for(let a=s;a;a=a.enter(e,n,Ut.ExcludeBuffers|Ut.EnterBracketed))a.type.isTop&&(s=a);return s}function Gr(t){let e=t.field(or.state,!1);return e?e.tree:fn.empty}class fE{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,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}}let La=null;class qc{constructor(e,n,r=[],s,a,c,u,f){this.parser=e,this.state=n,this.fragments=r,this.tree=s,this.treeLen=a,this.viewport=c,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new qc(e,n,[],fn.empty,0,r,[],null)}startParse(){return this.parser.startParse(new fE(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=fn.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Ls.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Ls.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=La;La=this;try{return e()}finally{La=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=Fx(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:s,treeLen:a,viewport:c,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((h,g,b,v)=>f.push({fromA:h,toA:g,fromB:b,toB:v})),r=Ls.applyChanges(r,f),s=fn.empty,a=0,c={from:e.mapPos(c.from,-1),to:e.mapPos(c.to,1)},this.skipped.length){u=[];for(let h of this.skipped){let g=e.mapPos(h.from,1),b=e.mapPos(h.to,-1);g<b&&u.push({from:g,to:b})}}}return new qc(this.parser,n,r,s,a,c,u,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:s,to:a}=this.skipped[r];s<e.to&&a>e.from&&(this.fragments=Fx(this.fragments,s,a),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends nE{createParse(n,r,s){let a=s[0].from,c=s[s.length-1].to;return{parsedPos:a,advance(){let f=La;if(f){for(let h of s)f.tempSkipped.push(h);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=c,new fn(fi.none,[],[],c-a)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return La}}function Fx(t,e,n){return Ls.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}class bl{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new bl(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=qc.create(e.facet(xl).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new bl(r)}}or.state=$r.define({create:bl.init,update(t,e){for(let n of e.effects)if(n.is(or.setState))return n.value;return e.startState.facet(xl)!=e.state.facet(xl)?bl.init(e.state):t.apply(e)}});let Px=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(Px=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});const Lh=typeof navigator<"u"&&(!((_h=navigator.scheduling)===null||_h===void 0)&&_h.isInputPending)?()=>navigator.scheduling.isInputPending():null,hE=lr.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 n=this.view.state.field(or.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(or.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=Px(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:s}}=this.view,a=r.field(or.state);if(a.tree==a.context.tree&&a.context.isDone(s+1e5))return;let c=Date.now()+Math.min(this.chunkBudget,100,e&&!Lh?Math.max(25,e.timeRemaining()-5):1e9),u=a.context.treeLen<s&&r.doc.length>s+1e3,f=a.context.work(()=>Lh&&Lh()||Date.now()>c,s+(u?0:1e5));this.chunkBudget-=Date.now()-n,(f||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:or.setState.of(new bl(a.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Pi(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),xl=Ue.define({combine(t){return t.length?t[0]:null},enables:t=>[or.state,hE,Je.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]}),pE=Ue.define(),qh=Ue.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Bc(t){let e=t.facet(qh);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function $c(t,e){let n="",r=t.tabSize,s=t.facet(qh)[0];if(s==" "){for(;e>=r;)n+=" ",e-=r;s=" "}for(let a=0;a<e;a++)n+=s;return n}function Yx(t,e){t instanceof wt&&(t=new Ic(t));for(let r of t.state.facet(pE)){let s=r(t,e);if(s!==void 0)return s}let n=Gr(t.state);return n.length>=e?gE(t,n,e):null}class Ic{constructor(e,n={}){this.state=e,this.options=n,this.unit=Bc(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:a}=this.options;return s!=null&&s>=r.from&&s<=r.to?a&&s==e?{text:"",from:e}:(n<0?s<e:s<=e)?{text:r.text.slice(s-r.from),from:s}:{text:r.text.slice(0,s-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:s}=this.lineAt(e,n);return r.slice(e-s,Math.min(r.length,e+100-s))}column(e,n=1){let{text:r,from:s}=this.lineAt(e,n),a=this.countColumn(r,e-s),c=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return c>-1&&(a+=c-this.countColumn(r,r.search(/\S|$/))),a}countColumn(e,n=e.length){return Zo(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:s}=this.lineAt(e,n),a=this.options.overrideIndentation;if(a){let c=a(s);if(c>-1)return c}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const mE=new yt;function gE(t,e,n){let r=e.resolveStack(n),s=e.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(s!=r.node){let a=[];for(let c=s;c&&!(c.from<r.node.from||c.to>r.node.to||c.from==r.node.from&&c.type==r.node.type);c=c.parent)a.push(c);for(let c=a.length-1;c>=0;c--)r={node:a[c],next:r}}return Kx(r,t,n)}function Kx(t,e,n){for(let r=t;r;r=r.next){let s=bE(r.node);if(s)return s(Bh.create(e,n,r))}return 0}function yE(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function bE(t){let e=t.type.prop(mE);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(yt.closedBy))){let s=t.lastChild,a=s&&r.indexOf(s.name)>-1;return c=>SE(c,!0,1,void 0,a&&!yE(c)?s.from:void 0)}return t.parent==null?xE:null}function xE(){return 0}class Bh extends Ic{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.context=r}get node(){return this.context.node}static create(e,n,r){return new Bh(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(vE(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return Kx(this.context.next,this.base,this.pos)}}function vE(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function wE(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let s=t.options.simulateBreak,a=t.state.doc.lineAt(n.from),c=s==null||s<=a.from?a.to:Math.min(a.to,s);for(let u=n.to;;){let f=e.childAfter(u);if(!f||f==r)return null;if(!f.type.isSkipped){if(f.from>=c)return null;let h=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+h}}u=f.to}}function SE(t,e,n,r,s){let a=t.textAfter,c=a.match(/^\s*/)[0].length,u=r&&a.slice(c,c+r.length)==r||s==t.pos+c,f=wE(t);return f?u?t.column(f.from):t.column(f.to):t.baseIndent+(u?0:t.unit*n)}const AE=1e4,kE="()[]{}",CE=new yt;function $h(t,e,n){let r=t.prop(e<0?yt.openedBy:yt.closedBy);if(r)return r;if(t.name.length==1){let s=n.indexOf(t.name);if(s>-1&&s%2==(e<0?1:0))return[n[s+e]]}return null}function Ih(t){let e=t.type.prop(CE);return e?e(t.node):t}function vl(t,e,n,r={}){let s=r.maxScanDistance||AE,a=r.brackets||kE,c=Gr(t),u=c.resolveInner(e,n);for(let f=u;f;f=f.parent){let h=$h(f.type,n,a);if(h&&f.from<f.to){let g=Ih(f);if(g&&(n>0?e>=g.from&&e<g.to:e>g.from&&e<=g.to))return NE(t,e,n,f,g,h,a)}}return TE(t,e,n,c,u.type,s,a)}function NE(t,e,n,r,s,a,c){let u=r.parent,f={from:s.from,to:s.to},h=0,g=u?.cursor();if(g&&(n<0?g.childBefore(r.from):g.childAfter(r.to)))do if(n<0?g.to<=r.from:g.from>=r.to){if(h==0&&a.indexOf(g.type.name)>-1&&g.from<g.to){let b=Ih(g);return{start:f,end:b?{from:b.from,to:b.to}:void 0,matched:!0}}else if($h(g.type,n,c))h++;else if($h(g.type,-n,c)){if(h==0){let b=Ih(g);return{start:f,end:b&&b.from<b.to?{from:b.from,to:b.to}:void 0,matched:!1}}h--}}while(n<0?g.prevSibling():g.nextSibling());return{start:f,matched:!1}}function TE(t,e,n,r,s,a,c){if(n<0?!e:e==t.doc.length)return null;let u=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),f=c.indexOf(u);if(f<0||f%2==0!=n>0)return null;let h={from:n<0?e-1:e,to:n>0?e+1:e},g=t.doc.iterRange(e,n>0?t.doc.length:0),b=0;for(let v=0;!g.next().done&&v<=a;){let w=g.value;n<0&&(v+=w.length);let A=e+v*n;for(let C=n>0?0:w.length-1,O=n>0?w.length:-1;C!=O;C+=n){let D=c.indexOf(w[C]);if(!(D<0||r.resolveInner(A+C,1).type!=s))if(D%2==0==n>0)b++;else{if(b==1)return{start:h,end:{from:A+C,to:A+C+1},matched:D>>1==f>>1};b--}}n>0&&(v+=w.length)}return g.done?{start:h,matched:!1}:null}const jE=Object.create(null),Gx=[fi.none],Xx=[],Jx=Object.create(null),EE=Object.create(null);for(let[t,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"]])EE[t]=OE(jE,e);function Hh(t,e){Xx.indexOf(t)>-1||(Xx.push(t),console.warn(e))}function OE(t,e){let n=[];for(let u of e.split(" ")){let f=[];for(let h of u.split(".")){let g=t[h]||rt[h];g?typeof g=="function"?f.length?f=f.map(g):Hh(h,`Modifier ${h} used at start of tag`):f.length?Hh(h,`Tag ${h} used as modifier`):f=Array.isArray(g)?g:[g]:Hh(h,`Unknown highlighting tag ${h}`)}for(let h of f)n.push(h)}if(!n.length)return 0;let r=e.replace(/ /g,"_"),s=r+" "+n.map(u=>u.id),a=Jx[s];if(a)return a.id;let c=Jx[s]=fi.define({id:Gx.length,name:r,props:[oE({[r]:n})]});return Gx.push(c),c.id}Lt.RTL,Lt.LTR;const ME=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Uh(t.state,n.from);return r.line?RE(t):r.block?_E(t):!1};function zh(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let s=t(e,n);return s?(r(n.update(s)),!0):!1}}const RE=zh(BE,0),DE=zh(Qx,0),_E=zh((t,e)=>Qx(t,e,qE(e)),0);function Uh(t,e){let n=t.languageDataAt("commentTokens",e,1);return n.length?n[0]:{}}const qa=50;function LE(t,{open:e,close:n},r,s){let a=t.sliceDoc(r-qa,r),c=t.sliceDoc(s,s+qa),u=/\s*$/.exec(a)[0].length,f=/^\s*/.exec(c)[0].length,h=a.length-u;if(a.slice(h-e.length,h)==e&&c.slice(f,f+n.length)==n)return{open:{pos:r-u,margin:u&&1},close:{pos:s+f,margin:f&&1}};let g,b;s-r<=2*qa?g=b=t.sliceDoc(r,s):(g=t.sliceDoc(r,r+qa),b=t.sliceDoc(s-qa,s));let v=/^\s*/.exec(g)[0].length,w=/\s*$/.exec(b)[0].length,A=b.length-w-n.length;return g.slice(v,v+e.length)==e&&b.slice(A,A+n.length)==n?{open:{pos:r+v+e.length,margin:/\s/.test(g.charAt(v+e.length))?1:0},close:{pos:s-w-n.length,margin:/\s/.test(b.charAt(A-1))?1:0}}:null}function qE(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),s=n.to<=r.to?r:t.doc.lineAt(n.to);s.from>r.from&&s.from==n.to&&(s=n.to==r.to+1?r:t.doc.lineAt(n.to-1));let a=e.length-1;a>=0&&e[a].to>r.from?e[a].to=s.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:s.to})}return e}function Qx(t,e,n=e.selection.ranges){let r=n.map(a=>Uh(e,a.from).block);if(!r.every(a=>a))return null;let s=n.map((a,c)=>LE(e,r[c],a.from,a.to));if(t!=2&&!s.every(a=>a))return{changes:e.changes(n.map((a,c)=>s[c]?[]:[{from:a.from,insert:r[c].open+" "},{from:a.to,insert:" "+r[c].close}]))};if(t!=1&&s.some(a=>a)){let a=[];for(let c=0,u;c<s.length;c++)if(u=s[c]){let f=r[c],{open:h,close:g}=u;a.push({from:h.pos-f.open.length,to:h.pos+h.margin},{from:g.pos-g.margin,to:g.pos+f.close.length})}return{changes:a}}return null}function BE(t,e,n=e.selection.ranges){let r=[],s=-1;e:for(let{from:a,to:c}of n){let u=r.length,f=1e9,h;for(let g=a;g<=c;){let b=e.doc.lineAt(g);if(h==null&&(h=Uh(e,b.from).line,!h))continue e;if(b.from>s&&(a==c||c>b.from)){s=b.from;let v=/^\s*/.exec(b.text)[0].length,w=v==b.length,A=b.text.slice(v,v+h.length)==h?v:-1;v<b.text.length&&v<f&&(f=v),r.push({line:b,comment:A,token:h,indent:v,empty:w,single:!1})}g=b.to+1}if(f<1e9)for(let g=u;g<r.length;g++)r[g].indent<r[g].line.text.length&&(r[g].indent=f);r.length==u+1&&(r[u].single=!0)}if(t!=2&&r.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:u,token:f,indent:h,empty:g,single:b}of r)(b||!g)&&a.push({from:u.from+h,insert:f+" "});let c=e.changes(a);return{changes:c,selection:e.selection.map(c,1)}}else if(t!=1&&r.some(a=>a.comment>=0)){let a=[];for(let{line:c,comment:u,token:f}of r)if(u>=0){let h=c.from+u,g=h+f.length;c.text[g-c.from]==" "&&g++,a.push({from:h,to:g})}return{changes:a}}return null}const Vh=Ir.define(),$E=Ir.define(),IE=Ue.define(),Wx=Ue.define({combine(t){return Rf(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,s)=>e(r,s)||n(r,s)})}}),Zx=$r.define({create(){return Ji.empty},update(t,e){let n=e.state.facet(Wx),r=e.annotation(Vh);if(r){let f=Hn.fromTransaction(e,r.selection),h=r.side,g=h==0?t.undone:t.done;return f?g=zc(g,g.length,n.minDepth,f):g=nv(g,e.startState.selection),new Ji(h==0?r.rest:g,h==0?g:r.rest)}let s=e.annotation($E);if((s=="full"||s=="before")&&(t=t.isolate()),e.annotation(tn.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let a=Hn.fromTransaction(e),c=e.annotation(tn.time),u=e.annotation(tn.userEvent);return a?t=t.addChanges(a,c,u,n,e):e.selection&&(t=t.addSelection(e.startState.selection,c,u,n.newGroupDelay)),(s=="full"||s=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Ji(t.done.map(Hn.fromJSON),t.undone.map(Hn.fromJSON))}});function HE(t={}){return[Zx,Wx.of(t),Je.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?ev:e.inputType=="historyRedo"?Fh:null;return r?(e.preventDefault(),r(n)):!1}})]}function Hc(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let s=n.field(Zx,!1);if(!s)return!1;let a=s.pop(t,n,e);return a?(r(a),!0):!1}}const ev=Hc(0,!1),Fh=Hc(1,!1),zE=Hc(0,!0),UE=Hc(1,!0);class Hn{constructor(e,n,r,s,a){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=s,this.selectionsAfter=a}setSelAfter(e){return new Hn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new Hn(e.changes&&en.fromJSON(e.changes),[],e.mapped&&Ui.fromJSON(e.mapped),e.startSelection&&Ae.fromJSON(e.startSelection),e.selectionsAfter.map(Ae.fromJSON))}static fromTransaction(e,n){let r=mi;for(let s of e.startState.facet(IE)){let a=s(e);a.length&&(r=r.concat(a))}return!r.length&&e.changes.empty?null:new Hn(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,mi)}static selection(e){return new Hn(void 0,mi,void 0,void 0,e)}}function zc(t,e,n,r){let s=e+1>n+20?e-n-1:0,a=t.slice(s,e);return a.push(r),a}function VE(t,e){let n=[],r=!1;return t.iterChangedRanges((s,a)=>n.push(s,a)),e.iterChangedRanges((s,a,c,u)=>{for(let f=0;f<n.length;){let h=n[f++],g=n[f++];u>=h&&c<=g&&(r=!0)}}),r}function FE(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function tv(t,e){return t.length?e.length?t.concat(e):t:e}const mi=[],PE=200;function nv(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-PE));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),zc(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Hn.selection([e])]}function YE(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function Ph(t,e){if(!t.length)return t;let n=t.length,r=mi;for(;n;){let s=KE(t[n-1],e,r);if(s.changes&&!s.changes.empty||s.effects.length){let a=t.slice(0,n);return a[n-1]=s,a}else e=s.mapped,n--,r=s.selectionsAfter}return r.length?[Hn.selection(r)]:mi}function KE(t,e,n){let r=tv(t.selectionsAfter.length?t.selectionsAfter.map(u=>u.map(e)):mi,n);if(!t.changes)return Hn.selection(r);let s=t.changes.map(e),a=e.mapDesc(t.changes,!0),c=t.mapped?t.mapped.composeDesc(a):a;return new Hn(s,zt.mapEffects(t.effects,e),c,t.startSelection.map(a),r)}const GE=/^(input\.type|delete)($|\.)/;class Ji{constructor(e,n,r=0,s=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=s}isolate(){return this.prevTime?new Ji(this.done,this.undone):this}addChanges(e,n,r,s,a){let c=this.done,u=c[c.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!r||GE.test(r))&&(!u.selectionsAfter.length&&n-this.prevTime<s.newGroupDelay&&s.joinToEvent(a,VE(u.changes,e.changes))||r=="input.type.compose")?c=zc(c,c.length-1,s.minDepth,new Hn(e.changes.compose(u.changes),tv(zt.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,mi)):c=zc(c,c.length,s.minDepth,e),new Ji(c,mi,n,r)}addSelection(e,n,r,s){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:mi;return a.length>0&&n-this.prevTime<s&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&FE(a[a.length-1],e)?this:new Ji(nv(this.done,e),this.undone,n,r)}addMapping(e){return new Ji(Ph(this.done,e),Ph(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let s=e==0?this.done:this.undone;if(s.length==0)return null;let a=s[s.length-1],c=a.selectionsAfter[0]||(a.startSelection?a.startSelection.map(a.changes.invertedDesc,1):n.selection);if(r&&a.selectionsAfter.length)return n.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:Vh.of({side:e,rest:YE(s),selection:c}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let u=s.length==1?mi:s.slice(0,s.length-1);return a.mapped&&(u=Ph(u,a.mapped)),n.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:Vh.of({side:e,rest:u,selection:c}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Ji.empty=new Ji(mi,mi);const iv=[{key:"Mod-z",run:ev,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Fh,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Fh,preventDefault:!0},{key:"Mod-u",run:zE,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:UE,preventDefault:!0}];function wl(t,e){return Ae.create(t.ranges.map(e),t.mainIndex)}function Di(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function _i({state:t,dispatch:e},n){let r=wl(t.selection,n);return r.eq(t.selection,!0)?!1:(e(Di(t,r)),!0)}function Uc(t,e){return Ae.cursor(e?t.to:t.from)}function rv(t,e){return _i(t,n=>n.empty?t.moveByChar(n,e):Uc(n,e))}function Cn(t){return t.textDirectionAt(t.state.selection.main.head)==Lt.LTR}const sv=t=>rv(t,!Cn(t)),lv=t=>rv(t,Cn(t));function av(t,e){return _i(t,n=>n.empty?t.moveByGroup(n,e):Uc(n,e))}const XE=t=>av(t,!Cn(t)),JE=t=>av(t,Cn(t));function QE(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Vc(t,e,n){let r=Gr(t).resolveInner(e.head),s=n?yt.closedBy:yt.openedBy;for(let f=e.head;;){let h=n?r.childAfter(f):r.childBefore(f);if(!h)break;QE(t,h,s)?r=h:f=n?h.to:h.from}let a=r.type.prop(s),c,u;return a&&(c=n?vl(t,r.from,1):vl(t,r.to,-1))&&c.matched?u=n?c.end.to:c.end.from:u=n?r.to:r.from,Ae.cursor(u,n?-1:1)}const WE=t=>_i(t,e=>Vc(t.state,e,!Cn(t))),ZE=t=>_i(t,e=>Vc(t.state,e,Cn(t)));function ov(t,e){return _i(t,n=>{if(!n.empty)return Uc(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}const cv=t=>ov(t,!1),uv=t=>ov(t,!0);function dv(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,s;if(e){for(let a of t.state.facet(Je.scrollMargins)){let c=a(t);c?.top&&(n=Math.max(c?.top,n)),c?.bottom&&(r=Math.max(c?.bottom,r))}s=t.scrollDOM.clientHeight-n-r}else s=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,s-5)}}function fv(t,e){let n=dv(t),{state:r}=t,s=wl(r.selection,c=>c.empty?t.moveVertically(c,e,n.height):Uc(c,e));if(s.eq(r.selection))return!1;let a;if(n.selfScroll){let c=t.coordsAtPos(r.selection.main.head),u=t.scrollDOM.getBoundingClientRect(),f=u.top+n.marginTop,h=u.bottom-n.marginBottom;c&&c.top>f&&c.bottom<h&&(a=Je.scrollIntoView(s.main.head,{y:"start",yMargin:c.top-f}))}return t.dispatch(Di(r,s),{effects:a}),!0}const hv=t=>fv(t,!1),Yh=t=>fv(t,!0);function Xr(t,e,n){let r=t.lineBlockAt(e.head),s=t.moveToLineBoundary(e,n);if(s.head==e.head&&s.head!=(n?r.to:r.from)&&(s=t.moveToLineBoundary(e,n,!1)),!n&&s.head==r.from&&r.length){let a=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;a&&e.head!=r.from+a&&(s=Ae.cursor(r.from+a))}return s}const eO=t=>_i(t,e=>Xr(t,e,!0)),tO=t=>_i(t,e=>Xr(t,e,!1)),nO=t=>_i(t,e=>Xr(t,e,!Cn(t))),iO=t=>_i(t,e=>Xr(t,e,Cn(t))),rO=t=>_i(t,e=>Ae.cursor(t.lineBlockAt(e.head).from,1)),sO=t=>_i(t,e=>Ae.cursor(t.lineBlockAt(e.head).to,-1));function lO(t,e,n){let r=!1,s=wl(t.selection,a=>{let c=vl(t,a.head,-1)||vl(t,a.head,1)||a.head>0&&vl(t,a.head-1,1)||a.head<t.doc.length&&vl(t,a.head+1,-1);if(!c||!c.end)return a;r=!0;let u=c.start.from==a.head?c.end.to:c.end.from;return Ae.cursor(u)});return r?(e(Di(t,s)),!0):!1}const aO=({state:t,dispatch:e})=>lO(t,e);function gi(t,e,n){let r=wl(t.state.selection,s=>{s.undirectional&&s.head>=s.anchor!=e&&(s=Ae.range(s.head,s.anchor));let a=n(s);return Ae.range(s.anchor,a.head,a.goalColumn,a.bidiLevel||void 0,a.assoc)});return r.eq(t.state.selection)?!1:(t.dispatch(Di(t.state,r)),!0)}function pv(t,e){return gi(t,e,n=>t.moveByChar(n,e))}const mv=t=>pv(t,!Cn(t)),gv=t=>pv(t,Cn(t));function yv(t,e){return gi(t,e,n=>t.moveByGroup(n,e))}const oO=t=>yv(t,!Cn(t)),cO=t=>yv(t,Cn(t)),uO=t=>{let e=!Cn(t);return gi(t,e,n=>Vc(t.state,n,e))},dO=t=>{let e=Cn(t);return gi(t,e,n=>Vc(t.state,n,e))};function bv(t,e){return gi(t,e,n=>t.moveVertically(n,e))}const xv=t=>bv(t,!1),vv=t=>bv(t,!0);function wv(t,e){return gi(t,e,n=>t.moveVertically(n,e,dv(t).height))}const Sv=t=>wv(t,!1),Av=t=>wv(t,!0),fO=t=>gi(t,!0,e=>Xr(t,e,!0)),hO=t=>gi(t,!1,e=>Xr(t,e,!1)),pO=t=>{let e=!Cn(t);return gi(t,e,n=>Xr(t,n,e))},mO=t=>{let e=Cn(t);return gi(t,e,n=>Xr(t,n,e))},gO=t=>gi(t,!1,e=>Ae.cursor(t.lineBlockAt(e.head).from)),yO=t=>gi(t,!0,e=>Ae.cursor(t.lineBlockAt(e.head).to)),kv=({state:t,dispatch:e})=>(e(Di(t,{anchor:0})),!0),Cv=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.doc.length})),!0),Nv=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.selection.main.anchor,head:0})),!0),Tv=({state:t,dispatch:e})=>(e(Di(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),bO=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),xO=({state:t,dispatch:e})=>{let n=Pc(t).map(({from:r,to:s})=>Ae.undirectionalRange(r,Math.min(s+1,t.doc.length)));return e(t.update({selection:Ae.create(n),userEvent:"select"})),!0},vO=({state:t,dispatch:e})=>{let n=wl(t.selection,r=>{let s=Gr(t),a=s.resolveStack(r.from,1);if(r.empty){let c=s.resolveStack(r.from,-1);c.node.from>=a.node.from&&c.node.to<=a.node.to&&(a=c)}for(let c=a;c;c=c.next){let{node:u}=c;if((u.from<r.from&&u.to>=r.to||u.to>r.to&&u.from<=r.from)&&c.next)return Ae.undirectionalRange(u.from,u.to)}return r});return n.eq(t.selection)?!1:(e(Di(t,n)),!0)};function jv(t,e){let{state:n}=t,r=n.selection,s=n.selection.ranges.slice();for(let a of n.selection.ranges){let c=n.doc.lineAt(a.head);if(e?c.to<t.state.doc.length:c.from>0)for(let u=a;;){let f=t.moveVertically(u,e);if(f.head<c.from||f.head>c.to){s.some(h=>h.head==f.head)||s.push(f);break}else{if(f.head==u.head)break;u=f}}}return s.length==r.ranges.length?!1:(t.dispatch(Di(n,Ae.create(s,s.length-1))),!0)}const wO=t=>jv(t,!1),SO=t=>jv(t,!0),AO=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=Ae.create([n.main]):n.main.empty||(r=Ae.create([Ae.cursor(n.main.head)])),r?(e(Di(t,r)),!0):!1};function Ba(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,s=r.changeByRange(a=>{let{from:c,to:u}=a;if(c==u){let f=e(a);f<c?(n="delete.backward",f=Fc(t,f,!1)):f>c&&(n="delete.forward",f=Fc(t,f,!0)),c=Math.min(c,f),u=Math.max(u,f)}else c=Fc(t,c,!1),u=Fc(t,u,!0);return c==u?{range:a}:{changes:{from:c,to:u},range:Ae.cursor(c,c<a.head?-1:1)}});return s.changes.empty?!1:(t.dispatch(r.update(s,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?Je.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Fc(t,e,n){if(t instanceof Je)for(let r of t.state.facet(Je.atomicRanges).map(s=>s(t)))r.between(e,e,(s,a)=>{s<e&&a>e&&(e=n?a:s)});return e}const Ev=(t,e,n)=>Ba(t,r=>{let s=r.from,{state:a}=t,c=a.doc.lineAt(s),u,f;if(n&&!e&&s>c.from&&s<c.from+200&&!/[^ \t]/.test(u=c.text.slice(0,s-c.from))){if(u[u.length-1]==" ")return s-1;let h=Zo(u,a.tabSize),g=h%Bc(a)||Bc(a);for(let b=0;b<g&&u[u.length-1-b]==" ";b++)s--;f=s}else f=An(c.text,s-c.from,e,e)+c.from,f==s&&c.number!=(e?a.doc.lines:1)?f+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(c.text.slice(f-c.from,s-c.from))&&(f=An(c.text,f-c.from,!1,!1)+c.from);return f}),Kh=t=>Ev(t,!1,!0),Ov=t=>Ev(t,!0,!1),Mv=(t,e)=>Ba(t,n=>{let r=n.head,{state:s}=t,a=s.doc.lineAt(r),c=s.charCategorizer(r);for(let u=null;;){if(r==(e?a.to:a.from)){r==n.head&&a.number!=(e?s.doc.lines:1)&&(r+=e?1:-1);break}let f=An(a.text,r-a.from,e)+a.from,h=a.text.slice(Math.min(r,f)-a.from,Math.max(r,f)-a.from),g=c(h);if(u!=null&&g!=u)break;(h!=" "||r!=n.head)&&(u=g),r=f}return r}),Rv=t=>Mv(t,!1),kO=t=>Mv(t,!0),CO=t=>Ba(t,e=>{let n=t.lineBlockAt(e.head).to;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),NO=t=>Ba(t,e=>{let n=t.moveToLineBoundary(e,!1).head;return e.head>n?n:Math.max(0,e.head-1)}),TO=t=>Ba(t,e=>{let n=t.moveToLineBoundary(e,!0).head;return e.head<n?n:Math.min(t.state.doc.length,e.head+1)}),jO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:gt.of(["",""])},range:Ae.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},EO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let s=r.from,a=t.doc.lineAt(s),c=s==a.from?s-1:An(a.text,s-a.from,!1)+a.from,u=s==a.to?s+1:An(a.text,s-a.from,!0)+a.from;return{changes:{from:c,to:u,insert:t.doc.slice(s,u).append(t.doc.slice(c,s))},range:Ae.cursor(u)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function Pc(t){let e=[],n=-1;for(let r of t.selection.ranges){let s=t.doc.lineAt(r.from),a=t.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=t.doc.lineAt(r.to-1)),n>=s.number){let c=e[e.length-1];c.to=a.to,c.ranges.push(r)}else e.push({from:s.from,to:a.to,ranges:[r]});n=a.number+1}return e}function Dv(t,e,n){if(t.readOnly)return!1;let r=[],s=[];for(let a of Pc(t)){if(n?a.to==t.doc.length:a.from==0)continue;let c=t.doc.lineAt(n?a.to+1:a.from-1),u=c.length+1;if(n){r.push({from:a.to,to:c.to},{from:a.from,insert:c.text+t.lineBreak});for(let f of a.ranges)s.push(Ae.range(Math.min(t.doc.length,f.anchor+u),Math.min(t.doc.length,f.head+u)))}else{r.push({from:c.from,to:a.from},{from:a.to,insert:t.lineBreak+c.text});for(let f of a.ranges)s.push(Ae.range(f.anchor-u,f.head-u))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:Ae.create(s,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}const OO=({state:t,dispatch:e})=>Dv(t,e,!1),MO=({state:t,dispatch:e})=>Dv(t,e,!0);function _v(t,e,n){if(t.readOnly)return!1;let r=[];for(let a of Pc(t))n?r.push({from:a.from,insert:t.doc.slice(a.from,a.to)+t.lineBreak}):r.push({from:a.to,insert:t.lineBreak+t.doc.slice(a.from,a.to)});let s=t.changes(r);return e(t.update({changes:s,selection:t.selection.map(s,n?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const RO=({state:t,dispatch:e})=>_v(t,e,!1),DO=({state:t,dispatch:e})=>_v(t,e,!0),_O=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Pc(e).map(({from:s,to:a})=>(s>0?s--:a<e.doc.length&&a++,{from:s,to:a}))),r=wl(e.selection,s=>{let a;if(t.lineWrapping){let c=t.lineBlockAt(s.head),u=t.coordsAtPos(s.head,s.assoc||1);u&&(a=c.bottom+t.documentTop-u.bottom+t.defaultLineHeight/2)}return t.moveVertically(s,!0,a)}).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function LO(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=Gr(t).resolveInner(e),r=n.childBefore(e),s=n.childAfter(e),a;return r&&s&&r.to<=e&&s.from>=e&&(a=r.type.prop(yt.closedBy))&&a.indexOf(s.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(s.from).from&&!/\S/.test(t.sliceDoc(r.to,s.from))?{from:r.to,to:s.from}:null}const Lv=qv(!1),qO=qv(!0);function qv(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(s=>{let{from:a,to:c}=s,u=e.doc.lineAt(a),f=!t&&a==c&&LO(e,a);t&&(a=c=(c<=u.to?u:e.doc.lineAt(c)).to);let h=new Ic(e,{simulateBreak:a,simulateDoubleBreak:!!f}),g=Yx(h,a);for(g==null&&(g=Zo(/^\s*/.exec(e.doc.lineAt(a).text)[0],e.tabSize));c<u.to&&/\s/.test(u.text[c-u.from]);)c++;f?{from:a,to:c}=f:a>u.from&&a<u.from+100&&!/\S/.test(u.text.slice(0,a))&&(a=u.from);let b=["",$c(e,g)];return f&&b.push($c(e,h.lineIndent(u.from,-1))),{changes:{from:a,to:c,insert:gt.of(b)},range:Ae.cursor(a+1+b[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Gh(t,e){let n=-1;return t.changeByRange(r=>{let s=[];for(let c=r.from;c<=r.to;){let u=t.doc.lineAt(c);u.number>n&&(r.empty||r.to>u.from)&&(e(u,s,r),n=u.number),c=u.to+1}let a=t.changes(s);return{changes:s,range:Ae.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}const BO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Ic(t,{overrideIndentation:a=>{let c=n[a];return c??-1}}),s=Gh(t,(a,c,u)=>{let f=Yx(r,a.from);if(f==null)return;/\S/.test(a.text)||(f=0);let h=/^\s*/.exec(a.text)[0],g=$c(t,f);(h!=g||u.from<a.from+h.length)&&(n[a.from]=f,c.push({from:a.from,to:a.from+h.length,insert:g}))});return s.changes.empty||e(t.update(s,{userEvent:"indent"})),!0},Bv=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Gh(t,(n,r)=>{r.push({from:n.from,insert:t.facet(qh)})}),{userEvent:"input.indent"})),!0),$v=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Gh(t,(n,r)=>{let s=/^\s*/.exec(n.text)[0];if(!s)return;let a=Zo(s,t.tabSize),c=0,u=$c(t,Math.max(0,a-Bc(t)));for(;c<s.length&&c<u.length&&s.charCodeAt(c)==u.charCodeAt(c);)c++;r.push({from:n.from+c,to:n.from+s.length,insert:u.slice(c)})}),{userEvent:"delete.dedent"})),!0),$O=t=>(t.setTabFocusMode(),!0),IO=[{key:"Ctrl-b",run:sv,shift:mv,preventDefault:!0},{key:"Ctrl-f",run:lv,shift:gv},{key:"Ctrl-p",run:cv,shift:xv},{key:"Ctrl-n",run:uv,shift:vv},{key:"Ctrl-a",run:rO,shift:gO},{key:"Ctrl-e",run:sO,shift:yO},{key:"Ctrl-d",run:Ov},{key:"Ctrl-h",run:Kh},{key:"Ctrl-k",run:CO},{key:"Ctrl-Alt-h",run:Rv},{key:"Ctrl-o",run:jO},{key:"Ctrl-t",run:EO},{key:"Ctrl-v",run:Yh}],HO=[{key:"ArrowLeft",run:sv,shift:mv,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:XE,shift:oO,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:nO,shift:pO,preventDefault:!0},{key:"ArrowRight",run:lv,shift:gv,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:JE,shift:cO,preventDefault:!0},{mac:"Cmd-ArrowRight",run:iO,shift:mO,preventDefault:!0},{key:"ArrowUp",run:cv,shift:xv,preventDefault:!0},{mac:"Cmd-ArrowUp",run:kv,shift:Nv},{mac:"Ctrl-ArrowUp",run:hv,shift:Sv},{key:"ArrowDown",run:uv,shift:vv,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Cv,shift:Tv},{mac:"Ctrl-ArrowDown",run:Yh,shift:Av},{key:"PageUp",run:hv,shift:Sv},{key:"PageDown",run:Yh,shift:Av},{key:"Home",run:tO,shift:hO,preventDefault:!0},{key:"Mod-Home",run:kv,shift:Nv},{key:"End",run:eO,shift:fO,preventDefault:!0},{key:"Mod-End",run:Cv,shift:Tv},{key:"Enter",run:Lv,shift:Lv},{key:"Mod-a",run:bO},{key:"Backspace",run:Kh,shift:Kh,preventDefault:!0},{key:"Delete",run:Ov,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Rv,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:kO,preventDefault:!0},{mac:"Mod-Backspace",run:NO,preventDefault:!0},{mac:"Mod-Delete",run:TO,preventDefault:!0}].concat(IO.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Iv=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:WE,shift:uO},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:ZE,shift:dO},{key:"Alt-ArrowUp",run:OO},{key:"Shift-Alt-ArrowUp",run:RO},{key:"Alt-ArrowDown",run:MO},{key:"Shift-Alt-ArrowDown",run:DO},{key:"Mod-Alt-ArrowUp",run:wO},{key:"Mod-Alt-ArrowDown",run:SO},{key:"Escape",run:AO},{key:"Mod-Enter",run:qO},{key:"Alt-l",mac:"Ctrl-l",run:xO},{key:"Mod-i",run:vO,preventDefault:!0},{key:"Mod-[",run:$v},{key:"Mod-]",run:Bv},{key:"Mod-Alt-\\",run:BO},{key:"Shift-Mod-k",run:_O},{key:"Shift-Mod-\\",run:aO},{key:"Mod-/",run:ME},{key:"Alt-A",mac:"Ctrl-A",run:DE},{key:"Ctrl-m",mac:"Shift-Alt-m",run:$O}].concat(HO),zO={key:"Tab",run:Bv,shift:$v};function Hv({ariaLabel:t,dataTestId:e,ariaControls:n,ariaActiveDescendant:r,ariaAutocomplete:s,ariaExpanded:a}){const c={"aria-label":t,"aria-multiline":"true",role:"textbox",spellcheck:"false"};return e&&(c["data-testid"]=e),n&&(c["aria-controls"]=n),r&&(c["aria-activedescendant"]=r),s&&(c["aria-autocomplete"]=s),a!==void 0&&(c["aria-expanded"]=String(a)),c}function zv(t){const e=t==="dark";return Je.theme({"&":{height:"100%",backgroundColor:e?"#030712":"#ffffff",color:e?"#f3f4f6":"#111827"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',fontSize:"12px",lineHeight:"24px",overflow:"auto"},".cm-content":{minHeight:"100%",padding:"8px 12px",caretColor:e?"#f9fafb":"#111827"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:e?"#f9fafb":"#111827"},".cm-gutters":{backgroundColor:e?"#111827":"#f9fafb",color:e?"#6b7280":"#9ca3af",borderRight:`1px solid ${e?"#1f2937":"#e5e7eb"}`},".cm-activeLine":{backgroundColor:e?"#11182780":"#f3f4f680"},".cm-activeLineGutter":{backgroundColor:e?"#1f2937":"#f3f4f6"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:e?"#1d4ed880":"#bfdbfe"}},{dark:e})}const UO={key:"Enter",run:t=>(t.dispatch(t.state.replaceSelection(`
|
|
59
|
+
`)),!0)};function Uv(t){const e=Iv.filter(n=>n.key!=="Enter");return vx.of(t?[...Iv,...iv,zO]:[UO,...e,...iv])}const $a=I.forwardRef(({ariaLabel:t,value:e,onChange:n,language:r="text",theme:s="light",minLines:a=7,maxLines:c=16,dataTestId:u,wrap:f=!1,autoIndent:h=!1,ariaControls:g,ariaActiveDescendant:b,ariaAutocomplete:v,ariaExpanded:w,onEditorKeyDown:A,onCursorChange:C},O)=>{const D=I.useRef(null),E=I.useRef(null),j=I.useRef(n),M=I.useRef(C),_=I.useRef(A),q=I.useRef(!1),R=I.useRef({value:e,theme:s,wrap:f,autoIndent:h,ariaLabel:t,dataTestId:u,ariaControls:g,ariaActiveDescendant:b,ariaAutocomplete:v,ariaExpanded:w}),X=I.useMemo(()=>new nr,[]),U=I.useMemo(()=>new nr,[]),B=I.useMemo(()=>new nr,[]),K=I.useMemo(()=>new nr,[]),W=I.useMemo(()=>new nr,[]);j.current=n,M.current=C,_.current=A,I.useImperativeHandle(O,()=>({focus:()=>E.current?.focus(),getSelection:()=>{const Q=E.current?.state.selection.main;return Q?{from:Q.from,to:Q.to}:{from:0,to:0}},setSelection:(Q,oe=Q)=>{const ce=E.current;if(!ce)return;const ve=ce.state.doc.length,T=Math.max(0,Math.min(Q,ve)),z=Math.max(0,Math.min(oe,ve));ce.dispatch({selection:{anchor:T,head:z},scrollIntoView:!0}),ce.focus(),M.current?.(T)},coordsAtPos:Q=>{const oe=E.current;if(!oe)return null;const ce=Math.max(0,Math.min(Q,oe.state.doc.length)),ve=oe.coordsAtPos(ce);return ve?{left:ve.left,right:ve.right,top:ve.top,bottom:ve.bottom}:null}}),[]),I.useEffect(()=>{if(!D.current||E.current)return;const Q=R.current,oe=wt.create({doc:Q.value,extensions:[HE(),Rj(),X.of(zv(Q.theme)),U.of(Q.wrap?Je.lineWrapping:[]),B.of(Q.wrap?[]:[Rx(),_x(),Tx()]),K.of(Uv(Q.autoIndent)),W.of(Je.contentAttributes.of(Hv(Q))),Go.highest(Je.domEventHandlers({keydown:ve=>(_.current?.(ve),ve.defaultPrevented)})),Je.updateListener.of(ve=>{ve.docChanged&&!q.current&&j.current(ve.state.doc.toString()),(ve.selectionSet||ve.docChanged)&&M.current?.(ve.state.selection.main.head)})]}),ce=new Je({state:oe,parent:D.current});return E.current=ce,()=>{ce.destroy(),E.current=null}},[W,B,K,X,U]),I.useEffect(()=>{const Q=E.current;if(!Q||Q.state.doc.toString()===e)return;const oe=Q.state.selection.main;q.current=!0,Q.dispatch({changes:{from:0,to:Q.state.doc.length,insert:e},selection:{anchor:Math.min(oe.anchor,e.length),head:Math.min(oe.head,e.length)}}),q.current=!1},[e]),I.useEffect(()=>{E.current?.dispatch({effects:X.reconfigure(zv(s))})},[s,X]),I.useEffect(()=>{E.current?.dispatch({effects:U.reconfigure(f?Je.lineWrapping:[])}),E.current?.dispatch({effects:B.reconfigure(f?[]:[Rx(),_x(),Tx()])})},[B,f,U]),I.useEffect(()=>{E.current?.dispatch({effects:K.reconfigure(Uv(h))})},[h,K]),I.useEffect(()=>{E.current?.dispatch({effects:W.reconfigure(Je.contentAttributes.of(Hv({ariaLabel:t,dataTestId:u,ariaControls:g,ariaActiveDescendant:b,ariaAutocomplete:v,ariaExpanded:w})))})},[b,v,g,w,t,W,u]);const ye=Math.max(1,e.split(`
|
|
60
|
+
`).length),fe=Math.min(c,Math.max(a,ye))*24+16,L=s==="dark";return p.jsx("div",{className:`api-client-code-editor min-w-0 overflow-hidden rounded-md border focus-within:ring-2 focus-within:ring-inset focus-within:ring-blue-500 ${L?"border-gray-700 bg-gray-950":"border-gray-300 bg-white"}`,"data-editor":"codemirror","data-language":r,"data-wrap":f?"soft":"off",style:{height:fe},children:p.jsx("div",{ref:D,className:"h-full min-w-0"})})});$a.displayName="ApiClientCodeEditor";const Vv=()=>({key:"",value:"",enabled:!0}),Xh=()=>({key:"",value:"",enabled:!0,type:"text"}),Fv=[["application/json","JSON — application/json"],["application/problem+json","Problem JSON — application/problem+json"],["application/ld+json","JSON-LD — application/ld+json"],["text/plain","Text — text/plain"],["application/xml","XML — application/xml"],["text/html","HTML — text/html"],["application/javascript","JavaScript — application/javascript"],["application/octet-stream","Binary — application/octet-stream"]];function VO(t){const e=(t||"").toLowerCase();return e.includes("json")?"json":e.includes("xml")?"xml":e.includes("html")?"html":e.includes("javascript")?"javascript":"text"}function FO({label:t,entries:e,onChange:n,inputClass:r}){const s=(a,c)=>n(e.map((u,f)=>f===a?{...u,...c}:u));return p.jsxs("div",{className:"space-y-2",children:[e.map((a,c)=>p.jsxs("div",{className:"grid grid-cols-[auto_1fr_1fr_auto] items-center gap-2",children:[p.jsx("input",{"aria-label":`${t} ${c+1} enabled`,type:"checkbox",checked:a.enabled!==!1,onChange:u=>s(c,{enabled:u.target.checked})}),p.jsx("input",{"aria-label":`${t} ${c+1} key`,className:`min-w-0 rounded-md border px-3 py-2 text-sm ${r}`,placeholder:"Key",value:a.key,onChange:u=>s(c,{key:u.target.value})}),p.jsx("input",{"aria-label":`${t} ${c+1} value`,className:`min-w-0 rounded-md border px-3 py-2 text-sm ${r}`,placeholder:"Value",value:a.value,onChange:u=>s(c,{value:u.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove ${t.toLowerCase()} ${c+1}`,className:"rounded-md border p-2",onClick:()=>n(e.filter((u,f)=>f!==c)),children:p.jsx(ci,{className:"h-4 w-4"})})]},c)),p.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 rounded-md border px-3 py-2 text-xs",onClick:()=>n([...e,Vv()]),children:[p.jsx(Cs,{className:"h-3.5 w-3.5"})," Add field"]})]})}const PO=({draft:t,onChange:e,theme:n="light"})=>{const r=t.bodyMode||da(t),s=n==="dark",a=s?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",u=Fv.some(([v])=>v===t.contentType)?t.contentType||"application/json":"__custom__",f=I.useMemo(()=>{if(r!=="json"||!(t.body||"").trim())return null;try{return JSON.parse(t.body||""),""}catch(v){return v instanceof Error?v.message:"Invalid JSON"}},[t.body,r]),h=I.useMemo(()=>{const v=t.graphql?.variables?.trim();if(r!=="graphql"||!v)return null;try{return JSON.parse(v),""}catch(w){return w instanceof Error?w.message:"Invalid JSON"}},[t.graphql?.variables,r]),g=v=>{const w={bodyMode:v};v==="json"&&(!t.contentType||!t.contentType.includes("json"))&&(w.contentType="application/json"),v==="raw"&&!t.contentType&&(w.contentType="text/plain"),v==="urlencoded"&&(w.contentType="application/x-www-form-urlencoded"),v==="formdata"&&(w.contentType=void 0),v==="binary"&&!t.contentType&&(w.contentType="application/octet-stream"),v==="graphql"&&(w.contentType="application/json"),e({...t,...w})},b=(v,w)=>{const A=t.formData||[Xh()];e({...t,formData:A.map((C,O)=>O===v?{...C,...w}:C)})};return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-body-heading",children:[p.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[p.jsxs("label",{className:"text-sm font-medium",children:["Body type",p.jsxs("select",{"aria-label":"Request body type",className:`ml-2 rounded-md border px-3 py-2 text-sm ${a}`,value:r,onChange:v=>g(v.target.value),children:[p.jsx("option",{value:"none",children:"None"}),p.jsx("option",{value:"json",children:"JSON"}),p.jsx("option",{value:"raw",children:"Raw"}),p.jsx("option",{value:"urlencoded",children:"x-www-form-urlencoded"}),p.jsx("option",{value:"formdata",children:"form-data"}),p.jsx("option",{value:"binary",children:"Binary"}),p.jsx("option",{value:"graphql",children:"GraphQL"})]})]}),(r==="json"||r==="raw"||r==="binary")&&p.jsxs("div",{className:"flex flex-wrap items-end gap-2",children:[p.jsxs("label",{className:"text-sm font-medium",children:["Content type",p.jsxs("select",{"aria-label":"Content type",className:`ml-2 rounded-md border px-3 py-2 text-sm ${a}`,value:u,onChange:v=>{const w=v.target.value==="__custom__"?"":v.target.value;e({...t,contentType:w})},children:[Fv.map(([v,w])=>p.jsx("option",{value:v,children:w},v)),p.jsx("option",{value:"__custom__",children:"Custom…"})]})]}),u==="__custom__"&&p.jsx("input",{"aria-label":"Custom content type",className:`rounded-md border px-3 py-2 text-sm ${a}`,placeholder:"application/vnd.example+json",value:t.contentType||"",onChange:v=>e({...t,contentType:v.target.value})})]})]}),r==="none"&&p.jsx("div",{className:`rounded-md border border-dashed p-4 text-sm ${s?"border-gray-700 text-gray-400":"border-gray-300 text-gray-500"}`,children:"This request has no body."}),(r==="json"||r==="raw")&&p.jsxs("div",{className:"space-y-2",children:[p.jsx($a,{ariaLabel:"Request body",language:r==="json"?"json":VO(t.contentType),theme:n,value:t.body||"",onChange:v=>e({...t,body:v}),minLines:9,maxLines:20}),p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[p.jsx("span",{className:`text-xs ${f?"text-red-600":r==="json"&&f===""?"text-green-600":s?"text-gray-400":"text-gray-500"}`,children:r==="json"?f?`Invalid JSON: ${f}`:(t.body||"").trim()?"Valid JSON":"Enter a JSON object, array, or value.":"Raw body is sent exactly as entered."}),r==="json"&&p.jsx("button",{type:"button",className:"rounded-md border px-3 py-1.5 text-xs",disabled:!!f||!(t.body||"").trim(),onClick:()=>{try{e({...t,body:JSON.stringify(JSON.parse(t.body||""),null,2)})}catch{}},children:"Beautify JSON"})]})]}),r==="urlencoded"&&p.jsxs("div",{className:"space-y-2",children:[p.jsx(FO,{label:"Form field",entries:t.urlencoded?.length?t.urlencoded:[Vv()],inputClass:a,onChange:v=>e({...t,urlencoded:v,contentType:"application/x-www-form-urlencoded"})}),p.jsx("p",{className:`text-xs ${s?"text-gray-400":"text-gray-500"}`,children:"Enabled fields are URL-encoded at send time. Variable substitution still applies to keys and values."})]}),r==="formdata"&&p.jsxs("div",{className:"space-y-2",children:[(t.formData?.length?t.formData:[Xh()]).map((v,w)=>p.jsxs("div",{className:"grid gap-2 md:grid-cols-[auto_7rem_1fr_1fr_auto]",children:[p.jsx("input",{"aria-label":`Form data ${w+1} enabled`,type:"checkbox",checked:v.enabled!==!1,onChange:A=>b(w,{enabled:A.target.checked})}),p.jsxs("select",{"aria-label":`Form data ${w+1} type`,className:`rounded-md border px-2 py-2 text-sm ${a}`,value:v.type||"text",onChange:A=>b(w,{type:A.target.value,file:void 0,fileName:void 0}),children:[p.jsx("option",{value:"text",children:"Text"}),p.jsx("option",{value:"file",children:"File"})]}),p.jsx("input",{"aria-label":`Form data ${w+1} key`,className:`min-w-0 rounded-md border px-3 py-2 text-sm ${a}`,placeholder:"Key",value:v.key,onChange:A=>b(w,{key:A.target.value})}),v.type==="file"?p.jsxs("label",{className:`flex min-w-0 cursor-pointer items-center rounded-md border px-3 py-2 text-sm ${a}`,children:[p.jsx("span",{className:"truncate",children:v.file?.name||v.fileName||"Choose file…"}),p.jsx("input",{"aria-label":`Form data ${w+1} file`,className:"sr-only",type:"file",onChange:A=>{const C=A.target.files?.[0];b(w,{file:C,fileName:C?.name,contentType:C?.type||void 0})}})]}):p.jsx("input",{"aria-label":`Form data ${w+1} value`,className:`min-w-0 rounded-md border px-3 py-2 text-sm ${a}`,placeholder:"Value",value:v.value,onChange:A=>b(w,{value:A.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove form data ${w+1}`,className:"rounded-md border p-2",onClick:()=>e({...t,formData:(t.formData||[]).filter((A,C)=>C!==w)}),children:p.jsx(ci,{className:"h-4 w-4"})})]},w)),p.jsxs("button",{type:"button",className:"inline-flex items-center gap-2 rounded-md border px-3 py-2 text-xs",onClick:()=>e({...t,formData:[...t.formData||[],Xh()]}),children:[p.jsx(Cs,{className:"h-3.5 w-3.5"})," Add form-data field"]}),p.jsx("p",{className:`text-xs ${s?"text-gray-400":"text-gray-500"}`,children:"The browser supplies the multipart boundary automatically. Imported Postman file paths must be re-selected from this browser."})]}),r==="binary"&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs("label",{className:`flex cursor-pointer items-center justify-between gap-3 rounded-md border px-3 py-3 text-sm ${a}`,children:[p.jsx("span",{className:"min-w-0 truncate",children:t.binary?.file?.name||t.binary?.fileName||"Choose binary file…"}),p.jsx("span",{className:"shrink-0 text-xs font-medium",children:"Browse"}),p.jsx("input",{"aria-label":"Binary file",className:"sr-only",type:"file",onChange:v=>{const w=v.target.files?.[0];e({...t,contentType:w?.type||t.contentType||"application/octet-stream",binary:{file:w,fileName:w?.name||t.binary?.fileName,contentType:w?.type||t.binary?.contentType}})}})]}),p.jsx("p",{className:`text-xs ${s?"text-gray-400":"text-gray-500"}`,children:"The selected file is sent as the request body without text conversion. Saved requests retain only file metadata, so the browser asks you to re-select the file before a later send or collection run."})]}),r==="graphql"&&p.jsxs("div",{className:"grid gap-3 xl:grid-cols-2",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"text-xs font-medium",children:"Query"}),p.jsx($a,{ariaLabel:"GraphQL query",language:"graphql",theme:n,value:t.graphql?.query||"",onChange:v=>e({...t,graphql:{query:v,variables:t.graphql?.variables||""}}),minLines:9,maxLines:20})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("div",{className:"text-xs font-medium",children:"Variables (JSON)"}),p.jsx($a,{ariaLabel:"GraphQL variables",language:"json",theme:n,value:t.graphql?.variables||"",onChange:v=>e({...t,graphql:{query:t.graphql?.query||"",variables:v}}),minLines:9,maxLines:20}),p.jsx("div",{className:`text-xs ${h?"text-red-600":s?"text-gray-400":"text-gray-500"}`,children:h?`Invalid variables JSON: ${h}`:"Variables are serialized with the query as application/json."})]})]})]})};function YO(t,e){return t.find(([n])=>n.toLowerCase()===e.toLowerCase())?.[1]||""}function KO(t,e){const n=e.toLowerCase();if(n.includes("json"))try{return{body:JSON.stringify(JSON.parse(t),null,2),language:"json"}}catch{return{body:t,language:"json",invalidJson:!0}}return n.includes("html")?{body:t,language:"markup"}:n.includes("xml")?{body:t,language:"markup"}:n.includes("javascript")?{body:t,language:"javascript"}:{body:t,language:"text"}}function GO(t,e){const n=e.trim().toLowerCase();if(!n)return 0;let r=0,s=0;const a=t.toLowerCase();for(;s<a.length;){const c=a.indexOf(n,s);if(c<0)break;r+=1,s=c+Math.max(1,n.length)}return r}function XO(t,e){const n=e.trim().toLowerCase();return n?t.split(`
|
|
61
61
|
`).filter(s=>s.toLowerCase().includes(n)).join(`
|
|
62
|
-
`):t}const
|
|
62
|
+
`):t}const JO=({response:t,theme:e="light",curlCommand:n,advanced:r=!0})=>{const[s,a]=I.useState("pretty"),[c,u]=I.useState(""),[f,h]=I.useState(!1),[g,b]=I.useState(""),[v,w]=I.useState(!1),A=YO(t.headers,"content-type"),C=I.useMemo(()=>KO(t.body,A),[A,t.body]),O=/(?:text\/html|application\/xhtml\+xml)/i.test(A),D=I.useMemo(()=>new TextEncoder().encode(t.body).byteLength,[t.body]),E=e==="dark",j=r?s:"pretty",M=j==="pretty"?C.body:t.body,_=I.useMemo(()=>GO(M,c),[c,M]),q=I.useMemo(()=>f?XO(M,c):M,[c,M,f]),R=g.trim().toLowerCase(),X=t.headers.filter(([W,ye])=>!R||`${W}: ${ye}`.toLowerCase().includes(R)),U=E?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",B=E?"text-gray-400":"text-gray-500",K=async()=>{if(!(!n||typeof navigator>"u"||!navigator.clipboard?.writeText))try{await navigator.clipboard.writeText(n),w(!0),window.setTimeout(()=>w(!1),1500)}catch{w(!1)}};return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-response-heading",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[p.jsxs("div",{id:"api-client-response-heading",className:"font-semibold",children:["Response ",p.jsxs("span",{className:t.status>=400?E?"text-red-300":"text-red-600":E?"text-green-300":"text-green-600",children:[t.status," ",t.statusText]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsxs("div",{className:`flex flex-wrap gap-3 text-xs ${B}`,children:[t.transport&&p.jsx("span",{"aria-label":"Actual transport",children:t.transport==="api-host"?"API host":"Browser"}),t.transport==="api-host"&&t.hostRoundTripTime!=null?p.jsxs(p.Fragment,{children:[p.jsxs("span",{children:["Host ",Math.max(0,t.hostRoundTripTime-t.responseTime)," ms"]}),p.jsxs("span",{children:["Target ",t.responseTime," ms"]})]}):p.jsxs("span",{children:[t.responseTime," ms"]}),p.jsxs("span",{children:[D.toLocaleString()," B"]}),A&&p.jsx("span",{className:"font-mono",children:A.split(";")[0]})]}),n&&p.jsx("button",{type:"button",className:`rounded-md border px-2.5 py-1.5 text-xs font-medium ${E?"border-gray-700 bg-gray-900 text-gray-200 hover:bg-gray-800":"border-gray-300 bg-white text-gray-700 hover:bg-gray-50"}`,onClick:()=>{K()},"aria-label":"Copy request as cURL",children:v?"Copied cURL":"Copy as cURL"})]})]}),r&&p.jsxs("div",{className:`flex w-fit overflow-hidden rounded-md border ${E?"border-gray-700":"border-gray-300"}`,role:"group","aria-label":"Response body view",children:[["pretty","raw"].map(W=>{const ye=W==="pretty"?"Pretty":"Raw";return p.jsx("button",{type:"button","aria-label":ye,"aria-pressed":s===W,className:`px-3 py-1.5 text-xs font-medium ${s===W?"bg-blue-600 text-white":E?"bg-gray-900 text-gray-300":"bg-white text-gray-700"}`,onClick:()=>a(W),children:ye},W)}),p.jsx("button",{type:"button",disabled:!O,"aria-pressed":s==="preview",className:`px-3 py-1.5 text-xs font-medium ${s==="preview"?"bg-blue-600 text-white":E?"bg-gray-900 text-gray-300":"bg-white text-gray-700"} disabled:cursor-not-allowed disabled:opacity-40`,onClick:()=>a("preview"),children:"Preview"})]}),r&&j!=="preview"&&p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p.jsx("input",{"aria-label":"Search response body",type:"search",className:`min-w-0 flex-1 rounded-md border px-3 py-2 text-sm ${U}`,placeholder:"Search response body…",value:c,onChange:W=>u(W.target.value)}),p.jsx("span",{className:`text-xs ${B}`,children:c.trim()?`${_} match${_===1?"":"es"}`:"Search exact response text"}),p.jsxs("label",{className:`inline-flex items-center gap-2 text-xs ${B}`,children:[p.jsx("input",{type:"checkbox",checked:f,disabled:!c.trim(),onChange:W=>h(W.target.checked)}),"Only matching lines"]})]}),j==="pretty"&&p.jsxs("div",{className:"space-y-2",children:[C.invalidJson&&p.jsx("div",{className:`rounded-md border px-3 py-2 text-xs ${E?"border-amber-800 bg-amber-950/40 text-amber-200":"border-amber-300 bg-amber-50 text-amber-800"}`,children:"Response declares JSON but could not be parsed. Showing the exact payload."}),p.jsx(_r,{code:q||"(empty response)",language:C.language,title:r?"Body — Pretty":"Response body",theme:e,wrap:!0})]}),r&&j==="raw"&&p.jsx("div",{"data-testid":"api-client-response-raw-body",children:p.jsx(_r,{code:q||"(empty response)",language:"text",title:"Body — Raw",theme:e,wrap:!0})}),r&&j==="preview"&&O&&p.jsx("iframe",{title:"Response preview",sandbox:"",srcDoc:t.body,className:`min-h-80 w-full rounded-md border bg-white ${E?"border-gray-700":"border-gray-300"}`}),r&&t.headers.length>0&&p.jsxs("section",{className:`overflow-hidden rounded-md border ${E?"border-gray-700":"border-gray-200"}`,"aria-labelledby":"api-client-response-headers-heading",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[p.jsxs("h4",{id:"api-client-response-headers-heading",className:"text-sm font-medium",children:["Response headers (",t.headers.length,")"]}),p.jsx("input",{"aria-label":"Filter response headers",type:"search",className:`rounded-md border px-2 py-1.5 text-xs ${U}`,placeholder:"Filter headers…",value:g,onChange:W=>b(W.target.value)})]}),p.jsx("div",{className:"overflow-x-auto border-t",children:p.jsxs("table",{className:"w-full min-w-[28rem] text-left text-xs",children:[p.jsx("thead",{className:E?"bg-gray-900 text-gray-300":"bg-gray-50 text-gray-600",children:p.jsxs("tr",{children:[p.jsx("th",{className:"px-3 py-2 font-medium",children:"Header"}),p.jsx("th",{className:"px-3 py-2 font-medium",children:"Value"})]})}),p.jsxs("tbody",{children:[X.map(([W,ye],pe)=>p.jsxs("tr",{className:E?"border-t border-gray-800":"border-t border-gray-100",children:[p.jsx("th",{scope:"row",className:"whitespace-nowrap px-3 py-2 font-mono font-medium",children:W}),p.jsx("td",{className:"break-all px-3 py-2 font-mono",children:ye})]},`${W}:${pe}`)),X.length===0&&p.jsx("tr",{children:p.jsx("td",{colSpan:2,className:`px-3 py-4 text-center ${B}`,children:"No response headers match this filter."})})]})]})})]})]})};function QO(t){if(!t.trim())return{valid:!0,message:"Ready"};try{return new Function("flex","console",`"use strict"; return (async () => {
|
|
63
63
|
${t}
|
|
64
|
-
});`),{valid:!0,message:"Syntax OK"}}catch(e){return{valid:!1,message:e instanceof Error?e.message:String(e)}}}function
|
|
64
|
+
});`),{valid:!0,message:"Syntax OK"}}catch(e){return{valid:!1,message:e instanceof Error?e.message:String(e)}}}function WO(t,e){let n=0,r=0;const s={...e};for(let a=0;a<t.length;a+=1){const c=t[a],u=t[a+1];if(s.blockComment){c==="*"&&u==="/"&&(s.blockComment=!1,a+=1);continue}if(s.quote){if(s.escaped){s.escaped=!1;continue}if(c==="\\"){s.escaped=!0;continue}c===s.quote&&(s.quote=void 0);continue}if(c==="/"&&u==="/")break;if(c==="/"&&u==="*"){s.blockComment=!0,a+=1;continue}if(c==="'"||c==='"'||c==="`"){s.quote=c,s.escaped=!1;continue}c==="{"?n+=1:c==="}"&&(r+=1)}return{opens:n,closes:r,state:s}}function ZO(t){const e=t.replace(/\r\n?/g,`
|
|
65
65
|
`);if(!e.trim())return e;let n=0,r={escaped:!1,blockComment:!1};return e.split(`
|
|
66
|
-
`).map(a=>{const u=a.replace(/[ \t]+$/g,"").trimStart();if(!u)return"";const f=u.match(/^}+/)?.[0].length||0,h=Math.max(0,n-f),g=
|
|
67
|
-
`)}function
|
|
68
|
-
`).length}function
|
|
66
|
+
`).map(a=>{const u=a.replace(/[ \t]+$/g,"").trimStart();if(!u)return"";const f=u.match(/^}+/)?.[0].length||0,h=Math.max(0,n-f),g=WO(u,r);return r=g.state,n=Math.max(0,n+g.opens-g.closes),`${" ".repeat(h)}${u}`}).join(`
|
|
67
|
+
`)}function Pv(t,e){return t.slice(0,Math.max(0,Math.min(e,t.length))).replace(/\r\n?/g,`
|
|
68
|
+
`).length}function Yv(t,e,n){const r=t.split(`
|
|
69
69
|
`),s=e.split(`
|
|
70
70
|
`),a=t.slice(0,Math.max(0,Math.min(n,t.length))),c=a.split(`
|
|
71
71
|
`).length-1,u=a.lastIndexOf(`
|
|
72
|
-
`),f=a.length-(u+1),h=r[c]||"",g=s[c]||"",b=h.length-h.trimStart().length,v=g.length-g.trimStart().length,w=g.length-v,A=f<=b?Math.min(f,v):v+Math.min(f-b,w);return s.slice(0,c).reduce((
|
|
73
|
-
`),s=VO(t),a=Fv(r,s,Vv(t,e)),c=Fv(r,s,Vv(t,n));return{value:s,selectionStart:Math.min(a,s.length),selectionEnd:Math.min(Math.max(a,c),s.length)}}const Kh=[{label:"get",kind:"method",signature:"get(key: string): string | undefined",documentation:"Read a variable by key."},{label:"has",kind:"method",signature:"has(key: string): boolean",documentation:"Check whether a variable is defined."},{label:"set",kind:"method",signature:"set(key: string, value: unknown): void",documentation:"Set a variable. Collection and environment stores persist the change in the workspace."},{label:"unset",kind:"method",signature:"unset(key: string): void",documentation:"Remove a variable by key."},{label:"replaceIn",kind:"method",signature:"replaceIn(value: string): string",documentation:"Replace {{variable}} placeholders using this variable scope."}],PO={flex:[{label:"request",kind:"property",documentation:"The mutable request draft available to pre-request and test scripts."},{label:"response",kind:"property",documentation:"The response from the executed request.",testsOnly:!0},{label:"environment",kind:"property",documentation:"Read and mutate variables in the active environment."},{label:"collection",kind:"property",documentation:"Read and mutate variables on the current collection."},{label:"variables",kind:"property",documentation:"Read and mutate the effective variables for this execution."},{label:"expect",kind:"function",signature:"expect(actual: unknown): FlexExpectation",documentation:"Create an assertion chain for a value."},{label:"test",kind:"function",signature:"test(name: string, callback: () => unknown | Promise<unknown>): void",documentation:"Register a post-response test.",testsOnly:!0}],"flex.request":[{label:"method",kind:"property",signature:"method: string",documentation:"Read or replace the HTTP method."},{label:"url",kind:"property",signature:"url: string",documentation:"Read or replace the request URL before variable resolution."},{label:"headers",kind:"property",documentation:"Mutable request-header helpers."},{label:"body",kind:"property",documentation:"Mutable raw request-body helpers."}],"flex.request.headers":[{label:"get",kind:"method",signature:"get(name: string): string | undefined",documentation:"Read a request header case-insensitively."},{label:"has",kind:"method",signature:"has(name: string): boolean",documentation:"Check whether a request header exists."},{label:"set",kind:"method",signature:"set(name: string, value: unknown): void",documentation:"Set or replace a request header."},{label:"upsert",kind:"method",signature:"upsert({ key, value }: { key: string; value: unknown }): void",documentation:"Set or replace a request header from a key/value object."},{label:"remove",kind:"method",signature:"remove(name: string): void",documentation:"Remove a request header case-insensitively."},{label:"toObject",kind:"method",signature:"toObject(): Record<string, string>",documentation:"Return enabled request headers as an object."}],"flex.request.body":[{label:"raw",kind:"property",signature:"raw: string",documentation:"Read or replace the raw request body."}],"flex.response":[{label:"code",kind:"property",signature:"code: number",documentation:"HTTP response status code.",testsOnly:!0},{label:"status",kind:"property",signature:"status: string",documentation:"HTTP response status text.",testsOnly:!0},{label:"responseTime",kind:"property",signature:"responseTime: number",documentation:"Measured response time in milliseconds.",testsOnly:!0},{label:"headers",kind:"property",documentation:"Read-only response-header helpers.",testsOnly:!0},{label:"text",kind:"method",signature:"text(): string",documentation:"Return the response body as text.",testsOnly:!0},{label:"json",kind:"method",signature:"json(): unknown",documentation:"Parse and return the response body as JSON.",testsOnly:!0}],"flex.response.headers":[{label:"get",kind:"method",signature:"get(name: string): string | undefined",documentation:"Read a response header case-insensitively.",testsOnly:!0},{label:"has",kind:"method",signature:"has(name: string): boolean",documentation:"Check whether a response header exists.",testsOnly:!0},{label:"toObject",kind:"method",signature:"toObject(): Record<string, string>",documentation:"Return response headers as an object.",testsOnly:!0}],"flex.environment":Kh,"flex.collection":Kh,"flex.variables":Kh.map(t=>({...t,documentation:t.label==="set"||t.label==="unset"?`${t.documentation} Local effective-variable changes apply only to the current request execution.`:t.documentation})),"flex.expect.to":[{label:"equal",kind:"method",signature:"equal(expected: unknown): void",documentation:"Assert strict equality with Object.is."},{label:"eql",kind:"method",signature:"eql(expected: unknown): void",documentation:"Assert deep structural equality."},{label:"include",kind:"method",signature:"include(expected: unknown): void",documentation:"Assert that a string or array contains the expected value."},{label:"match",kind:"method",signature:"match(pattern: RegExp): void",documentation:"Assert that a string matches a regular expression."},{label:"have",kind:"property",documentation:"Property assertions."},{label:"be",kind:"property",documentation:"Boolean, range, and membership assertions."}],"flex.expect.to.have":[{label:"property",kind:"method",signature:"property(name: string, expected?: unknown): void",documentation:"Assert that an object has a property, optionally with an expected value."}],"flex.expect.to.be":[{label:"above",kind:"method",signature:"above(expected: number): void",documentation:"Assert that a number is greater than expected."},{label:"below",kind:"method",signature:"below(expected: number): void",documentation:"Assert that a number is less than expected."},{label:"oneOf",kind:"method",signature:"oneOf(expected: unknown[]): void",documentation:"Assert deep equality with one value from a list."},{label:"ok",kind:"property",signature:"ok: true",documentation:"Assert that the value is truthy."},{label:"true",kind:"property",signature:"true: true",documentation:"Assert that the value is exactly true."},{label:"false",kind:"property",signature:"false: true",documentation:"Assert that the value is exactly false."}],console:[{label:"log",kind:"method",signature:"log(...values: unknown[]): void",documentation:"Write a line to the API Client script console."},{label:"info",kind:"method",signature:"info(...values: unknown[]): void",documentation:"Write an informational line to the API Client script console."},{label:"warn",kind:"method",signature:"warn(...values: unknown[]): void",documentation:"Write a warning line to the API Client script console."},{label:"error",kind:"method",signature:"error(...values: unknown[]): void",documentation:"Write an error line to the API Client script console."}]};function Pv(t,e){return[...PO[t]||[]].filter(n=>e==="tests"||!n.testsOnly).map(n=>({...n}))}function YO(t,e,n={}){const r=e.toLowerCase();return[...new Set(n[t]||[])].filter(Boolean).filter(s=>s.toLowerCase().startsWith(r)).sort((s,a)=>s.localeCompare(a)).map(s=>({label:s,kind:"variable",signature:s,documentation:`Known ${t==="variables"?"effective":t} variable.`}))}const KO=[{label:"flex",kind:"namespace",documentation:"FlexDoc request, response, variables, assertions, and test scripting API."},{label:"console",kind:"namespace",documentation:"Captured script console with log, info, warn, and error methods."}];function GO(t){const e=t.lastIndexOf("flex.expect(");if(e<0)return null;const n=t.slice(e),r=[[/\.to\.have\.([A-Za-z_$][\w$]*)?$/,"flex.expect.to.have"],[/\.to\.be\.([A-Za-z_$][\w$]*)?$/,"flex.expect.to.be"],[/\.to\.([A-Za-z_$][\w$]*)?$/,"flex.expect.to"]];for(const[s,a]of r){const c=n.match(s);if(c)return{path:a,prefix:c[1]||""}}return null}function XO(t){const e=t.match(/flex\.(environment|collection|variables)\.(?:get|has|set|unset)\(\s*['"]([^'"]*)$/);return e?{scope:e[1],prefix:e[2]||""}:null}function JO(t){const e=t.match(/(?:^|[^\w$])((?:flex|console)(?:\.[A-Za-z_$][\w$]*)*)\.([A-Za-z_$][\w$]*)?$/);return e?{path:e[1],prefix:e[2]||""}:null}function QO(t,e,n,r={},s=!1){const a=Math.max(0,Math.min(e,t.length)),c=t.slice(0,a),u=XO(c);if(u){const v=YO(u.scope,u.prefix,r);return v.length>0?{from:a-u.prefix.length,to:a,items:v}:null}const f=GO(c);if(f){const v=Pv(f.path,n).filter(w=>w.label.toLowerCase().startsWith(f.prefix.toLowerCase()));return v.length>0?{from:a-f.prefix.length,to:a,items:v}:null}const h=JO(c);if(h){const v=Pv(h.path,n).filter(w=>w.label.toLowerCase().startsWith(h.prefix.toLowerCase()));return v.length>0?{from:a-h.prefix.length,to:a,items:v}:null}const g=c.match(/([A-Za-z_$][\w$]*)$/)?.[1]||"";if(!s&&!g)return null;const b=KO.filter(v=>!g||v.label.startsWith(g));return!s&&b.length===0?null:b.length>0?{from:a-g.length,to:a,items:b.map(v=>({...v}))}:null}const Yv=({ariaLabel:t,value:e,onChange:n,phase:r,theme:s="light",variableKeys:a={}})=>{const c=I.useRef(null),u=I.useRef(null),f=I.useRef([]),[h,g]=I.useState(null),[b,v]=I.useState(0),[w,A]=I.useState({left:12,top:36}),C=I.useMemo(()=>`api-client-script-completions-${t.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,[t]),j=I.useMemo(()=>zO(e),[e]),D=s==="dark",M=B=>{const K=u.current,W=c.current;if(!K||!W)return;const ye=K.coordsAtPos(B);if(!ye)return;const pe=W.getBoundingClientRect(),fe=ye.left-pe.left,L=Math.max(8,pe.width-430),Q=ye.bottom-pe.top+2,oe=Math.max(8,pe.height-96);A({left:Math.max(8,Math.min(fe,L)),top:Math.max(8,Math.min(Q,oe))})},E=(B,K,W=!1)=>{const ye=QO(B,K,r,a,W);g(ye),v(0),ye&&requestAnimationFrame(()=>M(K))},R=B=>{if(!h)return;const K=`${e.slice(0,h.from)}${B.label}${e.slice(h.to)}`,W=h.from+B.label.length;n(K),g(null),requestAnimationFrame(()=>{u.current?.setSelection(W)})},_=()=>{if(!j.valid)return;const B=u.current?.getSelection()??{from:e.length,to:e.length},K=FO(e,B.from,B.to);K.value!==e&&n(K.value),g(null),requestAnimationFrame(()=>{u.current?.setSelection(K.selectionStart,K.selectionEnd)})};I.useEffect(()=>{f.current[b]?.scrollIntoView({block:"nearest"})},[b]);const q=B=>{const K=u.current?.getSelection().from??e.length;if((B.ctrlKey||B.metaKey)&&B.code==="Space"){B.preventDefault(),E(e,K,!0);return}if(B.shiftKey&&B.altKey&&B.code==="KeyF"){B.preventDefault(),_();return}if(!(!h||h.items.length===0)){if(B.key==="ArrowDown"){B.preventDefault(),v(W=>(W+1)%h.items.length);return}if(B.key==="ArrowUp"){B.preventDefault(),v(W=>(W-1+h.items.length)%h.items.length);return}if(B.key==="Enter"||B.key==="Tab"){B.preventDefault(),R(h.items[b]);return}B.key==="Escape"&&(B.preventDefault(),g(null))}},O=h?.items[b],X=!!h&&h.items.length>0,U=D?"border-gray-700 bg-gray-900 text-gray-100 shadow-2xl":"border-gray-200 bg-white text-gray-900 shadow-2xl";return p.jsxs("div",{ref:c,className:"relative min-w-0",onBlur:B=>{B.currentTarget.contains(B.relatedTarget)||g(null)},children:[p.jsxs("div",{className:"mb-1 flex flex-wrap items-center justify-between gap-2",children:[p.jsxs("span",{role:j.valid?"status":"alert",className:`inline-flex items-center gap-1 text-[11px] ${j.valid?D?"text-emerald-300":"text-emerald-700":D?"text-amber-300":"text-amber-700"}`,children:[j.valid?p.jsx(la,{className:"h-3.5 w-3.5"}):p.jsx(Ed,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"max-w-[24rem] truncate",children:j.message})]}),p.jsxs("button",{type:"button",className:"inline-flex min-h-9 items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs disabled:cursor-not-allowed disabled:opacity-50",disabled:!j.valid||!e.trim(),onMouseDown:B=>B.preventDefault(),onClick:_,"aria-label":"Format current script",children:[p.jsx(tk,{className:"h-3.5 w-3.5"}),"Format"]})]}),p.jsx($a,{ref:u,ariaActiveDescendant:X?`${C}-${b}`:void 0,ariaAutocomplete:"list",ariaControls:X?C:void 0,ariaExpanded:X,ariaLabel:t,autoIndent:!0,dataTestId:`${t}-editor`,language:"javascript",onChange:B=>{const K=u.current?.getSelection().from??B.length;n(B),requestAnimationFrame(()=>{const W=u.current?.getSelection().from??K;E(B,W)})},onCursorChange:B=>{h&&M(B)},onEditorKeyDown:q,theme:s,value:e,wrap:!0}),X&&p.jsxs("div",{className:`absolute z-[70] w-[min(26rem,calc(100%-1rem))] overflow-hidden rounded-md border ${U}`,"data-testid":`${t}-completion-popup`,style:{left:w.left,top:w.top},children:[p.jsx("div",{id:C,role:"listbox","aria-label":"Script suggestions",className:"max-h-56 overflow-y-auto py-1",children:h.items.map((B,K)=>p.jsxs("button",{ref:W=>{f.current[K]=W},"aria-label":B.label,"aria-selected":K===b,className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-xs ${K===b?D?"bg-blue-700 text-white":"bg-blue-50 text-gray-900":D?"hover:bg-gray-800":"hover:bg-gray-50"}`,id:`${C}-${K}`,onMouseEnter:()=>v(K),onMouseDown:W=>{W.preventDefault(),R(B)},role:"option",type:"button",children:[p.jsx("span",{"aria-hidden":"true",className:"shrink-0 rounded bg-black/5 px-1 font-mono text-[10px] uppercase opacity-60 dark:bg-white/10",children:B.kind}),p.jsx("span",{className:"font-mono font-semibold",children:B.label}),p.jsx("span",{"aria-hidden":"true",className:`min-w-0 truncate ${K===b&&D?"text-blue-100":D?"text-gray-400":"text-gray-500"}`,children:B.signature||""})]},`${B.kind}-${B.label}`))}),O&&p.jsxs("div",{className:`border-t px-3 py-2 text-[11px] ${D?"border-gray-700 text-gray-300":"border-gray-200 text-gray-600"}`,children:[O.signature&&p.jsx("div",{className:"mb-1 overflow-x-auto whitespace-nowrap font-mono text-xs",children:O.signature}),p.jsx("div",{children:O.documentation})]})]}),p.jsxs("div",{className:`mt-1 flex flex-wrap gap-x-3 text-[11px] ${D?"text-gray-400":"text-gray-500"}`,children:[p.jsxs("span",{children:[p.jsx("code",{children:"flex."})," or Ctrl+Space"]}),p.jsx("span",{children:"Enter keeps indentation"}),p.jsx("span",{children:"↑/↓ choose"}),p.jsx("span",{children:"Enter/Tab complete"}),p.jsx("span",{children:"Shift+Alt+F format"})]})]})},Kv=new Set,Yc="API-host execute route",Kc="the execute path";function Gc(t,e){return`${Yc} diagnostic ${t}. Check ${e}.`}function WO(t,e){return t===401?Gc("was unauthorized",`documentation authentication for ${Kc}`):t===403?Gc("was rejected",`CSRF, same-origin, and authorization middleware for ${Kc}`):t===404||t===501||t===405&&(!e||!/\bPOST\b/i.test(e))?`${Yc} is not available at the configured endpoint. Deploy the FlexDoc execute route or update the API-host URL.`:t===400?`${Yc} returned HTTP 400 before FlexDoc validated the diagnostic probe. Check CSRF and request-body middleware for ${Kc}.`:Gc(`returned HTTP ${t}`,"authentication, CSRF, and middleware configuration")}async function ZO(t,e=globalThis.fetch,n){const r=t.trim();if(!r||!e||n?.aborted)return null;const s=e===globalThis.fetch;if(s&&Kv.has(r))return null;try{const a=await e(r,{method:"POST",credentials:"same-origin",headers:{"X-FlexDoc-Execute":"1","Content-Type":"application/json"},body:"{}",signal:n});if(n?.aborted)return null;const c=await a.text();let u="";try{const h=c?JSON.parse(c):{};typeof h.error=="string"&&(u=h.error)}catch{}return a.status===429||a.status===400&&/host execution/i.test(u)?(s&&Kv.add(r),null):a.redirected?Gc("was redirected",`authentication middleware for ${Kc}`):a.ok?`${Yc} accepted the deliberately invalid diagnostic request. Verify that the configured endpoint is FlexDoc's hardened execute route.`:WO(a.status,a.headers.get("Allow"))}catch{return null}}function e3(t){let e=t.url;for(const[n,r]of Object.entries(t.variables||{}))e=e.split(`{${n}}`).join(r.default);return e}function Gh(t){return t.replace(/\/+$/,"")}function Gv(t,e){const n=Gh(e);return n?t===n||t.startsWith(`${n}/`)||t.startsWith(`${n}?`):!1}function t3(t,e,n){const r=Gh(n);if(!r)return t;const s=Gh(e);if(s&&Gv(t,s))return`${r}${t.slice(s.length)}`;try{const a=new URL(t),c=`${a.pathname==="/"?"":a.pathname}${a.search}${a.hash}`;return`${r}${c}`}catch{return r}}const n3=()=>({key:"",value:"",enabled:!0});function i3(t){return{method:t?.method||"GET",url:t?.url||"",query:t?.query?.map(e=>({...e}))||[],headers:t?.headers?.map(e=>({...e}))||[],body:t?.body||"",contentType:t?.contentType||"application/json",bodyMode:t?.bodyMode||da(t||{}),urlencoded:t?.urlencoded?.length?t.urlencoded.map(e=>({...e})):void 0,formData:t?.formData?.length?t.formData.map(e=>({...e})):void 0,binary:t?.binary?{...t.binary}:void 0,graphql:t?.graphql?{...t.graphql}:void 0,auth:t?.auth||{type:"none"},hostExecution:t?.hostExecution?{...t.hostExecution}:void 0}}function r3(t){const e=t.auth?t.auth.type==="oauth2"?{...t.auth,scopes:t.auth.scopes?[...t.auth.scopes]:void 0}:{...t.auth}:void 0;return{...t,query:t.query?.map(n=>({...n})),headers:t.headers?.map(n=>({...n})),urlencoded:t.urlencoded?.map(n=>({...n})),formData:t.formData?.map(n=>({...n})),binary:t.binary?{...t.binary}:void 0,graphql:t.graphql?{...t.graphql}:void 0,auth:e,hostExecution:t.hostExecution?{...t.hostExecution}:void 0}}function s3(t){try{return new URL(t).origin}catch{return""}}function l3(t,e){if(t==="query"){const n=e.trim().replace(/^\?/,"").replace(/\r?\n/g,"&");return n?[...new URLSearchParams(n).entries()].map(([r,s])=>({key:r,value:s,enabled:!0})):[]}return e.split(/\r?\n/).map(n=>n.trim()).filter(Boolean).flatMap(n=>{const r=n.indexOf(":");return r<=0?[]:[{key:n.slice(0,r).trim(),value:n.slice(r+1).trim(),enabled:!0}]})}function Xv({kind:t,label:e,entries:n,onChange:r,inputClass:s,mutedClass:a}){const[c,u]=I.useState(""),f=(g,b)=>r(n.map((v,w)=>w===g?{...v,...b}:v)),h=()=>{const g=l3(t,c);g.length&&(r(g),u(""))};return p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[p.jsx("span",{className:"text-sm font-medium",children:e}),p.jsxs("button",{type:"button",className:"inline-flex min-h-11 items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm",onClick:()=>r([...n,n3()]),children:[p.jsx(Cs,{className:"h-4 w-4"})," Add"]})]}),n.length===0&&p.jsxs("div",{className:`rounded-md border border-dashed p-3 text-sm ${a}`,children:["No ",t==="query"?"query parameters":"headers"," configured."]}),n.map((g,b)=>p.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)_auto]",children:[p.jsx("input",{className:"mt-3","aria-label":`${e} ${b+1} enabled`,type:"checkbox",checked:g.enabled!==!1,onChange:v=>f(b,{enabled:v.target.checked})}),p.jsx("input",{"aria-label":`${e} ${b+1} key`,className:`min-w-0 w-full rounded-md border px-3 py-2 text-sm ${s}`,placeholder:"Key",value:g.key,onChange:v=>f(b,{key:v.target.value})}),p.jsx("input",{"aria-label":`${e} ${b+1} value`,className:`col-start-2 min-w-0 w-full rounded-md border px-3 py-2 text-sm sm:col-start-auto ${s}`,placeholder:"Value",value:g.value,onChange:v=>f(b,{value:v.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove ${e.toLowerCase()} ${b+1}`,className:"col-start-3 row-start-1 inline-flex min-h-11 items-center justify-center rounded-md border px-3 py-2 sm:col-start-auto sm:row-start-auto",onClick:()=>r(n.filter((v,w)=>w!==b)),children:p.jsx(ci,{className:"h-4 w-4"})})]},b)),p.jsxs("details",{className:"rounded-md border p-3",children:[p.jsx("summary",{className:"cursor-pointer text-xs font-medium",children:"Bulk edit"}),p.jsxs("div",{className:"mt-2 space-y-2",children:[p.jsx("textarea",{"aria-label":`${e} bulk editor`,className:`min-h-24 w-full rounded-md border px-3 py-2 font-mono text-xs ${s}`,placeholder:t==="query"?"a=1&b=2":`Accept: application/json
|
|
74
|
-
X-Trace: abc123`,value:c,onChange:g=>u(g.target.value)}),p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("span",{className:`text-xs ${a}`,children:t==="query"?"Paste query-string pairs; applying replaces the current rows.":"Paste raw Header: value lines; applying replaces the current rows."}),p.jsx("button",{type:"button",className:"rounded-md border px-3 py-1.5 text-xs",disabled:!c.trim(),onClick:h,children:"Apply"})]})]})]})]})}function Jv(t){return(t||[]).filter(e=>e.enabled!==!1&&e.key.trim()).length}function a3(t,e){const n=[...t.matchAll(/\{\{\s*([^{}]+?)\s*\}\}/g)].map(c=>c[1].trim()),r=[...new Set(n)],s=r.filter(c=>!Object.prototype.hasOwnProperty.call(e,c)),a=t.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(c,u)=>{const f=u.trim();return Object.prototype.hasOwnProperty.call(e,f)?e[f]:c});return{names:r,missing:s,resolved:a}}const Qv=({initialRequest:t,initialScripts:e,initialRequestTab:n="params",initialScriptTab:r,theme:s="light",density:a="advanced",messages:c,credentials:u="same-origin",requestInterceptor:f,onRequestChange:h,onDraftChange:g,onScriptsChange:b,onRequestTabChange:v,onScriptTabChange:w,onExecutionStart:A,onExecutionComplete:C,resolveAuth:j,variables:D={},collectionVariables:M={},externalVariables:E={},environmentVariables:R={},onCollectionChanges:_,onEnvironmentChanges:q,serverOptions:O=[],initialServerUrl:X,onServerUrlChange:U,hostExecution:B,credentialStorage:K,onCredentialStorageChange:W})=>{const ye=i3(t),pe=wn(e),fe=O.map(se=>({server:se,url:e3(se)})),L=fe.map(se=>se.url),Q=X||L.find(se=>Gv(ye.url,se))||"",oe=L.includes(Q)?Q:L[0]||"",ce=Q&&!L.includes(Q)?Q:"",ve=Q||oe||s3(ye.url),[T,z]=I.useState(ye),[he,ne]=I.useState(pe),[ke,qe]=I.useState(oe),[$e,Fe]=I.useState(ce),Ye=I.useRef(ve),Ie=I.useRef(ve),[ut,Rt]=I.useState(null),[Ce,Oe]=I.useState(),[G,we]=I.useState(null),[Ne,De]=I.useState(null),[Ke,st]=I.useState([]),[Et,Zn]=I.useState([]),[Nn,ht]=I.useState(!1),_n=I.useRef(null),Tn=I.useRef(h),ei=I.useRef(g),kt=I.useRef(b),x=I.useRef(null),[V,me]=I.useState(n),[ae,J]=I.useState(()=>r||(pe.tests.trim()&&!pe.preRequest.trim()?"tests":"pre-request")),k=I.useRef({}),Y=I.useRef({}),Z=I.useId().replace(/:/g,""),xe=I.useId().replace(/:/g,"");I.useEffect(()=>{Tn.current=h},[h]),I.useEffect(()=>{ei.current=g},[g]),I.useEffect(()=>{kt.current=b},[b]),I.useEffect(()=>{ei.current?.(r3(T))},[T]),I.useEffect(()=>{kt.current?.(wn(he))},[he]),I.useEffect(()=>{try{const se=j?{...T,auth:j(T.auth)}:T,Le=Y0(se,{variables:D}),tt=JSON.stringify([Le.method,Le.url,Le.headerEntries,Le.body,Le.bodyKind]);if(tt===x.current)return;x.current=tt,Tn.current?.(Le)}catch{}},[T,j,D]);const F=(T.method||"GET").toUpperCase(),ue=["GET","HEAD"].includes(F),re=s==="dark"?"bg-gray-900 border-gray-700 text-gray-100":"bg-white border-gray-300 text-gray-900",Se=`rounded-md border px-3 py-2 text-sm ${re}`,Me=s==="dark"?"border-gray-700 bg-gray-800/60 text-gray-100":"border-gray-200 bg-gray-50 text-gray-900",je=s==="dark"?"text-gray-400":"text-gray-600",_e=V==="scripts"&&a!=="advanced"?"params":V,ze=Jv(T.query),Qe=Jv(T.headers),pn=!!T.auth&&T.auth.type!=="none"&&T.auth.type!=="inherit",Un=da(T)!=="none",jn=!!(he.preRequest.trim()||he.tests.trim()),Wr=[{id:"params",label:"Params",count:ze},{id:"headers",label:"Headers",count:Qe},{id:"authorization",label:"Authorization",active:pn},{id:"body",label:"Body",active:Un},{id:"scripts",label:"Scripts",active:jn}].filter(se=>a==="advanced"||se.id!=="scripts"),yi=se=>`${Z}-request-tab-${se}`,Ee=se=>`${Z}-request-panel-${se}`,We=se=>`${xe}-script-tab-${se}`,Vt=se=>`${xe}-script-panel-${se}`,Ln=a3(T.url,D),bi=se=>{se==="scripts"&&a!=="advanced"||(me(se),v?.(se))},qn=se=>{J(se),w?.(se)},Ft=(se,Le)=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(se.key))return;se.preventDefault();const tt=Wr.filter(Va=>!Va.disabled).map(Va=>Va.id),qi=Math.max(0,tt.indexOf(Le)),ti=se.key==="Home"?tt[0]:se.key==="End"?tt[tt.length-1]:se.key==="ArrowRight"?tt[(qi+1)%tt.length]:tt[(qi-1+tt.length)%tt.length];bi(ti),k.current[ti]?.focus()},Kt=(se,Le)=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(se.key))return;se.preventDefault();const tt=["pre-request","tests"],qi=tt.indexOf(Le),ti=se.key==="Home"?tt[0]:se.key==="End"?tt[tt.length-1]:se.key==="ArrowRight"?tt[(qi+1)%tt.length]:tt[(qi-1+tt.length)%tt.length];qn(ti),Y.current[ti]?.focus()},Vn=se=>{if(!se)return;const Le=Ye.current;Ye.current=se,U?.(se),z(tt=>({...tt,url:t3(tt.url,Le,se)}))},ur=j?j(T.auth):T.auth,Bs=Uo({request:{...T,auth:ur},hostExecution:B}),[Li,za,Zr]=Bs,kl=Li==="host-required",dr=Zr?B?.available?c?.unusualBodyHostExecution||`${F} request bodies are unusual. FlexDoc will use API-host execution so the body can be sent.`:c?.unusualBodyBrowserWarning||`${F} request bodies are unusual. Browser fetch may reject this request; enable API-host execution to send it reliably.`:PC(Bs,B,c?.hostBrowserUnsupported,c?.hostExecutionDisabled),es=se=>B?.available===!0&&(B.capabilities||[]).includes(se),fr=FC(ut,{...T,auth:ur},B),hr=async()=>{if(Nn)return;const se=new AbortController;_n.current=se,A?.(),ht(!0),we(null),De(null),st([]),Zn([]),Rt(null),Oe(void 0);try{const Le=await gy({request:T,scripts:he,credentials:u,requestInterceptor:f,resolveAuth:j,variables:D,collectionVariables:M,externalVariables:E,environmentVariables:R,hostExecution:B,signal:se.signal,onRequestBuilt:ti=>Tn.current?.(ti),onCollectionChanges:_,onEnvironmentChanges:q});if(se.signal.aborted){we(c?.requestCancelled||"Request cancelled.");return}let tt=Le.error||null;if(tt&&Le.result?.transport==="api-host"&&B?.endpoint){const ti=await ZO(B.endpoint,globalThis.fetch,se.signal);if(se.signal.aborted){we(c?.requestCancelled||"Request cancelled.");return}ti&&(tt=`${tt} ${ti}`)}const qi=UC(Le,T,B);tt&&qi&&(tt=`${tt} ${qi}`),we(tt),De(Le.scriptError||null),st(Le.scriptTests),Zn(Le.scriptLogs),Le.response&&(Oe(Le.curlCommand),Rt(Le.response)),Le.result&&C?.(Le.result)}finally{_n.current===se&&(_n.current=null),ht(!1)}},Gt=()=>_n.current?.abort(),iu=Ke.filter(se=>se.passed).length,Ua=!Nn&&!(kl&&!za);return p.jsx("div",{className:`min-w-0 rounded-xl border p-4 md:p-5 ${Me}`,"data-api-client-editor":!0,onKeyDown:se=>{(se.ctrlKey||se.metaKey)&&se.key==="Enter"&&Ua&&(se.preventDefault(),hr())},children:p.jsxs("div",{className:"flex flex-col gap-4",children:[p.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[O.length>0&&p.jsxs("label",{className:"text-sm font-medium",children:["Server",p.jsx("select",{"aria-label":"API Client server",className:`mt-1 w-full rounded-md border px-3 py-2 text-sm ${re}`,value:ke,onChange:se=>{qe(se.target.value),Fe(""),Vn(se.target.value)},children:fe.map(({server:se,url:Le})=>p.jsxs("option",{value:Le,children:[se.description?`${se.description} — `:"",se.url]},`${se.url}:${Le}`))})]}),p.jsxs("label",{className:"text-sm font-medium",children:["Custom server URL ",p.jsx("span",{className:"text-xs font-normal opacity-70",children:"(optional override)"}),p.jsx("input",{"aria-label":"API Client custom server URL",className:`mt-1 w-full rounded-md border px-3 py-2 font-mono text-sm ${re}`,value:$e,onChange:se=>{const Le=se.target.value;Fe(Le);const tt=ke||Ie.current;(Le.trim()||tt)&&Vn(Le.trim()||tt)},placeholder:"http://localhost:8080"})]})]}),p.jsxs("div",{className:"grid min-w-0 gap-2 sm:grid-cols-[auto_minmax(0,1fr)]",children:[p.jsx("select",{"aria-label":"HTTP method",className:`rounded-md border px-3 py-2 font-medium ${re}`,value:F,onChange:se=>{const Le=se.target.value;z(tt=>({...tt,method:Le}))},children:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(se=>p.jsx("option",{children:se},se))}),p.jsx("input",{"aria-label":"Request URL",className:`w-full rounded-md border px-3 py-2 font-mono text-sm ${re}`,placeholder:"https://api.example.com/resource or {{baseUrl}}/resource",value:T.url,onChange:se=>{const Le=se.target.value;z(tt=>({...tt,url:Le}))}})]}),Ln.names.length>0&&p.jsx("div",{className:`rounded-md border px-3 py-2 text-xs ${Ln.missing.length?s==="dark"?"border-amber-800 bg-amber-950/40 text-amber-200":"border-amber-300 bg-amber-50 text-amber-800":s==="dark"?"border-gray-700 bg-gray-900 text-gray-300":"border-gray-200 bg-white text-gray-600"}`,children:Ln.missing.length>0?p.jsxs(p.Fragment,{children:["Missing URL variable",Ln.missing.length===1?"":"s",": ",p.jsx("strong",{children:Ln.missing.join(", ")}),"."]}):p.jsxs(p.Fragment,{children:["Resolved URL: ",p.jsx("code",{className:"break-all",children:Ln.resolved})]})}),p.jsx("div",{className:"-mx-1 overflow-x-auto px-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","data-api-client-request-tabs":!0,children:p.jsx("div",{className:`flex min-w-max gap-1 rounded-lg border p-1 ${s==="dark"?"border-gray-700 bg-gray-900/70":"border-gray-200 bg-white"}`,role:"tablist","aria-label":"Request configuration",children:Wr.map(se=>p.jsxs("button",{ref:Le=>{k.current[se.id]=Le},id:yi(se.id),type:"button",role:"tab","aria-controls":Ee(se.id),"aria-label":se.label,"aria-selected":_e===se.id,tabIndex:_e===se.id?0:-1,className:`inline-flex items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition ${_e===se.id?"bg-blue-600 text-white shadow-sm":s==="dark"?"text-gray-300 hover:bg-gray-800":"text-gray-600 hover:bg-gray-100"}`,onClick:()=>bi(se.id),onKeyDown:Le=>Ft(Le,se.id),children:[p.jsx("span",{children:se.label}),se.count!==void 0&&se.count>0&&p.jsx("span",{className:`rounded-full px-1.5 text-[10px] leading-5 ${_e===se.id?"bg-white/20 text-white":s==="dark"?"bg-gray-700 text-gray-200":"bg-gray-200 text-gray-700"}`,children:se.count}),se.active&&se.count===void 0&&p.jsx("span",{"aria-label":"Configured",className:`h-1.5 w-1.5 rounded-full ${_e===se.id?"bg-white":"bg-blue-500"}`})]},se.id))})}),ue&&p.jsx("p",{className:`-mt-2 text-xs ${je}`,children:c?.unusualBodyAdvisory||`${F} request bodies are unusual and may be ignored or rejected by servers or intermediaries. FlexDoc keeps the body; API-host execution can send it when available, while browser fetch may reject it.`}),_e==="params"&&p.jsx("div",{role:"tabpanel",id:Ee("params"),"aria-labelledby":yi("params"),children:p.jsx(Xv,{kind:"query",label:"Query parameters",entries:T.query||[],onChange:se=>z(Le=>({...Le,query:se})),inputClass:re,mutedClass:je})}),_e==="headers"&&p.jsx("div",{role:"tabpanel",id:Ee("headers"),"aria-labelledby":yi("headers"),children:p.jsx(Xv,{kind:"headers",label:"Headers",entries:T.headers||[],onChange:se=>z(Le=>({...Le,headers:se})),inputClass:re,mutedClass:je})}),_e==="authorization"&&p.jsxs("div",{role:"tabpanel",id:Ee("authorization"),"aria-labelledby":yi("authorization"),className:"space-y-3",children:[p.jsx(gf,{auth:T.auth||{type:"none"},label:"",allowInherit:!!j,advanced:a==="advanced",hostExecution:B,onChange:se=>z(Le=>({...Le,auth:se})),theme:s}),W&&p.jsxs("label",{className:"block text-sm font-medium",children:["Credential storage",p.jsxs("select",{"aria-label":"Credential storage",className:Se,value:K||"remember",onChange:se=>W(se.target.value),children:[p.jsx("option",{value:"session",children:"Session only"}),p.jsx("option",{value:"remember",children:"Remember on this browser"}),p.jsx("option",{value:"never",children:"Never store"})]}),p.jsxs("span",{className:`mt-1 block text-xs font-normal ${je}`,children:["Applies to request, collection, and folder credentials. ",K==="session"?"Kept in this tab, not IndexedDB.":K==="never"?"Memory only; cleared on reload.":"Stored in this browser workspace."]})]}),a==="advanced"&&B?.available&&p.jsxs("div",{className:"grid gap-2 rounded-md border p-3 sm:grid-cols-2",children:[B.clientCertificates?.length?p.jsxs("label",{className:"text-xs font-medium",children:["Client certificate",p.jsxs("select",{"aria-label":"Client certificate",className:`mt-1 w-full rounded-md border px-2 py-1.5 ${re}`,value:T.hostExecution?.certificateId||"",onChange:se=>z(Le=>({...Le,hostExecution:{...Le.hostExecution||{},certificateId:se.target.value||void 0}})),children:[p.jsx("option",{value:"",children:"None"}),B.clientCertificates.map(se=>p.jsx("option",{value:se.id,children:se.name},se.id))]})]}):null,es("cookies")&&p.jsxs("label",{className:"inline-flex items-center gap-2 text-xs font-medium",children:[p.jsx("input",{"aria-label":"Use API host cookie jar",type:"checkbox",checked:T.hostExecution?.cookieJar==="session",onChange:se=>z(Le=>({...Le,hostExecution:{...Le.hostExecution||{},cookieJar:se.target.checked?"session":void 0}}))}),"Use API host cookie jar"]})]})]}),_e==="body"&&p.jsx("div",{role:"tabpanel",id:Ee("body"),"aria-labelledby":yi("body"),children:p.jsx(LO,{draft:T,onChange:z,theme:s})}),a==="advanced"&&_e==="scripts"&&p.jsxs("section",{role:"tabpanel",id:Ee("scripts"),"aria-labelledby":yi("scripts"),className:"min-w-0 space-y-3",children:[p.jsxs("div",{children:[p.jsx("h3",{id:"api-client-scripts-heading",className:"font-semibold",children:"Scripts"}),p.jsx("p",{className:`text-xs ${je}`,children:"Trusted local JavaScript. Editors soft-wrap, keep indentation, format only when you choose Format or Shift+Alt+F, and show lightweight syntax diagnostics."})]}),p.jsx("div",{className:`inline-flex max-w-full gap-1 rounded-lg border p-1 ${s==="dark"?"border-gray-700 bg-gray-900/70":"border-gray-200 bg-white"}`,role:"tablist","aria-label":"Script phase",children:["pre-request","tests"].map(se=>p.jsxs("button",{ref:Le=>{Y.current[se]=Le},id:We(se),type:"button",role:"tab","aria-controls":Vt(se),"aria-selected":ae===se,tabIndex:ae===se?0:-1,className:`rounded-md px-3 py-1.5 text-sm ${ae===se?"bg-blue-600 text-white":""}`,onClick:()=>qn(se),onKeyDown:Le=>Kt(Le,se),children:[se==="pre-request"?"Pre-request":"Tests",(se==="pre-request"?he.preRequest:he.tests).trim()&&p.jsx("span",{"aria-label":"Configured",className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full ${ae===se?"bg-white":"bg-blue-500"}`})]},se))}),ae==="pre-request"?p.jsx("div",{role:"tabpanel",id:Vt("pre-request"),"aria-labelledby":We("pre-request"),className:"min-w-0",children:p.jsx(Yv,{ariaLabel:"Pre-request script",phase:"pre-request",theme:s,value:he.preRequest,onChange:se=>ne(Le=>({...Le,preRequest:se})),variableKeys:{environment:Object.keys(R),collection:Object.keys(M),variables:Object.keys(D)}})}):p.jsx("div",{role:"tabpanel",id:Vt("tests"),"aria-labelledby":We("tests"),className:"min-w-0",children:p.jsx(Yv,{ariaLabel:"Tests script",phase:"tests",theme:s,value:he.tests,onChange:se=>ne(Le=>({...Le,tests:se})),variableKeys:{environment:Object.keys(R),collection:Object.keys(M),variables:Object.keys(D)}})})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[p.jsx("span",{"aria-label":"Request transport",className:`rounded border px-2 py-1 ${je}`,children:zC(Li)}),B?.available&&p.jsxs("label",{className:`inline-flex items-center gap-2 ${je}`,children:["Transport preference",p.jsxs("select",{"aria-label":"Transport preference",disabled:kl,className:`rounded-md border px-2 py-1 ${re}`,value:T.hostExecution?.preferHostExecution===void 0?"inherit":T.hostExecution.preferHostExecution?"host":"browser",onChange:({target:{value:se}})=>z(Le=>({...Le,hostExecution:{...Le.hostExecution||{},preferHostExecution:se==="inherit"?void 0:se==="host"}})),children:[p.jsx("option",{value:"inherit",children:"Server default"}),p.jsx("option",{value:"browser",children:"Prefer browser"}),p.jsx("option",{value:"host",children:"Prefer API host"})]})]})]}),(fr||dr||B?.available)&&p.jsx(mf,{message:fr||dr||"FlexDoc API host is available.",capabilities:B?.capabilities,warning:!!fr||!za&&!Zr,theme:s,label:c?.hostExecutionStatus||"Host execution status"}),Nn?p.jsxs("button",{type:"button",onClick:Gt,className:"inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-md border border-red-500 px-4 py-2 font-medium text-red-600 sm:w-auto",children:[p.jsx(Hg,{className:"h-4 w-4"}),c?.cancelRequest||"Cancel request"]}):p.jsxs("button",{type:"button","data-api-client-send":"true",onClick:()=>{hr()},disabled:!Ua,"aria-keyshortcuts":"Control+Enter Meta+Enter",title:`${c?.sendRequest||"Send request"} (Ctrl/Cmd+Enter)`,className:"inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 font-medium text-white hover:bg-blue-700 disabled:opacity-60 sm:w-auto",children:[p.jsx(aa,{className:"h-4 w-4"})," ",c?.sendRequest||"Send request"," ",p.jsx("span",{className:"text-xs font-normal opacity-80",children:"Ctrl/Cmd+Enter"})]}),G&&p.jsxs("div",{role:"alert",className:`flex gap-2 rounded-md border p-3 text-sm ${s==="dark"?"border-red-800 bg-red-950/40 text-red-200":"border-red-300 bg-red-50 text-red-700"}`,children:[p.jsx(Ad,{className:"mt-0.5 h-4 w-4 shrink-0"}),G]}),Ne&&p.jsxs("div",{role:"alert",className:`flex gap-2 rounded-md border p-3 text-sm ${s==="dark"?"border-amber-800 bg-amber-950/40 text-amber-200":"border-amber-300 bg-amber-50 text-amber-800"}`,children:[p.jsx(Ad,{className:"mt-0.5 h-4 w-4 shrink-0"}),Ne]}),ut&&p.jsx(HO,{response:ut,theme:s,curlCommand:Ce,advanced:a==="advanced"}),Ke.length>0&&p.jsxs("section",{className:"space-y-2","aria-labelledby":"api-client-test-results-heading",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h3",{id:"api-client-test-results-heading",className:"font-semibold",children:"Test results"}),p.jsxs("span",{className:`text-xs ${je}`,children:[iu,"/",Ke.length," passed"]})]}),p.jsx("div",{className:"space-y-2",children:Ke.map((se,Le)=>p.jsxs("div",{className:`rounded-md border px-3 py-2 text-sm ${se.passed?s==="dark"?"border-green-800 bg-green-950/40 text-green-200":"border-green-300 bg-green-50 text-green-800":s==="dark"?"border-red-800 bg-red-950/40 text-red-200":"border-red-300 bg-red-50 text-red-800"}`,children:[p.jsxs("div",{className:"font-medium",children:[se.passed?"PASS":"FAIL"," — ",se.name]}),se.error&&p.jsx("div",{className:"mt-1 text-xs",children:se.error})]},`${se.name}:${Le}`))})]}),Et.length>0&&p.jsx(_r,{code:Et.join(`
|
|
75
|
-
`),language:"text",title:"Script console",theme:s,wrap:!0})]})})};function Xh(t,e){if(typeof window>"u")return;const n=new URL(window.location.href);e?n.searchParams.set(t,e):n.searchParams.delete(t),window.history.replaceState(null,"",`${n.pathname}${n.search}${n.hash}`)}function o3(t,e){return t==="scripts"||e?"advanced":typeof window>"u"?"basic":new URLSearchParams(window.location.search).get("density")==="advanced"?"advanced":"basic"}function Wv(t,e){return JSON.stringify({request:t,scripts:e},(n,r)=>typeof File<"u"&&r instanceof File?{name:r.name,size:r.size,type:r.type,lastModified:r.lastModified}:r)}const c3=({spec:t,path:e,method:n,theme:r,options:s,initialRequestTab:a,initialScriptTab:c,onRequestChange:u,onOpenInApiClient:f})=>{const h=t.paths[e],b=h?.[n.toLowerCase()]?.servers||h?.servers||t.servers||[],v=s?.tryIt?.apiClientPersistenceKey??ry(t.info?.title,typeof window>"u"?void 0:window.location.host),w=I.useMemo(()=>{const ne={..._0(t,e,n),serverUrl:s?.tryIt?.defaultServer};return aC(t,e,n,ne,s?.tryIt?.defaultServer)},[n,s?.tryIt?.defaultServer,e,t]),A=I.useMemo(()=>wn(),[]),[C,j]=I.useState(()=>o3(a,c)),[D,M]=I.useState(w.request),[E,R]=I.useState(w.serverUrl),[_,q]=I.useState(A),[O,X]=I.useState(a||"params"),[U,B]=I.useState(c||"pre-request"),[K,W]=I.useState(()=>nl()),[ye,pe]=I.useState(v===!1),fe=s?.messages;I.useEffect(()=>{if(v===!1)return;let ne=!1;return dy(v).then(ke=>{ne||(W(ke),pe(!0))}).catch(()=>{ne||pe(!0)}),()=>{ne=!0}},[v]);const L=hy(v,K,ye),Q=I.useMemo(()=>ff(K),[K]),oe=Wv(D,_)!==Wv(w.request,A),ce=C==="advanced",ve=r==="dark"?"border-gray-700 bg-gray-900/40 text-gray-100":"border-gray-200 bg-white text-gray-900",T=r==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",z=ne=>{j(ne),Xh("density",ne==="advanced"?"advanced":void 0)},he=()=>f?.({request:D,scripts:wn(_),serverUrl:E,requestTab:O,scriptTab:U});return p.jsxs("div",{className:"space-y-3","data-try-it-session":!0,children:[L&&p.jsx(mf,{message:"FlexDoc could not save environment changes to browser storage. They will be lost when the page is closed.",showCapabilities:!1,warning:!0,theme:r,label:"API Client storage status"}),p.jsxs("div",{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border p-2 ${ve}`,children:[p.jsxs("div",{className:"flex rounded-md border p-1",role:"group","aria-label":"Try It density",children:[p.jsx("button",{type:"button","aria-pressed":!ce,className:`rounded px-3 py-1.5 text-sm ${ce?"":"bg-blue-600 text-white"}`,onClick:()=>z("basic"),children:fe?.tryItBasic||"Basic"}),p.jsx("button",{type:"button","aria-pressed":ce,className:`rounded px-3 py-1.5 text-sm ${ce?"bg-blue-600 text-white":""}`,onClick:()=>z("advanced"),children:fe?.tryItAdvanced||"Advanced"})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ce&&oe&&p.jsx("span",{"aria-label":"Unsaved Try It changes",className:"text-xs font-medium",children:fe?.unsavedChanges||"Unsaved changes"}),f&&p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-1.5 text-sm",onClick:he,children:[p.jsx(Nd,{className:"h-4 w-4"}),fe?.openApiClient||"Open in API Client"]})]})]}),ce&&p.jsx("div",{className:`rounded-lg border p-3 ${ve}`,children:p.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[p.jsx("span",{children:fe?.environment||"Environment"}),p.jsxs("select",{"aria-label":fe?.environment||"Try It environment",className:`min-w-48 rounded-md border px-2 py-1.5 text-sm ${T}`,value:K.activeEnvironmentId||"",onChange:ne=>W(ke=>({...ke,activeEnvironmentId:ne.target.value||void 0})),children:[p.jsx("option",{value:"",children:fe?.noEnvironment||"No environment"}),K.environments.map(ne=>p.jsx("option",{value:ne.id,children:ne.name},ne.id))]})]})}),p.jsx(Qv,{initialRequest:w.request,initialScripts:A,initialRequestTab:O,initialScriptTab:U,density:C,theme:r,messages:fe,credentials:s?.tryIt?.credentials||"same-origin",requestInterceptor:s?.tryIt?.requestInterceptor,hostExecution:s?.tryIt?.hostExecution,credentialStorage:K.credentialStorage||"remember",onCredentialStorageChange:ne=>W(ke=>({...ke,credentialStorage:ne})),environmentVariables:Q,serverOptions:b,initialServerUrl:w.serverUrl,onServerUrlChange:R,onRequestChange:u,onDraftChange:M,onScriptsChange:ne=>q(wn(ne)),onRequestTabChange:ne=>{X(ne),Xh("tab",ne)},onScriptTabChange:ne=>{B(ne),Xh("script",ne)},onEnvironmentChanges:ne=>W(ke=>hf(ke,ne))})]})};function Jh(t,e){const n=encodeURIComponent(t).replace(/%/g,"~");return`${e.trim().toLowerCase()}-${n}`}function u3(t,e){return`${e.trim().toLowerCase()}-${t.replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"")}`}const d3=["curl","javascript","python","go","java"];function f3(){if(typeof window>"u")return{tryIt:!1};const t=new URLSearchParams(window.location.search),e=t.get("tab"),n=t.get("script");return{tryIt:t.get("tryIt")==="1",requestTab:e&&/^(params|headers|authorization|body|scripts)$/.test(e)?e:void 0,scriptTab:n&&/^(pre-request|tests)$/.test(n)?n:void 0}}function h3(t,e){if(typeof window>"u")return;const n=new URL(window.location.href);e?n.searchParams.set(t,e):n.searchParams.delete(t),window.history.replaceState(null,"",`${n.pathname}${n.search}${n.hash}`)}const p3=({spec:t,path:e,method:n,theme:r="light",options:s={},defaultExpandedSections:a,runtimeSnapshot:c,onOpenInApiClient:u})=>{const f=f3(),h=a??tf(s.expand,s.expand===void 0?s.expandResponses:void 0),g=f.tryIt&&!h.includes("tryIt")?[...h,"tryIt"]:h,b=`${n}:${e}:${g.join("|")}`,[v,w]=I.useState(()=>({key:b,sections:new Set(g)})),A=v.key===b?v.sections:new Set(g),[C,j]=I.useState(s.codeSamples?.languages?.[0]||"curl"),[D,M]=I.useState(!1),E=I.useId().replace(/:/g,""),R=I.useRef({}),_=I.useMemo(()=>L0(t,e,n,_0(t,e,n)),[t,e,n]),[q,O]=I.useState(_),U=t.paths[e]?.[n.toLowerCase()],B=I.useMemo(()=>Ek(t,e,n),[t,e,n]),K=s.messages;if(I.useEffect(()=>{!f.tryIt||typeof document>"u"||requestAnimationFrame(()=>document.getElementById("tryIt-heading")?.scrollIntoView({block:"start"}))},[f.tryIt,n,e]),!U)return p.jsx("div",{className:"p-6",children:"Operation not found."});const W=r==="dark"?"text-gray-400":"text-gray-600",ye=r==="dark"?"border-gray-700 bg-gray-800/60":"border-gray-200 bg-white",pe=r==="dark"?"bg-gray-900 text-gray-100":"bg-white text-gray-900",fe=s.codeSamples?.languages?.length?s.codeSamples.languages:d3,L=U.security??t.security,Q={requiredPropsFirst:s.requiredPropsFirst,sortPropsAlphabetically:s.sortPropsAlphabetically},oe=r==="dark"?"bg-blue-950/60 text-blue-200":"bg-blue-100 text-blue-700",ce=r==="dark"?"bg-red-950/60 text-red-200":"bg-red-100 text-red-700",ve=r==="dark"?"bg-orange-950/60 text-orange-200":"bg-orange-100 text-orange-700",T=r==="dark"?"bg-gray-800 text-gray-200":"bg-gray-100 text-gray-700",z=Ce=>`${E}-code-tab-${Ce}`,he=`${E}-code-panel`,ne=Ce=>{const Oe=!A.has(Ce);w(G=>{const we=new Set(G.key===b?G.sections:g);return we.has(Ce)?we.delete(Ce):we.add(Ce),{key:b,sections:we}}),Ce==="tryIt"&&h3("tryIt",Oe?"1":void 0)},ke=(Ce,Oe,G)=>p.jsxs("section",{className:"mb-8","aria-labelledby":`${Oe}-heading`,children:[p.jsxs("button",{type:"button",id:`${Oe}-heading`,"aria-expanded":A.has(Oe),onClick:()=>ne(Oe),className:"mb-4 flex min-h-10 w-full items-center gap-2 text-left text-base font-semibold sm:text-lg",children:[A.has(Oe)?p.jsx(Lg,{className:"h-5 w-5 shrink-0"}):p.jsx(qg,{className:"h-5 w-5 shrink-0"}),Ce]}),A.has(Oe)&&G]}),qe=Ce=>{j(Ce),R.current[Ce]?.focus()},$e=(Ce,Oe)=>{if(!/^(ArrowLeft|ArrowRight|Home|End)$/.test(Ce.key))return;Ce.preventDefault();const G=fe.indexOf(Oe),we=Ce.key==="Home"?fe[0]:Ce.key==="End"?fe[fe.length-1]:Ce.key==="ArrowRight"?fe[(G+1)%fe.length]:fe[(G-1+fe.length)%fe.length];qe(we)},Fe=async()=>{if(typeof window>"u"||typeof navigator>"u"||!navigator.clipboard)return;const Ce=new URL(window.location.href);Ce.hash=Jh(e,n),await navigator.clipboard.writeText(Ce.toString()),M(!0),window.setTimeout(()=>M(!1),1400)},Ye=U.requestBody?$n.isReference(U.requestBody)?$n.resolveReference(t,U.requestBody.$ref):U.requestBody:void 0,Ie=Object.entries(U).filter(([Ce])=>Ce.startsWith("x-")),ut=typeof s.theme=="object"?s.theme.methodColors?.[n.toLowerCase()]:void 0,Rt=c?.routes.some(Ce=>Ce.method===n.toUpperCase()&&Ce.path===e);return p.jsx("div",{lang:s.locale,className:`min-h-full ${pe}`,children:p.jsxs("article",{className:"mx-auto w-full max-w-6xl p-4 sm:p-6 lg:p-8",children:[p.jsxs("header",{className:"mb-8",children:[p.jsxs("div",{className:"mb-4 flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",children:[p.jsx("span",{className:`shrink-0 rounded border px-2.5 py-1 text-xs font-bold sm:text-sm ${$n.getMethodColor(n,r)}`,style:{background:ut?.bg,borderColor:ut?.border},children:n.toUpperCase()}),p.jsx("code",{className:`min-w-0 max-w-full overflow-x-auto rounded px-2.5 py-1 font-mono text-sm sm:text-base ${r==="dark"?"bg-gray-800 text-blue-300":"bg-gray-100 text-gray-900"}`,children:e}),p.jsxs("button",{type:"button",className:"inline-flex min-h-9 items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs","aria-label":"Copy endpoint link",onClick:()=>{Fe()},children:[D?p.jsx(_g,{className:"h-3.5 w-3.5"}):p.jsx(YA,{className:"h-3.5 w-3.5"}),D?"Copied":"Copy link"]})]}),U.summary&&p.jsx("h1",{className:"mb-2 text-2xl font-bold tracking-tight sm:text-3xl",children:U.summary}),U.description&&p.jsx("p",{className:`max-w-3xl whitespace-pre-wrap leading-relaxed ${W}`,children:U.description}),p.jsxs("div",{className:"mt-4 flex flex-wrap gap-3 text-sm",children:[U.deprecated&&p.jsxs("span",{className:r==="dark"?"inline-flex items-center gap-1 text-orange-300":"inline-flex items-center gap-1 text-orange-600",children:[p.jsx(Ad,{className:"h-4 w-4"}),"Deprecated"]}),L?.length?p.jsxs("span",{className:r==="dark"?"inline-flex items-center gap-1 text-red-300":"inline-flex items-center gap-1 text-red-600",children:[p.jsx(XA,{className:"h-4 w-4"}),"Authentication required"]}):p.jsxs("span",{className:r==="dark"?"inline-flex items-center gap-1 text-green-300":"inline-flex items-center gap-1 text-green-600",children:[p.jsx(GA,{className:"h-4 w-4"}),"No authentication required"]}),c&&(Rt?p.jsx("span",{className:r==="dark"?"text-green-300":"text-green-600",children:"Observed at runtime"}):p.jsx("span",{className:c.discoveryComplete?r==="dark"?"text-amber-300":"text-amber-600":W,children:c.discoveryComplete?"Not found at runtime":"Not observed in partial runtime discovery"})),U.operationId&&p.jsxs("span",{className:W,children:["operationId: ",p.jsx("code",{children:U.operationId})]})]}),(s.showExtensions||s.showCommonExtensions)&&Ie.length>0&&p.jsx("div",{className:`mt-4 rounded-lg border p-3 text-xs ${ye}`,children:Ie.map(([Ce,Oe])=>p.jsxs("div",{children:[p.jsx("code",{children:Ce}),": ",typeof Oe=="string"?Oe:JSON.stringify(Oe)]},Ce))})]}),B.length>0&&ke(K?.parameters||"Parameters","parameters",p.jsx("div",{className:"space-y-3",children:B.map(Ce=>p.jsxs("div",{className:`rounded-lg border p-4 ${ye}`,children:[p.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[p.jsx("code",{className:"font-medium",children:Ce.name}),p.jsx("span",{className:`rounded px-2 py-0.5 text-xs ${oe}`,children:Ce.in}),Ce.required&&p.jsx("span",{className:`rounded px-2 py-0.5 text-xs ${ce}`,children:"required"}),Ce.deprecated&&p.jsx("span",{className:`rounded px-2 py-0.5 text-xs ${ve}`,children:"deprecated"})]}),Ce.description&&p.jsx("p",{className:`mb-3 text-sm ${W}`,children:Ce.description}),Ce.schema&&p.jsx(Lr,{spec:t,schema:Ce.schema,theme:r,required:Ce.required,...Q})]},`${Ce.in}:${Ce.name}`))})),Ye&&ke(K?.requestBody||"Request Body","requestBody",p.jsxs("div",{className:"space-y-4",children:[Ye.description&&p.jsx("p",{className:W,children:Ye.description}),Object.entries(Ye.content||{}).map(([Ce,Oe])=>p.jsxs("div",{className:`rounded-lg border p-4 ${ye}`,children:[p.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[p.jsx("code",{className:`rounded px-2 py-1 text-xs ${T}`,children:Ce}),Ye.required&&p.jsx("span",{className:`rounded px-2 py-0.5 text-xs ${ce}`,children:"required"})]}),Oe.schema&&p.jsx(Lr,{spec:t,schema:Oe.schema,theme:r,...Q}),Oe.example!==void 0&&p.jsx("div",{className:"mt-3",children:p.jsx(_r,{code:JSON.stringify(Oe.example,null,2),language:"json",title:"Example payload",theme:r,wrap:!0})})]},Ce))]})),ke(K?.responses||"Responses","responses",p.jsx("div",{className:"space-y-4",children:Object.entries(U.responses||{}).map(([Ce,Oe])=>{const G=$n.isReference(Oe)?$n.resolveReference(t,Oe.$ref):Oe;return p.jsxs("div",{className:`rounded-lg border p-4 ${ye}`,children:[p.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[p.jsx("span",{className:"rounded border px-2.5 py-1 text-sm font-bold",children:Ce}),p.jsx("span",{className:`text-sm ${W}`,children:G.description})]}),G.headers&&s.showRequestHeaders&&p.jsxs("div",{className:"mb-3 text-sm",children:[p.jsx("span",{className:"font-medium",children:"Headers:"})," ",Object.keys(G.headers).join(", ")]}),G.content&&Object.entries(G.content).map(([we,Ne])=>{const De=Ne.examples&&Object.values(Ne.examples)[s.payloadSampleIdx||0];return p.jsxs("div",{className:"mt-3",children:[p.jsx("code",{className:`rounded px-1.5 py-0.5 text-xs ${T}`,children:we}),Ne.schema&&p.jsx("div",{className:"mt-2",children:p.jsx(Lr,{spec:t,schema:Ne.schema,theme:r,...Q})}),Ne.example!==void 0&&p.jsx("div",{className:"mt-3",children:p.jsx(_r,{code:JSON.stringify(Ne.example,null,2),language:"json",title:"Example response",theme:r,wrap:!0})}),De&&p.jsx("div",{className:"mt-3",children:p.jsx(_r,{code:JSON.stringify(De.value??De,null,2),language:"json",title:"Example response",theme:r,wrap:!0})})]},we)})]},Ce)})})),s.tryIt?.enabled!==!1&&ke(K?.tryIt||"Try It","tryIt",p.jsx(c3,{spec:t,path:e,method:n,theme:r,options:s,initialRequestTab:f.requestTab,initialScriptTab:f.scriptTab,onRequestChange:O,onOpenInApiClient:u},`${n}:${e}:${s.tryIt?.defaultServer||""}`)),s.codeSamples?.enabled!==!1&&ke(K?.codeExamples||"Code Examples","codeSamples",p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"mb-3 flex max-w-full gap-1 overflow-x-auto pb-1",role:"tablist","aria-label":"Code example language",children:fe.map(Ce=>p.jsx("button",{ref:Oe=>{R.current[Ce]=Oe},id:z(Ce),type:"button",role:"tab","aria-controls":he,"aria-selected":C===Ce,tabIndex:C===Ce?0:-1,onClick:()=>qe(Ce),onKeyDown:Oe=>$e(Oe,Ce),className:`shrink-0 rounded-md px-3 py-2 text-sm ${C===Ce?"bg-blue-600 text-white":r==="dark"?"bg-gray-800 text-gray-200":"bg-gray-100 text-gray-700"}`,children:q0(Ce)},Ce))}),p.jsx("div",{role:"tabpanel",id:he,"aria-labelledby":z(C),children:p.jsx(_r,{code:Rk(q,C),language:C==="curl"?"bash":C,title:q0(C),theme:r,wrap:!!(typeof s.theme=="object"&&s.theme.typography?.code?.wrap)})})]})),U.externalDocs&&p.jsx("p",{className:"pb-4 text-sm",children:p.jsx("a",{className:"text-blue-600 underline",href:U.externalDocs.url,target:"_blank",rel:"noopener noreferrer",children:U.externalDocs.description||"External documentation"})})]})})};function m3(t){const e=t?.["x-flexdoc-priority"]??t?.["x-flexdoc-weight"];return typeof e=="number"&&Number.isFinite(e)?e:0}function g3(t,e){let n=m3(t)*1e3;return t?.["x-flexdoc-highlight"]===!0&&(n+=1e5),t?.deprecated||(n+=100),t?.summary&&(n+=40),t?.description&&(n+=20),t?.operationId&&(n+=10),Array.isArray(t?.tags)&&t.tags.length>0&&(n+=5),e.toLowerCase()==="get"?n+=3:e.toLowerCase()==="post"&&(n+=2),n}function y3(t){let e=0;const n=[];for(const[r,s]of Object.entries(t.paths))for(const a of $n.getHttpMethods(s)){const c=s[a];n.push({path:r,method:a,operation:c,score:g3(c,a),order:e++})}return n.sort((r,s)=>s.score-r.score||r.order-s.order).slice(0,6)}const b3=({spec:t,onEndpointSelect:e,theme:n="light"})=>{const r=n==="dark",s=r?"border-gray-700 bg-gray-800 text-white shadow-lg":"border-gray-200 bg-white text-gray-900 shadow-sm",a=r?"text-gray-300":"text-gray-600",c=r?"hover:border-gray-600 hover:bg-gray-700":"hover:border-blue-300 hover:bg-blue-50",u=Object.values(t.paths).reduce((g,b)=>{for(const v of $n.getHttpMethods(b))g[v]=(g[v]||0)+1,g.total+=1;return g},{total:0}),f=y3(t),h=[{icon:Bg,title:"Total endpoints",value:u.total,surface:r?"bg-blue-900":"bg-blue-100",iconClass:r?"text-blue-300":"text-blue-600"},{icon:Ig,title:"Servers",value:t.servers?.length||0,surface:r?"bg-green-900":"bg-green-100",iconClass:r?"text-green-300":"text-green-600"},{icon:zg,title:"Tags",value:t.tags?.length||0,surface:r?"bg-purple-900":"bg-purple-100",iconClass:r?"text-purple-300":"text-purple-600"},{icon:ek,title:"Security schemes",value:t.components?.securitySchemes?Object.keys(t.components.securitySchemes).length:0,surface:r?"bg-orange-900":"bg-orange-100",iconClass:r?"text-orange-300":"text-orange-600"}];return p.jsx("div",{className:`flex-1 overflow-y-auto ${r?"bg-gray-900":"bg-gray-50"}`,children:p.jsxs("div",{className:"p-4 md:p-8",children:[p.jsxs("header",{className:"mb-8",children:[p.jsxs("div",{className:"mb-4 flex items-center gap-4",children:[p.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-xl ${r?"bg-blue-700":"bg-gradient-to-br from-blue-500 to-blue-600"}`,children:p.jsx(Bg,{className:"h-6 w-6 text-white"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h1",{className:`truncate text-2xl font-bold md:text-3xl ${r?"text-white":"text-gray-900"}`,children:t.info.title}),p.jsxs("p",{className:a,children:["Version ",t.info.version]})]})]}),t.info.description&&p.jsx("p",{className:`max-w-4xl text-lg leading-relaxed ${a}`,children:t.info.description})]}),p.jsx("div",{className:"mb-8 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:h.map(({icon:g,title:b,value:v,surface:w,iconClass:A})=>p.jsx("div",{className:`rounded-xl border p-4 ${s}`,children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg ${w}`,children:p.jsx(g,{className:`h-5 w-5 ${A}`})}),p.jsxs("div",{children:[p.jsx("p",{className:`text-sm font-medium ${a}`,children:b}),p.jsx("p",{className:"text-xl font-bold",children:v})]})]})},b))}),p.jsxs("section",{className:`mb-8 rounded-xl border p-4 md:p-6 ${s}`,"aria-labelledby":"method-distribution-heading",children:[p.jsx("h2",{id:"method-distribution-heading",className:"mb-4 text-lg font-semibold md:text-xl",children:"HTTP method distribution"}),p.jsx("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4 lg:grid-cols-6",children:["get","post","put","delete","patch","options"].map(g=>p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:`mx-auto mb-2 flex items-center justify-center rounded-lg px-3 py-1.5 ${$n.getMethodColor(g,n)}`,children:p.jsx("span",{className:"text-sm font-medium",children:g.toUpperCase()})}),p.jsx("p",{className:"font-bold",children:u[g]||0})]},g))})]}),p.jsxs("section",{className:`mb-8 rounded-xl border p-4 md:p-6 ${s}`,"aria-labelledby":"endpoint-highlights-heading",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h2",{id:"endpoint-highlights-heading",className:"text-lg font-semibold md:text-xl",children:"Endpoint highlights"}),p.jsx("p",{className:`mt-1 text-xs ${a}`,children:"Prioritized by explicit FlexDoc metadata when supplied, then by documentation completeness. This is not usage analytics."})]}),p.jsxs("div",{className:"space-y-3",children:[f.map(({path:g,method:b,operation:v})=>p.jsxs("button",{type:"button",onClick:()=>e(g,b),className:`w-full rounded-lg border p-3 text-left transition-colors ${c} ${r?"border-gray-700":"border-gray-200"}`,children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:`rounded border px-2 py-1 text-xs font-bold ${$n.getMethodColor(b,n)}`,children:b.toUpperCase()}),p.jsx("code",{className:`break-all font-mono text-sm ${r?"text-blue-300":"text-blue-600"}`,children:g})]}),v?.summary&&p.jsx("p",{className:`ml-14 mt-2 text-sm ${a}`,children:v.summary})]},`${b}-${g}`)),f.length===0&&p.jsx("p",{className:`py-4 text-sm ${a}`,children:"No operations are defined in this specification."})]})]}),p.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(t.info.contact||t.info.license)&&p.jsxs("section",{className:`rounded-xl border p-4 md:p-6 ${s}`,"aria-labelledby":"api-information-heading",children:[p.jsx("h2",{id:"api-information-heading",className:"mb-4 text-lg font-semibold md:text-xl",children:"Information"}),p.jsxs("div",{className:"space-y-4",children:[t.info.contact&&p.jsxs("div",{children:[p.jsx("h3",{className:"mb-2 font-medium",children:"Contact"}),t.info.contact.name&&p.jsx("p",{className:`text-sm ${a}`,children:t.info.contact.name}),t.info.contact.email&&p.jsx("a",{className:`block text-sm underline ${r?"text-blue-300":"text-blue-600"}`,href:`mailto:${t.info.contact.email}`,children:t.info.contact.email}),t.info.contact.url&&p.jsxs("a",{href:t.info.contact.url,target:"_blank",rel:"noopener noreferrer",className:`inline-flex items-center gap-1 text-sm ${r?"text-blue-300":"text-blue-600"}`,children:["Website ",p.jsx(Nd,{className:"h-3 w-3"})]})]}),t.info.license&&p.jsxs("div",{children:[p.jsx("h3",{className:"mb-2 font-medium",children:"License"}),t.info.license.url?p.jsxs("a",{href:t.info.license.url,target:"_blank",rel:"noopener noreferrer",className:`inline-flex items-center gap-1 text-sm ${r?"text-blue-300":"text-blue-600"}`,children:[t.info.license.name,p.jsx(Nd,{className:"h-3 w-3"})]}):p.jsx("p",{className:`text-sm ${a}`,children:t.info.license.name})]})]})]}),t.servers&&t.servers.length>0&&p.jsxs("section",{className:`rounded-xl border p-4 md:p-6 ${s}`,"aria-labelledby":"api-servers-heading",children:[p.jsx("h2",{id:"api-servers-heading",className:"mb-4 text-lg font-semibold md:text-xl",children:"Servers"}),p.jsx("div",{className:"space-y-3",children:t.servers.map((g,b)=>p.jsxs("div",{className:`rounded-lg p-3 ${r?"bg-gray-700/50":"bg-gray-50"}`,children:[p.jsx("code",{className:`break-all font-mono text-sm ${r?"text-blue-300":"text-blue-600"}`,children:g.url}),g.description&&p.jsx("p",{className:`mt-1 text-sm ${a}`,children:g.description})]},`${g.url}:${b}`))})]})]})]})})};var Zv={commit:"unknown"};const x3=typeof Zv>"u"?{commit:"unknown"}:Zv,v3=({footerClasses:t,footer:e})=>{const n=e?.copyright,r=e?.link||[],s=x3,a=e?.showBuildInfo!==!1&&s.commit!=="unknown";return p.jsx("footer",{className:`${t} w-full border-t`,children:p.jsxs("div",{className:"mx-auto flex min-h-12 w-full max-w-[1600px] flex-col gap-2 px-4 py-3 text-xs sm:flex-row sm:items-center sm:justify-between sm:px-6 sm:text-sm",children:[p.jsxs("p",{children:[n||p.jsxs(p.Fragment,{children:["Powered by ",p.jsx("a",{href:"https://flexdoc.prauga.com",target:"_blank",rel:"noopener noreferrer",className:"font-semibold hover:opacity-80 transition-opacity",children:"FlexDoc"})]}),a]}),r.length>0&&p.jsx("nav",{"aria-label":"Footer links",className:"flex flex-wrap gap-x-4 gap-y-2",children:r.map(c=>p.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:c.text},`${c.text}:${c.url}`))})]})})},w3=(t,e,n)=>t==="dark"?n:e,S3="Runtime intelligence returned an invalid snapshot.",A3=new Set(["runtime.operation-undocumented","runtime.operation-unobserved","runtime.method-mismatch","runtime.duplicate-operation"]),k3=new Set(["error","warning","info"]),C3=new Set(["pass","warn","fail","partial"]);function sn(){throw new Error(S3)}function Qi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zn(t,e){const n=t[e];return(typeof n!="string"||n.trim()==="")&&sn(),n}function Qh(t,e){const n=t[e];if(n!==void 0)return(typeof n!="string"||n.trim()==="")&&sn(),n}function e1(t,e){const n=t[e];if(n!==void 0){if(typeof n=="string"&&n.trim()!=="")return n;if(Array.isArray(n)&&n.length>0&&n.every(r=>typeof r=="string"&&r.trim()!==""))return[...n];sn()}}function cr(t,e){const n=t[e];return(typeof n!="number"||!Number.isInteger(n)||n<0)&&sn(),n}function N3(t){return Qi(t)||sn(),{method:zn(t,"method"),path:zn(t,"path")}}function Wh(t){return Array.isArray(t)||sn(),t.map(N3)}function T3(t){(!Qi(t)||!Qi(t.location))&&sn();const e=zn(t,"code"),n=zn(t,"severity");(!A3.has(e)||!k3.has(n)||t.location.kind!=="operation")&&sn();const r={id:zn(t,"id"),code:e,severity:n,location:{kind:"operation",path:zn(t.location,"path")},message:zn(t,"message")},s=Qh(t.location,"method");s&&(r.location.method=s);const a=e1(t,"expected");a!==void 0&&(r.expected=a);const c=e1(t,"observed");return c!==void 0&&(r.observed=c),r}function j3(t){(!Qi(t)||!Qi(t.summary)||!Array.isArray(t.findings)||typeof t.complete!="boolean")&&sn();const e=zn(t,"status");C3.has(e)||sn();const n=t.findings.map(T3),r={total:cr(t.summary,"total"),errors:cr(t.summary,"errors"),warnings:cr(t.summary,"warnings"),info:cr(t.summary,"info")},s={total:n.length,errors:n.filter(c=>c.severity==="error").length,warnings:n.filter(c=>c.severity==="warning").length,info:n.filter(c=>c.severity==="info").length};JSON.stringify(r)!==JSON.stringify(s)&&sn();const a=r.errors>0?"fail":r.warnings>0?"warn":t.complete?"pass":"partial";return e!==a&&sn(),{status:e,complete:t.complete,findings:n,summary:r}}function E3(t){Qi(t)||sn(),(!Qi(t.runtime)||!Qi(t.summary))&&sn(),typeof t.discoveryComplete!="boolean"&&sn();const e={name:zn(t.runtime,"name"),version:zn(t.runtime,"version"),platform:zn(t.runtime,"platform"),arch:zn(t.runtime,"arch")},n={documented:cr(t.summary,"documented"),runtime:cr(t.summary,"runtime"),matched:cr(t.summary,"matched"),runtimeOnly:cr(t.summary,"runtimeOnly"),documentedOnly:cr(t.summary,"documentedOnly")},r={framework:zn(t,"framework"),runtime:e,discoveryComplete:t.discoveryComplete,routes:Wh(t.routes),runtimeOnly:Wh(t.runtimeOnly),documentedOnly:Wh(t.documentedOnly),summary:n},s=Qh(t,"frameworkVersion");s&&(r.frameworkVersion=s);const a=Qh(t,"serverOrigin");if(a&&(r.serverOrigin=a),t.server!==void 0){Qi(t.server)||sn();const c=t.server.localPort;c!==void 0&&(typeof c!="number"||!Number.isInteger(c)||c<=0||c>65535)&&sn(),r.server=c===void 0?{}:{localPort:c}}return t.environment!==void 0&&(Qi(t.environment)||sn(),r.environment={name:zn(t.environment,"name")}),t.validation!==void 0&&(r.validation=j3(t.validation)),r}const O3=60;function M3(t,e,n=O3){const r=Math.max(0,Math.min(Math.max(0,e-20),Math.max(0,t-n)));return{start:r,end:Math.min(t,r+n)}}const Zh=44;function R3(t){return Array.from(t.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'))}const D3=({spec:t,theme:e,onEndpointSelect:n,onHome:r,onOpenSettings:s,onOpenApiClient:a,onOpenRuntime:c,onSendCurrent:u,messages:f})=>{const[h,g]=I.useState(!1),[b,v]=I.useState(""),[w,A]=I.useState(0),C=I.useRef(null),j=I.useRef(null),D=I.useRef([]),M=h&&typeof document<"u"&&Array.from(document.querySelectorAll('[data-api-client-send="true"]')).some(ye=>!ye.closest(".hidden")),E=I.useMemo(()=>{const ye=[{id:"overview",label:f?.openOverview||"Open Overview",action:r},{id:"api-client",label:f?.openApiClient||"Open API Client",action:a},...c?[{id:"runtime",label:f?.openRuntime||"Open Runtime Intelligence",action:c}]:[],{id:"settings",label:f?.openSettings||"Open Viewer Settings",action:s},...u&&M?[{id:"send-current",label:f?.sendCurrentRequest||"Send current request",action:u}]:[]];for(const[pe,fe]of Object.entries(t.paths))for(const L of $n.getHttpMethods(fe))ye.push({id:`operation:${L}:${pe}`,label:`${L.toUpperCase()} ${pe}`,action:()=>n(pe,L)});return ye},[M,f?.openApiClient,f?.openOverview,f?.openRuntime,f?.openSettings,f?.sendCurrentRequest,n,r,a,c,s,u,t]),R=b.trim().toLowerCase(),_=I.useMemo(()=>R?E.filter(ye=>ye.label.toLowerCase().includes(R)):E,[E,R]),{start:q,end:O}=M3(_.length,w),X=_.slice(q,O),U=I.useCallback(()=>{g(!1),v(""),A(0)},[]),B=I.useCallback(ye=>{ye&&(U(),ye.action())},[U]);if(I.useEffect(()=>{const ye=pe=>{!(pe.ctrlKey||pe.metaKey)||pe.key.toLowerCase()!=="k"||(pe.preventDefault(),g(fe=>!fe))};return document.addEventListener("keydown",ye),()=>document.removeEventListener("keydown",ye)},[]),I.useEffect(()=>{if(!h||typeof document>"u")return;const ye=document.activeElement instanceof HTMLElement?document.activeElement:null,pe=document.body.style.overflow;document.body.style.overflow="hidden",requestAnimationFrame(()=>j.current?.focus());const fe=L=>{if(L.key==="Escape"){L.preventDefault(),U();return}if(L.key==="ArrowDown"||L.key==="ArrowUp"||L.key==="Home"||L.key==="End"){L.preventDefault(),A(T=>!_.length||L.key==="Home"?0:L.key==="End"?_.length-1:L.key==="ArrowDown"?(T+1)%_.length:(T-1+_.length)%_.length);return}if(L.key==="Enter"){L.preventDefault(),B(_[w]);return}if(L.key!=="Tab"||!C.current)return;const Q=R3(C.current);if(!Q.length)return;const oe=Q[0],ce=Q[Q.length-1],ve=document.activeElement;L.shiftKey&&(ve===oe||!C.current.contains(ve))?(L.preventDefault(),ce.focus()):!L.shiftKey&&(ve===ce||!C.current.contains(ve))&&(L.preventDefault(),oe.focus())};return document.addEventListener("keydown",fe),()=>{document.body.style.overflow=pe,document.removeEventListener("keydown",fe),ye?.isConnected&&ye.focus()}},[w,B,U,h,_]),I.useEffect(()=>{D.current[w]?.scrollIntoView({block:"nearest"})},[w]),!h)return null;const K=e==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900",W=e==="dark"?"bg-blue-950/70 text-blue-100":"bg-blue-50 text-blue-900";return p.jsxs("div",{className:"fixed inset-0 z-[80]",children:[p.jsx("button",{type:"button","aria-label":f?.closeCommandPalette||"Close command palette",className:"absolute inset-0 bg-black/40",onClick:U}),p.jsxs("div",{ref:C,role:"dialog","aria-modal":"true","aria-label":f?.commandPalette||"Command palette",className:`relative mx-auto mt-[10vh] w-[min(94vw,56rem)] overflow-hidden rounded-xl border shadow-2xl ${K}`,children:[p.jsx("input",{ref:j,"aria-label":f?.searchCommands||"Search commands",className:"w-full border-b bg-transparent p-3 text-sm outline-none",placeholder:f?.searchCommandsPlaceholder||"Search operations and commands…",value:b,onChange:ye=>{v(ye.target.value),A(0)}}),p.jsxs("div",{className:"max-h-[60vh] overflow-y-auto p-2",role:"listbox","aria-label":f?.commandResults||"Command results",children:[q>0&&p.jsx("div",{"aria-hidden":"true",style:{height:q*Zh}}),X.map((ye,pe)=>{const fe=q+pe;return p.jsx("button",{ref:L=>{D.current[fe]=L},type:"button",role:"option","aria-selected":fe===w,"aria-posinset":fe+1,"aria-setsize":_.length,className:`w-full rounded-md p-2 text-left text-sm ${fe===w?W:""}`,style:{height:Zh,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onMouseEnter:()=>A(fe),onClick:()=>B(ye),children:ye.label},ye.id)}),O<_.length&&p.jsx("div",{"aria-hidden":"true",style:{height:(_.length-O)*Zh}}),!_.length&&p.jsx("div",{className:"p-3 text-sm opacity-65",children:f?.noCommandResults||"No matching commands."})]})]})]})},_3={parameters:"Parameters",requestBody:"Request body",responses:"Responses",tryIt:"Try It",codeSamples:"Code examples"};function L3(t){return t===void 0?"host":Array.isArray(t)?"custom":t==="none"?"minimal":t}function q3(t){return Array.from(t.querySelectorAll('button:not([disabled]), select:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')).filter(e=>e.getAttribute("aria-hidden")!=="true")}const B3=({open:t,theme:e,hostTheme:n,manageTheme:r,viewerTheme:s,viewerExpand:a,effectiveExpandedSections:c,messages:u,onThemeChange:f,onExpandChange:h,onClose:g})=>{const b=I.useRef(null),v=I.useRef(null);if(I.useEffect(()=>{if(!t||typeof document>"u")return;const D=document.activeElement instanceof HTMLElement?document.activeElement:null;v.current?.focus();const M=E=>{if(E.key==="Escape"){E.preventDefault(),g();return}if(E.key!=="Tab"||!b.current)return;const R=q3(b.current);if(R.length===0){E.preventDefault(),b.current.focus();return}const _=R[0],q=R[R.length-1],O=document.activeElement;E.shiftKey&&(O===_||!b.current.contains(O))?(E.preventDefault(),q.focus()):!E.shiftKey&&(O===q||!b.current.contains(O))&&(E.preventDefault(),_.focus())};return document.addEventListener("keydown",M),()=>{document.removeEventListener("keydown",M),D?.isConnected&&D.focus()}},[t,g]),!t)return null;const w=e==="dark",A=w?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900",C=w?"border-gray-700 bg-gray-800 text-gray-100":"border-gray-300 bg-white text-gray-900",j=Array.isArray(a)?a.filter(D=>Ns.includes(D)):[];return p.jsxs("div",{className:"fixed inset-0 z-[70]",children:[p.jsx("button",{type:"button","aria-label":"Close settings backdrop",className:"absolute inset-0 bg-black/40",onClick:g}),p.jsxs("aside",{ref:b,role:"dialog","aria-modal":"true","aria-label":"Viewer settings",tabIndex:-1,className:`absolute inset-y-0 right-0 flex w-[min(92vw,24rem)] flex-col border-l shadow-2xl ${A}`,children:[p.jsxs("div",{className:"flex min-h-14 items-center justify-between border-b px-4",children:[p.jsxs("div",{children:[p.jsx("div",{className:"font-semibold",children:"Settings"}),p.jsx("div",{className:"text-xs opacity-65",children:"Preferences are saved for this documentation."})]}),p.jsx("button",{type:"button","aria-label":"Close settings",className:"inline-flex h-11 w-11 items-center justify-center rounded-md",onClick:g,children:p.jsx(Od,{className:"h-5 w-5"})})]}),p.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto p-4",children:[r&&p.jsxs("section",{"aria-labelledby":"appearance-settings-heading",children:[p.jsx("h2",{id:"appearance-settings-heading",className:"mb-1 text-sm font-semibold",children:u?.viewerTheme||"Appearance"}),p.jsx("p",{className:"mb-3 text-xs opacity-65",children:"Override the documentation host theme on this device."}),p.jsxs("select",{"aria-label":u?.viewerTheme||"Viewer theme",className:`w-full rounded-md border px-3 py-2 text-sm ${C}`,value:s||"host",onChange:D=>f(D.target.value==="host"?void 0:D.target.value),children:[p.jsxs("option",{value:"host",children:["Use documentation default (",n,")"]}),p.jsx("option",{value:"light",children:u?.lightTheme||"Light"}),p.jsx("option",{value:"dark",children:u?.darkTheme||"Dark"}),p.jsx("option",{value:"high-contrast",children:u?.highContrast||"High contrast"})]})]}),p.jsxs("section",{"aria-labelledby":"expansion-settings-heading",children:[p.jsx("h2",{id:"expansion-settings-heading",className:"mb-1 text-sm font-semibold",children:"Default expanded sections"}),p.jsx("p",{className:"mb-3 text-xs opacity-65",children:"This preference overrides the documentation author's default. Opening or closing a section manually remains temporary."}),p.jsxs("select",{ref:v,"aria-label":"Default expanded sections",className:`w-full rounded-md border px-3 py-2 text-sm ${C}`,value:L3(a),onChange:D=>{const M=D.target.value;h(M==="host"?void 0:M==="custom"?[...c]:M)},children:[p.jsx("option",{value:"host",children:"Use documentation default"}),p.jsx("option",{value:"minimal",children:"Minimal"}),p.jsx("option",{value:"documentation",children:"Documentation"}),p.jsx("option",{value:"interactive",children:"Interactive"}),p.jsx("option",{value:"all",children:"All sections"}),p.jsx("option",{value:"custom",children:"Custom sections"})]}),Array.isArray(a)&&p.jsxs("fieldset",{className:"mt-4 space-y-2",children:[p.jsx("legend",{className:"mb-2 text-xs font-medium uppercase tracking-wide opacity-65",children:"Custom sections"}),Ns.map(D=>p.jsxs("label",{className:"flex min-h-9 items-center gap-2 text-sm",children:[p.jsx("input",{type:"checkbox",checked:j.includes(D),onChange:M=>{const E=new Set(j);M.target.checked?E.add(D):E.delete(D),h(Ns.filter(R=>E.has(R)))}}),_3[D]]},D))]}),a!==void 0&&p.jsx("button",{type:"button",className:"mt-5 rounded-md border px-3 py-2 text-sm",onClick:()=>h(void 0),children:"Reset to documentation defaults"})]})]})]})]})};function $3(t){return Array.from(t.querySelectorAll('button:not([disabled]), select:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')).filter(e=>e.getAttribute("aria-hidden")!=="true")}const I3=({open:t,theme:e,loading:n,error:r,snapshot:s,onClose:a,onEndpointSelect:c,messages:u})=>{const f=I.useRef(null),h=I.useRef(null);if(I.useEffect(()=>{if(!t||typeof document>"u")return;const j=document.activeElement instanceof HTMLElement?document.activeElement:null,D=document.body.style.overflow;document.body.style.overflow="hidden",h.current?.focus();const M=E=>{if(E.key==="Escape"){E.preventDefault(),a();return}if(E.key!=="Tab"||!f.current)return;const R=$3(f.current);if(R.length===0){E.preventDefault(),f.current.focus();return}const _=R[0],q=R[R.length-1],O=document.activeElement;E.shiftKey&&(O===_||!f.current.contains(O))?(E.preventDefault(),q.focus()):!E.shiftKey&&(O===q||!f.current.contains(O))&&(E.preventDefault(),_.focus())};return document.addEventListener("keydown",M),()=>{document.body.style.overflow=D,document.removeEventListener("keydown",M),j?.isConnected&&j.focus()}},[t,a]),!t)return null;const g=e==="dark",b=g?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900",v=g?"text-gray-400":"text-gray-600",w=g?"border-red-800 bg-red-950/50 text-red-200":"border-red-300 bg-red-50 text-red-800",A=g?"border-amber-700 bg-amber-950/50 text-amber-200":"border-amber-300 bg-amber-50 text-amber-900",C=g?"text-green-300":"text-green-700";return p.jsxs("div",{className:"fixed inset-0 z-50",children:[p.jsx("button",{tabIndex:-1,className:"absolute inset-0 bg-black/40","aria-label":u?.closeRuntimeIntelligence||"Close runtime intelligence",onClick:a}),p.jsxs("section",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":"runtime-intelligence-heading",tabIndex:-1,className:`absolute inset-y-0 right-0 w-[min(92vw,32rem)] overflow-y-auto border-l p-5 shadow-2xl ${b}`,children:[p.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4",children:[p.jsxs("div",{children:[p.jsxs("div",{id:"runtime-intelligence-heading",className:"flex items-center gap-2 text-lg font-semibold",children:[p.jsx(Dg,{className:"h-5 w-5"}),u?.runtimeIntelligence||"Runtime intelligence"]}),p.jsx("p",{className:`mt-1 text-sm ${v}`,children:u?.runtimeIntelligenceDescription||"Live route presence and backend context from the service hosting this documentation."})]}),p.jsx("button",{ref:h,className:"inline-flex h-10 w-10 items-center justify-center rounded-md border","aria-label":u?.closeRuntimeIntelligencePanel||"Close runtime intelligence panel",onClick:a,children:p.jsx(Od,{className:"h-4 w-4"})})]}),n&&p.jsx("p",{className:v,children:u?.inspectingRuntimeRoutes||"Inspecting runtime routes…"}),r&&p.jsx("div",{role:"alert",className:`rounded-lg border p-3 text-sm ${w}`,children:r}),s&&p.jsxs("div",{className:"space-y-5",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[p.jsxs("div",{className:"rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.framework||"Framework"}),p.jsxs("div",{className:"font-semibold",children:[s.framework,s.frameworkVersion?` ${s.frameworkVersion}`:""]})]}),p.jsxs("div",{className:"rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.matched||"Matched"}),p.jsxs("div",{className:"font-semibold",children:[s.summary.matched," / ",s.summary.documented]})]}),p.jsxs("div",{className:"col-span-2 rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.runtime||"Runtime"}),p.jsxs("div",{className:"font-semibold",children:[s.runtime.name," ",s.runtime.version]}),p.jsxs("div",{className:`mt-1 text-xs ${v}`,children:[s.runtime.platform," · ",s.runtime.arch]})]}),s.validation&&p.jsxs("div",{className:"col-span-2 rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.contractValidation||"Contract validation"}),p.jsxs("div",{className:"font-semibold",children:[s.validation.status.toUpperCase()," · ",s.validation.summary.total," ",s.validation.summary.total===1?"finding":"findings"]}),p.jsxs("div",{className:`mt-1 text-xs ${v}`,children:[s.validation.summary.errors," errors · ",s.validation.summary.warnings," warnings · ",s.validation.summary.info," info"]})]}),(s.serverOrigin||s.server?.localPort)&&p.jsxs("div",{className:"col-span-2 rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.runtimeServer||"Runtime server"}),s.serverOrigin&&p.jsx("code",{className:"block break-all text-xs",children:s.serverOrigin}),s.server?.localPort&&p.jsxs("div",{className:`mt-1 text-xs ${v}`,children:[u?.backendListenerPort||"Backend listener port"," ",s.server.localPort]})]}),s.environment?.name&&p.jsxs("div",{className:"col-span-2 rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.environment||"Environment"}),p.jsx("div",{className:"font-semibold",children:s.environment.name})]})]}),!s.discoveryComplete&&p.jsxs("div",{className:`flex gap-2 rounded-lg border p-3 text-sm ${A}`,children:[p.jsx(Ed,{className:"mt-0.5 h-4 w-4 shrink-0"}),u?.routeDiscoveryPartial||"Route discovery is partial; documented routes not observed at runtime may be false positives."]}),s.validation?p.jsx(H3,{result:s.validation,theme:e,messages:u,onSelect:c?j=>{j.location.method&&(c(j.location.path,j.location.method),a())}:void 0}):p.jsxs(p.Fragment,{children:[p.jsx(n1,{title:u?.implementedButUndocumented||"Implemented but undocumented",routes:s.runtimeOnly,empty:u?.noUndocumentedRuntimeRoutes||"No undocumented runtime routes discovered.",theme:e,warning:!0,openLabel:u?.openRuntimeRoute||"Open runtime route"}),p.jsx(n1,{title:u?.documentedButNotObserved||"Documented but not observed",routes:s.documentedOnly,empty:u?.everyDocumentedRouteObserved||"Every documented route was observed.",theme:e,openLabel:u?.openRuntimeRoute||"Open runtime route",onSelect:c?j=>{c(j.path,j.method),a()}:void 0})]}),s.validation?.status==="pass"&&p.jsxs("div",{className:`flex items-center gap-2 text-sm ${C}`,children:[p.jsx(la,{className:"h-4 w-4"}),u?.contractValidationPass||"The running backend matches the OpenAPI contract for all validated checks."]}),!s.validation&&s.summary.runtimeOnly===0&&s.summary.documentedOnly===0&&s.discoveryComplete&&p.jsxs("div",{className:`flex items-center gap-2 text-sm ${C}`,children:[p.jsx(la,{className:"h-4 w-4"}),u?.runtimeAligned||"Runtime routes and OpenAPI paths are aligned."]})]})]})]})};function H3({result:t,theme:e,messages:n,onSelect:r}){const a=e==="dark"?"text-gray-400":"text-gray-600",c=n?.contractValidation||"Contract validation";return p.jsxs("section",{children:[p.jsxs("h3",{className:"mb-2 font-semibold",children:[c," ",p.jsxs("span",{className:a,children:["(",t.findings.length,")"]})]}),t.findings.length?p.jsx("div",{className:"space-y-2",children:t.findings.map(u=>{const f=u.code==="runtime.operation-unobserved"||u.code==="runtime.method-mismatch",h=!!(r&&f&&u.location.method),g=p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex gap-2 text-sm",children:[p.jsx("span",{className:"w-14 shrink-0 font-semibold",children:u.severity.toUpperCase()}),p.jsx("code",{className:"break-all",children:u.code})]}),p.jsx("div",{className:`mt-1 text-xs ${a}`,children:u.message}),(u.expected!==void 0||u.observed!==void 0)&&p.jsxs("div",{className:`mt-1 text-xs ${a}`,children:[u.expected!==void 0&&p.jsxs("div",{children:[n?.validationExpected||"Expected",": ",t1(u.expected)]}),u.observed!==void 0&&p.jsxs("div",{children:[n?.validationObserved||"Observed",": ",t1(u.observed)]})]})]});return h?p.jsx("button",{type:"button","aria-label":`${n?.openRuntimeRoute||"Open documented operation"} ${u.location.method} ${u.location.path}`,className:"w-full rounded border p-2 text-left",onClick:()=>r?.(u),children:g},u.id):p.jsx("div",{className:"rounded border p-2",children:g},u.id)})}):p.jsx("p",{className:`text-sm ${a}`,children:n?.contractValidationPass||"No contract mismatches detected."})]})}function t1(t){return Array.isArray(t)?t.join(", "):t}function n1({title:t,routes:e,empty:n,theme:r,warning:s=!1,onSelect:a,openLabel:c="Open runtime route"}){const u=r==="dark",f=u?"text-gray-400":"text-gray-600",h=s?u?"border-amber-700":"border-amber-300":"";return p.jsxs("section",{children:[p.jsxs("h3",{className:"mb-2 font-semibold",children:[t," ",p.jsxs("span",{className:f,children:["(",e.length,")"]})]}),e.length?p.jsx("div",{className:"space-y-2",children:e.map(g=>a?p.jsxs("button",{type:"button","aria-label":`${c} ${g.method} ${g.path}`,className:`flex w-full gap-2 rounded border p-2 text-left text-sm transition hover:border-blue-500 hover:bg-blue-500/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${h}`,onClick:()=>a(g),children:[p.jsx("span",{className:"w-14 shrink-0 font-semibold",children:g.method}),p.jsx("code",{className:"break-all",children:g.path})]},`${g.method}:${g.path}`):p.jsxs("div",{className:`flex gap-2 rounded border p-2 text-sm ${h}`,children:[p.jsx("span",{className:"w-14 shrink-0 font-semibold",children:g.method}),p.jsx("code",{className:"break-all",children:g.path})]},`${g.method}:${g.path}`))}):p.jsx("p",{className:`text-sm ${f}`,children:n})]})}function z3({className:t="h-8 w-8"}){return p.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 512 512",className:t,children:[p.jsx("rect",{width:"512",height:"512",rx:"115",fill:"white"}),p.jsx("path",{d:"M397 130.546C397 136.784 392.409 141.84 386.745 141.84H196.951C191.287 141.84 186.696 146.896 186.696 153.134L186.692 239.516C186.692 245.754 191.283 250.811 196.947 250.811H315.049C320.712 250.811 325.303 255.867 325.303 262.105V317.357C325.303 323.594 320.712 328.651 315.049 328.651H196.951C191.288 328.651 186.696 333.707 186.696 339.944L186.692 436.706C186.692 442.944 182.101 448 176.438 448H125.255C119.591 448 115 442.943 115 436.706V329.566C115 323.329 119.591 318.272 125.255 318.272H171.66C177.324 318.272 181.915 313.216 181.915 306.978V272.483C181.915 266.246 177.324 261.189 171.66 261.189H125.255C119.591 261.189 115 256.133 115 249.895V142.756C115 136.518 119.591 131.461 125.255 131.461H171.66C177.324 131.461 181.915 126.405 181.915 120.167V75.2941C181.915 69.0565 186.506 64 192.169 64H386.745C392.409 64 397 69.0565 397 75.2941V130.546Z",fill:"#3461E1"})]})}const ep="flexdoc-runner",tp=1;function Xc(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Jc(t){return Array.isArray(t)?`[${t.map(Jc).join(",")}]`:Xc(t)?`{${Object.keys(t).filter(n=>t[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${Jc(t[n])}`).join(",")}}`:JSON.stringify(t)}function i1(t){return t.type==="oauth2"?{...t,scopes:t.scopes?[...t.scopes]:void 0}:{...t}}function U3(t){return{...t,auth:i1(t.auth),variables:t.variables.map(e=>({...e}))}}function np(t){return{...t,auth:i1(t.auth)}}function r1(t){if(t.request.binary?.file)throw new Error(`Request ${t.name} contains an in-memory binary file. Runner artifact file payload export is not supported yet.`);if((t.request.formData||[]).some(e=>e.type==="file"&&!!e.file))throw new Error(`Request ${t.name} contains an in-memory multipart file. Runner artifact file payload export is not supported yet.`)}function ip(t){r1(t);const e=Ei(t.request);return e.binary&&delete e.binary.file,e.formData&&(e.formData=e.formData.map(n=>{const r={...n};return delete r.file,r})),{...t,request:e,scripts:t.scripts?wn(t.scripts):void 0}}function V3(t){return{...t,variables:t.variables.map(e=>({...e}))}}function s1(t,e){const n=t.collections.find(r=>r.id===e.collectionId);if(!n)throw new Error(`Runner scope references missing collection ${e.collectionId}.`);return n}function l1(t,e,n){const r=new Set,s=new Map(t.folders.filter(c=>c.collectionId===e).map(c=>[c.id,c]));let a=n?s.get(n):void 0;for(;a&&!r.has(a.id);)r.add(a.id),a=a.parentFolderId?s.get(a.parentFolderId):void 0;return r}function a1(t,e,n){const r=new Set([n]);let s=!0;for(;s;){s=!1;for(const a of t.folders)a.collectionId!==e||!a.parentFolderId||r.has(a.id)||r.has(a.parentFolderId)&&(r.add(a.id),s=!0)}return r}function o1(t,e){if(e.type==="collection")return t.folders.filter(s=>s.collectionId===e.collectionId).map(np);if(e.type==="folder"){if(!t.folders.find(c=>c.id===e.folderId&&c.collectionId===e.collectionId))throw new Error(`Runner scope references missing folder ${e.folderId}.`);const a=a1(t,e.collectionId,e.folderId);for(const c of l1(t,e.collectionId,e.folderId))a.add(c);return t.folders.filter(c=>c.collectionId===e.collectionId&&a.has(c.id)).map(np)}const n=t.requests.find(s=>s.id===e.requestId&&s.collectionId===e.collectionId);if(!n)throw new Error(`Runner scope references missing request ${e.requestId}.`);const r=l1(t,e.collectionId,n.folderId);return t.folders.filter(s=>s.collectionId===e.collectionId&&r.has(s.id)).map(np)}function c1(t,e){if(e.type==="collection")return t.requests.filter(r=>r.collectionId===e.collectionId).map(ip);if(e.type==="folder"){const r=a1(t,e.collectionId,e.folderId);return t.requests.filter(s=>s.collectionId===e.collectionId&&!!s.folderId&&r.has(s.folderId)).map(ip)}const n=t.requests.find(r=>r.id===e.requestId&&r.collectionId===e.collectionId);if(!n)throw new Error(`Runner scope references missing request ${e.requestId}.`);return[ip(n)]}function u1(t,e){if(t.length===0)throw new Error(`Runner ${e.type} scope contains no executable saved requests.`)}function F3(t,e){const n=e===!1?void 0:e??t.activeEnvironmentId;if(!n)return{environments:[]};const r=t.environments.find(s=>s.id===n);if(!r){if(typeof e=="string")throw new Error(`Runner export references missing environment ${e}.`);return{environments:[]}}return{environments:[V3(r)],activeEnvironmentId:r.id}}function P3(t,e,n={}){const r=t.credentialStorage!==void 0&&t.credentialStorage!=="remember"?Q0(t):t,s=s1(r,e),a=c1(r,e);u1(a,e);const c=F3(r,n.environmentId),u={version:6,collections:[U3(s)],folders:o1(r,e),requests:a,environments:c.environments,...c.activeEnvironmentId?{activeEnvironmentId:c.activeEnvironmentId}:{},history:[]};return{kind:ep,version:tp,exportedAt:n.exportedAt||new Date().toISOString(),scope:{...e},workspace:u}}function Y3(t){if(!Xc(t)||typeof t.type!="string"||typeof t.collectionId!="string"||!t.collectionId)throw new Error("Invalid FlexDoc Runner artifact scope.");if(t.type==="collection")return{type:"collection",collectionId:t.collectionId};if(t.type==="folder"&&typeof t.folderId=="string"&&t.folderId)return{type:"folder",collectionId:t.collectionId,folderId:t.folderId};if(t.type==="request"&&typeof t.requestId=="string"&&t.requestId)return{type:"request",collectionId:t.collectionId,requestId:t.requestId};throw new Error("Invalid FlexDoc Runner artifact scope.")}function Qc(t,e){const n=t.map(r=>r.id);if(new Set(n).size!==n.length)throw new Error(`Runner artifact workspace contains duplicate ${e} ids.`)}function d1(t,e){return t.length===e.length&&t.every((n,r)=>n.id===e[r]?.id)}function K3(t,e){const n=s1(t,e);if(t.collections.length!==1||t.collections[0].id!==n.id)throw new Error("Runner artifact workspace must contain exactly the scoped collection.");if(t.environments.length>1)throw new Error("Runner artifact workspace may contain at most one selected environment.");if(t.environments.length===0&&t.activeEnvironmentId!==void 0)throw new Error("Runner artifact workspace cannot select an environment that is not embedded.");if(t.environments.length===1&&t.activeEnvironmentId!==t.environments[0].id)throw new Error("Runner artifact workspace must activate its single embedded environment.");if(e.type==="folder"&&!t.folders.some(a=>a.id===e.folderId&&a.collectionId===e.collectionId))throw new Error(`Runner artifact references missing folder ${e.folderId}.`);if(e.type==="request"&&!t.requests.some(a=>a.id===e.requestId&&a.collectionId===e.collectionId))throw new Error(`Runner artifact references missing request ${e.requestId}.`);const r=o1(t,e),s=c1(t,e);if(u1(s,e),!d1(t.folders,r)||!d1(t.requests,s))throw new Error(`Runner artifact workspace contains entities outside its declared ${e.type} scope.`)}function G3(t){if(t.version!==6||!Array.isArray(t.collections)||!Array.isArray(t.folders)||!Array.isArray(t.requests)||!Array.isArray(t.environments)||!Array.isArray(t.history)||t.history.length!==0||t.activeEnvironmentId!==void 0&&typeof t.activeEnvironmentId!="string")throw new Error("Invalid FlexDoc Runner artifact workspace. Expected canonical workspace version 6 with empty history.");return{version:6,collections:t.collections,folders:t.folders,requests:t.requests,environments:t.environments,...t.activeEnvironmentId!==void 0?{activeEnvironmentId:t.activeEnvironmentId}:{},history:[]}}function X3(t){if(!Xc(t)||t.kind!==ep||t.version!==tp||typeof t.exportedAt!="string"||!t.exportedAt.trim()||!Xc(t.workspace))throw new Error("Invalid FlexDoc Runner artifact. Expected flexdoc-runner version 1.");const e=Y3(t.scope),n=G3(t.workspace),r=sy(n);if(Jc(n)!==Jc(r))throw new Error("Invalid FlexDoc Runner artifact workspace. Portable artifacts must not require workspace migration or normalization repairs.");Qc(r.collections,"collection"),Qc(r.folders,"folder"),Qc(r.requests,"request"),Qc(r.environments,"environment"),K3(r,e);for(const s of r.requests)r1(s);return{kind:ep,version:tp,exportedAt:t.exportedAt,scope:e,workspace:r}}function J3(t){return`${JSON.stringify(X3(t),null,2)}
|
|
76
|
-
`}function Q3(t,e,n){if(!n)return null;const r=t.folders.find(c=>c.id===n&&c.collectionId===e);if(!r)return new Set;const s=new Set([r.id]);let a=!0;for(;a;){a=!1;for(const c of t.folders)c.collectionId!==e||!c.parentFolderId||s.has(c.id)||s.has(c.parentFolderId)&&(s.add(c.id),a=!0)}return s}function Sl(t,e,n){const r=Q3(t,e,n);return t.requests.filter(s=>s.collectionId!==e?!1:r?!!s.folderId&&r.has(s.folderId):!0)}function W3(t,e){const n=new Map(t.map(c=>[c.id,c])),r=[],s=new Set;let a=n.get(e);for(;a&&!s.has(a.id);)s.add(a.id),r.unshift(a.name),a=a.parentFolderId?n.get(a.parentFolderId):void 0;return r.join(" / ")}function f1(t,e,n){const r=t.collections.find(a=>a.id===e)?.name||"Deleted collection";if(!n)return r;const s=W3(t.folders.filter(a=>a.collectionId===e),n);return s?`${r} / ${s}`:`${r} / Deleted folder`}function Z3(t){return!t.error&&!t.scriptError&&t.scriptTests.every(e=>e.passed)}async function eM(t){const e=Sl(t.workspace,t.collectionId,t.folderId),n=t.runId||Sn("run"),r=t.runName||f1(t.workspace,t.collectionId,t.folderId);let s=t.workspace;const a=[];let c=t.signal?.aborted===!0;for(let g=0;g<e.length&&!c;g+=1){if(t.signal?.aborted){c=!0;break}const b=e[g];t.onRequestStart?.(b,g,e.length);const v=oy(s,t.collectionId),w=ff(s),A={...t.externalEnvironmentVariables||{},...w},C={...v,...t.externalVariables||{},...A},j=await gy({request:b.request,scripts:b.scripts,credentials:t.credentials,requestInterceptor:t.requestInterceptor,hostExecution:t.hostExecution,preferHostExecution:t.preferHostExecution===!0,resolveAuth:_=>ay(s,b.collectionId,b.folderId,_||{type:"none"}),variables:C,collectionVariables:v,externalVariables:t.externalVariables,environmentVariables:A,signal:t.signal,fetcher:t.fetcher,now:t.now,onCollectionChanges:_=>{s=cy(s,b.collectionId,_),t.onCollectionChanges?.(_)},onEnvironmentChanges:_=>{s=hf(s,_),t.onEnvironmentChanges?.(_)}}),D=t.signal?.aborted===!0,M=!D&&Z3(j);let E;j.result&&!D&&(s=ly(s,{...j.result,collectionId:b.collectionId,folderId:b.folderId,runId:n,runName:r,runIndex:g+1,runTotal:e.length,runPassed:M}),E=s.history[0]?.id);const R={requestId:b.id,requestName:b.name,collectionId:b.collectionId,folderId:b.folderId,passed:M,cancelled:D,historyEntryId:E,outcome:j};if(a.push(R),t.onRequestComplete?.(R,g,e.length),D){c=!0;break}if(!R.passed&&t.stopOnFailure&&g<e.length-1){c=!0;break}}const u=a.filter(g=>g.passed).length,f=a.filter(g=>g.cancelled).length,h=a.filter(g=>!g.passed&&!g.cancelled).length;return{runId:n,runName:r,collectionId:t.collectionId,folderId:t.folderId,total:e.length,completed:a.length,passed:u,failed:h,cancelled:f,stopped:c,items:a,workspace:s}}function Jr(){return new Date().toISOString()}function tM(t){return`${t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"runner"}.flexdoc.json`}const nM=({request:t,scripts:e,onLoadRequest:n,onSelectedCollectionChange:r,onSelectedFolderChange:s,onRunCollection:a,onRunFolder:c,selectedCollectionId:u,selectedFolderId:f="",workspace:h,onWorkspaceChange:g,hostExecution:b,theme:v})=>{const[w,A]=I.useState(""),[C,j]=I.useState(""),[D,M]=I.useState(""),[E,R]=I.useState(null),[_,q]=I.useState(""),O=h.collections.find(G=>G.id===u)||h.collections[0],X=I.useMemo(()=>h.folders.filter(G=>G.collectionId===O?.id),[O?.id,h.folders]),U=I.useMemo(()=>h.requests.filter(G=>G.collectionId===O?.id),[O?.id,h.requests]),B=X.find(G=>G.id===f),K=I.useMemo(()=>new Map(X.map(G=>[G.id,G])),[X]),W=I.useMemo(()=>{const G=[],we=new Set,Ne=(De,Ke)=>{X.filter(st=>st.parentFolderId===De).forEach(st=>{we.has(st.id)||(we.add(st.id),G.push({folder:st,depth:Ke}),Ne(st.id,Ke+1))})};return Ne(void 0,0),X.forEach(De=>{we.has(De.id)||(we.add(De.id),G.push({folder:De,depth:0}),Ne(De.id,1))}),G},[X]),ye=G=>{const we=[],Ne=new Set;let De=K.get(G);for(;De&&!Ne.has(De.id);)Ne.add(De.id),we.unshift(De.name),De=De.parentFolderId?K.get(De.parentFolderId):void 0;return we.join(" / ")};I.useEffect(()=>{r?.(O?.id)},[r,O?.id]);const pe=(G,we)=>{try{const Ne=P3(h,G),De=new Blob([J3(Ne)],{type:"application/json;charset=utf-8"}),Ke=URL.createObjectURL(De),st=document.createElement("a");st.href=Ke,st.download=tM(we),st.click(),setTimeout(()=>URL.revokeObjectURL(Ke),0),q("")}catch(Ne){q(Ne instanceof Error?Ne.message:String(Ne))}},fe=()=>{const G=w.trim();if(!G)return;const we=Jr(),Ne=Sn("collection");g(De=>({...De,collections:[...De.collections,{id:Ne,name:G,auth:{type:"none"},variables:[],createdAt:we,updatedAt:we}]})),r?.(Ne),s?.(""),A(""),R(null)},L=G=>{if(!O)return;const we=Jr();g(Ne=>({...Ne,collections:Ne.collections.map(De=>De.id===O.id?{...De,auth:G,updatedAt:we}:De)}))},Q=G=>{if(!B)return;const we=Jr();g(Ne=>({...Ne,folders:Ne.folders.map(De=>De.id===B.id?{...De,auth:G,updatedAt:we}:De)}))},oe=()=>{if(!O)return;const G=Jr();g(we=>({...we,collections:we.collections.map(Ne=>Ne.id===O.id?{...Ne,variables:[...Ne.variables,{id:Sn("variable"),key:"",value:"",enabled:!0}],updatedAt:G}:Ne)}))},ce=(G,we)=>{if(!O)return;const Ne=Jr();g(De=>({...De,collections:De.collections.map(Ke=>Ke.id===O.id?{...Ke,variables:Ke.variables.map(st=>st.id===G?{...st,...we}:st),updatedAt:Ne}:Ke)}))},ve=G=>{if(!O)return;const we=Jr();g(Ne=>({...Ne,collections:Ne.collections.map(De=>De.id===O.id?{...De,variables:De.variables.filter(Ke=>Ke.id!==G),updatedAt:we}:De)}))},T=()=>{const G=C.trim();if(!G||!O)return;const we=Jr(),Ne=Sn("folder");g(De=>({...De,folders:[...De.folders,{id:Ne,collectionId:O.id,parentFolderId:f||void 0,name:G,auth:{type:"inherit"},createdAt:we,updatedAt:we}]})),s?.(Ne),j("")},z=()=>{if(!O)return;const G=D.trim()||t.url||"Untitled request",we=Jr();if(E){g(De=>({...De,requests:De.requests.map(Ke=>Ke.id===E?{...Ke,collectionId:O.id,folderId:f||void 0,name:G,request:Ei(t),scripts:wn(e),updatedAt:we}:Ke)}));return}const Ne={id:Sn("request"),collectionId:O.id,folderId:f||void 0,name:G,request:Ei(t),scripts:wn(e),createdAt:we,updatedAt:we};g(De=>({...De,requests:[...De.requests,Ne]})),R(Ne.id),M(G)},he=G=>{const we=h.requests.find(Ne=>Ne.id===G);we&&(R(we.id),r?.(we.collectionId),s?.(we.folderId||""),M(we.name),n(Ei(we.request),we.scripts?wn(we.scripts):void 0,we.collectionId,we.folderId))},ne=G=>{g(we=>({...we,requests:we.requests.filter(Ne=>Ne.id!==G)})),E===G&&(R(null),M(""))},ke=G=>{const we=h.folders.find(Ne=>Ne.id===G);g(Ne=>RC(Ne,G)),f===G&&s?.(we?.parentFolderId||"")},qe=G=>{const we=DC(h,G);g(we),u===G&&(r?.(we.collections[0]?.id||""),s?.(""),R(null),M(""))},$e=v==="dark"?"bg-gray-900 border-gray-700 text-gray-100":"bg-white border-gray-300 text-gray-900",Fe=v==="dark"?"text-gray-400":"text-gray-500",Ye=v==="dark"?"bg-blue-500/10 text-blue-300":"bg-blue-500/10 text-blue-700",Ie=G=>p.jsxs("div",{className:`group flex items-center gap-1 rounded-md ${E===G.id?"bg-blue-500/10":""}`,children:[p.jsxs("button",{type:"button",className:"min-w-0 flex-1 rounded-md px-2 py-2 text-left text-sm hover:bg-blue-500/10","aria-label":`Load saved request ${G.name}`,onClick:()=>he(G.id),children:[p.jsx("span",{className:"mr-2 font-mono text-xs font-semibold text-blue-600",children:G.request.method.toUpperCase()}),p.jsx("span",{className:"truncate",children:G.name})]}),p.jsx("button",{type:"button",className:"rounded-md p-2 opacity-70 hover:opacity-100","aria-label":`Export saved request ${G.name} for Runner`,onClick:()=>pe({type:"request",collectionId:G.collectionId,requestId:G.id},G.name),children:p.jsx(Cd,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:"rounded-md p-2 opacity-70 hover:opacity-100","aria-label":`Delete saved request ${G.name}`,onClick:()=>ne(G.id),children:p.jsx(ci,{className:"h-4 w-4"})})]},G.id),ut=(G,we,Ne=new Set)=>{if(Ne.has(G.id))return null;const De=new Set(Ne);De.add(G.id);const Ke=ye(G.id),st=X.filter(Et=>Et.parentFolderId===G.id);return p.jsxs(Og.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{type:"button","aria-label":`Select folder ${Ke}`,className:`min-w-0 flex-1 rounded-md py-2 pr-2 text-left text-sm ${f===G.id?"bg-blue-500/10":""}`,style:{paddingLeft:`${8+we*16}px`},onClick:()=>s?.(G.id),children:G.name}),p.jsx("button",{type:"button",disabled:Sl(h,G.collectionId,G.id).length===0,"aria-label":`Run folder ${Ke}`,className:"rounded-md p-2 opacity-70 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>c?.(G.collectionId,G.id),children:p.jsx(aa,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",disabled:Sl(h,G.collectionId,G.id).length===0,"aria-label":`Export folder ${Ke} for Runner`,className:"rounded-md p-2 opacity-70 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>pe({type:"folder",collectionId:G.collectionId,folderId:G.id},Ke),children:p.jsx(Cd,{className:"h-4 w-4"})}),p.jsx("button",{type:"button","aria-label":`Delete folder ${Ke}`,className:"rounded-md p-2 opacity-70 hover:opacity-100",onClick:()=>ke(G.id),children:p.jsx(ci,{className:"h-4 w-4"})})]}),st.map(Et=>ut(Et,we+1,De))]},G.id)},Rt=(G,we,Ne=new Set)=>{if(Ne.has(G.id))return null;const De=new Set(Ne);De.add(G.id);const Ke=U.filter(Et=>Et.folderId===G.id),st=X.filter(Et=>Et.parentFolderId===G.id);return Ke.length===0&&st.length===0?null:p.jsxs("div",{className:"space-y-1",children:[Ke.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`mb-1 text-xs font-semibold uppercase tracking-wide ${Fe}`,style:{paddingLeft:`${8+we*12}px`},children:G.name}),p.jsx("div",{style:{paddingLeft:`${we*12}px`},children:Ke.map(Ie)})]}),st.map(Et=>Rt(Et,we+1,De))]},G.id)},Ce=X.filter(G=>!G.parentFolderId),Oe=f?ye(f):"";return p.jsxs("section",{className:"space-y-4","aria-labelledby":"api-client-collections-heading",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(PA,{className:"h-4 w-4"}),p.jsx("h3",{id:"api-client-collections-heading",className:"font-semibold",children:"Collections"})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{"aria-label":"New collection name",className:`min-w-0 flex-1 rounded-md border px-2 py-2 text-sm ${$e}`,value:w,onChange:G=>A(G.target.value),placeholder:"New collection"}),p.jsx("button",{type:"button","aria-label":"Add collection",className:"rounded-md border px-3 py-2",onClick:fe,children:p.jsx(Cs,{className:"h-4 w-4"})})]}),p.jsx("div",{className:"space-y-2",children:h.collections.map(G=>p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{type:"button",className:`min-w-0 flex-1 rounded-md px-2 py-2 text-left text-sm font-medium ${G.id===O?.id?Ye:""}`,onClick:()=>{r?.(G.id),s?.(""),R(null),M("")},children:G.name}),p.jsx("button",{type:"button",disabled:Sl(h,G.id).length===0,"aria-label":`Run collection ${G.name}`,className:"rounded-md p-2 opacity-70 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>a?.(G.id),children:p.jsx(aa,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",disabled:Sl(h,G.id).length===0,"aria-label":`Export collection ${G.name} for Runner`,className:"rounded-md p-2 opacity-70 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>pe({type:"collection",collectionId:G.id},G.name),children:p.jsx(Cd,{className:"h-4 w-4"})}),h.collections.length>1&&p.jsx("button",{type:"button","aria-label":`Delete collection ${G.name}`,className:"rounded-md p-2 opacity-70 hover:opacity-100",onClick:()=>qe(G.id),children:p.jsx(ci,{className:"h-4 w-4"})})]},G.id))}),p.jsxs("p",{className:`text-xs ${Fe}`,children:["Runner exports can include saved authentication, collection variables, and the active environment. Treat downloaded ",p.jsx("code",{children:".flexdoc.json"})," files as sensitive configuration."]}),_&&p.jsx("p",{role:"alert",className:"text-xs text-red-600",children:_}),O&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"space-y-2 border-t pt-3",children:[p.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide",children:"Collection authorization"}),p.jsx(gf,{auth:O.auth,label:"Collection",hostExecution:b,onChange:L,theme:v}),p.jsx("p",{className:`text-xs ${Fe}`,children:"Requests set to inherit use the nearest folder override, then this collection authorization."})]}),p.jsxs("div",{className:"space-y-2 border-t pt-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:"Collection variables"}),p.jsxs("button",{type:"button","aria-label":"Add collection variable",className:"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs",onClick:oe,children:[p.jsx(Cs,{className:"h-3.5 w-3.5"})," Add"]})]}),p.jsxs("div",{className:"space-y-2",children:[O.variables.map((G,we)=>p.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)_auto] items-center gap-1",children:[p.jsx("input",{"aria-label":`Collection variable ${we+1} enabled`,type:"checkbox",checked:G.enabled!==!1,onChange:Ne=>ce(G.id,{enabled:Ne.target.checked})}),p.jsx("input",{"aria-label":`Collection variable ${we+1} key`,className:`min-w-0 rounded-md border px-2 py-1.5 font-mono text-xs ${$e}`,placeholder:"baseUrl",value:G.key,onChange:Ne=>ce(G.id,{key:Ne.target.value})}),p.jsx("input",{"aria-label":`Collection variable ${we+1} value`,className:`min-w-0 rounded-md border px-2 py-1.5 font-mono text-xs ${$e}`,placeholder:"https://api.example.com",value:G.value,onChange:Ne=>ce(G.id,{value:Ne.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove collection variable ${we+1}`,className:"rounded-md p-1.5 opacity-70 hover:opacity-100",onClick:()=>ve(G.id),children:p.jsx(ci,{className:"h-3.5 w-3.5"})})]},G.id)),O.variables.length===0&&p.jsxs("p",{className:`text-xs ${Fe}`,children:["Collection variables provide reusable defaults such as ",p.jsx("code",{children:"{{baseUrl}}"}),". Active environment values override matching collection keys."]})]})]}),p.jsxs("div",{className:"space-y-1 border-t pt-3",children:[p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{"aria-label":"New folder name",className:`min-w-0 flex-1 rounded-md border px-2 py-2 text-sm ${$e}`,value:C,onChange:G=>j(G.target.value),placeholder:"Folder"}),p.jsx("button",{type:"button","aria-label":"Add folder",className:"rounded-md border px-3 py-2",onClick:T,children:p.jsx(VA,{className:"h-4 w-4"})})]}),p.jsx("p",{className:`text-xs ${Fe}`,children:Oe?`New folders are created inside ${Oe}.`:"New folders are created at the collection root."})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("button",{type:"button","aria-label":"Select collection root",className:`w-full rounded-md px-2 py-2 text-left text-sm ${f===""?"bg-blue-500/10":""}`,onClick:()=>s?.(""),children:"Unfiled / collection root"}),Ce.map(G=>ut(G,0))]}),B&&p.jsxs("div",{className:"space-y-2 border-t pt-3",children:[p.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide",children:["Folder authorization — ",Oe]}),p.jsx(gf,{auth:B.auth,label:"Folder",allowInherit:!0,hostExecution:b,onChange:Q,theme:v})]}),p.jsxs("div",{className:"space-y-2 border-t pt-3",children:[p.jsx("input",{"aria-label":"Saved request name",className:`w-full rounded-md border px-2 py-2 text-sm ${$e}`,value:D,onChange:G=>M(G.target.value),placeholder:"Request name"}),p.jsxs("select",{"aria-label":"Saved request folder",className:`w-full rounded-md border px-2 py-2 text-sm ${$e}`,value:f,onChange:G=>s?.(G.target.value),children:[p.jsx("option",{value:"",children:"Unfiled"}),W.map(({folder:G,depth:we})=>p.jsx("option",{value:G.id,children:`${"— ".repeat(we)}${G.name}`},G.id))]}),p.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm font-medium",onClick:z,children:[p.jsx(WA,{className:"h-4 w-4"})," ",E?"Update request":"Save request"]})]}),p.jsxs("div",{className:"space-y-3 border-t pt-3",children:[U.filter(G=>!G.folderId).map(Ie),Ce.map(G=>Rt(G,0)),U.length===0&&p.jsx("p",{className:`px-2 text-xs ${Fe}`,children:"Save the current request to build a reusable collection."})]})]})]})};function Ia(){return new Date().toISOString()}const iM=({workspace:t,onWorkspaceChange:e,theme:n})=>{const[r,s]=I.useState(""),a=t.environments.find(w=>w.id===t.activeEnvironmentId),c=n==="dark"?"bg-gray-900 border-gray-700 text-gray-100":"bg-white border-gray-300 text-gray-900",u=n==="dark"?"text-gray-400":"text-gray-500",f=()=>{const w=r.trim();if(!w)return;const A=Ia(),C=Sn("environment");e(j=>({...j,environments:[...j.environments,{id:C,name:w,variables:[],createdAt:A,updatedAt:A}],activeEnvironmentId:C})),s("")},h=w=>{if(!a)return;const A=Ia();e(C=>({...C,environments:C.environments.map(j=>j.id===a.id?{...j,name:w,updatedAt:A}:j)}))},g=()=>{if(!a)return;const w=Ia();e(A=>({...A,environments:A.environments.map(C=>C.id===a.id?{...C,variables:[...C.variables,{id:Sn("variable"),key:"",value:"",enabled:!0}],updatedAt:w}:C)}))},b=(w,A)=>{if(!a)return;const C=Ia();e(j=>({...j,environments:j.environments.map(D=>D.id===a.id?{...D,variables:D.variables.map(M=>M.id===w?{...M,...A}:M),updatedAt:C}:D)}))},v=w=>{if(!a)return;const A=Ia();e(C=>({...C,environments:C.environments.map(j=>j.id===a.id?{...j,variables:j.variables.filter(D=>D.id!==w),updatedAt:A}:j)}))};return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-environment-heading",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("h3",{id:"api-client-environment-heading",className:"font-semibold",children:"Environment"}),a&&p.jsx("button",{type:"button","aria-label":`Delete environment ${a.name}`,className:"rounded-md p-2 opacity-70 hover:opacity-100",onClick:()=>e(w=>MC(w,a.id)),children:p.jsx(ci,{className:"h-4 w-4"})})]}),p.jsxs("select",{"aria-label":"Active environment",className:`w-full rounded-md border px-2 py-2 text-sm ${c}`,value:t.activeEnvironmentId||"",onChange:w=>e(A=>({...A,activeEnvironmentId:w.target.value||void 0})),children:[p.jsx("option",{value:"",children:"No environment"}),t.environments.map(w=>p.jsx("option",{value:w.id,children:w.name},w.id))]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{"aria-label":"New environment name",className:`min-w-0 flex-1 rounded-md border px-2 py-2 text-sm ${c}`,value:r,onChange:w=>s(w.target.value),placeholder:"New environment"}),p.jsx("button",{type:"button","aria-label":"Add environment",className:"rounded-md border px-3 py-2",onClick:f,children:p.jsx(Cs,{className:"h-4 w-4"})})]}),a&&p.jsxs("div",{className:"space-y-3",children:[p.jsx("input",{"aria-label":"Environment name",className:`w-full rounded-md border px-2 py-2 text-sm font-medium ${c}`,value:a.name,onChange:w=>h(w.target.value)}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:"Variables"}),p.jsxs("button",{type:"button","aria-label":"Add environment variable",className:"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs",onClick:g,children:[p.jsx(Cs,{className:"h-3.5 w-3.5"})," Add"]})]}),p.jsxs("div",{className:"space-y-2",children:[a.variables.map((w,A)=>p.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)_auto] items-center gap-1",children:[p.jsx("input",{"aria-label":`Environment variable ${A+1} enabled`,type:"checkbox",checked:w.enabled!==!1,onChange:C=>b(w.id,{enabled:C.target.checked})}),p.jsx("input",{"aria-label":`Environment variable ${A+1} key`,className:`min-w-0 rounded-md border px-2 py-1.5 font-mono text-xs ${c}`,placeholder:"baseUrl",value:w.key,onChange:C=>b(w.id,{key:C.target.value})}),p.jsx("input",{"aria-label":`Environment variable ${A+1} value`,className:`min-w-0 rounded-md border px-2 py-1.5 font-mono text-xs ${c}`,placeholder:"https://api.example.com",value:w.value,onChange:C=>b(w.id,{value:C.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove environment variable ${A+1}`,className:"rounded-md p-1.5 opacity-70 hover:opacity-100",onClick:()=>v(w.id),children:p.jsx(ci,{className:"h-3.5 w-3.5"})})]},w.id)),a.variables.length===0&&p.jsxs("p",{className:`text-xs ${u}`,children:["Add variables such as ",p.jsx("code",{children:"{{baseUrl}}"})," or ",p.jsx("code",{children:"{{token}}"}),"."]})]})]})]})};function Wc(t){return!!t.error||!!t.scriptError||t.status!==void 0&&t.status>=400||!!t.scriptTests?.some(e=>!e.passed)}function rp(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString()}function rM(t,e){const n=e.query.trim().toLowerCase();return t.history.filter(r=>{const s=r.collectionId?t.collections.find(g=>g.id===r.collectionId)?.name||"Deleted collection":"",a=r.folderId?t.folders.find(g=>g.id===r.folderId)?.name||"Deleted folder":"",c=!n||[r.executedMethod,r.resolvedUrl,r.status,r.statusText,s,a,r.runName].filter(g=>g!==void 0).some(g=>String(g).toLowerCase().includes(n)),u=e.method==="all"||r.executedMethod.toUpperCase()===e.method,f=Wc(r),h=e.outcome==="all"||e.outcome==="success"&&!f||e.outcome==="failed"&&f||e.outcome==="tests"&&!!r.scriptTests?.length;return c&&u&&h})}function sM(t){const e=new Set,n=[];for(const r of t){if(!r.runId){n.push({kind:"entry",entry:r});continue}if(e.has(r.runId))continue;e.add(r.runId);const s=t.filter(c=>c.runId===r.runId).sort((c,u)=>(c.runIndex||Number.MAX_SAFE_INTEGER)-(u.runIndex||Number.MAX_SAFE_INTEGER)),a=Math.max(s.length,...s.map(c=>c.runTotal||0));n.push({kind:"run",group:{runId:r.runId,runName:r.runName||"Collection run",entries:s,total:a,captured:s.length,passed:s.filter(c=>c.runPassed===!0).length,failed:s.filter(c=>c.runPassed===!1).length,cancelled:0}})}return n}const lM=({workspace:t,onWorkspaceChange:e,onLoadRequest:n,onViewAll:r,theme:s})=>{const a=s==="dark"?"text-gray-400":"text-gray-500",c=f=>{const h=t.history.find(g=>g.id===f);h&&n(h.request,h.scripts,h.collectionId,h.folderId)},u=f=>{const h=t.history.find(g=>g.id===f);h&&(typeof window<"u"&&!window.confirm(`Delete this history entry?
|
|
72
|
+
`),f=a.length-(u+1),h=r[c]||"",g=s[c]||"",b=h.length-h.trimStart().length,v=g.length-g.trimStart().length,w=g.length-v,A=f<=b?Math.min(f,v):v+Math.min(f-b,w);return s.slice(0,c).reduce((O,D)=>O+D.length+1,0)+A}function e3(t,e,n=e){const r=t.replace(/\r\n?/g,`
|
|
73
|
+
`),s=ZO(t),a=Yv(r,s,Pv(t,e)),c=Yv(r,s,Pv(t,n));return{value:s,selectionStart:Math.min(a,s.length),selectionEnd:Math.min(Math.max(a,c),s.length)}}const Jh=[{label:"get",kind:"method",signature:"get(key: string): string | undefined",documentation:"Read a variable by key."},{label:"has",kind:"method",signature:"has(key: string): boolean",documentation:"Check whether a variable is defined."},{label:"set",kind:"method",signature:"set(key: string, value: unknown): void",documentation:"Set a variable. Collection and environment stores persist the change in the workspace."},{label:"unset",kind:"method",signature:"unset(key: string): void",documentation:"Remove a variable by key."},{label:"replaceIn",kind:"method",signature:"replaceIn(value: string): string",documentation:"Replace {{variable}} placeholders using this variable scope."}],t3={flex:[{label:"request",kind:"property",documentation:"The mutable request draft available to pre-request and test scripts."},{label:"response",kind:"property",documentation:"The response from the executed request.",testsOnly:!0},{label:"environment",kind:"property",documentation:"Read and mutate variables in the active environment."},{label:"collection",kind:"property",documentation:"Read and mutate variables on the current collection."},{label:"variables",kind:"property",documentation:"Read and mutate the effective variables for this execution."},{label:"expect",kind:"function",signature:"expect(actual: unknown): FlexExpectation",documentation:"Create an assertion chain for a value."},{label:"test",kind:"function",signature:"test(name: string, callback: () => unknown | Promise<unknown>): void",documentation:"Register a post-response test.",testsOnly:!0}],"flex.request":[{label:"method",kind:"property",signature:"method: string",documentation:"Read or replace the HTTP method."},{label:"url",kind:"property",signature:"url: string",documentation:"Read or replace the request URL before variable resolution."},{label:"headers",kind:"property",documentation:"Mutable request-header helpers."},{label:"body",kind:"property",documentation:"Mutable raw request-body helpers."}],"flex.request.headers":[{label:"get",kind:"method",signature:"get(name: string): string | undefined",documentation:"Read a request header case-insensitively."},{label:"has",kind:"method",signature:"has(name: string): boolean",documentation:"Check whether a request header exists."},{label:"set",kind:"method",signature:"set(name: string, value: unknown): void",documentation:"Set or replace a request header."},{label:"upsert",kind:"method",signature:"upsert({ key, value }: { key: string; value: unknown }): void",documentation:"Set or replace a request header from a key/value object."},{label:"remove",kind:"method",signature:"remove(name: string): void",documentation:"Remove a request header case-insensitively."},{label:"toObject",kind:"method",signature:"toObject(): Record<string, string>",documentation:"Return enabled request headers as an object."}],"flex.request.body":[{label:"raw",kind:"property",signature:"raw: string",documentation:"Read or replace the raw request body."}],"flex.response":[{label:"code",kind:"property",signature:"code: number",documentation:"HTTP response status code.",testsOnly:!0},{label:"status",kind:"property",signature:"status: string",documentation:"HTTP response status text.",testsOnly:!0},{label:"responseTime",kind:"property",signature:"responseTime: number",documentation:"Measured response time in milliseconds.",testsOnly:!0},{label:"headers",kind:"property",documentation:"Read-only response-header helpers.",testsOnly:!0},{label:"text",kind:"method",signature:"text(): string",documentation:"Return the response body as text.",testsOnly:!0},{label:"json",kind:"method",signature:"json(): unknown",documentation:"Parse and return the response body as JSON.",testsOnly:!0}],"flex.response.headers":[{label:"get",kind:"method",signature:"get(name: string): string | undefined",documentation:"Read a response header case-insensitively.",testsOnly:!0},{label:"has",kind:"method",signature:"has(name: string): boolean",documentation:"Check whether a response header exists.",testsOnly:!0},{label:"toObject",kind:"method",signature:"toObject(): Record<string, string>",documentation:"Return response headers as an object.",testsOnly:!0}],"flex.environment":Jh,"flex.collection":Jh,"flex.variables":Jh.map(t=>({...t,documentation:t.label==="set"||t.label==="unset"?`${t.documentation} Local effective-variable changes apply only to the current request execution.`:t.documentation})),"flex.expect.to":[{label:"equal",kind:"method",signature:"equal(expected: unknown): void",documentation:"Assert strict equality with Object.is."},{label:"eql",kind:"method",signature:"eql(expected: unknown): void",documentation:"Assert deep structural equality."},{label:"include",kind:"method",signature:"include(expected: unknown): void",documentation:"Assert that a string or array contains the expected value."},{label:"match",kind:"method",signature:"match(pattern: RegExp): void",documentation:"Assert that a string matches a regular expression."},{label:"have",kind:"property",documentation:"Property assertions."},{label:"be",kind:"property",documentation:"Boolean, range, and membership assertions."}],"flex.expect.to.have":[{label:"property",kind:"method",signature:"property(name: string, expected?: unknown): void",documentation:"Assert that an object has a property, optionally with an expected value."}],"flex.expect.to.be":[{label:"above",kind:"method",signature:"above(expected: number): void",documentation:"Assert that a number is greater than expected."},{label:"below",kind:"method",signature:"below(expected: number): void",documentation:"Assert that a number is less than expected."},{label:"oneOf",kind:"method",signature:"oneOf(expected: unknown[]): void",documentation:"Assert deep equality with one value from a list."},{label:"ok",kind:"property",signature:"ok: true",documentation:"Assert that the value is truthy."},{label:"true",kind:"property",signature:"true: true",documentation:"Assert that the value is exactly true."},{label:"false",kind:"property",signature:"false: true",documentation:"Assert that the value is exactly false."}],console:[{label:"log",kind:"method",signature:"log(...values: unknown[]): void",documentation:"Write a line to the API Client script console."},{label:"info",kind:"method",signature:"info(...values: unknown[]): void",documentation:"Write an informational line to the API Client script console."},{label:"warn",kind:"method",signature:"warn(...values: unknown[]): void",documentation:"Write a warning line to the API Client script console."},{label:"error",kind:"method",signature:"error(...values: unknown[]): void",documentation:"Write an error line to the API Client script console."}]};function Kv(t,e){return[...t3[t]||[]].filter(n=>e==="tests"||!n.testsOnly).map(n=>({...n}))}function n3(t,e,n={}){const r=e.toLowerCase();return[...new Set(n[t]||[])].filter(Boolean).filter(s=>s.toLowerCase().startsWith(r)).sort((s,a)=>s.localeCompare(a)).map(s=>({label:s,kind:"variable",signature:s,documentation:`Known ${t==="variables"?"effective":t} variable.`}))}const i3=[{label:"flex",kind:"namespace",documentation:"FlexDoc request, response, variables, assertions, and test scripting API."},{label:"console",kind:"namespace",documentation:"Captured script console with log, info, warn, and error methods."}];function r3(t){const e=t.lastIndexOf("flex.expect(");if(e<0)return null;const n=t.slice(e),r=[[/\.to\.have\.([A-Za-z_$][\w$]*)?$/,"flex.expect.to.have"],[/\.to\.be\.([A-Za-z_$][\w$]*)?$/,"flex.expect.to.be"],[/\.to\.([A-Za-z_$][\w$]*)?$/,"flex.expect.to"]];for(const[s,a]of r){const c=n.match(s);if(c)return{path:a,prefix:c[1]||""}}return null}function s3(t){const e=t.match(/flex\.(environment|collection|variables)\.(?:get|has|set|unset)\(\s*['"]([^'"]*)$/);return e?{scope:e[1],prefix:e[2]||""}:null}function l3(t){const e=t.match(/(?:^|[^\w$])((?:flex|console)(?:\.[A-Za-z_$][\w$]*)*)\.([A-Za-z_$][\w$]*)?$/);return e?{path:e[1],prefix:e[2]||""}:null}function a3(t,e,n,r={},s=!1){const a=Math.max(0,Math.min(e,t.length)),c=t.slice(0,a),u=s3(c);if(u){const v=n3(u.scope,u.prefix,r);return v.length>0?{from:a-u.prefix.length,to:a,items:v}:null}const f=r3(c);if(f){const v=Kv(f.path,n).filter(w=>w.label.toLowerCase().startsWith(f.prefix.toLowerCase()));return v.length>0?{from:a-f.prefix.length,to:a,items:v}:null}const h=l3(c);if(h){const v=Kv(h.path,n).filter(w=>w.label.toLowerCase().startsWith(h.prefix.toLowerCase()));return v.length>0?{from:a-h.prefix.length,to:a,items:v}:null}const g=c.match(/([A-Za-z_$][\w$]*)$/)?.[1]||"";if(!s&&!g)return null;const b=i3.filter(v=>!g||v.label.startsWith(g));return!s&&b.length===0?null:b.length>0?{from:a-g.length,to:a,items:b.map(v=>({...v}))}:null}const Gv=({ariaLabel:t,value:e,onChange:n,phase:r,theme:s="light",variableKeys:a={}})=>{const c=I.useRef(null),u=I.useRef(null),f=I.useRef([]),[h,g]=I.useState(null),[b,v]=I.useState(0),[w,A]=I.useState({left:12,top:36}),C=I.useMemo(()=>`api-client-script-completions-${t.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`,[t]),O=I.useMemo(()=>QO(e),[e]),D=s==="dark",E=B=>{const K=u.current,W=c.current;if(!K||!W)return;const ye=K.coordsAtPos(B);if(!ye)return;const pe=W.getBoundingClientRect(),fe=ye.left-pe.left,L=Math.max(8,pe.width-430),Q=ye.bottom-pe.top+2,oe=Math.max(8,pe.height-96);A({left:Math.max(8,Math.min(fe,L)),top:Math.max(8,Math.min(Q,oe))})},j=(B,K,W=!1)=>{const ye=a3(B,K,r,a,W);g(ye),v(0),ye&&requestAnimationFrame(()=>E(K))},M=B=>{if(!h)return;const K=`${e.slice(0,h.from)}${B.label}${e.slice(h.to)}`,W=h.from+B.label.length;n(K),g(null),requestAnimationFrame(()=>{u.current?.setSelection(W)})},_=()=>{if(!O.valid)return;const B=u.current?.getSelection()??{from:e.length,to:e.length},K=e3(e,B.from,B.to);K.value!==e&&n(K.value),g(null),requestAnimationFrame(()=>{u.current?.setSelection(K.selectionStart,K.selectionEnd)})};I.useEffect(()=>{f.current[b]?.scrollIntoView({block:"nearest"})},[b]);const q=B=>{const K=u.current?.getSelection().from??e.length;if((B.ctrlKey||B.metaKey)&&B.code==="Space"){B.preventDefault(),j(e,K,!0);return}if(B.shiftKey&&B.altKey&&B.code==="KeyF"){B.preventDefault(),_();return}if(!(!h||h.items.length===0)){if(B.key==="ArrowDown"){B.preventDefault(),v(W=>(W+1)%h.items.length);return}if(B.key==="ArrowUp"){B.preventDefault(),v(W=>(W-1+h.items.length)%h.items.length);return}if(B.key==="Enter"||B.key==="Tab"){B.preventDefault(),M(h.items[b]);return}B.key==="Escape"&&(B.preventDefault(),g(null))}},R=h?.items[b],X=!!h&&h.items.length>0,U=D?"border-gray-700 bg-gray-900 text-gray-100 shadow-2xl":"border-gray-200 bg-white text-gray-900 shadow-2xl";return p.jsxs("div",{ref:c,className:"relative min-w-0",onBlur:B=>{B.currentTarget.contains(B.relatedTarget)||g(null)},children:[p.jsxs("div",{className:"mb-1 flex flex-wrap items-center justify-between gap-2",children:[p.jsxs("span",{role:O.valid?"status":"alert",className:`inline-flex items-center gap-1 text-[11px] ${O.valid?D?"text-emerald-300":"text-emerald-700":D?"text-amber-300":"text-amber-700"}`,children:[O.valid?p.jsx(la,{className:"h-3.5 w-3.5"}):p.jsx(Od,{className:"h-3.5 w-3.5"}),p.jsx("span",{className:"max-w-[24rem] truncate",children:O.message})]}),p.jsxs("button",{type:"button",className:"inline-flex min-h-9 items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs disabled:cursor-not-allowed disabled:opacity-50",disabled:!O.valid||!e.trim(),onMouseDown:B=>B.preventDefault(),onClick:_,"aria-label":"Format current script",children:[p.jsx(ik,{className:"h-3.5 w-3.5"}),"Format"]})]}),p.jsx($a,{ref:u,ariaActiveDescendant:X?`${C}-${b}`:void 0,ariaAutocomplete:"list",ariaControls:X?C:void 0,ariaExpanded:X,ariaLabel:t,autoIndent:!0,dataTestId:`${t}-editor`,language:"javascript",onChange:B=>{const K=u.current?.getSelection().from??B.length;n(B),requestAnimationFrame(()=>{const W=u.current?.getSelection().from??K;j(B,W)})},onCursorChange:B=>{h&&E(B)},onEditorKeyDown:q,theme:s,value:e,wrap:!0}),X&&p.jsxs("div",{className:`absolute z-[70] w-[min(26rem,calc(100%-1rem))] overflow-hidden rounded-md border ${U}`,"data-testid":`${t}-completion-popup`,style:{left:w.left,top:w.top},children:[p.jsx("div",{id:C,role:"listbox","aria-label":"Script suggestions",className:"max-h-56 overflow-y-auto py-1",children:h.items.map((B,K)=>p.jsxs("button",{ref:W=>{f.current[K]=W},"aria-label":B.label,"aria-selected":K===b,className:`flex w-full items-baseline gap-2 px-3 py-1.5 text-left text-xs ${K===b?D?"bg-blue-700 text-white":"bg-blue-50 text-gray-900":D?"hover:bg-gray-800":"hover:bg-gray-50"}`,id:`${C}-${K}`,onMouseEnter:()=>v(K),onMouseDown:W=>{W.preventDefault(),M(B)},role:"option",type:"button",children:[p.jsx("span",{"aria-hidden":"true",className:"shrink-0 rounded bg-black/5 px-1 font-mono text-[10px] uppercase opacity-60 dark:bg-white/10",children:B.kind}),p.jsx("span",{className:"font-mono font-semibold",children:B.label}),p.jsx("span",{"aria-hidden":"true",className:`min-w-0 truncate ${K===b&&D?"text-blue-100":D?"text-gray-400":"text-gray-500"}`,children:B.signature||""})]},`${B.kind}-${B.label}`))}),R&&p.jsxs("div",{className:`border-t px-3 py-2 text-[11px] ${D?"border-gray-700 text-gray-300":"border-gray-200 text-gray-600"}`,children:[R.signature&&p.jsx("div",{className:"mb-1 overflow-x-auto whitespace-nowrap font-mono text-xs",children:R.signature}),p.jsx("div",{children:R.documentation})]})]}),p.jsxs("div",{className:`mt-1 flex flex-wrap gap-x-3 text-[11px] ${D?"text-gray-400":"text-gray-500"}`,children:[p.jsxs("span",{children:[p.jsx("code",{children:"flex."})," or Ctrl+Space"]}),p.jsx("span",{children:"Enter keeps indentation"}),p.jsx("span",{children:"↑/↓ choose"}),p.jsx("span",{children:"Enter/Tab complete"}),p.jsx("span",{children:"Shift+Alt+F format"})]})]})},Xv=new Set,Yc="API-host execute route",Kc="the execute path";function Gc(t,e){return`${Yc} diagnostic ${t}. Check ${e}.`}function o3(t,e){return t===401?Gc("was unauthorized",`documentation authentication for ${Kc}`):t===403?Gc("was rejected",`CSRF, same-origin, and authorization middleware for ${Kc}`):t===404||t===501||t===405&&(!e||!/\bPOST\b/i.test(e))?`${Yc} is not available at the configured endpoint. Deploy the FlexDoc execute route or update the API-host URL.`:t===400?`${Yc} returned HTTP 400 before FlexDoc validated the diagnostic probe. Check CSRF and request-body middleware for ${Kc}.`:Gc(`returned HTTP ${t}`,"authentication, CSRF, and middleware configuration")}async function c3(t,e=globalThis.fetch,n){const r=t.trim();if(!r||!e||n?.aborted)return null;const s=e===globalThis.fetch;if(s&&Xv.has(r))return null;try{const a=await e(r,{method:"POST",credentials:"same-origin",headers:{"X-FlexDoc-Execute":"1","Content-Type":"application/json"},body:"{}",signal:n});if(n?.aborted)return null;const c=await a.text();let u="";try{const h=c?JSON.parse(c):{};typeof h.error=="string"&&(u=h.error)}catch{}return a.status===429||a.status===400&&/host execution/i.test(u)?(s&&Xv.add(r),null):a.redirected?Gc("was redirected",`authentication middleware for ${Kc}`):a.ok?`${Yc} accepted the deliberately invalid diagnostic request. Verify that the configured endpoint is FlexDoc's hardened execute route.`:o3(a.status,a.headers.get("Allow"))}catch{return null}}function u3(t){let e=t.url;for(const[n,r]of Object.entries(t.variables||{}))e=e.split(`{${n}}`).join(r.default);return e}function Qh(t){return t.replace(/\/+$/,"")}function Jv(t,e){const n=Qh(e);return n?t===n||t.startsWith(`${n}/`)||t.startsWith(`${n}?`):!1}function d3(t,e,n){const r=Qh(n);if(!r)return t;const s=Qh(e);if(s&&Jv(t,s))return`${r}${t.slice(s.length)}`;try{const a=new URL(t),c=`${a.pathname==="/"?"":a.pathname}${a.search}${a.hash}`;return`${r}${c}`}catch{return r}}const f3=()=>({key:"",value:"",enabled:!0});function h3(t){return{method:t?.method||"GET",url:t?.url||"",query:t?.query?.map(e=>({...e}))||[],headers:t?.headers?.map(e=>({...e}))||[],body:t?.body||"",contentType:t?.contentType||"application/json",bodyMode:t?.bodyMode||da(t||{}),urlencoded:t?.urlencoded?.length?t.urlencoded.map(e=>({...e})):void 0,formData:t?.formData?.length?t.formData.map(e=>({...e})):void 0,binary:t?.binary?{...t.binary}:void 0,graphql:t?.graphql?{...t.graphql}:void 0,auth:t?.auth||{type:"none"},hostExecution:t?.hostExecution?{...t.hostExecution}:void 0}}function p3(t){const e=t.auth?t.auth.type==="oauth2"?{...t.auth,scopes:t.auth.scopes?[...t.auth.scopes]:void 0}:{...t.auth}:void 0;return{...t,query:t.query?.map(n=>({...n})),headers:t.headers?.map(n=>({...n})),urlencoded:t.urlencoded?.map(n=>({...n})),formData:t.formData?.map(n=>({...n})),binary:t.binary?{...t.binary}:void 0,graphql:t.graphql?{...t.graphql}:void 0,auth:e,hostExecution:t.hostExecution?{...t.hostExecution}:void 0}}function m3(t){try{return new URL(t).origin}catch{return""}}function g3(t,e){if(t==="query"){const n=e.trim().replace(/^\?/,"").replace(/\r?\n/g,"&");return n?[...new URLSearchParams(n).entries()].map(([r,s])=>({key:r,value:s,enabled:!0})):[]}return e.split(/\r?\n/).map(n=>n.trim()).filter(Boolean).flatMap(n=>{const r=n.indexOf(":");return r<=0?[]:[{key:n.slice(0,r).trim(),value:n.slice(r+1).trim(),enabled:!0}]})}function Qv({kind:t,label:e,entries:n,onChange:r,inputClass:s,mutedClass:a}){const[c,u]=I.useState(""),f=(g,b)=>r(n.map((v,w)=>w===g?{...v,...b}:v)),h=()=>{const g=g3(t,c);g.length&&(r(g),u(""))};return p.jsxs("div",{className:"space-y-3",children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[p.jsx("span",{className:"text-sm font-medium",children:e}),p.jsxs("button",{type:"button",className:"inline-flex min-h-11 items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm",onClick:()=>r([...n,f3()]),children:[p.jsx(Cs,{className:"h-4 w-4"})," Add"]})]}),n.length===0&&p.jsxs("div",{className:`rounded-md border border-dashed p-3 text-sm ${a}`,children:["No ",t==="query"?"query parameters":"headers"," configured."]}),n.map((g,b)=>p.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_auto] items-start gap-2 sm:grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)_auto]",children:[p.jsx("input",{className:"mt-3","aria-label":`${e} ${b+1} enabled`,type:"checkbox",checked:g.enabled!==!1,onChange:v=>f(b,{enabled:v.target.checked})}),p.jsx("input",{"aria-label":`${e} ${b+1} key`,className:`min-w-0 w-full rounded-md border px-3 py-2 text-sm ${s}`,placeholder:"Key",value:g.key,onChange:v=>f(b,{key:v.target.value})}),p.jsx("input",{"aria-label":`${e} ${b+1} value`,className:`col-start-2 min-w-0 w-full rounded-md border px-3 py-2 text-sm sm:col-start-auto ${s}`,placeholder:"Value",value:g.value,onChange:v=>f(b,{value:v.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove ${e.toLowerCase()} ${b+1}`,className:"col-start-3 row-start-1 inline-flex min-h-11 items-center justify-center rounded-md border px-3 py-2 sm:col-start-auto sm:row-start-auto",onClick:()=>r(n.filter((v,w)=>w!==b)),children:p.jsx(ci,{className:"h-4 w-4"})})]},b)),p.jsxs("details",{className:"rounded-md border p-3",children:[p.jsx("summary",{className:"cursor-pointer text-xs font-medium",children:"Bulk edit"}),p.jsxs("div",{className:"mt-2 space-y-2",children:[p.jsx("textarea",{"aria-label":`${e} bulk editor`,className:`min-h-24 w-full rounded-md border px-3 py-2 font-mono text-xs ${s}`,placeholder:t==="query"?"a=1&b=2":`Accept: application/json
|
|
74
|
+
X-Trace: abc123`,value:c,onChange:g=>u(g.target.value)}),p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("span",{className:`text-xs ${a}`,children:t==="query"?"Paste query-string pairs; applying replaces the current rows.":"Paste raw Header: value lines; applying replaces the current rows."}),p.jsx("button",{type:"button",className:"rounded-md border px-3 py-1.5 text-xs",disabled:!c.trim(),onClick:h,children:"Apply"})]})]})]})]})}function Wv(t){return(t||[]).filter(e=>e.enabled!==!1&&e.key.trim()).length}function y3(t,e){const n=[...t.matchAll(/\{\{\s*([^{}]+?)\s*\}\}/g)].map(c=>c[1].trim()),r=[...new Set(n)],s=r.filter(c=>!Object.prototype.hasOwnProperty.call(e,c)),a=t.replace(/\{\{\s*([^{}]+?)\s*\}\}/g,(c,u)=>{const f=u.trim();return Object.prototype.hasOwnProperty.call(e,f)?e[f]:c});return{names:r,missing:s,resolved:a}}const Zv=({initialRequest:t,initialScripts:e,initialRequestTab:n="params",initialScriptTab:r,theme:s="light",density:a="advanced",messages:c,credentials:u="same-origin",requestInterceptor:f,onRequestChange:h,onDraftChange:g,onScriptsChange:b,onRequestTabChange:v,onScriptTabChange:w,onExecutionStart:A,onExecutionComplete:C,resolveAuth:O,variables:D={},collectionVariables:E={},externalVariables:j={},environmentVariables:M={},onCollectionChanges:_,onEnvironmentChanges:q,serverOptions:R=[],initialServerUrl:X,onServerUrlChange:U,hostExecution:B,credentialStorage:K,onCredentialStorageChange:W})=>{const ye=h3(t),pe=wn(e),fe=R.map(se=>({server:se,url:u3(se)})),L=fe.map(se=>se.url),Q=X||L.find(se=>Jv(ye.url,se))||"",oe=L.includes(Q)?Q:L[0]||"",ce=Q&&!L.includes(Q)?Q:"",ve=Q||oe||m3(ye.url),[T,z]=I.useState(ye),[he,ne]=I.useState(pe),[ke,qe]=I.useState(oe),[$e,Fe]=I.useState(ce),Ye=I.useRef(ve),Ie=I.useRef(ve),[ut,Rt]=I.useState(null),[Ce,Oe]=I.useState(),[G,we]=I.useState(null),[Ne,De]=I.useState(null),[Ke,st]=I.useState([]),[Et,Zn]=I.useState([]),[Nn,ht]=I.useState(!1),_n=I.useRef(null),Tn=I.useRef(h),ei=I.useRef(g),kt=I.useRef(b),x=I.useRef(null),[V,me]=I.useState(n),[ae,J]=I.useState(()=>r||(pe.tests.trim()&&!pe.preRequest.trim()?"tests":"pre-request")),k=I.useRef({}),Y=I.useRef({}),Z=I.useId().replace(/:/g,""),xe=I.useId().replace(/:/g,"");I.useEffect(()=>{Tn.current=h},[h]),I.useEffect(()=>{ei.current=g},[g]),I.useEffect(()=>{kt.current=b},[b]),I.useEffect(()=>{ei.current?.(p3(T))},[T]),I.useEffect(()=>{kt.current?.(wn(he))},[he]),I.useEffect(()=>{try{const se=O?{...T,auth:O(T.auth)}:T,Le=G0(se,{variables:D}),tt=JSON.stringify([Le.method,Le.url,Le.headerEntries,Le.body,Le.bodyKind]);if(tt===x.current)return;x.current=tt,Tn.current?.(Le)}catch{}},[T,O,D]);const F=(T.method||"GET").toUpperCase(),ue=["GET","HEAD"].includes(F),re=s==="dark"?"bg-gray-900 border-gray-700 text-gray-100":"bg-white border-gray-300 text-gray-900",Se=`rounded-md border px-3 py-2 text-sm ${re}`,Me=s==="dark"?"border-gray-700 bg-gray-800/60 text-gray-100":"border-gray-200 bg-gray-50 text-gray-900",je=s==="dark"?"text-gray-400":"text-gray-600",_e=V==="scripts"&&a!=="advanced"?"params":V,ze=Wv(T.query),Qe=Wv(T.headers),pn=!!T.auth&&T.auth.type!=="none"&&T.auth.type!=="inherit",Un=da(T)!=="none",jn=!!(he.preRequest.trim()||he.tests.trim()),Wr=[{id:"params",label:"Params",count:ze},{id:"headers",label:"Headers",count:Qe},{id:"authorization",label:"Authorization",active:pn},{id:"body",label:"Body",active:Un},{id:"scripts",label:"Scripts",active:jn}].filter(se=>a==="advanced"||se.id!=="scripts"),yi=se=>`${Z}-request-tab-${se}`,Ee=se=>`${Z}-request-panel-${se}`,We=se=>`${xe}-script-tab-${se}`,Vt=se=>`${xe}-script-panel-${se}`,Ln=y3(T.url,D),bi=se=>{se==="scripts"&&a!=="advanced"||(me(se),v?.(se))},qn=se=>{J(se),w?.(se)},Ft=(se,Le)=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(se.key))return;se.preventDefault();const tt=Wr.filter(Va=>!Va.disabled).map(Va=>Va.id),qi=Math.max(0,tt.indexOf(Le)),ti=se.key==="Home"?tt[0]:se.key==="End"?tt[tt.length-1]:se.key==="ArrowRight"?tt[(qi+1)%tt.length]:tt[(qi-1+tt.length)%tt.length];bi(ti),k.current[ti]?.focus()},Kt=(se,Le)=>{if(!["ArrowLeft","ArrowRight","Home","End"].includes(se.key))return;se.preventDefault();const tt=["pre-request","tests"],qi=tt.indexOf(Le),ti=se.key==="Home"?tt[0]:se.key==="End"?tt[tt.length-1]:se.key==="ArrowRight"?tt[(qi+1)%tt.length]:tt[(qi-1+tt.length)%tt.length];qn(ti),Y.current[ti]?.focus()},Vn=se=>{if(!se)return;const Le=Ye.current;Ye.current=se,U?.(se),z(tt=>({...tt,url:d3(tt.url,Le,se)}))},ur=O?O(T.auth):T.auth,Bs=Uo({request:{...T,auth:ur},hostExecution:B}),[Li,za,Zr]=Bs,kl=Li==="host-required",dr=Zr?B?.available?c?.unusualBodyHostExecution||`${F} request bodies are unusual. FlexDoc will use API-host execution so the body can be sent.`:c?.unusualBodyBrowserWarning||`${F} request bodies are unusual. Browser fetch may reject this request; enable API-host execution to send it reliably.`:eN(Bs,B,c?.hostBrowserUnsupported,c?.hostExecutionDisabled),es=se=>B?.available===!0&&(B.capabilities||[]).includes(se),fr=ZC(ut,{...T,auth:ur},B),hr=async()=>{if(Nn)return;const se=new AbortController;_n.current=se,A?.(),ht(!0),we(null),De(null),st([]),Zn([]),Rt(null),Oe(void 0);try{const Le=await by({request:T,scripts:he,credentials:u,requestInterceptor:f,resolveAuth:O,variables:D,collectionVariables:E,externalVariables:j,environmentVariables:M,hostExecution:B,signal:se.signal,onRequestBuilt:ti=>Tn.current?.(ti),onCollectionChanges:_,onEnvironmentChanges:q});if(se.signal.aborted){we(c?.requestCancelled||"Request cancelled.");return}let tt=Le.error||null;if(tt&&Le.result?.transport==="api-host"&&B?.endpoint){const ti=await c3(B.endpoint,globalThis.fetch,se.signal);if(se.signal.aborted){we(c?.requestCancelled||"Request cancelled.");return}ti&&(tt=`${tt} ${ti}`)}const qi=QC(Le,T,B);tt&&qi&&(tt=`${tt} ${qi}`),we(tt),De(Le.scriptError||null),st(Le.scriptTests),Zn(Le.scriptLogs),Le.response&&(Oe(Le.curlCommand),Rt(Le.response)),Le.result&&C?.(Le.result)}finally{_n.current===se&&(_n.current=null),ht(!1)}},Gt=()=>_n.current?.abort(),iu=Ke.filter(se=>se.passed).length,Ua=!Nn&&!(kl&&!za);return p.jsx("div",{className:`min-w-0 rounded-xl border p-4 md:p-5 ${Me}`,"data-api-client-editor":!0,onKeyDown:se=>{(se.ctrlKey||se.metaKey)&&se.key==="Enter"&&Ua&&(se.preventDefault(),hr())},children:p.jsxs("div",{className:"flex flex-col gap-4",children:[p.jsxs("div",{className:"grid gap-2 sm:grid-cols-2",children:[R.length>0&&p.jsxs("label",{className:"text-sm font-medium",children:["Server",p.jsx("select",{"aria-label":"API Client server",className:`mt-1 w-full rounded-md border px-3 py-2 text-sm ${re}`,value:ke,onChange:se=>{qe(se.target.value),Fe(""),Vn(se.target.value)},children:fe.map(({server:se,url:Le})=>p.jsxs("option",{value:Le,children:[se.description?`${se.description} — `:"",se.url]},`${se.url}:${Le}`))})]}),p.jsxs("label",{className:"text-sm font-medium",children:["Custom server URL ",p.jsx("span",{className:"text-xs font-normal opacity-70",children:"(optional override)"}),p.jsx("input",{"aria-label":"API Client custom server URL",className:`mt-1 w-full rounded-md border px-3 py-2 font-mono text-sm ${re}`,value:$e,onChange:se=>{const Le=se.target.value;Fe(Le);const tt=ke||Ie.current;(Le.trim()||tt)&&Vn(Le.trim()||tt)},placeholder:"http://localhost:8080"})]})]}),p.jsxs("div",{className:"grid min-w-0 gap-2 sm:grid-cols-[auto_minmax(0,1fr)]",children:[p.jsx("select",{"aria-label":"HTTP method",className:`rounded-md border px-3 py-2 font-medium ${re}`,value:F,onChange:se=>{const Le=se.target.value;z(tt=>({...tt,method:Le}))},children:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(se=>p.jsx("option",{children:se},se))}),p.jsx("input",{"aria-label":"Request URL",className:`w-full rounded-md border px-3 py-2 font-mono text-sm ${re}`,placeholder:"https://api.example.com/resource or {{baseUrl}}/resource",value:T.url,onChange:se=>{const Le=se.target.value;z(tt=>({...tt,url:Le}))}})]}),Ln.names.length>0&&p.jsx("div",{className:`rounded-md border px-3 py-2 text-xs ${Ln.missing.length?s==="dark"?"border-amber-800 bg-amber-950/40 text-amber-200":"border-amber-300 bg-amber-50 text-amber-800":s==="dark"?"border-gray-700 bg-gray-900 text-gray-300":"border-gray-200 bg-white text-gray-600"}`,children:Ln.missing.length>0?p.jsxs(p.Fragment,{children:["Missing URL variable",Ln.missing.length===1?"":"s",": ",p.jsx("strong",{children:Ln.missing.join(", ")}),"."]}):p.jsxs(p.Fragment,{children:["Resolved URL: ",p.jsx("code",{className:"break-all",children:Ln.resolved})]})}),p.jsx("div",{className:"-mx-1 overflow-x-auto px-1 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","data-api-client-request-tabs":!0,children:p.jsx("div",{className:`flex min-w-max gap-1 rounded-lg border p-1 ${s==="dark"?"border-gray-700 bg-gray-900/70":"border-gray-200 bg-white"}`,role:"tablist","aria-label":"Request configuration",children:Wr.map(se=>p.jsxs("button",{ref:Le=>{k.current[se.id]=Le},id:yi(se.id),type:"button",role:"tab","aria-controls":Ee(se.id),"aria-label":se.label,"aria-selected":_e===se.id,tabIndex:_e===se.id?0:-1,className:`inline-flex items-center gap-1.5 rounded-md px-3 py-2 text-sm font-medium transition ${_e===se.id?"bg-blue-600 text-white shadow-sm":s==="dark"?"text-gray-300 hover:bg-gray-800":"text-gray-600 hover:bg-gray-100"}`,onClick:()=>bi(se.id),onKeyDown:Le=>Ft(Le,se.id),children:[p.jsx("span",{children:se.label}),se.count!==void 0&&se.count>0&&p.jsx("span",{className:`rounded-full px-1.5 text-[10px] leading-5 ${_e===se.id?"bg-white/20 text-white":s==="dark"?"bg-gray-700 text-gray-200":"bg-gray-200 text-gray-700"}`,children:se.count}),se.active&&se.count===void 0&&p.jsx("span",{"aria-label":"Configured",className:`h-1.5 w-1.5 rounded-full ${_e===se.id?"bg-white":"bg-blue-500"}`})]},se.id))})}),ue&&p.jsx("p",{className:`-mt-2 text-xs ${je}`,children:c?.unusualBodyAdvisory||`${F} request bodies are unusual and may be ignored or rejected by servers or intermediaries. FlexDoc keeps the body; API-host execution can send it when available, while browser fetch may reject it.`}),_e==="params"&&p.jsx("div",{role:"tabpanel",id:Ee("params"),"aria-labelledby":yi("params"),children:p.jsx(Qv,{kind:"query",label:"Query parameters",entries:T.query||[],onChange:se=>z(Le=>({...Le,query:se})),inputClass:re,mutedClass:je})}),_e==="headers"&&p.jsx("div",{role:"tabpanel",id:Ee("headers"),"aria-labelledby":yi("headers"),children:p.jsx(Qv,{kind:"headers",label:"Headers",entries:T.headers||[],onChange:se=>z(Le=>({...Le,headers:se})),inputClass:re,mutedClass:je})}),_e==="authorization"&&p.jsxs("div",{role:"tabpanel",id:Ee("authorization"),"aria-labelledby":yi("authorization"),className:"space-y-3",children:[p.jsx(xf,{auth:T.auth||{type:"none"},label:"",allowInherit:!!O,advanced:a==="advanced",hostExecution:B,onChange:se=>z(Le=>({...Le,auth:se})),theme:s}),W&&p.jsxs("label",{className:"block text-sm font-medium",children:["Credential storage",p.jsxs("select",{"aria-label":"Credential storage",className:Se,value:K||"remember",onChange:se=>W(se.target.value),children:[p.jsx("option",{value:"session",children:"Session only"}),p.jsx("option",{value:"remember",children:"Remember on this browser"}),p.jsx("option",{value:"never",children:"Never store"})]}),p.jsxs("span",{className:`mt-1 block text-xs font-normal ${je}`,children:["Applies to request, collection, and folder credentials. ",K==="session"?"Kept in this tab, not IndexedDB.":K==="never"?"Memory only; cleared on reload.":"Stored in this browser workspace."]})]}),a==="advanced"&&B?.available&&p.jsxs("div",{className:"grid gap-2 rounded-md border p-3 sm:grid-cols-2",children:[B.clientCertificates?.length?p.jsxs("label",{className:"text-xs font-medium",children:["Client certificate",p.jsxs("select",{"aria-label":"Client certificate",className:`mt-1 w-full rounded-md border px-2 py-1.5 ${re}`,value:T.hostExecution?.certificateId||"",onChange:se=>z(Le=>({...Le,hostExecution:{...Le.hostExecution||{},certificateId:se.target.value||void 0}})),children:[p.jsx("option",{value:"",children:"None"}),B.clientCertificates.map(se=>p.jsx("option",{value:se.id,children:se.name},se.id))]})]}):null,es("cookies")&&p.jsxs("label",{className:"inline-flex items-center gap-2 text-xs font-medium",children:[p.jsx("input",{"aria-label":"Use API host cookie jar",type:"checkbox",checked:T.hostExecution?.cookieJar==="session",onChange:se=>z(Le=>({...Le,hostExecution:{...Le.hostExecution||{},cookieJar:se.target.checked?"session":void 0}}))}),"Use API host cookie jar"]})]})]}),_e==="body"&&p.jsx("div",{role:"tabpanel",id:Ee("body"),"aria-labelledby":yi("body"),children:p.jsx(PO,{draft:T,onChange:z,theme:s})}),a==="advanced"&&_e==="scripts"&&p.jsxs("section",{role:"tabpanel",id:Ee("scripts"),"aria-labelledby":yi("scripts"),className:"min-w-0 space-y-3",children:[p.jsxs("div",{children:[p.jsx("h3",{id:"api-client-scripts-heading",className:"font-semibold",children:"Scripts"}),p.jsx("p",{className:`text-xs ${je}`,children:"Trusted local JavaScript. Editors soft-wrap, keep indentation, format only when you choose Format or Shift+Alt+F, and show lightweight syntax diagnostics."})]}),p.jsx("div",{className:`inline-flex max-w-full gap-1 rounded-lg border p-1 ${s==="dark"?"border-gray-700 bg-gray-900/70":"border-gray-200 bg-white"}`,role:"tablist","aria-label":"Script phase",children:["pre-request","tests"].map(se=>p.jsxs("button",{ref:Le=>{Y.current[se]=Le},id:We(se),type:"button",role:"tab","aria-controls":Vt(se),"aria-selected":ae===se,tabIndex:ae===se?0:-1,className:`rounded-md px-3 py-1.5 text-sm ${ae===se?"bg-blue-600 text-white":""}`,onClick:()=>qn(se),onKeyDown:Le=>Kt(Le,se),children:[se==="pre-request"?"Pre-request":"Tests",(se==="pre-request"?he.preRequest:he.tests).trim()&&p.jsx("span",{"aria-label":"Configured",className:`ml-1.5 inline-block h-1.5 w-1.5 rounded-full ${ae===se?"bg-white":"bg-blue-500"}`})]},se))}),ae==="pre-request"?p.jsx("div",{role:"tabpanel",id:Vt("pre-request"),"aria-labelledby":We("pre-request"),className:"min-w-0",children:p.jsx(Gv,{ariaLabel:"Pre-request script",phase:"pre-request",theme:s,value:he.preRequest,onChange:se=>ne(Le=>({...Le,preRequest:se})),variableKeys:{environment:Object.keys(M),collection:Object.keys(E),variables:Object.keys(D)}})}):p.jsx("div",{role:"tabpanel",id:Vt("tests"),"aria-labelledby":We("tests"),className:"min-w-0",children:p.jsx(Gv,{ariaLabel:"Tests script",phase:"tests",theme:s,value:he.tests,onChange:se=>ne(Le=>({...Le,tests:se})),variableKeys:{environment:Object.keys(M),collection:Object.keys(E),variables:Object.keys(D)}})})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[p.jsx("span",{"aria-label":"Request transport",className:`rounded border px-2 py-1 ${je}`,children:JC(Li)}),B?.available&&p.jsxs("label",{className:`inline-flex items-center gap-2 ${je}`,children:["Transport preference",p.jsxs("select",{"aria-label":"Transport preference",disabled:kl,className:`rounded-md border px-2 py-1 ${re}`,value:T.hostExecution?.preferHostExecution===void 0?"inherit":T.hostExecution.preferHostExecution?"host":"browser",onChange:({target:{value:se}})=>z(Le=>({...Le,hostExecution:{...Le.hostExecution||{},preferHostExecution:se==="inherit"?void 0:se==="host"}})),children:[p.jsx("option",{value:"inherit",children:"Server default"}),p.jsx("option",{value:"browser",children:"Prefer browser"}),p.jsx("option",{value:"host",children:"Prefer API host"})]})]})]}),(fr||dr||B?.available)&&p.jsx(bf,{message:fr||dr||"FlexDoc API host is available.",capabilities:B?.capabilities,warning:!!fr||!za&&!Zr,theme:s,label:c?.hostExecutionStatus||"Host execution status"}),Nn?p.jsxs("button",{type:"button",onClick:Gt,className:"inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-md border border-red-500 px-4 py-2 font-medium text-red-600 sm:w-auto",children:[p.jsx(Ug,{className:"h-4 w-4"}),c?.cancelRequest||"Cancel request"]}):p.jsxs("button",{type:"button","data-api-client-send":"true",onClick:()=>{hr()},disabled:!Ua,"aria-keyshortcuts":"Control+Enter Meta+Enter",title:`${c?.sendRequest||"Send request"} (Ctrl/Cmd+Enter)`,className:"inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-md bg-blue-600 px-4 py-2 font-medium text-white hover:bg-blue-700 disabled:opacity-60 sm:w-auto",children:[p.jsx(aa,{className:"h-4 w-4"})," ",c?.sendRequest||"Send request"," ",p.jsx("span",{className:"text-xs font-normal opacity-80",children:"Ctrl/Cmd+Enter"})]}),G&&p.jsxs("div",{role:"alert",className:`flex gap-2 rounded-md border p-3 text-sm ${s==="dark"?"border-red-800 bg-red-950/40 text-red-200":"border-red-300 bg-red-50 text-red-700"}`,children:[p.jsx(kd,{className:"mt-0.5 h-4 w-4 shrink-0"}),G]}),Ne&&p.jsxs("div",{role:"alert",className:`flex gap-2 rounded-md border p-3 text-sm ${s==="dark"?"border-amber-800 bg-amber-950/40 text-amber-200":"border-amber-300 bg-amber-50 text-amber-800"}`,children:[p.jsx(kd,{className:"mt-0.5 h-4 w-4 shrink-0"}),Ne]}),ut&&p.jsx(JO,{response:ut,theme:s,curlCommand:Ce,advanced:a==="advanced"}),Ke.length>0&&p.jsxs("section",{className:"space-y-2","aria-labelledby":"api-client-test-results-heading",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("h3",{id:"api-client-test-results-heading",className:"font-semibold",children:"Test results"}),p.jsxs("span",{className:`text-xs ${je}`,children:[iu,"/",Ke.length," passed"]})]}),p.jsx("div",{className:"space-y-2",children:Ke.map((se,Le)=>p.jsxs("div",{className:`rounded-md border px-3 py-2 text-sm ${se.passed?s==="dark"?"border-green-800 bg-green-950/40 text-green-200":"border-green-300 bg-green-50 text-green-800":s==="dark"?"border-red-800 bg-red-950/40 text-red-200":"border-red-300 bg-red-50 text-red-800"}`,children:[p.jsxs("div",{className:"font-medium",children:[se.passed?"PASS":"FAIL"," — ",se.name]}),se.error&&p.jsx("div",{className:"mt-1 text-xs",children:se.error})]},`${se.name}:${Le}`))})]}),Et.length>0&&p.jsx(_r,{code:Et.join(`
|
|
75
|
+
`),language:"text",title:"Script console",theme:s,wrap:!0})]})})};function Wh(t,e){if(typeof window>"u")return;const n=new URL(window.location.href);e?n.searchParams.set(t,e):n.searchParams.delete(t),window.history.replaceState(null,"",`${n.pathname}${n.search}${n.hash}`)}function b3(t,e){return t==="scripts"||e?"advanced":typeof window>"u"?"basic":new URLSearchParams(window.location.search).get("density")==="advanced"?"advanced":"basic"}function e1(t,e){return JSON.stringify({request:t,scripts:e},(n,r)=>typeof File<"u"&&r instanceof File?{name:r.name,size:r.size,type:r.type,lastModified:r.lastModified}:r)}const x3=({spec:t,path:e,method:n,theme:r,options:s,initialRequestTab:a,initialScriptTab:c,onRequestChange:u,onOpenInApiClient:f})=>{const h=t.paths[e],b=h?.[n.toLowerCase()]?.servers||h?.servers||t.servers||[],v=s?.tryIt?.apiClientPersistenceKey??ly(t.info?.title,typeof window>"u"?void 0:window.location.host),w=I.useMemo(()=>{const ne={...q0(t,e,n),serverUrl:s?.tryIt?.defaultServer};return cC(t,e,n,ne,s?.tryIt?.defaultServer)},[n,s?.tryIt?.defaultServer,e,t]),A=I.useMemo(()=>wn(),[]),[C,O]=I.useState(()=>b3(a,c)),[D,E]=I.useState(w.request),[j,M]=I.useState(w.serverUrl),[_,q]=I.useState(A),[R,X]=I.useState(a||"params"),[U,B]=I.useState(c||"pre-request"),[K,W]=I.useState(()=>nl()),[ye,pe]=I.useState(v===!1),fe=s?.messages;I.useEffect(()=>{if(v===!1)return;let ne=!1;return hy(v).then(ke=>{ne||(W(ke),pe(!0))}).catch(()=>{ne||pe(!0)}),()=>{ne=!0}},[v]);const L=my(v,K,ye),Q=I.useMemo(()=>hf(K),[K]),oe=e1(D,_)!==e1(w.request,A),ce=C==="advanced",ve=r==="dark"?"border-gray-700 bg-gray-900/40 text-gray-100":"border-gray-200 bg-white text-gray-900",T=r==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",z=ne=>{O(ne),Wh("density",ne==="advanced"?"advanced":void 0)},he=()=>f?.({request:D,scripts:wn(_),serverUrl:j,requestTab:R,scriptTab:U});return p.jsxs("div",{className:"space-y-3","data-try-it-session":!0,children:[L&&p.jsx(bf,{message:"FlexDoc could not save environment changes to browser storage. They will be lost when the page is closed.",showCapabilities:!1,warning:!0,theme:r,label:"API Client storage status"}),p.jsxs("div",{className:`flex flex-wrap items-center justify-between gap-3 rounded-lg border p-2 ${ve}`,children:[p.jsxs("div",{className:"flex rounded-md border p-1",role:"group","aria-label":"Try It density",children:[p.jsx("button",{type:"button","aria-pressed":!ce,className:`rounded px-3 py-1.5 text-sm ${ce?"":"bg-blue-600 text-white"}`,onClick:()=>z("basic"),children:fe?.tryItBasic||"Basic"}),p.jsx("button",{type:"button","aria-pressed":ce,className:`rounded px-3 py-1.5 text-sm ${ce?"bg-blue-600 text-white":""}`,onClick:()=>z("advanced"),children:fe?.tryItAdvanced||"Advanced"})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[ce&&oe&&p.jsx("span",{"aria-label":"Unsaved Try It changes",className:"text-xs font-medium",children:fe?.unsavedChanges||"Unsaved changes"}),f&&p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-1.5 text-sm",onClick:he,children:[p.jsx(Td,{className:"h-4 w-4"}),fe?.openApiClient||"Open in API Client"]})]})]}),ce&&p.jsx("div",{className:`rounded-lg border p-3 ${ve}`,children:p.jsxs("label",{className:"flex flex-wrap items-center gap-2 text-sm font-medium",children:[p.jsx("span",{children:fe?.environment||"Environment"}),p.jsxs("select",{"aria-label":fe?.environment||"Try It environment",className:`min-w-48 rounded-md border px-2 py-1.5 text-sm ${T}`,value:K.activeEnvironmentId||"",onChange:ne=>W(ke=>({...ke,activeEnvironmentId:ne.target.value||void 0})),children:[p.jsx("option",{value:"",children:fe?.noEnvironment||"No environment"}),K.environments.map(ne=>p.jsx("option",{value:ne.id,children:ne.name},ne.id))]})]})}),p.jsx(Zv,{initialRequest:w.request,initialScripts:A,initialRequestTab:R,initialScriptTab:U,density:C,theme:r,messages:fe,credentials:s?.tryIt?.credentials||"same-origin",requestInterceptor:s?.tryIt?.requestInterceptor,hostExecution:s?.tryIt?.hostExecution,credentialStorage:K.credentialStorage||"remember",onCredentialStorageChange:ne=>W(ke=>({...ke,credentialStorage:ne})),environmentVariables:Q,serverOptions:b,initialServerUrl:w.serverUrl,onServerUrlChange:M,onRequestChange:u,onDraftChange:E,onScriptsChange:ne=>q(wn(ne)),onRequestTabChange:ne=>{X(ne),Wh("tab",ne)},onScriptTabChange:ne=>{B(ne),Wh("script",ne)},onEnvironmentChanges:ne=>W(ke=>pf(ke,ne))})]})};function Zh(t,e){const n=encodeURIComponent(t).replace(/%/g,"~");return`${e.trim().toLowerCase()}-${n}`}function v3(t,e){return`${e.trim().toLowerCase()}-${t.replace(/[^a-zA-Z0-9]+/g,"-").replace(/^-|-$/g,"")}`}const w3=["curl","javascript","python","go","java"];function S3(){if(typeof window>"u")return{tryIt:!1};const t=new URLSearchParams(window.location.search),e=t.get("tab"),n=t.get("script");return{tryIt:t.get("tryIt")==="1",requestTab:e&&/^(params|headers|authorization|body|scripts)$/.test(e)?e:void 0,scriptTab:n&&/^(pre-request|tests)$/.test(n)?n:void 0}}function A3(t,e){if(typeof window>"u")return;const n=new URL(window.location.href);e?n.searchParams.set(t,e):n.searchParams.delete(t),window.history.replaceState(null,"",`${n.pathname}${n.search}${n.hash}`)}const k3=({spec:t,path:e,method:n,theme:r="light",options:s={},defaultExpandedSections:a,runtimeSnapshot:c,onOpenInApiClient:u})=>{const f=S3(),h=a??nf(s.expand,s.expand===void 0?s.expandResponses:void 0),g=f.tryIt&&!h.includes("tryIt")?[...h,"tryIt"]:h,b=`${n}:${e}:${g.join("|")}`,[v,w]=I.useState(()=>({key:b,sections:new Set(g)})),A=v.key===b?v.sections:new Set(g),[C,O]=I.useState(s.codeSamples?.languages?.[0]||"curl"),[D,E]=I.useState(!1),j=I.useId().replace(/:/g,""),M=I.useRef({}),_=I.useMemo(()=>B0(t,e,n,q0(t,e,n)),[t,e,n]),[q,R]=I.useState(_),U=t.paths[e]?.[n.toLowerCase()],B=I.useMemo(()=>Mk(t,e,n),[t,e,n]),K=s.messages;if(I.useEffect(()=>{!f.tryIt||typeof document>"u"||requestAnimationFrame(()=>document.getElementById("tryIt-heading")?.scrollIntoView({block:"start"}))},[f.tryIt,n,e]),!U)return p.jsx("div",{className:"p-6",children:"Operation not found."});const W=r==="dark"?"text-gray-400":"text-gray-600",ye=r==="dark"?"border-gray-700 bg-gray-800/60":"border-gray-200 bg-white",pe=r==="dark"?"bg-gray-900 text-gray-100":"bg-white text-gray-900",fe=s.codeSamples?.languages?.length?s.codeSamples.languages:w3,L=U.security??t.security,Q={requiredPropsFirst:s.requiredPropsFirst,sortPropsAlphabetically:s.sortPropsAlphabetically},oe=r==="dark"?"bg-blue-950/60 text-blue-200":"bg-blue-100 text-blue-700",ce=r==="dark"?"bg-red-950/60 text-red-200":"bg-red-100 text-red-700",ve=r==="dark"?"bg-orange-950/60 text-orange-200":"bg-orange-100 text-orange-700",T=r==="dark"?"bg-gray-800 text-gray-200":"bg-gray-100 text-gray-700",z=Ce=>`${j}-code-tab-${Ce}`,he=`${j}-code-panel`,ne=Ce=>{const Oe=!A.has(Ce);w(G=>{const we=new Set(G.key===b?G.sections:g);return we.has(Ce)?we.delete(Ce):we.add(Ce),{key:b,sections:we}}),Ce==="tryIt"&&A3("tryIt",Oe?"1":void 0)},ke=(Ce,Oe,G)=>p.jsxs("section",{className:"mb-8","aria-labelledby":`${Oe}-heading`,children:[p.jsxs("button",{type:"button",id:`${Oe}-heading`,"aria-expanded":A.has(Oe),onClick:()=>ne(Oe),className:"mb-4 flex min-h-10 w-full items-center gap-2 text-left text-base font-semibold sm:text-lg",children:[A.has(Oe)?p.jsx(Bg,{className:"h-5 w-5 shrink-0"}):p.jsx($g,{className:"h-5 w-5 shrink-0"}),Ce]}),A.has(Oe)&&G]}),qe=Ce=>{O(Ce),M.current[Ce]?.focus()},$e=(Ce,Oe)=>{if(!/^(ArrowLeft|ArrowRight|Home|End)$/.test(Ce.key))return;Ce.preventDefault();const G=fe.indexOf(Oe),we=Ce.key==="Home"?fe[0]:Ce.key==="End"?fe[fe.length-1]:Ce.key==="ArrowRight"?fe[(G+1)%fe.length]:fe[(G-1+fe.length)%fe.length];qe(we)},Fe=async()=>{if(typeof window>"u"||typeof navigator>"u"||!navigator.clipboard)return;const Ce=new URL(window.location.href);Ce.hash=Zh(e,n),await navigator.clipboard.writeText(Ce.toString()),E(!0),window.setTimeout(()=>E(!1),1400)},Ye=U.requestBody?$n.isReference(U.requestBody)?$n.resolveReference(t,U.requestBody.$ref):U.requestBody:void 0,Ie=Object.entries(U).filter(([Ce])=>Ce.startsWith("x-")),ut=typeof s.theme=="object"?s.theme.methodColors?.[n.toLowerCase()]:void 0,Rt=c?.routes.some(Ce=>Ce.method===n.toUpperCase()&&Ce.path===e);return p.jsx("div",{lang:s.locale,className:`min-h-full ${pe}`,children:p.jsxs("article",{className:"mx-auto w-full max-w-6xl p-4 sm:p-6 lg:p-8",children:[p.jsxs("header",{className:"mb-8",children:[p.jsxs("div",{className:"mb-4 flex min-w-0 flex-wrap items-center gap-2 sm:gap-3",children:[p.jsx("span",{className:`shrink-0 rounded border px-2.5 py-1 text-xs font-bold sm:text-sm ${$n.getMethodColor(n,r)}`,style:{background:ut?.bg,borderColor:ut?.border},children:n.toUpperCase()}),p.jsx("code",{className:`min-w-0 max-w-full overflow-x-auto rounded px-2.5 py-1 font-mono text-sm sm:text-base ${r==="dark"?"bg-gray-800 text-blue-300":"bg-gray-100 text-gray-900"}`,children:e}),p.jsxs("button",{type:"button",className:"inline-flex min-h-9 items-center gap-1.5 rounded-md border px-2.5 py-1 text-xs","aria-label":"Copy endpoint link",onClick:()=>{Fe()},children:[D?p.jsx(qg,{className:"h-3.5 w-3.5"}):p.jsx(GA,{className:"h-3.5 w-3.5"}),D?"Copied":"Copy link"]})]}),U.summary&&p.jsx("h1",{className:"mb-2 text-2xl font-bold tracking-tight sm:text-3xl",children:U.summary}),U.description&&p.jsx("p",{className:`max-w-3xl whitespace-pre-wrap leading-relaxed ${W}`,children:U.description}),p.jsxs("div",{className:"mt-4 flex flex-wrap gap-3 text-sm",children:[U.deprecated&&p.jsxs("span",{className:r==="dark"?"inline-flex items-center gap-1 text-orange-300":"inline-flex items-center gap-1 text-orange-600",children:[p.jsx(kd,{className:"h-4 w-4"}),"Deprecated"]}),L?.length?p.jsxs("span",{className:r==="dark"?"inline-flex items-center gap-1 text-red-300":"inline-flex items-center gap-1 text-red-600",children:[p.jsx(QA,{className:"h-4 w-4"}),"Authentication required"]}):p.jsxs("span",{className:r==="dark"?"inline-flex items-center gap-1 text-green-300":"inline-flex items-center gap-1 text-green-600",children:[p.jsx(JA,{className:"h-4 w-4"}),"No authentication required"]}),c&&(Rt?p.jsx("span",{className:r==="dark"?"text-green-300":"text-green-600",children:"Observed at runtime"}):p.jsx("span",{className:c.discoveryComplete?r==="dark"?"text-amber-300":"text-amber-600":W,children:c.discoveryComplete?"Not found at runtime":"Not observed in partial runtime discovery"})),U.operationId&&p.jsxs("span",{className:W,children:["operationId: ",p.jsx("code",{children:U.operationId})]})]}),(s.showExtensions||s.showCommonExtensions)&&Ie.length>0&&p.jsx("div",{className:`mt-4 rounded-lg border p-3 text-xs ${ye}`,children:Ie.map(([Ce,Oe])=>p.jsxs("div",{children:[p.jsx("code",{children:Ce}),": ",typeof Oe=="string"?Oe:JSON.stringify(Oe)]},Ce))})]}),B.length>0&&ke(K?.parameters||"Parameters","parameters",p.jsx("div",{className:"space-y-3",children:B.map(Ce=>p.jsxs("div",{className:`rounded-lg border p-4 ${ye}`,children:[p.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-2",children:[p.jsx("code",{className:"font-medium",children:Ce.name}),p.jsx("span",{className:`rounded px-2 py-0.5 text-xs ${oe}`,children:Ce.in}),Ce.required&&p.jsx("span",{className:`rounded px-2 py-0.5 text-xs ${ce}`,children:"required"}),Ce.deprecated&&p.jsx("span",{className:`rounded px-2 py-0.5 text-xs ${ve}`,children:"deprecated"})]}),Ce.description&&p.jsx("p",{className:`mb-3 text-sm ${W}`,children:Ce.description}),Ce.schema&&p.jsx(Lr,{spec:t,schema:Ce.schema,theme:r,required:Ce.required,...Q})]},`${Ce.in}:${Ce.name}`))})),Ye&&ke(K?.requestBody||"Request Body","requestBody",p.jsxs("div",{className:"space-y-4",children:[Ye.description&&p.jsx("p",{className:W,children:Ye.description}),Object.entries(Ye.content||{}).map(([Ce,Oe])=>p.jsxs("div",{className:`rounded-lg border p-4 ${ye}`,children:[p.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[p.jsx("code",{className:`rounded px-2 py-1 text-xs ${T}`,children:Ce}),Ye.required&&p.jsx("span",{className:`rounded px-2 py-0.5 text-xs ${ce}`,children:"required"})]}),Oe.schema&&p.jsx(Lr,{spec:t,schema:Oe.schema,theme:r,...Q}),Oe.example!==void 0&&p.jsx("div",{className:"mt-3",children:p.jsx(_r,{code:JSON.stringify(Oe.example,null,2),language:"json",title:"Example payload",theme:r,wrap:!0})})]},Ce))]})),ke(K?.responses||"Responses","responses",p.jsx("div",{className:"space-y-4",children:Object.entries(U.responses||{}).map(([Ce,Oe])=>{const G=$n.isReference(Oe)?$n.resolveReference(t,Oe.$ref):Oe;return p.jsxs("div",{className:`rounded-lg border p-4 ${ye}`,children:[p.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[p.jsx("span",{className:"rounded border px-2.5 py-1 text-sm font-bold",children:Ce}),p.jsx("span",{className:`text-sm ${W}`,children:G.description})]}),G.headers&&s.showRequestHeaders&&p.jsxs("div",{className:"mb-3 text-sm",children:[p.jsx("span",{className:"font-medium",children:"Headers:"})," ",Object.keys(G.headers).join(", ")]}),G.content&&Object.entries(G.content).map(([we,Ne])=>{const De=Ne.examples&&Object.values(Ne.examples)[s.payloadSampleIdx||0];return p.jsxs("div",{className:"mt-3",children:[p.jsx("code",{className:`rounded px-1.5 py-0.5 text-xs ${T}`,children:we}),Ne.schema&&p.jsx("div",{className:"mt-2",children:p.jsx(Lr,{spec:t,schema:Ne.schema,theme:r,...Q})}),Ne.example!==void 0&&p.jsx("div",{className:"mt-3",children:p.jsx(_r,{code:JSON.stringify(Ne.example,null,2),language:"json",title:"Example response",theme:r,wrap:!0})}),De&&p.jsx("div",{className:"mt-3",children:p.jsx(_r,{code:JSON.stringify(De.value??De,null,2),language:"json",title:"Example response",theme:r,wrap:!0})})]},we)})]},Ce)})})),s.tryIt?.enabled!==!1&&ke(K?.tryIt||"Try It","tryIt",p.jsx(x3,{spec:t,path:e,method:n,theme:r,options:s,initialRequestTab:f.requestTab,initialScriptTab:f.scriptTab,onRequestChange:R,onOpenInApiClient:u},`${n}:${e}:${s.tryIt?.defaultServer||""}`)),s.codeSamples?.enabled!==!1&&ke(K?.codeExamples||"Code Examples","codeSamples",p.jsxs("div",{className:"min-w-0",children:[p.jsx("div",{className:"mb-3 flex max-w-full gap-1 overflow-x-auto pb-1",role:"tablist","aria-label":"Code example language",children:fe.map(Ce=>p.jsx("button",{ref:Oe=>{M.current[Ce]=Oe},id:z(Ce),type:"button",role:"tab","aria-controls":he,"aria-selected":C===Ce,tabIndex:C===Ce?0:-1,onClick:()=>qe(Ce),onKeyDown:Oe=>$e(Oe,Ce),className:`shrink-0 rounded-md px-3 py-2 text-sm ${C===Ce?"bg-blue-600 text-white":r==="dark"?"bg-gray-800 text-gray-200":"bg-gray-100 text-gray-700"}`,children:$0(Ce)},Ce))}),p.jsx("div",{role:"tabpanel",id:he,"aria-labelledby":z(C),children:p.jsx(_r,{code:_k(q,C),language:C==="curl"?"bash":C,title:$0(C),theme:r,wrap:!!(typeof s.theme=="object"&&s.theme.typography?.code?.wrap)})})]})),U.externalDocs&&p.jsx("p",{className:"pb-4 text-sm",children:p.jsx("a",{className:"text-blue-600 underline",href:U.externalDocs.url,target:"_blank",rel:"noopener noreferrer",children:U.externalDocs.description||"External documentation"})})]})})};function C3(t){const e=t?.["x-flexdoc-priority"]??t?.["x-flexdoc-weight"];return typeof e=="number"&&Number.isFinite(e)?e:0}function N3(t,e){let n=C3(t)*1e3;return t?.["x-flexdoc-highlight"]===!0&&(n+=1e5),t?.deprecated||(n+=100),t?.summary&&(n+=40),t?.description&&(n+=20),t?.operationId&&(n+=10),Array.isArray(t?.tags)&&t.tags.length>0&&(n+=5),e.toLowerCase()==="get"?n+=3:e.toLowerCase()==="post"&&(n+=2),n}function T3(t){let e=0;const n=[];for(const[r,s]of Object.entries(t.paths))for(const a of $n.getHttpMethods(s)){const c=s[a];n.push({path:r,method:a,operation:c,score:N3(c,a),order:e++})}return n.sort((r,s)=>s.score-r.score||r.order-s.order).slice(0,6)}const j3=({spec:t,onEndpointSelect:e,theme:n="light"})=>{const r=n==="dark",s=r?"border-gray-700 bg-gray-800 text-white shadow-lg":"border-gray-200 bg-white text-gray-900 shadow-sm",a=r?"text-gray-300":"text-gray-600",c=r?"hover:border-gray-600 hover:bg-gray-700":"hover:border-blue-300 hover:bg-blue-50",u=Object.values(t.paths).reduce((g,b)=>{for(const v of $n.getHttpMethods(b))g[v]=(g[v]||0)+1,g.total+=1;return g},{total:0}),f=T3(t),h=[{icon:Ig,title:"Total endpoints",value:u.total,surface:r?"bg-blue-900":"bg-blue-100",iconClass:r?"text-blue-300":"text-blue-600"},{icon:zg,title:"Servers",value:t.servers?.length||0,surface:r?"bg-green-900":"bg-green-100",iconClass:r?"text-green-300":"text-green-600"},{icon:Vg,title:"Tags",value:t.tags?.length||0,surface:r?"bg-purple-900":"bg-purple-100",iconClass:r?"text-purple-300":"text-purple-600"},{icon:nk,title:"Security schemes",value:t.components?.securitySchemes?Object.keys(t.components.securitySchemes).length:0,surface:r?"bg-orange-900":"bg-orange-100",iconClass:r?"text-orange-300":"text-orange-600"}];return p.jsx("div",{className:`flex-1 overflow-y-auto ${r?"bg-gray-900":"bg-gray-50"}`,children:p.jsxs("div",{className:"p-4 md:p-8",children:[p.jsxs("header",{className:"mb-8",children:[p.jsxs("div",{className:"mb-4 flex items-center gap-4",children:[p.jsx("div",{className:`flex h-12 w-12 items-center justify-center rounded-xl ${r?"bg-blue-700":"bg-gradient-to-br from-blue-500 to-blue-600"}`,children:p.jsx(Ig,{className:"h-6 w-6 text-white"})}),p.jsxs("div",{className:"min-w-0",children:[p.jsx("h1",{className:`truncate text-2xl font-bold md:text-3xl ${r?"text-white":"text-gray-900"}`,children:t.info.title}),p.jsxs("p",{className:a,children:["Version ",t.info.version]})]})]}),t.info.description&&p.jsx("p",{className:`max-w-4xl text-lg leading-relaxed ${a}`,children:t.info.description})]}),p.jsx("div",{className:"mb-8 grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4",children:h.map(({icon:g,title:b,value:v,surface:w,iconClass:A})=>p.jsx("div",{className:`rounded-xl border p-4 ${s}`,children:p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("div",{className:`flex h-10 w-10 items-center justify-center rounded-lg ${w}`,children:p.jsx(g,{className:`h-5 w-5 ${A}`})}),p.jsxs("div",{children:[p.jsx("p",{className:`text-sm font-medium ${a}`,children:b}),p.jsx("p",{className:"text-xl font-bold",children:v})]})]})},b))}),p.jsxs("section",{className:`mb-8 rounded-xl border p-4 md:p-6 ${s}`,"aria-labelledby":"method-distribution-heading",children:[p.jsx("h2",{id:"method-distribution-heading",className:"mb-4 text-lg font-semibold md:text-xl",children:"HTTP method distribution"}),p.jsx("div",{className:"grid grid-cols-2 gap-4 md:grid-cols-4 lg:grid-cols-6",children:["get","post","put","delete","patch","options"].map(g=>p.jsxs("div",{className:"text-center",children:[p.jsx("div",{className:`mx-auto mb-2 flex items-center justify-center rounded-lg px-3 py-1.5 ${$n.getMethodColor(g,n)}`,children:p.jsx("span",{className:"text-sm font-medium",children:g.toUpperCase()})}),p.jsx("p",{className:"font-bold",children:u[g]||0})]},g))})]}),p.jsxs("section",{className:`mb-8 rounded-xl border p-4 md:p-6 ${s}`,"aria-labelledby":"endpoint-highlights-heading",children:[p.jsxs("div",{className:"mb-4",children:[p.jsx("h2",{id:"endpoint-highlights-heading",className:"text-lg font-semibold md:text-xl",children:"Endpoint highlights"}),p.jsx("p",{className:`mt-1 text-xs ${a}`,children:"Prioritized by explicit FlexDoc metadata when supplied, then by documentation completeness. This is not usage analytics."})]}),p.jsxs("div",{className:"space-y-3",children:[f.map(({path:g,method:b,operation:v})=>p.jsxs("button",{type:"button",onClick:()=>e(g,b),className:`w-full rounded-lg border p-3 text-left transition-colors ${c} ${r?"border-gray-700":"border-gray-200"}`,children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsx("span",{className:`rounded border px-2 py-1 text-xs font-bold ${$n.getMethodColor(b,n)}`,children:b.toUpperCase()}),p.jsx("code",{className:`break-all font-mono text-sm ${r?"text-blue-300":"text-blue-600"}`,children:g})]}),v?.summary&&p.jsx("p",{className:`ml-14 mt-2 text-sm ${a}`,children:v.summary})]},`${b}-${g}`)),f.length===0&&p.jsx("p",{className:`py-4 text-sm ${a}`,children:"No operations are defined in this specification."})]})]}),p.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(t.info.contact||t.info.license)&&p.jsxs("section",{className:`rounded-xl border p-4 md:p-6 ${s}`,"aria-labelledby":"api-information-heading",children:[p.jsx("h2",{id:"api-information-heading",className:"mb-4 text-lg font-semibold md:text-xl",children:"Information"}),p.jsxs("div",{className:"space-y-4",children:[t.info.contact&&p.jsxs("div",{children:[p.jsx("h3",{className:"mb-2 font-medium",children:"Contact"}),t.info.contact.name&&p.jsx("p",{className:`text-sm ${a}`,children:t.info.contact.name}),t.info.contact.email&&p.jsx("a",{className:`block text-sm underline ${r?"text-blue-300":"text-blue-600"}`,href:`mailto:${t.info.contact.email}`,children:t.info.contact.email}),t.info.contact.url&&p.jsxs("a",{href:t.info.contact.url,target:"_blank",rel:"noopener noreferrer",className:`inline-flex items-center gap-1 text-sm ${r?"text-blue-300":"text-blue-600"}`,children:["Website ",p.jsx(Td,{className:"h-3 w-3"})]})]}),t.info.license&&p.jsxs("div",{children:[p.jsx("h3",{className:"mb-2 font-medium",children:"License"}),t.info.license.url?p.jsxs("a",{href:t.info.license.url,target:"_blank",rel:"noopener noreferrer",className:`inline-flex items-center gap-1 text-sm ${r?"text-blue-300":"text-blue-600"}`,children:[t.info.license.name,p.jsx(Td,{className:"h-3 w-3"})]}):p.jsx("p",{className:`text-sm ${a}`,children:t.info.license.name})]})]})]}),t.servers&&t.servers.length>0&&p.jsxs("section",{className:`rounded-xl border p-4 md:p-6 ${s}`,"aria-labelledby":"api-servers-heading",children:[p.jsx("h2",{id:"api-servers-heading",className:"mb-4 text-lg font-semibold md:text-xl",children:"Servers"}),p.jsx("div",{className:"space-y-3",children:t.servers.map((g,b)=>p.jsxs("div",{className:`rounded-lg p-3 ${r?"bg-gray-700/50":"bg-gray-50"}`,children:[p.jsx("code",{className:`break-all font-mono text-sm ${r?"text-blue-300":"text-blue-600"}`,children:g.url}),g.description&&p.jsx("p",{className:`mt-1 text-sm ${a}`,children:g.description})]},`${g.url}:${b}`))})]})]})]})})};var t1={commit:"unknown"};const E3=typeof t1>"u"?{commit:"unknown"}:t1,O3=({footerClasses:t,footer:e})=>{const n=e?.copyright,r=e?.link||[],s=E3,a=e?.showBuildInfo!==!1&&s.commit!=="unknown";return p.jsx("footer",{className:`${t} w-full border-t`,children:p.jsxs("div",{className:"mx-auto flex min-h-12 w-full max-w-[1600px] flex-col gap-2 px-4 py-3 text-xs sm:flex-row sm:items-center sm:justify-between sm:px-6 sm:text-sm",children:[p.jsxs("p",{children:[n||p.jsxs(p.Fragment,{children:["Powered by ",p.jsx("a",{href:"https://flexdoc.prauga.com",target:"_blank",rel:"noopener noreferrer",className:"font-semibold hover:opacity-80 transition-opacity",children:"FlexDoc"})]}),a]}),r.length>0&&p.jsx("nav",{"aria-label":"Footer links",className:"flex flex-wrap gap-x-4 gap-y-2",children:r.map(c=>p.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"hover:opacity-80",children:c.text},`${c.text}:${c.url}`))})]})})},M3=(t,e,n)=>t==="dark"?n:e,R3="Runtime intelligence returned an invalid snapshot.",D3=new Set(["runtime.operation-undocumented","runtime.operation-unobserved","runtime.method-mismatch","runtime.duplicate-operation"]),_3=new Set(["error","warning","info"]),L3=new Set(["pass","warn","fail","partial"]);function sn(){throw new Error(R3)}function Qi(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function zn(t,e){const n=t[e];return(typeof n!="string"||n.trim()==="")&&sn(),n}function ep(t,e){const n=t[e];if(n!==void 0)return(typeof n!="string"||n.trim()==="")&&sn(),n}function n1(t,e){const n=t[e];if(n!==void 0){if(typeof n=="string"&&n.trim()!=="")return n;if(Array.isArray(n)&&n.length>0&&n.every(r=>typeof r=="string"&&r.trim()!==""))return[...n];sn()}}function cr(t,e){const n=t[e];return(typeof n!="number"||!Number.isInteger(n)||n<0)&&sn(),n}function q3(t){return Qi(t)||sn(),{method:zn(t,"method"),path:zn(t,"path")}}function tp(t){return Array.isArray(t)||sn(),t.map(q3)}function B3(t){(!Qi(t)||!Qi(t.location))&&sn();const e=zn(t,"code"),n=zn(t,"severity");(!D3.has(e)||!_3.has(n)||t.location.kind!=="operation")&&sn();const r={id:zn(t,"id"),code:e,severity:n,location:{kind:"operation",path:zn(t.location,"path")},message:zn(t,"message")},s=ep(t.location,"method");s&&(r.location.method=s);const a=n1(t,"expected");a!==void 0&&(r.expected=a);const c=n1(t,"observed");return c!==void 0&&(r.observed=c),r}function $3(t){(!Qi(t)||!Qi(t.summary)||!Array.isArray(t.findings)||typeof t.complete!="boolean")&&sn();const e=zn(t,"status");L3.has(e)||sn();const n=t.findings.map(B3),r={total:cr(t.summary,"total"),errors:cr(t.summary,"errors"),warnings:cr(t.summary,"warnings"),info:cr(t.summary,"info")},s={total:n.length,errors:n.filter(c=>c.severity==="error").length,warnings:n.filter(c=>c.severity==="warning").length,info:n.filter(c=>c.severity==="info").length};JSON.stringify(r)!==JSON.stringify(s)&&sn();const a=r.errors>0?"fail":r.warnings>0?"warn":t.complete?"pass":"partial";return e!==a&&sn(),{status:e,complete:t.complete,findings:n,summary:r}}function I3(t){Qi(t)||sn(),(!Qi(t.runtime)||!Qi(t.summary))&&sn(),typeof t.discoveryComplete!="boolean"&&sn();const e={name:zn(t.runtime,"name"),version:zn(t.runtime,"version"),platform:zn(t.runtime,"platform"),arch:zn(t.runtime,"arch")},n={documented:cr(t.summary,"documented"),runtime:cr(t.summary,"runtime"),matched:cr(t.summary,"matched"),runtimeOnly:cr(t.summary,"runtimeOnly"),documentedOnly:cr(t.summary,"documentedOnly")},r={framework:zn(t,"framework"),runtime:e,discoveryComplete:t.discoveryComplete,routes:tp(t.routes),runtimeOnly:tp(t.runtimeOnly),documentedOnly:tp(t.documentedOnly),summary:n},s=ep(t,"frameworkVersion");s&&(r.frameworkVersion=s);const a=ep(t,"serverOrigin");if(a&&(r.serverOrigin=a),t.server!==void 0){Qi(t.server)||sn();const c=t.server.localPort;c!==void 0&&(typeof c!="number"||!Number.isInteger(c)||c<=0||c>65535)&&sn(),r.server=c===void 0?{}:{localPort:c}}return t.environment!==void 0&&(Qi(t.environment)||sn(),r.environment={name:zn(t.environment,"name")}),t.validation!==void 0&&(r.validation=$3(t.validation)),r}const H3=60;function z3(t,e,n=H3){const r=Math.max(0,Math.min(Math.max(0,e-20),Math.max(0,t-n)));return{start:r,end:Math.min(t,r+n)}}const np=44;function U3(t){return Array.from(t.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])'))}const V3=({spec:t,theme:e,onEndpointSelect:n,onHome:r,onOpenSettings:s,onOpenApiClient:a,onOpenRuntime:c,onSendCurrent:u,messages:f})=>{const[h,g]=I.useState(!1),[b,v]=I.useState(""),[w,A]=I.useState(0),C=I.useRef(null),O=I.useRef(null),D=I.useRef([]),E=h&&typeof document<"u"&&Array.from(document.querySelectorAll('[data-api-client-send="true"]')).some(ye=>!ye.closest(".hidden")),j=I.useMemo(()=>{const ye=[{id:"overview",label:f?.openOverview||"Open Overview",action:r},{id:"api-client",label:f?.openApiClient||"Open API Client",action:a},...c?[{id:"runtime",label:f?.openRuntime||"Open Runtime Intelligence",action:c}]:[],{id:"settings",label:f?.openSettings||"Open Viewer Settings",action:s},...u&&E?[{id:"send-current",label:f?.sendCurrentRequest||"Send current request",action:u}]:[]];for(const[pe,fe]of Object.entries(t.paths))for(const L of $n.getHttpMethods(fe))ye.push({id:`operation:${L}:${pe}`,label:`${L.toUpperCase()} ${pe}`,action:()=>n(pe,L)});return ye},[E,f?.openApiClient,f?.openOverview,f?.openRuntime,f?.openSettings,f?.sendCurrentRequest,n,r,a,c,s,u,t]),M=b.trim().toLowerCase(),_=I.useMemo(()=>M?j.filter(ye=>ye.label.toLowerCase().includes(M)):j,[j,M]),{start:q,end:R}=z3(_.length,w),X=_.slice(q,R),U=I.useCallback(()=>{g(!1),v(""),A(0)},[]),B=I.useCallback(ye=>{ye&&(U(),ye.action())},[U]);if(I.useEffect(()=>{const ye=pe=>{!(pe.ctrlKey||pe.metaKey)||pe.key.toLowerCase()!=="k"||(pe.preventDefault(),g(fe=>!fe))};return document.addEventListener("keydown",ye),()=>document.removeEventListener("keydown",ye)},[]),I.useEffect(()=>{if(!h||typeof document>"u")return;const ye=document.activeElement instanceof HTMLElement?document.activeElement:null,pe=document.body.style.overflow;document.body.style.overflow="hidden",requestAnimationFrame(()=>O.current?.focus());const fe=L=>{if(L.key==="Escape"){L.preventDefault(),U();return}if(L.key==="ArrowDown"||L.key==="ArrowUp"||L.key==="Home"||L.key==="End"){L.preventDefault(),A(T=>!_.length||L.key==="Home"?0:L.key==="End"?_.length-1:L.key==="ArrowDown"?(T+1)%_.length:(T-1+_.length)%_.length);return}if(L.key==="Enter"){L.preventDefault(),B(_[w]);return}if(L.key!=="Tab"||!C.current)return;const Q=U3(C.current);if(!Q.length)return;const oe=Q[0],ce=Q[Q.length-1],ve=document.activeElement;L.shiftKey&&(ve===oe||!C.current.contains(ve))?(L.preventDefault(),ce.focus()):!L.shiftKey&&(ve===ce||!C.current.contains(ve))&&(L.preventDefault(),oe.focus())};return document.addEventListener("keydown",fe),()=>{document.body.style.overflow=pe,document.removeEventListener("keydown",fe),ye?.isConnected&&ye.focus()}},[w,B,U,h,_]),I.useEffect(()=>{D.current[w]?.scrollIntoView({block:"nearest"})},[w]),!h)return null;const K=e==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900",W=e==="dark"?"bg-blue-950/70 text-blue-100":"bg-blue-50 text-blue-900";return p.jsxs("div",{className:"fixed inset-0 z-[80]",children:[p.jsx("button",{type:"button","aria-label":f?.closeCommandPalette||"Close command palette",className:"absolute inset-0 bg-black/40",onClick:U}),p.jsxs("div",{ref:C,role:"dialog","aria-modal":"true","aria-label":f?.commandPalette||"Command palette",className:`relative mx-auto mt-[10vh] w-[min(94vw,56rem)] overflow-hidden rounded-xl border shadow-2xl ${K}`,children:[p.jsx("input",{ref:O,"aria-label":f?.searchCommands||"Search commands",className:"w-full border-b bg-transparent p-3 text-sm outline-none",placeholder:f?.searchCommandsPlaceholder||"Search operations and commands…",value:b,onChange:ye=>{v(ye.target.value),A(0)}}),p.jsxs("div",{className:"max-h-[60vh] overflow-y-auto p-2",role:"listbox","aria-label":f?.commandResults||"Command results",children:[q>0&&p.jsx("div",{"aria-hidden":"true",style:{height:q*np}}),X.map((ye,pe)=>{const fe=q+pe;return p.jsx("button",{ref:L=>{D.current[fe]=L},type:"button",role:"option","aria-selected":fe===w,"aria-posinset":fe+1,"aria-setsize":_.length,className:`w-full rounded-md p-2 text-left text-sm ${fe===w?W:""}`,style:{height:np,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},onMouseEnter:()=>A(fe),onClick:()=>B(ye),children:ye.label},ye.id)}),R<_.length&&p.jsx("div",{"aria-hidden":"true",style:{height:(_.length-R)*np}}),!_.length&&p.jsx("div",{className:"p-3 text-sm opacity-65",children:f?.noCommandResults||"No matching commands."})]})]})]})},F3={parameters:"Parameters",requestBody:"Request body",responses:"Responses",tryIt:"Try It",codeSamples:"Code examples"};function P3(t){return t===void 0?"host":Array.isArray(t)?"custom":t==="none"?"minimal":t}function Y3(t){return Array.from(t.querySelectorAll('button:not([disabled]), select:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')).filter(e=>e.getAttribute("aria-hidden")!=="true")}const K3=({open:t,theme:e,hostTheme:n,manageTheme:r,viewerTheme:s,viewerExpand:a,effectiveExpandedSections:c,messages:u,onThemeChange:f,onExpandChange:h,onClose:g})=>{const b=I.useRef(null),v=I.useRef(null);if(I.useEffect(()=>{if(!t||typeof document>"u")return;const D=document.activeElement instanceof HTMLElement?document.activeElement:null;v.current?.focus();const E=j=>{if(j.key==="Escape"){j.preventDefault(),g();return}if(j.key!=="Tab"||!b.current)return;const M=Y3(b.current);if(M.length===0){j.preventDefault(),b.current.focus();return}const _=M[0],q=M[M.length-1],R=document.activeElement;j.shiftKey&&(R===_||!b.current.contains(R))?(j.preventDefault(),q.focus()):!j.shiftKey&&(R===q||!b.current.contains(R))&&(j.preventDefault(),_.focus())};return document.addEventListener("keydown",E),()=>{document.removeEventListener("keydown",E),D?.isConnected&&D.focus()}},[t,g]),!t)return null;const w=e==="dark",A=w?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900",C=w?"border-gray-700 bg-gray-800 text-gray-100":"border-gray-300 bg-white text-gray-900",O=Array.isArray(a)?a.filter(D=>Ns.includes(D)):[];return p.jsxs("div",{className:"fixed inset-0 z-[70]",children:[p.jsx("button",{type:"button","aria-label":"Close settings backdrop",className:"absolute inset-0 bg-black/40",onClick:g}),p.jsxs("aside",{ref:b,role:"dialog","aria-modal":"true","aria-label":"Viewer settings",tabIndex:-1,className:`absolute inset-y-0 right-0 flex w-[min(92vw,24rem)] flex-col border-l shadow-2xl ${A}`,children:[p.jsxs("div",{className:"flex min-h-14 items-center justify-between border-b px-4",children:[p.jsxs("div",{children:[p.jsx("div",{className:"font-semibold",children:"Settings"}),p.jsx("div",{className:"text-xs opacity-65",children:"Preferences are saved for this documentation."})]}),p.jsx("button",{type:"button","aria-label":"Close settings",className:"inline-flex h-11 w-11 items-center justify-center rounded-md",onClick:g,children:p.jsx(Md,{className:"h-5 w-5"})})]}),p.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto p-4",children:[r&&p.jsxs("section",{"aria-labelledby":"appearance-settings-heading",children:[p.jsx("h2",{id:"appearance-settings-heading",className:"mb-1 text-sm font-semibold",children:u?.viewerTheme||"Appearance"}),p.jsx("p",{className:"mb-3 text-xs opacity-65",children:"Override the documentation host theme on this device."}),p.jsxs("select",{"aria-label":u?.viewerTheme||"Viewer theme",className:`w-full rounded-md border px-3 py-2 text-sm ${C}`,value:s||"host",onChange:D=>f(D.target.value==="host"?void 0:D.target.value),children:[p.jsxs("option",{value:"host",children:["Use documentation default (",n,")"]}),p.jsx("option",{value:"light",children:u?.lightTheme||"Light"}),p.jsx("option",{value:"dark",children:u?.darkTheme||"Dark"}),p.jsx("option",{value:"high-contrast",children:u?.highContrast||"High contrast"})]})]}),p.jsxs("section",{"aria-labelledby":"expansion-settings-heading",children:[p.jsx("h2",{id:"expansion-settings-heading",className:"mb-1 text-sm font-semibold",children:"Default expanded sections"}),p.jsx("p",{className:"mb-3 text-xs opacity-65",children:"This preference overrides the documentation author's default. Opening or closing a section manually remains temporary."}),p.jsxs("select",{ref:v,"aria-label":"Default expanded sections",className:`w-full rounded-md border px-3 py-2 text-sm ${C}`,value:P3(a),onChange:D=>{const E=D.target.value;h(E==="host"?void 0:E==="custom"?[...c]:E)},children:[p.jsx("option",{value:"host",children:"Use documentation default"}),p.jsx("option",{value:"minimal",children:"Minimal"}),p.jsx("option",{value:"documentation",children:"Documentation"}),p.jsx("option",{value:"interactive",children:"Interactive"}),p.jsx("option",{value:"all",children:"All sections"}),p.jsx("option",{value:"custom",children:"Custom sections"})]}),Array.isArray(a)&&p.jsxs("fieldset",{className:"mt-4 space-y-2",children:[p.jsx("legend",{className:"mb-2 text-xs font-medium uppercase tracking-wide opacity-65",children:"Custom sections"}),Ns.map(D=>p.jsxs("label",{className:"flex min-h-9 items-center gap-2 text-sm",children:[p.jsx("input",{type:"checkbox",checked:O.includes(D),onChange:E=>{const j=new Set(O);E.target.checked?j.add(D):j.delete(D),h(Ns.filter(M=>j.has(M)))}}),F3[D]]},D))]}),a!==void 0&&p.jsx("button",{type:"button",className:"mt-5 rounded-md border px-3 py-2 text-sm",onClick:()=>h(void 0),children:"Reset to documentation defaults"})]})]})]})]})};function G3(t){return Array.from(t.querySelectorAll('button:not([disabled]), select:not([disabled]), input:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])')).filter(e=>e.getAttribute("aria-hidden")!=="true")}const X3=({open:t,theme:e,loading:n,error:r,snapshot:s,onClose:a,onEndpointSelect:c,messages:u})=>{const f=I.useRef(null),h=I.useRef(null);if(I.useEffect(()=>{if(!t||typeof document>"u")return;const O=document.activeElement instanceof HTMLElement?document.activeElement:null,D=document.body.style.overflow;document.body.style.overflow="hidden",h.current?.focus();const E=j=>{if(j.key==="Escape"){j.preventDefault(),a();return}if(j.key!=="Tab"||!f.current)return;const M=G3(f.current);if(M.length===0){j.preventDefault(),f.current.focus();return}const _=M[0],q=M[M.length-1],R=document.activeElement;j.shiftKey&&(R===_||!f.current.contains(R))?(j.preventDefault(),q.focus()):!j.shiftKey&&(R===q||!f.current.contains(R))&&(j.preventDefault(),_.focus())};return document.addEventListener("keydown",E),()=>{document.body.style.overflow=D,document.removeEventListener("keydown",E),O?.isConnected&&O.focus()}},[t,a]),!t)return null;const g=e==="dark",b=g?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900",v=g?"text-gray-400":"text-gray-600",w=g?"border-red-800 bg-red-950/50 text-red-200":"border-red-300 bg-red-50 text-red-800",A=g?"border-amber-700 bg-amber-950/50 text-amber-200":"border-amber-300 bg-amber-50 text-amber-900",C=g?"text-green-300":"text-green-700";return p.jsxs("div",{className:"fixed inset-0 z-50",children:[p.jsx("button",{tabIndex:-1,className:"absolute inset-0 bg-black/40","aria-label":u?.closeRuntimeIntelligence||"Close runtime intelligence",onClick:a}),p.jsxs("section",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":"runtime-intelligence-heading",tabIndex:-1,className:`absolute inset-y-0 right-0 w-[min(92vw,32rem)] overflow-y-auto border-l p-5 shadow-2xl ${b}`,children:[p.jsxs("div",{className:"mb-5 flex items-start justify-between gap-4",children:[p.jsxs("div",{children:[p.jsxs("div",{id:"runtime-intelligence-heading",className:"flex items-center gap-2 text-lg font-semibold",children:[p.jsx(Lg,{className:"h-5 w-5"}),u?.runtimeIntelligence||"Runtime intelligence"]}),p.jsx("p",{className:`mt-1 text-sm ${v}`,children:u?.runtimeIntelligenceDescription||"Live route presence and backend context from the service hosting this documentation."})]}),p.jsx("button",{ref:h,className:"inline-flex h-10 w-10 items-center justify-center rounded-md border","aria-label":u?.closeRuntimeIntelligencePanel||"Close runtime intelligence panel",onClick:a,children:p.jsx(Md,{className:"h-4 w-4"})})]}),n&&p.jsx("p",{className:v,children:u?.inspectingRuntimeRoutes||"Inspecting runtime routes…"}),r&&p.jsx("div",{role:"alert",className:`rounded-lg border p-3 text-sm ${w}`,children:r}),s&&p.jsxs("div",{className:"space-y-5",children:[p.jsxs("div",{className:"grid grid-cols-2 gap-3 text-sm",children:[p.jsxs("div",{className:"rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.framework||"Framework"}),p.jsxs("div",{className:"font-semibold",children:[s.framework,s.frameworkVersion?` ${s.frameworkVersion}`:""]})]}),p.jsxs("div",{className:"rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.matched||"Matched"}),p.jsxs("div",{className:"font-semibold",children:[s.summary.matched," / ",s.summary.documented]})]}),p.jsxs("div",{className:"col-span-2 rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.runtime||"Runtime"}),p.jsxs("div",{className:"font-semibold",children:[s.runtime.name," ",s.runtime.version]}),p.jsxs("div",{className:`mt-1 text-xs ${v}`,children:[s.runtime.platform," · ",s.runtime.arch]})]}),s.validation&&p.jsxs("div",{className:"col-span-2 rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.contractValidation||"Contract validation"}),p.jsxs("div",{className:"font-semibold",children:[s.validation.status.toUpperCase()," · ",s.validation.summary.total," ",s.validation.summary.total===1?"finding":"findings"]}),p.jsxs("div",{className:`mt-1 text-xs ${v}`,children:[s.validation.summary.errors," errors · ",s.validation.summary.warnings," warnings · ",s.validation.summary.info," info"]})]}),(s.serverOrigin||s.server?.localPort)&&p.jsxs("div",{className:"col-span-2 rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.runtimeServer||"Runtime server"}),s.serverOrigin&&p.jsx("code",{className:"block break-all text-xs",children:s.serverOrigin}),s.server?.localPort&&p.jsxs("div",{className:`mt-1 text-xs ${v}`,children:[u?.backendListenerPort||"Backend listener port"," ",s.server.localPort]})]}),s.environment?.name&&p.jsxs("div",{className:"col-span-2 rounded-lg border p-3",children:[p.jsx("div",{className:v,children:u?.environment||"Environment"}),p.jsx("div",{className:"font-semibold",children:s.environment.name})]})]}),!s.discoveryComplete&&p.jsxs("div",{className:`flex gap-2 rounded-lg border p-3 text-sm ${A}`,children:[p.jsx(Od,{className:"mt-0.5 h-4 w-4 shrink-0"}),u?.routeDiscoveryPartial||"Route discovery is partial; documented routes not observed at runtime may be false positives."]}),s.validation?p.jsx(J3,{result:s.validation,theme:e,messages:u,onSelect:c?O=>{O.location.method&&(c(O.location.path,O.location.method),a())}:void 0}):p.jsxs(p.Fragment,{children:[p.jsx(r1,{title:u?.implementedButUndocumented||"Implemented but undocumented",routes:s.runtimeOnly,empty:u?.noUndocumentedRuntimeRoutes||"No undocumented runtime routes discovered.",theme:e,warning:!0,openLabel:u?.openRuntimeRoute||"Open runtime route"}),p.jsx(r1,{title:u?.documentedButNotObserved||"Documented but not observed",routes:s.documentedOnly,empty:u?.everyDocumentedRouteObserved||"Every documented route was observed.",theme:e,openLabel:u?.openRuntimeRoute||"Open runtime route",onSelect:c?O=>{c(O.path,O.method),a()}:void 0})]}),s.validation?.status==="pass"&&p.jsxs("div",{className:`flex items-center gap-2 text-sm ${C}`,children:[p.jsx(la,{className:"h-4 w-4"}),u?.contractValidationPass||"The running backend matches the OpenAPI contract for all validated checks."]}),!s.validation&&s.summary.runtimeOnly===0&&s.summary.documentedOnly===0&&s.discoveryComplete&&p.jsxs("div",{className:`flex items-center gap-2 text-sm ${C}`,children:[p.jsx(la,{className:"h-4 w-4"}),u?.runtimeAligned||"Runtime routes and OpenAPI paths are aligned."]})]})]})]})};function J3({result:t,theme:e,messages:n,onSelect:r}){const a=e==="dark"?"text-gray-400":"text-gray-600",c=n?.contractValidation||"Contract validation";return p.jsxs("section",{children:[p.jsxs("h3",{className:"mb-2 font-semibold",children:[c," ",p.jsxs("span",{className:a,children:["(",t.findings.length,")"]})]}),t.findings.length?p.jsx("div",{className:"space-y-2",children:t.findings.map(u=>{const f=u.code==="runtime.operation-unobserved"||u.code==="runtime.method-mismatch",h=!!(r&&f&&u.location.method),g=p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"flex gap-2 text-sm",children:[p.jsx("span",{className:"w-14 shrink-0 font-semibold",children:u.severity.toUpperCase()}),p.jsx("code",{className:"break-all",children:u.code})]}),p.jsx("div",{className:`mt-1 text-xs ${a}`,children:u.message}),(u.expected!==void 0||u.observed!==void 0)&&p.jsxs("div",{className:`mt-1 text-xs ${a}`,children:[u.expected!==void 0&&p.jsxs("div",{children:[n?.validationExpected||"Expected",": ",i1(u.expected)]}),u.observed!==void 0&&p.jsxs("div",{children:[n?.validationObserved||"Observed",": ",i1(u.observed)]})]})]});return h?p.jsx("button",{type:"button","aria-label":`${n?.openRuntimeRoute||"Open documented operation"} ${u.location.method} ${u.location.path}`,className:"w-full rounded border p-2 text-left",onClick:()=>r?.(u),children:g},u.id):p.jsx("div",{className:"rounded border p-2",children:g},u.id)})}):p.jsx("p",{className:`text-sm ${a}`,children:n?.contractValidationPass||"No contract mismatches detected."})]})}function i1(t){return Array.isArray(t)?t.join(", "):t}function r1({title:t,routes:e,empty:n,theme:r,warning:s=!1,onSelect:a,openLabel:c="Open runtime route"}){const u=r==="dark",f=u?"text-gray-400":"text-gray-600",h=s?u?"border-amber-700":"border-amber-300":"";return p.jsxs("section",{children:[p.jsxs("h3",{className:"mb-2 font-semibold",children:[t," ",p.jsxs("span",{className:f,children:["(",e.length,")"]})]}),e.length?p.jsx("div",{className:"space-y-2",children:e.map(g=>a?p.jsxs("button",{type:"button","aria-label":`${c} ${g.method} ${g.path}`,className:`flex w-full gap-2 rounded border p-2 text-left text-sm transition hover:border-blue-500 hover:bg-blue-500/10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ${h}`,onClick:()=>a(g),children:[p.jsx("span",{className:"w-14 shrink-0 font-semibold",children:g.method}),p.jsx("code",{className:"break-all",children:g.path})]},`${g.method}:${g.path}`):p.jsxs("div",{className:`flex gap-2 rounded border p-2 text-sm ${h}`,children:[p.jsx("span",{className:"w-14 shrink-0 font-semibold",children:g.method}),p.jsx("code",{className:"break-all",children:g.path})]},`${g.method}:${g.path}`))}):p.jsx("p",{className:`text-sm ${f}`,children:n})]})}function Q3({className:t="h-8 w-8"}){return p.jsxs("svg",{"aria-hidden":"true",viewBox:"0 0 512 512",className:t,children:[p.jsx("rect",{width:"512",height:"512",rx:"115",fill:"white"}),p.jsx("path",{d:"M397 130.546C397 136.784 392.409 141.84 386.745 141.84H196.951C191.287 141.84 186.696 146.896 186.696 153.134L186.692 239.516C186.692 245.754 191.283 250.811 196.947 250.811H315.049C320.712 250.811 325.303 255.867 325.303 262.105V317.357C325.303 323.594 320.712 328.651 315.049 328.651H196.951C191.288 328.651 186.696 333.707 186.696 339.944L186.692 436.706C186.692 442.944 182.101 448 176.438 448H125.255C119.591 448 115 442.943 115 436.706V329.566C115 323.329 119.591 318.272 125.255 318.272H171.66C177.324 318.272 181.915 313.216 181.915 306.978V272.483C181.915 266.246 177.324 261.189 171.66 261.189H125.255C119.591 261.189 115 256.133 115 249.895V142.756C115 136.518 119.591 131.461 125.255 131.461H171.66C177.324 131.461 181.915 126.405 181.915 120.167V75.2941C181.915 69.0565 186.506 64 192.169 64H386.745C392.409 64 397 69.0565 397 75.2941V130.546Z",fill:"#3461E1"})]})}const ip="flexdoc-runner",rp=1;function Xc(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function Jc(t){return Array.isArray(t)?`[${t.map(Jc).join(",")}]`:Xc(t)?`{${Object.keys(t).filter(n=>t[n]!==void 0).sort().map(n=>`${JSON.stringify(n)}:${Jc(t[n])}`).join(",")}}`:JSON.stringify(t)}function s1(t){return t.type==="oauth2"?{...t,scopes:t.scopes?[...t.scopes]:void 0}:{...t}}function W3(t){return{...t,auth:s1(t.auth),variables:t.variables.map(e=>({...e}))}}function sp(t){return{...t,auth:s1(t.auth)}}function l1(t){if(t.request.binary?.file)throw new Error(`Request ${t.name} contains an in-memory binary file. Runner artifact file payload export is not supported yet.`);if((t.request.formData||[]).some(e=>e.type==="file"&&!!e.file))throw new Error(`Request ${t.name} contains an in-memory multipart file. Runner artifact file payload export is not supported yet.`)}function lp(t){l1(t);const e=Ei(t.request);return e.binary&&delete e.binary.file,e.formData&&(e.formData=e.formData.map(n=>{const r={...n};return delete r.file,r})),{...t,request:e,scripts:t.scripts?wn(t.scripts):void 0}}function Z3(t){return{...t,variables:t.variables.map(e=>({...e}))}}function a1(t,e){const n=t.collections.find(r=>r.id===e.collectionId);if(!n)throw new Error(`Runner scope references missing collection ${e.collectionId}.`);return n}function o1(t,e,n){const r=new Set,s=new Map(t.folders.filter(c=>c.collectionId===e).map(c=>[c.id,c]));let a=n?s.get(n):void 0;for(;a&&!r.has(a.id);)r.add(a.id),a=a.parentFolderId?s.get(a.parentFolderId):void 0;return r}function c1(t,e,n){const r=new Set([n]);let s=!0;for(;s;){s=!1;for(const a of t.folders)a.collectionId!==e||!a.parentFolderId||r.has(a.id)||r.has(a.parentFolderId)&&(r.add(a.id),s=!0)}return r}function u1(t,e){if(e.type==="collection")return t.folders.filter(s=>s.collectionId===e.collectionId).map(sp);if(e.type==="folder"){if(!t.folders.find(c=>c.id===e.folderId&&c.collectionId===e.collectionId))throw new Error(`Runner scope references missing folder ${e.folderId}.`);const a=c1(t,e.collectionId,e.folderId);for(const c of o1(t,e.collectionId,e.folderId))a.add(c);return t.folders.filter(c=>c.collectionId===e.collectionId&&a.has(c.id)).map(sp)}const n=t.requests.find(s=>s.id===e.requestId&&s.collectionId===e.collectionId);if(!n)throw new Error(`Runner scope references missing request ${e.requestId}.`);const r=o1(t,e.collectionId,n.folderId);return t.folders.filter(s=>s.collectionId===e.collectionId&&r.has(s.id)).map(sp)}function d1(t,e){if(e.type==="collection")return t.requests.filter(r=>r.collectionId===e.collectionId).map(lp);if(e.type==="folder"){const r=c1(t,e.collectionId,e.folderId);return t.requests.filter(s=>s.collectionId===e.collectionId&&!!s.folderId&&r.has(s.folderId)).map(lp)}const n=t.requests.find(r=>r.id===e.requestId&&r.collectionId===e.collectionId);if(!n)throw new Error(`Runner scope references missing request ${e.requestId}.`);return[lp(n)]}function f1(t,e){if(t.length===0)throw new Error(`Runner ${e.type} scope contains no executable saved requests.`)}function eM(t,e){const n=e===!1?void 0:e??t.activeEnvironmentId;if(!n)return{environments:[]};const r=t.environments.find(s=>s.id===n);if(!r){if(typeof e=="string")throw new Error(`Runner export references missing environment ${e}.`);return{environments:[]}}return{environments:[Z3(r)],activeEnvironmentId:r.id}}function tM(t,e,n={}){const r=t.credentialStorage!==void 0&&t.credentialStorage!=="remember"?Z0(t):t,s=a1(r,e),a=d1(r,e);f1(a,e);const c=eM(r,n.environmentId),u={version:6,collections:[W3(s)],folders:u1(r,e),requests:a,environments:c.environments,...c.activeEnvironmentId?{activeEnvironmentId:c.activeEnvironmentId}:{},history:[]};return{kind:ip,version:rp,exportedAt:n.exportedAt||new Date().toISOString(),scope:{...e},workspace:u}}function nM(t){if(!Xc(t)||typeof t.type!="string"||typeof t.collectionId!="string"||!t.collectionId)throw new Error("Invalid FlexDoc Runner artifact scope.");if(t.type==="collection")return{type:"collection",collectionId:t.collectionId};if(t.type==="folder"&&typeof t.folderId=="string"&&t.folderId)return{type:"folder",collectionId:t.collectionId,folderId:t.folderId};if(t.type==="request"&&typeof t.requestId=="string"&&t.requestId)return{type:"request",collectionId:t.collectionId,requestId:t.requestId};throw new Error("Invalid FlexDoc Runner artifact scope.")}function Qc(t,e){const n=t.map(r=>r.id);if(new Set(n).size!==n.length)throw new Error(`Runner artifact workspace contains duplicate ${e} ids.`)}function h1(t,e){return t.length===e.length&&t.every((n,r)=>n.id===e[r]?.id)}function iM(t,e){const n=a1(t,e);if(t.collections.length!==1||t.collections[0].id!==n.id)throw new Error("Runner artifact workspace must contain exactly the scoped collection.");if(t.environments.length>1)throw new Error("Runner artifact workspace may contain at most one selected environment.");if(t.environments.length===0&&t.activeEnvironmentId!==void 0)throw new Error("Runner artifact workspace cannot select an environment that is not embedded.");if(t.environments.length===1&&t.activeEnvironmentId!==t.environments[0].id)throw new Error("Runner artifact workspace must activate its single embedded environment.");if(e.type==="folder"&&!t.folders.some(a=>a.id===e.folderId&&a.collectionId===e.collectionId))throw new Error(`Runner artifact references missing folder ${e.folderId}.`);if(e.type==="request"&&!t.requests.some(a=>a.id===e.requestId&&a.collectionId===e.collectionId))throw new Error(`Runner artifact references missing request ${e.requestId}.`);const r=u1(t,e),s=d1(t,e);if(f1(s,e),!h1(t.folders,r)||!h1(t.requests,s))throw new Error(`Runner artifact workspace contains entities outside its declared ${e.type} scope.`)}function rM(t){if(t.version!==6||!Array.isArray(t.collections)||!Array.isArray(t.folders)||!Array.isArray(t.requests)||!Array.isArray(t.environments)||!Array.isArray(t.history)||t.history.length!==0||t.activeEnvironmentId!==void 0&&typeof t.activeEnvironmentId!="string")throw new Error("Invalid FlexDoc Runner artifact workspace. Expected canonical workspace version 6 with empty history.");return{version:6,collections:t.collections,folders:t.folders,requests:t.requests,environments:t.environments,...t.activeEnvironmentId!==void 0?{activeEnvironmentId:t.activeEnvironmentId}:{},history:[]}}function sM(t){if(!Xc(t)||t.kind!==ip||t.version!==rp||typeof t.exportedAt!="string"||!t.exportedAt.trim()||!Xc(t.workspace))throw new Error("Invalid FlexDoc Runner artifact. Expected flexdoc-runner version 1.");const e=nM(t.scope),n=rM(t.workspace),r=ay(n);if(Jc(n)!==Jc(r))throw new Error("Invalid FlexDoc Runner artifact workspace. Portable artifacts must not require workspace migration or normalization repairs.");Qc(r.collections,"collection"),Qc(r.folders,"folder"),Qc(r.requests,"request"),Qc(r.environments,"environment"),iM(r,e);for(const s of r.requests)l1(s);return{kind:ip,version:rp,exportedAt:t.exportedAt,scope:e,workspace:r}}function lM(t){return`${JSON.stringify(sM(t),null,2)}
|
|
76
|
+
`}function aM(t,e,n){if(!n)return null;const r=t.folders.find(c=>c.id===n&&c.collectionId===e);if(!r)return new Set;const s=new Set([r.id]);let a=!0;for(;a;){a=!1;for(const c of t.folders)c.collectionId!==e||!c.parentFolderId||s.has(c.id)||s.has(c.parentFolderId)&&(s.add(c.id),a=!0)}return s}function Sl(t,e,n){const r=aM(t,e,n);return t.requests.filter(s=>s.collectionId!==e?!1:r?!!s.folderId&&r.has(s.folderId):!0)}function oM(t,e){const n=new Map(t.map(c=>[c.id,c])),r=[],s=new Set;let a=n.get(e);for(;a&&!s.has(a.id);)s.add(a.id),r.unshift(a.name),a=a.parentFolderId?n.get(a.parentFolderId):void 0;return r.join(" / ")}function p1(t,e,n){const r=t.collections.find(a=>a.id===e)?.name||"Deleted collection";if(!n)return r;const s=oM(t.folders.filter(a=>a.collectionId===e),n);return s?`${r} / ${s}`:`${r} / Deleted folder`}function cM(t){return!t.error&&!t.scriptError&&t.scriptTests.every(e=>e.passed)}async function uM(t){const e=Sl(t.workspace,t.collectionId,t.folderId),n=t.runId||Sn("run"),r=t.runName||p1(t.workspace,t.collectionId,t.folderId);let s=t.workspace;const a=[];let c=t.signal?.aborted===!0;for(let g=0;g<e.length&&!c;g+=1){if(t.signal?.aborted){c=!0;break}const b=e[g];t.onRequestStart?.(b,g,e.length);const v=uy(s,t.collectionId),w=hf(s),A={...t.externalEnvironmentVariables||{},...w},C={...v,...t.externalVariables||{},...A},O=await by({request:b.request,scripts:b.scripts,credentials:t.credentials,requestInterceptor:t.requestInterceptor,hostExecution:t.hostExecution,preferHostExecution:t.preferHostExecution===!0,resolveAuth:_=>cy(s,b.collectionId,b.folderId,_||{type:"none"}),variables:C,collectionVariables:v,externalVariables:t.externalVariables,environmentVariables:A,signal:t.signal,fetcher:t.fetcher,now:t.now,onCollectionChanges:_=>{s=dy(s,b.collectionId,_),t.onCollectionChanges?.(_)},onEnvironmentChanges:_=>{s=pf(s,_),t.onEnvironmentChanges?.(_)}}),D=t.signal?.aborted===!0,E=!D&&cM(O);let j;O.result&&!D&&(s=oy(s,{...O.result,collectionId:b.collectionId,folderId:b.folderId,runId:n,runName:r,runIndex:g+1,runTotal:e.length,runPassed:E}),j=s.history[0]?.id);const M={requestId:b.id,requestName:b.name,collectionId:b.collectionId,folderId:b.folderId,passed:E,cancelled:D,historyEntryId:j,outcome:O};if(a.push(M),t.onRequestComplete?.(M,g,e.length),D){c=!0;break}if(!M.passed&&t.stopOnFailure&&g<e.length-1){c=!0;break}}const u=a.filter(g=>g.passed).length,f=a.filter(g=>g.cancelled).length,h=a.filter(g=>!g.passed&&!g.cancelled).length;return{runId:n,runName:r,collectionId:t.collectionId,folderId:t.folderId,total:e.length,completed:a.length,passed:u,failed:h,cancelled:f,stopped:c,items:a,workspace:s}}function Jr(){return new Date().toISOString()}function dM(t){return`${t.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")||"runner"}.flexdoc.json`}const fM=({request:t,scripts:e,onLoadRequest:n,onSelectedCollectionChange:r,onSelectedFolderChange:s,onRunCollection:a,onRunFolder:c,selectedCollectionId:u,selectedFolderId:f="",workspace:h,onWorkspaceChange:g,hostExecution:b,theme:v})=>{const[w,A]=I.useState(""),[C,O]=I.useState(""),[D,E]=I.useState(""),[j,M]=I.useState(null),[_,q]=I.useState(""),R=h.collections.find(G=>G.id===u)||h.collections[0],X=I.useMemo(()=>h.folders.filter(G=>G.collectionId===R?.id),[R?.id,h.folders]),U=I.useMemo(()=>h.requests.filter(G=>G.collectionId===R?.id),[R?.id,h.requests]),B=X.find(G=>G.id===f),K=I.useMemo(()=>new Map(X.map(G=>[G.id,G])),[X]),W=I.useMemo(()=>{const G=[],we=new Set,Ne=(De,Ke)=>{X.filter(st=>st.parentFolderId===De).forEach(st=>{we.has(st.id)||(we.add(st.id),G.push({folder:st,depth:Ke}),Ne(st.id,Ke+1))})};return Ne(void 0,0),X.forEach(De=>{we.has(De.id)||(we.add(De.id),G.push({folder:De,depth:0}),Ne(De.id,1))}),G},[X]),ye=G=>{const we=[],Ne=new Set;let De=K.get(G);for(;De&&!Ne.has(De.id);)Ne.add(De.id),we.unshift(De.name),De=De.parentFolderId?K.get(De.parentFolderId):void 0;return we.join(" / ")};I.useEffect(()=>{r?.(R?.id)},[r,R?.id]);const pe=(G,we)=>{try{const Ne=tM(h,G),De=new Blob([lM(Ne)],{type:"application/json;charset=utf-8"}),Ke=URL.createObjectURL(De),st=document.createElement("a");st.href=Ke,st.download=dM(we),st.click(),setTimeout(()=>URL.revokeObjectURL(Ke),0),q("")}catch(Ne){q(Ne instanceof Error?Ne.message:String(Ne))}},fe=()=>{const G=w.trim();if(!G)return;const we=Jr(),Ne=Sn("collection");g(De=>({...De,collections:[...De.collections,{id:Ne,name:G,auth:{type:"none"},variables:[],createdAt:we,updatedAt:we}]})),r?.(Ne),s?.(""),A(""),M(null)},L=G=>{if(!R)return;const we=Jr();g(Ne=>({...Ne,collections:Ne.collections.map(De=>De.id===R.id?{...De,auth:G,updatedAt:we}:De)}))},Q=G=>{if(!B)return;const we=Jr();g(Ne=>({...Ne,folders:Ne.folders.map(De=>De.id===B.id?{...De,auth:G,updatedAt:we}:De)}))},oe=()=>{if(!R)return;const G=Jr();g(we=>({...we,collections:we.collections.map(Ne=>Ne.id===R.id?{...Ne,variables:[...Ne.variables,{id:Sn("variable"),key:"",value:"",enabled:!0}],updatedAt:G}:Ne)}))},ce=(G,we)=>{if(!R)return;const Ne=Jr();g(De=>({...De,collections:De.collections.map(Ke=>Ke.id===R.id?{...Ke,variables:Ke.variables.map(st=>st.id===G?{...st,...we}:st),updatedAt:Ne}:Ke)}))},ve=G=>{if(!R)return;const we=Jr();g(Ne=>({...Ne,collections:Ne.collections.map(De=>De.id===R.id?{...De,variables:De.variables.filter(Ke=>Ke.id!==G),updatedAt:we}:De)}))},T=()=>{const G=C.trim();if(!G||!R)return;const we=Jr(),Ne=Sn("folder");g(De=>({...De,folders:[...De.folders,{id:Ne,collectionId:R.id,parentFolderId:f||void 0,name:G,auth:{type:"inherit"},createdAt:we,updatedAt:we}]})),s?.(Ne),O("")},z=()=>{if(!R)return;const G=D.trim()||t.url||"Untitled request",we=Jr();if(j){g(De=>({...De,requests:De.requests.map(Ke=>Ke.id===j?{...Ke,collectionId:R.id,folderId:f||void 0,name:G,request:Ei(t),scripts:wn(e),updatedAt:we}:Ke)}));return}const Ne={id:Sn("request"),collectionId:R.id,folderId:f||void 0,name:G,request:Ei(t),scripts:wn(e),createdAt:we,updatedAt:we};g(De=>({...De,requests:[...De.requests,Ne]})),M(Ne.id),E(G)},he=G=>{const we=h.requests.find(Ne=>Ne.id===G);we&&(M(we.id),r?.(we.collectionId),s?.(we.folderId||""),E(we.name),n(Ei(we.request),we.scripts?wn(we.scripts):void 0,we.collectionId,we.folderId))},ne=G=>{g(we=>({...we,requests:we.requests.filter(Ne=>Ne.id!==G)})),j===G&&(M(null),E(""))},ke=G=>{const we=h.folders.find(Ne=>Ne.id===G);g(Ne=>_C(Ne,G)),f===G&&s?.(we?.parentFolderId||"")},qe=G=>{const we=LC(h,G);g(we),u===G&&(r?.(we.collections[0]?.id||""),s?.(""),M(null),E(""))},$e=v==="dark"?"bg-gray-900 border-gray-700 text-gray-100":"bg-white border-gray-300 text-gray-900",Fe=v==="dark"?"text-gray-400":"text-gray-500",Ye=v==="dark"?"bg-blue-500/10 text-blue-300":"bg-blue-500/10 text-blue-700",Ie=G=>p.jsxs("div",{className:`group flex items-center gap-1 rounded-md ${j===G.id?"bg-blue-500/10":""}`,children:[p.jsxs("button",{type:"button",className:"min-w-0 flex-1 rounded-md px-2 py-2 text-left text-sm hover:bg-blue-500/10","aria-label":`Load saved request ${G.name}`,onClick:()=>he(G.id),children:[p.jsx("span",{className:"mr-2 font-mono text-xs font-semibold text-blue-600",children:G.request.method.toUpperCase()}),p.jsx("span",{className:"truncate",children:G.name})]}),p.jsx("button",{type:"button",className:"rounded-md p-2 opacity-70 hover:opacity-100","aria-label":`Export saved request ${G.name} for Runner`,onClick:()=>pe({type:"request",collectionId:G.collectionId,requestId:G.id},G.name),children:p.jsx(Nd,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",className:"rounded-md p-2 opacity-70 hover:opacity-100","aria-label":`Delete saved request ${G.name}`,onClick:()=>ne(G.id),children:p.jsx(ci,{className:"h-4 w-4"})})]},G.id),ut=(G,we,Ne=new Set)=>{if(Ne.has(G.id))return null;const De=new Set(Ne);De.add(G.id);const Ke=ye(G.id),st=X.filter(Et=>Et.parentFolderId===G.id);return p.jsxs(Ad.Fragment,{children:[p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{type:"button","aria-label":`Select folder ${Ke}`,className:`min-w-0 flex-1 rounded-md py-2 pr-2 text-left text-sm ${f===G.id?"bg-blue-500/10":""}`,style:{paddingLeft:`${8+we*16}px`},onClick:()=>s?.(G.id),children:G.name}),p.jsx("button",{type:"button",disabled:Sl(h,G.collectionId,G.id).length===0,"aria-label":`Run folder ${Ke}`,className:"rounded-md p-2 opacity-70 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>c?.(G.collectionId,G.id),children:p.jsx(aa,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",disabled:Sl(h,G.collectionId,G.id).length===0,"aria-label":`Export folder ${Ke} for Runner`,className:"rounded-md p-2 opacity-70 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>pe({type:"folder",collectionId:G.collectionId,folderId:G.id},Ke),children:p.jsx(Nd,{className:"h-4 w-4"})}),p.jsx("button",{type:"button","aria-label":`Delete folder ${Ke}`,className:"rounded-md p-2 opacity-70 hover:opacity-100",onClick:()=>ke(G.id),children:p.jsx(ci,{className:"h-4 w-4"})})]}),st.map(Et=>ut(Et,we+1,De))]},G.id)},Rt=(G,we,Ne=new Set)=>{if(Ne.has(G.id))return null;const De=new Set(Ne);De.add(G.id);const Ke=U.filter(Et=>Et.folderId===G.id),st=X.filter(Et=>Et.parentFolderId===G.id);return Ke.length===0&&st.length===0?null:p.jsxs("div",{className:"space-y-1",children:[Ke.length>0&&p.jsxs(p.Fragment,{children:[p.jsx("div",{className:`mb-1 text-xs font-semibold uppercase tracking-wide ${Fe}`,style:{paddingLeft:`${8+we*12}px`},children:G.name}),p.jsx("div",{style:{paddingLeft:`${we*12}px`},children:Ke.map(Ie)})]}),st.map(Et=>Rt(Et,we+1,De))]},G.id)},Ce=X.filter(G=>!G.parentFolderId),Oe=f?ye(f):"";return p.jsxs("section",{className:"space-y-4","aria-labelledby":"api-client-collections-heading",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(KA,{className:"h-4 w-4"}),p.jsx("h3",{id:"api-client-collections-heading",className:"font-semibold",children:"Collections"})]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{"aria-label":"New collection name",className:`min-w-0 flex-1 rounded-md border px-2 py-2 text-sm ${$e}`,value:w,onChange:G=>A(G.target.value),placeholder:"New collection"}),p.jsx("button",{type:"button","aria-label":"Add collection",className:"rounded-md border px-3 py-2",onClick:fe,children:p.jsx(Cs,{className:"h-4 w-4"})})]}),p.jsx("div",{className:"space-y-2",children:h.collections.map(G=>p.jsxs("div",{className:"flex items-center gap-1",children:[p.jsx("button",{type:"button",className:`min-w-0 flex-1 rounded-md px-2 py-2 text-left text-sm font-medium ${G.id===R?.id?Ye:""}`,onClick:()=>{r?.(G.id),s?.(""),M(null),E("")},children:G.name}),p.jsx("button",{type:"button",disabled:Sl(h,G.id).length===0,"aria-label":`Run collection ${G.name}`,className:"rounded-md p-2 opacity-70 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>a?.(G.id),children:p.jsx(aa,{className:"h-4 w-4"})}),p.jsx("button",{type:"button",disabled:Sl(h,G.id).length===0,"aria-label":`Export collection ${G.name} for Runner`,className:"rounded-md p-2 opacity-70 hover:opacity-100 disabled:cursor-not-allowed disabled:opacity-30",onClick:()=>pe({type:"collection",collectionId:G.id},G.name),children:p.jsx(Nd,{className:"h-4 w-4"})}),h.collections.length>1&&p.jsx("button",{type:"button","aria-label":`Delete collection ${G.name}`,className:"rounded-md p-2 opacity-70 hover:opacity-100",onClick:()=>qe(G.id),children:p.jsx(ci,{className:"h-4 w-4"})})]},G.id))}),p.jsxs("p",{className:`text-xs ${Fe}`,children:["Runner exports can include saved authentication, collection variables, and the active environment. Treat downloaded ",p.jsx("code",{children:".flexdoc.json"})," files as sensitive configuration."]}),_&&p.jsx("p",{role:"alert",className:"text-xs text-red-600",children:_}),R&&p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"space-y-2 border-t pt-3",children:[p.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide",children:"Collection authorization"}),p.jsx(xf,{auth:R.auth,label:"Collection",hostExecution:b,onChange:L,theme:v}),p.jsx("p",{className:`text-xs ${Fe}`,children:"Requests set to inherit use the nearest folder override, then this collection authorization."})]}),p.jsxs("div",{className:"space-y-2 border-t pt-3",children:[p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:"Collection variables"}),p.jsxs("button",{type:"button","aria-label":"Add collection variable",className:"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs",onClick:oe,children:[p.jsx(Cs,{className:"h-3.5 w-3.5"})," Add"]})]}),p.jsxs("div",{className:"space-y-2",children:[R.variables.map((G,we)=>p.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)_auto] items-center gap-1",children:[p.jsx("input",{"aria-label":`Collection variable ${we+1} enabled`,type:"checkbox",checked:G.enabled!==!1,onChange:Ne=>ce(G.id,{enabled:Ne.target.checked})}),p.jsx("input",{"aria-label":`Collection variable ${we+1} key`,className:`min-w-0 rounded-md border px-2 py-1.5 font-mono text-xs ${$e}`,placeholder:"baseUrl",value:G.key,onChange:Ne=>ce(G.id,{key:Ne.target.value})}),p.jsx("input",{"aria-label":`Collection variable ${we+1} value`,className:`min-w-0 rounded-md border px-2 py-1.5 font-mono text-xs ${$e}`,placeholder:"https://api.example.com",value:G.value,onChange:Ne=>ce(G.id,{value:Ne.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove collection variable ${we+1}`,className:"rounded-md p-1.5 opacity-70 hover:opacity-100",onClick:()=>ve(G.id),children:p.jsx(ci,{className:"h-3.5 w-3.5"})})]},G.id)),R.variables.length===0&&p.jsxs("p",{className:`text-xs ${Fe}`,children:["Collection variables provide reusable defaults such as ",p.jsx("code",{children:"{{baseUrl}}"}),". Active environment values override matching collection keys."]})]})]}),p.jsxs("div",{className:"space-y-1 border-t pt-3",children:[p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{"aria-label":"New folder name",className:`min-w-0 flex-1 rounded-md border px-2 py-2 text-sm ${$e}`,value:C,onChange:G=>O(G.target.value),placeholder:"Folder"}),p.jsx("button",{type:"button","aria-label":"Add folder",className:"rounded-md border px-3 py-2",onClick:T,children:p.jsx(PA,{className:"h-4 w-4"})})]}),p.jsx("p",{className:`text-xs ${Fe}`,children:Oe?`New folders are created inside ${Oe}.`:"New folders are created at the collection root."})]}),p.jsxs("div",{className:"space-y-1",children:[p.jsx("button",{type:"button","aria-label":"Select collection root",className:`w-full rounded-md px-2 py-2 text-left text-sm ${f===""?"bg-blue-500/10":""}`,onClick:()=>s?.(""),children:"Unfiled / collection root"}),Ce.map(G=>ut(G,0))]}),B&&p.jsxs("div",{className:"space-y-2 border-t pt-3",children:[p.jsxs("div",{className:"text-xs font-semibold uppercase tracking-wide",children:["Folder authorization — ",Oe]}),p.jsx(xf,{auth:B.auth,label:"Folder",allowInherit:!0,hostExecution:b,onChange:Q,theme:v})]}),p.jsxs("div",{className:"space-y-2 border-t pt-3",children:[p.jsx("input",{"aria-label":"Saved request name",className:`w-full rounded-md border px-2 py-2 text-sm ${$e}`,value:D,onChange:G=>E(G.target.value),placeholder:"Request name"}),p.jsxs("select",{"aria-label":"Saved request folder",className:`w-full rounded-md border px-2 py-2 text-sm ${$e}`,value:f,onChange:G=>s?.(G.target.value),children:[p.jsx("option",{value:"",children:"Unfiled"}),W.map(({folder:G,depth:we})=>p.jsx("option",{value:G.id,children:`${"— ".repeat(we)}${G.name}`},G.id))]}),p.jsxs("button",{type:"button",className:"inline-flex w-full items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm font-medium",onClick:z,children:[p.jsx(ek,{className:"h-4 w-4"})," ",j?"Update request":"Save request"]})]}),p.jsxs("div",{className:"space-y-3 border-t pt-3",children:[U.filter(G=>!G.folderId).map(Ie),Ce.map(G=>Rt(G,0)),U.length===0&&p.jsx("p",{className:`px-2 text-xs ${Fe}`,children:"Save the current request to build a reusable collection."})]})]})]})};function Ia(){return new Date().toISOString()}const hM=({workspace:t,onWorkspaceChange:e,theme:n})=>{const[r,s]=I.useState(""),a=t.environments.find(w=>w.id===t.activeEnvironmentId),c=n==="dark"?"bg-gray-900 border-gray-700 text-gray-100":"bg-white border-gray-300 text-gray-900",u=n==="dark"?"text-gray-400":"text-gray-500",f=()=>{const w=r.trim();if(!w)return;const A=Ia(),C=Sn("environment");e(O=>({...O,environments:[...O.environments,{id:C,name:w,variables:[],createdAt:A,updatedAt:A}],activeEnvironmentId:C})),s("")},h=w=>{if(!a)return;const A=Ia();e(C=>({...C,environments:C.environments.map(O=>O.id===a.id?{...O,name:w,updatedAt:A}:O)}))},g=()=>{if(!a)return;const w=Ia();e(A=>({...A,environments:A.environments.map(C=>C.id===a.id?{...C,variables:[...C.variables,{id:Sn("variable"),key:"",value:"",enabled:!0}],updatedAt:w}:C)}))},b=(w,A)=>{if(!a)return;const C=Ia();e(O=>({...O,environments:O.environments.map(D=>D.id===a.id?{...D,variables:D.variables.map(E=>E.id===w?{...E,...A}:E),updatedAt:C}:D)}))},v=w=>{if(!a)return;const A=Ia();e(C=>({...C,environments:C.environments.map(O=>O.id===a.id?{...O,variables:O.variables.filter(D=>D.id!==w),updatedAt:A}:O)}))};return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-environment-heading",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("h3",{id:"api-client-environment-heading",className:"font-semibold",children:"Environment"}),a&&p.jsx("button",{type:"button","aria-label":`Delete environment ${a.name}`,className:"rounded-md p-2 opacity-70 hover:opacity-100",onClick:()=>e(w=>DC(w,a.id)),children:p.jsx(ci,{className:"h-4 w-4"})})]}),p.jsxs("select",{"aria-label":"Active environment",className:`w-full rounded-md border px-2 py-2 text-sm ${c}`,value:t.activeEnvironmentId||"",onChange:w=>e(A=>({...A,activeEnvironmentId:w.target.value||void 0})),children:[p.jsx("option",{value:"",children:"No environment"}),t.environments.map(w=>p.jsx("option",{value:w.id,children:w.name},w.id))]}),p.jsxs("div",{className:"flex gap-2",children:[p.jsx("input",{"aria-label":"New environment name",className:`min-w-0 flex-1 rounded-md border px-2 py-2 text-sm ${c}`,value:r,onChange:w=>s(w.target.value),placeholder:"New environment"}),p.jsx("button",{type:"button","aria-label":"Add environment",className:"rounded-md border px-3 py-2",onClick:f,children:p.jsx(Cs,{className:"h-4 w-4"})})]}),a&&p.jsxs("div",{className:"space-y-3",children:[p.jsx("input",{"aria-label":"Environment name",className:`w-full rounded-md border px-2 py-2 text-sm font-medium ${c}`,value:a.name,onChange:w=>h(w.target.value)}),p.jsxs("div",{className:"flex items-center justify-between",children:[p.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide",children:"Variables"}),p.jsxs("button",{type:"button","aria-label":"Add environment variable",className:"inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs",onClick:g,children:[p.jsx(Cs,{className:"h-3.5 w-3.5"})," Add"]})]}),p.jsxs("div",{className:"space-y-2",children:[a.variables.map((w,A)=>p.jsxs("div",{className:"grid grid-cols-[auto_minmax(0,1fr)_minmax(0,1fr)_auto] items-center gap-1",children:[p.jsx("input",{"aria-label":`Environment variable ${A+1} enabled`,type:"checkbox",checked:w.enabled!==!1,onChange:C=>b(w.id,{enabled:C.target.checked})}),p.jsx("input",{"aria-label":`Environment variable ${A+1} key`,className:`min-w-0 rounded-md border px-2 py-1.5 font-mono text-xs ${c}`,placeholder:"baseUrl",value:w.key,onChange:C=>b(w.id,{key:C.target.value})}),p.jsx("input",{"aria-label":`Environment variable ${A+1} value`,className:`min-w-0 rounded-md border px-2 py-1.5 font-mono text-xs ${c}`,placeholder:"https://api.example.com",value:w.value,onChange:C=>b(w.id,{value:C.target.value})}),p.jsx("button",{type:"button","aria-label":`Remove environment variable ${A+1}`,className:"rounded-md p-1.5 opacity-70 hover:opacity-100",onClick:()=>v(w.id),children:p.jsx(ci,{className:"h-3.5 w-3.5"})})]},w.id)),a.variables.length===0&&p.jsxs("p",{className:`text-xs ${u}`,children:["Add variables such as ",p.jsx("code",{children:"{{baseUrl}}"})," or ",p.jsx("code",{children:"{{token}}"}),"."]})]})]})]})};function Wc(t){return!!t.error||!!t.scriptError||t.status!==void 0&&t.status>=400||!!t.scriptTests?.some(e=>!e.passed)}function ap(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString()}function pM(t,e){const n=e.query.trim().toLowerCase();return t.history.filter(r=>{const s=r.collectionId?t.collections.find(g=>g.id===r.collectionId)?.name||"Deleted collection":"",a=r.folderId?t.folders.find(g=>g.id===r.folderId)?.name||"Deleted folder":"",c=!n||[r.executedMethod,r.resolvedUrl,r.status,r.statusText,s,a,r.runName].filter(g=>g!==void 0).some(g=>String(g).toLowerCase().includes(n)),u=e.method==="all"||r.executedMethod.toUpperCase()===e.method,f=Wc(r),h=e.outcome==="all"||e.outcome==="success"&&!f||e.outcome==="failed"&&f||e.outcome==="tests"&&!!r.scriptTests?.length;return c&&u&&h})}function mM(t){const e=new Set,n=[];for(const r of t){if(!r.runId){n.push({kind:"entry",entry:r});continue}if(e.has(r.runId))continue;e.add(r.runId);const s=t.filter(c=>c.runId===r.runId).sort((c,u)=>(c.runIndex||Number.MAX_SAFE_INTEGER)-(u.runIndex||Number.MAX_SAFE_INTEGER)),a=Math.max(s.length,...s.map(c=>c.runTotal||0));n.push({kind:"run",group:{runId:r.runId,runName:r.runName||"Collection run",entries:s,total:a,captured:s.length,passed:s.filter(c=>c.runPassed===!0).length,failed:s.filter(c=>c.runPassed===!1).length,cancelled:0}})}return n}const gM=({workspace:t,onWorkspaceChange:e,onLoadRequest:n,onViewAll:r,theme:s})=>{const a=s==="dark"?"text-gray-400":"text-gray-500",[c,u]=Ad.useState(!1),f=async()=>{if(!(typeof navigator>"u"||!navigator.clipboard?.writeText))try{await navigator.clipboard.writeText(JSON.stringify(zC(VC()),null,2)),u(!0),window.setTimeout(()=>u(!1),1500)}catch{u(!1)}},h=b=>{const v=t.history.find(w=>w.id===b);v&&n(v.request,v.scripts,v.collectionId,v.folderId)},g=b=>{const v=t.history.find(w=>w.id===b);v&&(typeof window<"u"&&!window.confirm(`Delete this history entry?
|
|
77
77
|
|
|
78
|
-
${h.executedMethod.toUpperCase()} ${h.resolvedUrl}`)||e(g=>({...g,history:g.history.filter(b=>b.id!==f)})))};return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-history-heading",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(kd,{className:"h-4 w-4"}),p.jsx("h3",{id:"api-client-history-heading",className:"font-semibold",children:"Recent history"})]}),t.history.length>0&&r&&p.jsx("button",{type:"button",className:`text-xs underline underline-offset-2 ${a}`,onClick:r,children:"View all"})]}),p.jsxs("label",{className:"flex items-center gap-2 rounded-md border p-2 text-xs",title:"Sensitive history headers are always redacted.",children:[p.jsx("input",{type:"checkbox",checked:t.historyBodies!==!1,onChange:f=>e(h=>({...h,historyBodies:f.target.checked}))}),p.jsx("span",{children:"Store API-host bodies"})]}),p.jsxs("div",{className:"space-y-1",children:[t.history.slice(0,5).map(f=>{const h=f.status!==void 0?`${f.status}${f.statusText?` ${f.statusText}`:""}`:f.error?"Error":"Sent",g=f.responseTime!==void 0?` · ${f.responseTime} ms`:"",b=f.scriptTests?.filter(w=>w.passed).length||0,v=f.scriptTests?.length?`${b}/${f.scriptTests.length} tests passed`:f.scriptError?"Script error":void 0;return p.jsxs("div",{className:"group flex items-start gap-1 rounded-md",children:[p.jsxs("button",{type:"button",className:"min-w-0 flex-1 rounded-md px-2 py-2 text-left hover:bg-blue-500/10","aria-label":`Load history request ${f.executedMethod.toUpperCase()} ${f.resolvedUrl}`,onClick:()=>c(f.id),children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[p.jsx("span",{className:"font-mono font-semibold text-blue-600",children:f.executedMethod.toUpperCase()}),p.jsxs("span",{className:f.error?"text-red-600":a,children:[h,g]})]}),p.jsx("div",{className:"truncate font-mono text-xs",title:f.resolvedUrl,children:f.resolvedUrl}),v&&p.jsx("div",{className:`mt-1 text-[11px] ${f.scriptError?"text-red-600":a}`,children:v}),p.jsx("div",{className:`mt-1 text-[11px] ${a}`,children:rp(f.createdAt)})]}),p.jsx("button",{type:"button",className:"rounded-md p-2 opacity-70 hover:opacity-100","aria-label":`Delete history request ${f.executedMethod.toUpperCase()} ${f.resolvedUrl}`,onClick:()=>u(f.id),children:p.jsx(ci,{className:"h-4 w-4"})})]},f.id)}),t.history.length===0&&p.jsx("div",{className:`rounded-md border border-dashed px-3 py-3 text-xs ${a}`,children:"Sent requests appear here for quick replay. Import or open a collection request, then Send it to start building history."})]}),t.history.length>0&&r&&p.jsxs("button",{type:"button",className:"w-full rounded-md border px-3 py-2 text-xs font-medium hover:bg-blue-500/10",onClick:r,children:["Open full history · ",t.history.length]})]})};function sp(t){return t.error?"Request failed":t.status!==void 0?`${t.status}${t.statusText?` ${t.statusText}`:""}`:"Sent"}function aM(t){return(t||[]).filter(e=>e.enabled!==!1&&(e.key.trim()||e.value.trim()))}const Al="text-xs font-semibold uppercase tracking-wide",h1="font-mono font-semibold text-blue-600",p1="mt-1 truncate font-mono text-xs";function m1({title:t,values:e,mutedClass:n}){const r=aM(e);return r.length===0?null:p.jsxs("section",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:t}),p.jsx("div",{className:"overflow-hidden rounded-md border",children:r.map((s,a)=>p.jsxs("div",{className:"grid grid-cols-[minmax(8rem,0.35fr)_minmax(0,1fr)] gap-3 border-b px-3 py-2 text-xs last:border-b-0",children:[p.jsx("span",{className:"break-all font-mono font-medium",children:s.key||"—"}),p.jsx("span",{className:`break-all font-mono ${n}`,children:s.value})]},`${s.key}:${a}`))})]})}function g1(t){const e=[`${t.passed} runner passed`,`${t.failed} runner failed`];return t.cancelled&&e.push(`${t.cancelled} cancelled`),e.join(" · ")}const oM=({workspace:t,onWorkspaceChange:e,onLoadRequest:n,onBack:r,theme:s,initialEntryId:a,initialRunId:c})=>{const[u,f]=I.useState(""),[h,g]=I.useState("all"),[b,v]=I.useState("all"),[w,A]=I.useState(c?void 0:a||t.history[0]?.id),[C,j]=I.useState(c),D=s==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",M=s==="dark"?"border-gray-700 bg-gray-800/60 text-gray-100":"border-gray-200 bg-gray-50 text-gray-900",E=s==="dark"?"text-gray-400":"text-gray-500",R=s==="dark"?"border-gray-700 bg-gray-950 text-gray-100":"border-gray-200 bg-white text-gray-900",_=`rounded-md border px-3 py-2 text-sm ${D}`,q=I.useMemo(()=>rM(t,{query:u,method:h,outcome:b}),[h,b,u,t]),O=I.useMemo(()=>sM(q),[q]),X=C?O.find(T=>T.kind==="run"&&T.group.runId===C):void 0,U=X?.kind==="run"?X.group:void 0,B=U?void 0:q.find(T=>T.id===w)||q[0],K=B?.collectionId?t.collections.find(T=>T.id===B.collectionId):void 0,W=B?.folderId?t.folders.find(T=>T.id===B.folderId):void 0,ye=()=>{A(void 0),j(void 0)},pe=T=>{A(T),j(void 0)},fe=T=>{j(T),A(void 0)},L=T=>{n(T.request,T.scripts,T.collectionId,T.folderId),r()},Q=T=>{window.confirm("Delete this history entry? This cannot be undone.")&&(e(z=>({...z,history:z.history.filter(he=>he.id!==T)})),w===T&&A(void 0))},oe=()=>{window.confirm("Clear all request history? This cannot be undone.")&&(e(T=>({...T,history:[]})),ye())},ce=B?.responseHeaders||[],ve=B?.scriptTests?.filter(T=>T.passed).length||0;return p.jsx("section",{className:`rounded-xl border p-4 md:p-5 ${M}`,"aria-labelledby":"api-client-history-page-heading",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm",onClick:r,children:[p.jsx(Ro,{className:"h-4 w-4"})," Client"]}),p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(kd,{className:"h-5 w-5"}),p.jsx("h2",{id:"api-client-history-page-heading",className:"text-lg font-semibold",children:"Request history"})]}),p.jsxs("p",{className:`text-xs ${E}`,children:[t.history.length," persisted request",t.history.length===1?"":"s"," · newest first"]})]})]}),t.history.length>0&&p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 self-start rounded-md border px-3 py-2 text-sm text-red-600",onClick:oe,children:[p.jsx(ci,{className:"h-4 w-4"})," Clear history"]})]}),p.jsxs("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_10rem_12rem]",children:[p.jsxs("label",{className:"relative",children:[p.jsx("span",{className:"sr-only",children:"Search history"}),p.jsx($g,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 ${E}`}),p.jsx("input",{"aria-label":"Search history",className:`w-full rounded-md border py-2 pl-9 pr-3 text-sm ${D}`,value:u,onChange:T=>{f(T.target.value),ye()},placeholder:"Search URL, status, collection or run…"})]}),p.jsxs("select",{"aria-label":"History method filter",className:_,value:h,onChange:T=>{g(T.target.value),ye()},children:[p.jsx("option",{value:"all",children:"All methods"}),["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(T=>p.jsx("option",{value:T,children:T},T))]}),p.jsxs("select",{"aria-label":"History outcome filter",className:_,value:b,onChange:T=>{v(T.target.value),ye()},children:[p.jsx("option",{value:"all",children:"All outcomes"}),p.jsx("option",{value:"success",children:"Successful HTTP"}),p.jsx("option",{value:"failed",children:"HTTP / script failures"}),p.jsx("option",{value:"tests",children:"With tests"})]})]}),p.jsxs("div",{className:"grid min-h-[32rem] gap-4 lg:grid-cols-[minmax(18rem,0.85fr)_minmax(0,1.35fr)]",children:[p.jsxs("div",{className:"max-h-[48rem] space-y-2 overflow-auto rounded-lg border p-2",children:[O.map(T=>{if(T.kind==="entry"){const ne=T.entry,ke=B?.id===ne.id,qe=Wc(ne),$e=ne.collectionId?t.collections.find(Fe=>Fe.id===ne.collectionId)?.name||"Deleted collection":void 0;return p.jsxs("button",{type:"button",className:`w-full rounded-md border px-3 py-3 text-left transition ${ke?"border-blue-500 bg-blue-500/10":"border-transparent hover:bg-blue-500/5"}`,onClick:()=>pe(ne.id),children:[p.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[p.jsx("span",{className:h1,children:ne.executedMethod.toUpperCase()}),p.jsxs("span",{className:qe?"text-red-600":E,children:[sp(ne),ne.responseTime!==void 0?` · ${ne.responseTime} ms`:""]})]}),p.jsx("div",{className:p1,title:ne.resolvedUrl,children:ne.resolvedUrl}),p.jsxs("div",{className:`mt-1 flex items-center justify-between gap-2 text-[11px] ${E}`,children:[p.jsx("span",{className:"truncate",children:$e||"Unsaved request"}),p.jsx("span",{children:rp(ne.createdAt)})]})]},ne.id)}const z=T.group,he=U?.runId===z.runId;return p.jsxs("div",{className:`rounded-lg border ${he?"border-blue-500 bg-blue-500/5":""}`,children:[p.jsxs("button",{type:"button","aria-label":`Open collection run ${z.runName}`,className:"w-full px-3 py-3 text-left",onClick:()=>fe(z.runId),children:[p.jsx("div",{className:"text-xs font-semibold text-blue-600",children:"Collection run"}),p.jsx("div",{className:"mt-1 truncate text-sm font-medium",children:z.runName}),p.jsxs("div",{className:`mt-1 text-[11px] ${E}`,children:[z.captured,"/",z.total," history entries · ",g1(z)]})]}),p.jsx("div",{className:"border-t px-2 py-1",children:z.entries.map(ne=>p.jsxs("button",{type:"button",className:`w-full rounded-md px-2 py-2 text-left text-xs hover:bg-blue-500/10 ${B?.id===ne.id?"bg-blue-500/10":""}`,onClick:()=>pe(ne.id),children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("span",{children:[p.jsx("span",{className:"mr-2 text-[10px] text-gray-500",children:ne.runIndex||"–"}),p.jsx("span",{className:h1,children:ne.executedMethod.toUpperCase()})]}),p.jsx("span",{className:Wc(ne)?"text-red-600":E,children:sp(ne)})]}),p.jsx("div",{className:"mt-1 truncate font-mono",title:ne.resolvedUrl,children:ne.resolvedUrl})]},ne.id))})]},z.runId)}),q.length===0&&p.jsx("div",{className:`px-3 py-8 text-center text-sm ${E}`,children:t.history.length===0?"Send a request to start building history.":"No history entries match these filters."})]}),p.jsxs("div",{className:"min-w-0 rounded-lg border p-4",children:[U&&p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"border-b pb-4",children:[p.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-blue-600",children:"Collection run"}),p.jsx("h3",{className:"mt-1 text-lg font-semibold",children:U.runName}),p.jsxs("p",{className:`mt-1 text-sm ${E}`,children:[U.captured," / ",U.total," history entries captured · ",g1(U)]}),p.jsx("p",{className:`mt-2 text-xs ${E}`,children:"Runner pass/fail is based on transport, scripts, and tests. An HTTP 4xx/5xx can therefore be a runner pass while still appearing as an HTTP failure in the request inspector."})]}),p.jsx("div",{className:"space-y-2",children:U.entries.map(T=>p.jsxs("button",{type:"button","aria-label":`Inspect history ${T.runIndex||""}`,className:"w-full rounded-md border px-3 py-3 text-left hover:bg-blue-500/5",onClick:()=>pe(T.id),children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-sm",children:[p.jsxs("span",{children:[p.jsx("span",{className:`mr-2 text-xs ${E}`,children:T.runIndex||"–"}),p.jsx("span",{className:"font-mono font-bold text-blue-600",children:T.executedMethod.toUpperCase()})]}),p.jsxs("span",{className:T.runPassed===!1?"text-red-600":T.runPassed===!0?"text-green-600":E,children:[T.runPassed===!0?"Runner pass":T.runPassed===!1?"Runner fail":"Recorded",T.status!==void 0?` · HTTP ${T.status}`:""]})]}),p.jsx("div",{className:p1,children:T.resolvedUrl})]},T.id))})]}),!U&&!B&&p.jsx("div",{className:`flex min-h-[20rem] items-center justify-center text-sm ${E}`,children:"Select a history entry or collection run to inspect it."}),B&&p.jsxs("div",{className:"space-y-5",children:[p.jsxs("div",{className:"space-y-2 border-b pb-4",children:[p.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[p.jsx("span",{className:"font-mono font-bold text-blue-600",children:B.executedMethod.toUpperCase()}),p.jsx("span",{className:Wc(B)?"text-red-600":E,children:sp(B)}),B.responseTime!==void 0&&p.jsxs("span",{className:E,children:[B.responseTime," ms"]}),B.runPassed!==void 0&&p.jsx("span",{className:B.runPassed?"text-green-600":"text-red-600",children:B.runPassed?"Runner pass":"Runner fail"})]}),p.jsx("div",{className:"mt-1 break-all font-mono text-sm",children:B.resolvedUrl}),p.jsxs("div",{className:`mt-1 text-xs ${E}`,children:[rp(B.createdAt),B.collectionId?` · ${K?.name||"Deleted collection"}`:"",B.folderId?` / ${W?.name||"Deleted folder"}`:"",B.runName?` · Run: ${B.runName}`:""]})]}),p.jsxs("div",{className:"flex shrink-0 gap-2",children:[p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium hover:bg-blue-500/10",onClick:()=>L(B),children:[p.jsx(QA,{className:"h-4 w-4"})," Open in client"]}),p.jsx("button",{type:"button","aria-label":"Delete selected history entry",className:"inline-flex min-h-10 items-center rounded-md border px-3 py-2 text-red-600",onClick:()=>Q(B.id),children:p.jsx(ci,{className:"h-4 w-4"})})]})]}),B.error&&p.jsx("div",{className:"rounded-md border border-red-300 bg-red-500/10 px-3 py-2 text-sm text-red-700",children:B.error})]}),p.jsxs("section",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("h3",{className:"font-semibold",children:"Request"}),B.requestBodyTruncated&&p.jsx("span",{className:"text-xs text-amber-600",children:"Body truncated in history"})]}),p.jsxs("div",{className:"grid gap-3 text-xs sm:grid-cols-2",children:[p.jsxs("div",{children:[p.jsx("span",{className:E,children:"Original URL"}),p.jsx("div",{className:"mt-1 break-all font-mono",children:B.request.url})]}),p.jsxs("div",{children:[p.jsx("span",{className:E,children:"Content type"}),p.jsx("div",{className:"mt-1 font-mono",children:B.request.contentType||"—"})]})]}),p.jsx(m1,{title:"Query parameters",values:B.request.query,mutedClass:E}),p.jsx(m1,{title:"Headers",values:B.request.headers,mutedClass:E}),B.request.body&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Body"}),p.jsx("pre",{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md border p-3 text-xs ${R}`,children:B.request.body})]})]}),p.jsxs("section",{className:"space-y-3 border-t pt-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("h3",{className:"font-semibold",children:"Response"}),B.responseBodyTruncated&&p.jsx("span",{className:"text-xs text-amber-600",children:"Body truncated in history"})]}),ce.length>0&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Headers"}),p.jsx("div",{className:"overflow-hidden rounded-md border",children:ce.map(([T,z],he)=>p.jsxs("div",{className:"grid grid-cols-[minmax(8rem,0.35fr)_minmax(0,1fr)] gap-3 border-b px-3 py-2 text-xs last:border-b-0",children:[p.jsx("span",{className:"break-all font-mono font-medium",children:T}),p.jsx("span",{className:`break-all font-mono ${E}`,children:z})]},`${T}:${he}`))})]}),B.responseBody!==void 0?p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Body"}),p.jsx("pre",{className:`max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border p-3 text-xs ${R}`,children:B.responseBody||"(empty response body)"})]}):p.jsx("p",{className:`text-sm ${E}`,children:"Response payload was not captured for this older history entry."})]}),(B.scriptTests?.length||B.scriptError||B.scriptLogs?.length)&&p.jsxs("section",{className:"space-y-3 border-t pt-4",children:[p.jsx("h3",{className:"font-semibold",children:"Tests & console"}),B.scriptTests?.length?p.jsxs("div",{className:"space-y-1",children:[p.jsxs("div",{className:`text-xs ${E}`,children:[ve,"/",B.scriptTests.length," tests passed"]}),B.scriptTests.map((T,z)=>p.jsxs("div",{className:`rounded-md border px-3 py-2 text-sm ${T.passed?"":"border-red-300 bg-red-500/10 text-red-700"}`,children:[p.jsxs("span",{className:"font-medium",children:[T.passed?"✓":"✕"," ",T.name]}),T.error&&p.jsx("div",{className:"mt-1 text-xs",children:T.error})]},`${T.name}:${z}`))]}):null,B.scriptError&&p.jsx("div",{className:"rounded-md border border-red-300 bg-red-500/10 px-3 py-2 text-sm text-red-700",children:B.scriptError}),B.scriptLogs?.length?p.jsx("pre",{className:`max-h-56 overflow-auto whitespace-pre-wrap rounded-md border p-3 text-xs ${R}`,children:B.scriptLogs.join(`
|
|
79
|
-
`)}):null]}),(B.scripts?.preRequest.trim()||B.scripts?.tests.trim())&&p.jsxs("section",{className:"space-y-3 border-t pt-4",children:[p.jsx("h3",{className:"font-semibold",children:"Scripts used"}),B.scripts?.preRequest.trim()&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Pre-request"}),p.jsx("pre",{className:`max-h-56 overflow-auto whitespace-pre-wrap rounded-md border p-3 text-xs ${
|
|
80
|
-
${s}`),s}function
|
|
81
|
-
`):at(t.exec)):""}function
|
|
78
|
+
${v.executedMethod.toUpperCase()} ${v.resolvedUrl}`)||e(w=>({...w,history:w.history.filter(A=>A.id!==b)})))};return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-history-heading",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Cd,{className:"h-4 w-4"}),p.jsx("h3",{id:"api-client-history-heading",className:"font-semibold",children:"Recent history"})]}),t.history.length>0&&r&&p.jsx("button",{type:"button",className:`text-xs underline underline-offset-2 ${a}`,onClick:r,children:"View all"})]}),p.jsxs("label",{className:"flex items-center gap-2 rounded-md border p-2 text-xs",title:"Sensitive history headers are always redacted.",children:[p.jsx("input",{type:"checkbox",checked:t.historyBodies!==!1,onChange:b=>e(v=>({...v,historyBodies:b.target.checked}))}),p.jsx("span",{children:"Store API-host bodies"})]}),p.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md border p-2 text-xs",children:[p.jsx("span",{className:a,title:"Counts and duration percentiles for this tab. No URLs, headers, bodies or credentials.",children:"Transport observation"}),p.jsxs("span",{className:"flex items-center gap-2",children:[p.jsx("button",{type:"button",className:"underline underline-offset-2",onClick:f,children:c?"Copied":"Copy"}),p.jsx("button",{type:"button",className:`underline underline-offset-2 ${a}`,onClick:()=>{FC(),u(!1)},children:"Reset"})]})]}),p.jsxs("div",{className:"space-y-1",children:[t.history.slice(0,5).map(b=>{const v=b.status!==void 0?`${b.status}${b.statusText?` ${b.statusText}`:""}`:b.error?"Error":"Sent",w=b.responseTime!==void 0?` · ${b.responseTime} ms`:"",A=b.scriptTests?.filter(O=>O.passed).length||0,C=b.scriptTests?.length?`${A}/${b.scriptTests.length} tests passed`:b.scriptError?"Script error":void 0;return p.jsxs("div",{className:"group flex items-start gap-1 rounded-md",children:[p.jsxs("button",{type:"button",className:"min-w-0 flex-1 rounded-md px-2 py-2 text-left hover:bg-blue-500/10","aria-label":`Load history request ${b.executedMethod.toUpperCase()} ${b.resolvedUrl}`,onClick:()=>h(b.id),children:[p.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[p.jsx("span",{className:"font-mono font-semibold text-blue-600",children:b.executedMethod.toUpperCase()}),p.jsxs("span",{className:b.error?"text-red-600":a,children:[v,w]})]}),p.jsx("div",{className:"truncate font-mono text-xs",title:b.resolvedUrl,children:b.resolvedUrl}),C&&p.jsx("div",{className:`mt-1 text-[11px] ${b.scriptError?"text-red-600":a}`,children:C}),p.jsx("div",{className:`mt-1 text-[11px] ${a}`,children:ap(b.createdAt)})]}),p.jsx("button",{type:"button",className:"rounded-md p-2 opacity-70 hover:opacity-100","aria-label":`Delete history request ${b.executedMethod.toUpperCase()} ${b.resolvedUrl}`,onClick:()=>g(b.id),children:p.jsx(ci,{className:"h-4 w-4"})})]},b.id)}),t.history.length===0&&p.jsx("div",{className:`rounded-md border border-dashed px-3 py-3 text-xs ${a}`,children:"Sent requests appear here for quick replay. Import or open a collection request, then Send it to start building history."})]}),t.history.length>0&&r&&p.jsxs("button",{type:"button",className:"w-full rounded-md border px-3 py-2 text-xs font-medium hover:bg-blue-500/10",onClick:r,children:["Open full history · ",t.history.length]})]})};function op(t){return t.error?"Request failed":t.status!==void 0?`${t.status}${t.statusText?` ${t.statusText}`:""}`:"Sent"}function yM(t){return(t||[]).filter(e=>e.enabled!==!1&&(e.key.trim()||e.value.trim()))}const Al="text-xs font-semibold uppercase tracking-wide",m1="font-mono font-semibold text-blue-600",g1="mt-1 truncate font-mono text-xs";function y1({title:t,values:e,mutedClass:n}){const r=yM(e);return r.length===0?null:p.jsxs("section",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:t}),p.jsx("div",{className:"overflow-hidden rounded-md border",children:r.map((s,a)=>p.jsxs("div",{className:"grid grid-cols-[minmax(8rem,0.35fr)_minmax(0,1fr)] gap-3 border-b px-3 py-2 text-xs last:border-b-0",children:[p.jsx("span",{className:"break-all font-mono font-medium",children:s.key||"—"}),p.jsx("span",{className:`break-all font-mono ${n}`,children:s.value})]},`${s.key}:${a}`))})]})}function b1(t){const e=[`${t.passed} runner passed`,`${t.failed} runner failed`];return t.cancelled&&e.push(`${t.cancelled} cancelled`),e.join(" · ")}const bM=({workspace:t,onWorkspaceChange:e,onLoadRequest:n,onBack:r,theme:s,initialEntryId:a,initialRunId:c})=>{const[u,f]=I.useState(""),[h,g]=I.useState("all"),[b,v]=I.useState("all"),[w,A]=I.useState(c?void 0:a||t.history[0]?.id),[C,O]=I.useState(c),D=s==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",E=s==="dark"?"border-gray-700 bg-gray-800/60 text-gray-100":"border-gray-200 bg-gray-50 text-gray-900",j=s==="dark"?"text-gray-400":"text-gray-500",M=s==="dark"?"border-gray-700 bg-gray-950 text-gray-100":"border-gray-200 bg-white text-gray-900",_=`rounded-md border px-3 py-2 text-sm ${D}`,q=I.useMemo(()=>pM(t,{query:u,method:h,outcome:b}),[h,b,u,t]),R=I.useMemo(()=>mM(q),[q]),X=C?R.find(T=>T.kind==="run"&&T.group.runId===C):void 0,U=X?.kind==="run"?X.group:void 0,B=U?void 0:q.find(T=>T.id===w)||q[0],K=B?.collectionId?t.collections.find(T=>T.id===B.collectionId):void 0,W=B?.folderId?t.folders.find(T=>T.id===B.folderId):void 0,ye=()=>{A(void 0),O(void 0)},pe=T=>{A(T),O(void 0)},fe=T=>{O(T),A(void 0)},L=T=>{n(T.request,T.scripts,T.collectionId,T.folderId),r()},Q=T=>{window.confirm("Delete this history entry? This cannot be undone.")&&(e(z=>({...z,history:z.history.filter(he=>he.id!==T)})),w===T&&A(void 0))},oe=()=>{window.confirm("Clear all request history? This cannot be undone.")&&(e(T=>({...T,history:[]})),ye())},ce=B?.responseHeaders||[],ve=B?.scriptTests?.filter(T=>T.passed).length||0;return p.jsx("section",{className:`rounded-xl border p-4 md:p-5 ${E}`,"aria-labelledby":"api-client-history-page-heading",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[p.jsxs("div",{className:"flex items-center gap-3",children:[p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm",onClick:r,children:[p.jsx(Ro,{className:"h-4 w-4"})," Client"]}),p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Cd,{className:"h-5 w-5"}),p.jsx("h2",{id:"api-client-history-page-heading",className:"text-lg font-semibold",children:"Request history"})]}),p.jsxs("p",{className:`text-xs ${j}`,children:[t.history.length," persisted request",t.history.length===1?"":"s"," · newest first"]})]})]}),t.history.length>0&&p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 self-start rounded-md border px-3 py-2 text-sm text-red-600",onClick:oe,children:[p.jsx(ci,{className:"h-4 w-4"})," Clear history"]})]}),p.jsxs("div",{className:"grid gap-2 md:grid-cols-[minmax(0,1fr)_10rem_12rem]",children:[p.jsxs("label",{className:"relative",children:[p.jsx("span",{className:"sr-only",children:"Search history"}),p.jsx(Hg,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 ${j}`}),p.jsx("input",{"aria-label":"Search history",className:`w-full rounded-md border py-2 pl-9 pr-3 text-sm ${D}`,value:u,onChange:T=>{f(T.target.value),ye()},placeholder:"Search URL, status, collection or run…"})]}),p.jsxs("select",{"aria-label":"History method filter",className:_,value:h,onChange:T=>{g(T.target.value),ye()},children:[p.jsx("option",{value:"all",children:"All methods"}),["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(T=>p.jsx("option",{value:T,children:T},T))]}),p.jsxs("select",{"aria-label":"History outcome filter",className:_,value:b,onChange:T=>{v(T.target.value),ye()},children:[p.jsx("option",{value:"all",children:"All outcomes"}),p.jsx("option",{value:"success",children:"Successful HTTP"}),p.jsx("option",{value:"failed",children:"HTTP / script failures"}),p.jsx("option",{value:"tests",children:"With tests"})]})]}),p.jsxs("div",{className:"grid min-h-[32rem] gap-4 lg:grid-cols-[minmax(18rem,0.85fr)_minmax(0,1.35fr)]",children:[p.jsxs("div",{className:"max-h-[48rem] space-y-2 overflow-auto rounded-lg border p-2",children:[R.map(T=>{if(T.kind==="entry"){const ne=T.entry,ke=B?.id===ne.id,qe=Wc(ne),$e=ne.collectionId?t.collections.find(Fe=>Fe.id===ne.collectionId)?.name||"Deleted collection":void 0;return p.jsxs("button",{type:"button",className:`w-full rounded-md border px-3 py-3 text-left transition ${ke?"border-blue-500 bg-blue-500/10":"border-transparent hover:bg-blue-500/5"}`,onClick:()=>pe(ne.id),children:[p.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs",children:[p.jsx("span",{className:m1,children:ne.executedMethod.toUpperCase()}),p.jsxs("span",{className:qe?"text-red-600":j,children:[op(ne),ne.responseTime!==void 0?` · ${ne.responseTime} ms`:""]})]}),p.jsx("div",{className:g1,title:ne.resolvedUrl,children:ne.resolvedUrl}),p.jsxs("div",{className:`mt-1 flex items-center justify-between gap-2 text-[11px] ${j}`,children:[p.jsx("span",{className:"truncate",children:$e||"Unsaved request"}),p.jsx("span",{children:ap(ne.createdAt)})]})]},ne.id)}const z=T.group,he=U?.runId===z.runId;return p.jsxs("div",{className:`rounded-lg border ${he?"border-blue-500 bg-blue-500/5":""}`,children:[p.jsxs("button",{type:"button","aria-label":`Open collection run ${z.runName}`,className:"w-full px-3 py-3 text-left",onClick:()=>fe(z.runId),children:[p.jsx("div",{className:"text-xs font-semibold text-blue-600",children:"Collection run"}),p.jsx("div",{className:"mt-1 truncate text-sm font-medium",children:z.runName}),p.jsxs("div",{className:`mt-1 text-[11px] ${j}`,children:[z.captured,"/",z.total," history entries · ",b1(z)]})]}),p.jsx("div",{className:"border-t px-2 py-1",children:z.entries.map(ne=>p.jsxs("button",{type:"button",className:`w-full rounded-md px-2 py-2 text-left text-xs hover:bg-blue-500/10 ${B?.id===ne.id?"bg-blue-500/10":""}`,onClick:()=>pe(ne.id),children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsxs("span",{children:[p.jsx("span",{className:"mr-2 text-[10px] text-gray-500",children:ne.runIndex||"–"}),p.jsx("span",{className:m1,children:ne.executedMethod.toUpperCase()})]}),p.jsx("span",{className:Wc(ne)?"text-red-600":j,children:op(ne)})]}),p.jsx("div",{className:"mt-1 truncate font-mono",title:ne.resolvedUrl,children:ne.resolvedUrl})]},ne.id))})]},z.runId)}),q.length===0&&p.jsx("div",{className:`px-3 py-8 text-center text-sm ${j}`,children:t.history.length===0?"Send a request to start building history.":"No history entries match these filters."})]}),p.jsxs("div",{className:"min-w-0 rounded-lg border p-4",children:[U&&p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"border-b pb-4",children:[p.jsx("div",{className:"text-xs font-semibold uppercase tracking-wide text-blue-600",children:"Collection run"}),p.jsx("h3",{className:"mt-1 text-lg font-semibold",children:U.runName}),p.jsxs("p",{className:`mt-1 text-sm ${j}`,children:[U.captured," / ",U.total," history entries captured · ",b1(U)]}),p.jsx("p",{className:`mt-2 text-xs ${j}`,children:"Runner pass/fail is based on transport, scripts, and tests. An HTTP 4xx/5xx can therefore be a runner pass while still appearing as an HTTP failure in the request inspector."})]}),p.jsx("div",{className:"space-y-2",children:U.entries.map(T=>p.jsxs("button",{type:"button","aria-label":`Inspect history ${T.runIndex||""}`,className:"w-full rounded-md border px-3 py-3 text-left hover:bg-blue-500/5",onClick:()=>pe(T.id),children:[p.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 text-sm",children:[p.jsxs("span",{children:[p.jsx("span",{className:`mr-2 text-xs ${j}`,children:T.runIndex||"–"}),p.jsx("span",{className:"font-mono font-bold text-blue-600",children:T.executedMethod.toUpperCase()})]}),p.jsxs("span",{className:T.runPassed===!1?"text-red-600":T.runPassed===!0?"text-green-600":j,children:[T.runPassed===!0?"Runner pass":T.runPassed===!1?"Runner fail":"Recorded",T.status!==void 0?` · HTTP ${T.status}`:""]})]}),p.jsx("div",{className:g1,children:T.resolvedUrl})]},T.id))})]}),!U&&!B&&p.jsx("div",{className:`flex min-h-[20rem] items-center justify-center text-sm ${j}`,children:"Select a history entry or collection run to inspect it."}),B&&p.jsxs("div",{className:"space-y-5",children:[p.jsxs("div",{className:"space-y-2 border-b pb-4",children:[p.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[p.jsx("span",{className:"font-mono font-bold text-blue-600",children:B.executedMethod.toUpperCase()}),p.jsx("span",{className:Wc(B)?"text-red-600":j,children:op(B)}),B.responseTime!==void 0&&p.jsxs("span",{className:j,children:[B.responseTime," ms"]}),B.runPassed!==void 0&&p.jsx("span",{className:B.runPassed?"text-green-600":"text-red-600",children:B.runPassed?"Runner pass":"Runner fail"})]}),p.jsx("div",{className:"mt-1 break-all font-mono text-sm",children:B.resolvedUrl}),p.jsxs("div",{className:`mt-1 text-xs ${j}`,children:[ap(B.createdAt),B.collectionId?` · ${K?.name||"Deleted collection"}`:"",B.folderId?` / ${W?.name||"Deleted folder"}`:"",B.runName?` · Run: ${B.runName}`:""]})]}),p.jsxs("div",{className:"flex shrink-0 gap-2",children:[p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium hover:bg-blue-500/10",onClick:()=>L(B),children:[p.jsx(ZA,{className:"h-4 w-4"})," Open in client"]}),p.jsx("button",{type:"button","aria-label":"Delete selected history entry",className:"inline-flex min-h-10 items-center rounded-md border px-3 py-2 text-red-600",onClick:()=>Q(B.id),children:p.jsx(ci,{className:"h-4 w-4"})})]})]}),B.error&&p.jsx("div",{className:"rounded-md border border-red-300 bg-red-500/10 px-3 py-2 text-sm text-red-700",children:B.error})]}),p.jsxs("section",{className:"space-y-3",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("h3",{className:"font-semibold",children:"Request"}),B.requestBodyTruncated&&p.jsx("span",{className:"text-xs text-amber-600",children:"Body truncated in history"})]}),p.jsxs("div",{className:"grid gap-3 text-xs sm:grid-cols-2",children:[p.jsxs("div",{children:[p.jsx("span",{className:j,children:"Original URL"}),p.jsx("div",{className:"mt-1 break-all font-mono",children:B.request.url})]}),p.jsxs("div",{children:[p.jsx("span",{className:j,children:"Content type"}),p.jsx("div",{className:"mt-1 font-mono",children:B.request.contentType||"—"})]})]}),p.jsx(y1,{title:"Query parameters",values:B.request.query,mutedClass:j}),p.jsx(y1,{title:"Headers",values:B.request.headers,mutedClass:j}),B.request.body&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Body"}),p.jsx("pre",{className:`max-h-72 overflow-auto whitespace-pre-wrap break-words rounded-md border p-3 text-xs ${M}`,children:B.request.body})]})]}),p.jsxs("section",{className:"space-y-3 border-t pt-4",children:[p.jsxs("div",{className:"flex items-center justify-between gap-2",children:[p.jsx("h3",{className:"font-semibold",children:"Response"}),B.responseBodyTruncated&&p.jsx("span",{className:"text-xs text-amber-600",children:"Body truncated in history"})]}),ce.length>0&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Headers"}),p.jsx("div",{className:"overflow-hidden rounded-md border",children:ce.map(([T,z],he)=>p.jsxs("div",{className:"grid grid-cols-[minmax(8rem,0.35fr)_minmax(0,1fr)] gap-3 border-b px-3 py-2 text-xs last:border-b-0",children:[p.jsx("span",{className:"break-all font-mono font-medium",children:T}),p.jsx("span",{className:`break-all font-mono ${j}`,children:z})]},`${T}:${he}`))})]}),B.responseBody!==void 0?p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Body"}),p.jsx("pre",{className:`max-h-96 overflow-auto whitespace-pre-wrap break-words rounded-md border p-3 text-xs ${M}`,children:B.responseBody||"(empty response body)"})]}):p.jsx("p",{className:`text-sm ${j}`,children:"Response payload was not captured for this older history entry."})]}),(B.scriptTests?.length||B.scriptError||B.scriptLogs?.length)&&p.jsxs("section",{className:"space-y-3 border-t pt-4",children:[p.jsx("h3",{className:"font-semibold",children:"Tests & console"}),B.scriptTests?.length?p.jsxs("div",{className:"space-y-1",children:[p.jsxs("div",{className:`text-xs ${j}`,children:[ve,"/",B.scriptTests.length," tests passed"]}),B.scriptTests.map((T,z)=>p.jsxs("div",{className:`rounded-md border px-3 py-2 text-sm ${T.passed?"":"border-red-300 bg-red-500/10 text-red-700"}`,children:[p.jsxs("span",{className:"font-medium",children:[T.passed?"✓":"✕"," ",T.name]}),T.error&&p.jsx("div",{className:"mt-1 text-xs",children:T.error})]},`${T.name}:${z}`))]}):null,B.scriptError&&p.jsx("div",{className:"rounded-md border border-red-300 bg-red-500/10 px-3 py-2 text-sm text-red-700",children:B.scriptError}),B.scriptLogs?.length?p.jsx("pre",{className:`max-h-56 overflow-auto whitespace-pre-wrap rounded-md border p-3 text-xs ${M}`,children:B.scriptLogs.join(`
|
|
79
|
+
`)}):null]}),(B.scripts?.preRequest.trim()||B.scripts?.tests.trim())&&p.jsxs("section",{className:"space-y-3 border-t pt-4",children:[p.jsx("h3",{className:"font-semibold",children:"Scripts used"}),B.scripts?.preRequest.trim()&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Pre-request"}),p.jsx("pre",{className:`max-h-56 overflow-auto whitespace-pre-wrap rounded-md border p-3 text-xs ${M}`,children:B.scripts.preRequest})]}),B.scripts?.tests.trim()&&p.jsxs("div",{className:"space-y-2",children:[p.jsx("h4",{className:Al,children:"Tests"}),p.jsx("pre",{className:`max-h-56 overflow-auto whitespace-pre-wrap rounded-md border p-3 text-xs ${M}`,children:B.scripts.tests})]})]})]})]})]})]})})};function hn(t){return!!t&&typeof t=="object"&&!Array.isArray(t)}function at(t){if(t==null)return"";if(typeof t=="string")return t;if(typeof t=="number"||typeof t=="boolean")return String(t);try{return JSON.stringify(t)}catch{return String(t)}}function Wn(t,e,n,r){t.push({code:e,path:n,message:r})}function Qr(t){return Array.isArray(t)?t.filter(hn):[]}function et(t,e,n){const r=Qr(t[e]).find(s=>s.key===n);return r?at(r.value):""}function xM(t){switch(t){case"authorization_code":return"authorizationCode";case"client_credentials":return"clientCredentials";case"password_credentials":case"password":return"password";case"implicit":return"implicit";case"access_token":return"accessToken";default:return}}function cp(t,e,n,r){if(!hn(t)||typeof t.type!="string")return{...e};const s=t.type.toLowerCase();if(s==="inherit")return{...e};if(s==="noauth")return{type:"none"};if(s==="bearer")return{type:"bearer",token:et(t,"bearer","token")};if(s==="basic")return{type:"basic",username:et(t,"basic","username"),password:et(t,"basic","password")};if(s==="apikey"){const c=et(t,"apikey","in").toLowerCase();return c==="cookie"?Wn(r,"postman-auth-host-execution",n,"Imported Postman cookie API key requires FlexDoc API host execution; the browser will not send this auth mode directly."):c&&c!=="header"&&c!=="query"&&Wn(r,"postman-auth-apikey-location",n,`Unsupported Postman API-key location "${c}"; imported as a header API key.`),{type:"apiKey",key:et(t,"apikey","key"),value:et(t,"apikey","value"),in:c==="query"?"query":c==="cookie"?"cookie":"header"}}if(s==="oauth2"){const c=et(t,"oauth2","scope"),u=xM(et(t,"oauth2","grant_type")),f=et(t,"oauth2","client_authentication").toLowerCase();return{type:"oauth2",accessToken:et(t,"oauth2","accessToken"),...u?{grantType:u}:{},authorizationUrl:et(t,"oauth2","authUrl")||void 0,tokenUrl:et(t,"oauth2","accessTokenUrl")||void 0,clientId:et(t,"oauth2","clientId")||void 0,clientSecret:et(t,"oauth2","clientSecret")||void 0,clientAuthentication:f==="header"||f==="basic"?"basic":"body",redirectUri:et(t,"oauth2","redirect_uri")||void 0,scopes:c?c.split(/[\s,]+/).filter(Boolean):void 0,username:et(t,"oauth2","username")||void 0,password:et(t,"oauth2","password")||void 0,refreshToken:et(t,"oauth2","refreshToken")||void 0}}const a=c=>Wn(r,"postman-auth-host-execution",n,`Imported Postman ${c} auth requires FlexDoc API host execution; the browser will not send this auth mode directly.`);if(s==="digest")return a("Digest"),{type:"digest",username:et(t,"digest","username"),password:et(t,"digest","password")};if(s==="hawk"){a("Hawk");const c=et(t,"hawk","algorithm").toLowerCase();return{type:"hawk",id:et(t,"hawk","authId")||et(t,"hawk","id"),key:et(t,"hawk","authKey")||et(t,"hawk","key"),algorithm:c==="sha1"?"sha1":"sha256",ext:et(t,"hawk","extraData")||et(t,"hawk","ext")||void 0}}if(s==="ntlm")return a("NTLM/Negotiate"),{type:"ntlm",username:et(t,"ntlm","username"),password:et(t,"ntlm","password"),domain:et(t,"ntlm","domain")||void 0,workstation:et(t,"ntlm","workstation")||void 0};if(s==="oauth1"){a("OAuth 1.0");const c=et(t,"oauth1","signatureMethod").toUpperCase();return{type:"oauth1",consumerKey:et(t,"oauth1","consumerKey"),consumerSecret:et(t,"oauth1","consumerSecret"),token:et(t,"oauth1","token")||void 0,tokenSecret:et(t,"oauth1","tokenSecret")||void 0,signatureMethod:c==="HMAC-SHA256"||c==="PLAINTEXT"?c:"HMAC-SHA1",realm:et(t,"oauth1","realm")||void 0}}return s==="awsv4"?(a("AWS Signature V4"),{type:"awsv4",accessKey:et(t,"awsv4","accessKey"),secretKey:et(t,"awsv4","secretKey"),sessionToken:et(t,"awsv4","sessionToken")||void 0,region:et(t,"awsv4","region"),service:et(t,"awsv4","service")}):(Wn(r,"postman-auth-unsupported",n,`Postman auth type "${t.type}" is not supported by FlexDoc and was left to inherited/default auth.`),{...e})}function x1(t,e,n){return Qr(t).flatMap((r,s)=>{const a=at(r.key).trim();return a?[{id:Sn("variable"),key:a,value:at(r.value),enabled:r.disabled!==!0&&r.enabled!==!1}]:(Wn(n,"postman-variable-empty-key",`${e}[${s}]`,"Skipped a Postman variable with an empty key."),[])})}function vM(t,e,n){const r=["pm.sendRequest","pm.globals","pm.iterationData","pm.cookies","pm.vault","pm.require","pm.execution","postman."].filter(a=>t.includes(a));let s=t.replace(/\bpm\.response\.to\.have\.status\(([^)\n]+)\)\s*;?/g,"flex.expect(flex.response?.code).to.equal($1);").replace(/\bpm\.response\.to\.have\.header\(([^)\n]+)\)\s*;?/g,"flex.expect(flex.response?.headers.has($1)).to.equal(true);").replace(/\bpm\.collectionVariables\b/g,"flex.collection").replace(/\bpm\.environment\b/g,"flex.environment").replace(/\bpm\.variables\b/g,"flex.variables").replace(/\bpm\.request\b/g,"flex.request").replace(/\bpm\.response\b/g,"flex.response").replace(/\bpm\.expect\b/g,"flex.expect").replace(/\bpm\.test\b/g,"flex.test").replace(/\bflex\.request\.headers\.add\s*\(/g,"flex.request.headers.upsert(");return/\bpm\./.test(s)&&r.push("other pm.* APIs"),r.length>0&&(Wn(n,"postman-script-partial-compatibility",e,`Imported script uses unsupported Postman APIs (${[...new Set(r)].join(", ")}); review the script before relying on it.`),s=`// Imported from Postman. Review unsupported API usage before relying on this script.
|
|
80
|
+
${s}`),s}function wM(t,e,n){return hn(t)?(t.src!==void 0&&Wn(n,"postman-script-src",e,"External Postman script sources are not fetched; only inline script.exec content is imported."),Array.isArray(t.exec)?t.exec.map(at).join(`
|
|
81
|
+
`):at(t.exec)):""}function v1(t,e,n){const r={preRequest:[],tests:[]};return Qr(t).forEach((s,a)=>{const c=at(s.listen).toLowerCase();if(c!=="prerequest"&&c!=="test")return;const u=`${e}[${a}]`,f=wM(s.script,`${u}.script`,n).trim();if(!f)return;const h=vM(f,`${u}.script`,n);c==="prerequest"?r.preRequest.push(h):r.tests.push(h)}),r}function SM(t,e){return{preRequest:[...t.preRequest,...e.preRequest],tests:[...t.tests,...e.tests]}}function AM(t){const e=t.preRequest.filter(Boolean).join(`
|
|
82
82
|
|
|
83
83
|
`).trim(),n=t.tests.filter(Boolean).join(`
|
|
84
84
|
|
|
85
|
-
`).trim();return e||n?{preRequest:e,tests:n}:void 0}function x1(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return t}}function v1(t){const e=t.split("#",1)[0],n=e.indexOf("?");if(n<0)return{url:e,query:[]};const r=e.slice(n+1),s=r?r.split("&").map(a=>{const c=a.indexOf("=");return{key:x1(c>=0?a.slice(0,c):a),value:x1(c>=0?a.slice(c+1):""),enabled:!0}}):[];return{url:e.slice(0,n),query:s}}function pM(t){return Qr(t).map(e=>({key:at(e.key),value:at(e.value),enabled:e.disabled!==!0}))}function mM(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function w1(t,e){let n=t;for(const r of Qr(e)){const s=at(r.key).trim();s&&(n=n.replace(new RegExp(`:${mM(s)}(?=/|$)`,"g"),`{{${s}}}`))}return n}function gM(t){if(typeof t=="string")return v1(t);if(!hn(t))return{url:"",query:[]};const e=pM(t.query),n=at(t.raw);if(n){const h=v1(n);return{url:w1(h.url,t.variable),query:e.length>0?e:h.query}}const r=at(t.protocol).replace(/:$/,""),s=Array.isArray(t.host)?t.host.map(at).join("."):at(t.host),a=at(t.port),c=Array.isArray(t.path)?t.path.map(at).join("/"):at(t.path).replace(/^\//,""),u=s?`${r?`${r}://`:""}${s}${a?`:${a}`:""}`:"",f=u?`${u}${c?`/${c}`:""}`:c;return{url:w1(f,t.variable),query:e}}function yM(t){return Qr(t).map(e=>({key:at(e.key),value:at(e.value),enabled:e.disabled!==!0}))}function bM(t){return t.find(e=>e.enabled!==!1&&e.key.toLowerCase()==="content-type")?.value}function xM(t){switch(t.toLowerCase()){case"json":return"application/json";case"xml":return"application/xml";case"html":return"text/html";case"javascript":return"application/javascript";case"text":return"text/plain";default:return}}function vM(t,e,n,r){const s=bM(e);if(!hn(t)||!t.mode)return{body:"",contentType:s||"application/json",bodyMode:"none"};const a=at(t.mode);if(a==="raw"){const c=hn(t.options)&&hn(t.options.raw)?t.options.raw:void 0,u=c?at(c.language):"";return{body:at(t.raw),contentType:s||xM(u)||"text/plain",bodyMode:u.toLowerCase()==="json"?"json":"raw"}}if(a==="urlencoded")return{body:"",bodyMode:"urlencoded",urlencoded:Qr(t.urlencoded).map(u=>({key:at(u.key),value:at(u.value),enabled:u.disabled!==!0})),contentType:s||"application/x-www-form-urlencoded"};if(a==="graphql"){const c=hn(t.graphql)?t.graphql:{},u=at(c.variables);return{body:"",bodyMode:"graphql",graphql:{query:at(c.query),variables:u},contentType:s||"application/json"}}if(a==="formdata"){const c=Qr(t.formdata).map(f=>{const h=at(f.type)==="file"?"file":"text",g=Array.isArray(f.src)?f.src.map(at).filter(Boolean).join(", "):at(f.src);return{key:at(f.key),value:h==="text"?at(f.value):"",enabled:f.disabled!==!0,type:h,...h==="file"&&g?{fileName:g}:{},...typeof f.contentType=="string"?{contentType:f.contentType}:{}}});return c.filter(f=>f.type==="file").length>0&&Wn(r,"postman-body-formdata-files",n,"Multipart file fields were preserved, but exported local file paths cannot be reopened by the browser. Re-select those files before sending."),{body:"",bodyMode:"formdata",formData:c,contentType:s}}if(a==="file"){const c=hn(t.file)?at(t.file.src):at(t.src);return Wn(r,"postman-body-file",n,c?`Postman binary file body "${c}" was preserved as intent, but browser security requires re-selecting the file before sending.`:"Postman binary file body requires selecting the file again in FlexDoc before sending."),{body:"",contentType:s||"application/octet-stream",bodyMode:"binary",binary:{fileName:c||void 0,contentType:s||"application/octet-stream"}}}return Wn(r,"postman-body-unsupported",n,`Postman body mode "${a}" is not supported; the request body was left empty.`),{body:"",contentType:s||"application/octet-stream",bodyMode:"none"}}function wM(t,e,n,r,s,a,c,u){const f=typeof t=="string"?{method:"GET",url:t}:t;if(!hn(f))return Wn(u,"postman-request-invalid",c,"Skipped an invalid Postman request entry."),null;const h=at(f.method).trim().toUpperCase()||"GET",g=gM(f.url),b=yM(f.header),v=vM(f.body,b,`${c}.body`,u),w={method:h,url:g.url,query:g.query,headers:b,body:v.body,contentType:v.contentType,bodyMode:v.bodyMode,urlencoded:v.urlencoded,formData:v.formData,binary:v.binary,graphql:v.graphql,auth:lp(f.auth,{type:"inherit"},`${c}.auth`,u)},A=hM(s);return{id:Sn("request"),collectionId:n,folderId:r,name:e.trim()||`${h} ${g.url||"request"}`,request:w,...A?{scripts:A}:{},createdAt:a,updatedAt:a}}function S1(t){Array.isArray(t.items)&&t.items.forEach((e,n)=>{const r=`${t.path}[${n}]`;if(!hn(e)){Wn(t.warnings,"postman-item-invalid",r,"Skipped an invalid Postman item.");return}const s=at(e.name)||"Untitled",a=b1(e.event,`${r}.event`,t.warnings),c=fM(t.inheritedScripts,a);if(Array.isArray(e.item)){const f=Sn("folder");t.folders.push({id:f,collectionId:t.collectionId,parentFolderId:t.parentFolderId,name:s,auth:lp(e.auth,{type:"inherit"},`${r}.auth`,t.warnings),createdAt:t.timestamp,updatedAt:t.timestamp}),S1({...t,items:e.item,parentFolderId:f,inheritedScripts:c,path:`${r}.item`});return}const u=wM(e.request,s,t.collectionId,t.parentFolderId,c,t.timestamp,`${r}.request`,t.warnings);u&&t.requests.push(u)})}function SM(t){if(!hn(t)||!hn(t.info)||!Array.isArray(t.item))throw new Error("This JSON is not a Postman collection. Expected info and item fields.");const e=at(t.info.name).trim();if(!e)throw new Error("Postman collection info.name is required.");const n=[],r=at(t.info.schema);r&&!r.includes("/v2.1.0/")&&Wn(n,"postman-schema-version","info.schema",`Collection schema "${r}" is not Postman v2.1; FlexDoc imported the compatible fields it recognized.`);const s=new Date().toISOString(),a=Sn("collection"),c={id:a,name:e,auth:lp(t.auth,{type:"none"},"auth",n),variables:y1(t.variable,"variable",n),createdAt:s,updatedAt:s},u=[],f=[];return S1({items:t.item,collectionId:a,inheritedScripts:b1(t.event,"event",n),timestamp:s,path:"item",folders:u,requests:f,warnings:n}),{collection:c,folders:u,requests:f,warnings:n}}function AM(t){if(!hn(t)||!Array.isArray(t.values)||typeof t.name!="string")throw new Error("This JSON is not a Postman environment. Expected name and values fields.");const e=at(t._postman_variable_scope).toLowerCase();if(e&&e!=="environment")throw new Error(`Postman variable scope "${e}" is not an environment.`);const n=[],r=new Date().toISOString();return{environment:{id:Sn("environment"),name:t.name.trim()||"Imported environment",variables:y1(t.values,"values",n),createdAt:r,updatedAt:r},warnings:n}}function kM(t){if(hn(t)&&hn(t.info)&&Array.isArray(t.item))return{kind:"collection",result:SM(t)};if(hn(t)&&Array.isArray(t.values)&&typeof t.name=="string")return{kind:"environment",result:AM(t)};throw new Error("Unsupported Postman JSON. Import a collection v2.1 JSON file or an exported environment JSON file.")}function CM(t){if(t.collections.length!==1||t.folders.length!==0||t.requests.length!==0)return!1;const e=t.collections[0];return e.name==="My Collection"&&e.auth.type==="none"&&e.variables.length===0}function NM(t,e){const n=CM(t)?[]:t.collections;return{...t,collections:[...n,e.collection],folders:[...t.folders,...e.folders],requests:[...t.requests,...e.requests]}}function TM(t,e){return{...t,environments:[...t.environments,e.environment],activeEnvironmentId:t.activeEnvironmentId||e.environment.id}}function A1(t,e){return`${t} ${t===1?e:`${e}s`}`}const jM=({onWorkspaceChange:t,onSelectedCollectionChange:e,theme:n})=>{const r=I.useRef(null),[s,a]=I.useState(null),[c,u]=I.useState([]),f=async A=>{if(A.length===0)return;const C=[],j=[],D=[];for(const q of A)try{const O=JSON.parse(await q.text()),X=kM(O);C.push(X),j.push(...X.result.warnings.map(U=>({...U,path:`${q.name}:${U.path}`})))}catch(O){D.push(`${q.name}: ${O instanceof Error?O.message:String(O)}`)}C.length>0&&t(q=>{let O=q;for(const X of C)O=X.kind==="collection"?NM(O,X.result):TM(O,X.result);return O});const M=C.filter(q=>q.kind==="collection"),E=C.length-M.length,R=M[M.length-1];R?.kind==="collection"&&e?.(R.result.collection.id),u(j);const _=[M.length>0?A1(M.length,"collection"):"",E>0?A1(E,"environment"):""].filter(Boolean);C.length===0?a({tone:"error",text:D.join(" ")||"No Postman documents were imported."}):D.length>0||j.length>0?a({tone:"warning",text:`Imported ${_.join(" and ")}. ${D.length>0?`${D.length} file${D.length===1?"":"s"} failed to import.`:`${j.length} compatibility warning${j.length===1?"":"s"} need review.`}`}):a({tone:"success",text:`Imported ${_.join(" and ")}.`})},h=n==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",g=n==="dark"?"text-gray-400":"text-gray-500",b=n==="dark"?"text-amber-300":"text-amber-700",v=n==="dark"?"text-emerald-300":"text-emerald-700",w=n==="dark"?"text-red-300":"text-red-700";return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-import-heading",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Ug,{className:"h-4 w-4"}),p.jsx("h3",{id:"api-client-import-heading",className:"font-semibold",children:"Import"})]}),p.jsx("input",{ref:r,type:"file",accept:".json,application/json",multiple:!0,className:"hidden","aria-label":"Import Postman JSON",onChange:A=>{const C=Array.from(A.currentTarget.files||[]);A.currentTarget.value="",f(C)}}),p.jsxs("button",{type:"button",className:`flex w-full items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm font-medium ${h}`,onClick:()=>r.current?.click(),children:[p.jsx(Ug,{className:"h-4 w-4"}),"Import Postman"]}),p.jsx("p",{className:`text-xs ${g}`,children:"Import Postman Collection v2.1 and exported environment JSON files. Multiple files can be selected together."}),s&&p.jsxs("div",{className:`flex items-start gap-2 text-xs ${s.tone==="success"?v:s.tone==="warning"?b:w}`,role:"status",children:[s.tone==="success"?p.jsx(la,{className:"mt-0.5 h-4 w-4 shrink-0"}):p.jsx(Ed,{className:"mt-0.5 h-4 w-4 shrink-0"}),p.jsx("span",{children:s.text})]}),c.length>0&&p.jsxs("details",{className:`text-xs ${b}`,children:[p.jsxs("summary",{className:"cursor-pointer font-medium",children:["Review import warnings (",c.length,")"]}),p.jsxs("ul",{className:"mt-2 space-y-2 pl-4",children:[c.slice(0,5).map((A,C)=>p.jsxs("li",{children:[p.jsx("span",{className:"font-mono",children:A.path}),": ",A.message]},`${A.code}-${A.path}-${C}`)),c.length>5&&p.jsxs("li",{children:[c.length-5," more warning",c.length-5===1?"":"s"," not shown."]})]})]})]})};function EM(t,e){if(!e.folderId)return"Collection root";const n=new Map(t.folders.map(c=>[c.id,c])),r=[],s=new Set;let a=n.get(e.folderId);for(;a&&!s.has(a.id);)s.add(a.id),r.unshift(a.name),a=a.parentFolderId?n.get(a.parentFolderId):void 0;return r.join(" / ")||"Deleted folder"}function OM(t){return t.status==="running"?"Running":t.status==="passed"?"Runner pass":t.status==="failed"?"Runner fail":t.status==="cancelled"?"Cancelled":t.status==="skipped"?"Not run":"Pending"}const MM=({workspace:t,onWorkspaceChange:e,collectionId:n,folderId:r,theme:s,credentials:a,requestInterceptor:c,hostExecution:u,externalVariables:f,externalEnvironmentVariables:h,onCollectionChanges:g,onEnvironmentChanges:b,onOpenHistory:v,onBack:w,fetcher:A})=>{const C=I.useMemo(()=>Sl(t,n,r),[n,r,t]),j=I.useMemo(()=>f1(t,n,r),[n,r,t]),D=t.environments.find(Q=>Q.id===t.activeEnvironmentId),[M,E]=I.useState(!1),[R,_]=I.useState(!1),[q,O]=I.useState(),[X,U]=I.useState({}),B=I.useRef(void 0),K=I.useRef(!0);I.useEffect(()=>(K.current=!0,()=>{K.current=!1,B.current?.abort()}),[]);const W=async()=>{if(R||C.length===0)return;const Q=new AbortController;B.current=Q,_(!0),O(void 0),U(Object.fromEntries(C.map(ce=>[ce.id,{status:"pending"}])));const oe=await eM({workspace:t,collectionId:n,folderId:r,runName:j,credentials:a,requestInterceptor:c,hostExecution:u,externalVariables:f,externalEnvironmentVariables:h,stopOnFailure:M,signal:Q.signal,fetcher:A,onCollectionChanges:g,onEnvironmentChanges:b,onRequestStart:ce=>{K.current&&U(ve=>({...ve,[ce.id]:{status:"running"}}))},onRequestComplete:ce=>{K.current&&U(ve=>({...ve,[ce.requestId]:{status:ce.cancelled?"cancelled":ce.passed?"passed":"failed",item:ce}}))}});K.current&&(e(oe.workspace),U(ce=>Object.fromEntries(C.map(ve=>{const T=ce[ve.id]||{status:"pending"};return[ve.id,T.status==="pending"&&oe.stopped?{status:"skipped"}:T]}))),O(oe),_(!1),B.current=void 0)},ye=()=>B.current?.abort(),pe=s==="dark"?"border-gray-700 bg-gray-800/60 text-gray-100":"border-gray-200 bg-gray-50 text-gray-900",fe=s==="dark"?"text-gray-400":"text-gray-500",L=s==="dark"?"border-gray-700 bg-gray-900/40":"border-gray-200 bg-white";return p.jsx("section",{className:`rounded-xl border p-4 md:p-5 ${pe}`,"aria-labelledby":"api-client-runner-heading",children:p.jsxs("div",{className:"space-y-5",children:[p.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm",onClick:w,children:[p.jsx(Ro,{className:"h-4 w-4"})," Client"]}),p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(aa,{className:"h-5 w-5"}),p.jsx("h2",{id:"api-client-runner-heading",className:"text-lg font-semibold",children:"Collection runner"})]}),p.jsx("p",{className:"mt-1 text-sm font-medium",children:j}),p.jsxs("p",{className:`mt-1 text-xs ${fe}`,children:[C.length," saved request",C.length===1?"":"s"," · Environment: ",D?.name||"None"]})]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[q?.runId&&p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm",onClick:()=>v(void 0,q.runId),children:[p.jsx(FA,{className:"h-4 w-4"})," Open run history"]}),R?p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border border-red-300 px-3 py-2 text-sm text-red-700",onClick:ye,children:[p.jsx(Hg,{className:"h-4 w-4"})," Stop run"]}):p.jsxs("button",{type:"button",disabled:C.length===0,className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>{W()},children:[p.jsx(aa,{className:"h-4 w-4"})," ",q?"Run again":"Start run"]})]})]}),p.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border p-3 sm:flex-row sm:items-center sm:justify-between",children:[p.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[p.jsx("input",{type:"checkbox",checked:M,disabled:R,onChange:Q=>E(Q.target.checked)}),"Stop on runner failure"]}),p.jsx("p",{className:`text-xs ${fe}`,children:"Runner failure means transport/script/test failure. HTTP 4xx/5xx alone does not fail an item."})]}),q&&p.jsxs("div",{className:"grid gap-2 sm:grid-cols-5",children:[p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Progress"}),p.jsxs("strong",{children:[q.completed," / ",q.total]})]}),p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Passed"}),p.jsx("strong",{className:"text-green-600",children:q.passed})]}),p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Failed"}),p.jsx("strong",{className:"text-red-600",children:q.failed})]}),p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Cancelled"}),p.jsx("strong",{children:q.cancelled})]}),p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Run"}),p.jsx("strong",{children:q.stopped?"Stopped":"Complete"})]})]}),p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-runner-order-heading",children:[p.jsxs("div",{children:[p.jsx("h3",{id:"api-client-runner-order-heading",className:"font-semibold",children:"Execution order"}),p.jsx("p",{className:`text-xs ${fe}`,children:"Requests execute sequentially in saved-request order. Folder runs include descendant folders; this list is the exact order that will run."})]}),C.map((Q,oe)=>{const ce=X[Q.id]||{status:"pending"},ve=ce.item?.outcome.result,T=ce.item?.outcome.scriptTests||[],z=T.filter(ne=>ne.passed).length,he=ve?.status!==void 0&&ve.status>=400;return p.jsxs("div",{"data-runner-request-id":Q.id,className:`rounded-lg border p-3 ${L}`,children:[p.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[p.jsx("span",{className:`text-xs ${fe}`,children:oe+1}),p.jsx("span",{className:"font-mono font-bold text-blue-600",children:Q.request.method.toUpperCase()}),p.jsx("span",{className:"font-medium",children:Q.name})]}),p.jsx("div",{className:`mt-1 text-xs ${fe}`,children:EM(t,Q)}),p.jsx("div",{className:"mt-1 truncate font-mono text-xs",title:Q.request.url,children:Q.request.url})]}),p.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 text-xs",children:[ce.status==="running"&&p.jsx(KA,{className:"h-4 w-4 animate-spin"}),ce.status==="passed"&&p.jsx(la,{className:"h-4 w-4 text-green-600"}),ce.status==="failed"&&p.jsx(zA,{className:"h-4 w-4 text-red-600"}),p.jsx("span",{children:OM(ce)}),ve?.status!==void 0&&p.jsxs("span",{className:he?"text-amber-600":fe,children:["HTTP ",ve.status]}),ve?.responseTime!==void 0&&p.jsxs("span",{className:fe,children:[p.jsx(kd,{className:"mr-1 inline h-3.5 w-3.5"}),ve.responseTime," ms"]})]})]}),T.length>0&&p.jsxs("div",{className:`mt-2 text-xs ${T.some(ne=>!ne.passed)?"text-red-600":fe}`,children:[z,"/",T.length," tests passed"]}),ce.item?.outcome.scriptError&&p.jsx("div",{className:"mt-2 text-xs text-red-600",children:ce.item.outcome.scriptError}),ce.item?.outcome.error&&!ce.item.cancelled&&p.jsx("div",{className:"mt-2 text-xs text-red-600",children:ce.item.outcome.error}),ce.item?.historyEntryId&&p.jsx("button",{type:"button",className:"mt-2 text-xs font-medium text-blue-600 underline underline-offset-2","aria-label":`Open history for ${Q.name}`,onClick:()=>v(ce.item?.historyEntryId,ce.item?.outcome.result?q?.runId:void 0),children:"Inspect history"})]},Q.id)}),C.length===0&&p.jsx("div",{className:`rounded-lg border px-4 py-8 text-center text-sm ${fe}`,children:"There are no saved requests in this run scope yet."})]})]})})};function k1(t){return`flexdoc:api-client-ui:${encodeURIComponent(t)}`}function C1(t,e){const n=e??(typeof window<"u"?window.localStorage:void 0);if(!n)return{version:1};try{const r=n.getItem(k1(t));if(!r)return{version:1};const s=JSON.parse(r);return s.version!==1?{version:1}:s.sidebarCollapsed!==void 0&&typeof s.sidebarCollapsed!="boolean"?{version:1}:s.requestTab!==void 0&&!["params","headers","authorization","body","scripts"].includes(s.requestTab)?{version:1}:s.scriptTab!==void 0&&!["pre-request","tests"].includes(s.scriptTab)?{version:1}:s.theme!==void 0&&!["light","dark"].includes(s.theme)?{version:1}:{version:1,...typeof s.sidebarCollapsed=="boolean"?{sidebarCollapsed:s.sidebarCollapsed}:{},...typeof s.requestTab=="string"?{requestTab:s.requestTab}:{},...typeof s.scriptTab=="string"?{scriptTab:s.scriptTab}:{},...typeof s.theme=="string"?{theme:s.theme}:{}}}catch{return{version:1}}}function Ha(t,e,n){const r=typeof window<"u"?window.localStorage:void 0;if(r)try{const s=C1(t,r);r.setItem(k1(t),JSON.stringify({...s,...e,version:1}))}catch{}}function RM(t){return{method:t?.method||"GET",url:t?.url||"",query:t?.query?.map(e=>({...e}))||[],headers:t?.headers?.map(e=>({...e}))||[],body:t?.body||"",contentType:t?.contentType||"application/json",bodyMode:t?.bodyMode,urlencoded:t?.urlencoded?.map(e=>({...e})),formData:t?.formData?.map(e=>({...e})),binary:t?.binary?{...t.binary}:void 0,graphql:t?.graphql?{...t.graphql}:void 0,hostExecution:t?.hostExecution?{...t.hostExecution}:void 0,auth:t?.auth?t.auth.type==="oauth2"?{...t.auth,scopes:t.auth.scopes?[...t.auth.scopes]:void 0}:{...t.auth}:{type:"inherit"}}}function N1(t,e){return da(t)!=="none"?"body":e.preRequest.trim()||e.tests.trim()?"scripts":t.auth&&t.auth.type!=="none"&&t.auth.type!=="inherit"?"authorization":(t.headers||[]).some(n=>n.enabled!==!1&&n.key.trim())?"headers":"params"}function ap(t){return t.tests.trim()&&!t.preRequest.trim()?"tests":"pre-request"}function T1(t,e){return JSON.stringify({request:t,scripts:wn(e)},(n,r)=>typeof File<"u"&&r instanceof File?{name:r.name,size:r.size,type:r.type,lastModified:r.lastModified}:r)}function DM(t,e){return!!t.url.trim()||!!t.body?.trim()||!!t.query?.some(n=>n.key.trim()||n.value.trim())||!!t.headers?.some(n=>n.key.trim()||n.value.trim())||!!e.preRequest.trim()||!!e.tests.trim()}const j1=({initialRequest:t,initialScripts:e,initialRequestTab:n,initialScriptTab:r,theme:s="light",persistenceKey:a="default",pageMode:c=!1,manageTheme:u=!0,handoff:f,activeEnvironmentId:h,onActiveEnvironmentIdChange:g,onChromeStateChange:b,onRequestChange:v,onDraftChange:w,onScriptsChange:A,onRequestTabChange:C,onScriptTabChange:j,onExecutionStart:D,onExecutionComplete:M,variables:E={},environmentVariables:R={},onCollectionChanges:_,onEnvironmentChanges:q,...O})=>{const X=RM(t),U=wn(e),B=nl(),K=a===!1?{}:C1(a),[W,ye]=I.useState(X),[pe,fe]=I.useState(X),[L,Q]=I.useState(U),[oe,ce]=I.useState(U),[ve,T]=I.useState(O.initialServerUrl),[z,he]=I.useState(0),[ne,ke]=I.useState(n||K.requestTab||"params"),[qe,$e]=I.useState(r||K.scriptTab||ap(U)),[Fe,Ye]=I.useState("request"),[Ie,ut]=I.useState({}),[Rt,Ce]=I.useState(),[Oe,G]=I.useState(B),[we,Ne]=I.useState(B.collections[0]?.id),[De,Ke]=I.useState(""),st=I.useRef(B.collections[0]?.id),Et=I.useRef(void 0),[Zn,Nn]=I.useState(a===!1),[ht,_n]=I.useState(K.sidebarCollapsed??!1),[Tn,ei]=I.useState(K.theme||s),kt=u?Tn:s;I.useEffect(()=>{if(a===!1)return;let Ee=!1;return dy(a).then(We=>{Ee||(G(We),Ne(We.collections[0]?.id),Ke(""),Nn(!0))}).catch(()=>{Ee||Nn(!0)}),()=>{Ee=!0}},[a]);const x=hy(a,Oe,Zn),V=I.useMemo(()=>oy(Oe,we),[we,Oe]),me=I.useMemo(()=>ff(Oe),[Oe]),ae=I.useMemo(()=>({...R,...me}),[R,me]),J=I.useMemo(()=>({...V,...E,...ae}),[V,ae,E]);I.useEffect(()=>{if(h===void 0)return;const Ee=h||void 0;let We=!1;return queueMicrotask(()=>{We||G(Vt=>Vt.activeEnvironmentId===Ee?Vt:{...Vt,activeEnvironmentId:Ee})}),()=>{We=!0}},[h]);const k=I.useMemo(()=>T1(pe,oe),[pe,oe]),Y=I.useMemo(()=>DM(pe,oe)&&!Oe.requests.some(Ee=>T1(Ee.request,Ee.scripts)===k),[k,pe,oe,Oe.requests]);I.useEffect(()=>{b?.({environments:Oe.environments.map(({id:Ee,name:We})=>({id:Ee,name:We})),activeEnvironmentId:Oe.activeEnvironmentId,hasUnsavedRequest:Y})},[Y,b,Oe.activeEnvironmentId,Oe.environments]);const Z=I.useCallback(Ee=>ay(Oe,we,De||void 0,Ee||{type:"none"}),[we,De,Oe]),xe=I.useCallback(Ee=>{Ne(Ee),Ke("")},[]),F=Ee=>{v?.(Ee)},ue=Ee=>{fe(Ei(Ee)),w?.(Ei(Ee))},re=Ee=>{const We=wn(Ee);ce(We),A?.(We)},Se=Ee=>{ke(Ee),a!==!1&&Ha(a,{requestTab:Ee}),C?.(Ee)},Me=Ee=>{$e(Ee),a!==!1&&Ha(a,{scriptTab:Ee}),j?.(Ee)},je=Ee=>{const We=st.current||we;G(Vt=>cy(Vt,We,Ee)),_?.(Ee)},_e=Ee=>{G(We=>hf(We,Ee)),q?.(Ee)},ze=()=>{st.current=we,Et.current=De||void 0,D?.()},Qe=Ee=>{G(We=>ly(We,{...Ee,collectionId:st.current,folderId:Et.current})),M?.(Ee)},pn=(Ee,We,Vt,Ln)=>{Ye("request");const bi=Vt&&Oe.collections.some(Li=>Li.id===Vt)?Vt:void 0;bi&&Ne(bi);const qn=bi||we,Ft=Ln&&Oe.folders.some(Li=>Li.id===Ln&&Li.collectionId===qn)?Ln:"";Ke(Ft);const Kt=Ei(Ee),Vn=wn(We),ur=N1(Kt,Vn),Bs=ap(Vn);ke(ur),$e(Bs),a!==!1&&Ha(a,{requestTab:ur,scriptTab:Bs}),ye(Kt),fe(Kt),Q(Vn),ce(Vn),T(void 0),he(Li=>Li+1)};I.useEffect(()=>{if(!f)return;const Ee=Ei(f.request),We=wn(f.scripts),Vt=f.requestTab||N1(Ee,We),Ln=f.scriptTab||ap(We);let bi=!1;return queueMicrotask(()=>{bi||(Ye("request"),ye(Ee),fe(Ee),Q(We),ce(We),T(f.serverUrl),ke(Vt),$e(Ln),he(qn=>qn+1))}),()=>{bi=!0}},[f]);const Un=(Ee,We)=>{Ne(Ee),Ke(We||""),Ce({collectionId:Ee,folderId:We}),Ye("runner")},jn=(Ee,We)=>{ut({entryId:Ee,runId:We}),Ye("history")},nu=()=>_n(Ee=>{const We=!Ee;return a!==!1&&Ha(a,{sidebarCollapsed:We}),We}),Wr=kt==="dark"?"border-gray-700 bg-gray-900/40 text-gray-100":"border-gray-200 bg-white text-gray-900",yi=kt==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900";return p.jsxs("div",{className:`grid h-full min-h-0 min-w-0 ${c?"gap-0":"gap-4"} ${ht?"lg:grid-cols-[3.5rem_minmax(0,1fr)]":"lg:grid-cols-[19rem_minmax(0,1fr)]"}`,"data-api-client-workspace":!0,children:[p.jsxs("aside",{className:`min-h-0 min-w-0 overflow-y-auto border p-3 ${c?"rounded-none border-b-0 border-l-0 border-t-0":"rounded-xl"} ${Wr}`,"data-api-client-workspace-sidebar":!0,"data-collapsed":ht?"true":"false",children:[p.jsx("div",{className:`mb-3 flex ${ht?"justify-center":"justify-end"}`,children:p.jsx("button",{type:"button",className:"inline-flex h-10 w-10 items-center justify-center rounded-md border","aria-label":ht?"Expand API Client sidebar":"Collapse API Client sidebar","aria-expanded":!ht,onClick:nu,children:ht?p.jsx(jd,{className:"h-4 w-4"}):p.jsx(Td,{className:"h-4 w-4"})})}),!ht&&p.jsxs("div",{className:"space-y-5",children:[x&&p.jsx(mf,{message:"FlexDoc could not save this workspace to browser storage. Recent changes and history will be lost when the page is closed. Clearing stored history usually frees enough space.",showCapabilities:!1,warning:!0,theme:kt,label:"API Client storage status"}),p.jsx(jM,{onWorkspaceChange:G,onSelectedCollectionChange:xe,theme:kt}),p.jsx("div",{className:"border-t pt-4",children:p.jsx(iM,{workspace:Oe,onWorkspaceChange:G,theme:kt})}),p.jsx("div",{className:"border-t pt-4",children:p.jsx(nM,{request:pe,scripts:oe,onLoadRequest:pn,onSelectedCollectionChange:xe,onSelectedFolderChange:Ke,onRunCollection:Ee=>Un(Ee),onRunFolder:(Ee,We)=>Un(Ee,We),selectedCollectionId:we,selectedFolderId:De,workspace:Oe,onWorkspaceChange:G,hostExecution:O.hostExecution,theme:kt})}),p.jsx("div",{className:"border-t pt-4",children:p.jsx(lM,{workspace:Oe,onWorkspaceChange:G,onLoadRequest:pn,onViewAll:()=>jn(),theme:kt})})]})]}),p.jsxs("div",{className:"min-h-0 min-w-0 overflow-y-auto overscroll-contain",children:[p.jsxs("div",{className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border px-3 py-2 text-xs ${Wr}`,"data-api-client-toolbar":!0,children:[p.jsxs("label",{className:"flex items-center gap-2",children:[p.jsx("span",{children:O.messages?.environment||"Environment"}),p.jsxs("select",{"aria-label":O.messages?.environment||"API Client environment",className:`rounded-md border px-2 py-1 text-xs ${yi}`,value:Oe.activeEnvironmentId||"",onChange:Ee=>{const We=Ee.target.value||void 0;G(Vt=>({...Vt,activeEnvironmentId:We})),g?.(We)},children:[p.jsx("option",{value:"",children:O.messages?.noEnvironment||"No environment"}),Oe.environments.map(Ee=>p.jsx("option",{value:Ee.id,children:Ee.name},Ee.id))]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u&&p.jsxs("button",{type:"button",className:`rounded-md border px-2 py-1 text-xs ${yi}`,"aria-label":`${O.messages?.viewerTheme||"Theme"}: ${kt==="dark"?O.messages?.lightTheme||"Light":O.messages?.darkTheme||"Dark"}`,"aria-pressed":kt==="dark",onClick:()=>{const Ee=kt==="dark"?"light":"dark";ei(Ee),a!==!1&&Ha(a,{theme:Ee})},children:[O.messages?.viewerTheme||"Theme",": ",kt==="dark"?O.messages?.darkTheme||"Dark":O.messages?.lightTheme||"Light"]}),Fe==="request"&&Y&&p.jsx("span",{"aria-label":"Unsaved request changes",children:O.messages?.unsavedChanges||"Unsaved changes"})]})]}),Fe==="history"?p.jsx(oM,{workspace:Oe,onWorkspaceChange:G,onLoadRequest:pn,onBack:()=>Ye("request"),initialEntryId:Ie.entryId,initialRunId:Ie.runId,theme:kt},`${Ie.runId||""}:${Ie.entryId||""}`):Fe==="runner"&&Rt?p.jsx(MM,{workspace:Oe,onWorkspaceChange:G,collectionId:Rt.collectionId,folderId:Rt.folderId,theme:kt,credentials:O.credentials,requestInterceptor:O.requestInterceptor,hostExecution:O.hostExecution,externalVariables:E,externalEnvironmentVariables:R,onCollectionChanges:_,onEnvironmentChanges:q,onOpenHistory:jn,onBack:()=>Ye("request")}):p.jsx(Qv,{...O,initialRequest:W,initialScripts:L,initialRequestTab:ne,initialScriptTab:qe,initialServerUrl:ve,theme:kt,resolveAuth:Z,variables:J,collectionVariables:V,externalVariables:E,environmentVariables:ae,onCollectionChanges:je,onEnvironmentChanges:_e,onDraftChange:ue,onScriptsChange:re,onRequestTabChange:Se,onScriptTabChange:Me,onExecutionStart:ze,onExecutionComplete:Qe,credentialStorage:Oe.credentialStorage||"remember",onCredentialStorageChange:Ee=>G(We=>({...We,credentialStorage:Ee})),onRequestChange:F},z)]})]})};function Zc(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function _M(t,e){if(!e)return{};const n=e.colors||{},r=e.typography||{},s=e.sidebar||{};return{"--flexdoc-primary":n.primary?.main,"--flexdoc-text":n.text?.primary,"--flexdoc-text-muted":n.text?.secondary,"--flexdoc-border":t==="dark"?n.border?.dark:n.border?.light,"--flexdoc-sidebar-bg":t==="dark"?s.backgroundColorDark:s.backgroundColor,"--flexdoc-sidebar-text":t==="dark"?s.textColorDark:s.textColor,"--flexdoc-sidebar-active-text":t==="dark"?s.activeTextColorDark:s.activeTextColor,"--flexdoc-heading-font":r.headings?.fontFamily,"--flexdoc-heading-weight":r.headings?.fontWeight,"--flexdoc-code-font":r.code?.fontFamily,"--flexdoc-code-size":r.code?.fontSize,"--flexdoc-code-line-height":r.code?.lineHeight,"--flexdoc-code-color":r.code?.color,"--flexdoc-code-bg":r.code?.backgroundColor,fontFamily:r.fontFamily,fontSize:r.fontSize,lineHeight:r.lineHeight}}function E1(t,e){const n=e.replace(/^#/,"");if(!n)return null;const r=[];for(const[s,a]of Object.entries(t.paths))for(const c of $n.getHttpMethods(a)){if(Jh(s,c)===n)return{path:s,method:c};u3(s,c)===n&&r.push({path:s,method:c})}return r.length===1?r[0]:null}function O1(){return typeof window>"u"?"docs":new URLSearchParams(window.location.search).get("view")==="api-client"?"api-client":"docs"}function op(t){if(typeof window>"u")return;const e=new URL(window.location.href);t==="api-client"?e.searchParams.set("view","api-client"):e.searchParams.delete("view"),window.history.replaceState(null,"",`${e.pathname}${e.search}${e.hash}`)}function M1(t,e){if(typeof document>"u"||typeof URL>"u")return"Downloads are unavailable in this environment.";try{const n=e==="yaml"?uk(t,{lineWidth:120,noRefs:!1}):JSON.stringify(t,null,2),r=new Blob([n],{type:e==="yaml"?"application/yaml;charset=utf-8":"application/json;charset=utf-8"}),s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=`openapi.${e==="yaml"?"yaml":"json"}`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(s);return}catch(n){const r=n instanceof Error?n.message:String(n);return`Unable to download ${e.toUpperCase()}: ${r}`}}function LM({logo:t,onHome:e}){const n=typeof t=="string"?{url:t}:t,r=typeof n.padding=="object"?`${Zc(n.padding.vertical)||"0"} ${Zc(n.padding.horizontal)||"0"}`:n.padding,s=p.jsx("img",{src:n.url,alt:n.alt||"API documentation logo",style:{maxHeight:Zc(n.maxHeight)||"32px",maxWidth:Zc(n.maxWidth)||"180px"}});return p.jsx("div",{className:`flex items-center ${n.containerClass||""}`,style:{backgroundColor:n.backgroundColor,padding:r},children:n.clickable===!1?s:p.jsx("button",{type:"button","aria-label":"Documentation home",onClick:e,children:s})})}const qM=({spec:t,theme:e="light",manageTheme:n=!0,customStyles:r={},options:s={}})=>{const a=gk(t.info.title,typeof window>"u"?void 0:window.location.host),c=ua(a),u=s.tryIt?.apiClientPersistenceKey??ry(t.info.title,typeof window>"u"?void 0:window.location.host),f=O1(),[h,g]=I.useState(()=>typeof window>"u"?null:E1(t,window.location.hash)),[b,v]=I.useState(f),[w,A]=I.useState(f==="api-client"),[C,j]=I.useState(),D=I.useRef(0),[M,E]=I.useState({environments:[],hasUnsavedRequest:!1}),[R,_]=I.useState(void 0),[q,O]=I.useState(!1),[X,U]=I.useState(!1),[B,K]=I.useState(!1),[W,ye]=I.useState(),[pe,fe]=I.useState(),[L,Q]=I.useState(()=>({key:a,preferences:c})),oe=I.useRef(null),ce=I.useRef(null),ve=I.useRef(null),T=s.runtimeIntelligence?.available===!0,z=s.runtimeIntelligence?.endpoint,he=T&&z&&pe?.endpoint===z?pe:void 0,ne=he?.snapshot,ke=he?.error,qe=!!(T&&z&&!he),$e=I.useCallback(()=>K(!1),[]),Fe=L.key===a?L.preferences:ua(a),Ye=n&&Fe.theme||e,Ie=Ye==="high-contrast"?"dark":Ye,ut=Fe.expand,Rt=Fe.expandedTags??["default"],Ce=Fe.sidebarCollapsed??!1,Oe=typeof s.theme=="object"?s.theme:void 0,G=I.useMemo(()=>({..._M(Ie,Oe),...r}),[Ie,Oe,r]);I.useEffect(()=>{if(!T||!z)return;const F=new AbortController;return fetch(z,{credentials:"same-origin",signal:F.signal}).then(async ue=>{if(!ue.ok)throw new Error(`Runtime intelligence unavailable: HTTP ${ue.status}`);return E3(await ue.json())}).then(ue=>fe({endpoint:z,snapshot:ue})).catch(ue=>{F.signal.aborted||fe({endpoint:z,error:ue instanceof Error?ue.message:String(ue)})}),()=>F.abort()},[T,z]),I.useEffect(()=>{if(!s.customCss)return;const F=document.createElement("style");return F.dataset.flexdocCustomCss="true",F.textContent=s.customCss,document.head.appendChild(F),()=>F.remove()},[s.customCss]),I.useEffect(()=>{if(typeof window>"u")return;const F=()=>g(E1(t,window.location.hash)),ue=()=>{const re=O1();v(re),re==="api-client"&&A(!0)};return F(),ue(),window.addEventListener("hashchange",F),window.addEventListener("popstate",ue),()=>{window.removeEventListener("hashchange",F),window.removeEventListener("popstate",ue)}},[t]),I.useEffect(()=>{if(!q||typeof document>"u")return;const F=document.body.style.overflow,ue=ce.current;document.body.style.overflow="hidden";const re=oe.current,Se=()=>Array.from(re?.querySelectorAll('button:not([data-focus-trap-ignore]):not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')||[]);requestAnimationFrame(()=>Se()[0]?.focus());const Me=je=>{if(je.key==="Escape"){je.preventDefault(),O(!1);return}if(je.key!=="Tab")return;const _e=Se();if(!_e.length)return;const ze=_e[0],Qe=_e[_e.length-1];je.shiftKey&&document.activeElement===ze?(je.preventDefault(),Qe.focus()):!je.shiftKey&&document.activeElement===Qe&&(je.preventDefault(),ze.focus())};return document.addEventListener("keydown",Me),()=>{document.body.style.overflow=F,document.removeEventListener("keydown",Me),ue?.focus()}},[q]);const we=()=>{Q({key:a,preferences:ua(a)})},Ne=F=>{Q(ue=>{const re=ue.key===a?ue.preferences:ua(a);return{key:a,preferences:{...re,...F,version:1}}})},De=()=>requestAnimationFrame(()=>ve.current?.scrollTo({top:0,behavior:"auto"})),Ke=(F,ue)=>{g({path:F,method:ue}),v("docs"),O(!1),op("docs"),typeof window<"u"&&(window.location.hash=Jh(F,ue)),De()},st=()=>{if(g(null),v("docs"),O(!1),typeof window<"u"){const F=new URL(window.location.href);F.searchParams.delete("view"),F.hash="",window.history.replaceState(null,"",`${F.pathname}${F.search}`)}De()},Et=F=>{F&&(D.current+=1,j({id:D.current,request:F.request,scripts:F.scripts,requestTab:F.requestTab,scriptTab:F.scriptTab,serverUrl:F.serverUrl})),A(!0),v("api-client"),op("api-client")},Zn=()=>{v("docs"),op("docs"),De()},Nn=()=>{const F=!Ce;_o(a,"sidebarCollapsed",F),Ne({sidebarCollapsed:F})},ht=tf(s.expand,s.expand===void 0?s.expandResponses:void 0),_n=ut===void 0?ht:tf(ut),Tn=F=>{_o(a,"expand",F),we()},ei=F=>{n&&(_o(a,"theme",F),we())},kt=F=>{_o(a,"expandedTags",F),Ne({expandedTags:F})},x=I.useCallback(()=>{if(typeof document>"u")return;(b==="api-client"?document.querySelector('[data-api-client-page="api-client"]:not(.hidden)'):document.querySelector('[data-flexdoc-docs-view="docs"]:not(.hidden)'))?.querySelector('[data-api-client-send="true"]:not([disabled])')?.click()},[b]),V=w3(Ie,"border-gray-200 bg-white text-gray-600","border-gray-700 bg-gray-800 text-gray-300"),me=Ie==="dark"?"bg-gray-900 text-gray-100":"bg-gray-50 text-gray-900",ae=Ie==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900",J=s.messages,k=(F=!1)=>p.jsx("button",{type:"button","data-flexdoc-floating-control":F?"settings":void 0,className:F?`fixed bottom-4 right-4 z-40 inline-flex h-11 w-11 items-center justify-center rounded-full border shadow-lg ${ae}`:"inline-flex h-11 w-11 items-center justify-center rounded-md border","aria-label":J?.openSettings||"Open settings","aria-expanded":X,onClick:()=>U(!0),children:p.jsx(ZA,{className:"h-5 w-5"})}),Y=(F=!1)=>T?p.jsxs("button",{type:"button","data-flexdoc-floating-control":F?"runtime":void 0,className:F?`fixed bottom-4 right-[4.25rem] z-40 inline-flex h-11 w-11 items-center justify-center rounded-full border shadow-lg ${ae}`:"inline-flex h-11 min-w-11 items-center justify-center gap-2 rounded-md border px-2 text-sm sm:px-3",onClick:()=>K(!0),"aria-label":J?.openRuntime||"Open runtime intelligence","aria-expanded":B,children:[p.jsx(Dg,{className:"h-4 w-4"}),!F&&p.jsx("span",{className:"hidden sm:inline",children:ne?`Runtime ${ne.summary.matched}/${ne.summary.documented}`:qe?"Runtime…":"Runtime"})]}):null,Z=(F=!1)=>p.jsx("button",{ref:ce,type:"button","data-flexdoc-floating-control":F?"navigation":void 0,"data-flexdoc-mobile-nav-trigger":F?"floating":"topbar",className:F?`fixed left-4 top-4 z-[65] pointer-events-auto inline-flex h-11 w-11 items-center justify-center rounded-full border shadow-lg lg:hidden ${ae}`:"inline-flex h-11 w-11 items-center justify-center rounded-md lg:hidden","aria-label":J?.apiNavigation||"Open API navigation","aria-expanded":q,onClick:()=>O(!0),children:p.jsx(JA,{className:"h-5 w-5"})}),xe=p.jsx(dk,{spec:t,onEndpointSelect:Ke,theme:Ie,selectedEndpoint:h||void 0,expandedTags:Rt,onExpandedTagsChange:kt,messages:J});return p.jsxs("div",{lang:s.locale,className:`flexdoc-root flex h-full min-h-0 flex-col ${me}`,style:G,"data-theme":Ye,"data-flexdoc-view":b,children:[!s.hideTopbar&&p.jsx("header",{className:`z-30 flex flex-wrap min-h-14 shrink-0 items-center gap-3 border-b px-3 sm:px-5 ${Ie==="dark"?"border-gray-700 bg-gray-900":"border-gray-200 bg-white"}`,children:b==="api-client"?p.jsxs(p.Fragment,{children:[p.jsxs("button",{type:"button",className:"inline-flex min-h-11 items-center gap-2 rounded-md border px-3 text-sm",onClick:Zn,children:[p.jsx(Ro,{className:"h-4 w-4"}),J?.backToOperation||"Back to operation"]}),p.jsx("div",{className:"min-w-0 flex-1 truncate font-semibold",children:J?.apiClient||"API Client"}),p.jsxs("label",{className:"flex shrink-0 items-center gap-1 text-xs sm:gap-2",children:[p.jsx("span",{className:"sr-only",children:J?.environment||"Environment"}),p.jsxs("select",{"aria-label":J?.environment||"API Client environment",style:{maxWidth:"10rem"},className:`rounded-md border px-2 py-1.5 text-xs ${Ie==="dark"?"border-gray-700 bg-gray-900":"border-gray-300 bg-white"}`,value:R??M.activeEnvironmentId??"",onChange:F=>_(F.target.value||null),children:[p.jsx("option",{value:"",children:J?.noEnvironment||"No environment"}),M.environments.map(F=>p.jsx("option",{value:F.id,children:F.name},F.id))]})]}),M.hasUnsavedRequest&&p.jsx("span",{className:"shrink-0 text-xs font-medium","aria-label":J?.unsavedChanges||"Unsaved request changes",children:J?.unsavedChanges||"Unsaved changes"}),k()]}):p.jsxs(p.Fragment,{children:[Z(),p.jsx("button",{type:"button",className:"hidden h-11 w-11 items-center justify-center rounded-md border lg:inline-flex","aria-label":Ce?"Expand API navigation sidebar":"Collapse API navigation sidebar","aria-expanded":!Ce,onClick:Nn,children:Ce?p.jsx(jd,{className:"h-5 w-5"}):p.jsx(Td,{className:"h-5 w-5"})}),s.logo?p.jsx(LM,{logo:s.logo,onHome:st}):p.jsx("button",{type:"button","aria-label":"Documentation home",onClick:st,children:p.jsx(z3,{})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"truncate font-semibold",children:t.info.title}),!s.hideHostname&&t.servers?.[0]?.url&&p.jsx("div",{className:"truncate text-xs opacity-60",children:t.servers[0].url})]}),Y(),h&&p.jsx("button",{type:"button",className:"hidden shrink-0 rounded-md border px-3 py-2 text-sm md:inline-flex","aria-label":J?.printOperation||"Print operation",onClick:()=>{typeof window<"u"&&window.print()},children:J?.printOperation||"Print operation"}),!s.hideDownloadButton&&p.jsxs("div",{className:"flex shrink-0 items-center gap-1","aria-label":"Download OpenAPI specification",children:[p.jsx("button",{type:"button",className:"rounded-md border px-2 py-2 text-xs sm:px-3 sm:text-sm",onClick:()=>ye(M1(t,"json")),children:"JSON"}),p.jsx("button",{type:"button",className:"rounded-md border px-2 py-2 text-xs sm:px-3 sm:text-sm",onClick:()=>ye(M1(t,"yaml")),children:"YAML"})]}),k()]})}),s.hideTopbar&&b==="docs"&&Z(!0),s.hideTopbar&&b==="docs"&&Y(!0),s.hideTopbar&&k(!0),s.hideTopbar&&b==="docs"&&p.jsx("button",{type:"button","data-flexdoc-floating-control":"desktop-navigation",className:`fixed left-4 top-4 z-40 hidden h-11 w-11 items-center justify-center rounded-full border shadow-lg lg:inline-flex ${ae}`,"aria-label":Ce?"Expand API navigation sidebar":"Collapse API navigation sidebar","aria-expanded":!Ce,onClick:Nn,children:Ce?p.jsx(jd,{className:"h-5 w-5"}):p.jsx(Td,{className:"h-5 w-5"})}),s.hideTopbar&&b==="api-client"&&p.jsxs(p.Fragment,{children:[p.jsxs("button",{type:"button","data-flexdoc-floating-control":"api-client-back",className:`fixed left-4 top-4 z-[65] inline-flex min-h-11 items-center gap-2 rounded-full border px-3 shadow-lg ${ae}`,onClick:Zn,children:[p.jsx(Ro,{className:"h-4 w-4"}),J?.backToOperation||"Back"]}),p.jsxs("div",{"data-flexdoc-floating-control":"api-client-status",className:`fixed right-4 top-4 z-[65] flex items-center gap-2 rounded-full border px-2 py-1.5 shadow-lg ${ae}`,style:{maxWidth:"calc(100vw - 8rem)"},children:[p.jsxs("label",{className:"flex min-w-0 items-center gap-1 text-xs",children:[p.jsx("span",{className:"sr-only",children:J?.environment||"Environment"}),p.jsxs("select",{"aria-label":J?.environment||"API Client environment",style:{maxWidth:"8rem"},className:`rounded-md border px-2 py-1 text-xs ${Ie==="dark"?"border-gray-700 bg-gray-900":"border-gray-300 bg-white"}`,value:R??M.activeEnvironmentId??"",onChange:F=>_(F.target.value||null),children:[p.jsx("option",{value:"",children:J?.noEnvironment||"No environment"}),M.environments.map(F=>p.jsx("option",{value:F.id,children:F.name},F.id))]})]}),M.hasUnsavedRequest&&p.jsx("span",{className:"truncate text-xs font-medium","aria-label":J?.unsavedChanges||"Unsaved request changes",children:J?.unsavedChanges||"Unsaved changes"})]})]}),p.jsxs("div",{className:"relative flex min-h-0 flex-1 overflow-hidden",children:[p.jsxs("div",{"data-flexdoc-docs-view":"docs",className:`${b==="docs"?"flex":"hidden"} min-h-0 min-w-0 flex-1`,children:[p.jsx("aside",{className:`hidden min-h-0 shrink-0 overflow-hidden transition-[width] duration-200 motion-reduce:transition-none lg:block ${Ce?"w-14":"w-80"}`,"data-docs-sidebar":!0,"data-collapsed":Ce?"true":"false",style:{background:"var(--flexdoc-sidebar-bg)",color:"var(--flexdoc-sidebar-text)"},children:!Ce&&xe}),p.jsxs("main",{ref:ve,"data-flexdoc-main-scroll":!0,className:"min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain",children:[h?p.jsx(p3,{spec:t,path:h.path,method:h.method,theme:Ie,options:s,defaultExpandedSections:_n,runtimeSnapshot:ne,onOpenInApiClient:Et}):p.jsx(b3,{spec:t,onEndpointSelect:Ke,theme:Ie}),p.jsx(v3,{footerClasses:V,footer:s.footer})]})]}),w&&p.jsx("div",{"data-api-client-page":"api-client",className:`${b==="api-client"?"block":"hidden"} min-h-0 min-w-0 flex-1 overflow-hidden`,children:p.jsx(j1,{pageMode:!0,manageTheme:!1,theme:Ie,messages:J,persistenceKey:u,handoff:C,activeEnvironmentId:R,onActiveEnvironmentIdChange:F=>_(F??null),onChromeStateChange:F=>{E(F),_(ue=>ue===void 0?F.activeEnvironmentId??null:ue)},credentials:s.tryIt?.credentials||"same-origin",requestInterceptor:s.tryIt?.requestInterceptor,hostExecution:s.tryIt?.hostExecution,serverOptions:t.servers||[]})})]}),q&&p.jsxs("div",{ref:oe,className:"fixed inset-0 z-[70] lg:hidden",role:"dialog","aria-modal":"true","aria-label":J?.apiNavigation||"API navigation",children:[p.jsx("button",{type:"button",tabIndex:-1,"data-focus-trap-ignore":!0,"aria-label":"Close navigation backdrop",className:"absolute inset-0 bg-black/40",onClick:()=>O(!1)}),p.jsxs("aside",{className:`absolute inset-y-0 left-0 flex w-[min(88vw,22rem)] flex-col shadow-2xl ${Ie==="dark"?"bg-gray-900":"bg-white"}`,children:[p.jsxs("div",{className:"flex h-14 items-center justify-between border-b px-4",children:[p.jsx("span",{className:"font-semibold",children:J?.apiNavigation||"API navigation"}),p.jsx("button",{type:"button",className:"inline-flex h-11 w-11 items-center justify-center rounded-md","aria-label":J?.closeApiNavigation||"Close API navigation",onClick:()=>O(!1),children:p.jsx(Od,{className:"h-5 w-5"})})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:xe})]})]}),W&&p.jsx("div",{role:"alert",className:`fixed bottom-4 left-1/2 z-[90] max-w-[min(92vw,40rem)] -translate-x-1/2 rounded-lg border px-4 py-3 text-sm shadow-xl ${Ie==="dark"?"border-red-800 bg-red-950 text-red-100":"border-red-300 bg-white text-red-700"}`,onClick:()=>ye(void 0),children:J?.downloadFailed||W}),p.jsx(I3,{open:B&&T,theme:Ie,loading:qe,error:ke,snapshot:ne,onClose:$e,onEndpointSelect:Ke,messages:J}),p.jsx(D3,{spec:t,theme:Ie,messages:J,onEndpointSelect:Ke,onHome:st,onOpenSettings:()=>U(!0),onOpenApiClient:()=>Et(),onOpenRuntime:T?()=>K(!0):void 0,onSendCurrent:x}),p.jsx(B3,{open:X,theme:Ie,hostTheme:e,manageTheme:n,viewerTheme:Fe.theme,viewerExpand:ut,effectiveExpandedSections:_n,messages:J,onThemeChange:ei,onExpandChange:Tn,onClose:()=>U(!1)})]})},cp="x-flexdoc-external-documents";function BM(t){if(typeof fetch!="function")throw new Error("No document loader is available in this environment");return fetch(t).then(async e=>{if(!e.ok)throw new Error(`Failed to load OpenAPI reference ${t}: ${e.status}`);const n=await e.text();return Hi.parseSpec(n).catch(()=>{try{return JSON.parse(n)}catch{throw new Error(`Reference document is not valid JSON/YAML: ${t}`)}})})}function $M(t,e){if(t.startsWith("#"))return{documentUri:e,pointer:t};const n=new URL(t,e),r=n.hash||"#";return n.hash="",{documentUri:n.toString(),pointer:r}}function R1(t,e){const n=Hi.encodePointerToken(t);if(e==="#"||e==="")return`#/${cp}/${n}`;if(!e.startsWith("#/"))throw new Error(`Unsupported JSON Pointer reference: ${e}`);return`#/${cp}/${n}/${e.slice(2)}`}function D1(t){return JSON.parse(JSON.stringify(t))}async function IM(t,e){const n=e.load||BM,r=new URL(e.baseUri).toString().replace(/#.*$/,""),s=D1(t),a={},c=new Map;async function u(g){if(g===r)return s;if(a[g])return a[g];if(c.has(g))return c.get(g);const b=Promise.resolve(n(g)).then(w=>D1(w));c.set(g,b);const v=await b;return a[g]=v,v}const f=new Set;async function h(g,b){if(f.has(b))return;f.add(b);async function v(w){if(!(!w||typeof w!="object")){if(Array.isArray(w)){for(const A of w)await v(A);return}if(typeof w.$ref=="string"){const A=$M(w.$ref,b);if(A.documentUri!==b){const C=await u(A.documentUri);w.$ref=A.documentUri===r?A.pointer:R1(A.documentUri,A.pointer),await h(C,A.documentUri)}else b!==r&&(w.$ref=R1(b,A.pointer))}for(const[A,C]of Object.entries(w))A!=="$ref"&&await v(C)}}await v(g)}return await h(s,r),Object.keys(a).length&&(s[cp]=a),s}async function HM(t,e){return IM(t,e)}const eu="1",tu=new WeakMap;function zM(t){return JSON.parse(JSON.stringify(t))}function up(t,e={}){const n=zM(t);if(e.title&&(n.info.title=e.title),e.description&&(n.info.description=e.description),e.altDescription&&!n.info.description&&(n.info.description=e.altDescription),e.version&&(n.info.version=e.version),!e.tagGroups?.length)return n;const r=new Map;for(const c of e.tagGroups)for(const u of c.tags)r.set(u,c.name);const s={},a=new Set(["get","post","put","delete","patch","options","head","trace"]);for(const[c,u]of Object.entries(n.paths)){const f={};let h=!1;for(const[g,b]of Object.entries(u)){if(!a.has(g)){f[g]=b;continue}const v=b,w=(v?.tags||[]).filter(A=>r.has(A)).map(A=>r.get(A));!w.length||!v||(f[g]={...v,tags:Array.from(new Set(w))},h=!0)}h&&(s[c]=f)}return n.paths=s,n.tags=e.tagGroups.map(c=>({name:c.name})),n}function UM(t){return typeof t.theme=="string"?t.theme:typeof document<"u"&&document.documentElement.classList.contains("dark")?"dark":"light"}function VM(t){if(typeof document>"u"||!t.favicon)return;const e=document.querySelector('link[rel~="icon"]'),n=e||document.createElement("link");n.rel="icon",n.href=t.favicon,e||document.head.appendChild(n)}function _1(t,e){const n=tu.get(t);n&&n.unmount();const r=LA.createRoot(t);return tu.set(t,r),r.render(e),()=>{tu.get(t)===r&&tu.delete(t),r.unmount()}}function L1(t,e,n){return VM(n),_1(t,p.jsx(qM,{spec:up(e,n),theme:UM(n),options:n}))}function q1(t,e){const n={contractVersion:eu,...e.options||{}};return L1(t,e.spec,n)}function B1(t,e={}){return _1(t,p.jsx(j1,{...e}))}async function $1(t,e){const n={contractVersion:eu,...e.options||{}},r=e.baseUri?await HM(e.spec,{baseUri:e.baseUri,load:e.documentLoader}):e.spec;return L1(t,r,n)}return typeof window<"u"&&(window.FlexDocStandalone={mount:q1,mountAsync:$1,mountApiClient:B1,prepareSpec:up,contractVersion:eu}),ks.FLEXDOC_CONTRACT_VERSION=eu,ks.mountApiClient=B1,ks.mountFlexDoc=q1,ks.mountFlexDocAsync=$1,ks.prepareSpec=up,Object.defineProperty(ks,Symbol.toStringTag,{value:"Module"}),ks})({});
|
|
85
|
+
`).trim();return e||n?{preRequest:e,tests:n}:void 0}function w1(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch{return t}}function S1(t){const e=t.split("#",1)[0],n=e.indexOf("?");if(n<0)return{url:e,query:[]};const r=e.slice(n+1),s=r?r.split("&").map(a=>{const c=a.indexOf("=");return{key:w1(c>=0?a.slice(0,c):a),value:w1(c>=0?a.slice(c+1):""),enabled:!0}}):[];return{url:e.slice(0,n),query:s}}function kM(t){return Qr(t).map(e=>({key:at(e.key),value:at(e.value),enabled:e.disabled!==!0}))}function CM(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function A1(t,e){let n=t;for(const r of Qr(e)){const s=at(r.key).trim();s&&(n=n.replace(new RegExp(`:${CM(s)}(?=/|$)`,"g"),`{{${s}}}`))}return n}function NM(t){if(typeof t=="string")return S1(t);if(!hn(t))return{url:"",query:[]};const e=kM(t.query),n=at(t.raw);if(n){const h=S1(n);return{url:A1(h.url,t.variable),query:e.length>0?e:h.query}}const r=at(t.protocol).replace(/:$/,""),s=Array.isArray(t.host)?t.host.map(at).join("."):at(t.host),a=at(t.port),c=Array.isArray(t.path)?t.path.map(at).join("/"):at(t.path).replace(/^\//,""),u=s?`${r?`${r}://`:""}${s}${a?`:${a}`:""}`:"",f=u?`${u}${c?`/${c}`:""}`:c;return{url:A1(f,t.variable),query:e}}function TM(t){return Qr(t).map(e=>({key:at(e.key),value:at(e.value),enabled:e.disabled!==!0}))}function jM(t){return t.find(e=>e.enabled!==!1&&e.key.toLowerCase()==="content-type")?.value}function EM(t){switch(t.toLowerCase()){case"json":return"application/json";case"xml":return"application/xml";case"html":return"text/html";case"javascript":return"application/javascript";case"text":return"text/plain";default:return}}function OM(t,e,n,r){const s=jM(e);if(!hn(t)||!t.mode)return{body:"",contentType:s||"application/json",bodyMode:"none"};const a=at(t.mode);if(a==="raw"){const c=hn(t.options)&&hn(t.options.raw)?t.options.raw:void 0,u=c?at(c.language):"";return{body:at(t.raw),contentType:s||EM(u)||"text/plain",bodyMode:u.toLowerCase()==="json"?"json":"raw"}}if(a==="urlencoded")return{body:"",bodyMode:"urlencoded",urlencoded:Qr(t.urlencoded).map(u=>({key:at(u.key),value:at(u.value),enabled:u.disabled!==!0})),contentType:s||"application/x-www-form-urlencoded"};if(a==="graphql"){const c=hn(t.graphql)?t.graphql:{},u=at(c.variables);return{body:"",bodyMode:"graphql",graphql:{query:at(c.query),variables:u},contentType:s||"application/json"}}if(a==="formdata"){const c=Qr(t.formdata).map(f=>{const h=at(f.type)==="file"?"file":"text",g=Array.isArray(f.src)?f.src.map(at).filter(Boolean).join(", "):at(f.src);return{key:at(f.key),value:h==="text"?at(f.value):"",enabled:f.disabled!==!0,type:h,...h==="file"&&g?{fileName:g}:{},...typeof f.contentType=="string"?{contentType:f.contentType}:{}}});return c.filter(f=>f.type==="file").length>0&&Wn(r,"postman-body-formdata-files",n,"Multipart file fields were preserved, but exported local file paths cannot be reopened by the browser. Re-select those files before sending."),{body:"",bodyMode:"formdata",formData:c,contentType:s}}if(a==="file"){const c=hn(t.file)?at(t.file.src):at(t.src);return Wn(r,"postman-body-file",n,c?`Postman binary file body "${c}" was preserved as intent, but browser security requires re-selecting the file before sending.`:"Postman binary file body requires selecting the file again in FlexDoc before sending."),{body:"",contentType:s||"application/octet-stream",bodyMode:"binary",binary:{fileName:c||void 0,contentType:s||"application/octet-stream"}}}return Wn(r,"postman-body-unsupported",n,`Postman body mode "${a}" is not supported; the request body was left empty.`),{body:"",contentType:s||"application/octet-stream",bodyMode:"none"}}function MM(t,e,n,r,s,a,c,u){const f=typeof t=="string"?{method:"GET",url:t}:t;if(!hn(f))return Wn(u,"postman-request-invalid",c,"Skipped an invalid Postman request entry."),null;const h=at(f.method).trim().toUpperCase()||"GET",g=NM(f.url),b=TM(f.header),v=OM(f.body,b,`${c}.body`,u),w={method:h,url:g.url,query:g.query,headers:b,body:v.body,contentType:v.contentType,bodyMode:v.bodyMode,urlencoded:v.urlencoded,formData:v.formData,binary:v.binary,graphql:v.graphql,auth:cp(f.auth,{type:"inherit"},`${c}.auth`,u)},A=AM(s);return{id:Sn("request"),collectionId:n,folderId:r,name:e.trim()||`${h} ${g.url||"request"}`,request:w,...A?{scripts:A}:{},createdAt:a,updatedAt:a}}function k1(t){Array.isArray(t.items)&&t.items.forEach((e,n)=>{const r=`${t.path}[${n}]`;if(!hn(e)){Wn(t.warnings,"postman-item-invalid",r,"Skipped an invalid Postman item.");return}const s=at(e.name)||"Untitled",a=v1(e.event,`${r}.event`,t.warnings),c=SM(t.inheritedScripts,a);if(Array.isArray(e.item)){const f=Sn("folder");t.folders.push({id:f,collectionId:t.collectionId,parentFolderId:t.parentFolderId,name:s,auth:cp(e.auth,{type:"inherit"},`${r}.auth`,t.warnings),createdAt:t.timestamp,updatedAt:t.timestamp}),k1({...t,items:e.item,parentFolderId:f,inheritedScripts:c,path:`${r}.item`});return}const u=MM(e.request,s,t.collectionId,t.parentFolderId,c,t.timestamp,`${r}.request`,t.warnings);u&&t.requests.push(u)})}function RM(t){if(!hn(t)||!hn(t.info)||!Array.isArray(t.item))throw new Error("This JSON is not a Postman collection. Expected info and item fields.");const e=at(t.info.name).trim();if(!e)throw new Error("Postman collection info.name is required.");const n=[],r=at(t.info.schema);r&&!r.includes("/v2.1.0/")&&Wn(n,"postman-schema-version","info.schema",`Collection schema "${r}" is not Postman v2.1; FlexDoc imported the compatible fields it recognized.`);const s=new Date().toISOString(),a=Sn("collection"),c={id:a,name:e,auth:cp(t.auth,{type:"none"},"auth",n),variables:x1(t.variable,"variable",n),createdAt:s,updatedAt:s},u=[],f=[];return k1({items:t.item,collectionId:a,inheritedScripts:v1(t.event,"event",n),timestamp:s,path:"item",folders:u,requests:f,warnings:n}),{collection:c,folders:u,requests:f,warnings:n}}function DM(t){if(!hn(t)||!Array.isArray(t.values)||typeof t.name!="string")throw new Error("This JSON is not a Postman environment. Expected name and values fields.");const e=at(t._postman_variable_scope).toLowerCase();if(e&&e!=="environment")throw new Error(`Postman variable scope "${e}" is not an environment.`);const n=[],r=new Date().toISOString();return{environment:{id:Sn("environment"),name:t.name.trim()||"Imported environment",variables:x1(t.values,"values",n),createdAt:r,updatedAt:r},warnings:n}}function _M(t){if(hn(t)&&hn(t.info)&&Array.isArray(t.item))return{kind:"collection",result:RM(t)};if(hn(t)&&Array.isArray(t.values)&&typeof t.name=="string")return{kind:"environment",result:DM(t)};throw new Error("Unsupported Postman JSON. Import a collection v2.1 JSON file or an exported environment JSON file.")}function LM(t){if(t.collections.length!==1||t.folders.length!==0||t.requests.length!==0)return!1;const e=t.collections[0];return e.name==="My Collection"&&e.auth.type==="none"&&e.variables.length===0}function qM(t,e){const n=LM(t)?[]:t.collections;return{...t,collections:[...n,e.collection],folders:[...t.folders,...e.folders],requests:[...t.requests,...e.requests]}}function BM(t,e){return{...t,environments:[...t.environments,e.environment],activeEnvironmentId:t.activeEnvironmentId||e.environment.id}}function C1(t,e){return`${t} ${t===1?e:`${e}s`}`}const $M=({onWorkspaceChange:t,onSelectedCollectionChange:e,theme:n})=>{const r=I.useRef(null),[s,a]=I.useState(null),[c,u]=I.useState([]),f=async A=>{if(A.length===0)return;const C=[],O=[],D=[];for(const q of A)try{const R=JSON.parse(await q.text()),X=_M(R);C.push(X),O.push(...X.result.warnings.map(U=>({...U,path:`${q.name}:${U.path}`})))}catch(R){D.push(`${q.name}: ${R instanceof Error?R.message:String(R)}`)}C.length>0&&t(q=>{let R=q;for(const X of C)R=X.kind==="collection"?qM(R,X.result):BM(R,X.result);return R});const E=C.filter(q=>q.kind==="collection"),j=C.length-E.length,M=E[E.length-1];M?.kind==="collection"&&e?.(M.result.collection.id),u(O);const _=[E.length>0?C1(E.length,"collection"):"",j>0?C1(j,"environment"):""].filter(Boolean);C.length===0?a({tone:"error",text:D.join(" ")||"No Postman documents were imported."}):D.length>0||O.length>0?a({tone:"warning",text:`Imported ${_.join(" and ")}. ${D.length>0?`${D.length} file${D.length===1?"":"s"} failed to import.`:`${O.length} compatibility warning${O.length===1?"":"s"} need review.`}`}):a({tone:"success",text:`Imported ${_.join(" and ")}.`})},h=n==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900",g=n==="dark"?"text-gray-400":"text-gray-500",b=n==="dark"?"text-amber-300":"text-amber-700",v=n==="dark"?"text-emerald-300":"text-emerald-700",w=n==="dark"?"text-red-300":"text-red-700";return p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-import-heading",children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(Fg,{className:"h-4 w-4"}),p.jsx("h3",{id:"api-client-import-heading",className:"font-semibold",children:"Import"})]}),p.jsx("input",{ref:r,type:"file",accept:".json,application/json",multiple:!0,className:"hidden","aria-label":"Import Postman JSON",onChange:A=>{const C=Array.from(A.currentTarget.files||[]);A.currentTarget.value="",f(C)}}),p.jsxs("button",{type:"button",className:`flex w-full items-center justify-center gap-2 rounded-md border px-3 py-2 text-sm font-medium ${h}`,onClick:()=>r.current?.click(),children:[p.jsx(Fg,{className:"h-4 w-4"}),"Import Postman"]}),p.jsx("p",{className:`text-xs ${g}`,children:"Import Postman Collection v2.1 and exported environment JSON files. Multiple files can be selected together."}),s&&p.jsxs("div",{className:`flex items-start gap-2 text-xs ${s.tone==="success"?v:s.tone==="warning"?b:w}`,role:"status",children:[s.tone==="success"?p.jsx(la,{className:"mt-0.5 h-4 w-4 shrink-0"}):p.jsx(Od,{className:"mt-0.5 h-4 w-4 shrink-0"}),p.jsx("span",{children:s.text})]}),c.length>0&&p.jsxs("details",{className:`text-xs ${b}`,children:[p.jsxs("summary",{className:"cursor-pointer font-medium",children:["Review import warnings (",c.length,")"]}),p.jsxs("ul",{className:"mt-2 space-y-2 pl-4",children:[c.slice(0,5).map((A,C)=>p.jsxs("li",{children:[p.jsx("span",{className:"font-mono",children:A.path}),": ",A.message]},`${A.code}-${A.path}-${C}`)),c.length>5&&p.jsxs("li",{children:[c.length-5," more warning",c.length-5===1?"":"s"," not shown."]})]})]})]})};function IM(t,e){if(!e.folderId)return"Collection root";const n=new Map(t.folders.map(c=>[c.id,c])),r=[],s=new Set;let a=n.get(e.folderId);for(;a&&!s.has(a.id);)s.add(a.id),r.unshift(a.name),a=a.parentFolderId?n.get(a.parentFolderId):void 0;return r.join(" / ")||"Deleted folder"}function HM(t){return t.status==="running"?"Running":t.status==="passed"?"Runner pass":t.status==="failed"?"Runner fail":t.status==="cancelled"?"Cancelled":t.status==="skipped"?"Not run":"Pending"}const zM=({workspace:t,onWorkspaceChange:e,collectionId:n,folderId:r,theme:s,credentials:a,requestInterceptor:c,hostExecution:u,externalVariables:f,externalEnvironmentVariables:h,onCollectionChanges:g,onEnvironmentChanges:b,onOpenHistory:v,onBack:w,fetcher:A})=>{const C=I.useMemo(()=>Sl(t,n,r),[n,r,t]),O=I.useMemo(()=>p1(t,n,r),[n,r,t]),D=t.environments.find(Q=>Q.id===t.activeEnvironmentId),[E,j]=I.useState(!1),[M,_]=I.useState(!1),[q,R]=I.useState(),[X,U]=I.useState({}),B=I.useRef(void 0),K=I.useRef(!0);I.useEffect(()=>(K.current=!0,()=>{K.current=!1,B.current?.abort()}),[]);const W=async()=>{if(M||C.length===0)return;const Q=new AbortController;B.current=Q,_(!0),R(void 0),U(Object.fromEntries(C.map(ce=>[ce.id,{status:"pending"}])));const oe=await uM({workspace:t,collectionId:n,folderId:r,runName:O,credentials:a,requestInterceptor:c,hostExecution:u,externalVariables:f,externalEnvironmentVariables:h,stopOnFailure:E,signal:Q.signal,fetcher:A,onCollectionChanges:g,onEnvironmentChanges:b,onRequestStart:ce=>{K.current&&U(ve=>({...ve,[ce.id]:{status:"running"}}))},onRequestComplete:ce=>{K.current&&U(ve=>({...ve,[ce.requestId]:{status:ce.cancelled?"cancelled":ce.passed?"passed":"failed",item:ce}}))}});K.current&&(e(oe.workspace),U(ce=>Object.fromEntries(C.map(ve=>{const T=ce[ve.id]||{status:"pending"};return[ve.id,T.status==="pending"&&oe.stopped?{status:"skipped"}:T]}))),R(oe),_(!1),B.current=void 0)},ye=()=>B.current?.abort(),pe=s==="dark"?"border-gray-700 bg-gray-800/60 text-gray-100":"border-gray-200 bg-gray-50 text-gray-900",fe=s==="dark"?"text-gray-400":"text-gray-500",L=s==="dark"?"border-gray-700 bg-gray-900/40":"border-gray-200 bg-white";return p.jsx("section",{className:`rounded-xl border p-4 md:p-5 ${pe}`,"aria-labelledby":"api-client-runner-heading",children:p.jsxs("div",{className:"space-y-5",children:[p.jsxs("header",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[p.jsxs("div",{className:"flex items-start gap-3",children:[p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm",onClick:w,children:[p.jsx(Ro,{className:"h-4 w-4"})," Client"]}),p.jsxs("div",{children:[p.jsxs("div",{className:"flex items-center gap-2",children:[p.jsx(aa,{className:"h-5 w-5"}),p.jsx("h2",{id:"api-client-runner-heading",className:"text-lg font-semibold",children:"Collection runner"})]}),p.jsx("p",{className:"mt-1 text-sm font-medium",children:O}),p.jsxs("p",{className:`mt-1 text-xs ${fe}`,children:[C.length," saved request",C.length===1?"":"s"," · Environment: ",D?.name||"None"]})]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[q?.runId&&p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm",onClick:()=>v(void 0,q.runId),children:[p.jsx(YA,{className:"h-4 w-4"})," Open run history"]}),M?p.jsxs("button",{type:"button",className:"inline-flex min-h-10 items-center gap-2 rounded-md border border-red-300 px-3 py-2 text-sm text-red-700",onClick:ye,children:[p.jsx(Ug,{className:"h-4 w-4"})," Stop run"]}):p.jsxs("button",{type:"button",disabled:C.length===0,className:"inline-flex min-h-10 items-center gap-2 rounded-md border px-3 py-2 text-sm font-medium disabled:cursor-not-allowed disabled:opacity-50",onClick:()=>{W()},children:[p.jsx(aa,{className:"h-4 w-4"})," ",q?"Run again":"Start run"]})]})]}),p.jsxs("div",{className:"flex flex-col gap-3 rounded-lg border p-3 sm:flex-row sm:items-center sm:justify-between",children:[p.jsxs("label",{className:"inline-flex items-center gap-2 text-sm",children:[p.jsx("input",{type:"checkbox",checked:E,disabled:M,onChange:Q=>j(Q.target.checked)}),"Stop on runner failure"]}),p.jsx("p",{className:`text-xs ${fe}`,children:"Runner failure means transport/script/test failure. HTTP 4xx/5xx alone does not fail an item."})]}),q&&p.jsxs("div",{className:"grid gap-2 sm:grid-cols-5",children:[p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Progress"}),p.jsxs("strong",{children:[q.completed," / ",q.total]})]}),p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Passed"}),p.jsx("strong",{className:"text-green-600",children:q.passed})]}),p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Failed"}),p.jsx("strong",{className:"text-red-600",children:q.failed})]}),p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Cancelled"}),p.jsx("strong",{children:q.cancelled})]}),p.jsxs("div",{className:"rounded-md border px-3 py-2 text-sm",children:[p.jsx("div",{className:fe,children:"Run"}),p.jsx("strong",{children:q.stopped?"Stopped":"Complete"})]})]}),p.jsxs("section",{className:"space-y-3","aria-labelledby":"api-client-runner-order-heading",children:[p.jsxs("div",{children:[p.jsx("h3",{id:"api-client-runner-order-heading",className:"font-semibold",children:"Execution order"}),p.jsx("p",{className:`text-xs ${fe}`,children:"Requests execute sequentially in saved-request order. Folder runs include descendant folders; this list is the exact order that will run."})]}),C.map((Q,oe)=>{const ce=X[Q.id]||{status:"pending"},ve=ce.item?.outcome.result,T=ce.item?.outcome.scriptTests||[],z=T.filter(ne=>ne.passed).length,he=ve?.status!==void 0&&ve.status>=400;return p.jsxs("div",{"data-runner-request-id":Q.id,className:`rounded-lg border p-3 ${L}`,children:[p.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[p.jsxs("div",{className:"min-w-0",children:[p.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[p.jsx("span",{className:`text-xs ${fe}`,children:oe+1}),p.jsx("span",{className:"font-mono font-bold text-blue-600",children:Q.request.method.toUpperCase()}),p.jsx("span",{className:"font-medium",children:Q.name})]}),p.jsx("div",{className:`mt-1 text-xs ${fe}`,children:IM(t,Q)}),p.jsx("div",{className:"mt-1 truncate font-mono text-xs",title:Q.request.url,children:Q.request.url})]}),p.jsxs("div",{className:"flex shrink-0 flex-wrap items-center gap-2 text-xs",children:[ce.status==="running"&&p.jsx(XA,{className:"h-4 w-4 animate-spin"}),ce.status==="passed"&&p.jsx(la,{className:"h-4 w-4 text-green-600"}),ce.status==="failed"&&p.jsx(VA,{className:"h-4 w-4 text-red-600"}),p.jsx("span",{children:HM(ce)}),ve?.status!==void 0&&p.jsxs("span",{className:he?"text-amber-600":fe,children:["HTTP ",ve.status]}),ve?.responseTime!==void 0&&p.jsxs("span",{className:fe,children:[p.jsx(Cd,{className:"mr-1 inline h-3.5 w-3.5"}),ve.responseTime," ms"]})]})]}),T.length>0&&p.jsxs("div",{className:`mt-2 text-xs ${T.some(ne=>!ne.passed)?"text-red-600":fe}`,children:[z,"/",T.length," tests passed"]}),ce.item?.outcome.scriptError&&p.jsx("div",{className:"mt-2 text-xs text-red-600",children:ce.item.outcome.scriptError}),ce.item?.outcome.error&&!ce.item.cancelled&&p.jsx("div",{className:"mt-2 text-xs text-red-600",children:ce.item.outcome.error}),ce.item?.historyEntryId&&p.jsx("button",{type:"button",className:"mt-2 text-xs font-medium text-blue-600 underline underline-offset-2","aria-label":`Open history for ${Q.name}`,onClick:()=>v(ce.item?.historyEntryId,ce.item?.outcome.result?q?.runId:void 0),children:"Inspect history"})]},Q.id)}),C.length===0&&p.jsx("div",{className:`rounded-lg border px-4 py-8 text-center text-sm ${fe}`,children:"There are no saved requests in this run scope yet."})]})]})})};function N1(t){return`flexdoc:api-client-ui:${encodeURIComponent(t)}`}function T1(t,e){const n=e??(typeof window<"u"?window.localStorage:void 0);if(!n)return{version:1};try{const r=n.getItem(N1(t));if(!r)return{version:1};const s=JSON.parse(r);return s.version!==1?{version:1}:s.sidebarCollapsed!==void 0&&typeof s.sidebarCollapsed!="boolean"?{version:1}:s.requestTab!==void 0&&!["params","headers","authorization","body","scripts"].includes(s.requestTab)?{version:1}:s.scriptTab!==void 0&&!["pre-request","tests"].includes(s.scriptTab)?{version:1}:s.theme!==void 0&&!["light","dark"].includes(s.theme)?{version:1}:{version:1,...typeof s.sidebarCollapsed=="boolean"?{sidebarCollapsed:s.sidebarCollapsed}:{},...typeof s.requestTab=="string"?{requestTab:s.requestTab}:{},...typeof s.scriptTab=="string"?{scriptTab:s.scriptTab}:{},...typeof s.theme=="string"?{theme:s.theme}:{}}}catch{return{version:1}}}function Ha(t,e,n){const r=typeof window<"u"?window.localStorage:void 0;if(r)try{const s=T1(t,r);r.setItem(N1(t),JSON.stringify({...s,...e,version:1}))}catch{}}function UM(t){return{method:t?.method||"GET",url:t?.url||"",query:t?.query?.map(e=>({...e}))||[],headers:t?.headers?.map(e=>({...e}))||[],body:t?.body||"",contentType:t?.contentType||"application/json",bodyMode:t?.bodyMode,urlencoded:t?.urlencoded?.map(e=>({...e})),formData:t?.formData?.map(e=>({...e})),binary:t?.binary?{...t.binary}:void 0,graphql:t?.graphql?{...t.graphql}:void 0,hostExecution:t?.hostExecution?{...t.hostExecution}:void 0,auth:t?.auth?t.auth.type==="oauth2"?{...t.auth,scopes:t.auth.scopes?[...t.auth.scopes]:void 0}:{...t.auth}:{type:"inherit"}}}function j1(t,e){return da(t)!=="none"?"body":e.preRequest.trim()||e.tests.trim()?"scripts":t.auth&&t.auth.type!=="none"&&t.auth.type!=="inherit"?"authorization":(t.headers||[]).some(n=>n.enabled!==!1&&n.key.trim())?"headers":"params"}function up(t){return t.tests.trim()&&!t.preRequest.trim()?"tests":"pre-request"}function E1(t,e){return JSON.stringify({request:t,scripts:wn(e)},(n,r)=>typeof File<"u"&&r instanceof File?{name:r.name,size:r.size,type:r.type,lastModified:r.lastModified}:r)}function VM(t,e){return!!t.url.trim()||!!t.body?.trim()||!!t.query?.some(n=>n.key.trim()||n.value.trim())||!!t.headers?.some(n=>n.key.trim()||n.value.trim())||!!e.preRequest.trim()||!!e.tests.trim()}const O1=({initialRequest:t,initialScripts:e,initialRequestTab:n,initialScriptTab:r,theme:s="light",persistenceKey:a="default",pageMode:c=!1,manageTheme:u=!0,handoff:f,activeEnvironmentId:h,onActiveEnvironmentIdChange:g,onChromeStateChange:b,onRequestChange:v,onDraftChange:w,onScriptsChange:A,onRequestTabChange:C,onScriptTabChange:O,onExecutionStart:D,onExecutionComplete:E,variables:j={},environmentVariables:M={},onCollectionChanges:_,onEnvironmentChanges:q,...R})=>{const X=UM(t),U=wn(e),B=nl(),K=a===!1?{}:T1(a),[W,ye]=I.useState(X),[pe,fe]=I.useState(X),[L,Q]=I.useState(U),[oe,ce]=I.useState(U),[ve,T]=I.useState(R.initialServerUrl),[z,he]=I.useState(0),[ne,ke]=I.useState(n||K.requestTab||"params"),[qe,$e]=I.useState(r||K.scriptTab||up(U)),[Fe,Ye]=I.useState("request"),[Ie,ut]=I.useState({}),[Rt,Ce]=I.useState(),[Oe,G]=I.useState(B),[we,Ne]=I.useState(B.collections[0]?.id),[De,Ke]=I.useState(""),st=I.useRef(B.collections[0]?.id),Et=I.useRef(void 0),[Zn,Nn]=I.useState(a===!1),[ht,_n]=I.useState(K.sidebarCollapsed??!1),[Tn,ei]=I.useState(K.theme||s),kt=u?Tn:s;I.useEffect(()=>{if(a===!1)return;let Ee=!1;return hy(a).then(We=>{Ee||(G(We),Ne(We.collections[0]?.id),Ke(""),Nn(!0))}).catch(()=>{Ee||Nn(!0)}),()=>{Ee=!0}},[a]);const x=my(a,Oe,Zn),V=I.useMemo(()=>uy(Oe,we),[we,Oe]),me=I.useMemo(()=>hf(Oe),[Oe]),ae=I.useMemo(()=>({...M,...me}),[M,me]),J=I.useMemo(()=>({...V,...j,...ae}),[V,ae,j]);I.useEffect(()=>{if(h===void 0)return;const Ee=h||void 0;let We=!1;return queueMicrotask(()=>{We||G(Vt=>Vt.activeEnvironmentId===Ee?Vt:{...Vt,activeEnvironmentId:Ee})}),()=>{We=!0}},[h]);const k=I.useMemo(()=>E1(pe,oe),[pe,oe]),Y=I.useMemo(()=>VM(pe,oe)&&!Oe.requests.some(Ee=>E1(Ee.request,Ee.scripts)===k),[k,pe,oe,Oe.requests]);I.useEffect(()=>{b?.({environments:Oe.environments.map(({id:Ee,name:We})=>({id:Ee,name:We})),activeEnvironmentId:Oe.activeEnvironmentId,hasUnsavedRequest:Y})},[Y,b,Oe.activeEnvironmentId,Oe.environments]);const Z=I.useCallback(Ee=>cy(Oe,we,De||void 0,Ee||{type:"none"}),[we,De,Oe]),xe=I.useCallback(Ee=>{Ne(Ee),Ke("")},[]),F=Ee=>{v?.(Ee)},ue=Ee=>{fe(Ei(Ee)),w?.(Ei(Ee))},re=Ee=>{const We=wn(Ee);ce(We),A?.(We)},Se=Ee=>{ke(Ee),a!==!1&&Ha(a,{requestTab:Ee}),C?.(Ee)},Me=Ee=>{$e(Ee),a!==!1&&Ha(a,{scriptTab:Ee}),O?.(Ee)},je=Ee=>{const We=st.current||we;G(Vt=>dy(Vt,We,Ee)),_?.(Ee)},_e=Ee=>{G(We=>pf(We,Ee)),q?.(Ee)},ze=()=>{st.current=we,Et.current=De||void 0,D?.()},Qe=Ee=>{G(We=>oy(We,{...Ee,collectionId:st.current,folderId:Et.current})),E?.(Ee)},pn=(Ee,We,Vt,Ln)=>{Ye("request");const bi=Vt&&Oe.collections.some(Li=>Li.id===Vt)?Vt:void 0;bi&&Ne(bi);const qn=bi||we,Ft=Ln&&Oe.folders.some(Li=>Li.id===Ln&&Li.collectionId===qn)?Ln:"";Ke(Ft);const Kt=Ei(Ee),Vn=wn(We),ur=j1(Kt,Vn),Bs=up(Vn);ke(ur),$e(Bs),a!==!1&&Ha(a,{requestTab:ur,scriptTab:Bs}),ye(Kt),fe(Kt),Q(Vn),ce(Vn),T(void 0),he(Li=>Li+1)};I.useEffect(()=>{if(!f)return;const Ee=Ei(f.request),We=wn(f.scripts),Vt=f.requestTab||j1(Ee,We),Ln=f.scriptTab||up(We);let bi=!1;return queueMicrotask(()=>{bi||(Ye("request"),ye(Ee),fe(Ee),Q(We),ce(We),T(f.serverUrl),ke(Vt),$e(Ln),he(qn=>qn+1))}),()=>{bi=!0}},[f]);const Un=(Ee,We)=>{Ne(Ee),Ke(We||""),Ce({collectionId:Ee,folderId:We}),Ye("runner")},jn=(Ee,We)=>{ut({entryId:Ee,runId:We}),Ye("history")},nu=()=>_n(Ee=>{const We=!Ee;return a!==!1&&Ha(a,{sidebarCollapsed:We}),We}),Wr=kt==="dark"?"border-gray-700 bg-gray-900/40 text-gray-100":"border-gray-200 bg-white text-gray-900",yi=kt==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-300 bg-white text-gray-900";return p.jsxs("div",{className:`grid h-full min-h-0 min-w-0 ${c?"gap-0":"gap-4"} ${ht?"lg:grid-cols-[3.5rem_minmax(0,1fr)]":"lg:grid-cols-[19rem_minmax(0,1fr)]"}`,"data-api-client-workspace":!0,children:[p.jsxs("aside",{className:`min-h-0 min-w-0 overflow-y-auto border p-3 ${c?"rounded-none border-b-0 border-l-0 border-t-0":"rounded-xl"} ${Wr}`,"data-api-client-workspace-sidebar":!0,"data-collapsed":ht?"true":"false",children:[p.jsx("div",{className:`mb-3 flex ${ht?"justify-center":"justify-end"}`,children:p.jsx("button",{type:"button",className:"inline-flex h-10 w-10 items-center justify-center rounded-md border","aria-label":ht?"Expand API Client sidebar":"Collapse API Client sidebar","aria-expanded":!ht,onClick:nu,children:ht?p.jsx(Ed,{className:"h-4 w-4"}):p.jsx(jd,{className:"h-4 w-4"})})}),!ht&&p.jsxs("div",{className:"space-y-5",children:[x&&p.jsx(bf,{message:"FlexDoc could not save this workspace to browser storage. Recent changes and history will be lost when the page is closed. Clearing stored history usually frees enough space.",showCapabilities:!1,warning:!0,theme:kt,label:"API Client storage status"}),p.jsx($M,{onWorkspaceChange:G,onSelectedCollectionChange:xe,theme:kt}),p.jsx("div",{className:"border-t pt-4",children:p.jsx(hM,{workspace:Oe,onWorkspaceChange:G,theme:kt})}),p.jsx("div",{className:"border-t pt-4",children:p.jsx(fM,{request:pe,scripts:oe,onLoadRequest:pn,onSelectedCollectionChange:xe,onSelectedFolderChange:Ke,onRunCollection:Ee=>Un(Ee),onRunFolder:(Ee,We)=>Un(Ee,We),selectedCollectionId:we,selectedFolderId:De,workspace:Oe,onWorkspaceChange:G,hostExecution:R.hostExecution,theme:kt})}),p.jsx("div",{className:"border-t pt-4",children:p.jsx(gM,{workspace:Oe,onWorkspaceChange:G,onLoadRequest:pn,onViewAll:()=>jn(),theme:kt})})]})]}),p.jsxs("div",{className:"min-h-0 min-w-0 overflow-y-auto overscroll-contain",children:[p.jsxs("div",{className:`mb-3 flex flex-wrap items-center justify-between gap-2 rounded-md border px-3 py-2 text-xs ${Wr}`,"data-api-client-toolbar":!0,children:[p.jsxs("label",{className:"flex items-center gap-2",children:[p.jsx("span",{children:R.messages?.environment||"Environment"}),p.jsxs("select",{"aria-label":R.messages?.environment||"API Client environment",className:`rounded-md border px-2 py-1 text-xs ${yi}`,value:Oe.activeEnvironmentId||"",onChange:Ee=>{const We=Ee.target.value||void 0;G(Vt=>({...Vt,activeEnvironmentId:We})),g?.(We)},children:[p.jsx("option",{value:"",children:R.messages?.noEnvironment||"No environment"}),Oe.environments.map(Ee=>p.jsx("option",{value:Ee.id,children:Ee.name},Ee.id))]})]}),p.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[u&&p.jsxs("button",{type:"button",className:`rounded-md border px-2 py-1 text-xs ${yi}`,"aria-label":`${R.messages?.viewerTheme||"Theme"}: ${kt==="dark"?R.messages?.lightTheme||"Light":R.messages?.darkTheme||"Dark"}`,"aria-pressed":kt==="dark",onClick:()=>{const Ee=kt==="dark"?"light":"dark";ei(Ee),a!==!1&&Ha(a,{theme:Ee})},children:[R.messages?.viewerTheme||"Theme",": ",kt==="dark"?R.messages?.darkTheme||"Dark":R.messages?.lightTheme||"Light"]}),Fe==="request"&&Y&&p.jsx("span",{"aria-label":"Unsaved request changes",children:R.messages?.unsavedChanges||"Unsaved changes"})]})]}),Fe==="history"?p.jsx(bM,{workspace:Oe,onWorkspaceChange:G,onLoadRequest:pn,onBack:()=>Ye("request"),initialEntryId:Ie.entryId,initialRunId:Ie.runId,theme:kt},`${Ie.runId||""}:${Ie.entryId||""}`):Fe==="runner"&&Rt?p.jsx(zM,{workspace:Oe,onWorkspaceChange:G,collectionId:Rt.collectionId,folderId:Rt.folderId,theme:kt,credentials:R.credentials,requestInterceptor:R.requestInterceptor,hostExecution:R.hostExecution,externalVariables:j,externalEnvironmentVariables:M,onCollectionChanges:_,onEnvironmentChanges:q,onOpenHistory:jn,onBack:()=>Ye("request")}):p.jsx(Zv,{...R,initialRequest:W,initialScripts:L,initialRequestTab:ne,initialScriptTab:qe,initialServerUrl:ve,theme:kt,resolveAuth:Z,variables:J,collectionVariables:V,externalVariables:j,environmentVariables:ae,onCollectionChanges:je,onEnvironmentChanges:_e,onDraftChange:ue,onScriptsChange:re,onRequestTabChange:Se,onScriptTabChange:Me,onExecutionStart:ze,onExecutionComplete:Qe,credentialStorage:Oe.credentialStorage||"remember",onCredentialStorageChange:Ee=>G(We=>({...We,credentialStorage:Ee})),onRequestChange:F},z)]})]})};function Zc(t){if(t!==void 0)return typeof t=="number"?`${t}px`:t}function FM(t,e){if(!e)return{};const n=e.colors||{},r=e.typography||{},s=e.sidebar||{};return{"--flexdoc-primary":n.primary?.main,"--flexdoc-text":n.text?.primary,"--flexdoc-text-muted":n.text?.secondary,"--flexdoc-border":t==="dark"?n.border?.dark:n.border?.light,"--flexdoc-sidebar-bg":t==="dark"?s.backgroundColorDark:s.backgroundColor,"--flexdoc-sidebar-text":t==="dark"?s.textColorDark:s.textColor,"--flexdoc-sidebar-active-text":t==="dark"?s.activeTextColorDark:s.activeTextColor,"--flexdoc-heading-font":r.headings?.fontFamily,"--flexdoc-heading-weight":r.headings?.fontWeight,"--flexdoc-code-font":r.code?.fontFamily,"--flexdoc-code-size":r.code?.fontSize,"--flexdoc-code-line-height":r.code?.lineHeight,"--flexdoc-code-color":r.code?.color,"--flexdoc-code-bg":r.code?.backgroundColor,fontFamily:r.fontFamily,fontSize:r.fontSize,lineHeight:r.lineHeight}}function M1(t,e){const n=e.replace(/^#/,"");if(!n)return null;const r=[];for(const[s,a]of Object.entries(t.paths))for(const c of $n.getHttpMethods(a)){if(Zh(s,c)===n)return{path:s,method:c};v3(s,c)===n&&r.push({path:s,method:c})}return r.length===1?r[0]:null}function R1(){return typeof window>"u"?"docs":new URLSearchParams(window.location.search).get("view")==="api-client"?"api-client":"docs"}function dp(t){if(typeof window>"u")return;const e=new URL(window.location.href);t==="api-client"?e.searchParams.set("view","api-client"):e.searchParams.delete("view"),window.history.replaceState(null,"",`${e.pathname}${e.search}${e.hash}`)}function D1(t,e){if(typeof document>"u"||typeof URL>"u")return"Downloads are unavailable in this environment.";try{const n=e==="yaml"?fk(t,{lineWidth:120,noRefs:!1}):JSON.stringify(t,null,2),r=new Blob([n],{type:e==="yaml"?"application/yaml;charset=utf-8":"application/json;charset=utf-8"}),s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=`openapi.${e==="yaml"?"yaml":"json"}`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(s);return}catch(n){const r=n instanceof Error?n.message:String(n);return`Unable to download ${e.toUpperCase()}: ${r}`}}function PM({logo:t,onHome:e}){const n=typeof t=="string"?{url:t}:t,r=typeof n.padding=="object"?`${Zc(n.padding.vertical)||"0"} ${Zc(n.padding.horizontal)||"0"}`:n.padding,s=p.jsx("img",{src:n.url,alt:n.alt||"API documentation logo",style:{maxHeight:Zc(n.maxHeight)||"32px",maxWidth:Zc(n.maxWidth)||"180px"}});return p.jsx("div",{className:`flex items-center ${n.containerClass||""}`,style:{backgroundColor:n.backgroundColor,padding:r},children:n.clickable===!1?s:p.jsx("button",{type:"button","aria-label":"Documentation home",onClick:e,children:s})})}const YM=({spec:t,theme:e="light",manageTheme:n=!0,customStyles:r={},options:s={}})=>{const a=bk(t.info.title,typeof window>"u"?void 0:window.location.host),c=ua(a),u=s.tryIt?.apiClientPersistenceKey??ly(t.info.title,typeof window>"u"?void 0:window.location.host),f=R1(),[h,g]=I.useState(()=>typeof window>"u"?null:M1(t,window.location.hash)),[b,v]=I.useState(f),[w,A]=I.useState(f==="api-client"),[C,O]=I.useState(),D=I.useRef(0),[E,j]=I.useState({environments:[],hasUnsavedRequest:!1}),[M,_]=I.useState(void 0),[q,R]=I.useState(!1),[X,U]=I.useState(!1),[B,K]=I.useState(!1),[W,ye]=I.useState(),[pe,fe]=I.useState(),[L,Q]=I.useState(()=>({key:a,preferences:c})),oe=I.useRef(null),ce=I.useRef(null),ve=I.useRef(null),T=s.runtimeIntelligence?.available===!0,z=s.runtimeIntelligence?.endpoint,he=T&&z&&pe?.endpoint===z?pe:void 0,ne=he?.snapshot,ke=he?.error,qe=!!(T&&z&&!he),$e=I.useCallback(()=>K(!1),[]),Fe=L.key===a?L.preferences:ua(a),Ye=n&&Fe.theme||e,Ie=Ye==="high-contrast"?"dark":Ye,ut=Fe.expand,Rt=Fe.expandedTags??["default"],Ce=Fe.sidebarCollapsed??!1,Oe=typeof s.theme=="object"?s.theme:void 0,G=I.useMemo(()=>({...FM(Ie,Oe),...r}),[Ie,Oe,r]);I.useEffect(()=>{if(!T||!z)return;const F=new AbortController;return fetch(z,{credentials:"same-origin",signal:F.signal}).then(async ue=>{if(!ue.ok)throw new Error(`Runtime intelligence unavailable: HTTP ${ue.status}`);return I3(await ue.json())}).then(ue=>fe({endpoint:z,snapshot:ue})).catch(ue=>{F.signal.aborted||fe({endpoint:z,error:ue instanceof Error?ue.message:String(ue)})}),()=>F.abort()},[T,z]),I.useEffect(()=>{if(!s.customCss)return;const F=document.createElement("style");return F.dataset.flexdocCustomCss="true",F.textContent=s.customCss,document.head.appendChild(F),()=>F.remove()},[s.customCss]),I.useEffect(()=>{if(typeof window>"u")return;const F=()=>g(M1(t,window.location.hash)),ue=()=>{const re=R1();v(re),re==="api-client"&&A(!0)};return F(),ue(),window.addEventListener("hashchange",F),window.addEventListener("popstate",ue),()=>{window.removeEventListener("hashchange",F),window.removeEventListener("popstate",ue)}},[t]),I.useEffect(()=>{if(!q||typeof document>"u")return;const F=document.body.style.overflow,ue=ce.current;document.body.style.overflow="hidden";const re=oe.current,Se=()=>Array.from(re?.querySelectorAll('button:not([data-focus-trap-ignore]):not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')||[]);requestAnimationFrame(()=>Se()[0]?.focus());const Me=je=>{if(je.key==="Escape"){je.preventDefault(),R(!1);return}if(je.key!=="Tab")return;const _e=Se();if(!_e.length)return;const ze=_e[0],Qe=_e[_e.length-1];je.shiftKey&&document.activeElement===ze?(je.preventDefault(),Qe.focus()):!je.shiftKey&&document.activeElement===Qe&&(je.preventDefault(),ze.focus())};return document.addEventListener("keydown",Me),()=>{document.body.style.overflow=F,document.removeEventListener("keydown",Me),ue?.focus()}},[q]);const we=()=>{Q({key:a,preferences:ua(a)})},Ne=F=>{Q(ue=>{const re=ue.key===a?ue.preferences:ua(a);return{key:a,preferences:{...re,...F,version:1}}})},De=()=>requestAnimationFrame(()=>ve.current?.scrollTo({top:0,behavior:"auto"})),Ke=(F,ue)=>{g({path:F,method:ue}),v("docs"),R(!1),dp("docs"),typeof window<"u"&&(window.location.hash=Zh(F,ue)),De()},st=()=>{if(g(null),v("docs"),R(!1),typeof window<"u"){const F=new URL(window.location.href);F.searchParams.delete("view"),F.hash="",window.history.replaceState(null,"",`${F.pathname}${F.search}`)}De()},Et=F=>{F&&(D.current+=1,O({id:D.current,request:F.request,scripts:F.scripts,requestTab:F.requestTab,scriptTab:F.scriptTab,serverUrl:F.serverUrl})),A(!0),v("api-client"),dp("api-client")},Zn=()=>{v("docs"),dp("docs"),De()},Nn=()=>{const F=!Ce;_o(a,"sidebarCollapsed",F),Ne({sidebarCollapsed:F})},ht=nf(s.expand,s.expand===void 0?s.expandResponses:void 0),_n=ut===void 0?ht:nf(ut),Tn=F=>{_o(a,"expand",F),we()},ei=F=>{n&&(_o(a,"theme",F),we())},kt=F=>{_o(a,"expandedTags",F),Ne({expandedTags:F})},x=I.useCallback(()=>{if(typeof document>"u")return;(b==="api-client"?document.querySelector('[data-api-client-page="api-client"]:not(.hidden)'):document.querySelector('[data-flexdoc-docs-view="docs"]:not(.hidden)'))?.querySelector('[data-api-client-send="true"]:not([disabled])')?.click()},[b]),V=M3(Ie,"border-gray-200 bg-white text-gray-600","border-gray-700 bg-gray-800 text-gray-300"),me=Ie==="dark"?"bg-gray-900 text-gray-100":"bg-gray-50 text-gray-900",ae=Ie==="dark"?"border-gray-700 bg-gray-900 text-gray-100":"border-gray-200 bg-white text-gray-900",J=s.messages,k=(F=!1)=>p.jsx("button",{type:"button","data-flexdoc-floating-control":F?"settings":void 0,className:F?`fixed bottom-4 right-4 z-40 inline-flex h-11 w-11 items-center justify-center rounded-full border shadow-lg ${ae}`:"inline-flex h-11 w-11 items-center justify-center rounded-md border","aria-label":J?.openSettings||"Open settings","aria-expanded":X,onClick:()=>U(!0),children:p.jsx(tk,{className:"h-5 w-5"})}),Y=(F=!1)=>T?p.jsxs("button",{type:"button","data-flexdoc-floating-control":F?"runtime":void 0,className:F?`fixed bottom-4 right-[4.25rem] z-40 inline-flex h-11 w-11 items-center justify-center rounded-full border shadow-lg ${ae}`:"inline-flex h-11 min-w-11 items-center justify-center gap-2 rounded-md border px-2 text-sm sm:px-3",onClick:()=>K(!0),"aria-label":J?.openRuntime||"Open runtime intelligence","aria-expanded":B,children:[p.jsx(Lg,{className:"h-4 w-4"}),!F&&p.jsx("span",{className:"hidden sm:inline",children:ne?`Runtime ${ne.summary.matched}/${ne.summary.documented}`:qe?"Runtime…":"Runtime"})]}):null,Z=(F=!1)=>p.jsx("button",{ref:ce,type:"button","data-flexdoc-floating-control":F?"navigation":void 0,"data-flexdoc-mobile-nav-trigger":F?"floating":"topbar",className:F?`fixed left-4 top-4 z-[65] pointer-events-auto inline-flex h-11 w-11 items-center justify-center rounded-full border shadow-lg lg:hidden ${ae}`:"inline-flex h-11 w-11 items-center justify-center rounded-md lg:hidden","aria-label":J?.apiNavigation||"Open API navigation","aria-expanded":q,onClick:()=>R(!0),children:p.jsx(WA,{className:"h-5 w-5"})}),xe=p.jsx(hk,{spec:t,onEndpointSelect:Ke,theme:Ie,selectedEndpoint:h||void 0,expandedTags:Rt,onExpandedTagsChange:kt,messages:J});return p.jsxs("div",{lang:s.locale,className:`flexdoc-root flex h-full min-h-0 flex-col ${me}`,style:G,"data-theme":Ye,"data-flexdoc-view":b,children:[!s.hideTopbar&&p.jsx("header",{className:`z-30 flex flex-wrap min-h-14 shrink-0 items-center gap-3 border-b px-3 sm:px-5 ${Ie==="dark"?"border-gray-700 bg-gray-900":"border-gray-200 bg-white"}`,children:b==="api-client"?p.jsxs(p.Fragment,{children:[p.jsxs("button",{type:"button",className:"inline-flex min-h-11 items-center gap-2 rounded-md border px-3 text-sm",onClick:Zn,children:[p.jsx(Ro,{className:"h-4 w-4"}),J?.backToOperation||"Back to operation"]}),p.jsx("div",{className:"min-w-0 flex-1 truncate font-semibold",children:J?.apiClient||"API Client"}),p.jsxs("label",{className:"flex shrink-0 items-center gap-1 text-xs sm:gap-2",children:[p.jsx("span",{className:"sr-only",children:J?.environment||"Environment"}),p.jsxs("select",{"aria-label":J?.environment||"API Client environment",style:{maxWidth:"10rem"},className:`rounded-md border px-2 py-1.5 text-xs ${Ie==="dark"?"border-gray-700 bg-gray-900":"border-gray-300 bg-white"}`,value:M??E.activeEnvironmentId??"",onChange:F=>_(F.target.value||null),children:[p.jsx("option",{value:"",children:J?.noEnvironment||"No environment"}),E.environments.map(F=>p.jsx("option",{value:F.id,children:F.name},F.id))]})]}),E.hasUnsavedRequest&&p.jsx("span",{className:"shrink-0 text-xs font-medium","aria-label":J?.unsavedChanges||"Unsaved request changes",children:J?.unsavedChanges||"Unsaved changes"}),k()]}):p.jsxs(p.Fragment,{children:[Z(),p.jsx("button",{type:"button",className:"hidden h-11 w-11 items-center justify-center rounded-md border lg:inline-flex","aria-label":Ce?"Expand API navigation sidebar":"Collapse API navigation sidebar","aria-expanded":!Ce,onClick:Nn,children:Ce?p.jsx(Ed,{className:"h-5 w-5"}):p.jsx(jd,{className:"h-5 w-5"})}),s.logo?p.jsx(PM,{logo:s.logo,onHome:st}):p.jsx("button",{type:"button","aria-label":"Documentation home",onClick:st,children:p.jsx(Q3,{})}),p.jsxs("div",{className:"min-w-0 flex-1",children:[p.jsx("div",{className:"truncate font-semibold",children:t.info.title}),!s.hideHostname&&t.servers?.[0]?.url&&p.jsx("div",{className:"truncate text-xs opacity-60",children:t.servers[0].url})]}),Y(),h&&p.jsx("button",{type:"button",className:"hidden shrink-0 rounded-md border px-3 py-2 text-sm md:inline-flex","aria-label":J?.printOperation||"Print operation",onClick:()=>{typeof window<"u"&&window.print()},children:J?.printOperation||"Print operation"}),!s.hideDownloadButton&&p.jsxs("div",{className:"flex shrink-0 items-center gap-1","aria-label":"Download OpenAPI specification",children:[p.jsx("button",{type:"button",className:"rounded-md border px-2 py-2 text-xs sm:px-3 sm:text-sm",onClick:()=>ye(D1(t,"json")),children:"JSON"}),p.jsx("button",{type:"button",className:"rounded-md border px-2 py-2 text-xs sm:px-3 sm:text-sm",onClick:()=>ye(D1(t,"yaml")),children:"YAML"})]}),k()]})}),s.hideTopbar&&b==="docs"&&Z(!0),s.hideTopbar&&b==="docs"&&Y(!0),s.hideTopbar&&k(!0),s.hideTopbar&&b==="docs"&&p.jsx("button",{type:"button","data-flexdoc-floating-control":"desktop-navigation",className:`fixed left-4 top-4 z-40 hidden h-11 w-11 items-center justify-center rounded-full border shadow-lg lg:inline-flex ${ae}`,"aria-label":Ce?"Expand API navigation sidebar":"Collapse API navigation sidebar","aria-expanded":!Ce,onClick:Nn,children:Ce?p.jsx(Ed,{className:"h-5 w-5"}):p.jsx(jd,{className:"h-5 w-5"})}),s.hideTopbar&&b==="api-client"&&p.jsxs(p.Fragment,{children:[p.jsxs("button",{type:"button","data-flexdoc-floating-control":"api-client-back",className:`fixed left-4 top-4 z-[65] inline-flex min-h-11 items-center gap-2 rounded-full border px-3 shadow-lg ${ae}`,onClick:Zn,children:[p.jsx(Ro,{className:"h-4 w-4"}),J?.backToOperation||"Back"]}),p.jsxs("div",{"data-flexdoc-floating-control":"api-client-status",className:`fixed right-4 top-4 z-[65] flex items-center gap-2 rounded-full border px-2 py-1.5 shadow-lg ${ae}`,style:{maxWidth:"calc(100vw - 8rem)"},children:[p.jsxs("label",{className:"flex min-w-0 items-center gap-1 text-xs",children:[p.jsx("span",{className:"sr-only",children:J?.environment||"Environment"}),p.jsxs("select",{"aria-label":J?.environment||"API Client environment",style:{maxWidth:"8rem"},className:`rounded-md border px-2 py-1 text-xs ${Ie==="dark"?"border-gray-700 bg-gray-900":"border-gray-300 bg-white"}`,value:M??E.activeEnvironmentId??"",onChange:F=>_(F.target.value||null),children:[p.jsx("option",{value:"",children:J?.noEnvironment||"No environment"}),E.environments.map(F=>p.jsx("option",{value:F.id,children:F.name},F.id))]})]}),E.hasUnsavedRequest&&p.jsx("span",{className:"truncate text-xs font-medium","aria-label":J?.unsavedChanges||"Unsaved request changes",children:J?.unsavedChanges||"Unsaved changes"})]})]}),p.jsxs("div",{className:"relative flex min-h-0 flex-1 overflow-hidden",children:[p.jsxs("div",{"data-flexdoc-docs-view":"docs",className:`${b==="docs"?"flex":"hidden"} min-h-0 min-w-0 flex-1`,children:[p.jsx("aside",{className:`hidden min-h-0 shrink-0 overflow-hidden transition-[width] duration-200 motion-reduce:transition-none lg:block ${Ce?"w-14":"w-80"}`,"data-docs-sidebar":!0,"data-collapsed":Ce?"true":"false",style:{background:"var(--flexdoc-sidebar-bg)",color:"var(--flexdoc-sidebar-text)"},children:!Ce&&xe}),p.jsxs("main",{ref:ve,"data-flexdoc-main-scroll":!0,className:"min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain",children:[h?p.jsx(k3,{spec:t,path:h.path,method:h.method,theme:Ie,options:s,defaultExpandedSections:_n,runtimeSnapshot:ne,onOpenInApiClient:Et}):p.jsx(j3,{spec:t,onEndpointSelect:Ke,theme:Ie}),p.jsx(O3,{footerClasses:V,footer:s.footer})]})]}),w&&p.jsx("div",{"data-api-client-page":"api-client",className:`${b==="api-client"?"block":"hidden"} min-h-0 min-w-0 flex-1 overflow-hidden`,children:p.jsx(O1,{pageMode:!0,manageTheme:!1,theme:Ie,messages:J,persistenceKey:u,handoff:C,activeEnvironmentId:M,onActiveEnvironmentIdChange:F=>_(F??null),onChromeStateChange:F=>{j(F),_(ue=>ue===void 0?F.activeEnvironmentId??null:ue)},credentials:s.tryIt?.credentials||"same-origin",requestInterceptor:s.tryIt?.requestInterceptor,hostExecution:s.tryIt?.hostExecution,serverOptions:t.servers||[]})})]}),q&&p.jsxs("div",{ref:oe,className:"fixed inset-0 z-[70] lg:hidden",role:"dialog","aria-modal":"true","aria-label":J?.apiNavigation||"API navigation",children:[p.jsx("button",{type:"button",tabIndex:-1,"data-focus-trap-ignore":!0,"aria-label":"Close navigation backdrop",className:"absolute inset-0 bg-black/40",onClick:()=>R(!1)}),p.jsxs("aside",{className:`absolute inset-y-0 left-0 flex w-[min(88vw,22rem)] flex-col shadow-2xl ${Ie==="dark"?"bg-gray-900":"bg-white"}`,children:[p.jsxs("div",{className:"flex h-14 items-center justify-between border-b px-4",children:[p.jsx("span",{className:"font-semibold",children:J?.apiNavigation||"API navigation"}),p.jsx("button",{type:"button",className:"inline-flex h-11 w-11 items-center justify-center rounded-md","aria-label":J?.closeApiNavigation||"Close API navigation",onClick:()=>R(!1),children:p.jsx(Md,{className:"h-5 w-5"})})]}),p.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:xe})]})]}),W&&p.jsx("div",{role:"alert",className:`fixed bottom-4 left-1/2 z-[90] max-w-[min(92vw,40rem)] -translate-x-1/2 rounded-lg border px-4 py-3 text-sm shadow-xl ${Ie==="dark"?"border-red-800 bg-red-950 text-red-100":"border-red-300 bg-white text-red-700"}`,onClick:()=>ye(void 0),children:J?.downloadFailed||W}),p.jsx(X3,{open:B&&T,theme:Ie,loading:qe,error:ke,snapshot:ne,onClose:$e,onEndpointSelect:Ke,messages:J}),p.jsx(V3,{spec:t,theme:Ie,messages:J,onEndpointSelect:Ke,onHome:st,onOpenSettings:()=>U(!0),onOpenApiClient:()=>Et(),onOpenRuntime:T?()=>K(!0):void 0,onSendCurrent:x}),p.jsx(K3,{open:X,theme:Ie,hostTheme:e,manageTheme:n,viewerTheme:Fe.theme,viewerExpand:ut,effectiveExpandedSections:_n,messages:J,onThemeChange:ei,onExpandChange:Tn,onClose:()=>U(!1)})]})},fp="x-flexdoc-external-documents";function KM(t){if(typeof fetch!="function")throw new Error("No document loader is available in this environment");return fetch(t).then(async e=>{if(!e.ok)throw new Error(`Failed to load OpenAPI reference ${t}: ${e.status}`);const n=await e.text();return Hi.parseSpec(n).catch(()=>{try{return JSON.parse(n)}catch{throw new Error(`Reference document is not valid JSON/YAML: ${t}`)}})})}function GM(t,e){if(t.startsWith("#"))return{documentUri:e,pointer:t};const n=new URL(t,e),r=n.hash||"#";return n.hash="",{documentUri:n.toString(),pointer:r}}function _1(t,e){const n=Hi.encodePointerToken(t);if(e==="#"||e==="")return`#/${fp}/${n}`;if(!e.startsWith("#/"))throw new Error(`Unsupported JSON Pointer reference: ${e}`);return`#/${fp}/${n}/${e.slice(2)}`}function L1(t){return JSON.parse(JSON.stringify(t))}async function XM(t,e){const n=e.load||KM,r=new URL(e.baseUri).toString().replace(/#.*$/,""),s=L1(t),a={},c=new Map;async function u(g){if(g===r)return s;if(a[g])return a[g];if(c.has(g))return c.get(g);const b=Promise.resolve(n(g)).then(w=>L1(w));c.set(g,b);const v=await b;return a[g]=v,v}const f=new Set;async function h(g,b){if(f.has(b))return;f.add(b);async function v(w){if(!(!w||typeof w!="object")){if(Array.isArray(w)){for(const A of w)await v(A);return}if(typeof w.$ref=="string"){const A=GM(w.$ref,b);if(A.documentUri!==b){const C=await u(A.documentUri);w.$ref=A.documentUri===r?A.pointer:_1(A.documentUri,A.pointer),await h(C,A.documentUri)}else b!==r&&(w.$ref=_1(b,A.pointer))}for(const[A,C]of Object.entries(w))A!=="$ref"&&await v(C)}}await v(g)}return await h(s,r),Object.keys(a).length&&(s[fp]=a),s}async function JM(t,e){return XM(t,e)}const eu="1",tu=new WeakMap;function QM(t){return JSON.parse(JSON.stringify(t))}function hp(t,e={}){const n=QM(t);if(e.title&&(n.info.title=e.title),e.description&&(n.info.description=e.description),e.altDescription&&!n.info.description&&(n.info.description=e.altDescription),e.version&&(n.info.version=e.version),!e.tagGroups?.length)return n;const r=new Map;for(const c of e.tagGroups)for(const u of c.tags)r.set(u,c.name);const s={},a=new Set(["get","post","put","delete","patch","options","head","trace"]);for(const[c,u]of Object.entries(n.paths)){const f={};let h=!1;for(const[g,b]of Object.entries(u)){if(!a.has(g)){f[g]=b;continue}const v=b,w=(v?.tags||[]).filter(A=>r.has(A)).map(A=>r.get(A));!w.length||!v||(f[g]={...v,tags:Array.from(new Set(w))},h=!0)}h&&(s[c]=f)}return n.paths=s,n.tags=e.tagGroups.map(c=>({name:c.name})),n}function WM(t){return typeof t.theme=="string"?t.theme:typeof document<"u"&&document.documentElement.classList.contains("dark")?"dark":"light"}function ZM(t){if(typeof document>"u"||!t.favicon)return;const e=document.querySelector('link[rel~="icon"]'),n=e||document.createElement("link");n.rel="icon",n.href=t.favicon,e||document.head.appendChild(n)}function q1(t,e){const n=tu.get(t);n&&n.unmount();const r=BA.createRoot(t);return tu.set(t,r),r.render(e),()=>{tu.get(t)===r&&tu.delete(t),r.unmount()}}function B1(t,e,n){return ZM(n),q1(t,p.jsx(YM,{spec:hp(e,n),theme:WM(n),options:n}))}function $1(t,e){const n={contractVersion:eu,...e.options||{}};return B1(t,e.spec,n)}function I1(t,e={}){return q1(t,p.jsx(O1,{...e}))}async function H1(t,e){const n={contractVersion:eu,...e.options||{}},r=e.baseUri?await JM(e.spec,{baseUri:e.baseUri,load:e.documentLoader}):e.spec;return B1(t,r,n)}return typeof window<"u"&&(window.FlexDocStandalone={mount:$1,mountAsync:H1,mountApiClient:I1,prepareSpec:hp,contractVersion:eu}),ks.FLEXDOC_CONTRACT_VERSION=eu,ks.mountApiClient=I1,ks.mountFlexDoc=$1,ks.mountFlexDocAsync=H1,ks.prepareSpec=hp,Object.defineProperty(ks,Symbol.toStringTag,{value:"Module"}),ks})({});
|
|
86
86
|
//# sourceMappingURL=flexdoc.standalone.js.map
|