@xtandard/webhooks 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +4 -4
- package/dist/cli.mjs +4 -4
- package/dist/{core-CMpnmI5Q.mjs → core-B1JzRitF.mjs} +20 -3
- package/dist/core-B1JzRitF.mjs.map +1 -0
- package/dist/{core-ZGhH6Vs2.cjs → core-DuHD0Rdg.cjs} +20 -3
- package/dist/core-DuHD0Rdg.cjs.map +1 -0
- package/dist/core.cjs +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{create-fetch-handler-jy3hy5nZ.d.mts → create-fetch-handler-BN9vXbgW.d.mts} +7 -3
- package/dist/{create-fetch-handler-CmooujQo.cjs → create-fetch-handler-BNsNcspj.cjs} +6 -5
- package/dist/{create-fetch-handler-CmooujQo.cjs.map → create-fetch-handler-BNsNcspj.cjs.map} +1 -1
- package/dist/{create-fetch-handler-BIdk9P30.mjs → create-fetch-handler-C6BqzdsN.mjs} +6 -5
- package/dist/{create-fetch-handler-BIdk9P30.mjs.map → create-fetch-handler-C6BqzdsN.mjs.map} +1 -1
- package/dist/{create-fetch-handler-Dlkhustu.d.cts → create-fetch-handler-D9ZRfrY6.d.cts} +7 -3
- package/dist/{dispatcher-Coubwrka.mjs → dispatcher-CFfWo-fN.mjs} +3 -3
- package/dist/{dispatcher-Coubwrka.mjs.map → dispatcher-CFfWo-fN.mjs.map} +1 -1
- package/dist/{dispatcher-B0xTEHt1.cjs → dispatcher-COdWV6hM.cjs} +3 -3
- package/dist/{dispatcher-B0xTEHt1.cjs.map → dispatcher-COdWV6hM.cjs.map} +1 -1
- package/dist/entry-bun.cjs +1 -1
- package/dist/entry-bun.d.cts +1 -1
- package/dist/entry-bun.d.mts +1 -1
- package/dist/entry-bun.mjs +1 -1
- package/dist/entry-elysia.cjs +1 -1
- package/dist/entry-elysia.d.cts +1 -1
- package/dist/entry-elysia.d.mts +1 -1
- package/dist/entry-elysia.mjs +1 -1
- package/dist/entry-express.cjs +1 -1
- package/dist/entry-express.d.cts +1 -1
- package/dist/entry-express.d.mts +1 -1
- package/dist/entry-express.mjs +1 -1
- package/dist/entry-hono.cjs +1 -1
- package/dist/entry-hono.d.cts +1 -1
- package/dist/entry-hono.d.mts +1 -1
- package/dist/entry-hono.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/react.css +1 -1
- package/dist/react.js +2522 -2506
- package/dist/testing.cjs +2 -2
- package/dist/testing.mjs +2 -2
- package/dist/types-react/ui/lib/portal-container.d.ts +24 -0
- package/dist/ui/assets/{index-S5t_CLOe.js → index-BgyX_njf.js} +44 -44
- package/dist/ui/assets/index-mJCJq_EB.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +4 -2
- package/dist/core-CMpnmI5Q.mjs.map +0 -1
- package/dist/core-ZGhH6Vs2.cjs.map +0 -1
- package/dist/ui/assets/index-B0eoQX2U.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var cN=Object.defineProperty;var Tw=n=>{throw TypeError(n)};var uN=(n,e,t)=>e in n?cN(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Kt=(n,e,t)=>uN(n,typeof e!="symbol"?e+"":e,t),py=(n,e,t)=>e.has(n)||Tw("Cannot "+t);var P=(n,e,t)=>(py(n,e,"read from private field"),t?t.call(n):e.get(n)),Ye=(n,e,t)=>e.has(n)?Tw("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Ne=(n,e,t,i)=>(py(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t),ft=(n,e,t)=>(py(n,e,"access private method"),t);var sd=(n,e,t,i)=>({set _(r){Ne(n,e,r,t)},get _(){return P(n,e,i)}});function fN(n,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const r in i)if(r!=="default"&&!(r in n)){const o=Object.getOwnPropertyDescriptor(i,r);o&&Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:()=>i[r]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const o of r)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(r){const o={};return r.integrity&&(o.integrity=r.integrity),r.referrerPolicy&&(o.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?o.credentials="include":r.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(r){if(r.ep)return;r.ep=!0;const o=t(r);fetch(r.href,o)}})();function hN(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var my={exports:{}},ju={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@ var aN=Object.defineProperty;var Rw=n=>{throw TypeError(n)};var cN=(n,e,t)=>e in
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var Ow;function dN(){if(Ow)return ju;Ow=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,r,o){var a=null;if(o!==void 0&&(a=""+o),r.key!==void 0&&(a=""+r.key),"key"in r){o={};for(var u in r)u!=="key"&&(o[u]=r[u])}else o=r;return r=o.ref,{$$typeof:n,type:i,key:a,ref:r!==void 0?r:null,props:o}}return ju.Fragment=e,ju.jsx=t,ju.jsxs=t,ju}var Mw;function pN(){return Mw||(Mw=1,my.exports=dN()),my.exports}var x=pN(),gy={exports:{}},ot={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react.production.js
|
|
12
12
|
*
|
|
@@ -14,7 +14,7 @@ var aN=Object.defineProperty;var Rw=n=>{throw TypeError(n)};var cN=(n,e,t)=>e in
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
17
|
+
*/var Nw;function mN(){if(Nw)return ot;Nw=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.iterator;function v(M){return M===null||typeof M!="object"?null:(M=b&&M[b]||M["@@iterator"],typeof M=="function"?M:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,E={};function k(M,U,te){this.props=M,this.context=U,this.refs=E,this.updater=te||S}k.prototype.isReactComponent={},k.prototype.setState=function(M,U){if(typeof M!="object"&&typeof M!="function"&&M!=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,M,U,"setState")},k.prototype.forceUpdate=function(M){this.updater.enqueueForceUpdate(this,M,"forceUpdate")};function R(){}R.prototype=k.prototype;function N(M,U,te){this.props=M,this.context=U,this.refs=E,this.updater=te||S}var T=N.prototype=new R;T.constructor=N,w(T,k.prototype),T.isPureReactComponent=!0;var B=Array.isArray;function L(){}var D={H:null,A:null,T:null,S:null},j=Object.prototype.hasOwnProperty;function X(M,U,te){var le=te.ref;return{$$typeof:n,type:M,key:U,ref:le!==void 0?le:null,props:te}}function J(M,U){return X(M.type,U,M.props)}function V(M){return typeof M=="object"&&M!==null&&M.$$typeof===n}function K(M){var U={"=":"=0",":":"=2"};return"$"+M.replace(/[=:]/g,function(te){return U[te]})}var ae=/\/+/g;function $(M,U){return typeof M=="object"&&M!==null&&M.key!=null?K(""+M.key):U.toString(36)}function H(M){switch(M.status){case"fulfilled":return M.value;case"rejected":throw M.reason;default:switch(typeof M.status=="string"?M.then(L,L):(M.status="pending",M.then(function(U){M.status==="pending"&&(M.status="fulfilled",M.value=U)},function(U){M.status==="pending"&&(M.status="rejected",M.reason=U)})),M.status){case"fulfilled":return M.value;case"rejected":throw M.reason}}throw M}function z(M,U,te,le,ne){var se=typeof M;(se==="undefined"||se==="boolean")&&(M=null);var he=!1;if(M===null)he=!0;else switch(se){case"bigint":case"string":case"number":he=!0;break;case"object":switch(M.$$typeof){case n:case e:he=!0;break;case p:return he=M._init,z(he(M._payload),U,te,le,ne)}}if(he)return ne=ne(M),he=le===""?"."+$(M,0):le,B(ne)?(te="",he!=null&&(te=he.replace(ae,"$&/")+"/"),z(ne,U,te,"",function(fe){return fe})):ne!=null&&(V(ne)&&(ne=J(ne,te+(ne.key==null||M&&M.key===ne.key?"":(""+ne.key).replace(ae,"$&/")+"/")+he)),U.push(ne)),1;he=0;var pe=le===""?".":le+":";if(B(M))for(var xe=0;xe<M.length;xe++)le=M[xe],se=pe+$(le,xe),he+=z(le,U,te,se,ne);else if(xe=v(M),typeof xe=="function")for(M=xe.call(M),xe=0;!(le=M.next()).done;)le=le.value,se=pe+$(le,xe++),he+=z(le,U,te,se,ne);else if(se==="object"){if(typeof M.then=="function")return z(H(M),U,te,le,ne);throw U=String(M),Error("Objects are not valid as a React child (found: "+(U==="[object Object]"?"object with keys {"+Object.keys(M).join(", ")+"}":U)+"). If you meant to render a collection of children, use an array instead.")}return he}function Q(M,U,te){if(M==null)return M;var le=[],ne=0;return z(M,le,"","",function(se){return U.call(te,se,ne++)}),le}function F(M){if(M._status===-1){var U=M._result;U=U(),U.then(function(te){(M._status===0||M._status===-1)&&(M._status=1,M._result=te)},function(te){(M._status===0||M._status===-1)&&(M._status=2,M._result=te)}),M._status===-1&&(M._status=0,M._result=U)}if(M._status===1)return M._result.default;throw M._result}var ee=typeof reportError=="function"?reportError:function(M){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var U=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof M=="object"&&M!==null&&typeof M.message=="string"?String(M.message):String(M),error:M});if(!window.dispatchEvent(U))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",M);return}console.error(M)},G={map:Q,forEach:function(M,U,te){Q(M,function(){U.apply(this,arguments)},te)},count:function(M){var U=0;return Q(M,function(){U++}),U},toArray:function(M){return Q(M,function(U){return U})||[]},only:function(M){if(!V(M))throw Error("React.Children.only expected to receive a single React element child.");return M}};return ot.Activity=g,ot.Children=G,ot.Component=k,ot.Fragment=t,ot.Profiler=r,ot.PureComponent=N,ot.StrictMode=i,ot.Suspense=f,ot.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=D,ot.__COMPILER_RUNTIME={__proto__:null,c:function(M){return D.H.useMemoCache(M)}},ot.cache=function(M){return function(){return M.apply(null,arguments)}},ot.cacheSignal=function(){return null},ot.cloneElement=function(M,U,te){if(M==null)throw Error("The argument must be a React element, but you passed "+M+".");var le=w({},M.props),ne=M.key;if(U!=null)for(se in U.key!==void 0&&(ne=""+U.key),U)!j.call(U,se)||se==="key"||se==="__self"||se==="__source"||se==="ref"&&U.ref===void 0||(le[se]=U[se]);var se=arguments.length-2;if(se===1)le.children=te;else if(1<se){for(var he=Array(se),pe=0;pe<se;pe++)he[pe]=arguments[pe+2];le.children=he}return X(M.type,ne,le)},ot.createContext=function(M){return M={$$typeof:a,_currentValue:M,_currentValue2:M,_threadCount:0,Provider:null,Consumer:null},M.Provider=M,M.Consumer={$$typeof:o,_context:M},M},ot.createElement=function(M,U,te){var le,ne={},se=null;if(U!=null)for(le in U.key!==void 0&&(se=""+U.key),U)j.call(U,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(ne[le]=U[le]);var he=arguments.length-2;if(he===1)ne.children=te;else if(1<he){for(var pe=Array(he),xe=0;xe<he;xe++)pe[xe]=arguments[xe+2];ne.children=pe}if(M&&M.defaultProps)for(le in he=M.defaultProps,he)ne[le]===void 0&&(ne[le]=he[le]);return X(M,se,ne)},ot.createRef=function(){return{current:null}},ot.forwardRef=function(M){return{$$typeof:u,render:M}},ot.isValidElement=V,ot.lazy=function(M){return{$$typeof:p,_payload:{_status:-1,_result:M},_init:F}},ot.memo=function(M,U){return{$$typeof:d,type:M,compare:U===void 0?null:U}},ot.startTransition=function(M){var U=D.T,te={};D.T=te;try{var le=M(),ne=D.S;ne!==null&&ne(te,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(L,ee)}catch(se){ee(se)}finally{U!==null&&te.types!==null&&(U.types=te.types),D.T=U}},ot.unstable_useCacheRefresh=function(){return D.H.useCacheRefresh()},ot.use=function(M){return D.H.use(M)},ot.useActionState=function(M,U,te){return D.H.useActionState(M,U,te)},ot.useCallback=function(M,U){return D.H.useCallback(M,U)},ot.useContext=function(M){return D.H.useContext(M)},ot.useDebugValue=function(){},ot.useDeferredValue=function(M,U){return D.H.useDeferredValue(M,U)},ot.useEffect=function(M,U){return D.H.useEffect(M,U)},ot.useEffectEvent=function(M){return D.H.useEffectEvent(M)},ot.useId=function(){return D.H.useId()},ot.useImperativeHandle=function(M,U,te){return D.H.useImperativeHandle(M,U,te)},ot.useInsertionEffect=function(M,U){return D.H.useInsertionEffect(M,U)},ot.useLayoutEffect=function(M,U){return D.H.useLayoutEffect(M,U)},ot.useMemo=function(M,U){return D.H.useMemo(M,U)},ot.useOptimistic=function(M,U){return D.H.useOptimistic(M,U)},ot.useReducer=function(M,U,te){return D.H.useReducer(M,U,te)},ot.useRef=function(M){return D.H.useRef(M)},ot.useState=function(M){return D.H.useState(M)},ot.useSyncExternalStore=function(M,U,te){return D.H.useSyncExternalStore(M,U,te)},ot.useTransition=function(){return D.H.useTransition()},ot.version="19.2.7",ot}var Dw;function Rf(){return Dw||(Dw=1,gy.exports=mN()),gy.exports}var A=Rf();const Nb=hN(A),Db=fN({__proto__:null,default:Nb},[A]);var yy={exports:{}},Bu={},by={exports:{}},vy={};/**
|
|
18
18
|
* @license React
|
|
19
19
|
* scheduler.production.js
|
|
20
20
|
*
|
|
@@ -22,7 +22,7 @@ var aN=Object.defineProperty;var Rw=n=>{throw TypeError(n)};var cN=(n,e,t)=>e in
|
|
|
22
22
|
*
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
|
-
*/var
|
|
25
|
+
*/var jw;function gN(){return jw||(jw=1,(function(n){function e(z,Q){var F=z.length;z.push(Q);e:for(;0<F;){var ee=F-1>>>1,G=z[ee];if(0<r(G,Q))z[ee]=Q,z[F]=G,F=ee;else break e}}function t(z){return z.length===0?null:z[0]}function i(z){if(z.length===0)return null;var Q=z[0],F=z.pop();if(F!==Q){z[0]=F;e:for(var ee=0,G=z.length,M=G>>>1;ee<M;){var U=2*(ee+1)-1,te=z[U],le=U+1,ne=z[le];if(0>r(te,F))le<G&&0>r(ne,te)?(z[ee]=ne,z[le]=F,ee=le):(z[ee]=te,z[U]=F,ee=U);else if(le<G&&0>r(ne,F))z[ee]=ne,z[le]=F,ee=le;else break e}}return Q}function r(z,Q){var F=z.sortIndex-Q.sortIndex;return F!==0?F:z.id-Q.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;n.unstable_now=function(){return o.now()}}else{var a=Date,u=a.now();n.unstable_now=function(){return a.now()-u}}var f=[],d=[],p=1,g=null,b=3,v=!1,S=!1,w=!1,E=!1,k=typeof setTimeout=="function"?setTimeout:null,R=typeof clearTimeout=="function"?clearTimeout:null,N=typeof setImmediate<"u"?setImmediate:null;function T(z){for(var Q=t(d);Q!==null;){if(Q.callback===null)i(d);else if(Q.startTime<=z)i(d),Q.sortIndex=Q.expirationTime,e(f,Q);else break;Q=t(d)}}function B(z){if(w=!1,T(z),!S)if(t(f)!==null)S=!0,L||(L=!0,K());else{var Q=t(d);Q!==null&&H(B,Q.startTime-z)}}var L=!1,D=-1,j=5,X=-1;function J(){return E?!0:!(n.unstable_now()-X<j)}function V(){if(E=!1,L){var z=n.unstable_now();X=z;var Q=!0;try{e:{S=!1,w&&(w=!1,R(D),D=-1),v=!0;var F=b;try{t:{for(T(z),g=t(f);g!==null&&!(g.expirationTime>z&&J());){var ee=g.callback;if(typeof ee=="function"){g.callback=null,b=g.priorityLevel;var G=ee(g.expirationTime<=z);if(z=n.unstable_now(),typeof G=="function"){g.callback=G,T(z),Q=!0;break t}g===t(f)&&i(f),T(z)}else i(f);g=t(f)}if(g!==null)Q=!0;else{var M=t(d);M!==null&&H(B,M.startTime-z),Q=!1}}break e}finally{g=null,b=F,v=!1}Q=void 0}}finally{Q?K():L=!1}}}var K;if(typeof N=="function")K=function(){N(V)};else if(typeof MessageChannel<"u"){var ae=new MessageChannel,$=ae.port2;ae.port1.onmessage=V,K=function(){$.postMessage(null)}}else K=function(){k(V,0)};function H(z,Q){D=k(function(){z(n.unstable_now())},Q)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):j=0<z?Math.floor(1e3/z):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(z){switch(b){case 1:case 2:case 3:var Q=3;break;default:Q=b}var F=b;b=Q;try{return z()}finally{b=F}},n.unstable_requestPaint=function(){E=!0},n.unstable_runWithPriority=function(z,Q){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var F=b;b=z;try{return Q()}finally{b=F}},n.unstable_scheduleCallback=function(z,Q,F){var ee=n.unstable_now();switch(typeof F=="object"&&F!==null?(F=F.delay,F=typeof F=="number"&&0<F?ee+F:ee):F=ee,z){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=F+G,z={id:p++,callback:Q,priorityLevel:z,startTime:F,expirationTime:G,sortIndex:-1},F>ee?(z.sortIndex=F,e(d,z),t(f)===null&&z===t(d)&&(w?(R(D),D=-1):w=!0,H(B,F-ee))):(z.sortIndex=G,e(f,z),S||v||(S=!0,L||(L=!0,K()))),z},n.unstable_shouldYield=J,n.unstable_wrapCallback=function(z){var Q=b;return function(){var F=b;b=Q;try{return z.apply(this,arguments)}finally{b=F}}}})(vy)),vy}var Bw;function yN(){return Bw||(Bw=1,by.exports=gN()),by.exports}var xy={exports:{}},Zn={};/**
|
|
26
26
|
* @license React
|
|
27
27
|
* react-dom.production.js
|
|
28
28
|
*
|
|
@@ -30,7 +30,7 @@ var aN=Object.defineProperty;var Rw=n=>{throw TypeError(n)};var cN=(n,e,t)=>e in
|
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
|
-
*/var
|
|
33
|
+
*/var Lw;function bN(){if(Lw)return Zn;Lw=1;var n=Rf();function e(f){var d="https://react.dev/errors/"+f;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+f+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var i={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},r=Symbol.for("react.portal");function o(f,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:g==null?null:""+g,children:f,containerInfo:d,implementation:p}}var a=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(f,d){if(f==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Zn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Zn.createPortal=function(f,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return o(f,d,null,p)},Zn.flushSync=function(f){var d=a.T,p=i.p;try{if(a.T=null,i.p=2,f)return f()}finally{a.T=d,i.p=p,i.d.f()}},Zn.preconnect=function(f,d){typeof f=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(f,d))},Zn.prefetchDNS=function(f){typeof f=="string"&&i.d.D(f)},Zn.preinit=function(f,d){if(typeof f=="string"&&d&&typeof d.as=="string"){var p=d.as,g=u(p,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?i.d.S(f,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:b,fetchPriority:v}):p==="script"&&i.d.X(f,{crossOrigin:g,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Zn.preinitModule=function(f,d){if(typeof f=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=u(d.as,d.crossOrigin);i.d.M(f,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(f)},Zn.preload=function(f,d){if(typeof f=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=u(p,d.crossOrigin);i.d.L(f,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Zn.preloadModule=function(f,d){if(typeof f=="string")if(d){var p=u(d.as,d.crossOrigin);i.d.m(f,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(f)},Zn.requestFormReset=function(f){i.d.r(f)},Zn.unstable_batchedUpdates=function(f,d){return f(d)},Zn.useFormState=function(f,d,p){return a.H.useFormState(f,d,p)},Zn.useFormStatus=function(){return a.H.useHostTransitionStatus()},Zn.version="19.2.7",Zn}var zw;function TA(){if(zw)return xy.exports;zw=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),xy.exports=bN(),xy.exports}/**
|
|
34
34
|
* @license React
|
|
35
35
|
* react-dom-client.production.js
|
|
36
36
|
*
|
|
@@ -38,15 +38,15 @@ var aN=Object.defineProperty;var Rw=n=>{throw TypeError(n)};var cN=(n,e,t)=>e in
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var
|
|
41
|
+
*/var Iw;function vN(){if(Iw)return Bu;Iw=1;var n=yN(),e=Rf(),t=TA();function i(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)l+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var l=s,c=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(c=l.return),s=l.return;while(s)}return l.tag===3?c:null}function a(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function u(s){if(s.tag===31){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function f(s){if(o(s)!==s)throw Error(i(188))}function d(s){var l=s.alternate;if(!l){if(l=o(s),l===null)throw Error(i(188));return l!==s?null:s}for(var c=s,h=l;;){var m=c.return;if(m===null)break;var y=m.alternate;if(y===null){if(h=m.return,h!==null){c=h;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===c)return f(m),s;if(y===h)return f(m),l;y=y.sibling}throw Error(i(188))}if(c.return!==h.return)c=m,h=y;else{for(var C=!1,O=m.child;O;){if(O===c){C=!0,c=m,h=y;break}if(O===h){C=!0,h=m,c=y;break}O=O.sibling}if(!C){for(O=y.child;O;){if(O===c){C=!0,c=y,h=m;break}if(O===h){C=!0,h=y,c=m;break}O=O.sibling}if(!C)throw Error(i(189))}}if(c.alternate!==h)throw Error(i(190))}if(c.tag!==3)throw Error(i(188));return c.stateNode.current===c?s:l}function p(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=p(s),l!==null)return l;s=s.sibling}return null}var g=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),k=Symbol.for("react.profiler"),R=Symbol.for("react.consumer"),N=Symbol.for("react.context"),T=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),L=Symbol.for("react.suspense_list"),D=Symbol.for("react.memo"),j=Symbol.for("react.lazy"),X=Symbol.for("react.activity"),J=Symbol.for("react.memo_cache_sentinel"),V=Symbol.iterator;function K(s){return s===null||typeof s!="object"?null:(s=V&&s[V]||s["@@iterator"],typeof s=="function"?s:null)}var ae=Symbol.for("react.client.reference");function $(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ae?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case w:return"Fragment";case k:return"Profiler";case E:return"StrictMode";case B:return"Suspense";case L:return"SuspenseList";case X:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case S:return"Portal";case N:return s.displayName||"Context";case R:return(s._context.displayName||"Context")+".Consumer";case T:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case D:return l=s.displayName||null,l!==null?l:$(s.type)||"Memo";case j:l=s._payload,s=s._init;try{return $(s(l))}catch{}}return null}var H=Array.isArray,z=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Q=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F={pending:!1,data:null,method:null,action:null},ee=[],G=-1;function M(s){return{current:s}}function U(s){0>G||(s.current=ee[G],ee[G]=null,G--)}function te(s,l){G++,ee[G]=s.current,s.current=l}var le=M(null),ne=M(null),se=M(null),he=M(null);function pe(s,l){switch(te(se,l),te(ne,s),te(le,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?$S(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=$S(l),s=ZS(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}U(le),te(le,s)}function xe(){U(le),U(ne),U(se)}function fe(s){s.memoizedState!==null&&te(he,s);var l=le.current,c=ZS(l,s.type);l!==c&&(te(ne,s),te(le,c))}function ie(s){ne.current===s&&(U(le),U(ne)),he.current===s&&(U(he),Ou._currentValue=F)}var ye,ve;function Qe(s){if(ye===void 0)try{throw Error()}catch(c){var l=c.stack.trim().match(/\n( *(at )?)/);ye=l&&l[1]||"",ve=-1<c.stack.indexOf(`
|
|
42
42
|
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
43
43
|
`+ye+s+ve}var Re=!1;function me(s,l){if(!s||Re)return"";Re=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(l){var ue=function(){throw Error()};if(Object.defineProperty(ue.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ue,[])}catch(re){var Z=re}Reflect.construct(s,[],ue)}else{try{ue.call()}catch(re){Z=re}s.call(ue.prototype)}}else{try{throw Error()}catch(re){Z=re}(ue=s())&&typeof ue.catch=="function"&&ue.catch(function(){})}}catch(re){if(re&&Z&&typeof re.stack=="string")return[re.stack,Z.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=h.DetermineComponentFrameRoot(),C=y[0],O=y[1];if(C&&O){var I=C.split(`
|
|
44
44
|
`),W=O.split(`
|
|
45
45
|
`);for(m=h=0;h<I.length&&!I[h].includes("DetermineComponentFrameRoot");)h++;for(;m<W.length&&!W[m].includes("DetermineComponentFrameRoot");)m++;if(h===I.length||m===W.length)for(h=I.length-1,m=W.length-1;1<=h&&0<=m&&I[h]!==W[m];)m--;for(;1<=h&&0<=m;h--,m--)if(I[h]!==W[m]){if(h!==1||m!==1)do if(h--,m--,0>m||I[h]!==W[m]){var oe=`
|
|
46
46
|
`+I[h].replace(" at new "," at ");return s.displayName&&oe.includes("<anonymous>")&&(oe=oe.replace("<anonymous>",s.displayName)),oe}while(1<=h&&0<=m);break}}}finally{Re=!1,Error.prepareStackTrace=c}return(c=s?s.displayName||s.name:"")?Qe(c):""}function ke(s,l){switch(s.tag){case 26:case 27:case 5:return Qe(s.type);case 16:return Qe("Lazy");case 13:return s.child!==l&&l!==null?Qe("Suspense Fallback"):Qe("Suspense");case 19:return Qe("SuspenseList");case 0:case 15:return me(s.type,!1);case 11:return me(s.type.render,!1);case 1:return me(s.type,!0);case 31:return Qe("Activity");default:return""}}function be(s){try{var l="",c=null;do l+=ke(s,c),c=s,s=s.return;while(s);return l}catch(h){return`
|
|
47
47
|
Error generating stack: `+h.message+`
|
|
48
|
-
`+h.stack}}var De=Object.prototype.hasOwnProperty,qe=n.unstable_scheduleCallback,je=n.unstable_cancelCallback,Te=n.unstable_shouldYield,we=n.unstable_requestPaint,Ae=n.unstable_now,Ce=n.unstable_getCurrentPriorityLevel,Ze=n.unstable_ImmediatePriority,nt=n.unstable_UserBlockingPriority,_e=n.unstable_NormalPriority,rt=n.unstable_LowPriority,at=n.unstable_IdlePriority,Lt=n.log,nn=n.unstable_setDisableYieldValue,ht=null,Ue=null;function Jt(s){if(typeof Lt=="function"&&nn(s),Ue&&typeof Ue.setStrictMode=="function")try{Ue.setStrictMode(ht,s)}catch{}}var Pt=Math.clz32?Math.clz32:At,es=Math.log,dn=Math.LN2;function At(s){return s>>>=0,s===0?32:31-(es(s)/dn|0)|0}var st=256,pn=262144,Ge=4194304;function it(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Et(s,l,c){var h=s.pendingLanes;if(h===0)return 0;var m=0,y=s.suspendedLanes,C=s.pingedLanes;s=s.warmLanes;var O=h&134217727;return O!==0?(h=O&~y,h!==0?m=it(h):(C&=O,C!==0?m=it(C):c||(c=O&~s,c!==0&&(m=it(c))))):(O=h&~y,O!==0?m=it(O):C!==0?m=it(C):c||(c=h&~s,c!==0&&(m=it(c)))),m===0?0:l!==0&&l!==m&&(l&y)===0&&(y=m&-m,c=l&-l,y>=c||y===32&&(c&4194048)!==0)?l:m}function Qt(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function sn(s,l){switch(s){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 Rn(){var s=Ge;return Ge<<=1,(Ge&62914560)===0&&(Ge=4194304),s}function Un(s){for(var l=[],c=0;31>c;c++)l.push(s);return l}function oi(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function ai(s,l,c,h,m,y){var C=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var O=s.entanglements,I=s.expirationTimes,W=s.hiddenUpdates;for(c=C&~c;0<c;){var oe=31-Pt(c),ue=1<<oe;O[oe]=0,I[oe]=-1;var Z=W[oe];if(Z!==null)for(W[oe]=null,oe=0;oe<Z.length;oe++){var re=Z[oe];re!==null&&(re.lane&=-536870913)}c&=~ue}h!==0&<(s,h,0),y!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=y&~(C&~l))}function lt(s,l,c){s.pendingLanes|=l,s.suspendedLanes&=~l;var h=31-Pt(l);s.entangledLanes|=l,s.entanglements[h]=s.entanglements[h]|1073741824|c&261930}function ts(s,l){var c=s.entangledLanes|=l;for(s=s.entanglements;c;){var h=31-Pt(c),m=1<<h;m&l|s[h]&l&&(s[h]|=l),c&=~m}}function ur(s,l){var c=l&-l;return c=(c&42)!==0?1:ys(c),(c&(s.suspendedLanes|l))!==0?0:c}function ys(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function zs(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Is(){var s=Q.p;return s!==0?s:(s=window.event,s===void 0?32:xw(s.type))}function fr(s,l){var c=Q.p;try{return Q.p=s,l()}finally{Q.p=c}}var qn=Math.random().toString(36).slice(2),Ut="__reactFiber$"+qn,rn="__reactProps$"+qn,Tn="__reactContainer$"+qn,yi="__reactEvents$"+qn,cm="__reactListeners$"+qn,Ff="__reactHandles$"+qn,Gf="__reactResources$"+qn,hr="__reactMarker$"+qn;function ma(s){delete s[Ut],delete s[rn],delete s[yi],delete s[cm],delete s[Ff]}function Ps(s){var l=s[Ut];if(l)return l;for(var c=s.parentNode;c;){if(l=c[Tn]||c[Ut]){if(c=l.alternate,l.child!==null||c!==null&&c.child!==null)for(s=sw(s);s!==null;){if(c=s[Ut])return c;s=sw(s)}return l}s=c,c=s.parentNode}return null}function Yr(s){if(s=s[Ut]||s[Tn]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Hs(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(i(33))}function Wr(s){var l=s[Gf];return l||(l=s[Gf]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Ot(s){s[hr]=!0}var ci=new Set,Xr={};function bi(s,l){$r(s,l),$r(s+"Capture",l)}function $r(s,l){for(Xr[s]=l,s=0;s<l.length;s++)ci.add(l[s])}var Uc=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]*$"),ga={},Qf={};function ya(s){return De.call(Qf,s)?!0:De.call(ga,s)?!1:Uc.test(s)?Qf[s]=!0:(ga[s]=!0,!1)}function Zr(s,l,c){if(ya(l))if(c===null)s.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var h=l.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+c)}}function Jr(s,l,c){if(c===null)s.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+c)}}function bs(s,l,c,h){if(h===null)s.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(l,c,""+h)}}function vi(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Kf(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function um(s,l,c){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var m=h.get,y=h.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return m.call(this)},set:function(C){c=""+C,y.call(this,C)}}),Object.defineProperty(s,l,{enumerable:h.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function po(s){if(!s._valueTracker){var l=Kf(s)?"checked":"value";s._valueTracker=um(s,l,""+s[l])}}function ba(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var c=l.getValue(),h="";return s&&(h=Kf(s)?s.checked?"true":"false":s.value),s=h,s!==c?(l.setValue(s),!0):!1}function el(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var fm=/[\n"\\]/g;function xi(s){return s.replace(fm,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function qc(s,l,c,h,m,y,C,O){s.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?s.type=C:s.removeAttribute("type"),l!=null?C==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+vi(l)):s.value!==""+vi(l)&&(s.value=""+vi(l)):C!=="submit"&&C!=="reset"||s.removeAttribute("value"),l!=null?Fc(s,C,vi(l)):c!=null?Fc(s,C,vi(c)):h!=null&&s.removeAttribute("value"),m==null&&y!=null&&(s.defaultChecked=!!y),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?s.name=""+vi(O):s.removeAttribute("name")}function Yf(s,l,c,h,m,y,C,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.type=y),l!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||l!=null)){po(s);return}c=c!=null?""+vi(c):"",l=l!=null?""+vi(l):c,O||l===s.value||(s.value=l),s.defaultValue=l}h=h??m,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=O?s.checked:!!h,s.defaultChecked=!!h,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(s.name=C),po(s)}function Fc(s,l,c){l==="number"&&el(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function tl(s,l,c,h){if(s=s.options,l){l={};for(var m=0;m<c.length;m++)l["$"+c[m]]=!0;for(c=0;c<s.length;c++)m=l.hasOwnProperty("$"+s[c].value),s[c].selected!==m&&(s[c].selected=m),m&&h&&(s[c].defaultSelected=!0)}else{for(c=""+vi(c),l=null,m=0;m<s.length;m++){if(s[m].value===c){s[m].selected=!0,h&&(s[m].defaultSelected=!0);return}l!==null||s[m].disabled||(l=s[m])}l!==null&&(l.selected=!0)}}function Me(s,l,c){if(l!=null&&(l=""+vi(l),l!==s.value&&(s.value=l),c==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=c!=null?""+vi(c):""}function Ke(s,l,c,h){if(l==null){if(h!=null){if(c!=null)throw Error(i(92));if(H(h)){if(1<h.length)throw Error(i(93));h=h[0]}c=h}c==null&&(c=""),l=c}c=vi(l),s.defaultValue=c,h=s.textContent,h===c&&h!==""&&h!==null&&(s.value=h),po(s)}function Je(s,l){if(l){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=l;return}}s.textContent=l}var Mt=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 ln(s,l,c){var h=l.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?h?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":h?s.setProperty(l,c):typeof c!="number"||c===0||Mt.has(l)?l==="float"?s.cssFloat=c:s[l]=(""+c).trim():s[l]=c+"px"}function On(s,l,c){if(l!=null&&typeof l!="object")throw Error(i(62));if(s=s.style,c!=null){for(var h in c)!c.hasOwnProperty(h)||l!=null&&l.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var m in l)h=l[m],l.hasOwnProperty(m)&&c[m]!==h&&ln(s,m,h)}else for(var y in l)l.hasOwnProperty(y)&&ln(s,y,l[y])}function vs(s){if(s.indexOf("-")===-1)return!1;switch(s){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 nl=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"]]),dr=/^[\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 Gc(s){return dr.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function xs(){}var Wf=null;function hm(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var va=null,xa=null;function Wv(s){var l=Yr(s);if(l&&(s=l.stateNode)){var c=s[rn]||null;e:switch(s=l.stateNode,l.type){case"input":if(qc(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),l=c.name,c.type==="radio"&&l!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+xi(""+l)+'"][type="radio"]'),l=0;l<c.length;l++){var h=c[l];if(h!==s&&h.form===s.form){var m=h[rn]||null;if(!m)throw Error(i(90));qc(h,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(l=0;l<c.length;l++)h=c[l],h.form===s.form&&ba(h)}break e;case"textarea":Me(s,c.value,c.defaultValue);break e;case"select":l=c.value,l!=null&&tl(s,!!c.multiple,l,!1)}}}var dm=!1;function Xv(s,l,c){if(dm)return s(l,c);dm=!0;try{var h=s(l);return h}finally{if(dm=!1,(va!==null||xa!==null)&&(zh(),va&&(l=va,s=xa,xa=va=null,Wv(l),s)))for(l=0;l<s.length;l++)Wv(s[l])}}function Qc(s,l){var c=s.stateNode;if(c===null)return null;var h=c[rn]||null;if(h===null)return null;c=h[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":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,l,typeof c));return c}var pr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pm=!1;if(pr)try{var Kc={};Object.defineProperty(Kc,"passive",{get:function(){pm=!0}}),window.addEventListener("test",Kc,Kc),window.removeEventListener("test",Kc,Kc)}catch{pm=!1}var il=null,mm=null,Xf=null;function $v(){if(Xf)return Xf;var s,l=mm,c=l.length,h,m="value"in il?il.value:il.textContent,y=m.length;for(s=0;s<c&&l[s]===m[s];s++);var C=c-s;for(h=1;h<=C&&l[c-h]===m[y-h];h++);return Xf=m.slice(s,1<h?1-h:void 0)}function $f(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function Zf(){return!0}function Zv(){return!1}function Si(s){function l(c,h,m,y,C){this._reactName=c,this._targetInst=m,this.type=h,this.nativeEvent=y,this.target=C,this.currentTarget=null;for(var O in s)s.hasOwnProperty(O)&&(c=s[O],this[O]=c?c(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Zf:Zv,this.isPropagationStopped=Zv,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Zf)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Zf)},persist:function(){},isPersistent:Zf}),l}var mo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jf=Si(mo),Yc=g({},mo,{view:0,detail:0}),lO=Si(Yc),gm,ym,Wc,eh=g({},Yc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vm,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Wc&&(Wc&&s.type==="mousemove"?(gm=s.screenX-Wc.screenX,ym=s.screenY-Wc.screenY):ym=gm=0,Wc=s),gm)},movementY:function(s){return"movementY"in s?s.movementY:ym}}),Jv=Si(eh),oO=g({},eh,{dataTransfer:0}),aO=Si(oO),cO=g({},Yc,{relatedTarget:0}),bm=Si(cO),uO=g({},mo,{animationName:0,elapsedTime:0,pseudoElement:0}),fO=Si(uO),hO=g({},mo,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),dO=Si(hO),pO=g({},mo,{data:0}),ex=Si(pO),mO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},gO={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"},yO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function bO(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=yO[s])?!!l[s]:!1}function vm(){return bO}var vO=g({},Yc,{key:function(s){if(s.key){var l=mO[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=$f(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?gO[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vm,charCode:function(s){return s.type==="keypress"?$f(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?$f(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),xO=Si(vO),SO=g({},eh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),tx=Si(SO),wO=g({},Yc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vm}),CO=Si(wO),kO=g({},mo,{propertyName:0,elapsedTime:0,pseudoElement:0}),AO=Si(kO),EO=g({},eh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),RO=Si(EO),TO=g({},mo,{newState:0,oldState:0}),OO=Si(TO),MO=[9,13,27,32],xm=pr&&"CompositionEvent"in window,Xc=null;pr&&"documentMode"in document&&(Xc=document.documentMode);var NO=pr&&"TextEvent"in window&&!Xc,nx=pr&&(!xm||Xc&&8<Xc&&11>=Xc),ix=" ",sx=!1;function rx(s,l){switch(s){case"keyup":return MO.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function lx(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Sa=!1;function DO(s,l){switch(s){case"compositionend":return lx(l);case"keypress":return l.which!==32?null:(sx=!0,ix);case"textInput":return s=l.data,s===ix&&sx?null:s;default:return null}}function jO(s,l){if(Sa)return s==="compositionend"||!xm&&rx(s,l)?(s=$v(),Xf=mm=il=null,Sa=!1,s):null;switch(s){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 nx&&l.locale!=="ko"?null:l.data;default:return null}}var BO={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 ox(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!BO[s.type]:l==="textarea"}function ax(s,l,c,h){va?xa?xa.push(h):xa=[h]:va=h,l=qh(l,"onChange"),0<l.length&&(c=new Jf("onChange","change",null,c,h),s.push({event:c,listeners:l}))}var $c=null,Zc=null;function LO(s){FS(s,0)}function th(s){var l=Hs(s);if(ba(l))return s}function cx(s,l){if(s==="change")return l}var ux=!1;if(pr){var Sm;if(pr){var wm="oninput"in document;if(!wm){var fx=document.createElement("div");fx.setAttribute("oninput","return;"),wm=typeof fx.oninput=="function"}Sm=wm}else Sm=!1;ux=Sm&&(!document.documentMode||9<document.documentMode)}function hx(){$c&&($c.detachEvent("onpropertychange",dx),Zc=$c=null)}function dx(s){if(s.propertyName==="value"&&th(Zc)){var l=[];ax(l,Zc,s,hm(s)),Xv(LO,l)}}function zO(s,l,c){s==="focusin"?(hx(),$c=l,Zc=c,$c.attachEvent("onpropertychange",dx)):s==="focusout"&&hx()}function IO(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return th(Zc)}function PO(s,l){if(s==="click")return th(l)}function HO(s,l){if(s==="input"||s==="change")return th(l)}function VO(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var Ii=typeof Object.is=="function"?Object.is:VO;function Jc(s,l){if(Ii(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var c=Object.keys(s),h=Object.keys(l);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var m=c[h];if(!De.call(l,m)||!Ii(s[m],l[m]))return!1}return!0}function px(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function mx(s,l){var c=px(s);s=0;for(var h;c;){if(c.nodeType===3){if(h=s+c.textContent.length,s<=l&&h>=l)return{node:c,offset:l-s};s=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=px(c)}}function gx(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?gx(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function yx(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=el(s.document);l instanceof s.HTMLIFrameElement;){try{var c=typeof l.contentWindow.location.href=="string"}catch{c=!1}if(c)s=l.contentWindow;else break;l=el(s.document)}return l}function Cm(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var _O=pr&&"documentMode"in document&&11>=document.documentMode,wa=null,km=null,eu=null,Am=!1;function bx(s,l,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Am||wa==null||wa!==el(h)||(h=wa,"selectionStart"in h&&Cm(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),eu&&Jc(eu,h)||(eu=h,h=qh(km,"onSelect"),0<h.length&&(l=new Jf("onSelect","select",null,l,c),s.push({event:l,listeners:h}),l.target=wa)))}function go(s,l){var c={};return c[s.toLowerCase()]=l.toLowerCase(),c["Webkit"+s]="webkit"+l,c["Moz"+s]="moz"+l,c}var Ca={animationend:go("Animation","AnimationEnd"),animationiteration:go("Animation","AnimationIteration"),animationstart:go("Animation","AnimationStart"),transitionrun:go("Transition","TransitionRun"),transitionstart:go("Transition","TransitionStart"),transitioncancel:go("Transition","TransitionCancel"),transitionend:go("Transition","TransitionEnd")},Em={},vx={};pr&&(vx=document.createElement("div").style,"AnimationEvent"in window||(delete Ca.animationend.animation,delete Ca.animationiteration.animation,delete Ca.animationstart.animation),"TransitionEvent"in window||delete Ca.transitionend.transition);function yo(s){if(Em[s])return Em[s];if(!Ca[s])return s;var l=Ca[s],c;for(c in l)if(l.hasOwnProperty(c)&&c in vx)return Em[s]=l[c];return s}var xx=yo("animationend"),Sx=yo("animationiteration"),wx=yo("animationstart"),UO=yo("transitionrun"),qO=yo("transitionstart"),FO=yo("transitioncancel"),Cx=yo("transitionend"),kx=new Map,Rm="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(" ");Rm.push("scrollEnd");function Ss(s,l){kx.set(s,l),bi(l,[s])}var nh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},ns=[],ka=0,Tm=0;function ih(){for(var s=ka,l=Tm=ka=0;l<s;){var c=ns[l];ns[l++]=null;var h=ns[l];ns[l++]=null;var m=ns[l];ns[l++]=null;var y=ns[l];if(ns[l++]=null,h!==null&&m!==null){var C=h.pending;C===null?m.next=m:(m.next=C.next,C.next=m),h.pending=m}y!==0&&Ax(c,m,y)}}function sh(s,l,c,h){ns[ka++]=s,ns[ka++]=l,ns[ka++]=c,ns[ka++]=h,Tm|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function Om(s,l,c,h){return sh(s,l,c,h),rh(s)}function bo(s,l){return sh(s,null,null,l),rh(s)}function Ax(s,l,c){s.lanes|=c;var h=s.alternate;h!==null&&(h.lanes|=c);for(var m=!1,y=s.return;y!==null;)y.childLanes|=c,h=y.alternate,h!==null&&(h.childLanes|=c),y.tag===22&&(s=y.stateNode,s===null||s._visibility&1||(m=!0)),s=y,y=y.return;return s.tag===3?(y=s.stateNode,m&&l!==null&&(m=31-Pt(c),s=y.hiddenUpdates,h=s[m],h===null?s[m]=[l]:h.push(l),l.lane=c|536870912),y):null}function rh(s){if(50<wu)throw wu=0,Pg=null,Error(i(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Aa={};function GO(s,l,c,h){this.tag=s,this.key=c,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=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pi(s,l,c,h){return new GO(s,l,c,h)}function Mm(s){return s=s.prototype,!(!s||!s.isReactComponent)}function mr(s,l){var c=s.alternate;return c===null?(c=Pi(s.tag,l,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=l,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,l=s.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function Ex(s,l){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,l=c.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function lh(s,l,c,h,m,y){var C=0;if(h=s,typeof s=="function")Mm(s)&&(C=1);else if(typeof s=="string")C=XM(s,c,le.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case X:return s=Pi(31,c,l,m),s.elementType=X,s.lanes=y,s;case w:return vo(c.children,m,y,l);case E:C=8,m|=24;break;case k:return s=Pi(12,c,l,m|2),s.elementType=k,s.lanes=y,s;case B:return s=Pi(13,c,l,m),s.elementType=B,s.lanes=y,s;case L:return s=Pi(19,c,l,m),s.elementType=L,s.lanes=y,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case N:C=10;break e;case R:C=9;break e;case T:C=11;break e;case D:C=14;break e;case j:C=16,h=null;break e}C=29,c=Error(i(130,s===null?"null":typeof s,"")),h=null}return l=Pi(C,c,l,m),l.elementType=s,l.type=h,l.lanes=y,l}function vo(s,l,c,h){return s=Pi(7,s,h,l),s.lanes=c,s}function Nm(s,l,c){return s=Pi(6,s,null,l),s.lanes=c,s}function Rx(s){var l=Pi(18,null,null,0);return l.stateNode=s,l}function Dm(s,l,c){return l=Pi(4,s.children!==null?s.children:[],s.key,l),l.lanes=c,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var Tx=new WeakMap;function is(s,l){if(typeof s=="object"&&s!==null){var c=Tx.get(s);return c!==void 0?c:(l={value:s,source:l,stack:be(l)},Tx.set(s,l),l)}return{value:s,source:l,stack:be(l)}}var Ea=[],Ra=0,oh=null,tu=0,ss=[],rs=0,sl=null,Vs=1,_s="";function gr(s,l){Ea[Ra++]=tu,Ea[Ra++]=oh,oh=s,tu=l}function Ox(s,l,c){ss[rs++]=Vs,ss[rs++]=_s,ss[rs++]=sl,sl=s;var h=Vs;s=_s;var m=32-Pt(h)-1;h&=~(1<<m),c+=1;var y=32-Pt(l)+m;if(30<y){var C=m-m%5;y=(h&(1<<C)-1).toString(32),h>>=C,m-=C,Vs=1<<32-Pt(l)+m|c<<m|h,_s=y+s}else Vs=1<<y|c<<m|h,_s=s}function jm(s){s.return!==null&&(gr(s,1),Ox(s,1,0))}function Bm(s){for(;s===oh;)oh=Ea[--Ra],Ea[Ra]=null,tu=Ea[--Ra],Ea[Ra]=null;for(;s===sl;)sl=ss[--rs],ss[rs]=null,_s=ss[--rs],ss[rs]=null,Vs=ss[--rs],ss[rs]=null}function Mx(s,l){ss[rs++]=Vs,ss[rs++]=_s,ss[rs++]=sl,Vs=l.id,_s=l.overflow,sl=s}var Fn=null,Xt=null,xt=!1,rl=null,ls=!1,Lm=Error(i(519));function ll(s){var l=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw nu(is(l,s)),Lm}function Nx(s){var l=s.stateNode,c=s.type,h=s.memoizedProps;switch(l[Ut]=s,l[rn]=h,c){case"dialog":yt("cancel",l),yt("close",l);break;case"iframe":case"object":case"embed":yt("load",l);break;case"video":case"audio":for(c=0;c<ku.length;c++)yt(ku[c],l);break;case"source":yt("error",l);break;case"img":case"image":case"link":yt("error",l),yt("load",l);break;case"details":yt("toggle",l);break;case"input":yt("invalid",l),Yf(l,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":yt("invalid",l);break;case"textarea":yt("invalid",l),Ke(l,h.value,h.defaultValue,h.children)}c=h.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||l.textContent===""+c||h.suppressHydrationWarning===!0||YS(l.textContent,c)?(h.popover!=null&&(yt("beforetoggle",l),yt("toggle",l)),h.onScroll!=null&&yt("scroll",l),h.onScrollEnd!=null&&yt("scrollend",l),h.onClick!=null&&(l.onclick=xs),l=!0):l=!1,l||ll(s,!0)}function Dx(s){for(Fn=s.return;Fn;)switch(Fn.tag){case 5:case 31:case 13:ls=!1;return;case 27:case 3:ls=!0;return;default:Fn=Fn.return}}function Ta(s){if(s!==Fn)return!1;if(!xt)return Dx(s),xt=!0,!1;var l=s.tag,c;if((c=l!==3&&l!==27)&&((c=l===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Jg(s.type,s.memoizedProps)),c=!c),c&&Xt&&ll(s),Dx(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Xt=iw(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Xt=iw(s)}else l===27?(l=Xt,xl(s.type)?(s=sy,sy=null,Xt=s):Xt=l):Xt=Fn?as(s.stateNode.nextSibling):null;return!0}function xo(){Xt=Fn=null,xt=!1}function zm(){var s=rl;return s!==null&&(Ai===null?Ai=s:Ai.push.apply(Ai,s),rl=null),s}function nu(s){rl===null?rl=[s]:rl.push(s)}var Im=M(null),So=null,yr=null;function ol(s,l,c){te(Im,l._currentValue),l._currentValue=c}function br(s){s._currentValue=Im.current,U(Im)}function Pm(s,l,c){for(;s!==null;){var h=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,h!==null&&(h.childLanes|=l)):h!==null&&(h.childLanes&l)!==l&&(h.childLanes|=l),s===c)break;s=s.return}}function Hm(s,l,c,h){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var y=m.dependencies;if(y!==null){var C=m.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=m;for(var I=0;I<l.length;I++)if(O.context===l[I]){y.lanes|=c,O=y.alternate,O!==null&&(O.lanes|=c),Pm(y.return,c,s),h||(C=null);break e}y=O.next}}else if(m.tag===18){if(C=m.return,C===null)throw Error(i(341));C.lanes|=c,y=C.alternate,y!==null&&(y.lanes|=c),Pm(C,c,s),C=null}else C=m.child;if(C!==null)C.return=m;else for(C=m;C!==null;){if(C===s){C=null;break}if(m=C.sibling,m!==null){m.return=C.return,C=m;break}C=C.return}m=C}}function Oa(s,l,c,h){s=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 C=m.alternate;if(C===null)throw Error(i(387));if(C=C.memoizedProps,C!==null){var O=m.type;Ii(m.pendingProps.value,C.value)||(s!==null?s.push(O):s=[O])}}else if(m===he.current){if(C=m.alternate,C===null)throw Error(i(387));C.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Ou):s=[Ou])}m=m.return}s!==null&&Hm(l,s,c,h),l.flags|=262144}function ah(s){for(s=s.firstContext;s!==null;){if(!Ii(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function wo(s){So=s,yr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Gn(s){return jx(So,s)}function ch(s,l){return So===null&&wo(s),jx(s,l)}function jx(s,l){var c=l._currentValue;if(l={context:l,memoizedValue:c,next:null},yr===null){if(s===null)throw Error(i(308));yr=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else yr=yr.next=l;return c}var QO=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(c,h){s.push(h)}};this.abort=function(){l.aborted=!0,s.forEach(function(c){return c()})}},KO=n.unstable_scheduleCallback,YO=n.unstable_NormalPriority,Cn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vm(){return{controller:new QO,data:new Map,refCount:0}}function iu(s){s.refCount--,s.refCount===0&&KO(YO,function(){s.controller.abort()})}var su=null,_m=0,Ma=0,Na=null;function WO(s,l){if(su===null){var c=su=[];_m=0,Ma=Fg(),Na={status:"pending",value:void 0,then:function(h){c.push(h)}}}return _m++,l.then(Bx,Bx),l}function Bx(){if(--_m===0&&su!==null){Na!==null&&(Na.status="fulfilled");var s=su;su=null,Ma=0,Na=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function XO(s,l){var c=[],h={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return s.then(function(){h.status="fulfilled",h.value=l;for(var m=0;m<c.length;m++)(0,c[m])(l)},function(m){for(h.status="rejected",h.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),h}var Lx=z.S;z.S=function(s,l){bS=Ae(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&WO(s,l),Lx!==null&&Lx(s,l)};var Co=M(null);function Um(){var s=Co.current;return s!==null?s:qt.pooledCache}function uh(s,l){l===null?te(Co,Co.current):te(Co,l.pool)}function zx(){var s=Um();return s===null?null:{parent:Cn._currentValue,pool:s}}var Da=Error(i(460)),qm=Error(i(474)),fh=Error(i(542)),hh={then:function(){}};function Ix(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Px(s,l,c){switch(c=s[c],c===void 0?s.push(l):c!==l&&(l.then(xs,xs),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,Vx(s),s;default:if(typeof l.status=="string")l.then(xs,xs);else{if(s=qt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=l,s.status="pending",s.then(function(h){if(l.status==="pending"){var m=l;m.status="fulfilled",m.value=h}},function(h){if(l.status==="pending"){var m=l;m.status="rejected",m.reason=h}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,Vx(s),s}throw Ao=l,Da}}function ko(s){try{var l=s._init;return l(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ao=c,Da):c}}var Ao=null;function Hx(){if(Ao===null)throw Error(i(459));var s=Ao;return Ao=null,s}function Vx(s){if(s===Da||s===fh)throw Error(i(483))}var ja=null,ru=0;function dh(s){var l=ru;return ru+=1,ja===null&&(ja=[]),Px(ja,s,l)}function lu(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function ph(s,l){throw l.$$typeof===b?Error(i(525)):(s=Object.prototype.toString.call(l),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function _x(s){function l(q,_){if(s){var Y=q.deletions;Y===null?(q.deletions=[_],q.flags|=16):Y.push(_)}}function c(q,_){if(!s)return null;for(;_!==null;)l(q,_),_=_.sibling;return null}function h(q){for(var _=new Map;q!==null;)q.key!==null?_.set(q.key,q):_.set(q.index,q),q=q.sibling;return _}function m(q,_){return q=mr(q,_),q.index=0,q.sibling=null,q}function y(q,_,Y){return q.index=Y,s?(Y=q.alternate,Y!==null?(Y=Y.index,Y<_?(q.flags|=67108866,_):Y):(q.flags|=67108866,_)):(q.flags|=1048576,_)}function C(q){return s&&q.alternate===null&&(q.flags|=67108866),q}function O(q,_,Y,ce){return _===null||_.tag!==6?(_=Nm(Y,q.mode,ce),_.return=q,_):(_=m(_,Y),_.return=q,_)}function I(q,_,Y,ce){var Xe=Y.type;return Xe===w?oe(q,_,Y.props.children,ce,Y.key):_!==null&&(_.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===j&&ko(Xe)===_.type)?(_=m(_,Y.props),lu(_,Y),_.return=q,_):(_=lh(Y.type,Y.key,Y.props,null,q.mode,ce),lu(_,Y),_.return=q,_)}function W(q,_,Y,ce){return _===null||_.tag!==4||_.stateNode.containerInfo!==Y.containerInfo||_.stateNode.implementation!==Y.implementation?(_=Dm(Y,q.mode,ce),_.return=q,_):(_=m(_,Y.children||[]),_.return=q,_)}function oe(q,_,Y,ce,Xe){return _===null||_.tag!==7?(_=vo(Y,q.mode,ce,Xe),_.return=q,_):(_=m(_,Y),_.return=q,_)}function ue(q,_,Y){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=Nm(""+_,q.mode,Y),_.return=q,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case v:return Y=lh(_.type,_.key,_.props,null,q.mode,Y),lu(Y,_),Y.return=q,Y;case S:return _=Dm(_,q.mode,Y),_.return=q,_;case j:return _=ko(_),ue(q,_,Y)}if(H(_)||K(_))return _=vo(_,q.mode,Y,null),_.return=q,_;if(typeof _.then=="function")return ue(q,dh(_),Y);if(_.$$typeof===N)return ue(q,ch(q,_),Y);ph(q,_)}return null}function Z(q,_,Y,ce){var Xe=_!==null?_.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Xe!==null?null:O(q,_,""+Y,ce);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:return Y.key===Xe?I(q,_,Y,ce):null;case S:return Y.key===Xe?W(q,_,Y,ce):null;case j:return Y=ko(Y),Z(q,_,Y,ce)}if(H(Y)||K(Y))return Xe!==null?null:oe(q,_,Y,ce,null);if(typeof Y.then=="function")return Z(q,_,dh(Y),ce);if(Y.$$typeof===N)return Z(q,_,ch(q,Y),ce);ph(q,Y)}return null}function re(q,_,Y,ce,Xe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return q=q.get(Y)||null,O(_,q,""+ce,Xe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return q=q.get(ce.key===null?Y:ce.key)||null,I(_,q,ce,Xe);case S:return q=q.get(ce.key===null?Y:ce.key)||null,W(_,q,ce,Xe);case j:return ce=ko(ce),re(q,_,Y,ce,Xe)}if(H(ce)||K(ce))return q=q.get(Y)||null,oe(_,q,ce,Xe,null);if(typeof ce.then=="function")return re(q,_,Y,dh(ce),Xe);if(ce.$$typeof===N)return re(q,_,Y,ch(_,ce),Xe);ph(_,ce)}return null}function Pe(q,_,Y,ce){for(var Xe=null,Rt=null,Fe=_,ut=_=0,vt=null;Fe!==null&&ut<Y.length;ut++){Fe.index>ut?(vt=Fe,Fe=null):vt=Fe.sibling;var Tt=Z(q,Fe,Y[ut],ce);if(Tt===null){Fe===null&&(Fe=vt);break}s&&Fe&&Tt.alternate===null&&l(q,Fe),_=y(Tt,_,ut),Rt===null?Xe=Tt:Rt.sibling=Tt,Rt=Tt,Fe=vt}if(ut===Y.length)return c(q,Fe),xt&&gr(q,ut),Xe;if(Fe===null){for(;ut<Y.length;ut++)Fe=ue(q,Y[ut],ce),Fe!==null&&(_=y(Fe,_,ut),Rt===null?Xe=Fe:Rt.sibling=Fe,Rt=Fe);return xt&&gr(q,ut),Xe}for(Fe=h(Fe);ut<Y.length;ut++)vt=re(Fe,q,ut,Y[ut],ce),vt!==null&&(s&&vt.alternate!==null&&Fe.delete(vt.key===null?ut:vt.key),_=y(vt,_,ut),Rt===null?Xe=vt:Rt.sibling=vt,Rt=vt);return s&&Fe.forEach(function(Al){return l(q,Al)}),xt&&gr(q,ut),Xe}function $e(q,_,Y,ce){if(Y==null)throw Error(i(151));for(var Xe=null,Rt=null,Fe=_,ut=_=0,vt=null,Tt=Y.next();Fe!==null&&!Tt.done;ut++,Tt=Y.next()){Fe.index>ut?(vt=Fe,Fe=null):vt=Fe.sibling;var Al=Z(q,Fe,Tt.value,ce);if(Al===null){Fe===null&&(Fe=vt);break}s&&Fe&&Al.alternate===null&&l(q,Fe),_=y(Al,_,ut),Rt===null?Xe=Al:Rt.sibling=Al,Rt=Al,Fe=vt}if(Tt.done)return c(q,Fe),xt&&gr(q,ut),Xe;if(Fe===null){for(;!Tt.done;ut++,Tt=Y.next())Tt=ue(q,Tt.value,ce),Tt!==null&&(_=y(Tt,_,ut),Rt===null?Xe=Tt:Rt.sibling=Tt,Rt=Tt);return xt&&gr(q,ut),Xe}for(Fe=h(Fe);!Tt.done;ut++,Tt=Y.next())Tt=re(Fe,q,ut,Tt.value,ce),Tt!==null&&(s&&Tt.alternate!==null&&Fe.delete(Tt.key===null?ut:Tt.key),_=y(Tt,_,ut),Rt===null?Xe=Tt:Rt.sibling=Tt,Rt=Tt);return s&&Fe.forEach(function(oN){return l(q,oN)}),xt&&gr(q,ut),Xe}function _t(q,_,Y,ce){if(typeof Y=="object"&&Y!==null&&Y.type===w&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:e:{for(var Xe=Y.key;_!==null;){if(_.key===Xe){if(Xe=Y.type,Xe===w){if(_.tag===7){c(q,_.sibling),ce=m(_,Y.props.children),ce.return=q,q=ce;break e}}else if(_.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===j&&ko(Xe)===_.type){c(q,_.sibling),ce=m(_,Y.props),lu(ce,Y),ce.return=q,q=ce;break e}c(q,_);break}else l(q,_);_=_.sibling}Y.type===w?(ce=vo(Y.props.children,q.mode,ce,Y.key),ce.return=q,q=ce):(ce=lh(Y.type,Y.key,Y.props,null,q.mode,ce),lu(ce,Y),ce.return=q,q=ce)}return C(q);case S:e:{for(Xe=Y.key;_!==null;){if(_.key===Xe)if(_.tag===4&&_.stateNode.containerInfo===Y.containerInfo&&_.stateNode.implementation===Y.implementation){c(q,_.sibling),ce=m(_,Y.children||[]),ce.return=q,q=ce;break e}else{c(q,_);break}else l(q,_);_=_.sibling}ce=Dm(Y,q.mode,ce),ce.return=q,q=ce}return C(q);case j:return Y=ko(Y),_t(q,_,Y,ce)}if(H(Y))return Pe(q,_,Y,ce);if(K(Y)){if(Xe=K(Y),typeof Xe!="function")throw Error(i(150));return Y=Xe.call(Y),$e(q,_,Y,ce)}if(typeof Y.then=="function")return _t(q,_,dh(Y),ce);if(Y.$$typeof===N)return _t(q,_,ch(q,Y),ce);ph(q,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,_!==null&&_.tag===6?(c(q,_.sibling),ce=m(_,Y),ce.return=q,q=ce):(c(q,_),ce=Nm(Y,q.mode,ce),ce.return=q,q=ce),C(q)):c(q,_)}return function(q,_,Y,ce){try{ru=0;var Xe=_t(q,_,Y,ce);return ja=null,Xe}catch(Fe){if(Fe===Da||Fe===fh)throw Fe;var Rt=Pi(29,Fe,null,q.mode);return Rt.lanes=ce,Rt.return=q,Rt}finally{}}}var Eo=_x(!0),Ux=_x(!1),al=!1;function Fm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gm(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function cl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ul(s,l,c){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(Nt&2)!==0){var m=h.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),h.pending=l,l=rh(s),Ax(s,null,c),l}return sh(s,h,l,c),rh(s)}function ou(s,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194048)!==0)){var h=l.lanes;h&=s.pendingLanes,c|=h,l.lanes=c,ts(s,c)}}function Qm(s,l){var c=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var m=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var C={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?m=y=C:y=y.next=C,c=c.next}while(c!==null);y===null?m=y=l:y=y.next=l}else m=y=l;c={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:h.shared,callbacks:h.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=l}var Km=!1;function au(){if(Km){var s=Na;if(s!==null)throw s}}function cu(s,l,c,h){Km=!1;var m=s.updateQueue;al=!1;var y=m.firstBaseUpdate,C=m.lastBaseUpdate,O=m.shared.pending;if(O!==null){m.shared.pending=null;var I=O,W=I.next;I.next=null,C===null?y=W:C.next=W,C=I;var oe=s.alternate;oe!==null&&(oe=oe.updateQueue,O=oe.lastBaseUpdate,O!==C&&(O===null?oe.firstBaseUpdate=W:O.next=W,oe.lastBaseUpdate=I))}if(y!==null){var ue=m.baseState;C=0,oe=W=I=null,O=y;do{var Z=O.lane&-536870913,re=Z!==O.lane;if(re?(bt&Z)===Z:(h&Z)===Z){Z!==0&&Z===Ma&&(Km=!0),oe!==null&&(oe=oe.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Pe=s,$e=O;Z=l;var _t=c;switch($e.tag){case 1:if(Pe=$e.payload,typeof Pe=="function"){ue=Pe.call(_t,ue,Z);break e}ue=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=$e.payload,Z=typeof Pe=="function"?Pe.call(_t,ue,Z):Pe,Z==null)break e;ue=g({},ue,Z);break e;case 2:al=!0}}Z=O.callback,Z!==null&&(s.flags|=64,re&&(s.flags|=8192),re=m.callbacks,re===null?m.callbacks=[Z]:re.push(Z))}else re={lane:Z,tag:O.tag,payload:O.payload,callback:O.callback,next:null},oe===null?(W=oe=re,I=ue):oe=oe.next=re,C|=Z;if(O=O.next,O===null){if(O=m.shared.pending,O===null)break;re=O,O=re.next,re.next=null,m.lastBaseUpdate=re,m.shared.pending=null}}while(!0);oe===null&&(I=ue),m.baseState=I,m.firstBaseUpdate=W,m.lastBaseUpdate=oe,y===null&&(m.shared.lanes=0),ml|=C,s.lanes=C,s.memoizedState=ue}}function qx(s,l){if(typeof s!="function")throw Error(i(191,s));s.call(l)}function Fx(s,l){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)qx(c[s],l)}var Ba=M(null),mh=M(0);function Gx(s,l){s=Rr,te(mh,s),te(Ba,l),Rr=s|l.baseLanes}function Ym(){te(mh,Rr),te(Ba,Ba.current)}function Wm(){Rr=mh.current,U(Ba),U(mh)}var Hi=M(null),os=null;function fl(s){var l=s.alternate;te(mn,mn.current&1),te(Hi,s),os===null&&(l===null||Ba.current!==null||l.memoizedState!==null)&&(os=s)}function Xm(s){te(mn,mn.current),te(Hi,s),os===null&&(os=s)}function Qx(s){s.tag===22?(te(mn,mn.current),te(Hi,s),os===null&&(os=s)):hl()}function hl(){te(mn,mn.current),te(Hi,Hi.current)}function Vi(s){U(Hi),os===s&&(os=null),U(mn)}var mn=M(0);function gh(s){for(var l=s;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||ny(c)||iy(c)))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===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var vr=0,ct=null,Ht=null,kn=null,yh=!1,La=!1,Ro=!1,bh=0,uu=0,za=null,$O=0;function on(){throw Error(i(321))}function $m(s,l){if(l===null)return!1;for(var c=0;c<l.length&&c<s.length;c++)if(!Ii(s[c],l[c]))return!1;return!0}function Zm(s,l,c,h,m,y){return vr=y,ct=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,z.H=s===null||s.memoizedState===null?O1:dg,Ro=!1,y=c(h,m),Ro=!1,La&&(y=Yx(l,c,h,m)),Kx(s),y}function Kx(s){z.H=du;var l=Ht!==null&&Ht.next!==null;if(vr=0,kn=Ht=ct=null,yh=!1,uu=0,za=null,l)throw Error(i(300));s===null||An||(s=s.dependencies,s!==null&&ah(s)&&(An=!0))}function Yx(s,l,c,h){ct=s;var m=0;do{if(La&&(za=null),uu=0,La=!1,25<=m)throw Error(i(301));if(m+=1,kn=Ht=null,s.updateQueue!=null){var y=s.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}z.H=M1,y=l(c,h)}while(La);return y}function ZO(){var s=z.H,l=s.useState()[0];return l=typeof l.then=="function"?fu(l):l,s=s.useState()[0],(Ht!==null?Ht.memoizedState:null)!==s&&(ct.flags|=1024),l}function Jm(){var s=bh!==0;return bh=0,s}function eg(s,l,c){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~c}function tg(s){if(yh){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}yh=!1}vr=0,kn=Ht=ct=null,La=!1,uu=bh=0,za=null}function ui(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kn===null?ct.memoizedState=kn=s:kn=kn.next=s,kn}function gn(){if(Ht===null){var s=ct.alternate;s=s!==null?s.memoizedState:null}else s=Ht.next;var l=kn===null?ct.memoizedState:kn.next;if(l!==null)kn=l,Ht=s;else{if(s===null)throw ct.alternate===null?Error(i(467)):Error(i(310));Ht=s,s={memoizedState:Ht.memoizedState,baseState:Ht.baseState,baseQueue:Ht.baseQueue,queue:Ht.queue,next:null},kn===null?ct.memoizedState=kn=s:kn=kn.next=s}return kn}function vh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fu(s){var l=uu;return uu+=1,za===null&&(za=[]),s=Px(za,s,l),l=ct,(kn===null?l.memoizedState:kn.next)===null&&(l=l.alternate,z.H=l===null||l.memoizedState===null?O1:dg),s}function xh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return fu(s);if(s.$$typeof===N)return Gn(s)}throw Error(i(438,String(s)))}function ng(s){var l=null,c=ct.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var h=ct.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(l={data:h.data.map(function(m){return m.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=vh(),ct.updateQueue=c),c.memoCache=l,c=l.data[l.index],c===void 0)for(c=l.data[l.index]=Array(s),h=0;h<s;h++)c[h]=J;return l.index++,c}function xr(s,l){return typeof l=="function"?l(s):l}function Sh(s){var l=gn();return ig(l,Ht,s)}function ig(s,l,c){var h=s.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=c;var m=s.baseQueue,y=h.pending;if(y!==null){if(m!==null){var C=m.next;m.next=y.next,y.next=C}l.baseQueue=m=y,h.pending=null}if(y=s.baseState,m===null)s.memoizedState=y;else{l=m.next;var O=C=null,I=null,W=l,oe=!1;do{var ue=W.lane&-536870913;if(ue!==W.lane?(bt&ue)===ue:(vr&ue)===ue){var Z=W.revertLane;if(Z===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),ue===Ma&&(oe=!0);else if((vr&Z)===Z){W=W.next,Z===Ma&&(oe=!0);continue}else ue={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},I===null?(O=I=ue,C=y):I=I.next=ue,ct.lanes|=Z,ml|=Z;ue=W.action,Ro&&c(y,ue),y=W.hasEagerState?W.eagerState:c(y,ue)}else Z={lane:ue,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},I===null?(O=I=Z,C=y):I=I.next=Z,ct.lanes|=ue,ml|=ue;W=W.next}while(W!==null&&W!==l);if(I===null?C=y:I.next=O,!Ii(y,s.memoizedState)&&(An=!0,oe&&(c=Na,c!==null)))throw c;s.memoizedState=y,s.baseState=C,s.baseQueue=I,h.lastRenderedState=y}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function sg(s){var l=gn(),c=l.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var h=c.dispatch,m=c.pending,y=l.memoizedState;if(m!==null){c.pending=null;var C=m=m.next;do y=s(y,C.action),C=C.next;while(C!==m);Ii(y,l.memoizedState)||(An=!0),l.memoizedState=y,l.baseQueue===null&&(l.baseState=y),c.lastRenderedState=y}return[y,h]}function Wx(s,l,c){var h=ct,m=gn(),y=xt;if(y){if(c===void 0)throw Error(i(407));c=c()}else c=l();var C=!Ii((Ht||m).memoizedState,c);if(C&&(m.memoizedState=c,An=!0),m=m.queue,og(Zx.bind(null,h,m,s),[s]),m.getSnapshot!==l||C||kn!==null&&kn.memoizedState.tag&1){if(h.flags|=2048,Ia(9,{destroy:void 0},$x.bind(null,h,m,c,l),null),qt===null)throw Error(i(349));y||(vr&127)!==0||Xx(h,l,c)}return c}function Xx(s,l,c){s.flags|=16384,s={getSnapshot:l,value:c},l=ct.updateQueue,l===null?(l=vh(),ct.updateQueue=l,l.stores=[s]):(c=l.stores,c===null?l.stores=[s]:c.push(s))}function $x(s,l,c,h){l.value=c,l.getSnapshot=h,Jx(l)&&e1(s)}function Zx(s,l,c){return c(function(){Jx(l)&&e1(s)})}function Jx(s){var l=s.getSnapshot;s=s.value;try{var c=l();return!Ii(s,c)}catch{return!0}}function e1(s){var l=bo(s,2);l!==null&&Ei(l,s,2)}function rg(s){var l=ui();if(typeof s=="function"){var c=s;if(s=c(),Ro){Jt(!0);try{c()}finally{Jt(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:s},l}function t1(s,l,c,h){return s.baseState=c,ig(s,Ht,typeof h=="function"?h:xr)}function JO(s,l,c,h,m){if(kh(s))throw Error(i(485));if(s=l.action,s!==null){var y={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){y.listeners.push(C)}};z.T!==null?c(!0):y.isTransition=!1,h(y),c=l.pending,c===null?(y.next=l.pending=y,n1(l,y)):(y.next=c.next,l.pending=c.next=y)}}function n1(s,l){var c=l.action,h=l.payload,m=s.state;if(l.isTransition){var y=z.T,C={};z.T=C;try{var O=c(m,h),I=z.S;I!==null&&I(C,O),i1(s,l,O)}catch(W){lg(s,l,W)}finally{y!==null&&C.types!==null&&(y.types=C.types),z.T=y}}else try{y=c(m,h),i1(s,l,y)}catch(W){lg(s,l,W)}}function i1(s,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){s1(s,l,h)},function(h){return lg(s,l,h)}):s1(s,l,c)}function s1(s,l,c){l.status="fulfilled",l.value=c,r1(l),s.state=c,l=s.pending,l!==null&&(c=l.next,c===l?s.pending=null:(c=c.next,l.next=c,n1(s,c)))}function lg(s,l,c){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do l.status="rejected",l.reason=c,r1(l),l=l.next;while(l!==h)}s.action=null}function r1(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function l1(s,l){return l}function o1(s,l){if(xt){var c=qt.formState;if(c!==null){e:{var h=ct;if(xt){if(Xt){t:{for(var m=Xt,y=ls;m.nodeType!==8;){if(!y){m=null;break t}if(m=as(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){Xt=as(m.nextSibling),h=m.data==="F!";break e}}ll(h)}h=!1}h&&(l=c[0])}}return c=ui(),c.memoizedState=c.baseState=l,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:l1,lastRenderedState:l},c.queue=h,c=E1.bind(null,ct,h),h.dispatch=c,h=rg(!1),y=hg.bind(null,ct,!1,h.queue),h=ui(),m={state:l,dispatch:null,action:s,pending:null},h.queue=m,c=JO.bind(null,ct,m,y,c),m.dispatch=c,h.memoizedState=s,[l,c,!1]}function a1(s){var l=gn();return c1(l,Ht,s)}function c1(s,l,c){if(l=ig(s,l,l1)[0],s=Sh(xr)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var h=fu(l)}catch(C){throw C===Da?fh:C}else h=l;l=gn();var m=l.queue,y=m.dispatch;return c!==l.memoizedState&&(ct.flags|=2048,Ia(9,{destroy:void 0},eM.bind(null,m,c),null)),[h,y,s]}function eM(s,l){s.action=l}function u1(s){var l=gn(),c=Ht;if(c!==null)return c1(l,c,s);gn(),l=l.memoizedState,c=gn();var h=c.queue.dispatch;return c.memoizedState=s,[l,h,!1]}function Ia(s,l,c,h){return s={tag:s,create:c,deps:h,inst:l,next:null},l=ct.updateQueue,l===null&&(l=vh(),ct.updateQueue=l),c=l.lastEffect,c===null?l.lastEffect=s.next=s:(h=c.next,c.next=s,s.next=h,l.lastEffect=s),s}function f1(){return gn().memoizedState}function wh(s,l,c,h){var m=ui();ct.flags|=s,m.memoizedState=Ia(1|l,{destroy:void 0},c,h===void 0?null:h)}function Ch(s,l,c,h){var m=gn();h=h===void 0?null:h;var y=m.memoizedState.inst;Ht!==null&&h!==null&&$m(h,Ht.memoizedState.deps)?m.memoizedState=Ia(l,y,c,h):(ct.flags|=s,m.memoizedState=Ia(1|l,y,c,h))}function h1(s,l){wh(8390656,8,s,l)}function og(s,l){Ch(2048,8,s,l)}function tM(s){ct.flags|=4;var l=ct.updateQueue;if(l===null)l=vh(),ct.updateQueue=l,l.events=[s];else{var c=l.events;c===null?l.events=[s]:c.push(s)}}function d1(s){var l=gn().memoizedState;return tM({ref:l,nextImpl:s}),function(){if((Nt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function p1(s,l){return Ch(4,2,s,l)}function m1(s,l){return Ch(4,4,s,l)}function g1(s,l){if(typeof l=="function"){s=s();var c=l(s);return function(){typeof c=="function"?c():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function y1(s,l,c){c=c!=null?c.concat([s]):null,Ch(4,4,g1.bind(null,l,s),c)}function ag(){}function b1(s,l){var c=gn();l=l===void 0?null:l;var h=c.memoizedState;return l!==null&&$m(l,h[1])?h[0]:(c.memoizedState=[s,l],s)}function v1(s,l){var c=gn();l=l===void 0?null:l;var h=c.memoizedState;if(l!==null&&$m(l,h[1]))return h[0];if(h=s(),Ro){Jt(!0);try{s()}finally{Jt(!1)}}return c.memoizedState=[h,l],h}function cg(s,l,c){return c===void 0||(vr&1073741824)!==0&&(bt&261930)===0?s.memoizedState=l:(s.memoizedState=c,s=xS(),ct.lanes|=s,ml|=s,c)}function x1(s,l,c,h){return Ii(c,l)?c:Ba.current!==null?(s=cg(s,c,h),Ii(s,l)||(An=!0),s):(vr&42)===0||(vr&1073741824)!==0&&(bt&261930)===0?(An=!0,s.memoizedState=c):(s=xS(),ct.lanes|=s,ml|=s,l)}function S1(s,l,c,h,m){var y=Q.p;Q.p=y!==0&&8>y?y:8;var C=z.T,O={};z.T=O,hg(s,!1,l,c);try{var I=m(),W=z.S;if(W!==null&&W(O,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var oe=XO(I,h);hu(s,l,oe,qi(s))}else hu(s,l,h,qi(s))}catch(ue){hu(s,l,{then:function(){},status:"rejected",reason:ue},qi())}finally{Q.p=y,C!==null&&O.types!==null&&(C.types=O.types),z.T=C}}function nM(){}function ug(s,l,c,h){if(s.tag!==5)throw Error(i(476));var m=w1(s).queue;S1(s,m,l,F,c===null?nM:function(){return C1(s),c(h)})}function w1(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:F},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:c},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function C1(s){var l=w1(s);l.next===null&&(l=s.alternate.memoizedState),hu(s,l.next.queue,{},qi())}function fg(){return Gn(Ou)}function k1(){return gn().memoizedState}function A1(){return gn().memoizedState}function iM(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var c=qi();s=cl(c);var h=ul(l,s,c);h!==null&&(Ei(h,l,c),ou(h,l,c)),l={cache:Vm()},s.payload=l;return}l=l.return}}function sM(s,l,c){var h=qi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},kh(s)?R1(l,c):(c=Om(s,l,c,h),c!==null&&(Ei(c,s,h),T1(c,l,h)))}function E1(s,l,c){var h=qi();hu(s,l,c,h)}function hu(s,l,c,h){var m={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(kh(s))R1(l,m);else{var y=s.alternate;if(s.lanes===0&&(y===null||y.lanes===0)&&(y=l.lastRenderedReducer,y!==null))try{var C=l.lastRenderedState,O=y(C,c);if(m.hasEagerState=!0,m.eagerState=O,Ii(O,C))return sh(s,l,m,0),qt===null&&ih(),!1}catch{}finally{}if(c=Om(s,l,m,h),c!==null)return Ei(c,s,h),T1(c,l,h),!0}return!1}function hg(s,l,c,h){if(h={lane:2,revertLane:Fg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},kh(s)){if(l)throw Error(i(479))}else l=Om(s,c,h,2),l!==null&&Ei(l,s,2)}function kh(s){var l=s.alternate;return s===ct||l!==null&&l===ct}function R1(s,l){La=yh=!0;var c=s.pending;c===null?l.next=l:(l.next=c.next,c.next=l),s.pending=l}function T1(s,l,c){if((c&4194048)!==0){var h=l.lanes;h&=s.pendingLanes,c|=h,l.lanes=c,ts(s,c)}}var du={readContext:Gn,use:xh,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on};du.useEffectEvent=on;var O1={readContext:Gn,use:xh,useCallback:function(s,l){return ui().memoizedState=[s,l===void 0?null:l],s},useContext:Gn,useEffect:h1,useImperativeHandle:function(s,l,c){c=c!=null?c.concat([s]):null,wh(4194308,4,g1.bind(null,l,s),c)},useLayoutEffect:function(s,l){return wh(4194308,4,s,l)},useInsertionEffect:function(s,l){wh(4,2,s,l)},useMemo:function(s,l){var c=ui();l=l===void 0?null:l;var h=s();if(Ro){Jt(!0);try{s()}finally{Jt(!1)}}return c.memoizedState=[h,l],h},useReducer:function(s,l,c){var h=ui();if(c!==void 0){var m=c(l);if(Ro){Jt(!0);try{c(l)}finally{Jt(!1)}}}else m=l;return h.memoizedState=h.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},h.queue=s,s=s.dispatch=sM.bind(null,ct,s),[h.memoizedState,s]},useRef:function(s){var l=ui();return s={current:s},l.memoizedState=s},useState:function(s){s=rg(s);var l=s.queue,c=E1.bind(null,ct,l);return l.dispatch=c,[s.memoizedState,c]},useDebugValue:ag,useDeferredValue:function(s,l){var c=ui();return cg(c,s,l)},useTransition:function(){var s=rg(!1);return s=S1.bind(null,ct,s.queue,!0,!1),ui().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,c){var h=ct,m=ui();if(xt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=l(),qt===null)throw Error(i(349));(bt&127)!==0||Xx(h,l,c)}m.memoizedState=c;var y={value:c,getSnapshot:l};return m.queue=y,h1(Zx.bind(null,h,y,s),[s]),h.flags|=2048,Ia(9,{destroy:void 0},$x.bind(null,h,y,c,l),null),c},useId:function(){var s=ui(),l=qt.identifierPrefix;if(xt){var c=_s,h=Vs;c=(h&~(1<<32-Pt(h)-1)).toString(32)+c,l="_"+l+"R_"+c,c=bh++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=$O++,l="_"+l+"r_"+c.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:fg,useFormState:o1,useActionState:o1,useOptimistic:function(s){var l=ui();l.memoizedState=l.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=hg.bind(null,ct,!0,c),c.dispatch=l,[s,l]},useMemoCache:ng,useCacheRefresh:function(){return ui().memoizedState=iM.bind(null,ct)},useEffectEvent:function(s){var l=ui(),c={impl:s};return l.memoizedState=c,function(){if((Nt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},dg={readContext:Gn,use:xh,useCallback:b1,useContext:Gn,useEffect:og,useImperativeHandle:y1,useInsertionEffect:p1,useLayoutEffect:m1,useMemo:v1,useReducer:Sh,useRef:f1,useState:function(){return Sh(xr)},useDebugValue:ag,useDeferredValue:function(s,l){var c=gn();return x1(c,Ht.memoizedState,s,l)},useTransition:function(){var s=Sh(xr)[0],l=gn().memoizedState;return[typeof s=="boolean"?s:fu(s),l]},useSyncExternalStore:Wx,useId:k1,useHostTransitionStatus:fg,useFormState:a1,useActionState:a1,useOptimistic:function(s,l){var c=gn();return t1(c,Ht,s,l)},useMemoCache:ng,useCacheRefresh:A1};dg.useEffectEvent=d1;var M1={readContext:Gn,use:xh,useCallback:b1,useContext:Gn,useEffect:og,useImperativeHandle:y1,useInsertionEffect:p1,useLayoutEffect:m1,useMemo:v1,useReducer:sg,useRef:f1,useState:function(){return sg(xr)},useDebugValue:ag,useDeferredValue:function(s,l){var c=gn();return Ht===null?cg(c,s,l):x1(c,Ht.memoizedState,s,l)},useTransition:function(){var s=sg(xr)[0],l=gn().memoizedState;return[typeof s=="boolean"?s:fu(s),l]},useSyncExternalStore:Wx,useId:k1,useHostTransitionStatus:fg,useFormState:u1,useActionState:u1,useOptimistic:function(s,l){var c=gn();return Ht!==null?t1(c,Ht,s,l):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:ng,useCacheRefresh:A1};M1.useEffectEvent=d1;function pg(s,l,c,h){l=s.memoizedState,c=c(h,l),c=c==null?l:g({},l,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var mg={enqueueSetState:function(s,l,c){s=s._reactInternals;var h=qi(),m=cl(h);m.payload=l,c!=null&&(m.callback=c),l=ul(s,m,h),l!==null&&(Ei(l,s,h),ou(l,s,h))},enqueueReplaceState:function(s,l,c){s=s._reactInternals;var h=qi(),m=cl(h);m.tag=1,m.payload=l,c!=null&&(m.callback=c),l=ul(s,m,h),l!==null&&(Ei(l,s,h),ou(l,s,h))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var c=qi(),h=cl(c);h.tag=2,l!=null&&(h.callback=l),l=ul(s,h,c),l!==null&&(Ei(l,s,c),ou(l,s,c))}};function N1(s,l,c,h,m,y,C){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,y,C):l.prototype&&l.prototype.isPureReactComponent?!Jc(c,h)||!Jc(m,y):!0}function D1(s,l,c,h){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,h),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,h),l.state!==s&&mg.enqueueReplaceState(l,l.state,null)}function To(s,l){var c=l;if("ref"in l){c={};for(var h in l)h!=="ref"&&(c[h]=l[h])}if(s=s.defaultProps){c===l&&(c=g({},c));for(var m in s)c[m]===void 0&&(c[m]=s[m])}return c}function j1(s){nh(s)}function B1(s){console.error(s)}function L1(s){nh(s)}function Ah(s,l){try{var c=s.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(h){setTimeout(function(){throw h})}}function z1(s,l,c){try{var h=s.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function gg(s,l,c){return c=cl(c),c.tag=3,c.payload={element:null},c.callback=function(){Ah(s,l)},c}function I1(s){return s=cl(s),s.tag=3,s}function P1(s,l,c,h){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var y=h.value;s.payload=function(){return m(y)},s.callback=function(){z1(l,c,h)}}var C=c.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(s.callback=function(){z1(l,c,h),typeof m!="function"&&(gl===null?gl=new Set([this]):gl.add(this));var O=h.stack;this.componentDidCatch(h.value,{componentStack:O!==null?O:""})})}function rM(s,l,c,h,m){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(l=c.alternate,l!==null&&Oa(l,c,m,!0),c=Hi.current,c!==null){switch(c.tag){case 31:case 13:return os===null?Ih():c.alternate===null&&an===0&&(an=3),c.flags&=-257,c.flags|=65536,c.lanes=m,h===hh?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([h]):l.add(h),_g(s,h,m)),!1;case 22:return c.flags|=65536,h===hh?c.flags|=16384:(l=c.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=l):(c=l.retryQueue,c===null?l.retryQueue=new Set([h]):c.add(h)),_g(s,h,m)),!1}throw Error(i(435,c.tag))}return _g(s,h,m),Ih(),!1}if(xt)return l=Hi.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,h!==Lm&&(s=Error(i(422),{cause:h}),nu(is(s,c)))):(h!==Lm&&(l=Error(i(423),{cause:h}),nu(is(l,c))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=is(h,c),m=gg(s.stateNode,h,m),Qm(s,m),an!==4&&(an=2)),!1;var y=Error(i(520),{cause:h});if(y=is(y,c),Su===null?Su=[y]:Su.push(y),an!==4&&(an=2),l===null)return!0;h=is(h,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,s=m&-m,c.lanes|=s,s=gg(c.stateNode,h,s),Qm(c,s),!1;case 1:if(l=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(gl===null||!gl.has(y))))return c.flags|=65536,m&=-m,c.lanes|=m,m=I1(m),P1(m,s,c,h),Qm(c,m),!1}c=c.return}while(c!==null);return!1}var yg=Error(i(461)),An=!1;function Qn(s,l,c,h){l.child=s===null?Ux(l,null,c,h):Eo(l,s.child,c,h)}function H1(s,l,c,h,m){c=c.render;var y=l.ref;if("ref"in h){var C={};for(var O in h)O!=="ref"&&(C[O]=h[O])}else C=h;return wo(l),h=Zm(s,l,c,C,y,m),O=Jm(),s!==null&&!An?(eg(s,l,m),Sr(s,l,m)):(xt&&O&&jm(l),l.flags|=1,Qn(s,l,h,m),l.child)}function V1(s,l,c,h,m){if(s===null){var y=c.type;return typeof y=="function"&&!Mm(y)&&y.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=y,_1(s,l,y,h,m)):(s=lh(c.type,null,h,l,l.mode,m),s.ref=l.ref,s.return=l,l.child=s)}if(y=s.child,!Ag(s,m)){var C=y.memoizedProps;if(c=c.compare,c=c!==null?c:Jc,c(C,h)&&s.ref===l.ref)return Sr(s,l,m)}return l.flags|=1,s=mr(y,h),s.ref=l.ref,s.return=l,l.child=s}function _1(s,l,c,h,m){if(s!==null){var y=s.memoizedProps;if(Jc(y,h)&&s.ref===l.ref)if(An=!1,l.pendingProps=h=y,Ag(s,m))(s.flags&131072)!==0&&(An=!0);else return l.lanes=s.lanes,Sr(s,l,m)}return bg(s,l,c,h,m)}function U1(s,l,c,h){var m=h.children,y=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((l.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,s!==null){for(h=l.child=s.child,m=0;h!==null;)m=m|h.lanes|h.childLanes,h=h.sibling;h=m&~y}else h=0,l.child=null;return q1(s,l,y,c,h)}if((c&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&uh(l,y!==null?y.cachePool:null),y!==null?Gx(l,y):Ym(),Qx(l);else return h=l.lanes=536870912,q1(s,l,y!==null?y.baseLanes|c:c,c,h)}else y!==null?(uh(l,y.cachePool),Gx(l,y),hl(),l.memoizedState=null):(s!==null&&uh(l,null),Ym(),hl());return Qn(s,l,m,c),l.child}function pu(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function q1(s,l,c,h,m){var y=Um();return y=y===null?null:{parent:Cn._currentValue,pool:y},l.memoizedState={baseLanes:c,cachePool:y},s!==null&&uh(l,null),Ym(),Qx(l),s!==null&&Oa(s,l,h,!0),l.childLanes=m,null}function Eh(s,l){return l=Th({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function F1(s,l,c){return Eo(l,s.child,null,c),s=Eh(l,l.pendingProps),s.flags|=2,Vi(l),l.memoizedState=null,s}function lM(s,l,c){var h=l.pendingProps,m=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(xt){if(h.mode==="hidden")return s=Eh(l,h),l.lanes=536870912,pu(null,s);if(Xm(l),(s=Xt)?(s=nw(s,ls),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:sl!==null?{id:Vs,overflow:_s}:null,retryLane:536870912,hydrationErrors:null},c=Rx(s),c.return=l,l.child=c,Fn=l,Xt=null)):s=null,s===null)throw ll(l);return l.lanes=536870912,null}return Eh(l,h)}var y=s.memoizedState;if(y!==null){var C=y.dehydrated;if(Xm(l),m)if(l.flags&256)l.flags&=-257,l=F1(s,l,c);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(i(558));else if(An||Oa(s,l,c,!1),m=(c&s.childLanes)!==0,An||m){if(h=qt,h!==null&&(C=ur(h,c),C!==0&&C!==y.retryLane))throw y.retryLane=C,bo(s,C),Ei(h,s,C),yg;Ih(),l=F1(s,l,c)}else s=y.treeContext,Xt=as(C.nextSibling),Fn=l,xt=!0,rl=null,ls=!1,s!==null&&Mx(l,s),l=Eh(l,h),l.flags|=4096;return l}return s=mr(s.child,{mode:h.mode,children:h.children}),s.ref=l.ref,l.child=s,s.return=l,s}function Rh(s,l){var c=l.ref;if(c===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(l.flags|=4194816)}}function bg(s,l,c,h,m){return wo(l),c=Zm(s,l,c,h,void 0,m),h=Jm(),s!==null&&!An?(eg(s,l,m),Sr(s,l,m)):(xt&&h&&jm(l),l.flags|=1,Qn(s,l,c,m),l.child)}function G1(s,l,c,h,m,y){return wo(l),l.updateQueue=null,c=Yx(l,h,c,m),Kx(s),h=Jm(),s!==null&&!An?(eg(s,l,y),Sr(s,l,y)):(xt&&h&&jm(l),l.flags|=1,Qn(s,l,c,y),l.child)}function Q1(s,l,c,h,m){if(wo(l),l.stateNode===null){var y=Aa,C=c.contextType;typeof C=="object"&&C!==null&&(y=Gn(C)),y=new c(h,y),l.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=mg,l.stateNode=y,y._reactInternals=l,y=l.stateNode,y.props=h,y.state=l.memoizedState,y.refs={},Fm(l),C=c.contextType,y.context=typeof C=="object"&&C!==null?Gn(C):Aa,y.state=l.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(pg(l,c,C,h),y.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(C=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),C!==y.state&&mg.enqueueReplaceState(y,y.state,null),cu(l,h,y,m),au(),y.state=l.memoizedState),typeof y.componentDidMount=="function"&&(l.flags|=4194308),h=!0}else if(s===null){y=l.stateNode;var O=l.memoizedProps,I=To(c,O);y.props=I;var W=y.context,oe=c.contextType;C=Aa,typeof oe=="object"&&oe!==null&&(C=Gn(oe));var ue=c.getDerivedStateFromProps;oe=typeof ue=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=l.pendingProps!==O,oe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||W!==C)&&D1(l,y,h,C),al=!1;var Z=l.memoizedState;y.state=Z,cu(l,h,y,m),au(),W=l.memoizedState,O||Z!==W||al?(typeof ue=="function"&&(pg(l,c,ue,h),W=l.memoizedState),(I=al||N1(l,c,I,h,Z,W,C))?(oe||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=h,l.memoizedState=W),y.props=h,y.state=W,y.context=C,h=I):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),h=!1)}else{y=l.stateNode,Gm(s,l),C=l.memoizedProps,oe=To(c,C),y.props=oe,ue=l.pendingProps,Z=y.context,W=c.contextType,I=Aa,typeof W=="object"&&W!==null&&(I=Gn(W)),O=c.getDerivedStateFromProps,(W=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(C!==ue||Z!==I)&&D1(l,y,h,I),al=!1,Z=l.memoizedState,y.state=Z,cu(l,h,y,m),au();var re=l.memoizedState;C!==ue||Z!==re||al||s!==null&&s.dependencies!==null&&ah(s.dependencies)?(typeof O=="function"&&(pg(l,c,O,h),re=l.memoizedState),(oe=al||N1(l,c,oe,h,Z,re,I)||s!==null&&s.dependencies!==null&&ah(s.dependencies))?(W||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(h,re,I),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(h,re,I)),typeof y.componentDidUpdate=="function"&&(l.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof y.componentDidUpdate!="function"||C===s.memoizedProps&&Z===s.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&Z===s.memoizedState||(l.flags|=1024),l.memoizedProps=h,l.memoizedState=re),y.props=h,y.state=re,y.context=I,h=oe):(typeof y.componentDidUpdate!="function"||C===s.memoizedProps&&Z===s.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&Z===s.memoizedState||(l.flags|=1024),h=!1)}return y=h,Rh(s,l),h=(l.flags&128)!==0,y||h?(y=l.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:y.render(),l.flags|=1,s!==null&&h?(l.child=Eo(l,s.child,null,m),l.child=Eo(l,null,c,m)):Qn(s,l,c,m),l.memoizedState=y.state,s=l.child):s=Sr(s,l,m),s}function K1(s,l,c,h){return xo(),l.flags|=256,Qn(s,l,c,h),l.child}var vg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xg(s){return{baseLanes:s,cachePool:zx()}}function Sg(s,l,c){return s=s!==null?s.childLanes&~c:0,l&&(s|=Ui),s}function Y1(s,l,c){var h=l.pendingProps,m=!1,y=(l.flags&128)!==0,C;if((C=y)||(C=s!==null&&s.memoizedState===null?!1:(mn.current&2)!==0),C&&(m=!0,l.flags&=-129),C=(l.flags&32)!==0,l.flags&=-33,s===null){if(xt){if(m?fl(l):hl(),(s=Xt)?(s=nw(s,ls),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:sl!==null?{id:Vs,overflow:_s}:null,retryLane:536870912,hydrationErrors:null},c=Rx(s),c.return=l,l.child=c,Fn=l,Xt=null)):s=null,s===null)throw ll(l);return iy(s)?l.lanes=32:l.lanes=536870912,null}var O=h.children;return h=h.fallback,m?(hl(),m=l.mode,O=Th({mode:"hidden",children:O},m),h=vo(h,m,c,null),O.return=l,h.return=l,O.sibling=h,l.child=O,h=l.child,h.memoizedState=xg(c),h.childLanes=Sg(s,C,c),l.memoizedState=vg,pu(null,h)):(fl(l),wg(l,O))}var I=s.memoizedState;if(I!==null&&(O=I.dehydrated,O!==null)){if(y)l.flags&256?(fl(l),l.flags&=-257,l=Cg(s,l,c)):l.memoizedState!==null?(hl(),l.child=s.child,l.flags|=128,l=null):(hl(),O=h.fallback,m=l.mode,h=Th({mode:"visible",children:h.children},m),O=vo(O,m,c,null),O.flags|=2,h.return=l,O.return=l,h.sibling=O,l.child=h,Eo(l,s.child,null,c),h=l.child,h.memoizedState=xg(c),h.childLanes=Sg(s,C,c),l.memoizedState=vg,l=pu(null,h));else if(fl(l),iy(O)){if(C=O.nextSibling&&O.nextSibling.dataset,C)var W=C.dgst;C=W,h=Error(i(419)),h.stack="",h.digest=C,nu({value:h,source:null,stack:null}),l=Cg(s,l,c)}else if(An||Oa(s,l,c,!1),C=(c&s.childLanes)!==0,An||C){if(C=qt,C!==null&&(h=ur(C,c),h!==0&&h!==I.retryLane))throw I.retryLane=h,bo(s,h),Ei(C,s,h),yg;ny(O)||Ih(),l=Cg(s,l,c)}else ny(O)?(l.flags|=192,l.child=s.child,l=null):(s=I.treeContext,Xt=as(O.nextSibling),Fn=l,xt=!0,rl=null,ls=!1,s!==null&&Mx(l,s),l=wg(l,h.children),l.flags|=4096);return l}return m?(hl(),O=h.fallback,m=l.mode,I=s.child,W=I.sibling,h=mr(I,{mode:"hidden",children:h.children}),h.subtreeFlags=I.subtreeFlags&65011712,W!==null?O=mr(W,O):(O=vo(O,m,c,null),O.flags|=2),O.return=l,h.return=l,h.sibling=O,l.child=h,pu(null,h),h=l.child,O=s.child.memoizedState,O===null?O=xg(c):(m=O.cachePool,m!==null?(I=Cn._currentValue,m=m.parent!==I?{parent:I,pool:I}:m):m=zx(),O={baseLanes:O.baseLanes|c,cachePool:m}),h.memoizedState=O,h.childLanes=Sg(s,C,c),l.memoizedState=vg,pu(s.child,h)):(fl(l),c=s.child,s=c.sibling,c=mr(c,{mode:"visible",children:h.children}),c.return=l,c.sibling=null,s!==null&&(C=l.deletions,C===null?(l.deletions=[s],l.flags|=16):C.push(s)),l.child=c,l.memoizedState=null,c)}function wg(s,l){return l=Th({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Th(s,l){return s=Pi(22,s,null,l),s.lanes=0,s}function Cg(s,l,c){return Eo(l,s.child,null,c),s=wg(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function W1(s,l,c){s.lanes|=l;var h=s.alternate;h!==null&&(h.lanes|=l),Pm(s.return,l,c)}function kg(s,l,c,h,m,y){var C=s.memoizedState;C===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:m,treeForkCount:y}:(C.isBackwards=l,C.rendering=null,C.renderingStartTime=0,C.last=h,C.tail=c,C.tailMode=m,C.treeForkCount=y)}function X1(s,l,c){var h=l.pendingProps,m=h.revealOrder,y=h.tail;h=h.children;var C=mn.current,O=(C&2)!==0;if(O?(C=C&1|2,l.flags|=128):C&=1,te(mn,C),Qn(s,l,h,c),h=xt?tu:0,!O&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&W1(s,c,l);else if(s.tag===19)W1(s,c,l);else if(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}switch(m){case"forwards":for(c=l.child,m=null;c!==null;)s=c.alternate,s!==null&&gh(s)===null&&(m=c),c=c.sibling;c=m,c===null?(m=l.child,l.child=null):(m=c.sibling,c.sibling=null),kg(l,!1,m,c,y,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=l.child,l.child=null;m!==null;){if(s=m.alternate,s!==null&&gh(s)===null){l.child=m;break}s=m.sibling,m.sibling=c,c=m,m=s}kg(l,!0,c,null,y,h);break;case"together":kg(l,!1,null,null,void 0,h);break;default:l.memoizedState=null}return l.child}function Sr(s,l,c){if(s!==null&&(l.dependencies=s.dependencies),ml|=l.lanes,(c&l.childLanes)===0)if(s!==null){if(Oa(s,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(i(153));if(l.child!==null){for(s=l.child,c=mr(s,s.pendingProps),l.child=c,c.return=l;s.sibling!==null;)s=s.sibling,c=c.sibling=mr(s,s.pendingProps),c.return=l;c.sibling=null}return l.child}function Ag(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&ah(s)))}function oM(s,l,c){switch(l.tag){case 3:pe(l,l.stateNode.containerInfo),ol(l,Cn,s.memoizedState.cache),xo();break;case 27:case 5:fe(l);break;case 4:pe(l,l.stateNode.containerInfo);break;case 10:ol(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Xm(l),null;break;case 13:var h=l.memoizedState;if(h!==null)return h.dehydrated!==null?(fl(l),l.flags|=128,null):(c&l.child.childLanes)!==0?Y1(s,l,c):(fl(l),s=Sr(s,l,c),s!==null?s.sibling:null);fl(l);break;case 19:var m=(s.flags&128)!==0;if(h=(c&l.childLanes)!==0,h||(Oa(s,l,c,!1),h=(c&l.childLanes)!==0),m){if(h)return X1(s,l,c);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),te(mn,mn.current),h)break;return null;case 22:return l.lanes=0,U1(s,l,c,l.pendingProps);case 24:ol(l,Cn,s.memoizedState.cache)}return Sr(s,l,c)}function $1(s,l,c){if(s!==null)if(s.memoizedProps!==l.pendingProps)An=!0;else{if(!Ag(s,c)&&(l.flags&128)===0)return An=!1,oM(s,l,c);An=(s.flags&131072)!==0}else An=!1,xt&&(l.flags&1048576)!==0&&Ox(l,tu,l.index);switch(l.lanes=0,l.tag){case 16:e:{var h=l.pendingProps;if(s=ko(l.elementType),l.type=s,typeof s=="function")Mm(s)?(h=To(s,h),l.tag=1,l=Q1(null,l,s,h,c)):(l.tag=0,l=bg(null,l,s,h,c));else{if(s!=null){var m=s.$$typeof;if(m===T){l.tag=11,l=H1(null,l,s,h,c);break e}else if(m===D){l.tag=14,l=V1(null,l,s,h,c);break e}}throw l=$(s)||s,Error(i(306,l,""))}}return l;case 0:return bg(s,l,l.type,l.pendingProps,c);case 1:return h=l.type,m=To(h,l.pendingProps),Q1(s,l,h,m,c);case 3:e:{if(pe(l,l.stateNode.containerInfo),s===null)throw Error(i(387));h=l.pendingProps;var y=l.memoizedState;m=y.element,Gm(s,l),cu(l,h,null,c);var C=l.memoizedState;if(h=C.cache,ol(l,Cn,h),h!==y.cache&&Hm(l,[Cn],c,!0),au(),h=C.element,y.isDehydrated)if(y={element:h,isDehydrated:!1,cache:C.cache},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){l=K1(s,l,h,c);break e}else if(h!==m){m=is(Error(i(424)),l),nu(m),l=K1(s,l,h,c);break e}else{switch(s=l.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Xt=as(s.firstChild),Fn=l,xt=!0,rl=null,ls=!0,c=Ux(l,null,h,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(xo(),h===m){l=Sr(s,l,c);break e}Qn(s,l,h,c)}l=l.child}return l;case 26:return Rh(s,l),s===null?(c=aw(l.type,null,l.pendingProps,null))?l.memoizedState=c:xt||(c=l.type,s=l.pendingProps,h=Fh(se.current).createElement(c),h[Ut]=l,h[rn]=s,Kn(h,c,s),Ot(h),l.stateNode=h):l.memoizedState=aw(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return fe(l),s===null&&xt&&(h=l.stateNode=rw(l.type,l.pendingProps,se.current),Fn=l,ls=!0,m=Xt,xl(l.type)?(sy=m,Xt=as(h.firstChild)):Xt=m),Qn(s,l,l.pendingProps.children,c),Rh(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&xt&&((m=h=Xt)&&(h=IM(h,l.type,l.pendingProps,ls),h!==null?(l.stateNode=h,Fn=l,Xt=as(h.firstChild),ls=!1,m=!0):m=!1),m||ll(l)),fe(l),m=l.type,y=l.pendingProps,C=s!==null?s.memoizedProps:null,h=y.children,Jg(m,y)?h=null:C!==null&&Jg(m,C)&&(l.flags|=32),l.memoizedState!==null&&(m=Zm(s,l,ZO,null,null,c),Ou._currentValue=m),Rh(s,l),Qn(s,l,h,c),l.child;case 6:return s===null&&xt&&((s=c=Xt)&&(c=PM(c,l.pendingProps,ls),c!==null?(l.stateNode=c,Fn=l,Xt=null,s=!0):s=!1),s||ll(l)),null;case 13:return Y1(s,l,c);case 4:return pe(l,l.stateNode.containerInfo),h=l.pendingProps,s===null?l.child=Eo(l,null,h,c):Qn(s,l,h,c),l.child;case 11:return H1(s,l,l.type,l.pendingProps,c);case 7:return Qn(s,l,l.pendingProps,c),l.child;case 8:return Qn(s,l,l.pendingProps.children,c),l.child;case 12:return Qn(s,l,l.pendingProps.children,c),l.child;case 10:return h=l.pendingProps,ol(l,l.type,h.value),Qn(s,l,h.children,c),l.child;case 9:return m=l.type._context,h=l.pendingProps.children,wo(l),m=Gn(m),h=h(m),l.flags|=1,Qn(s,l,h,c),l.child;case 14:return V1(s,l,l.type,l.pendingProps,c);case 15:return _1(s,l,l.type,l.pendingProps,c);case 19:return X1(s,l,c);case 31:return lM(s,l,c);case 22:return U1(s,l,c,l.pendingProps);case 24:return wo(l),h=Gn(Cn),s===null?(m=Um(),m===null&&(m=qt,y=Vm(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=c),m=y),l.memoizedState={parent:h,cache:m},Fm(l),ol(l,Cn,m)):((s.lanes&c)!==0&&(Gm(s,l),cu(l,null,null,c),au()),m=s.memoizedState,y=l.memoizedState,m.parent!==h?(m={parent:h,cache:h},l.memoizedState=m,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=m),ol(l,Cn,h)):(h=y.cache,ol(l,Cn,h),h!==m.cache&&Hm(l,[Cn],c,!0))),Qn(s,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(i(156,l.tag))}function wr(s){s.flags|=4}function Eg(s,l,c,h,m){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(kS())s.flags|=8192;else throw Ao=hh,qm}else s.flags&=-16777217}function Z1(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!dw(l))if(kS())s.flags|=8192;else throw Ao=hh,qm}function Oh(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?Rn():536870912,s.lanes|=l,_a|=l)}function mu(s,l){if(!xt)switch(s.tailMode){case"hidden":l=s.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function $t(s){var l=s.alternate!==null&&s.alternate.child===s.child,c=0,h=0;if(l)for(var m=s.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags&65011712,h|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags,h|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=h,s.childLanes=c,l}function aM(s,l,c){var h=l.pendingProps;switch(Bm(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 c=l.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),br(Cn),xe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(Ta(l)?wr(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,zm())),$t(l),null;case 26:var m=l.type,y=l.memoizedState;return s===null?(wr(l),y!==null?($t(l),Z1(l,y)):($t(l),Eg(l,m,null,h,c))):y?y!==s.memoizedState?(wr(l),$t(l),Z1(l,y)):($t(l),l.flags&=-16777217):(s=s.memoizedProps,s!==h&&wr(l),$t(l),Eg(l,m,s,h,c)),null;case 27:if(ie(l),c=se.current,m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==h&&wr(l);else{if(!h){if(l.stateNode===null)throw Error(i(166));return $t(l),null}s=le.current,Ta(l)?Nx(l):(s=rw(m,h,c),l.stateNode=s,wr(l))}return $t(l),null;case 5:if(ie(l),m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==h&&wr(l);else{if(!h){if(l.stateNode===null)throw Error(i(166));return $t(l),null}if(y=le.current,Ta(l))Nx(l);else{var C=Fh(se.current);switch(y){case 1:y=C.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=C.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=C.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof h.is=="string"?C.createElement("select",{is:h.is}):C.createElement("select"),h.multiple?y.multiple=!0:h.size&&(y.size=h.size);break;default:y=typeof h.is=="string"?C.createElement(m,{is:h.is}):C.createElement(m)}}y[Ut]=l,y[rn]=h;e:for(C=l.child;C!==null;){if(C.tag===5||C.tag===6)y.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===l)break e;for(;C.sibling===null;){if(C.return===null||C.return===l)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}l.stateNode=y;e:switch(Kn(y,m,h),m){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&wr(l)}}return $t(l),Eg(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,c),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==h&&wr(l);else{if(typeof h!="string"&&l.stateNode===null)throw Error(i(166));if(s=se.current,Ta(l)){if(s=l.stateNode,c=l.memoizedProps,h=null,m=Fn,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[Ut]=l,s=!!(s.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||YS(s.nodeValue,c)),s||ll(l,!0)}else s=Fh(s).createTextNode(h),s[Ut]=l,l.stateNode=s}return $t(l),null;case 31:if(c=l.memoizedState,s===null||s.memoizedState!==null){if(h=Ta(l),c!==null){if(s===null){if(!h)throw Error(i(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[Ut]=l}else xo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;$t(l),s=!1}else c=zm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return l.flags&256?(Vi(l),l):(Vi(l),null);if((l.flags&128)!==0)throw Error(i(558))}return $t(l),null;case 13:if(h=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Ta(l),h!==null&&h.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Ut]=l}else xo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;$t(l),m=!1}else m=zm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(Vi(l),l):(Vi(l),null)}return Vi(l),(l.flags&128)!==0?(l.lanes=c,l):(c=h!==null,s=s!==null&&s.memoizedState!==null,c&&(h=l.child,m=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(m=h.alternate.memoizedState.cachePool.pool),y=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(y=h.memoizedState.cachePool.pool),y!==m&&(h.flags|=2048)),c!==s&&c&&(l.child.flags|=8192),Oh(l,l.updateQueue),$t(l),null);case 4:return xe(),s===null&&Yg(l.stateNode.containerInfo),$t(l),null;case 10:return br(l.type),$t(l),null;case 19:if(U(mn),h=l.memoizedState,h===null)return $t(l),null;if(m=(l.flags&128)!==0,y=h.rendering,y===null)if(m)mu(h,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(y=gh(s),y!==null){for(l.flags|=128,mu(h,!1),s=y.updateQueue,l.updateQueue=s,Oh(l,s),l.subtreeFlags=0,s=c,c=l.child;c!==null;)Ex(c,s),c=c.sibling;return te(mn,mn.current&1|2),xt&&gr(l,h.treeForkCount),l.child}s=s.sibling}h.tail!==null&&Ae()>Bh&&(l.flags|=128,m=!0,mu(h,!1),l.lanes=4194304)}else{if(!m)if(s=gh(y),s!==null){if(l.flags|=128,m=!0,s=s.updateQueue,l.updateQueue=s,Oh(l,s),mu(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!xt)return $t(l),null}else 2*Ae()-h.renderingStartTime>Bh&&c!==536870912&&(l.flags|=128,m=!0,mu(h,!1),l.lanes=4194304);h.isBackwards?(y.sibling=l.child,l.child=y):(s=h.last,s!==null?s.sibling=y:l.child=y,h.last=y)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=Ae(),s.sibling=null,c=mn.current,te(mn,m?c&1|2:c&1),xt&&gr(l,h.treeForkCount),s):($t(l),null);case 22:case 23:return Vi(l),Wm(),h=l.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(l.flags|=8192):h&&(l.flags|=8192),h?(c&536870912)!==0&&(l.flags&128)===0&&($t(l),l.subtreeFlags&6&&(l.flags|=8192)):$t(l),c=l.updateQueue,c!==null&&Oh(l,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==c&&(l.flags|=2048),s!==null&&U(Co),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),br(Cn),$t(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function cM(s,l){switch(Bm(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return br(Cn),xe(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return ie(l),null;case 31:if(l.memoizedState!==null){if(Vi(l),l.alternate===null)throw Error(i(340));xo()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(Vi(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(i(340));xo()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return U(mn),null;case 4:return xe(),null;case 10:return br(l.type),null;case 22:case 23:return Vi(l),Wm(),s!==null&&U(Co),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return br(Cn),null;case 25:return null;default:return null}}function J1(s,l){switch(Bm(l),l.tag){case 3:br(Cn),xe();break;case 26:case 27:case 5:ie(l);break;case 4:xe();break;case 31:l.memoizedState!==null&&Vi(l);break;case 13:Vi(l);break;case 19:U(mn);break;case 10:br(l.type);break;case 22:case 23:Vi(l),Wm(),s!==null&&U(Co);break;case 24:br(Cn)}}function gu(s,l){try{var c=l.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var m=h.next;c=m;do{if((c.tag&s)===s){h=void 0;var y=c.create,C=c.inst;h=y(),C.destroy=h}c=c.next}while(c!==m)}}catch(O){It(l,l.return,O)}}function dl(s,l,c){try{var h=l.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var y=m.next;h=y;do{if((h.tag&s)===s){var C=h.inst,O=C.destroy;if(O!==void 0){C.destroy=void 0,m=l;var I=c,W=O;try{W()}catch(oe){It(m,I,oe)}}}h=h.next}while(h!==y)}}catch(oe){It(l,l.return,oe)}}function eS(s){var l=s.updateQueue;if(l!==null){var c=s.stateNode;try{Fx(l,c)}catch(h){It(s,s.return,h)}}}function tS(s,l,c){c.props=To(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(h){It(s,l,h)}}function yu(s,l){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof c=="function"?s.refCleanup=c(h):c.current=h}}catch(m){It(s,l,m)}}function Us(s,l){var c=s.ref,h=s.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(m){It(s,l,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){It(s,l,m)}else c.current=null}function nS(s){var l=s.type,c=s.memoizedProps,h=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":c.autoFocus&&h.focus();break e;case"img":c.src?h.src=c.src:c.srcSet&&(h.srcset=c.srcSet)}}catch(m){It(s,s.return,m)}}function Rg(s,l,c){try{var h=s.stateNode;NM(h,s.type,c,l),h[rn]=l}catch(m){It(s,s.return,m)}}function iS(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&xl(s.type)||s.tag===4}function Tg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||iS(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&xl(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Og(s,l,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,l?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,l):(l=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,l.appendChild(s),c=c._reactRootContainer,c!=null||l.onclick!==null||(l.onclick=xs));else if(h!==4&&(h===27&&xl(s.type)&&(c=s.stateNode,l=null),s=s.child,s!==null))for(Og(s,l,c),s=s.sibling;s!==null;)Og(s,l,c),s=s.sibling}function Mh(s,l,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,l?c.insertBefore(s,l):c.appendChild(s);else if(h!==4&&(h===27&&xl(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Mh(s,l,c),s=s.sibling;s!==null;)Mh(s,l,c),s=s.sibling}function sS(s){var l=s.stateNode,c=s.memoizedProps;try{for(var h=s.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);Kn(l,h,c),l[Ut]=s,l[rn]=c}catch(y){It(s,s.return,y)}}var Cr=!1,En=!1,Mg=!1,rS=typeof WeakSet=="function"?WeakSet:Set,Pn=null;function uM(s,l){if(s=s.containerInfo,$g=$h,s=yx(s),Cm(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var m=h.anchorOffset,y=h.focusNode;h=h.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var C=0,O=-1,I=-1,W=0,oe=0,ue=s,Z=null;t:for(;;){for(var re;ue!==c||m!==0&&ue.nodeType!==3||(O=C+m),ue!==y||h!==0&&ue.nodeType!==3||(I=C+h),ue.nodeType===3&&(C+=ue.nodeValue.length),(re=ue.firstChild)!==null;)Z=ue,ue=re;for(;;){if(ue===s)break t;if(Z===c&&++W===m&&(O=C),Z===y&&++oe===h&&(I=C),(re=ue.nextSibling)!==null)break;ue=Z,Z=ue.parentNode}ue=re}c=O===-1||I===-1?null:{start:O,end:I}}else c=null}c=c||{start:0,end:0}}else c=null;for(Zg={focusedElem:s,selectionRange:c},$h=!1,Pn=l;Pn!==null;)if(l=Pn,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,Pn=s;else for(;Pn!==null;){switch(l=Pn,y=l.alternate,s=l.flags,l.tag){case 0:if((s&4)!==0&&(s=l.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)m=s[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&y!==null){s=void 0,c=l,m=y.memoizedProps,y=y.memoizedState,h=c.stateNode;try{var Pe=To(c.type,m);s=h.getSnapshotBeforeUpdate(Pe,y),h.__reactInternalSnapshotBeforeUpdate=s}catch($e){It(c,c.return,$e)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,c=s.nodeType,c===9)ty(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":ty(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=l.sibling,s!==null){s.return=l.return,Pn=s;break}Pn=l.return}}function lS(s,l,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:Ar(s,c),h&4&&gu(5,c);break;case 1:if(Ar(s,c),h&4)if(s=c.stateNode,l===null)try{s.componentDidMount()}catch(C){It(c,c.return,C)}else{var m=To(c.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(m,l,s.__reactInternalSnapshotBeforeUpdate)}catch(C){It(c,c.return,C)}}h&64&&eS(c),h&512&&yu(c,c.return);break;case 3:if(Ar(s,c),h&64&&(s=c.updateQueue,s!==null)){if(l=null,c.child!==null)switch(c.child.tag){case 27:case 5:l=c.child.stateNode;break;case 1:l=c.child.stateNode}try{Fx(s,l)}catch(C){It(c,c.return,C)}}break;case 27:l===null&&h&4&&sS(c);case 26:case 5:Ar(s,c),l===null&&h&4&&nS(c),h&512&&yu(c,c.return);break;case 12:Ar(s,c);break;case 31:Ar(s,c),h&4&&cS(s,c);break;case 13:Ar(s,c),h&4&&uS(s,c),h&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=vM.bind(null,c),HM(s,c))));break;case 22:if(h=c.memoizedState!==null||Cr,!h){l=l!==null&&l.memoizedState!==null||En,m=Cr;var y=En;Cr=h,(En=l)&&!y?Er(s,c,(c.subtreeFlags&8772)!==0):Ar(s,c),Cr=m,En=y}break;case 30:break;default:Ar(s,c)}}function oS(s){var l=s.alternate;l!==null&&(s.alternate=null,oS(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&ma(l)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var en=null,wi=!1;function kr(s,l,c){for(c=c.child;c!==null;)aS(s,l,c),c=c.sibling}function aS(s,l,c){if(Ue&&typeof Ue.onCommitFiberUnmount=="function")try{Ue.onCommitFiberUnmount(ht,c)}catch{}switch(c.tag){case 26:En||Us(c,l),kr(s,l,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:En||Us(c,l);var h=en,m=wi;xl(c.type)&&(en=c.stateNode,wi=!1),kr(s,l,c),Eu(c.stateNode),en=h,wi=m;break;case 5:En||Us(c,l);case 6:if(h=en,m=wi,en=null,kr(s,l,c),en=h,wi=m,en!==null)if(wi)try{(en.nodeType===9?en.body:en.nodeName==="HTML"?en.ownerDocument.body:en).removeChild(c.stateNode)}catch(y){It(c,l,y)}else try{en.removeChild(c.stateNode)}catch(y){It(c,l,y)}break;case 18:en!==null&&(wi?(s=en,ew(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Wa(s)):ew(en,c.stateNode));break;case 4:h=en,m=wi,en=c.stateNode.containerInfo,wi=!0,kr(s,l,c),en=h,wi=m;break;case 0:case 11:case 14:case 15:dl(2,c,l),En||dl(4,c,l),kr(s,l,c);break;case 1:En||(Us(c,l),h=c.stateNode,typeof h.componentWillUnmount=="function"&&tS(c,l,h)),kr(s,l,c);break;case 21:kr(s,l,c);break;case 22:En=(h=En)||c.memoizedState!==null,kr(s,l,c),En=h;break;default:kr(s,l,c)}}function cS(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Wa(s)}catch(c){It(l,l.return,c)}}}function uS(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Wa(s)}catch(c){It(l,l.return,c)}}function fM(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new rS),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new rS),l;default:throw Error(i(435,s.tag))}}function Nh(s,l){var c=fM(s);l.forEach(function(h){if(!c.has(h)){c.add(h);var m=xM.bind(null,s,h);h.then(m,m)}})}function Ci(s,l){var c=l.deletions;if(c!==null)for(var h=0;h<c.length;h++){var m=c[h],y=s,C=l,O=C;e:for(;O!==null;){switch(O.tag){case 27:if(xl(O.type)){en=O.stateNode,wi=!1;break e}break;case 5:en=O.stateNode,wi=!1;break e;case 3:case 4:en=O.stateNode.containerInfo,wi=!0;break e}O=O.return}if(en===null)throw Error(i(160));aS(y,C,m),en=null,wi=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)fS(l,s),l=l.sibling}var ws=null;function fS(s,l){var c=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Ci(l,s),ki(s),h&4&&(dl(3,s,s.return),gu(3,s),dl(5,s,s.return));break;case 1:Ci(l,s),ki(s),h&512&&(En||c===null||Us(c,c.return)),h&64&&Cr&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:var m=ws;if(Ci(l,s),ki(s),h&512&&(En||c===null||Us(c,c.return)),h&4){var y=c!==null?c.memoizedState:null;if(h=s.memoizedState,c===null)if(h===null)if(s.stateNode===null){e:{h=s.type,c=s.memoizedProps,m=m.ownerDocument||m;t:switch(h){case"title":y=m.getElementsByTagName("title")[0],(!y||y[hr]||y[Ut]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(h),m.head.insertBefore(y,m.querySelector("head > title"))),Kn(y,h,c),y[Ut]=s,Ot(y),h=y;break e;case"link":var C=fw("link","href",m).get(h+(c.href||""));if(C){for(var O=0;O<C.length;O++)if(y=C[O],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){C.splice(O,1);break t}}y=m.createElement(h),Kn(y,h,c),m.head.appendChild(y);break;case"meta":if(C=fw("meta","content",m).get(h+(c.content||""))){for(O=0;O<C.length;O++)if(y=C[O],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){C.splice(O,1);break t}}y=m.createElement(h),Kn(y,h,c),m.head.appendChild(y);break;default:throw Error(i(468,h))}y[Ut]=s,Ot(y),h=y}s.stateNode=h}else hw(m,s.type,s.stateNode);else s.stateNode=uw(m,h,s.memoizedProps);else y!==h?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,h===null?hw(m,s.type,s.stateNode):uw(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&Rg(s,s.memoizedProps,c.memoizedProps)}break;case 27:Ci(l,s),ki(s),h&512&&(En||c===null||Us(c,c.return)),c!==null&&h&4&&Rg(s,s.memoizedProps,c.memoizedProps);break;case 5:if(Ci(l,s),ki(s),h&512&&(En||c===null||Us(c,c.return)),s.flags&32){m=s.stateNode;try{Je(m,"")}catch(Pe){It(s,s.return,Pe)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,Rg(s,m,c!==null?c.memoizedProps:m)),h&1024&&(Mg=!0);break;case 6:if(Ci(l,s),ki(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,c=s.stateNode;try{c.nodeValue=h}catch(Pe){It(s,s.return,Pe)}}break;case 3:if(Kh=null,m=ws,ws=Gh(l.containerInfo),Ci(l,s),ws=m,ki(s),h&4&&c!==null&&c.memoizedState.isDehydrated)try{Wa(l.containerInfo)}catch(Pe){It(s,s.return,Pe)}Mg&&(Mg=!1,hS(s));break;case 4:h=ws,ws=Gh(s.stateNode.containerInfo),Ci(l,s),ki(s),ws=h;break;case 12:Ci(l,s),ki(s);break;case 31:Ci(l,s),ki(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Nh(s,h)));break;case 13:Ci(l,s),ki(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(jh=Ae()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Nh(s,h)));break;case 22:m=s.memoizedState!==null;var I=c!==null&&c.memoizedState!==null,W=Cr,oe=En;if(Cr=W||m,En=oe||I,Ci(l,s),En=oe,Cr=W,ki(s),h&8192)e:for(l=s.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(c===null||I||Cr||En||Oo(s)),c=null,l=s;;){if(l.tag===5||l.tag===26){if(c===null){I=c=l;try{if(y=I.stateNode,m)C=y.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{O=I.stateNode;var ue=I.memoizedProps.style,Z=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;O.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Pe){It(I,I.return,Pe)}}}else if(l.tag===6){if(c===null){I=l;try{I.stateNode.nodeValue=m?"":I.memoizedProps}catch(Pe){It(I,I.return,Pe)}}}else if(l.tag===18){if(c===null){I=l;try{var re=I.stateNode;m?tw(re,!0):tw(I.stateNode,!1)}catch(Pe){It(I,I.return,Pe)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;c===l&&(c=null),l=l.return}c===l&&(c=null),l.sibling.return=l.return,l=l.sibling}h&4&&(h=s.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,Nh(s,c))));break;case 19:Ci(l,s),ki(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Nh(s,h)));break;case 30:break;case 21:break;default:Ci(l,s),ki(s)}}function ki(s){var l=s.flags;if(l&2){try{for(var c,h=s.return;h!==null;){if(iS(h)){c=h;break}h=h.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var m=c.stateNode,y=Tg(s);Mh(s,y,m);break;case 5:var C=c.stateNode;c.flags&32&&(Je(C,""),c.flags&=-33);var O=Tg(s);Mh(s,O,C);break;case 3:case 4:var I=c.stateNode.containerInfo,W=Tg(s);Og(s,W,I);break;default:throw Error(i(161))}}catch(oe){It(s,s.return,oe)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function hS(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;hS(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function Ar(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)lS(s,l.alternate,l),l=l.sibling}function Oo(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:dl(4,l,l.return),Oo(l);break;case 1:Us(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&tS(l,l.return,c),Oo(l);break;case 27:Eu(l.stateNode);case 26:case 5:Us(l,l.return),Oo(l);break;case 22:l.memoizedState===null&&Oo(l);break;case 30:Oo(l);break;default:Oo(l)}s=s.sibling}}function Er(s,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var h=l.alternate,m=s,y=l,C=y.flags;switch(y.tag){case 0:case 11:case 15:Er(m,y,c),gu(4,y);break;case 1:if(Er(m,y,c),h=y,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(W){It(h,h.return,W)}if(h=y,m=h.updateQueue,m!==null){var O=h.stateNode;try{var I=m.shared.hiddenCallbacks;if(I!==null)for(m.shared.hiddenCallbacks=null,m=0;m<I.length;m++)qx(I[m],O)}catch(W){It(h,h.return,W)}}c&&C&64&&eS(y),yu(y,y.return);break;case 27:sS(y);case 26:case 5:Er(m,y,c),c&&h===null&&C&4&&nS(y),yu(y,y.return);break;case 12:Er(m,y,c);break;case 31:Er(m,y,c),c&&C&4&&cS(m,y);break;case 13:Er(m,y,c),c&&C&4&&uS(m,y);break;case 22:y.memoizedState===null&&Er(m,y,c),yu(y,y.return);break;case 30:break;default:Er(m,y,c)}l=l.sibling}}function Ng(s,l){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&iu(c))}function Dg(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&iu(s))}function Cs(s,l,c,h){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)dS(s,l,c,h),l=l.sibling}function dS(s,l,c,h){var m=l.flags;switch(l.tag){case 0:case 11:case 15:Cs(s,l,c,h),m&2048&&gu(9,l);break;case 1:Cs(s,l,c,h);break;case 3:Cs(s,l,c,h),m&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&iu(s)));break;case 12:if(m&2048){Cs(s,l,c,h),s=l.stateNode;try{var y=l.memoizedProps,C=y.id,O=y.onPostCommit;typeof O=="function"&&O(C,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(I){It(l,l.return,I)}}else Cs(s,l,c,h);break;case 31:Cs(s,l,c,h);break;case 13:Cs(s,l,c,h);break;case 23:break;case 22:y=l.stateNode,C=l.alternate,l.memoizedState!==null?y._visibility&2?Cs(s,l,c,h):bu(s,l):y._visibility&2?Cs(s,l,c,h):(y._visibility|=2,Pa(s,l,c,h,(l.subtreeFlags&10256)!==0||!1)),m&2048&&Ng(C,l);break;case 24:Cs(s,l,c,h),m&2048&&Dg(l.alternate,l);break;default:Cs(s,l,c,h)}}function Pa(s,l,c,h,m){for(m=m&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var y=s,C=l,O=c,I=h,W=C.flags;switch(C.tag){case 0:case 11:case 15:Pa(y,C,O,I,m),gu(8,C);break;case 23:break;case 22:var oe=C.stateNode;C.memoizedState!==null?oe._visibility&2?Pa(y,C,O,I,m):bu(y,C):(oe._visibility|=2,Pa(y,C,O,I,m)),m&&W&2048&&Ng(C.alternate,C);break;case 24:Pa(y,C,O,I,m),m&&W&2048&&Dg(C.alternate,C);break;default:Pa(y,C,O,I,m)}l=l.sibling}}function bu(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=s,h=l,m=h.flags;switch(h.tag){case 22:bu(c,h),m&2048&&Ng(h.alternate,h);break;case 24:bu(c,h),m&2048&&Dg(h.alternate,h);break;default:bu(c,h)}l=l.sibling}}var vu=8192;function Ha(s,l,c){if(s.subtreeFlags&vu)for(s=s.child;s!==null;)pS(s,l,c),s=s.sibling}function pS(s,l,c){switch(s.tag){case 26:Ha(s,l,c),s.flags&vu&&s.memoizedState!==null&&$M(c,ws,s.memoizedState,s.memoizedProps);break;case 5:Ha(s,l,c);break;case 3:case 4:var h=ws;ws=Gh(s.stateNode.containerInfo),Ha(s,l,c),ws=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=vu,vu=16777216,Ha(s,l,c),vu=h):Ha(s,l,c));break;default:Ha(s,l,c)}}function mS(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function xu(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var h=l[c];Pn=h,yS(h,s)}mS(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)gS(s),s=s.sibling}function gS(s){switch(s.tag){case 0:case 11:case 15:xu(s),s.flags&2048&&dl(9,s,s.return);break;case 3:xu(s);break;case 12:xu(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Dh(s)):xu(s);break;default:xu(s)}}function Dh(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var h=l[c];Pn=h,yS(h,s)}mS(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:dl(8,l,l.return),Dh(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,Dh(l));break;default:Dh(l)}s=s.sibling}}function yS(s,l){for(;Pn!==null;){var c=Pn;switch(c.tag){case 0:case 11:case 15:dl(8,c,l);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:iu(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,Pn=h;else e:for(c=s;Pn!==null;){h=Pn;var m=h.sibling,y=h.return;if(oS(h),h===c){Pn=null;break e}if(m!==null){m.return=y,Pn=m;break e}Pn=y}}}var hM={getCacheForType:function(s){var l=Gn(Cn),c=l.data.get(s);return c===void 0&&(c=s(),l.data.set(s,c)),c},cacheSignal:function(){return Gn(Cn).controller.signal}},dM=typeof WeakMap=="function"?WeakMap:Map,Nt=0,qt=null,gt=null,bt=0,zt=0,_i=null,pl=!1,Va=!1,jg=!1,Rr=0,an=0,ml=0,Mo=0,Bg=0,Ui=0,_a=0,Su=null,Ai=null,Lg=!1,jh=0,bS=0,Bh=1/0,Lh=null,gl=null,Mn=0,yl=null,Ua=null,Tr=0,zg=0,Ig=null,vS=null,wu=0,Pg=null;function qi(){return(Nt&2)!==0&&bt!==0?bt&-bt:z.T!==null?Fg():Is()}function xS(){if(Ui===0)if((bt&536870912)===0||xt){var s=pn;pn<<=1,(pn&3932160)===0&&(pn=262144),Ui=s}else Ui=536870912;return s=Hi.current,s!==null&&(s.flags|=32),Ui}function Ei(s,l,c){(s===qt&&(zt===2||zt===9)||s.cancelPendingCommit!==null)&&(qa(s,0),bl(s,bt,Ui,!1)),oi(s,c),((Nt&2)===0||s!==qt)&&(s===qt&&((Nt&2)===0&&(Mo|=c),an===4&&bl(s,bt,Ui,!1)),qs(s))}function SS(s,l,c){if((Nt&6)!==0)throw Error(i(327));var h=!c&&(l&127)===0&&(l&s.expiredLanes)===0||Qt(s,l),m=h?gM(s,l):Vg(s,l,!0),y=h;do{if(m===0){Va&&!h&&bl(s,l,0,!1);break}else{if(c=s.current.alternate,y&&!pM(c)){m=Vg(s,l,!1),y=!1;continue}if(m===2){if(y=l,s.errorRecoveryDisabledLanes&y)var C=0;else C=s.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){l=C;e:{var O=s;m=Su;var I=O.current.memoizedState.isDehydrated;if(I&&(qa(O,C).flags|=256),C=Vg(O,C,!1),C!==2){if(jg&&!I){O.errorRecoveryDisabledLanes|=y,Mo|=y,m=4;break e}y=Ai,Ai=m,y!==null&&(Ai===null?Ai=y:Ai.push.apply(Ai,y))}m=C}if(y=!1,m!==2)continue}}if(m===1){qa(s,0),bl(s,l,0,!0);break}e:{switch(h=s,y=m,y){case 0:case 1:throw Error(i(345));case 4:if((l&4194048)!==l)break;case 6:bl(h,l,Ui,!pl);break e;case 2:Ai=null;break;case 3:case 5:break;default:throw Error(i(329))}if((l&62914560)===l&&(m=jh+300-Ae(),10<m)){if(bl(h,l,Ui,!pl),Et(h,0,!0)!==0)break e;Tr=l,h.timeoutHandle=ZS(wS.bind(null,h,c,Ai,Lh,Lg,l,Ui,Mo,_a,pl,y,"Throttled",-0,0),m);break e}wS(h,c,Ai,Lh,Lg,l,Ui,Mo,_a,pl,y,null,-0,0)}}break}while(!0);qs(s)}function wS(s,l,c,h,m,y,C,O,I,W,oe,ue,Z,re){if(s.timeoutHandle=-1,ue=l.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xs},pS(l,y,ue);var Pe=(y&62914560)===y?jh-Ae():(y&4194048)===y?bS-Ae():0;if(Pe=ZM(ue,Pe),Pe!==null){Tr=y,s.cancelPendingCommit=Pe(MS.bind(null,s,l,y,c,h,m,C,O,I,oe,ue,null,Z,re)),bl(s,y,C,!W);return}}MS(s,l,y,c,h,m,C,O,I)}function pM(s){for(var l=s;;){var c=l.tag;if((c===0||c===11||c===15)&&l.flags&16384&&(c=l.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var m=c[h],y=m.getSnapshot;m=m.value;try{if(!Ii(y(),m))return!1}catch{return!1}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function bl(s,l,c,h){l&=~Bg,l&=~Mo,s.suspendedLanes|=l,s.pingedLanes&=~l,h&&(s.warmLanes|=l),h=s.expirationTimes;for(var m=l;0<m;){var y=31-Pt(m),C=1<<y;h[y]=-1,m&=~C}c!==0&<(s,c,l)}function zh(){return(Nt&6)===0?(Cu(0),!1):!0}function Hg(){if(gt!==null){if(zt===0)var s=gt.return;else s=gt,yr=So=null,tg(s),ja=null,ru=0,s=gt;for(;s!==null;)J1(s.alternate,s),s=s.return;gt=null}}function qa(s,l){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,BM(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Tr=0,Hg(),qt=s,gt=c=mr(s.current,null),bt=l,zt=0,_i=null,pl=!1,Va=Qt(s,l),jg=!1,_a=Ui=Bg=Mo=ml=an=0,Ai=Su=null,Lg=!1,(l&8)!==0&&(l|=l&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=l;0<h;){var m=31-Pt(h),y=1<<m;l|=s[m],h&=~y}return Rr=l,ih(),c}function CS(s,l){ct=null,z.H=du,l===Da||l===fh?(l=Hx(),zt=3):l===qm?(l=Hx(),zt=4):zt=l===yg?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,_i=l,gt===null&&(an=1,Ah(s,is(l,s.current)))}function kS(){var s=Hi.current;return s===null?!0:(bt&4194048)===bt?os===null:(bt&62914560)===bt||(bt&536870912)!==0?s===os:!1}function AS(){var s=z.H;return z.H=du,s===null?du:s}function ES(){var s=z.A;return z.A=hM,s}function Ih(){an=4,pl||(bt&4194048)!==bt&&Hi.current!==null||(Va=!0),(ml&134217727)===0&&(Mo&134217727)===0||qt===null||bl(qt,bt,Ui,!1)}function Vg(s,l,c){var h=Nt;Nt|=2;var m=AS(),y=ES();(qt!==s||bt!==l)&&(Lh=null,qa(s,l)),l=!1;var C=an;e:do try{if(zt!==0&>!==null){var O=gt,I=_i;switch(zt){case 8:Hg(),C=6;break e;case 3:case 2:case 9:case 6:Hi.current===null&&(l=!0);var W=zt;if(zt=0,_i=null,Fa(s,O,I,W),c&&Va){C=0;break e}break;default:W=zt,zt=0,_i=null,Fa(s,O,I,W)}}mM(),C=an;break}catch(oe){CS(s,oe)}while(!0);return l&&s.shellSuspendCounter++,yr=So=null,Nt=h,z.H=m,z.A=y,gt===null&&(qt=null,bt=0,ih()),C}function mM(){for(;gt!==null;)RS(gt)}function gM(s,l){var c=Nt;Nt|=2;var h=AS(),m=ES();qt!==s||bt!==l?(Lh=null,Bh=Ae()+500,qa(s,l)):Va=Qt(s,l);e:do try{if(zt!==0&>!==null){l=gt;var y=_i;t:switch(zt){case 1:zt=0,_i=null,Fa(s,l,y,1);break;case 2:case 9:if(Ix(y)){zt=0,_i=null,TS(l);break}l=function(){zt!==2&&zt!==9||qt!==s||(zt=7),qs(s)},y.then(l,l);break e;case 3:zt=7;break e;case 4:zt=5;break e;case 7:Ix(y)?(zt=0,_i=null,TS(l)):(zt=0,_i=null,Fa(s,l,y,7));break;case 5:var C=null;switch(gt.tag){case 26:C=gt.memoizedState;case 5:case 27:var O=gt;if(C?dw(C):O.stateNode.complete){zt=0,_i=null;var I=O.sibling;if(I!==null)gt=I;else{var W=O.return;W!==null?(gt=W,Ph(W)):gt=null}break t}}zt=0,_i=null,Fa(s,l,y,5);break;case 6:zt=0,_i=null,Fa(s,l,y,6);break;case 8:Hg(),an=6;break e;default:throw Error(i(462))}}yM();break}catch(oe){CS(s,oe)}while(!0);return yr=So=null,z.H=h,z.A=m,Nt=c,gt!==null?0:(qt=null,bt=0,ih(),an)}function yM(){for(;gt!==null&&!Te();)RS(gt)}function RS(s){var l=$1(s.alternate,s,Rr);s.memoizedProps=s.pendingProps,l===null?Ph(s):gt=l}function TS(s){var l=s,c=l.alternate;switch(l.tag){case 15:case 0:l=G1(c,l,l.pendingProps,l.type,void 0,bt);break;case 11:l=G1(c,l,l.pendingProps,l.type.render,l.ref,bt);break;case 5:tg(l);default:J1(c,l),l=gt=Ex(l,Rr),l=$1(c,l,Rr)}s.memoizedProps=s.pendingProps,l===null?Ph(s):gt=l}function Fa(s,l,c,h){yr=So=null,tg(l),ja=null,ru=0;var m=l.return;try{if(rM(s,m,l,c,bt)){an=1,Ah(s,is(c,s.current)),gt=null;return}}catch(y){if(m!==null)throw gt=m,y;an=1,Ah(s,is(c,s.current)),gt=null;return}l.flags&32768?(xt||h===1?s=!0:Va||(bt&536870912)!==0?s=!1:(pl=s=!0,(h===2||h===9||h===3||h===6)&&(h=Hi.current,h!==null&&h.tag===13&&(h.flags|=16384))),OS(l,s)):Ph(l)}function Ph(s){var l=s;do{if((l.flags&32768)!==0){OS(l,pl);return}s=l.return;var c=aM(l.alternate,l,Rr);if(c!==null){gt=c;return}if(l=l.sibling,l!==null){gt=l;return}gt=l=s}while(l!==null);an===0&&(an=5)}function OS(s,l){do{var c=cM(s.alternate,s);if(c!==null){c.flags&=32767,gt=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!l&&(s=s.sibling,s!==null)){gt=s;return}gt=s=c}while(s!==null);an=6,gt=null}function MS(s,l,c,h,m,y,C,O,I){s.cancelPendingCommit=null;do Hh();while(Mn!==0);if((Nt&6)!==0)throw Error(i(327));if(l!==null){if(l===s.current)throw Error(i(177));if(y=l.lanes|l.childLanes,y|=Tm,ai(s,c,y,C,O,I),s===qt&&(gt=qt=null,bt=0),Ua=l,yl=s,Tr=c,zg=y,Ig=m,vS=h,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,SM(_e,function(){return LS(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||h){h=z.T,z.T=null,m=Q.p,Q.p=2,C=Nt,Nt|=4;try{uM(s,l,c)}finally{Nt=C,Q.p=m,z.T=h}}Mn=1,NS(),DS(),jS()}}function NS(){if(Mn===1){Mn=0;var s=yl,l=Ua,c=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||c){c=z.T,z.T=null;var h=Q.p;Q.p=2;var m=Nt;Nt|=4;try{fS(l,s);var y=Zg,C=yx(s.containerInfo),O=y.focusedElem,I=y.selectionRange;if(C!==O&&O&&O.ownerDocument&&gx(O.ownerDocument.documentElement,O)){if(I!==null&&Cm(O)){var W=I.start,oe=I.end;if(oe===void 0&&(oe=W),"selectionStart"in O)O.selectionStart=W,O.selectionEnd=Math.min(oe,O.value.length);else{var ue=O.ownerDocument||document,Z=ue&&ue.defaultView||window;if(Z.getSelection){var re=Z.getSelection(),Pe=O.textContent.length,$e=Math.min(I.start,Pe),_t=I.end===void 0?$e:Math.min(I.end,Pe);!re.extend&&$e>_t&&(C=_t,_t=$e,$e=C);var q=mx(O,$e),_=mx(O,_t);if(q&&_&&(re.rangeCount!==1||re.anchorNode!==q.node||re.anchorOffset!==q.offset||re.focusNode!==_.node||re.focusOffset!==_.offset)){var Y=ue.createRange();Y.setStart(q.node,q.offset),re.removeAllRanges(),$e>_t?(re.addRange(Y),re.extend(_.node,_.offset)):(Y.setEnd(_.node,_.offset),re.addRange(Y))}}}}for(ue=[],re=O;re=re.parentNode;)re.nodeType===1&&ue.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ue.length;O++){var ce=ue[O];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}$h=!!$g,Zg=$g=null}finally{Nt=m,Q.p=h,z.T=c}}s.current=l,Mn=2}}function DS(){if(Mn===2){Mn=0;var s=yl,l=Ua,c=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||c){c=z.T,z.T=null;var h=Q.p;Q.p=2;var m=Nt;Nt|=4;try{lS(s,l.alternate,l)}finally{Nt=m,Q.p=h,z.T=c}}Mn=3}}function jS(){if(Mn===4||Mn===3){Mn=0,we();var s=yl,l=Ua,c=Tr,h=vS;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Mn=5:(Mn=0,Ua=yl=null,BS(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(gl=null),zs(c),l=l.stateNode,Ue&&typeof Ue.onCommitFiberRoot=="function")try{Ue.onCommitFiberRoot(ht,l,void 0,(l.current.flags&128)===128)}catch{}if(h!==null){l=z.T,m=Q.p,Q.p=2,z.T=null;try{for(var y=s.onRecoverableError,C=0;C<h.length;C++){var O=h[C];y(O.value,{componentStack:O.stack})}}finally{z.T=l,Q.p=m}}(Tr&3)!==0&&Hh(),qs(s),m=s.pendingLanes,(c&261930)!==0&&(m&42)!==0?s===Pg?wu++:(wu=0,Pg=s):wu=0,Cu(0)}}function BS(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,iu(l)))}function Hh(){return NS(),DS(),jS(),LS()}function LS(){if(Mn!==5)return!1;var s=yl,l=zg;zg=0;var c=zs(Tr),h=z.T,m=Q.p;try{Q.p=32>c?32:c,z.T=null,c=Ig,Ig=null;var y=yl,C=Tr;if(Mn=0,Ua=yl=null,Tr=0,(Nt&6)!==0)throw Error(i(331));var O=Nt;if(Nt|=4,gS(y.current),dS(y,y.current,C,c),Nt=O,Cu(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot=="function")try{Ue.onPostCommitFiberRoot(ht,y)}catch{}return!0}finally{Q.p=m,z.T=h,BS(s,l)}}function zS(s,l,c){l=is(c,l),l=gg(s.stateNode,l,2),s=ul(s,l,2),s!==null&&(oi(s,2),qs(s))}function It(s,l,c){if(s.tag===3)zS(s,s,c);else for(;l!==null;){if(l.tag===3){zS(l,s,c);break}else if(l.tag===1){var h=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(gl===null||!gl.has(h))){s=is(c,s),c=I1(2),h=ul(l,c,2),h!==null&&(P1(c,h,l,s),oi(h,2),qs(h));break}}l=l.return}}function _g(s,l,c){var h=s.pingCache;if(h===null){h=s.pingCache=new dM;var m=new Set;h.set(l,m)}else m=h.get(l),m===void 0&&(m=new Set,h.set(l,m));m.has(c)||(jg=!0,m.add(c),s=bM.bind(null,s,l,c),l.then(s,s))}function bM(s,l,c){var h=s.pingCache;h!==null&&h.delete(l),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,qt===s&&(bt&c)===c&&(an===4||an===3&&(bt&62914560)===bt&&300>Ae()-jh?(Nt&2)===0&&qa(s,0):Bg|=c,_a===bt&&(_a=0)),qs(s)}function IS(s,l){l===0&&(l=Rn()),s=bo(s,l),s!==null&&(oi(s,l),qs(s))}function vM(s){var l=s.memoizedState,c=0;l!==null&&(c=l.retryLane),IS(s,c)}function xM(s,l){var c=0;switch(s.tag){case 31:case 13:var h=s.stateNode,m=s.memoizedState;m!==null&&(c=m.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(l),IS(s,c)}function SM(s,l){return qe(s,l)}var Vh=null,Ga=null,Ug=!1,_h=!1,qg=!1,vl=0;function qs(s){s!==Ga&&s.next===null&&(Ga===null?Vh=Ga=s:Ga=Ga.next=s),_h=!0,Ug||(Ug=!0,CM())}function Cu(s,l){if(!qg&&_h){qg=!0;do for(var c=!1,h=Vh;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var y=0;else{var C=h.suspendedLanes,O=h.pingedLanes;y=(1<<31-Pt(42|s)+1)-1,y&=m&~(C&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,_S(h,y))}else y=bt,y=Et(h,h===qt?y:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(y&3)===0||Qt(h,y)||(c=!0,_S(h,y));h=h.next}while(c);qg=!1}}function wM(){PS()}function PS(){_h=Ug=!1;var s=0;vl!==0&&jM()&&(s=vl);for(var l=Ae(),c=null,h=Vh;h!==null;){var m=h.next,y=HS(h,l);y===0?(h.next=null,c===null?Vh=m:c.next=m,m===null&&(Ga=c)):(c=h,(s!==0||(y&3)!==0)&&(_h=!0)),h=m}Mn!==0&&Mn!==5||Cu(s),vl!==0&&(vl=0)}function HS(s,l){for(var c=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,y=s.pendingLanes&-62914561;0<y;){var C=31-Pt(y),O=1<<C,I=m[C];I===-1?((O&c)===0||(O&h)!==0)&&(m[C]=sn(O,l)):I<=l&&(s.expiredLanes|=O),y&=~O}if(l=qt,c=bt,c=Et(s,s===l?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,c===0||s===l&&(zt===2||zt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&je(h),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Qt(s,c)){if(l=c&-c,l===s.callbackPriority)return l;switch(h!==null&&je(h),zs(c)){case 2:case 8:c=nt;break;case 32:c=_e;break;case 268435456:c=at;break;default:c=_e}return h=VS.bind(null,s),c=qe(c,h),s.callbackPriority=l,s.callbackNode=c,l}return h!==null&&h!==null&&je(h),s.callbackPriority=2,s.callbackNode=null,2}function VS(s,l){if(Mn!==0&&Mn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(Hh()&&s.callbackNode!==c)return null;var h=bt;return h=Et(s,s===qt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(SS(s,h,l),HS(s,Ae()),s.callbackNode!=null&&s.callbackNode===c?VS.bind(null,s):null)}function _S(s,l){if(Hh())return null;SS(s,l,!0)}function CM(){LM(function(){(Nt&6)!==0?qe(Ze,wM):PS()})}function Fg(){if(vl===0){var s=Ma;s===0&&(s=st,st<<=1,(st&261888)===0&&(st=256)),vl=s}return vl}function US(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Gc(""+s)}function qS(s,l){var c=l.ownerDocument.createElement("input");return c.name=l.name,c.value=l.value,s.id&&c.setAttribute("form",s.id),l.parentNode.insertBefore(c,l),s=new FormData(s),c.parentNode.removeChild(c),s}function kM(s,l,c,h,m){if(l==="submit"&&c&&c.stateNode===m){var y=US((m[rn]||null).action),C=h.submitter;C&&(l=(l=C[rn]||null)?US(l.formAction):C.getAttribute("formAction"),l!==null&&(y=l,C=null));var O=new Jf("action","action",null,h,m);s.push({event:O,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(vl!==0){var I=C?qS(m,C):new FormData(m);ug(c,{pending:!0,data:I,method:m.method,action:y},null,I)}}else typeof y=="function"&&(O.preventDefault(),I=C?qS(m,C):new FormData(m),ug(c,{pending:!0,data:I,method:m.method,action:y},y,I))},currentTarget:m}]})}}for(var Gg=0;Gg<Rm.length;Gg++){var Qg=Rm[Gg],AM=Qg.toLowerCase(),EM=Qg[0].toUpperCase()+Qg.slice(1);Ss(AM,"on"+EM)}Ss(xx,"onAnimationEnd"),Ss(Sx,"onAnimationIteration"),Ss(wx,"onAnimationStart"),Ss("dblclick","onDoubleClick"),Ss("focusin","onFocus"),Ss("focusout","onBlur"),Ss(UO,"onTransitionRun"),Ss(qO,"onTransitionStart"),Ss(FO,"onTransitionCancel"),Ss(Cx,"onTransitionEnd"),$r("onMouseEnter",["mouseout","mouseover"]),$r("onMouseLeave",["mouseout","mouseover"]),$r("onPointerEnter",["pointerout","pointerover"]),$r("onPointerLeave",["pointerout","pointerover"]),bi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),bi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),bi("onBeforeInput",["compositionend","keypress","textInput","paste"]),bi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),bi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),bi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ku="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(" "),RM=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ku));function FS(s,l){l=(l&4)!==0;for(var c=0;c<s.length;c++){var h=s[c],m=h.event;h=h.listeners;e:{var y=void 0;if(l)for(var C=h.length-1;0<=C;C--){var O=h[C],I=O.instance,W=O.currentTarget;if(O=O.listener,I!==y&&m.isPropagationStopped())break e;y=O,m.currentTarget=W;try{y(m)}catch(oe){nh(oe)}m.currentTarget=null,y=I}else for(C=0;C<h.length;C++){if(O=h[C],I=O.instance,W=O.currentTarget,O=O.listener,I!==y&&m.isPropagationStopped())break e;y=O,m.currentTarget=W;try{y(m)}catch(oe){nh(oe)}m.currentTarget=null,y=I}}}}function yt(s,l){var c=l[yi];c===void 0&&(c=l[yi]=new Set);var h=s+"__bubble";c.has(h)||(GS(l,s,2,!1),c.add(h))}function Kg(s,l,c){var h=0;l&&(h|=4),GS(c,s,h,l)}var Uh="_reactListening"+Math.random().toString(36).slice(2);function Yg(s){if(!s[Uh]){s[Uh]=!0,ci.forEach(function(c){c!=="selectionchange"&&(RM.has(c)||Kg(c,!1,s),Kg(c,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Uh]||(l[Uh]=!0,Kg("selectionchange",!1,l))}}function GS(s,l,c,h){switch(xw(l)){case 2:var m=tN;break;case 8:m=nN;break;default:m=cy}c=m.bind(null,l,c,s),m=void 0,!pm||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),h?m!==void 0?s.addEventListener(l,c,{capture:!0,passive:m}):s.addEventListener(l,c,!0):m!==void 0?s.addEventListener(l,c,{passive:m}):s.addEventListener(l,c,!1)}function Wg(s,l,c,h,m){var y=h;if((l&1)===0&&(l&2)===0&&h!==null)e:for(;;){if(h===null)return;var C=h.tag;if(C===3||C===4){var O=h.stateNode.containerInfo;if(O===m)break;if(C===4)for(C=h.return;C!==null;){var I=C.tag;if((I===3||I===4)&&C.stateNode.containerInfo===m)return;C=C.return}for(;O!==null;){if(C=Ps(O),C===null)return;if(I=C.tag,I===5||I===6||I===26||I===27){h=y=C;continue e}O=O.parentNode}}h=h.return}Xv(function(){var W=y,oe=hm(c),ue=[];e:{var Z=kx.get(s);if(Z!==void 0){var re=Jf,Pe=s;switch(s){case"keypress":if($f(c)===0)break e;case"keydown":case"keyup":re=xO;break;case"focusin":Pe="focus",re=bm;break;case"focusout":Pe="blur",re=bm;break;case"beforeblur":case"afterblur":re=bm;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=Jv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=aO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=CO;break;case xx:case Sx:case wx:re=fO;break;case Cx:re=AO;break;case"scroll":case"scrollend":re=lO;break;case"wheel":re=RO;break;case"copy":case"cut":case"paste":re=dO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=tx;break;case"toggle":case"beforetoggle":re=OO}var $e=(l&4)!==0,_t=!$e&&(s==="scroll"||s==="scrollend"),q=$e?Z!==null?Z+"Capture":null:Z;$e=[];for(var _=W,Y;_!==null;){var ce=_;if(Y=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Y===null||q===null||(ce=Qc(_,q),ce!=null&&$e.push(Au(_,ce,Y))),_t)break;_=_.return}0<$e.length&&(Z=new re(Z,Pe,null,c,oe),ue.push({event:Z,listeners:$e}))}}if((l&7)===0){e:{if(Z=s==="mouseover"||s==="pointerover",re=s==="mouseout"||s==="pointerout",Z&&c!==Wf&&(Pe=c.relatedTarget||c.fromElement)&&(Ps(Pe)||Pe[Tn]))break e;if((re||Z)&&(Z=oe.window===oe?oe:(Z=oe.ownerDocument)?Z.defaultView||Z.parentWindow:window,re?(Pe=c.relatedTarget||c.toElement,re=W,Pe=Pe?Ps(Pe):null,Pe!==null&&(_t=o(Pe),$e=Pe.tag,Pe!==_t||$e!==5&&$e!==27&&$e!==6)&&(Pe=null)):(re=null,Pe=W),re!==Pe)){if($e=Jv,ce="onMouseLeave",q="onMouseEnter",_="mouse",(s==="pointerout"||s==="pointerover")&&($e=tx,ce="onPointerLeave",q="onPointerEnter",_="pointer"),_t=re==null?Z:Hs(re),Y=Pe==null?Z:Hs(Pe),Z=new $e(ce,_+"leave",re,c,oe),Z.target=_t,Z.relatedTarget=Y,ce=null,Ps(oe)===W&&($e=new $e(q,_+"enter",Pe,c,oe),$e.target=Y,$e.relatedTarget=_t,ce=$e),_t=ce,re&&Pe)t:{for($e=TM,q=re,_=Pe,Y=0,ce=q;ce;ce=$e(ce))Y++;ce=0;for(var Xe=_;Xe;Xe=$e(Xe))ce++;for(;0<Y-ce;)q=$e(q),Y--;for(;0<ce-Y;)_=$e(_),ce--;for(;Y--;){if(q===_||_!==null&&q===_.alternate){$e=q;break t}q=$e(q),_=$e(_)}$e=null}else $e=null;re!==null&&QS(ue,Z,re,$e,!1),Pe!==null&&_t!==null&&QS(ue,_t,Pe,$e,!0)}}e:{if(Z=W?Hs(W):window,re=Z.nodeName&&Z.nodeName.toLowerCase(),re==="select"||re==="input"&&Z.type==="file")var Rt=cx;else if(ox(Z))if(ux)Rt=HO;else{Rt=IO;var Fe=zO}else re=Z.nodeName,!re||re.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?W&&vs(W.elementType)&&(Rt=cx):Rt=PO;if(Rt&&(Rt=Rt(s,W))){ax(ue,Rt,c,oe);break e}Fe&&Fe(s,Z,W),s==="focusout"&&W&&Z.type==="number"&&W.memoizedProps.value!=null&&Fc(Z,"number",Z.value)}switch(Fe=W?Hs(W):window,s){case"focusin":(ox(Fe)||Fe.contentEditable==="true")&&(wa=Fe,km=W,eu=null);break;case"focusout":eu=km=wa=null;break;case"mousedown":Am=!0;break;case"contextmenu":case"mouseup":case"dragend":Am=!1,bx(ue,c,oe);break;case"selectionchange":if(_O)break;case"keydown":case"keyup":bx(ue,c,oe)}var ut;if(xm)e:{switch(s){case"compositionstart":var vt="onCompositionStart";break e;case"compositionend":vt="onCompositionEnd";break e;case"compositionupdate":vt="onCompositionUpdate";break e}vt=void 0}else Sa?rx(s,c)&&(vt="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(vt="onCompositionStart");vt&&(nx&&c.locale!=="ko"&&(Sa||vt!=="onCompositionStart"?vt==="onCompositionEnd"&&Sa&&(ut=$v()):(il=oe,mm="value"in il?il.value:il.textContent,Sa=!0)),Fe=qh(W,vt),0<Fe.length&&(vt=new ex(vt,s,null,c,oe),ue.push({event:vt,listeners:Fe}),ut?vt.data=ut:(ut=lx(c),ut!==null&&(vt.data=ut)))),(ut=NO?DO(s,c):jO(s,c))&&(vt=qh(W,"onBeforeInput"),0<vt.length&&(Fe=new ex("onBeforeInput","beforeinput",null,c,oe),ue.push({event:Fe,listeners:vt}),Fe.data=ut)),kM(ue,s,W,c,oe)}FS(ue,l)})}function Au(s,l,c){return{instance:s,listener:l,currentTarget:c}}function qh(s,l){for(var c=l+"Capture",h=[];s!==null;){var m=s,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=Qc(s,c),m!=null&&h.unshift(Au(s,m,y)),m=Qc(s,l),m!=null&&h.push(Au(s,m,y))),s.tag===3)return h;s=s.return}return[]}function TM(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function QS(s,l,c,h,m){for(var y=l._reactName,C=[];c!==null&&c!==h;){var O=c,I=O.alternate,W=O.stateNode;if(O=O.tag,I!==null&&I===h)break;O!==5&&O!==26&&O!==27||W===null||(I=W,m?(W=Qc(c,y),W!=null&&C.unshift(Au(c,W,I))):m||(W=Qc(c,y),W!=null&&C.push(Au(c,W,I)))),c=c.return}C.length!==0&&s.push({event:l,listeners:C})}var OM=/\r\n?/g,MM=/\u0000|\uFFFD/g;function KS(s){return(typeof s=="string"?s:""+s).replace(OM,`
|
|
49
|
-
`).replace(MM,"")}function YS(s,l){return l=KS(l),KS(s)===l}function Vt(s,l,c,h,m,y){switch(c){case"children":typeof h=="string"?l==="body"||l==="textarea"&&h===""||Je(s,h):(typeof h=="number"||typeof h=="bigint")&&l!=="body"&&Je(s,""+h);break;case"className":Jr(s,"class",h);break;case"tabIndex":Jr(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Jr(s,c,h);break;case"style":On(s,h,y);break;case"data":if(l!=="object"){Jr(s,"data",h);break}case"src":case"href":if(h===""&&(l!=="a"||c!=="href")){s.removeAttribute(c);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=Gc(""+h),s.setAttribute(c,h);break;case"action":case"formAction":if(typeof h=="function"){s.setAttribute(c,"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"&&(c==="formAction"?(l!=="input"&&Vt(s,l,"name",m.name,m,null),Vt(s,l,"formEncType",m.formEncType,m,null),Vt(s,l,"formMethod",m.formMethod,m,null),Vt(s,l,"formTarget",m.formTarget,m,null)):(Vt(s,l,"encType",m.encType,m,null),Vt(s,l,"method",m.method,m,null),Vt(s,l,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=Gc(""+h),s.setAttribute(c,h);break;case"onClick":h!=null&&(s.onclick=xs);break;case"onScroll":h!=null&&yt("scroll",s);break;case"onScrollEnd":h!=null&&yt("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}c=Gc(""+h),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""+h):s.removeAttribute(c);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":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":h===!0?s.setAttribute(c,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,h):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(c,h):s.removeAttribute(c);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(c):s.setAttribute(c,h);break;case"popover":yt("beforetoggle",s),yt("toggle",s),Zr(s,"popover",h);break;case"xlinkActuate":bs(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":bs(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":bs(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":bs(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":bs(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":bs(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":bs(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":bs(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":bs(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Zr(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=nl.get(c)||c,Zr(s,c,h))}}function Xg(s,l,c,h,m,y){switch(c){case"style":On(s,h,y);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"children":typeof h=="string"?Je(s,h):(typeof h=="number"||typeof h=="bigint")&&Je(s,""+h);break;case"onScroll":h!=null&&yt("scroll",s);break;case"onScrollEnd":h!=null&&yt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=xs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xr.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),l=c.slice(2,m?c.length-7:void 0),y=s[rn]||null,y=y!=null?y[c]:null,typeof y=="function"&&s.removeEventListener(l,y,m),typeof h=="function")){typeof y!="function"&&y!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(l,h,m);break e}c in s?s[c]=h:h===!0?s.setAttribute(c,""):Zr(s,c,h)}}}function Kn(s,l,c){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":yt("error",s),yt("load",s);var h=!1,m=!1,y;for(y in c)if(c.hasOwnProperty(y)){var C=c[y];if(C!=null)switch(y){case"src":h=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:Vt(s,l,y,C,c,null)}}m&&Vt(s,l,"srcSet",c.srcSet,c,null),h&&Vt(s,l,"src",c.src,c,null);return;case"input":yt("invalid",s);var O=y=C=m=null,I=null,W=null;for(h in c)if(c.hasOwnProperty(h)){var oe=c[h];if(oe!=null)switch(h){case"name":m=oe;break;case"type":C=oe;break;case"checked":I=oe;break;case"defaultChecked":W=oe;break;case"value":y=oe;break;case"defaultValue":O=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,l));break;default:Vt(s,l,h,oe,c,null)}}Yf(s,y,O,I,W,C,m,!1);return;case"select":yt("invalid",s),h=C=y=null;for(m in c)if(c.hasOwnProperty(m)&&(O=c[m],O!=null))switch(m){case"value":y=O;break;case"defaultValue":C=O;break;case"multiple":h=O;default:Vt(s,l,m,O,c,null)}l=y,c=C,s.multiple=!!h,l!=null?tl(s,!!h,l,!1):c!=null&&tl(s,!!h,c,!0);return;case"textarea":yt("invalid",s),y=m=h=null;for(C in c)if(c.hasOwnProperty(C)&&(O=c[C],O!=null))switch(C){case"value":h=O;break;case"defaultValue":m=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:Vt(s,l,C,O,c,null)}Ke(s,h,m,y);return;case"option":for(I in c)if(c.hasOwnProperty(I)&&(h=c[I],h!=null))switch(I){case"selected":s.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Vt(s,l,I,h,c,null)}return;case"dialog":yt("beforetoggle",s),yt("toggle",s),yt("cancel",s),yt("close",s);break;case"iframe":case"object":yt("load",s);break;case"video":case"audio":for(h=0;h<ku.length;h++)yt(ku[h],s);break;case"image":yt("error",s),yt("load",s);break;case"details":yt("toggle",s);break;case"embed":case"source":case"link":yt("error",s),yt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in c)if(c.hasOwnProperty(W)&&(h=c[W],h!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:Vt(s,l,W,h,c,null)}return;default:if(vs(l)){for(oe in c)c.hasOwnProperty(oe)&&(h=c[oe],h!==void 0&&Xg(s,l,oe,h,c,void 0));return}}for(O in c)c.hasOwnProperty(O)&&(h=c[O],h!=null&&Vt(s,l,O,h,c,null))}function NM(s,l,c,h){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,C=null,O=null,I=null,W=null,oe=null;for(re in c){var ue=c[re];if(c.hasOwnProperty(re)&&ue!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":I=ue;default:h.hasOwnProperty(re)||Vt(s,l,re,null,h,ue)}}for(var Z in h){var re=h[Z];if(ue=c[Z],h.hasOwnProperty(Z)&&(re!=null||ue!=null))switch(Z){case"type":y=re;break;case"name":m=re;break;case"checked":W=re;break;case"defaultChecked":oe=re;break;case"value":C=re;break;case"defaultValue":O=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,l));break;default:re!==ue&&Vt(s,l,Z,re,h,ue)}}qc(s,C,O,I,W,oe,y,m);return;case"select":re=C=O=Z=null;for(y in c)if(I=c[y],c.hasOwnProperty(y)&&I!=null)switch(y){case"value":break;case"multiple":re=I;default:h.hasOwnProperty(y)||Vt(s,l,y,null,h,I)}for(m in h)if(y=h[m],I=c[m],h.hasOwnProperty(m)&&(y!=null||I!=null))switch(m){case"value":Z=y;break;case"defaultValue":O=y;break;case"multiple":C=y;default:y!==I&&Vt(s,l,m,y,h,I)}l=O,c=C,h=re,Z!=null?tl(s,!!c,Z,!1):!!h!=!!c&&(l!=null?tl(s,!!c,l,!0):tl(s,!!c,c?[]:"",!1));return;case"textarea":re=Z=null;for(O in c)if(m=c[O],c.hasOwnProperty(O)&&m!=null&&!h.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:Vt(s,l,O,null,h,m)}for(C in h)if(m=h[C],y=c[C],h.hasOwnProperty(C)&&(m!=null||y!=null))switch(C){case"value":Z=m;break;case"defaultValue":re=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==y&&Vt(s,l,C,m,h,y)}Me(s,Z,re);return;case"option":for(var Pe in c)if(Z=c[Pe],c.hasOwnProperty(Pe)&&Z!=null&&!h.hasOwnProperty(Pe))switch(Pe){case"selected":s.selected=!1;break;default:Vt(s,l,Pe,null,h,Z)}for(I in h)if(Z=h[I],re=c[I],h.hasOwnProperty(I)&&Z!==re&&(Z!=null||re!=null))switch(I){case"selected":s.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:Vt(s,l,I,Z,h,re)}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 $e in c)Z=c[$e],c.hasOwnProperty($e)&&Z!=null&&!h.hasOwnProperty($e)&&Vt(s,l,$e,null,h,Z);for(W in h)if(Z=h[W],re=c[W],h.hasOwnProperty(W)&&Z!==re&&(Z!=null||re!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,l));break;default:Vt(s,l,W,Z,h,re)}return;default:if(vs(l)){for(var _t in c)Z=c[_t],c.hasOwnProperty(_t)&&Z!==void 0&&!h.hasOwnProperty(_t)&&Xg(s,l,_t,void 0,h,Z);for(oe in h)Z=h[oe],re=c[oe],!h.hasOwnProperty(oe)||Z===re||Z===void 0&&re===void 0||Xg(s,l,oe,Z,h,re);return}}for(var q in c)Z=c[q],c.hasOwnProperty(q)&&Z!=null&&!h.hasOwnProperty(q)&&Vt(s,l,q,null,h,Z);for(ue in h)Z=h[ue],re=c[ue],!h.hasOwnProperty(ue)||Z===re||Z==null&&re==null||Vt(s,l,ue,Z,h,re)}function WS(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function DM(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,c=performance.getEntriesByType("resource"),h=0;h<c.length;h++){var m=c[h],y=m.transferSize,C=m.initiatorType,O=m.duration;if(y&&O&&WS(C)){for(C=0,O=m.responseEnd,h+=1;h<c.length;h++){var I=c[h],W=I.startTime;if(W>O)break;var oe=I.transferSize,ue=I.initiatorType;oe&&WS(ue)&&(I=I.responseEnd,C+=oe*(I<O?1:(O-W)/(I-W)))}if(--h,l+=8*(y+C)/(m.duration/1e3),s++,10<s)break}}if(0<s)return l/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var $g=null,Zg=null;function Fh(s){return s.nodeType===9?s:s.ownerDocument}function XS(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function $S(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function Jg(s,l){return s==="textarea"||s==="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 ey=null;function jM(){var s=window.event;return s&&s.type==="popstate"?s===ey?!1:(ey=s,!0):(ey=null,!1)}var ZS=typeof setTimeout=="function"?setTimeout:void 0,BM=typeof clearTimeout=="function"?clearTimeout:void 0,JS=typeof Promise=="function"?Promise:void 0,LM=typeof queueMicrotask=="function"?queueMicrotask:typeof JS<"u"?function(s){return JS.resolve(null).then(s).catch(zM)}:ZS;function zM(s){setTimeout(function(){throw s})}function xl(s){return s==="head"}function ew(s,l){var c=l,h=0;do{var m=c.nextSibling;if(s.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(h===0){s.removeChild(m),Wa(l);return}h--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")h++;else if(c==="html")Eu(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Eu(c);for(var y=c.firstChild;y;){var C=y.nextSibling,O=y.nodeName;y[hr]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=C}}else c==="body"&&Eu(s.ownerDocument.body);c=m}while(c);Wa(l)}function tw(s,l){var c=s;s=0;do{var h=c.nextSibling;if(c.nodeType===1?l?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(l?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),h&&h.nodeType===8)if(c=h.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=h}while(c)}function ty(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var c=l;switch(l=l.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":ty(c),ma(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function IM(s,l,c,h){for(;s.nodeType===1;){var m=c;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[hr])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(y=s.getAttribute("rel"),y==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(y!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(y=s.getAttribute("src"),(y!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===y)return s}else return s;if(s=as(s.nextSibling),s===null)break}return null}function PM(s,l,c){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=as(s.nextSibling),s===null))return null;return s}function nw(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=as(s.nextSibling),s===null))return null;return s}function ny(s){return s.data==="$?"||s.data==="$~"}function iy(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function HM(s,l){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||c.readyState!=="loading")l();else{var h=function(){l(),c.removeEventListener("DOMContentLoaded",h)};c.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function as(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return s}var sy=null;function iw(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(l===0)return as(s.nextSibling);l--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||l++}s=s.nextSibling}return null}function sw(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(l===0)return s;l--}else c!=="/$"&&c!=="/&"||l++}s=s.previousSibling}return null}function rw(s,l,c){switch(l=Fh(c),s){case"html":if(s=l.documentElement,!s)throw Error(i(452));return s;case"head":if(s=l.head,!s)throw Error(i(453));return s;case"body":if(s=l.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Eu(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);ma(s)}var cs=new Map,lw=new Set;function Gh(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Or=Q.d;Q.d={f:VM,r:_M,D:UM,C:qM,L:FM,m:GM,X:KM,S:QM,M:YM};function VM(){var s=Or.f(),l=zh();return s||l}function _M(s){var l=Yr(s);l!==null&&l.tag===5&&l.type==="form"?C1(l):Or.r(s)}var Qa=typeof document>"u"?null:document;function ow(s,l,c){var h=Qa;if(h&&typeof l=="string"&&l){var m=xi(l);m='link[rel="'+s+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),lw.has(m)||(lw.add(m),s={rel:s,crossOrigin:c,href:l},h.querySelector(m)===null&&(l=h.createElement("link"),Kn(l,"link",s),Ot(l),h.head.appendChild(l)))}}function UM(s){Or.D(s),ow("dns-prefetch",s,null)}function qM(s,l){Or.C(s,l),ow("preconnect",s,l)}function FM(s,l,c){Or.L(s,l,c);var h=Qa;if(h&&s&&l){var m='link[rel="preload"][as="'+xi(l)+'"]';l==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+xi(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+xi(c.imageSizes)+'"]')):m+='[href="'+xi(s)+'"]';var y=m;switch(l){case"style":y=Ka(s);break;case"script":y=Ya(s)}cs.has(y)||(s=g({rel:"preload",href:l==="image"&&c&&c.imageSrcSet?void 0:s,as:l},c),cs.set(y,s),h.querySelector(m)!==null||l==="style"&&h.querySelector(Ru(y))||l==="script"&&h.querySelector(Tu(y))||(l=h.createElement("link"),Kn(l,"link",s),Ot(l),h.head.appendChild(l)))}}function GM(s,l){Or.m(s,l);var c=Qa;if(c&&s){var h=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+xi(h)+'"][href="'+xi(s)+'"]',y=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Ya(s)}if(!cs.has(y)&&(s=g({rel:"modulepreload",href:s},l),cs.set(y,s),c.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Tu(y)))return}h=c.createElement("link"),Kn(h,"link",s),Ot(h),c.head.appendChild(h)}}}function QM(s,l,c){Or.S(s,l,c);var h=Qa;if(h&&s){var m=Wr(h).hoistableStyles,y=Ka(s);l=l||"default";var C=m.get(y);if(!C){var O={loading:0,preload:null};if(C=h.querySelector(Ru(y)))O.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":l},c),(c=cs.get(y))&&ry(s,c);var I=C=h.createElement("link");Ot(I),Kn(I,"link",s),I._p=new Promise(function(W,oe){I.onload=W,I.onerror=oe}),I.addEventListener("load",function(){O.loading|=1}),I.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Qh(C,l,h)}C={type:"stylesheet",instance:C,count:1,state:O},m.set(y,C)}}}function KM(s,l){Or.X(s,l);var c=Qa;if(c&&s){var h=Wr(c).hoistableScripts,m=Ya(s),y=h.get(m);y||(y=c.querySelector(Tu(m)),y||(s=g({src:s,async:!0},l),(l=cs.get(m))&&ly(s,l),y=c.createElement("script"),Ot(y),Kn(y,"link",s),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},h.set(m,y))}}function YM(s,l){Or.M(s,l);var c=Qa;if(c&&s){var h=Wr(c).hoistableScripts,m=Ya(s),y=h.get(m);y||(y=c.querySelector(Tu(m)),y||(s=g({src:s,async:!0,type:"module"},l),(l=cs.get(m))&&ly(s,l),y=c.createElement("script"),Ot(y),Kn(y,"link",s),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},h.set(m,y))}}function aw(s,l,c,h){var m=(m=se.current)?Gh(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(l=Ka(c.href),c=Wr(m).hoistableStyles,h=c.get(l),h||(h={type:"style",instance:null,count:0,state:null},c.set(l,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Ka(c.href);var y=Wr(m).hoistableStyles,C=y.get(s);if(C||(m=m.ownerDocument||m,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(s,C),(y=m.querySelector(Ru(s)))&&!y._p&&(C.instance=y,C.state.loading=5),cs.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},cs.set(s,c),y||WM(m,s,c,C.state))),l&&h===null)throw Error(i(528,""));return C}if(l&&h!==null)throw Error(i(529,""));return null;case"script":return l=c.async,c=c.src,typeof c=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ya(c),c=Wr(m).hoistableScripts,h=c.get(l),h||(h={type:"script",instance:null,count:0,state:null},c.set(l,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Ka(s){return'href="'+xi(s)+'"'}function Ru(s){return'link[rel="stylesheet"]['+s+"]"}function cw(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function WM(s,l,c,h){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?h.loading=1:(l=s.createElement("link"),h.preload=l,l.addEventListener("load",function(){return h.loading|=1}),l.addEventListener("error",function(){return h.loading|=2}),Kn(l,"link",c),Ot(l),s.head.appendChild(l))}function Ya(s){return'[src="'+xi(s)+'"]'}function Tu(s){return"script[async]"+s}function uw(s,l,c){if(l.count++,l.instance===null)switch(l.type){case"style":var h=s.querySelector('style[data-href~="'+xi(c.href)+'"]');if(h)return l.instance=h,Ot(h),h;var m=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),Ot(h),Kn(h,"style",m),Qh(h,c.precedence,s),l.instance=h;case"stylesheet":m=Ka(c.href);var y=s.querySelector(Ru(m));if(y)return l.state.loading|=4,l.instance=y,Ot(y),y;h=cw(c),(m=cs.get(m))&&ry(h,m),y=(s.ownerDocument||s).createElement("link"),Ot(y);var C=y;return C._p=new Promise(function(O,I){C.onload=O,C.onerror=I}),Kn(y,"link",h),l.state.loading|=4,Qh(y,c.precedence,s),l.instance=y;case"script":return y=Ya(c.src),(m=s.querySelector(Tu(y)))?(l.instance=m,Ot(m),m):(h=c,(m=cs.get(y))&&(h=g({},c),ly(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),Ot(m),Kn(m,"link",h),s.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(i(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(h=l.instance,l.state.loading|=4,Qh(h,c.precedence,s));return l.instance}function Qh(s,l,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,y=m,C=0;C<h.length;C++){var O=h[C];if(O.dataset.precedence===l)y=O;else if(y!==m)break}y?y.parentNode.insertBefore(s,y.nextSibling):(l=c.nodeType===9?c.head:c,l.insertBefore(s,l.firstChild))}function ry(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function ly(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Kh=null;function fw(s,l,c){if(Kh===null){var h=new Map,m=Kh=new Map;m.set(c,h)}else m=Kh,h=m.get(c),h||(h=new Map,m.set(c,h));if(h.has(s))return h;for(h.set(s,null),c=c.getElementsByTagName(s),m=0;m<c.length;m++){var y=c[m];if(!(y[hr]||y[Ut]||s==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var C=y.getAttribute(l)||"";C=s+C;var O=h.get(C);O?O.push(y):h.set(C,[y])}}return h}function hw(s,l,c){s=s.ownerDocument||s,s.head.insertBefore(c,l==="title"?s.querySelector("head > title"):null)}function XM(s,l,c){if(c===1||l.itemProp!=null)return!1;switch(s){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;switch(l.rel){case"stylesheet":return s=l.disabled,typeof l.precedence=="string"&&s==null;default:return!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 dw(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function $M(s,l,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=Ka(h.href),y=l.querySelector(Ru(m));if(y){l=y._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Yh.bind(s),l.then(s,s)),c.state.loading|=4,c.instance=y,Ot(y);return}y=l.ownerDocument||l,h=cw(h),(m=cs.get(m))&&ry(h,m),y=y.createElement("link"),Ot(y);var C=y;C._p=new Promise(function(O,I){C.onload=O,C.onerror=I}),Kn(y,"link",h),c.instance=y}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,l),(l=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=Yh.bind(s),l.addEventListener("load",c),l.addEventListener("error",c))}}var oy=0;function ZM(s,l){return s.stylesheets&&s.count===0&&Xh(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var h=setTimeout(function(){if(s.stylesheets&&Xh(s,s.stylesheets),s.unsuspend){var y=s.unsuspend;s.unsuspend=null,y()}},6e4+l);0<s.imgBytes&&oy===0&&(oy=62500*DM());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Xh(s,s.stylesheets),s.unsuspend)){var y=s.unsuspend;s.unsuspend=null,y()}},(s.imgBytes>oy?50:800)+l);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function Yh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xh(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Wh=null;function Xh(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Wh=new Map,l.forEach(JM,s),Wh=null,Yh.call(s))}function JM(s,l){if(!(l.state.loading&4)){var c=Wh.get(s);if(c)var h=c.get(null);else{c=new Map,Wh.set(s,c);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var C=m[y];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(c.set(C.dataset.precedence,C),h=C)}h&&c.set(null,h)}m=l.instance,C=m.getAttribute("data-precedence"),y=c.get(C)||h,y===h&&c.set(null,m),c.set(C,m),this.count++,h=Yh.bind(this),m.addEventListener("load",h),m.addEventListener("error",h),y?y.parentNode.insertBefore(m,y.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),l.state.loading|=4}}var Ou={$$typeof:N,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function eN(s,l,c,h,m,y,C,O,I){this.tag=1,this.containerInfo=s,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=h,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function pw(s,l,c,h,m,y,C,O,I,W,oe,ue){return s=new eN(s,l,c,C,I,W,oe,ue,O),l=1,y===!0&&(l|=24),y=Pi(3,null,null,l),s.current=y,y.stateNode=s,l=Vm(),l.refCount++,s.pooledCache=l,l.refCount++,y.memoizedState={element:h,isDehydrated:c,cache:l},Fm(y),s}function mw(s){return s?(s=Aa,s):Aa}function gw(s,l,c,h,m,y){m=mw(m),h.context===null?h.context=m:h.pendingContext=m,h=cl(l),h.payload={element:c},y=y===void 0?null:y,y!==null&&(h.callback=y),c=ul(s,h,l),c!==null&&(Ei(c,s,l),ou(c,s,l))}function yw(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<l?c:l}}function ay(s,l){yw(s,l),(s=s.alternate)&&yw(s,l)}function bw(s){if(s.tag===13||s.tag===31){var l=bo(s,67108864);l!==null&&Ei(l,s,67108864),ay(s,67108864)}}function vw(s){if(s.tag===13||s.tag===31){var l=qi();l=ys(l);var c=bo(s,l);c!==null&&Ei(c,s,l),ay(s,l)}}var $h=!0;function tN(s,l,c,h){var m=z.T;z.T=null;var y=Q.p;try{Q.p=2,cy(s,l,c,h)}finally{Q.p=y,z.T=m}}function nN(s,l,c,h){var m=z.T;z.T=null;var y=Q.p;try{Q.p=8,cy(s,l,c,h)}finally{Q.p=y,z.T=m}}function cy(s,l,c,h){if($h){var m=uy(h);if(m===null)Wg(s,l,h,Zh,c),Sw(s,h);else if(sN(m,s,l,c,h))h.stopPropagation();else if(Sw(s,h),l&4&&-1<iN.indexOf(s)){for(;m!==null;){var y=Yr(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var C=it(y.pendingLanes);if(C!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;C;){var I=1<<31-Pt(C);O.entanglements[1]|=I,C&=~I}qs(y),(Nt&6)===0&&(Bh=Ae()+500,Cu(0))}}break;case 31:case 13:O=bo(y,2),O!==null&&Ei(O,y,2),zh(),ay(y,2)}if(y=uy(h),y===null&&Wg(s,l,h,Zh,c),y===m)break;m=y}m!==null&&h.stopPropagation()}else Wg(s,l,h,null,c)}}function uy(s){return s=hm(s),fy(s)}var Zh=null;function fy(s){if(Zh=null,s=Ps(s),s!==null){var l=o(s);if(l===null)s=null;else{var c=l.tag;if(c===13){if(s=a(l),s!==null)return s;s=null}else if(c===31){if(s=u(l),s!==null)return s;s=null}else if(c===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return Zh=s,null}function xw(s){switch(s){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(Ce()){case Ze:return 2;case nt:return 8;case _e:case rt:return 32;case at:return 268435456;default:return 32}default:return 32}}var hy=!1,Sl=null,wl=null,Cl=null,Mu=new Map,Nu=new Map,kl=[],iN="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 Sw(s,l){switch(s){case"focusin":case"focusout":Sl=null;break;case"dragenter":case"dragleave":wl=null;break;case"mouseover":case"mouseout":Cl=null;break;case"pointerover":case"pointerout":Mu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nu.delete(l.pointerId)}}function Du(s,l,c,h,m,y){return s===null||s.nativeEvent!==y?(s={blockedOn:l,domEventName:c,eventSystemFlags:h,nativeEvent:y,targetContainers:[m]},l!==null&&(l=Yr(l),l!==null&&bw(l)),s):(s.eventSystemFlags|=h,l=s.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),s)}function sN(s,l,c,h,m){switch(l){case"focusin":return Sl=Du(Sl,s,l,c,h,m),!0;case"dragenter":return wl=Du(wl,s,l,c,h,m),!0;case"mouseover":return Cl=Du(Cl,s,l,c,h,m),!0;case"pointerover":var y=m.pointerId;return Mu.set(y,Du(Mu.get(y)||null,s,l,c,h,m)),!0;case"gotpointercapture":return y=m.pointerId,Nu.set(y,Du(Nu.get(y)||null,s,l,c,h,m)),!0}return!1}function ww(s){var l=Ps(s.target);if(l!==null){var c=o(l);if(c!==null){if(l=c.tag,l===13){if(l=a(c),l!==null){s.blockedOn=l,fr(s.priority,function(){vw(c)});return}}else if(l===31){if(l=u(c),l!==null){s.blockedOn=l,fr(s.priority,function(){vw(c)});return}}else if(l===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Jh(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var c=uy(s.nativeEvent);if(c===null){c=s.nativeEvent;var h=new c.constructor(c.type,c);Wf=h,c.target.dispatchEvent(h),Wf=null}else return l=Yr(c),l!==null&&bw(l),s.blockedOn=c,!1;l.shift()}return!0}function Cw(s,l,c){Jh(s)&&c.delete(l)}function rN(){hy=!1,Sl!==null&&Jh(Sl)&&(Sl=null),wl!==null&&Jh(wl)&&(wl=null),Cl!==null&&Jh(Cl)&&(Cl=null),Mu.forEach(Cw),Nu.forEach(Cw)}function ed(s,l){s.blockedOn===l&&(s.blockedOn=null,hy||(hy=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,rN)))}var td=null;function kw(s){td!==s&&(td=s,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){td===s&&(td=null);for(var l=0;l<s.length;l+=3){var c=s[l],h=s[l+1],m=s[l+2];if(typeof h!="function"){if(fy(h||c)===null)continue;break}var y=Yr(c);y!==null&&(s.splice(l,3),l-=3,ug(y,{pending:!0,data:m,method:c.method,action:h},h,m))}}))}function Wa(s){function l(I){return ed(I,s)}Sl!==null&&ed(Sl,s),wl!==null&&ed(wl,s),Cl!==null&&ed(Cl,s),Mu.forEach(l),Nu.forEach(l);for(var c=0;c<kl.length;c++){var h=kl[c];h.blockedOn===s&&(h.blockedOn=null)}for(;0<kl.length&&(c=kl[0],c.blockedOn===null);)ww(c),c.blockedOn===null&&kl.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(h=0;h<c.length;h+=3){var m=c[h],y=c[h+1],C=m[rn]||null;if(typeof y=="function")C||kw(c);else if(C){var O=null;if(y&&y.hasAttribute("formAction")){if(m=y,C=y[rn]||null)O=C.formAction;else if(fy(m)!==null)continue}else O=C.action;typeof O=="function"?c[h+1]=O:(c.splice(h,3),h-=3),kw(c)}}}function Aw(){function s(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(C){return m=C})},focusReset:"manual",scroll:"manual"})}function l(){m!==null&&(m(),m=null),h||setTimeout(c,20)}function c(){if(!h&&!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 h=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(c,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),m!==null&&(m(),m=null)}}}function dy(s){this._internalRoot=s}nd.prototype.render=dy.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(i(409));var c=l.current,h=qi();gw(c,h,s,l,null,null)},nd.prototype.unmount=dy.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;gw(s.current,2,null,s,null,null),zh(),l[Tn]=null}};function nd(s){this._internalRoot=s}nd.prototype.unstable_scheduleHydration=function(s){if(s){var l=Is();s={blockedOn:null,target:s,priority:l};for(var c=0;c<kl.length&&l!==0&&l<kl[c].priority;c++);kl.splice(c,0,s),c===0&&ww(s)}};var Ew=e.version;if(Ew!=="19.2.7")throw Error(i(527,Ew,"19.2.7"));Q.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=d(l),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var lN={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var id=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!id.isDisabled&&id.supportsFiber)try{ht=id.inject(lN),Ue=id}catch{}}return Bu.createRoot=function(s,l){if(!r(s))throw Error(i(299));var c=!1,h="",m=j1,y=B1,C=L1;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(h=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError)),l=pw(s,1,!1,null,null,c,h,null,m,y,C,Aw),s[Tn]=l.current,Yg(s),new dy(l)},Bu.hydrateRoot=function(s,l,c){if(!r(s))throw Error(i(299));var h=!1,m="",y=j1,C=B1,O=L1,I=null;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(C=c.onCaughtError),c.onRecoverableError!==void 0&&(O=c.onRecoverableError),c.formState!==void 0&&(I=c.formState)),l=pw(s,1,!0,l,c??null,h,m,I,y,C,O,Aw),l.context=mw(null),c=l.current,h=qi(),h=ys(h),m=cl(h),m.callback=null,ul(c,m,h),c=h,l.current.lanes=c,oi(l,c),qs(l),s[Tn]=l.current,Yg(s),new nd(l)},Bu.version="19.2.7",Bu}var Iw;function vN(){if(Iw)return yy.exports;Iw=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),yy.exports=bN(),yy.exports}var xN=vN(),Sy={exports:{}},wy={};/**
|
|
48
|
+
`+h.stack}}var De=Object.prototype.hasOwnProperty,qe=n.unstable_scheduleCallback,je=n.unstable_cancelCallback,Te=n.unstable_shouldYield,we=n.unstable_requestPaint,Ae=n.unstable_now,Ce=n.unstable_getCurrentPriorityLevel,Ze=n.unstable_ImmediatePriority,nt=n.unstable_UserBlockingPriority,_e=n.unstable_NormalPriority,rt=n.unstable_LowPriority,at=n.unstable_IdlePriority,Lt=n.log,nn=n.unstable_setDisableYieldValue,ht=null,Ue=null;function Jt(s){if(typeof Lt=="function"&&nn(s),Ue&&typeof Ue.setStrictMode=="function")try{Ue.setStrictMode(ht,s)}catch{}}var Pt=Math.clz32?Math.clz32:At,es=Math.log,dn=Math.LN2;function At(s){return s>>>=0,s===0?32:31-(es(s)/dn|0)|0}var st=256,pn=262144,Ge=4194304;function it(s){var l=s&42;if(l!==0)return l;switch(s&-s){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 s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Et(s,l,c){var h=s.pendingLanes;if(h===0)return 0;var m=0,y=s.suspendedLanes,C=s.pingedLanes;s=s.warmLanes;var O=h&134217727;return O!==0?(h=O&~y,h!==0?m=it(h):(C&=O,C!==0?m=it(C):c||(c=O&~s,c!==0&&(m=it(c))))):(O=h&~y,O!==0?m=it(O):C!==0?m=it(C):c||(c=h&~s,c!==0&&(m=it(c)))),m===0?0:l!==0&&l!==m&&(l&y)===0&&(y=m&-m,c=l&-l,y>=c||y===32&&(c&4194048)!==0)?l:m}function Qt(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function sn(s,l){switch(s){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 Rn(){var s=Ge;return Ge<<=1,(Ge&62914560)===0&&(Ge=4194304),s}function Un(s){for(var l=[],c=0;31>c;c++)l.push(s);return l}function oi(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function ai(s,l,c,h,m,y){var C=s.pendingLanes;s.pendingLanes=c,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=c,s.entangledLanes&=c,s.errorRecoveryDisabledLanes&=c,s.shellSuspendCounter=0;var O=s.entanglements,I=s.expirationTimes,W=s.hiddenUpdates;for(c=C&~c;0<c;){var oe=31-Pt(c),ue=1<<oe;O[oe]=0,I[oe]=-1;var Z=W[oe];if(Z!==null)for(W[oe]=null,oe=0;oe<Z.length;oe++){var re=Z[oe];re!==null&&(re.lane&=-536870913)}c&=~ue}h!==0&<(s,h,0),y!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=y&~(C&~l))}function lt(s,l,c){s.pendingLanes|=l,s.suspendedLanes&=~l;var h=31-Pt(l);s.entangledLanes|=l,s.entanglements[h]=s.entanglements[h]|1073741824|c&261930}function ts(s,l){var c=s.entangledLanes|=l;for(s=s.entanglements;c;){var h=31-Pt(c),m=1<<h;m&l|s[h]&l&&(s[h]|=l),c&=~m}}function ur(s,l){var c=l&-l;return c=(c&42)!==0?1:ys(c),(c&(s.suspendedLanes|l))!==0?0:c}function ys(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=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:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function zs(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function Is(){var s=Q.p;return s!==0?s:(s=window.event,s===void 0?32:Sw(s.type))}function fr(s,l){var c=Q.p;try{return Q.p=s,l()}finally{Q.p=c}}var qn=Math.random().toString(36).slice(2),Ut="__reactFiber$"+qn,rn="__reactProps$"+qn,Tn="__reactContainer$"+qn,yi="__reactEvents$"+qn,cm="__reactListeners$"+qn,Ff="__reactHandles$"+qn,Gf="__reactResources$"+qn,hr="__reactMarker$"+qn;function ma(s){delete s[Ut],delete s[rn],delete s[yi],delete s[cm],delete s[Ff]}function Ps(s){var l=s[Ut];if(l)return l;for(var c=s.parentNode;c;){if(l=c[Tn]||c[Ut]){if(c=l.alternate,l.child!==null||c!==null&&c.child!==null)for(s=rw(s);s!==null;){if(c=s[Ut])return c;s=rw(s)}return l}s=c,c=s.parentNode}return null}function Yr(s){if(s=s[Ut]||s[Tn]){var l=s.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return s}return null}function Hs(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(i(33))}function Wr(s){var l=s[Gf];return l||(l=s[Gf]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function Ot(s){s[hr]=!0}var ci=new Set,Xr={};function bi(s,l){$r(s,l),$r(s+"Capture",l)}function $r(s,l){for(Xr[s]=l,s=0;s<l.length;s++)ci.add(l[s])}var Uc=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]*$"),ga={},Qf={};function ya(s){return De.call(Qf,s)?!0:De.call(ga,s)?!1:Uc.test(s)?Qf[s]=!0:(ga[s]=!0,!1)}function Zr(s,l,c){if(ya(l))if(c===null)s.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var h=l.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+c)}}function Jr(s,l,c){if(c===null)s.removeAttribute(l);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+c)}}function bs(s,l,c,h){if(h===null)s.removeAttribute(c);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(c);return}s.setAttributeNS(l,c,""+h)}}function vi(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function Kf(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function um(s,l,c){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,l);if(!s.hasOwnProperty(l)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var m=h.get,y=h.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return m.call(this)},set:function(C){c=""+C,y.call(this,C)}}),Object.defineProperty(s,l,{enumerable:h.enumerable}),{getValue:function(){return c},setValue:function(C){c=""+C},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function po(s){if(!s._valueTracker){var l=Kf(s)?"checked":"value";s._valueTracker=um(s,l,""+s[l])}}function ba(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var c=l.getValue(),h="";return s&&(h=Kf(s)?s.checked?"true":"false":s.value),s=h,s!==c?(l.setValue(s),!0):!1}function el(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var fm=/[\n"\\]/g;function xi(s){return s.replace(fm,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function qc(s,l,c,h,m,y,C,O){s.name="",C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?s.type=C:s.removeAttribute("type"),l!=null?C==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+vi(l)):s.value!==""+vi(l)&&(s.value=""+vi(l)):C!=="submit"&&C!=="reset"||s.removeAttribute("value"),l!=null?Fc(s,C,vi(l)):c!=null?Fc(s,C,vi(c)):h!=null&&s.removeAttribute("value"),m==null&&y!=null&&(s.defaultChecked=!!y),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),O!=null&&typeof O!="function"&&typeof O!="symbol"&&typeof O!="boolean"?s.name=""+vi(O):s.removeAttribute("name")}function Yf(s,l,c,h,m,y,C,O){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(s.type=y),l!=null||c!=null){if(!(y!=="submit"&&y!=="reset"||l!=null)){po(s);return}c=c!=null?""+vi(c):"",l=l!=null?""+vi(l):c,O||l===s.value||(s.value=l),s.defaultValue=l}h=h??m,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=O?s.checked:!!h,s.defaultChecked=!!h,C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"&&(s.name=C),po(s)}function Fc(s,l,c){l==="number"&&el(s.ownerDocument)===s||s.defaultValue===""+c||(s.defaultValue=""+c)}function tl(s,l,c,h){if(s=s.options,l){l={};for(var m=0;m<c.length;m++)l["$"+c[m]]=!0;for(c=0;c<s.length;c++)m=l.hasOwnProperty("$"+s[c].value),s[c].selected!==m&&(s[c].selected=m),m&&h&&(s[c].defaultSelected=!0)}else{for(c=""+vi(c),l=null,m=0;m<s.length;m++){if(s[m].value===c){s[m].selected=!0,h&&(s[m].defaultSelected=!0);return}l!==null||s[m].disabled||(l=s[m])}l!==null&&(l.selected=!0)}}function Me(s,l,c){if(l!=null&&(l=""+vi(l),l!==s.value&&(s.value=l),c==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=c!=null?""+vi(c):""}function Ke(s,l,c,h){if(l==null){if(h!=null){if(c!=null)throw Error(i(92));if(H(h)){if(1<h.length)throw Error(i(93));h=h[0]}c=h}c==null&&(c=""),l=c}c=vi(l),s.defaultValue=c,h=s.textContent,h===c&&h!==""&&h!==null&&(s.value=h),po(s)}function Je(s,l){if(l){var c=s.firstChild;if(c&&c===s.lastChild&&c.nodeType===3){c.nodeValue=l;return}}s.textContent=l}var Mt=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 ln(s,l,c){var h=l.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?h?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":h?s.setProperty(l,c):typeof c!="number"||c===0||Mt.has(l)?l==="float"?s.cssFloat=c:s[l]=(""+c).trim():s[l]=c+"px"}function On(s,l,c){if(l!=null&&typeof l!="object")throw Error(i(62));if(s=s.style,c!=null){for(var h in c)!c.hasOwnProperty(h)||l!=null&&l.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var m in l)h=l[m],l.hasOwnProperty(m)&&c[m]!==h&&ln(s,m,h)}else for(var y in l)l.hasOwnProperty(y)&&ln(s,y,l[y])}function vs(s){if(s.indexOf("-")===-1)return!1;switch(s){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 nl=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"]]),dr=/^[\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 Gc(s){return dr.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function xs(){}var Wf=null;function hm(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var va=null,xa=null;function Xv(s){var l=Yr(s);if(l&&(s=l.stateNode)){var c=s[rn]||null;e:switch(s=l.stateNode,l.type){case"input":if(qc(s,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),l=c.name,c.type==="radio"&&l!=null){for(c=s;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+xi(""+l)+'"][type="radio"]'),l=0;l<c.length;l++){var h=c[l];if(h!==s&&h.form===s.form){var m=h[rn]||null;if(!m)throw Error(i(90));qc(h,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(l=0;l<c.length;l++)h=c[l],h.form===s.form&&ba(h)}break e;case"textarea":Me(s,c.value,c.defaultValue);break e;case"select":l=c.value,l!=null&&tl(s,!!c.multiple,l,!1)}}}var dm=!1;function $v(s,l,c){if(dm)return s(l,c);dm=!0;try{var h=s(l);return h}finally{if(dm=!1,(va!==null||xa!==null)&&(zh(),va&&(l=va,s=xa,xa=va=null,Xv(l),s)))for(l=0;l<s.length;l++)Xv(s[l])}}function Qc(s,l){var c=s.stateNode;if(c===null)return null;var h=c[rn]||null;if(h===null)return null;c=h[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":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(c&&typeof c!="function")throw Error(i(231,l,typeof c));return c}var pr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),pm=!1;if(pr)try{var Kc={};Object.defineProperty(Kc,"passive",{get:function(){pm=!0}}),window.addEventListener("test",Kc,Kc),window.removeEventListener("test",Kc,Kc)}catch{pm=!1}var il=null,mm=null,Xf=null;function Zv(){if(Xf)return Xf;var s,l=mm,c=l.length,h,m="value"in il?il.value:il.textContent,y=m.length;for(s=0;s<c&&l[s]===m[s];s++);var C=c-s;for(h=1;h<=C&&l[c-h]===m[y-h];h++);return Xf=m.slice(s,1<h?1-h:void 0)}function $f(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function Zf(){return!0}function Jv(){return!1}function Si(s){function l(c,h,m,y,C){this._reactName=c,this._targetInst=m,this.type=h,this.nativeEvent=y,this.target=C,this.currentTarget=null;for(var O in s)s.hasOwnProperty(O)&&(c=s[O],this[O]=c?c(y):y[O]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?Zf:Jv,this.isPropagationStopped=Jv,this}return g(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=Zf)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=Zf)},persist:function(){},isPersistent:Zf}),l}var mo={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Jf=Si(mo),Yc=g({},mo,{view:0,detail:0}),oO=Si(Yc),gm,ym,Wc,eh=g({},Yc,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:vm,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Wc&&(Wc&&s.type==="mousemove"?(gm=s.screenX-Wc.screenX,ym=s.screenY-Wc.screenY):ym=gm=0,Wc=s),gm)},movementY:function(s){return"movementY"in s?s.movementY:ym}}),ex=Si(eh),aO=g({},eh,{dataTransfer:0}),cO=Si(aO),uO=g({},Yc,{relatedTarget:0}),bm=Si(uO),fO=g({},mo,{animationName:0,elapsedTime:0,pseudoElement:0}),hO=Si(fO),dO=g({},mo,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),pO=Si(dO),mO=g({},mo,{data:0}),tx=Si(mO),gO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},yO={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"},bO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function vO(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=bO[s])?!!l[s]:!1}function vm(){return vO}var xO=g({},Yc,{key:function(s){if(s.key){var l=gO[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=$f(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?yO[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:vm,charCode:function(s){return s.type==="keypress"?$f(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?$f(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),SO=Si(xO),wO=g({},eh,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),nx=Si(wO),CO=g({},Yc,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:vm}),kO=Si(CO),AO=g({},mo,{propertyName:0,elapsedTime:0,pseudoElement:0}),EO=Si(AO),RO=g({},eh,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),TO=Si(RO),OO=g({},mo,{newState:0,oldState:0}),MO=Si(OO),NO=[9,13,27,32],xm=pr&&"CompositionEvent"in window,Xc=null;pr&&"documentMode"in document&&(Xc=document.documentMode);var DO=pr&&"TextEvent"in window&&!Xc,ix=pr&&(!xm||Xc&&8<Xc&&11>=Xc),sx=" ",rx=!1;function lx(s,l){switch(s){case"keyup":return NO.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ox(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var Sa=!1;function jO(s,l){switch(s){case"compositionend":return ox(l);case"keypress":return l.which!==32?null:(rx=!0,sx);case"textInput":return s=l.data,s===sx&&rx?null:s;default:return null}}function BO(s,l){if(Sa)return s==="compositionend"||!xm&&lx(s,l)?(s=Zv(),Xf=mm=il=null,Sa=!1,s):null;switch(s){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 ix&&l.locale!=="ko"?null:l.data;default:return null}}var LO={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 ax(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!LO[s.type]:l==="textarea"}function cx(s,l,c,h){va?xa?xa.push(h):xa=[h]:va=h,l=qh(l,"onChange"),0<l.length&&(c=new Jf("onChange","change",null,c,h),s.push({event:c,listeners:l}))}var $c=null,Zc=null;function zO(s){GS(s,0)}function th(s){var l=Hs(s);if(ba(l))return s}function ux(s,l){if(s==="change")return l}var fx=!1;if(pr){var Sm;if(pr){var wm="oninput"in document;if(!wm){var hx=document.createElement("div");hx.setAttribute("oninput","return;"),wm=typeof hx.oninput=="function"}Sm=wm}else Sm=!1;fx=Sm&&(!document.documentMode||9<document.documentMode)}function dx(){$c&&($c.detachEvent("onpropertychange",px),Zc=$c=null)}function px(s){if(s.propertyName==="value"&&th(Zc)){var l=[];cx(l,Zc,s,hm(s)),$v(zO,l)}}function IO(s,l,c){s==="focusin"?(dx(),$c=l,Zc=c,$c.attachEvent("onpropertychange",px)):s==="focusout"&&dx()}function PO(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return th(Zc)}function HO(s,l){if(s==="click")return th(l)}function VO(s,l){if(s==="input"||s==="change")return th(l)}function _O(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var Ii=typeof Object.is=="function"?Object.is:_O;function Jc(s,l){if(Ii(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var c=Object.keys(s),h=Object.keys(l);if(c.length!==h.length)return!1;for(h=0;h<c.length;h++){var m=c[h];if(!De.call(l,m)||!Ii(s[m],l[m]))return!1}return!0}function mx(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function gx(s,l){var c=mx(s);s=0;for(var h;c;){if(c.nodeType===3){if(h=s+c.textContent.length,s<=l&&h>=l)return{node:c,offset:l-s};s=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=mx(c)}}function yx(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?yx(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function bx(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=el(s.document);l instanceof s.HTMLIFrameElement;){try{var c=typeof l.contentWindow.location.href=="string"}catch{c=!1}if(c)s=l.contentWindow;else break;l=el(s.document)}return l}function Cm(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var UO=pr&&"documentMode"in document&&11>=document.documentMode,wa=null,km=null,eu=null,Am=!1;function vx(s,l,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Am||wa==null||wa!==el(h)||(h=wa,"selectionStart"in h&&Cm(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),eu&&Jc(eu,h)||(eu=h,h=qh(km,"onSelect"),0<h.length&&(l=new Jf("onSelect","select",null,l,c),s.push({event:l,listeners:h}),l.target=wa)))}function go(s,l){var c={};return c[s.toLowerCase()]=l.toLowerCase(),c["Webkit"+s]="webkit"+l,c["Moz"+s]="moz"+l,c}var Ca={animationend:go("Animation","AnimationEnd"),animationiteration:go("Animation","AnimationIteration"),animationstart:go("Animation","AnimationStart"),transitionrun:go("Transition","TransitionRun"),transitionstart:go("Transition","TransitionStart"),transitioncancel:go("Transition","TransitionCancel"),transitionend:go("Transition","TransitionEnd")},Em={},xx={};pr&&(xx=document.createElement("div").style,"AnimationEvent"in window||(delete Ca.animationend.animation,delete Ca.animationiteration.animation,delete Ca.animationstart.animation),"TransitionEvent"in window||delete Ca.transitionend.transition);function yo(s){if(Em[s])return Em[s];if(!Ca[s])return s;var l=Ca[s],c;for(c in l)if(l.hasOwnProperty(c)&&c in xx)return Em[s]=l[c];return s}var Sx=yo("animationend"),wx=yo("animationiteration"),Cx=yo("animationstart"),qO=yo("transitionrun"),FO=yo("transitionstart"),GO=yo("transitioncancel"),kx=yo("transitionend"),Ax=new Map,Rm="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(" ");Rm.push("scrollEnd");function Ss(s,l){Ax.set(s,l),bi(l,[s])}var nh=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},ns=[],ka=0,Tm=0;function ih(){for(var s=ka,l=Tm=ka=0;l<s;){var c=ns[l];ns[l++]=null;var h=ns[l];ns[l++]=null;var m=ns[l];ns[l++]=null;var y=ns[l];if(ns[l++]=null,h!==null&&m!==null){var C=h.pending;C===null?m.next=m:(m.next=C.next,C.next=m),h.pending=m}y!==0&&Ex(c,m,y)}}function sh(s,l,c,h){ns[ka++]=s,ns[ka++]=l,ns[ka++]=c,ns[ka++]=h,Tm|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function Om(s,l,c,h){return sh(s,l,c,h),rh(s)}function bo(s,l){return sh(s,null,null,l),rh(s)}function Ex(s,l,c){s.lanes|=c;var h=s.alternate;h!==null&&(h.lanes|=c);for(var m=!1,y=s.return;y!==null;)y.childLanes|=c,h=y.alternate,h!==null&&(h.childLanes|=c),y.tag===22&&(s=y.stateNode,s===null||s._visibility&1||(m=!0)),s=y,y=y.return;return s.tag===3?(y=s.stateNode,m&&l!==null&&(m=31-Pt(c),s=y.hiddenUpdates,h=s[m],h===null?s[m]=[l]:h.push(l),l.lane=c|536870912),y):null}function rh(s){if(50<wu)throw wu=0,Pg=null,Error(i(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var Aa={};function QO(s,l,c,h){this.tag=s,this.key=c,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=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pi(s,l,c,h){return new QO(s,l,c,h)}function Mm(s){return s=s.prototype,!(!s||!s.isReactComponent)}function mr(s,l){var c=s.alternate;return c===null?(c=Pi(s.tag,l,s.key,s.mode),c.elementType=s.elementType,c.type=s.type,c.stateNode=s.stateNode,c.alternate=s,s.alternate=c):(c.pendingProps=l,c.type=s.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=s.flags&65011712,c.childLanes=s.childLanes,c.lanes=s.lanes,c.child=s.child,c.memoizedProps=s.memoizedProps,c.memoizedState=s.memoizedState,c.updateQueue=s.updateQueue,l=s.dependencies,c.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},c.sibling=s.sibling,c.index=s.index,c.ref=s.ref,c.refCleanup=s.refCleanup,c}function Rx(s,l){s.flags&=65011714;var c=s.alternate;return c===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=c.childLanes,s.lanes=c.lanes,s.child=c.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=c.memoizedProps,s.memoizedState=c.memoizedState,s.updateQueue=c.updateQueue,s.type=c.type,l=c.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function lh(s,l,c,h,m,y){var C=0;if(h=s,typeof s=="function")Mm(s)&&(C=1);else if(typeof s=="string")C=$M(s,c,le.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case X:return s=Pi(31,c,l,m),s.elementType=X,s.lanes=y,s;case w:return vo(c.children,m,y,l);case E:C=8,m|=24;break;case k:return s=Pi(12,c,l,m|2),s.elementType=k,s.lanes=y,s;case B:return s=Pi(13,c,l,m),s.elementType=B,s.lanes=y,s;case L:return s=Pi(19,c,l,m),s.elementType=L,s.lanes=y,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case N:C=10;break e;case R:C=9;break e;case T:C=11;break e;case D:C=14;break e;case j:C=16,h=null;break e}C=29,c=Error(i(130,s===null?"null":typeof s,"")),h=null}return l=Pi(C,c,l,m),l.elementType=s,l.type=h,l.lanes=y,l}function vo(s,l,c,h){return s=Pi(7,s,h,l),s.lanes=c,s}function Nm(s,l,c){return s=Pi(6,s,null,l),s.lanes=c,s}function Tx(s){var l=Pi(18,null,null,0);return l.stateNode=s,l}function Dm(s,l,c){return l=Pi(4,s.children!==null?s.children:[],s.key,l),l.lanes=c,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var Ox=new WeakMap;function is(s,l){if(typeof s=="object"&&s!==null){var c=Ox.get(s);return c!==void 0?c:(l={value:s,source:l,stack:be(l)},Ox.set(s,l),l)}return{value:s,source:l,stack:be(l)}}var Ea=[],Ra=0,oh=null,tu=0,ss=[],rs=0,sl=null,Vs=1,_s="";function gr(s,l){Ea[Ra++]=tu,Ea[Ra++]=oh,oh=s,tu=l}function Mx(s,l,c){ss[rs++]=Vs,ss[rs++]=_s,ss[rs++]=sl,sl=s;var h=Vs;s=_s;var m=32-Pt(h)-1;h&=~(1<<m),c+=1;var y=32-Pt(l)+m;if(30<y){var C=m-m%5;y=(h&(1<<C)-1).toString(32),h>>=C,m-=C,Vs=1<<32-Pt(l)+m|c<<m|h,_s=y+s}else Vs=1<<y|c<<m|h,_s=s}function jm(s){s.return!==null&&(gr(s,1),Mx(s,1,0))}function Bm(s){for(;s===oh;)oh=Ea[--Ra],Ea[Ra]=null,tu=Ea[--Ra],Ea[Ra]=null;for(;s===sl;)sl=ss[--rs],ss[rs]=null,_s=ss[--rs],ss[rs]=null,Vs=ss[--rs],ss[rs]=null}function Nx(s,l){ss[rs++]=Vs,ss[rs++]=_s,ss[rs++]=sl,Vs=l.id,_s=l.overflow,sl=s}var Fn=null,Xt=null,xt=!1,rl=null,ls=!1,Lm=Error(i(519));function ll(s){var l=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw nu(is(l,s)),Lm}function Dx(s){var l=s.stateNode,c=s.type,h=s.memoizedProps;switch(l[Ut]=s,l[rn]=h,c){case"dialog":yt("cancel",l),yt("close",l);break;case"iframe":case"object":case"embed":yt("load",l);break;case"video":case"audio":for(c=0;c<ku.length;c++)yt(ku[c],l);break;case"source":yt("error",l);break;case"img":case"image":case"link":yt("error",l),yt("load",l);break;case"details":yt("toggle",l);break;case"input":yt("invalid",l),Yf(l,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":yt("invalid",l);break;case"textarea":yt("invalid",l),Ke(l,h.value,h.defaultValue,h.children)}c=h.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||l.textContent===""+c||h.suppressHydrationWarning===!0||WS(l.textContent,c)?(h.popover!=null&&(yt("beforetoggle",l),yt("toggle",l)),h.onScroll!=null&&yt("scroll",l),h.onScrollEnd!=null&&yt("scrollend",l),h.onClick!=null&&(l.onclick=xs),l=!0):l=!1,l||ll(s,!0)}function jx(s){for(Fn=s.return;Fn;)switch(Fn.tag){case 5:case 31:case 13:ls=!1;return;case 27:case 3:ls=!0;return;default:Fn=Fn.return}}function Ta(s){if(s!==Fn)return!1;if(!xt)return jx(s),xt=!0,!1;var l=s.tag,c;if((c=l!==3&&l!==27)&&((c=l===5)&&(c=s.type,c=!(c!=="form"&&c!=="button")||Jg(s.type,s.memoizedProps)),c=!c),c&&Xt&&ll(s),jx(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Xt=sw(s)}else if(l===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(317));Xt=sw(s)}else l===27?(l=Xt,xl(s.type)?(s=sy,sy=null,Xt=s):Xt=l):Xt=Fn?as(s.stateNode.nextSibling):null;return!0}function xo(){Xt=Fn=null,xt=!1}function zm(){var s=rl;return s!==null&&(Ai===null?Ai=s:Ai.push.apply(Ai,s),rl=null),s}function nu(s){rl===null?rl=[s]:rl.push(s)}var Im=M(null),So=null,yr=null;function ol(s,l,c){te(Im,l._currentValue),l._currentValue=c}function br(s){s._currentValue=Im.current,U(Im)}function Pm(s,l,c){for(;s!==null;){var h=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,h!==null&&(h.childLanes|=l)):h!==null&&(h.childLanes&l)!==l&&(h.childLanes|=l),s===c)break;s=s.return}}function Hm(s,l,c,h){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var y=m.dependencies;if(y!==null){var C=m.child;y=y.firstContext;e:for(;y!==null;){var O=y;y=m;for(var I=0;I<l.length;I++)if(O.context===l[I]){y.lanes|=c,O=y.alternate,O!==null&&(O.lanes|=c),Pm(y.return,c,s),h||(C=null);break e}y=O.next}}else if(m.tag===18){if(C=m.return,C===null)throw Error(i(341));C.lanes|=c,y=C.alternate,y!==null&&(y.lanes|=c),Pm(C,c,s),C=null}else C=m.child;if(C!==null)C.return=m;else for(C=m;C!==null;){if(C===s){C=null;break}if(m=C.sibling,m!==null){m.return=C.return,C=m;break}C=C.return}m=C}}function Oa(s,l,c,h){s=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 C=m.alternate;if(C===null)throw Error(i(387));if(C=C.memoizedProps,C!==null){var O=m.type;Ii(m.pendingProps.value,C.value)||(s!==null?s.push(O):s=[O])}}else if(m===he.current){if(C=m.alternate,C===null)throw Error(i(387));C.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Ou):s=[Ou])}m=m.return}s!==null&&Hm(l,s,c,h),l.flags|=262144}function ah(s){for(s=s.firstContext;s!==null;){if(!Ii(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function wo(s){So=s,yr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Gn(s){return Bx(So,s)}function ch(s,l){return So===null&&wo(s),Bx(s,l)}function Bx(s,l){var c=l._currentValue;if(l={context:l,memoizedValue:c,next:null},yr===null){if(s===null)throw Error(i(308));yr=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else yr=yr.next=l;return c}var KO=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(c,h){s.push(h)}};this.abort=function(){l.aborted=!0,s.forEach(function(c){return c()})}},YO=n.unstable_scheduleCallback,WO=n.unstable_NormalPriority,Cn={$$typeof:N,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Vm(){return{controller:new KO,data:new Map,refCount:0}}function iu(s){s.refCount--,s.refCount===0&&YO(WO,function(){s.controller.abort()})}var su=null,_m=0,Ma=0,Na=null;function XO(s,l){if(su===null){var c=su=[];_m=0,Ma=Fg(),Na={status:"pending",value:void 0,then:function(h){c.push(h)}}}return _m++,l.then(Lx,Lx),l}function Lx(){if(--_m===0&&su!==null){Na!==null&&(Na.status="fulfilled");var s=su;su=null,Ma=0,Na=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function $O(s,l){var c=[],h={status:"pending",value:null,reason:null,then:function(m){c.push(m)}};return s.then(function(){h.status="fulfilled",h.value=l;for(var m=0;m<c.length;m++)(0,c[m])(l)},function(m){for(h.status="rejected",h.reason=m,m=0;m<c.length;m++)(0,c[m])(void 0)}),h}var zx=z.S;z.S=function(s,l){vS=Ae(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&XO(s,l),zx!==null&&zx(s,l)};var Co=M(null);function Um(){var s=Co.current;return s!==null?s:qt.pooledCache}function uh(s,l){l===null?te(Co,Co.current):te(Co,l.pool)}function Ix(){var s=Um();return s===null?null:{parent:Cn._currentValue,pool:s}}var Da=Error(i(460)),qm=Error(i(474)),fh=Error(i(542)),hh={then:function(){}};function Px(s){return s=s.status,s==="fulfilled"||s==="rejected"}function Hx(s,l,c){switch(c=s[c],c===void 0?s.push(l):c!==l&&(l.then(xs,xs),l=c),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,_x(s),s;default:if(typeof l.status=="string")l.then(xs,xs);else{if(s=qt,s!==null&&100<s.shellSuspendCounter)throw Error(i(482));s=l,s.status="pending",s.then(function(h){if(l.status==="pending"){var m=l;m.status="fulfilled",m.value=h}},function(h){if(l.status==="pending"){var m=l;m.status="rejected",m.reason=h}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,_x(s),s}throw Ao=l,Da}}function ko(s){try{var l=s._init;return l(s._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(Ao=c,Da):c}}var Ao=null;function Vx(){if(Ao===null)throw Error(i(459));var s=Ao;return Ao=null,s}function _x(s){if(s===Da||s===fh)throw Error(i(483))}var ja=null,ru=0;function dh(s){var l=ru;return ru+=1,ja===null&&(ja=[]),Hx(ja,s,l)}function lu(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function ph(s,l){throw l.$$typeof===b?Error(i(525)):(s=Object.prototype.toString.call(l),Error(i(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function Ux(s){function l(q,_){if(s){var Y=q.deletions;Y===null?(q.deletions=[_],q.flags|=16):Y.push(_)}}function c(q,_){if(!s)return null;for(;_!==null;)l(q,_),_=_.sibling;return null}function h(q){for(var _=new Map;q!==null;)q.key!==null?_.set(q.key,q):_.set(q.index,q),q=q.sibling;return _}function m(q,_){return q=mr(q,_),q.index=0,q.sibling=null,q}function y(q,_,Y){return q.index=Y,s?(Y=q.alternate,Y!==null?(Y=Y.index,Y<_?(q.flags|=67108866,_):Y):(q.flags|=67108866,_)):(q.flags|=1048576,_)}function C(q){return s&&q.alternate===null&&(q.flags|=67108866),q}function O(q,_,Y,ce){return _===null||_.tag!==6?(_=Nm(Y,q.mode,ce),_.return=q,_):(_=m(_,Y),_.return=q,_)}function I(q,_,Y,ce){var Xe=Y.type;return Xe===w?oe(q,_,Y.props.children,ce,Y.key):_!==null&&(_.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===j&&ko(Xe)===_.type)?(_=m(_,Y.props),lu(_,Y),_.return=q,_):(_=lh(Y.type,Y.key,Y.props,null,q.mode,ce),lu(_,Y),_.return=q,_)}function W(q,_,Y,ce){return _===null||_.tag!==4||_.stateNode.containerInfo!==Y.containerInfo||_.stateNode.implementation!==Y.implementation?(_=Dm(Y,q.mode,ce),_.return=q,_):(_=m(_,Y.children||[]),_.return=q,_)}function oe(q,_,Y,ce,Xe){return _===null||_.tag!==7?(_=vo(Y,q.mode,ce,Xe),_.return=q,_):(_=m(_,Y),_.return=q,_)}function ue(q,_,Y){if(typeof _=="string"&&_!==""||typeof _=="number"||typeof _=="bigint")return _=Nm(""+_,q.mode,Y),_.return=q,_;if(typeof _=="object"&&_!==null){switch(_.$$typeof){case v:return Y=lh(_.type,_.key,_.props,null,q.mode,Y),lu(Y,_),Y.return=q,Y;case S:return _=Dm(_,q.mode,Y),_.return=q,_;case j:return _=ko(_),ue(q,_,Y)}if(H(_)||K(_))return _=vo(_,q.mode,Y,null),_.return=q,_;if(typeof _.then=="function")return ue(q,dh(_),Y);if(_.$$typeof===N)return ue(q,ch(q,_),Y);ph(q,_)}return null}function Z(q,_,Y,ce){var Xe=_!==null?_.key:null;if(typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint")return Xe!==null?null:O(q,_,""+Y,ce);if(typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:return Y.key===Xe?I(q,_,Y,ce):null;case S:return Y.key===Xe?W(q,_,Y,ce):null;case j:return Y=ko(Y),Z(q,_,Y,ce)}if(H(Y)||K(Y))return Xe!==null?null:oe(q,_,Y,ce,null);if(typeof Y.then=="function")return Z(q,_,dh(Y),ce);if(Y.$$typeof===N)return Z(q,_,ch(q,Y),ce);ph(q,Y)}return null}function re(q,_,Y,ce,Xe){if(typeof ce=="string"&&ce!==""||typeof ce=="number"||typeof ce=="bigint")return q=q.get(Y)||null,O(_,q,""+ce,Xe);if(typeof ce=="object"&&ce!==null){switch(ce.$$typeof){case v:return q=q.get(ce.key===null?Y:ce.key)||null,I(_,q,ce,Xe);case S:return q=q.get(ce.key===null?Y:ce.key)||null,W(_,q,ce,Xe);case j:return ce=ko(ce),re(q,_,Y,ce,Xe)}if(H(ce)||K(ce))return q=q.get(Y)||null,oe(_,q,ce,Xe,null);if(typeof ce.then=="function")return re(q,_,Y,dh(ce),Xe);if(ce.$$typeof===N)return re(q,_,Y,ch(_,ce),Xe);ph(_,ce)}return null}function Pe(q,_,Y,ce){for(var Xe=null,Rt=null,Fe=_,ut=_=0,vt=null;Fe!==null&&ut<Y.length;ut++){Fe.index>ut?(vt=Fe,Fe=null):vt=Fe.sibling;var Tt=Z(q,Fe,Y[ut],ce);if(Tt===null){Fe===null&&(Fe=vt);break}s&&Fe&&Tt.alternate===null&&l(q,Fe),_=y(Tt,_,ut),Rt===null?Xe=Tt:Rt.sibling=Tt,Rt=Tt,Fe=vt}if(ut===Y.length)return c(q,Fe),xt&&gr(q,ut),Xe;if(Fe===null){for(;ut<Y.length;ut++)Fe=ue(q,Y[ut],ce),Fe!==null&&(_=y(Fe,_,ut),Rt===null?Xe=Fe:Rt.sibling=Fe,Rt=Fe);return xt&&gr(q,ut),Xe}for(Fe=h(Fe);ut<Y.length;ut++)vt=re(Fe,q,ut,Y[ut],ce),vt!==null&&(s&&vt.alternate!==null&&Fe.delete(vt.key===null?ut:vt.key),_=y(vt,_,ut),Rt===null?Xe=vt:Rt.sibling=vt,Rt=vt);return s&&Fe.forEach(function(Al){return l(q,Al)}),xt&&gr(q,ut),Xe}function $e(q,_,Y,ce){if(Y==null)throw Error(i(151));for(var Xe=null,Rt=null,Fe=_,ut=_=0,vt=null,Tt=Y.next();Fe!==null&&!Tt.done;ut++,Tt=Y.next()){Fe.index>ut?(vt=Fe,Fe=null):vt=Fe.sibling;var Al=Z(q,Fe,Tt.value,ce);if(Al===null){Fe===null&&(Fe=vt);break}s&&Fe&&Al.alternate===null&&l(q,Fe),_=y(Al,_,ut),Rt===null?Xe=Al:Rt.sibling=Al,Rt=Al,Fe=vt}if(Tt.done)return c(q,Fe),xt&&gr(q,ut),Xe;if(Fe===null){for(;!Tt.done;ut++,Tt=Y.next())Tt=ue(q,Tt.value,ce),Tt!==null&&(_=y(Tt,_,ut),Rt===null?Xe=Tt:Rt.sibling=Tt,Rt=Tt);return xt&&gr(q,ut),Xe}for(Fe=h(Fe);!Tt.done;ut++,Tt=Y.next())Tt=re(Fe,q,ut,Tt.value,ce),Tt!==null&&(s&&Tt.alternate!==null&&Fe.delete(Tt.key===null?ut:Tt.key),_=y(Tt,_,ut),Rt===null?Xe=Tt:Rt.sibling=Tt,Rt=Tt);return s&&Fe.forEach(function(aN){return l(q,aN)}),xt&&gr(q,ut),Xe}function _t(q,_,Y,ce){if(typeof Y=="object"&&Y!==null&&Y.type===w&&Y.key===null&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case v:e:{for(var Xe=Y.key;_!==null;){if(_.key===Xe){if(Xe=Y.type,Xe===w){if(_.tag===7){c(q,_.sibling),ce=m(_,Y.props.children),ce.return=q,q=ce;break e}}else if(_.elementType===Xe||typeof Xe=="object"&&Xe!==null&&Xe.$$typeof===j&&ko(Xe)===_.type){c(q,_.sibling),ce=m(_,Y.props),lu(ce,Y),ce.return=q,q=ce;break e}c(q,_);break}else l(q,_);_=_.sibling}Y.type===w?(ce=vo(Y.props.children,q.mode,ce,Y.key),ce.return=q,q=ce):(ce=lh(Y.type,Y.key,Y.props,null,q.mode,ce),lu(ce,Y),ce.return=q,q=ce)}return C(q);case S:e:{for(Xe=Y.key;_!==null;){if(_.key===Xe)if(_.tag===4&&_.stateNode.containerInfo===Y.containerInfo&&_.stateNode.implementation===Y.implementation){c(q,_.sibling),ce=m(_,Y.children||[]),ce.return=q,q=ce;break e}else{c(q,_);break}else l(q,_);_=_.sibling}ce=Dm(Y,q.mode,ce),ce.return=q,q=ce}return C(q);case j:return Y=ko(Y),_t(q,_,Y,ce)}if(H(Y))return Pe(q,_,Y,ce);if(K(Y)){if(Xe=K(Y),typeof Xe!="function")throw Error(i(150));return Y=Xe.call(Y),$e(q,_,Y,ce)}if(typeof Y.then=="function")return _t(q,_,dh(Y),ce);if(Y.$$typeof===N)return _t(q,_,ch(q,Y),ce);ph(q,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,_!==null&&_.tag===6?(c(q,_.sibling),ce=m(_,Y),ce.return=q,q=ce):(c(q,_),ce=Nm(Y,q.mode,ce),ce.return=q,q=ce),C(q)):c(q,_)}return function(q,_,Y,ce){try{ru=0;var Xe=_t(q,_,Y,ce);return ja=null,Xe}catch(Fe){if(Fe===Da||Fe===fh)throw Fe;var Rt=Pi(29,Fe,null,q.mode);return Rt.lanes=ce,Rt.return=q,Rt}finally{}}}var Eo=Ux(!0),qx=Ux(!1),al=!1;function Fm(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Gm(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function cl(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function ul(s,l,c){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(Nt&2)!==0){var m=h.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),h.pending=l,l=rh(s),Ex(s,null,c),l}return sh(s,h,l,c),rh(s)}function ou(s,l,c){if(l=l.updateQueue,l!==null&&(l=l.shared,(c&4194048)!==0)){var h=l.lanes;h&=s.pendingLanes,c|=h,l.lanes=c,ts(s,c)}}function Qm(s,l){var c=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var m=null,y=null;if(c=c.firstBaseUpdate,c!==null){do{var C={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};y===null?m=y=C:y=y.next=C,c=c.next}while(c!==null);y===null?m=y=l:y=y.next=l}else m=y=l;c={baseState:h.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:h.shared,callbacks:h.callbacks},s.updateQueue=c;return}s=c.lastBaseUpdate,s===null?c.firstBaseUpdate=l:s.next=l,c.lastBaseUpdate=l}var Km=!1;function au(){if(Km){var s=Na;if(s!==null)throw s}}function cu(s,l,c,h){Km=!1;var m=s.updateQueue;al=!1;var y=m.firstBaseUpdate,C=m.lastBaseUpdate,O=m.shared.pending;if(O!==null){m.shared.pending=null;var I=O,W=I.next;I.next=null,C===null?y=W:C.next=W,C=I;var oe=s.alternate;oe!==null&&(oe=oe.updateQueue,O=oe.lastBaseUpdate,O!==C&&(O===null?oe.firstBaseUpdate=W:O.next=W,oe.lastBaseUpdate=I))}if(y!==null){var ue=m.baseState;C=0,oe=W=I=null,O=y;do{var Z=O.lane&-536870913,re=Z!==O.lane;if(re?(bt&Z)===Z:(h&Z)===Z){Z!==0&&Z===Ma&&(Km=!0),oe!==null&&(oe=oe.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var Pe=s,$e=O;Z=l;var _t=c;switch($e.tag){case 1:if(Pe=$e.payload,typeof Pe=="function"){ue=Pe.call(_t,ue,Z);break e}ue=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=$e.payload,Z=typeof Pe=="function"?Pe.call(_t,ue,Z):Pe,Z==null)break e;ue=g({},ue,Z);break e;case 2:al=!0}}Z=O.callback,Z!==null&&(s.flags|=64,re&&(s.flags|=8192),re=m.callbacks,re===null?m.callbacks=[Z]:re.push(Z))}else re={lane:Z,tag:O.tag,payload:O.payload,callback:O.callback,next:null},oe===null?(W=oe=re,I=ue):oe=oe.next=re,C|=Z;if(O=O.next,O===null){if(O=m.shared.pending,O===null)break;re=O,O=re.next,re.next=null,m.lastBaseUpdate=re,m.shared.pending=null}}while(!0);oe===null&&(I=ue),m.baseState=I,m.firstBaseUpdate=W,m.lastBaseUpdate=oe,y===null&&(m.shared.lanes=0),ml|=C,s.lanes=C,s.memoizedState=ue}}function Fx(s,l){if(typeof s!="function")throw Error(i(191,s));s.call(l)}function Gx(s,l){var c=s.callbacks;if(c!==null)for(s.callbacks=null,s=0;s<c.length;s++)Fx(c[s],l)}var Ba=M(null),mh=M(0);function Qx(s,l){s=Rr,te(mh,s),te(Ba,l),Rr=s|l.baseLanes}function Ym(){te(mh,Rr),te(Ba,Ba.current)}function Wm(){Rr=mh.current,U(Ba),U(mh)}var Hi=M(null),os=null;function fl(s){var l=s.alternate;te(mn,mn.current&1),te(Hi,s),os===null&&(l===null||Ba.current!==null||l.memoizedState!==null)&&(os=s)}function Xm(s){te(mn,mn.current),te(Hi,s),os===null&&(os=s)}function Kx(s){s.tag===22?(te(mn,mn.current),te(Hi,s),os===null&&(os=s)):hl()}function hl(){te(mn,mn.current),te(Hi,Hi.current)}function Vi(s){U(Hi),os===s&&(os=null),U(mn)}var mn=M(0);function gh(s){for(var l=s;l!==null;){if(l.tag===13){var c=l.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||ny(c)||iy(c)))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===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var vr=0,ct=null,Ht=null,kn=null,yh=!1,La=!1,Ro=!1,bh=0,uu=0,za=null,ZO=0;function on(){throw Error(i(321))}function $m(s,l){if(l===null)return!1;for(var c=0;c<l.length&&c<s.length;c++)if(!Ii(s[c],l[c]))return!1;return!0}function Zm(s,l,c,h,m,y){return vr=y,ct=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,z.H=s===null||s.memoizedState===null?M1:dg,Ro=!1,y=c(h,m),Ro=!1,La&&(y=Wx(l,c,h,m)),Yx(s),y}function Yx(s){z.H=du;var l=Ht!==null&&Ht.next!==null;if(vr=0,kn=Ht=ct=null,yh=!1,uu=0,za=null,l)throw Error(i(300));s===null||An||(s=s.dependencies,s!==null&&ah(s)&&(An=!0))}function Wx(s,l,c,h){ct=s;var m=0;do{if(La&&(za=null),uu=0,La=!1,25<=m)throw Error(i(301));if(m+=1,kn=Ht=null,s.updateQueue!=null){var y=s.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}z.H=N1,y=l(c,h)}while(La);return y}function JO(){var s=z.H,l=s.useState()[0];return l=typeof l.then=="function"?fu(l):l,s=s.useState()[0],(Ht!==null?Ht.memoizedState:null)!==s&&(ct.flags|=1024),l}function Jm(){var s=bh!==0;return bh=0,s}function eg(s,l,c){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~c}function tg(s){if(yh){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}yh=!1}vr=0,kn=Ht=ct=null,La=!1,uu=bh=0,za=null}function ui(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return kn===null?ct.memoizedState=kn=s:kn=kn.next=s,kn}function gn(){if(Ht===null){var s=ct.alternate;s=s!==null?s.memoizedState:null}else s=Ht.next;var l=kn===null?ct.memoizedState:kn.next;if(l!==null)kn=l,Ht=s;else{if(s===null)throw ct.alternate===null?Error(i(467)):Error(i(310));Ht=s,s={memoizedState:Ht.memoizedState,baseState:Ht.baseState,baseQueue:Ht.baseQueue,queue:Ht.queue,next:null},kn===null?ct.memoizedState=kn=s:kn=kn.next=s}return kn}function vh(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function fu(s){var l=uu;return uu+=1,za===null&&(za=[]),s=Hx(za,s,l),l=ct,(kn===null?l.memoizedState:kn.next)===null&&(l=l.alternate,z.H=l===null||l.memoizedState===null?M1:dg),s}function xh(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return fu(s);if(s.$$typeof===N)return Gn(s)}throw Error(i(438,String(s)))}function ng(s){var l=null,c=ct.updateQueue;if(c!==null&&(l=c.memoCache),l==null){var h=ct.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(l={data:h.data.map(function(m){return m.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),c===null&&(c=vh(),ct.updateQueue=c),c.memoCache=l,c=l.data[l.index],c===void 0)for(c=l.data[l.index]=Array(s),h=0;h<s;h++)c[h]=J;return l.index++,c}function xr(s,l){return typeof l=="function"?l(s):l}function Sh(s){var l=gn();return ig(l,Ht,s)}function ig(s,l,c){var h=s.queue;if(h===null)throw Error(i(311));h.lastRenderedReducer=c;var m=s.baseQueue,y=h.pending;if(y!==null){if(m!==null){var C=m.next;m.next=y.next,y.next=C}l.baseQueue=m=y,h.pending=null}if(y=s.baseState,m===null)s.memoizedState=y;else{l=m.next;var O=C=null,I=null,W=l,oe=!1;do{var ue=W.lane&-536870913;if(ue!==W.lane?(bt&ue)===ue:(vr&ue)===ue){var Z=W.revertLane;if(Z===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null}),ue===Ma&&(oe=!0);else if((vr&Z)===Z){W=W.next,Z===Ma&&(oe=!0);continue}else ue={lane:0,revertLane:W.revertLane,gesture:null,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},I===null?(O=I=ue,C=y):I=I.next=ue,ct.lanes|=Z,ml|=Z;ue=W.action,Ro&&c(y,ue),y=W.hasEagerState?W.eagerState:c(y,ue)}else Z={lane:ue,revertLane:W.revertLane,gesture:W.gesture,action:W.action,hasEagerState:W.hasEagerState,eagerState:W.eagerState,next:null},I===null?(O=I=Z,C=y):I=I.next=Z,ct.lanes|=ue,ml|=ue;W=W.next}while(W!==null&&W!==l);if(I===null?C=y:I.next=O,!Ii(y,s.memoizedState)&&(An=!0,oe&&(c=Na,c!==null)))throw c;s.memoizedState=y,s.baseState=C,s.baseQueue=I,h.lastRenderedState=y}return m===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function sg(s){var l=gn(),c=l.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var h=c.dispatch,m=c.pending,y=l.memoizedState;if(m!==null){c.pending=null;var C=m=m.next;do y=s(y,C.action),C=C.next;while(C!==m);Ii(y,l.memoizedState)||(An=!0),l.memoizedState=y,l.baseQueue===null&&(l.baseState=y),c.lastRenderedState=y}return[y,h]}function Xx(s,l,c){var h=ct,m=gn(),y=xt;if(y){if(c===void 0)throw Error(i(407));c=c()}else c=l();var C=!Ii((Ht||m).memoizedState,c);if(C&&(m.memoizedState=c,An=!0),m=m.queue,og(Jx.bind(null,h,m,s),[s]),m.getSnapshot!==l||C||kn!==null&&kn.memoizedState.tag&1){if(h.flags|=2048,Ia(9,{destroy:void 0},Zx.bind(null,h,m,c,l),null),qt===null)throw Error(i(349));y||(vr&127)!==0||$x(h,l,c)}return c}function $x(s,l,c){s.flags|=16384,s={getSnapshot:l,value:c},l=ct.updateQueue,l===null?(l=vh(),ct.updateQueue=l,l.stores=[s]):(c=l.stores,c===null?l.stores=[s]:c.push(s))}function Zx(s,l,c,h){l.value=c,l.getSnapshot=h,e1(l)&&t1(s)}function Jx(s,l,c){return c(function(){e1(l)&&t1(s)})}function e1(s){var l=s.getSnapshot;s=s.value;try{var c=l();return!Ii(s,c)}catch{return!0}}function t1(s){var l=bo(s,2);l!==null&&Ei(l,s,2)}function rg(s){var l=ui();if(typeof s=="function"){var c=s;if(s=c(),Ro){Jt(!0);try{c()}finally{Jt(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:s},l}function n1(s,l,c,h){return s.baseState=c,ig(s,Ht,typeof h=="function"?h:xr)}function eM(s,l,c,h,m){if(kh(s))throw Error(i(485));if(s=l.action,s!==null){var y={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(C){y.listeners.push(C)}};z.T!==null?c(!0):y.isTransition=!1,h(y),c=l.pending,c===null?(y.next=l.pending=y,i1(l,y)):(y.next=c.next,l.pending=c.next=y)}}function i1(s,l){var c=l.action,h=l.payload,m=s.state;if(l.isTransition){var y=z.T,C={};z.T=C;try{var O=c(m,h),I=z.S;I!==null&&I(C,O),s1(s,l,O)}catch(W){lg(s,l,W)}finally{y!==null&&C.types!==null&&(y.types=C.types),z.T=y}}else try{y=c(m,h),s1(s,l,y)}catch(W){lg(s,l,W)}}function s1(s,l,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(h){r1(s,l,h)},function(h){return lg(s,l,h)}):r1(s,l,c)}function r1(s,l,c){l.status="fulfilled",l.value=c,l1(l),s.state=c,l=s.pending,l!==null&&(c=l.next,c===l?s.pending=null:(c=c.next,l.next=c,i1(s,c)))}function lg(s,l,c){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do l.status="rejected",l.reason=c,l1(l),l=l.next;while(l!==h)}s.action=null}function l1(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function o1(s,l){return l}function a1(s,l){if(xt){var c=qt.formState;if(c!==null){e:{var h=ct;if(xt){if(Xt){t:{for(var m=Xt,y=ls;m.nodeType!==8;){if(!y){m=null;break t}if(m=as(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){Xt=as(m.nextSibling),h=m.data==="F!";break e}}ll(h)}h=!1}h&&(l=c[0])}}return c=ui(),c.memoizedState=c.baseState=l,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o1,lastRenderedState:l},c.queue=h,c=R1.bind(null,ct,h),h.dispatch=c,h=rg(!1),y=hg.bind(null,ct,!1,h.queue),h=ui(),m={state:l,dispatch:null,action:s,pending:null},h.queue=m,c=eM.bind(null,ct,m,y,c),m.dispatch=c,h.memoizedState=s,[l,c,!1]}function c1(s){var l=gn();return u1(l,Ht,s)}function u1(s,l,c){if(l=ig(s,l,o1)[0],s=Sh(xr)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var h=fu(l)}catch(C){throw C===Da?fh:C}else h=l;l=gn();var m=l.queue,y=m.dispatch;return c!==l.memoizedState&&(ct.flags|=2048,Ia(9,{destroy:void 0},tM.bind(null,m,c),null)),[h,y,s]}function tM(s,l){s.action=l}function f1(s){var l=gn(),c=Ht;if(c!==null)return u1(l,c,s);gn(),l=l.memoizedState,c=gn();var h=c.queue.dispatch;return c.memoizedState=s,[l,h,!1]}function Ia(s,l,c,h){return s={tag:s,create:c,deps:h,inst:l,next:null},l=ct.updateQueue,l===null&&(l=vh(),ct.updateQueue=l),c=l.lastEffect,c===null?l.lastEffect=s.next=s:(h=c.next,c.next=s,s.next=h,l.lastEffect=s),s}function h1(){return gn().memoizedState}function wh(s,l,c,h){var m=ui();ct.flags|=s,m.memoizedState=Ia(1|l,{destroy:void 0},c,h===void 0?null:h)}function Ch(s,l,c,h){var m=gn();h=h===void 0?null:h;var y=m.memoizedState.inst;Ht!==null&&h!==null&&$m(h,Ht.memoizedState.deps)?m.memoizedState=Ia(l,y,c,h):(ct.flags|=s,m.memoizedState=Ia(1|l,y,c,h))}function d1(s,l){wh(8390656,8,s,l)}function og(s,l){Ch(2048,8,s,l)}function nM(s){ct.flags|=4;var l=ct.updateQueue;if(l===null)l=vh(),ct.updateQueue=l,l.events=[s];else{var c=l.events;c===null?l.events=[s]:c.push(s)}}function p1(s){var l=gn().memoizedState;return nM({ref:l,nextImpl:s}),function(){if((Nt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function m1(s,l){return Ch(4,2,s,l)}function g1(s,l){return Ch(4,4,s,l)}function y1(s,l){if(typeof l=="function"){s=s();var c=l(s);return function(){typeof c=="function"?c():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function b1(s,l,c){c=c!=null?c.concat([s]):null,Ch(4,4,y1.bind(null,l,s),c)}function ag(){}function v1(s,l){var c=gn();l=l===void 0?null:l;var h=c.memoizedState;return l!==null&&$m(l,h[1])?h[0]:(c.memoizedState=[s,l],s)}function x1(s,l){var c=gn();l=l===void 0?null:l;var h=c.memoizedState;if(l!==null&&$m(l,h[1]))return h[0];if(h=s(),Ro){Jt(!0);try{s()}finally{Jt(!1)}}return c.memoizedState=[h,l],h}function cg(s,l,c){return c===void 0||(vr&1073741824)!==0&&(bt&261930)===0?s.memoizedState=l:(s.memoizedState=c,s=SS(),ct.lanes|=s,ml|=s,c)}function S1(s,l,c,h){return Ii(c,l)?c:Ba.current!==null?(s=cg(s,c,h),Ii(s,l)||(An=!0),s):(vr&42)===0||(vr&1073741824)!==0&&(bt&261930)===0?(An=!0,s.memoizedState=c):(s=SS(),ct.lanes|=s,ml|=s,l)}function w1(s,l,c,h,m){var y=Q.p;Q.p=y!==0&&8>y?y:8;var C=z.T,O={};z.T=O,hg(s,!1,l,c);try{var I=m(),W=z.S;if(W!==null&&W(O,I),I!==null&&typeof I=="object"&&typeof I.then=="function"){var oe=$O(I,h);hu(s,l,oe,qi(s))}else hu(s,l,h,qi(s))}catch(ue){hu(s,l,{then:function(){},status:"rejected",reason:ue},qi())}finally{Q.p=y,C!==null&&O.types!==null&&(C.types=O.types),z.T=C}}function iM(){}function ug(s,l,c,h){if(s.tag!==5)throw Error(i(476));var m=C1(s).queue;w1(s,m,l,F,c===null?iM:function(){return k1(s),c(h)})}function C1(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:F,baseState:F,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:F},next:null};var c={};return l.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:xr,lastRenderedState:c},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function k1(s){var l=C1(s);l.next===null&&(l=s.alternate.memoizedState),hu(s,l.next.queue,{},qi())}function fg(){return Gn(Ou)}function A1(){return gn().memoizedState}function E1(){return gn().memoizedState}function sM(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var c=qi();s=cl(c);var h=ul(l,s,c);h!==null&&(Ei(h,l,c),ou(h,l,c)),l={cache:Vm()},s.payload=l;return}l=l.return}}function rM(s,l,c){var h=qi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},kh(s)?T1(l,c):(c=Om(s,l,c,h),c!==null&&(Ei(c,s,h),O1(c,l,h)))}function R1(s,l,c){var h=qi();hu(s,l,c,h)}function hu(s,l,c,h){var m={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(kh(s))T1(l,m);else{var y=s.alternate;if(s.lanes===0&&(y===null||y.lanes===0)&&(y=l.lastRenderedReducer,y!==null))try{var C=l.lastRenderedState,O=y(C,c);if(m.hasEagerState=!0,m.eagerState=O,Ii(O,C))return sh(s,l,m,0),qt===null&&ih(),!1}catch{}finally{}if(c=Om(s,l,m,h),c!==null)return Ei(c,s,h),O1(c,l,h),!0}return!1}function hg(s,l,c,h){if(h={lane:2,revertLane:Fg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},kh(s)){if(l)throw Error(i(479))}else l=Om(s,c,h,2),l!==null&&Ei(l,s,2)}function kh(s){var l=s.alternate;return s===ct||l!==null&&l===ct}function T1(s,l){La=yh=!0;var c=s.pending;c===null?l.next=l:(l.next=c.next,c.next=l),s.pending=l}function O1(s,l,c){if((c&4194048)!==0){var h=l.lanes;h&=s.pendingLanes,c|=h,l.lanes=c,ts(s,c)}}var du={readContext:Gn,use:xh,useCallback:on,useContext:on,useEffect:on,useImperativeHandle:on,useLayoutEffect:on,useInsertionEffect:on,useMemo:on,useReducer:on,useRef:on,useState:on,useDebugValue:on,useDeferredValue:on,useTransition:on,useSyncExternalStore:on,useId:on,useHostTransitionStatus:on,useFormState:on,useActionState:on,useOptimistic:on,useMemoCache:on,useCacheRefresh:on};du.useEffectEvent=on;var M1={readContext:Gn,use:xh,useCallback:function(s,l){return ui().memoizedState=[s,l===void 0?null:l],s},useContext:Gn,useEffect:d1,useImperativeHandle:function(s,l,c){c=c!=null?c.concat([s]):null,wh(4194308,4,y1.bind(null,l,s),c)},useLayoutEffect:function(s,l){return wh(4194308,4,s,l)},useInsertionEffect:function(s,l){wh(4,2,s,l)},useMemo:function(s,l){var c=ui();l=l===void 0?null:l;var h=s();if(Ro){Jt(!0);try{s()}finally{Jt(!1)}}return c.memoizedState=[h,l],h},useReducer:function(s,l,c){var h=ui();if(c!==void 0){var m=c(l);if(Ro){Jt(!0);try{c(l)}finally{Jt(!1)}}}else m=l;return h.memoizedState=h.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},h.queue=s,s=s.dispatch=rM.bind(null,ct,s),[h.memoizedState,s]},useRef:function(s){var l=ui();return s={current:s},l.memoizedState=s},useState:function(s){s=rg(s);var l=s.queue,c=R1.bind(null,ct,l);return l.dispatch=c,[s.memoizedState,c]},useDebugValue:ag,useDeferredValue:function(s,l){var c=ui();return cg(c,s,l)},useTransition:function(){var s=rg(!1);return s=w1.bind(null,ct,s.queue,!0,!1),ui().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,c){var h=ct,m=ui();if(xt){if(c===void 0)throw Error(i(407));c=c()}else{if(c=l(),qt===null)throw Error(i(349));(bt&127)!==0||$x(h,l,c)}m.memoizedState=c;var y={value:c,getSnapshot:l};return m.queue=y,d1(Jx.bind(null,h,y,s),[s]),h.flags|=2048,Ia(9,{destroy:void 0},Zx.bind(null,h,y,c,l),null),c},useId:function(){var s=ui(),l=qt.identifierPrefix;if(xt){var c=_s,h=Vs;c=(h&~(1<<32-Pt(h)-1)).toString(32)+c,l="_"+l+"R_"+c,c=bh++,0<c&&(l+="H"+c.toString(32)),l+="_"}else c=ZO++,l="_"+l+"r_"+c.toString(32)+"_";return s.memoizedState=l},useHostTransitionStatus:fg,useFormState:a1,useActionState:a1,useOptimistic:function(s){var l=ui();l.memoizedState=l.baseState=s;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=c,l=hg.bind(null,ct,!0,c),c.dispatch=l,[s,l]},useMemoCache:ng,useCacheRefresh:function(){return ui().memoizedState=sM.bind(null,ct)},useEffectEvent:function(s){var l=ui(),c={impl:s};return l.memoizedState=c,function(){if((Nt&2)!==0)throw Error(i(440));return c.impl.apply(void 0,arguments)}}},dg={readContext:Gn,use:xh,useCallback:v1,useContext:Gn,useEffect:og,useImperativeHandle:b1,useInsertionEffect:m1,useLayoutEffect:g1,useMemo:x1,useReducer:Sh,useRef:h1,useState:function(){return Sh(xr)},useDebugValue:ag,useDeferredValue:function(s,l){var c=gn();return S1(c,Ht.memoizedState,s,l)},useTransition:function(){var s=Sh(xr)[0],l=gn().memoizedState;return[typeof s=="boolean"?s:fu(s),l]},useSyncExternalStore:Xx,useId:A1,useHostTransitionStatus:fg,useFormState:c1,useActionState:c1,useOptimistic:function(s,l){var c=gn();return n1(c,Ht,s,l)},useMemoCache:ng,useCacheRefresh:E1};dg.useEffectEvent=p1;var N1={readContext:Gn,use:xh,useCallback:v1,useContext:Gn,useEffect:og,useImperativeHandle:b1,useInsertionEffect:m1,useLayoutEffect:g1,useMemo:x1,useReducer:sg,useRef:h1,useState:function(){return sg(xr)},useDebugValue:ag,useDeferredValue:function(s,l){var c=gn();return Ht===null?cg(c,s,l):S1(c,Ht.memoizedState,s,l)},useTransition:function(){var s=sg(xr)[0],l=gn().memoizedState;return[typeof s=="boolean"?s:fu(s),l]},useSyncExternalStore:Xx,useId:A1,useHostTransitionStatus:fg,useFormState:f1,useActionState:f1,useOptimistic:function(s,l){var c=gn();return Ht!==null?n1(c,Ht,s,l):(c.baseState=s,[s,c.queue.dispatch])},useMemoCache:ng,useCacheRefresh:E1};N1.useEffectEvent=p1;function pg(s,l,c,h){l=s.memoizedState,c=c(h,l),c=c==null?l:g({},l,c),s.memoizedState=c,s.lanes===0&&(s.updateQueue.baseState=c)}var mg={enqueueSetState:function(s,l,c){s=s._reactInternals;var h=qi(),m=cl(h);m.payload=l,c!=null&&(m.callback=c),l=ul(s,m,h),l!==null&&(Ei(l,s,h),ou(l,s,h))},enqueueReplaceState:function(s,l,c){s=s._reactInternals;var h=qi(),m=cl(h);m.tag=1,m.payload=l,c!=null&&(m.callback=c),l=ul(s,m,h),l!==null&&(Ei(l,s,h),ou(l,s,h))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var c=qi(),h=cl(c);h.tag=2,l!=null&&(h.callback=l),l=ul(s,h,c),l!==null&&(Ei(l,s,c),ou(l,s,c))}};function D1(s,l,c,h,m,y,C){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,y,C):l.prototype&&l.prototype.isPureReactComponent?!Jc(c,h)||!Jc(m,y):!0}function j1(s,l,c,h){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(c,h),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(c,h),l.state!==s&&mg.enqueueReplaceState(l,l.state,null)}function To(s,l){var c=l;if("ref"in l){c={};for(var h in l)h!=="ref"&&(c[h]=l[h])}if(s=s.defaultProps){c===l&&(c=g({},c));for(var m in s)c[m]===void 0&&(c[m]=s[m])}return c}function B1(s){nh(s)}function L1(s){console.error(s)}function z1(s){nh(s)}function Ah(s,l){try{var c=s.onUncaughtError;c(l.value,{componentStack:l.stack})}catch(h){setTimeout(function(){throw h})}}function I1(s,l,c){try{var h=s.onCaughtError;h(c.value,{componentStack:c.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function gg(s,l,c){return c=cl(c),c.tag=3,c.payload={element:null},c.callback=function(){Ah(s,l)},c}function P1(s){return s=cl(s),s.tag=3,s}function H1(s,l,c,h){var m=c.type.getDerivedStateFromError;if(typeof m=="function"){var y=h.value;s.payload=function(){return m(y)},s.callback=function(){I1(l,c,h)}}var C=c.stateNode;C!==null&&typeof C.componentDidCatch=="function"&&(s.callback=function(){I1(l,c,h),typeof m!="function"&&(gl===null?gl=new Set([this]):gl.add(this));var O=h.stack;this.componentDidCatch(h.value,{componentStack:O!==null?O:""})})}function lM(s,l,c,h,m){if(c.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(l=c.alternate,l!==null&&Oa(l,c,m,!0),c=Hi.current,c!==null){switch(c.tag){case 31:case 13:return os===null?Ih():c.alternate===null&&an===0&&(an=3),c.flags&=-257,c.flags|=65536,c.lanes=m,h===hh?c.flags|=16384:(l=c.updateQueue,l===null?c.updateQueue=new Set([h]):l.add(h),_g(s,h,m)),!1;case 22:return c.flags|=65536,h===hh?c.flags|=16384:(l=c.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([h])},c.updateQueue=l):(c=l.retryQueue,c===null?l.retryQueue=new Set([h]):c.add(h)),_g(s,h,m)),!1}throw Error(i(435,c.tag))}return _g(s,h,m),Ih(),!1}if(xt)return l=Hi.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,h!==Lm&&(s=Error(i(422),{cause:h}),nu(is(s,c)))):(h!==Lm&&(l=Error(i(423),{cause:h}),nu(is(l,c))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,h=is(h,c),m=gg(s.stateNode,h,m),Qm(s,m),an!==4&&(an=2)),!1;var y=Error(i(520),{cause:h});if(y=is(y,c),Su===null?Su=[y]:Su.push(y),an!==4&&(an=2),l===null)return!0;h=is(h,c),c=l;do{switch(c.tag){case 3:return c.flags|=65536,s=m&-m,c.lanes|=s,s=gg(c.stateNode,h,s),Qm(c,s),!1;case 1:if(l=c.type,y=c.stateNode,(c.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(gl===null||!gl.has(y))))return c.flags|=65536,m&=-m,c.lanes|=m,m=P1(m),H1(m,s,c,h),Qm(c,m),!1}c=c.return}while(c!==null);return!1}var yg=Error(i(461)),An=!1;function Qn(s,l,c,h){l.child=s===null?qx(l,null,c,h):Eo(l,s.child,c,h)}function V1(s,l,c,h,m){c=c.render;var y=l.ref;if("ref"in h){var C={};for(var O in h)O!=="ref"&&(C[O]=h[O])}else C=h;return wo(l),h=Zm(s,l,c,C,y,m),O=Jm(),s!==null&&!An?(eg(s,l,m),Sr(s,l,m)):(xt&&O&&jm(l),l.flags|=1,Qn(s,l,h,m),l.child)}function _1(s,l,c,h,m){if(s===null){var y=c.type;return typeof y=="function"&&!Mm(y)&&y.defaultProps===void 0&&c.compare===null?(l.tag=15,l.type=y,U1(s,l,y,h,m)):(s=lh(c.type,null,h,l,l.mode,m),s.ref=l.ref,s.return=l,l.child=s)}if(y=s.child,!Ag(s,m)){var C=y.memoizedProps;if(c=c.compare,c=c!==null?c:Jc,c(C,h)&&s.ref===l.ref)return Sr(s,l,m)}return l.flags|=1,s=mr(y,h),s.ref=l.ref,s.return=l,l.child=s}function U1(s,l,c,h,m){if(s!==null){var y=s.memoizedProps;if(Jc(y,h)&&s.ref===l.ref)if(An=!1,l.pendingProps=h=y,Ag(s,m))(s.flags&131072)!==0&&(An=!0);else return l.lanes=s.lanes,Sr(s,l,m)}return bg(s,l,c,h,m)}function q1(s,l,c,h){var m=h.children,y=s!==null?s.memoizedState:null;if(s===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((l.flags&128)!==0){if(y=y!==null?y.baseLanes|c:c,s!==null){for(h=l.child=s.child,m=0;h!==null;)m=m|h.lanes|h.childLanes,h=h.sibling;h=m&~y}else h=0,l.child=null;return F1(s,l,y,c,h)}if((c&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&uh(l,y!==null?y.cachePool:null),y!==null?Qx(l,y):Ym(),Kx(l);else return h=l.lanes=536870912,F1(s,l,y!==null?y.baseLanes|c:c,c,h)}else y!==null?(uh(l,y.cachePool),Qx(l,y),hl(),l.memoizedState=null):(s!==null&&uh(l,null),Ym(),hl());return Qn(s,l,m,c),l.child}function pu(s,l){return s!==null&&s.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function F1(s,l,c,h,m){var y=Um();return y=y===null?null:{parent:Cn._currentValue,pool:y},l.memoizedState={baseLanes:c,cachePool:y},s!==null&&uh(l,null),Ym(),Kx(l),s!==null&&Oa(s,l,h,!0),l.childLanes=m,null}function Eh(s,l){return l=Th({mode:l.mode,children:l.children},s.mode),l.ref=s.ref,s.child=l,l.return=s,l}function G1(s,l,c){return Eo(l,s.child,null,c),s=Eh(l,l.pendingProps),s.flags|=2,Vi(l),l.memoizedState=null,s}function oM(s,l,c){var h=l.pendingProps,m=(l.flags&128)!==0;if(l.flags&=-129,s===null){if(xt){if(h.mode==="hidden")return s=Eh(l,h),l.lanes=536870912,pu(null,s);if(Xm(l),(s=Xt)?(s=iw(s,ls),s=s!==null&&s.data==="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:sl!==null?{id:Vs,overflow:_s}:null,retryLane:536870912,hydrationErrors:null},c=Tx(s),c.return=l,l.child=c,Fn=l,Xt=null)):s=null,s===null)throw ll(l);return l.lanes=536870912,null}return Eh(l,h)}var y=s.memoizedState;if(y!==null){var C=y.dehydrated;if(Xm(l),m)if(l.flags&256)l.flags&=-257,l=G1(s,l,c);else if(l.memoizedState!==null)l.child=s.child,l.flags|=128,l=null;else throw Error(i(558));else if(An||Oa(s,l,c,!1),m=(c&s.childLanes)!==0,An||m){if(h=qt,h!==null&&(C=ur(h,c),C!==0&&C!==y.retryLane))throw y.retryLane=C,bo(s,C),Ei(h,s,C),yg;Ih(),l=G1(s,l,c)}else s=y.treeContext,Xt=as(C.nextSibling),Fn=l,xt=!0,rl=null,ls=!1,s!==null&&Nx(l,s),l=Eh(l,h),l.flags|=4096;return l}return s=mr(s.child,{mode:h.mode,children:h.children}),s.ref=l.ref,l.child=s,s.return=l,s}function Rh(s,l){var c=l.ref;if(c===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(i(284));(s===null||s.ref!==c)&&(l.flags|=4194816)}}function bg(s,l,c,h,m){return wo(l),c=Zm(s,l,c,h,void 0,m),h=Jm(),s!==null&&!An?(eg(s,l,m),Sr(s,l,m)):(xt&&h&&jm(l),l.flags|=1,Qn(s,l,c,m),l.child)}function Q1(s,l,c,h,m,y){return wo(l),l.updateQueue=null,c=Wx(l,h,c,m),Yx(s),h=Jm(),s!==null&&!An?(eg(s,l,y),Sr(s,l,y)):(xt&&h&&jm(l),l.flags|=1,Qn(s,l,c,y),l.child)}function K1(s,l,c,h,m){if(wo(l),l.stateNode===null){var y=Aa,C=c.contextType;typeof C=="object"&&C!==null&&(y=Gn(C)),y=new c(h,y),l.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=mg,l.stateNode=y,y._reactInternals=l,y=l.stateNode,y.props=h,y.state=l.memoizedState,y.refs={},Fm(l),C=c.contextType,y.context=typeof C=="object"&&C!==null?Gn(C):Aa,y.state=l.memoizedState,C=c.getDerivedStateFromProps,typeof C=="function"&&(pg(l,c,C,h),y.state=l.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(C=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),C!==y.state&&mg.enqueueReplaceState(y,y.state,null),cu(l,h,y,m),au(),y.state=l.memoizedState),typeof y.componentDidMount=="function"&&(l.flags|=4194308),h=!0}else if(s===null){y=l.stateNode;var O=l.memoizedProps,I=To(c,O);y.props=I;var W=y.context,oe=c.contextType;C=Aa,typeof oe=="object"&&oe!==null&&(C=Gn(oe));var ue=c.getDerivedStateFromProps;oe=typeof ue=="function"||typeof y.getSnapshotBeforeUpdate=="function",O=l.pendingProps!==O,oe||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(O||W!==C)&&j1(l,y,h,C),al=!1;var Z=l.memoizedState;y.state=Z,cu(l,h,y,m),au(),W=l.memoizedState,O||Z!==W||al?(typeof ue=="function"&&(pg(l,c,ue,h),W=l.memoizedState),(I=al||D1(l,c,I,h,Z,W,C))?(oe||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=h,l.memoizedState=W),y.props=h,y.state=W,y.context=C,h=I):(typeof y.componentDidMount=="function"&&(l.flags|=4194308),h=!1)}else{y=l.stateNode,Gm(s,l),C=l.memoizedProps,oe=To(c,C),y.props=oe,ue=l.pendingProps,Z=y.context,W=c.contextType,I=Aa,typeof W=="object"&&W!==null&&(I=Gn(W)),O=c.getDerivedStateFromProps,(W=typeof O=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(C!==ue||Z!==I)&&j1(l,y,h,I),al=!1,Z=l.memoizedState,y.state=Z,cu(l,h,y,m),au();var re=l.memoizedState;C!==ue||Z!==re||al||s!==null&&s.dependencies!==null&&ah(s.dependencies)?(typeof O=="function"&&(pg(l,c,O,h),re=l.memoizedState),(oe=al||D1(l,c,oe,h,Z,re,I)||s!==null&&s.dependencies!==null&&ah(s.dependencies))?(W||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(h,re,I),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(h,re,I)),typeof y.componentDidUpdate=="function"&&(l.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof y.componentDidUpdate!="function"||C===s.memoizedProps&&Z===s.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&Z===s.memoizedState||(l.flags|=1024),l.memoizedProps=h,l.memoizedState=re),y.props=h,y.state=re,y.context=I,h=oe):(typeof y.componentDidUpdate!="function"||C===s.memoizedProps&&Z===s.memoizedState||(l.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||C===s.memoizedProps&&Z===s.memoizedState||(l.flags|=1024),h=!1)}return y=h,Rh(s,l),h=(l.flags&128)!==0,y||h?(y=l.stateNode,c=h&&typeof c.getDerivedStateFromError!="function"?null:y.render(),l.flags|=1,s!==null&&h?(l.child=Eo(l,s.child,null,m),l.child=Eo(l,null,c,m)):Qn(s,l,c,m),l.memoizedState=y.state,s=l.child):s=Sr(s,l,m),s}function Y1(s,l,c,h){return xo(),l.flags|=256,Qn(s,l,c,h),l.child}var vg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function xg(s){return{baseLanes:s,cachePool:Ix()}}function Sg(s,l,c){return s=s!==null?s.childLanes&~c:0,l&&(s|=Ui),s}function W1(s,l,c){var h=l.pendingProps,m=!1,y=(l.flags&128)!==0,C;if((C=y)||(C=s!==null&&s.memoizedState===null?!1:(mn.current&2)!==0),C&&(m=!0,l.flags&=-129),C=(l.flags&32)!==0,l.flags&=-33,s===null){if(xt){if(m?fl(l):hl(),(s=Xt)?(s=iw(s,ls),s=s!==null&&s.data!=="&"?s:null,s!==null&&(l.memoizedState={dehydrated:s,treeContext:sl!==null?{id:Vs,overflow:_s}:null,retryLane:536870912,hydrationErrors:null},c=Tx(s),c.return=l,l.child=c,Fn=l,Xt=null)):s=null,s===null)throw ll(l);return iy(s)?l.lanes=32:l.lanes=536870912,null}var O=h.children;return h=h.fallback,m?(hl(),m=l.mode,O=Th({mode:"hidden",children:O},m),h=vo(h,m,c,null),O.return=l,h.return=l,O.sibling=h,l.child=O,h=l.child,h.memoizedState=xg(c),h.childLanes=Sg(s,C,c),l.memoizedState=vg,pu(null,h)):(fl(l),wg(l,O))}var I=s.memoizedState;if(I!==null&&(O=I.dehydrated,O!==null)){if(y)l.flags&256?(fl(l),l.flags&=-257,l=Cg(s,l,c)):l.memoizedState!==null?(hl(),l.child=s.child,l.flags|=128,l=null):(hl(),O=h.fallback,m=l.mode,h=Th({mode:"visible",children:h.children},m),O=vo(O,m,c,null),O.flags|=2,h.return=l,O.return=l,h.sibling=O,l.child=h,Eo(l,s.child,null,c),h=l.child,h.memoizedState=xg(c),h.childLanes=Sg(s,C,c),l.memoizedState=vg,l=pu(null,h));else if(fl(l),iy(O)){if(C=O.nextSibling&&O.nextSibling.dataset,C)var W=C.dgst;C=W,h=Error(i(419)),h.stack="",h.digest=C,nu({value:h,source:null,stack:null}),l=Cg(s,l,c)}else if(An||Oa(s,l,c,!1),C=(c&s.childLanes)!==0,An||C){if(C=qt,C!==null&&(h=ur(C,c),h!==0&&h!==I.retryLane))throw I.retryLane=h,bo(s,h),Ei(C,s,h),yg;ny(O)||Ih(),l=Cg(s,l,c)}else ny(O)?(l.flags|=192,l.child=s.child,l=null):(s=I.treeContext,Xt=as(O.nextSibling),Fn=l,xt=!0,rl=null,ls=!1,s!==null&&Nx(l,s),l=wg(l,h.children),l.flags|=4096);return l}return m?(hl(),O=h.fallback,m=l.mode,I=s.child,W=I.sibling,h=mr(I,{mode:"hidden",children:h.children}),h.subtreeFlags=I.subtreeFlags&65011712,W!==null?O=mr(W,O):(O=vo(O,m,c,null),O.flags|=2),O.return=l,h.return=l,h.sibling=O,l.child=h,pu(null,h),h=l.child,O=s.child.memoizedState,O===null?O=xg(c):(m=O.cachePool,m!==null?(I=Cn._currentValue,m=m.parent!==I?{parent:I,pool:I}:m):m=Ix(),O={baseLanes:O.baseLanes|c,cachePool:m}),h.memoizedState=O,h.childLanes=Sg(s,C,c),l.memoizedState=vg,pu(s.child,h)):(fl(l),c=s.child,s=c.sibling,c=mr(c,{mode:"visible",children:h.children}),c.return=l,c.sibling=null,s!==null&&(C=l.deletions,C===null?(l.deletions=[s],l.flags|=16):C.push(s)),l.child=c,l.memoizedState=null,c)}function wg(s,l){return l=Th({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function Th(s,l){return s=Pi(22,s,null,l),s.lanes=0,s}function Cg(s,l,c){return Eo(l,s.child,null,c),s=wg(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function X1(s,l,c){s.lanes|=l;var h=s.alternate;h!==null&&(h.lanes|=l),Pm(s.return,l,c)}function kg(s,l,c,h,m,y){var C=s.memoizedState;C===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:h,tail:c,tailMode:m,treeForkCount:y}:(C.isBackwards=l,C.rendering=null,C.renderingStartTime=0,C.last=h,C.tail=c,C.tailMode=m,C.treeForkCount=y)}function $1(s,l,c){var h=l.pendingProps,m=h.revealOrder,y=h.tail;h=h.children;var C=mn.current,O=(C&2)!==0;if(O?(C=C&1|2,l.flags|=128):C&=1,te(mn,C),Qn(s,l,h,c),h=xt?tu:0,!O&&s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&X1(s,c,l);else if(s.tag===19)X1(s,c,l);else if(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}switch(m){case"forwards":for(c=l.child,m=null;c!==null;)s=c.alternate,s!==null&&gh(s)===null&&(m=c),c=c.sibling;c=m,c===null?(m=l.child,l.child=null):(m=c.sibling,c.sibling=null),kg(l,!1,m,c,y,h);break;case"backwards":case"unstable_legacy-backwards":for(c=null,m=l.child,l.child=null;m!==null;){if(s=m.alternate,s!==null&&gh(s)===null){l.child=m;break}s=m.sibling,m.sibling=c,c=m,m=s}kg(l,!0,c,null,y,h);break;case"together":kg(l,!1,null,null,void 0,h);break;default:l.memoizedState=null}return l.child}function Sr(s,l,c){if(s!==null&&(l.dependencies=s.dependencies),ml|=l.lanes,(c&l.childLanes)===0)if(s!==null){if(Oa(s,l,c,!1),(c&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(i(153));if(l.child!==null){for(s=l.child,c=mr(s,s.pendingProps),l.child=c,c.return=l;s.sibling!==null;)s=s.sibling,c=c.sibling=mr(s,s.pendingProps),c.return=l;c.sibling=null}return l.child}function Ag(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&ah(s)))}function aM(s,l,c){switch(l.tag){case 3:pe(l,l.stateNode.containerInfo),ol(l,Cn,s.memoizedState.cache),xo();break;case 27:case 5:fe(l);break;case 4:pe(l,l.stateNode.containerInfo);break;case 10:ol(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,Xm(l),null;break;case 13:var h=l.memoizedState;if(h!==null)return h.dehydrated!==null?(fl(l),l.flags|=128,null):(c&l.child.childLanes)!==0?W1(s,l,c):(fl(l),s=Sr(s,l,c),s!==null?s.sibling:null);fl(l);break;case 19:var m=(s.flags&128)!==0;if(h=(c&l.childLanes)!==0,h||(Oa(s,l,c,!1),h=(c&l.childLanes)!==0),m){if(h)return $1(s,l,c);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),te(mn,mn.current),h)break;return null;case 22:return l.lanes=0,q1(s,l,c,l.pendingProps);case 24:ol(l,Cn,s.memoizedState.cache)}return Sr(s,l,c)}function Z1(s,l,c){if(s!==null)if(s.memoizedProps!==l.pendingProps)An=!0;else{if(!Ag(s,c)&&(l.flags&128)===0)return An=!1,aM(s,l,c);An=(s.flags&131072)!==0}else An=!1,xt&&(l.flags&1048576)!==0&&Mx(l,tu,l.index);switch(l.lanes=0,l.tag){case 16:e:{var h=l.pendingProps;if(s=ko(l.elementType),l.type=s,typeof s=="function")Mm(s)?(h=To(s,h),l.tag=1,l=K1(null,l,s,h,c)):(l.tag=0,l=bg(null,l,s,h,c));else{if(s!=null){var m=s.$$typeof;if(m===T){l.tag=11,l=V1(null,l,s,h,c);break e}else if(m===D){l.tag=14,l=_1(null,l,s,h,c);break e}}throw l=$(s)||s,Error(i(306,l,""))}}return l;case 0:return bg(s,l,l.type,l.pendingProps,c);case 1:return h=l.type,m=To(h,l.pendingProps),K1(s,l,h,m,c);case 3:e:{if(pe(l,l.stateNode.containerInfo),s===null)throw Error(i(387));h=l.pendingProps;var y=l.memoizedState;m=y.element,Gm(s,l),cu(l,h,null,c);var C=l.memoizedState;if(h=C.cache,ol(l,Cn,h),h!==y.cache&&Hm(l,[Cn],c,!0),au(),h=C.element,y.isDehydrated)if(y={element:h,isDehydrated:!1,cache:C.cache},l.updateQueue.baseState=y,l.memoizedState=y,l.flags&256){l=Y1(s,l,h,c);break e}else if(h!==m){m=is(Error(i(424)),l),nu(m),l=Y1(s,l,h,c);break e}else{switch(s=l.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(Xt=as(s.firstChild),Fn=l,xt=!0,rl=null,ls=!0,c=qx(l,null,h,c),l.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling}else{if(xo(),h===m){l=Sr(s,l,c);break e}Qn(s,l,h,c)}l=l.child}return l;case 26:return Rh(s,l),s===null?(c=cw(l.type,null,l.pendingProps,null))?l.memoizedState=c:xt||(c=l.type,s=l.pendingProps,h=Fh(se.current).createElement(c),h[Ut]=l,h[rn]=s,Kn(h,c,s),Ot(h),l.stateNode=h):l.memoizedState=cw(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return fe(l),s===null&&xt&&(h=l.stateNode=lw(l.type,l.pendingProps,se.current),Fn=l,ls=!0,m=Xt,xl(l.type)?(sy=m,Xt=as(h.firstChild)):Xt=m),Qn(s,l,l.pendingProps.children,c),Rh(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&xt&&((m=h=Xt)&&(h=PM(h,l.type,l.pendingProps,ls),h!==null?(l.stateNode=h,Fn=l,Xt=as(h.firstChild),ls=!1,m=!0):m=!1),m||ll(l)),fe(l),m=l.type,y=l.pendingProps,C=s!==null?s.memoizedProps:null,h=y.children,Jg(m,y)?h=null:C!==null&&Jg(m,C)&&(l.flags|=32),l.memoizedState!==null&&(m=Zm(s,l,JO,null,null,c),Ou._currentValue=m),Rh(s,l),Qn(s,l,h,c),l.child;case 6:return s===null&&xt&&((s=c=Xt)&&(c=HM(c,l.pendingProps,ls),c!==null?(l.stateNode=c,Fn=l,Xt=null,s=!0):s=!1),s||ll(l)),null;case 13:return W1(s,l,c);case 4:return pe(l,l.stateNode.containerInfo),h=l.pendingProps,s===null?l.child=Eo(l,null,h,c):Qn(s,l,h,c),l.child;case 11:return V1(s,l,l.type,l.pendingProps,c);case 7:return Qn(s,l,l.pendingProps,c),l.child;case 8:return Qn(s,l,l.pendingProps.children,c),l.child;case 12:return Qn(s,l,l.pendingProps.children,c),l.child;case 10:return h=l.pendingProps,ol(l,l.type,h.value),Qn(s,l,h.children,c),l.child;case 9:return m=l.type._context,h=l.pendingProps.children,wo(l),m=Gn(m),h=h(m),l.flags|=1,Qn(s,l,h,c),l.child;case 14:return _1(s,l,l.type,l.pendingProps,c);case 15:return U1(s,l,l.type,l.pendingProps,c);case 19:return $1(s,l,c);case 31:return oM(s,l,c);case 22:return q1(s,l,c,l.pendingProps);case 24:return wo(l),h=Gn(Cn),s===null?(m=Um(),m===null&&(m=qt,y=Vm(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=c),m=y),l.memoizedState={parent:h,cache:m},Fm(l),ol(l,Cn,m)):((s.lanes&c)!==0&&(Gm(s,l),cu(l,null,null,c),au()),m=s.memoizedState,y=l.memoizedState,m.parent!==h?(m={parent:h,cache:h},l.memoizedState=m,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=m),ol(l,Cn,h)):(h=y.cache,ol(l,Cn,h),h!==m.cache&&Hm(l,[Cn],c,!0))),Qn(s,l,l.pendingProps.children,c),l.child;case 29:throw l.pendingProps}throw Error(i(156,l.tag))}function wr(s){s.flags|=4}function Eg(s,l,c,h,m){if((l=(s.mode&32)!==0)&&(l=!1),l){if(s.flags|=16777216,(m&335544128)===m)if(s.stateNode.complete)s.flags|=8192;else if(AS())s.flags|=8192;else throw Ao=hh,qm}else s.flags&=-16777217}function J1(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!pw(l))if(AS())s.flags|=8192;else throw Ao=hh,qm}function Oh(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?Rn():536870912,s.lanes|=l,_a|=l)}function mu(s,l){if(!xt)switch(s.tailMode){case"hidden":l=s.tail;for(var c=null;l!==null;)l.alternate!==null&&(c=l),l=l.sibling;c===null?s.tail=null:c.sibling=null;break;case"collapsed":c=s.tail;for(var h=null;c!==null;)c.alternate!==null&&(h=c),c=c.sibling;h===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function $t(s){var l=s.alternate!==null&&s.alternate.child===s.child,c=0,h=0;if(l)for(var m=s.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags&65011712,h|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)c|=m.lanes|m.childLanes,h|=m.subtreeFlags,h|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=h,s.childLanes=c,l}function cM(s,l,c){var h=l.pendingProps;switch(Bm(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 c=l.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),l.memoizedState.cache!==h&&(l.flags|=2048),br(Cn),xe(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(s===null||s.child===null)&&(Ta(l)?wr(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,zm())),$t(l),null;case 26:var m=l.type,y=l.memoizedState;return s===null?(wr(l),y!==null?($t(l),J1(l,y)):($t(l),Eg(l,m,null,h,c))):y?y!==s.memoizedState?(wr(l),$t(l),J1(l,y)):($t(l),l.flags&=-16777217):(s=s.memoizedProps,s!==h&&wr(l),$t(l),Eg(l,m,s,h,c)),null;case 27:if(ie(l),c=se.current,m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==h&&wr(l);else{if(!h){if(l.stateNode===null)throw Error(i(166));return $t(l),null}s=le.current,Ta(l)?Dx(l):(s=lw(m,h,c),l.stateNode=s,wr(l))}return $t(l),null;case 5:if(ie(l),m=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==h&&wr(l);else{if(!h){if(l.stateNode===null)throw Error(i(166));return $t(l),null}if(y=le.current,Ta(l))Dx(l);else{var C=Fh(se.current);switch(y){case 1:y=C.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=C.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=C.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=C.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof h.is=="string"?C.createElement("select",{is:h.is}):C.createElement("select"),h.multiple?y.multiple=!0:h.size&&(y.size=h.size);break;default:y=typeof h.is=="string"?C.createElement(m,{is:h.is}):C.createElement(m)}}y[Ut]=l,y[rn]=h;e:for(C=l.child;C!==null;){if(C.tag===5||C.tag===6)y.appendChild(C.stateNode);else if(C.tag!==4&&C.tag!==27&&C.child!==null){C.child.return=C,C=C.child;continue}if(C===l)break e;for(;C.sibling===null;){if(C.return===null||C.return===l)break e;C=C.return}C.sibling.return=C.return,C=C.sibling}l.stateNode=y;e:switch(Kn(y,m,h),m){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&wr(l)}}return $t(l),Eg(l,l.type,s===null?null:s.memoizedProps,l.pendingProps,c),null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==h&&wr(l);else{if(typeof h!="string"&&l.stateNode===null)throw Error(i(166));if(s=se.current,Ta(l)){if(s=l.stateNode,c=l.memoizedProps,h=null,m=Fn,m!==null)switch(m.tag){case 27:case 5:h=m.memoizedProps}s[Ut]=l,s=!!(s.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||WS(s.nodeValue,c)),s||ll(l,!0)}else s=Fh(s).createTextNode(h),s[Ut]=l,l.stateNode=s}return $t(l),null;case 31:if(c=l.memoizedState,s===null||s.memoizedState!==null){if(h=Ta(l),c!==null){if(s===null){if(!h)throw Error(i(318));if(s=l.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(i(557));s[Ut]=l}else xo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;$t(l),s=!1}else c=zm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=c),s=!0;if(!s)return l.flags&256?(Vi(l),l):(Vi(l),null);if((l.flags&128)!==0)throw Error(i(558))}return $t(l),null;case 13:if(h=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Ta(l),h!==null&&h.dehydrated!==null){if(s===null){if(!m)throw Error(i(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[Ut]=l}else xo(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;$t(l),m=!1}else m=zm(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(Vi(l),l):(Vi(l),null)}return Vi(l),(l.flags&128)!==0?(l.lanes=c,l):(c=h!==null,s=s!==null&&s.memoizedState!==null,c&&(h=l.child,m=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(m=h.alternate.memoizedState.cachePool.pool),y=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(y=h.memoizedState.cachePool.pool),y!==m&&(h.flags|=2048)),c!==s&&c&&(l.child.flags|=8192),Oh(l,l.updateQueue),$t(l),null);case 4:return xe(),s===null&&Yg(l.stateNode.containerInfo),$t(l),null;case 10:return br(l.type),$t(l),null;case 19:if(U(mn),h=l.memoizedState,h===null)return $t(l),null;if(m=(l.flags&128)!==0,y=h.rendering,y===null)if(m)mu(h,!1);else{if(an!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(y=gh(s),y!==null){for(l.flags|=128,mu(h,!1),s=y.updateQueue,l.updateQueue=s,Oh(l,s),l.subtreeFlags=0,s=c,c=l.child;c!==null;)Rx(c,s),c=c.sibling;return te(mn,mn.current&1|2),xt&&gr(l,h.treeForkCount),l.child}s=s.sibling}h.tail!==null&&Ae()>Bh&&(l.flags|=128,m=!0,mu(h,!1),l.lanes=4194304)}else{if(!m)if(s=gh(y),s!==null){if(l.flags|=128,m=!0,s=s.updateQueue,l.updateQueue=s,Oh(l,s),mu(h,!0),h.tail===null&&h.tailMode==="hidden"&&!y.alternate&&!xt)return $t(l),null}else 2*Ae()-h.renderingStartTime>Bh&&c!==536870912&&(l.flags|=128,m=!0,mu(h,!1),l.lanes=4194304);h.isBackwards?(y.sibling=l.child,l.child=y):(s=h.last,s!==null?s.sibling=y:l.child=y,h.last=y)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=Ae(),s.sibling=null,c=mn.current,te(mn,m?c&1|2:c&1),xt&&gr(l,h.treeForkCount),s):($t(l),null);case 22:case 23:return Vi(l),Wm(),h=l.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(l.flags|=8192):h&&(l.flags|=8192),h?(c&536870912)!==0&&(l.flags&128)===0&&($t(l),l.subtreeFlags&6&&(l.flags|=8192)):$t(l),c=l.updateQueue,c!==null&&Oh(l,c.retryQueue),c=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),h=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(h=l.memoizedState.cachePool.pool),h!==c&&(l.flags|=2048),s!==null&&U(Co),null;case 24:return c=null,s!==null&&(c=s.memoizedState.cache),l.memoizedState.cache!==c&&(l.flags|=2048),br(Cn),$t(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function uM(s,l){switch(Bm(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return br(Cn),xe(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return ie(l),null;case 31:if(l.memoizedState!==null){if(Vi(l),l.alternate===null)throw Error(i(340));xo()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 13:if(Vi(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(i(340));xo()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return U(mn),null;case 4:return xe(),null;case 10:return br(l.type),null;case 22:case 23:return Vi(l),Wm(),s!==null&&U(Co),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return br(Cn),null;case 25:return null;default:return null}}function eS(s,l){switch(Bm(l),l.tag){case 3:br(Cn),xe();break;case 26:case 27:case 5:ie(l);break;case 4:xe();break;case 31:l.memoizedState!==null&&Vi(l);break;case 13:Vi(l);break;case 19:U(mn);break;case 10:br(l.type);break;case 22:case 23:Vi(l),Wm(),s!==null&&U(Co);break;case 24:br(Cn)}}function gu(s,l){try{var c=l.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var m=h.next;c=m;do{if((c.tag&s)===s){h=void 0;var y=c.create,C=c.inst;h=y(),C.destroy=h}c=c.next}while(c!==m)}}catch(O){It(l,l.return,O)}}function dl(s,l,c){try{var h=l.updateQueue,m=h!==null?h.lastEffect:null;if(m!==null){var y=m.next;h=y;do{if((h.tag&s)===s){var C=h.inst,O=C.destroy;if(O!==void 0){C.destroy=void 0,m=l;var I=c,W=O;try{W()}catch(oe){It(m,I,oe)}}}h=h.next}while(h!==y)}}catch(oe){It(l,l.return,oe)}}function tS(s){var l=s.updateQueue;if(l!==null){var c=s.stateNode;try{Gx(l,c)}catch(h){It(s,s.return,h)}}}function nS(s,l,c){c.props=To(s.type,s.memoizedProps),c.state=s.memoizedState;try{c.componentWillUnmount()}catch(h){It(s,l,h)}}function yu(s,l){try{var c=s.ref;if(c!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof c=="function"?s.refCleanup=c(h):c.current=h}}catch(m){It(s,l,m)}}function Us(s,l){var c=s.ref,h=s.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(m){It(s,l,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(m){It(s,l,m)}else c.current=null}function iS(s){var l=s.type,c=s.memoizedProps,h=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":c.autoFocus&&h.focus();break e;case"img":c.src?h.src=c.src:c.srcSet&&(h.srcset=c.srcSet)}}catch(m){It(s,s.return,m)}}function Rg(s,l,c){try{var h=s.stateNode;DM(h,s.type,c,l),h[rn]=l}catch(m){It(s,s.return,m)}}function sS(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&xl(s.type)||s.tag===4}function Tg(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||sS(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&xl(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Og(s,l,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,l?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(s,l):(l=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,l.appendChild(s),c=c._reactRootContainer,c!=null||l.onclick!==null||(l.onclick=xs));else if(h!==4&&(h===27&&xl(s.type)&&(c=s.stateNode,l=null),s=s.child,s!==null))for(Og(s,l,c),s=s.sibling;s!==null;)Og(s,l,c),s=s.sibling}function Mh(s,l,c){var h=s.tag;if(h===5||h===6)s=s.stateNode,l?c.insertBefore(s,l):c.appendChild(s);else if(h!==4&&(h===27&&xl(s.type)&&(c=s.stateNode),s=s.child,s!==null))for(Mh(s,l,c),s=s.sibling;s!==null;)Mh(s,l,c),s=s.sibling}function rS(s){var l=s.stateNode,c=s.memoizedProps;try{for(var h=s.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);Kn(l,h,c),l[Ut]=s,l[rn]=c}catch(y){It(s,s.return,y)}}var Cr=!1,En=!1,Mg=!1,lS=typeof WeakSet=="function"?WeakSet:Set,Pn=null;function fM(s,l){if(s=s.containerInfo,$g=$h,s=bx(s),Cm(s)){if("selectionStart"in s)var c={start:s.selectionStart,end:s.selectionEnd};else e:{c=(c=s.ownerDocument)&&c.defaultView||window;var h=c.getSelection&&c.getSelection();if(h&&h.rangeCount!==0){c=h.anchorNode;var m=h.anchorOffset,y=h.focusNode;h=h.focusOffset;try{c.nodeType,y.nodeType}catch{c=null;break e}var C=0,O=-1,I=-1,W=0,oe=0,ue=s,Z=null;t:for(;;){for(var re;ue!==c||m!==0&&ue.nodeType!==3||(O=C+m),ue!==y||h!==0&&ue.nodeType!==3||(I=C+h),ue.nodeType===3&&(C+=ue.nodeValue.length),(re=ue.firstChild)!==null;)Z=ue,ue=re;for(;;){if(ue===s)break t;if(Z===c&&++W===m&&(O=C),Z===y&&++oe===h&&(I=C),(re=ue.nextSibling)!==null)break;ue=Z,Z=ue.parentNode}ue=re}c=O===-1||I===-1?null:{start:O,end:I}}else c=null}c=c||{start:0,end:0}}else c=null;for(Zg={focusedElem:s,selectionRange:c},$h=!1,Pn=l;Pn!==null;)if(l=Pn,s=l.child,(l.subtreeFlags&1028)!==0&&s!==null)s.return=l,Pn=s;else for(;Pn!==null;){switch(l=Pn,y=l.alternate,s=l.flags,l.tag){case 0:if((s&4)!==0&&(s=l.updateQueue,s=s!==null?s.events:null,s!==null))for(c=0;c<s.length;c++)m=s[c],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&y!==null){s=void 0,c=l,m=y.memoizedProps,y=y.memoizedState,h=c.stateNode;try{var Pe=To(c.type,m);s=h.getSnapshotBeforeUpdate(Pe,y),h.__reactInternalSnapshotBeforeUpdate=s}catch($e){It(c,c.return,$e)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,c=s.nodeType,c===9)ty(s);else if(c===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":ty(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(i(163))}if(s=l.sibling,s!==null){s.return=l.return,Pn=s;break}Pn=l.return}}function oS(s,l,c){var h=c.flags;switch(c.tag){case 0:case 11:case 15:Ar(s,c),h&4&&gu(5,c);break;case 1:if(Ar(s,c),h&4)if(s=c.stateNode,l===null)try{s.componentDidMount()}catch(C){It(c,c.return,C)}else{var m=To(c.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(m,l,s.__reactInternalSnapshotBeforeUpdate)}catch(C){It(c,c.return,C)}}h&64&&tS(c),h&512&&yu(c,c.return);break;case 3:if(Ar(s,c),h&64&&(s=c.updateQueue,s!==null)){if(l=null,c.child!==null)switch(c.child.tag){case 27:case 5:l=c.child.stateNode;break;case 1:l=c.child.stateNode}try{Gx(s,l)}catch(C){It(c,c.return,C)}}break;case 27:l===null&&h&4&&rS(c);case 26:case 5:Ar(s,c),l===null&&h&4&&iS(c),h&512&&yu(c,c.return);break;case 12:Ar(s,c);break;case 31:Ar(s,c),h&4&&uS(s,c);break;case 13:Ar(s,c),h&4&&fS(s,c),h&64&&(s=c.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(c=xM.bind(null,c),VM(s,c))));break;case 22:if(h=c.memoizedState!==null||Cr,!h){l=l!==null&&l.memoizedState!==null||En,m=Cr;var y=En;Cr=h,(En=l)&&!y?Er(s,c,(c.subtreeFlags&8772)!==0):Ar(s,c),Cr=m,En=y}break;case 30:break;default:Ar(s,c)}}function aS(s){var l=s.alternate;l!==null&&(s.alternate=null,aS(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&ma(l)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var en=null,wi=!1;function kr(s,l,c){for(c=c.child;c!==null;)cS(s,l,c),c=c.sibling}function cS(s,l,c){if(Ue&&typeof Ue.onCommitFiberUnmount=="function")try{Ue.onCommitFiberUnmount(ht,c)}catch{}switch(c.tag){case 26:En||Us(c,l),kr(s,l,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:En||Us(c,l);var h=en,m=wi;xl(c.type)&&(en=c.stateNode,wi=!1),kr(s,l,c),Eu(c.stateNode),en=h,wi=m;break;case 5:En||Us(c,l);case 6:if(h=en,m=wi,en=null,kr(s,l,c),en=h,wi=m,en!==null)if(wi)try{(en.nodeType===9?en.body:en.nodeName==="HTML"?en.ownerDocument.body:en).removeChild(c.stateNode)}catch(y){It(c,l,y)}else try{en.removeChild(c.stateNode)}catch(y){It(c,l,y)}break;case 18:en!==null&&(wi?(s=en,tw(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,c.stateNode),Wa(s)):tw(en,c.stateNode));break;case 4:h=en,m=wi,en=c.stateNode.containerInfo,wi=!0,kr(s,l,c),en=h,wi=m;break;case 0:case 11:case 14:case 15:dl(2,c,l),En||dl(4,c,l),kr(s,l,c);break;case 1:En||(Us(c,l),h=c.stateNode,typeof h.componentWillUnmount=="function"&&nS(c,l,h)),kr(s,l,c);break;case 21:kr(s,l,c);break;case 22:En=(h=En)||c.memoizedState!==null,kr(s,l,c),En=h;break;default:kr(s,l,c)}}function uS(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{Wa(s)}catch(c){It(l,l.return,c)}}}function fS(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Wa(s)}catch(c){It(l,l.return,c)}}function hM(s){switch(s.tag){case 31:case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new lS),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new lS),l;default:throw Error(i(435,s.tag))}}function Nh(s,l){var c=hM(s);l.forEach(function(h){if(!c.has(h)){c.add(h);var m=SM.bind(null,s,h);h.then(m,m)}})}function Ci(s,l){var c=l.deletions;if(c!==null)for(var h=0;h<c.length;h++){var m=c[h],y=s,C=l,O=C;e:for(;O!==null;){switch(O.tag){case 27:if(xl(O.type)){en=O.stateNode,wi=!1;break e}break;case 5:en=O.stateNode,wi=!1;break e;case 3:case 4:en=O.stateNode.containerInfo,wi=!0;break e}O=O.return}if(en===null)throw Error(i(160));cS(y,C,m),en=null,wi=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)hS(l,s),l=l.sibling}var ws=null;function hS(s,l){var c=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:Ci(l,s),ki(s),h&4&&(dl(3,s,s.return),gu(3,s),dl(5,s,s.return));break;case 1:Ci(l,s),ki(s),h&512&&(En||c===null||Us(c,c.return)),h&64&&Cr&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(c=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=c===null?h:c.concat(h))));break;case 26:var m=ws;if(Ci(l,s),ki(s),h&512&&(En||c===null||Us(c,c.return)),h&4){var y=c!==null?c.memoizedState:null;if(h=s.memoizedState,c===null)if(h===null)if(s.stateNode===null){e:{h=s.type,c=s.memoizedProps,m=m.ownerDocument||m;t:switch(h){case"title":y=m.getElementsByTagName("title")[0],(!y||y[hr]||y[Ut]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(h),m.head.insertBefore(y,m.querySelector("head > title"))),Kn(y,h,c),y[Ut]=s,Ot(y),h=y;break e;case"link":var C=hw("link","href",m).get(h+(c.href||""));if(C){for(var O=0;O<C.length;O++)if(y=C[O],y.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&y.getAttribute("rel")===(c.rel==null?null:c.rel)&&y.getAttribute("title")===(c.title==null?null:c.title)&&y.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){C.splice(O,1);break t}}y=m.createElement(h),Kn(y,h,c),m.head.appendChild(y);break;case"meta":if(C=hw("meta","content",m).get(h+(c.content||""))){for(O=0;O<C.length;O++)if(y=C[O],y.getAttribute("content")===(c.content==null?null:""+c.content)&&y.getAttribute("name")===(c.name==null?null:c.name)&&y.getAttribute("property")===(c.property==null?null:c.property)&&y.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&y.getAttribute("charset")===(c.charSet==null?null:c.charSet)){C.splice(O,1);break t}}y=m.createElement(h),Kn(y,h,c),m.head.appendChild(y);break;default:throw Error(i(468,h))}y[Ut]=s,Ot(y),h=y}s.stateNode=h}else dw(m,s.type,s.stateNode);else s.stateNode=fw(m,h,s.memoizedProps);else y!==h?(y===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):y.count--,h===null?dw(m,s.type,s.stateNode):fw(m,h,s.memoizedProps)):h===null&&s.stateNode!==null&&Rg(s,s.memoizedProps,c.memoizedProps)}break;case 27:Ci(l,s),ki(s),h&512&&(En||c===null||Us(c,c.return)),c!==null&&h&4&&Rg(s,s.memoizedProps,c.memoizedProps);break;case 5:if(Ci(l,s),ki(s),h&512&&(En||c===null||Us(c,c.return)),s.flags&32){m=s.stateNode;try{Je(m,"")}catch(Pe){It(s,s.return,Pe)}}h&4&&s.stateNode!=null&&(m=s.memoizedProps,Rg(s,m,c!==null?c.memoizedProps:m)),h&1024&&(Mg=!0);break;case 6:if(Ci(l,s),ki(s),h&4){if(s.stateNode===null)throw Error(i(162));h=s.memoizedProps,c=s.stateNode;try{c.nodeValue=h}catch(Pe){It(s,s.return,Pe)}}break;case 3:if(Kh=null,m=ws,ws=Gh(l.containerInfo),Ci(l,s),ws=m,ki(s),h&4&&c!==null&&c.memoizedState.isDehydrated)try{Wa(l.containerInfo)}catch(Pe){It(s,s.return,Pe)}Mg&&(Mg=!1,dS(s));break;case 4:h=ws,ws=Gh(s.stateNode.containerInfo),Ci(l,s),ki(s),ws=h;break;case 12:Ci(l,s),ki(s);break;case 31:Ci(l,s),ki(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Nh(s,h)));break;case 13:Ci(l,s),ki(s),s.child.flags&8192&&s.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(jh=Ae()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Nh(s,h)));break;case 22:m=s.memoizedState!==null;var I=c!==null&&c.memoizedState!==null,W=Cr,oe=En;if(Cr=W||m,En=oe||I,Ci(l,s),En=oe,Cr=W,ki(s),h&8192)e:for(l=s.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(c===null||I||Cr||En||Oo(s)),c=null,l=s;;){if(l.tag===5||l.tag===26){if(c===null){I=c=l;try{if(y=I.stateNode,m)C=y.style,typeof C.setProperty=="function"?C.setProperty("display","none","important"):C.display="none";else{O=I.stateNode;var ue=I.memoizedProps.style,Z=ue!=null&&ue.hasOwnProperty("display")?ue.display:null;O.style.display=Z==null||typeof Z=="boolean"?"":(""+Z).trim()}}catch(Pe){It(I,I.return,Pe)}}}else if(l.tag===6){if(c===null){I=l;try{I.stateNode.nodeValue=m?"":I.memoizedProps}catch(Pe){It(I,I.return,Pe)}}}else if(l.tag===18){if(c===null){I=l;try{var re=I.stateNode;m?nw(re,!0):nw(I.stateNode,!1)}catch(Pe){It(I,I.return,Pe)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;c===l&&(c=null),l=l.return}c===l&&(c=null),l.sibling.return=l.return,l=l.sibling}h&4&&(h=s.updateQueue,h!==null&&(c=h.retryQueue,c!==null&&(h.retryQueue=null,Nh(s,c))));break;case 19:Ci(l,s),ki(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,Nh(s,h)));break;case 30:break;case 21:break;default:Ci(l,s),ki(s)}}function ki(s){var l=s.flags;if(l&2){try{for(var c,h=s.return;h!==null;){if(sS(h)){c=h;break}h=h.return}if(c==null)throw Error(i(160));switch(c.tag){case 27:var m=c.stateNode,y=Tg(s);Mh(s,y,m);break;case 5:var C=c.stateNode;c.flags&32&&(Je(C,""),c.flags&=-33);var O=Tg(s);Mh(s,O,C);break;case 3:case 4:var I=c.stateNode.containerInfo,W=Tg(s);Og(s,W,I);break;default:throw Error(i(161))}}catch(oe){It(s,s.return,oe)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function dS(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;dS(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function Ar(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)oS(s,l.alternate,l),l=l.sibling}function Oo(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:dl(4,l,l.return),Oo(l);break;case 1:Us(l,l.return);var c=l.stateNode;typeof c.componentWillUnmount=="function"&&nS(l,l.return,c),Oo(l);break;case 27:Eu(l.stateNode);case 26:case 5:Us(l,l.return),Oo(l);break;case 22:l.memoizedState===null&&Oo(l);break;case 30:Oo(l);break;default:Oo(l)}s=s.sibling}}function Er(s,l,c){for(c=c&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var h=l.alternate,m=s,y=l,C=y.flags;switch(y.tag){case 0:case 11:case 15:Er(m,y,c),gu(4,y);break;case 1:if(Er(m,y,c),h=y,m=h.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(W){It(h,h.return,W)}if(h=y,m=h.updateQueue,m!==null){var O=h.stateNode;try{var I=m.shared.hiddenCallbacks;if(I!==null)for(m.shared.hiddenCallbacks=null,m=0;m<I.length;m++)Fx(I[m],O)}catch(W){It(h,h.return,W)}}c&&C&64&&tS(y),yu(y,y.return);break;case 27:rS(y);case 26:case 5:Er(m,y,c),c&&h===null&&C&4&&iS(y),yu(y,y.return);break;case 12:Er(m,y,c);break;case 31:Er(m,y,c),c&&C&4&&uS(m,y);break;case 13:Er(m,y,c),c&&C&4&&fS(m,y);break;case 22:y.memoizedState===null&&Er(m,y,c),yu(y,y.return);break;case 30:break;default:Er(m,y,c)}l=l.sibling}}function Ng(s,l){var c=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(c=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==c&&(s!=null&&s.refCount++,c!=null&&iu(c))}function Dg(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&iu(s))}function Cs(s,l,c,h){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)pS(s,l,c,h),l=l.sibling}function pS(s,l,c,h){var m=l.flags;switch(l.tag){case 0:case 11:case 15:Cs(s,l,c,h),m&2048&&gu(9,l);break;case 1:Cs(s,l,c,h);break;case 3:Cs(s,l,c,h),m&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&iu(s)));break;case 12:if(m&2048){Cs(s,l,c,h),s=l.stateNode;try{var y=l.memoizedProps,C=y.id,O=y.onPostCommit;typeof O=="function"&&O(C,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(I){It(l,l.return,I)}}else Cs(s,l,c,h);break;case 31:Cs(s,l,c,h);break;case 13:Cs(s,l,c,h);break;case 23:break;case 22:y=l.stateNode,C=l.alternate,l.memoizedState!==null?y._visibility&2?Cs(s,l,c,h):bu(s,l):y._visibility&2?Cs(s,l,c,h):(y._visibility|=2,Pa(s,l,c,h,(l.subtreeFlags&10256)!==0||!1)),m&2048&&Ng(C,l);break;case 24:Cs(s,l,c,h),m&2048&&Dg(l.alternate,l);break;default:Cs(s,l,c,h)}}function Pa(s,l,c,h,m){for(m=m&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var y=s,C=l,O=c,I=h,W=C.flags;switch(C.tag){case 0:case 11:case 15:Pa(y,C,O,I,m),gu(8,C);break;case 23:break;case 22:var oe=C.stateNode;C.memoizedState!==null?oe._visibility&2?Pa(y,C,O,I,m):bu(y,C):(oe._visibility|=2,Pa(y,C,O,I,m)),m&&W&2048&&Ng(C.alternate,C);break;case 24:Pa(y,C,O,I,m),m&&W&2048&&Dg(C.alternate,C);break;default:Pa(y,C,O,I,m)}l=l.sibling}}function bu(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var c=s,h=l,m=h.flags;switch(h.tag){case 22:bu(c,h),m&2048&&Ng(h.alternate,h);break;case 24:bu(c,h),m&2048&&Dg(h.alternate,h);break;default:bu(c,h)}l=l.sibling}}var vu=8192;function Ha(s,l,c){if(s.subtreeFlags&vu)for(s=s.child;s!==null;)mS(s,l,c),s=s.sibling}function mS(s,l,c){switch(s.tag){case 26:Ha(s,l,c),s.flags&vu&&s.memoizedState!==null&&ZM(c,ws,s.memoizedState,s.memoizedProps);break;case 5:Ha(s,l,c);break;case 3:case 4:var h=ws;ws=Gh(s.stateNode.containerInfo),Ha(s,l,c),ws=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=vu,vu=16777216,Ha(s,l,c),vu=h):Ha(s,l,c));break;default:Ha(s,l,c)}}function gS(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function xu(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var h=l[c];Pn=h,bS(h,s)}gS(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)yS(s),s=s.sibling}function yS(s){switch(s.tag){case 0:case 11:case 15:xu(s),s.flags&2048&&dl(9,s,s.return);break;case 3:xu(s);break;case 12:xu(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,Dh(s)):xu(s);break;default:xu(s)}}function Dh(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var c=0;c<l.length;c++){var h=l[c];Pn=h,bS(h,s)}gS(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:dl(8,l,l.return),Dh(l);break;case 22:c=l.stateNode,c._visibility&2&&(c._visibility&=-3,Dh(l));break;default:Dh(l)}s=s.sibling}}function bS(s,l){for(;Pn!==null;){var c=Pn;switch(c.tag){case 0:case 11:case 15:dl(8,c,l);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var h=c.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:iu(c.memoizedState.cache)}if(h=c.child,h!==null)h.return=c,Pn=h;else e:for(c=s;Pn!==null;){h=Pn;var m=h.sibling,y=h.return;if(aS(h),h===c){Pn=null;break e}if(m!==null){m.return=y,Pn=m;break e}Pn=y}}}var dM={getCacheForType:function(s){var l=Gn(Cn),c=l.data.get(s);return c===void 0&&(c=s(),l.data.set(s,c)),c},cacheSignal:function(){return Gn(Cn).controller.signal}},pM=typeof WeakMap=="function"?WeakMap:Map,Nt=0,qt=null,gt=null,bt=0,zt=0,_i=null,pl=!1,Va=!1,jg=!1,Rr=0,an=0,ml=0,Mo=0,Bg=0,Ui=0,_a=0,Su=null,Ai=null,Lg=!1,jh=0,vS=0,Bh=1/0,Lh=null,gl=null,Mn=0,yl=null,Ua=null,Tr=0,zg=0,Ig=null,xS=null,wu=0,Pg=null;function qi(){return(Nt&2)!==0&&bt!==0?bt&-bt:z.T!==null?Fg():Is()}function SS(){if(Ui===0)if((bt&536870912)===0||xt){var s=pn;pn<<=1,(pn&3932160)===0&&(pn=262144),Ui=s}else Ui=536870912;return s=Hi.current,s!==null&&(s.flags|=32),Ui}function Ei(s,l,c){(s===qt&&(zt===2||zt===9)||s.cancelPendingCommit!==null)&&(qa(s,0),bl(s,bt,Ui,!1)),oi(s,c),((Nt&2)===0||s!==qt)&&(s===qt&&((Nt&2)===0&&(Mo|=c),an===4&&bl(s,bt,Ui,!1)),qs(s))}function wS(s,l,c){if((Nt&6)!==0)throw Error(i(327));var h=!c&&(l&127)===0&&(l&s.expiredLanes)===0||Qt(s,l),m=h?yM(s,l):Vg(s,l,!0),y=h;do{if(m===0){Va&&!h&&bl(s,l,0,!1);break}else{if(c=s.current.alternate,y&&!mM(c)){m=Vg(s,l,!1),y=!1;continue}if(m===2){if(y=l,s.errorRecoveryDisabledLanes&y)var C=0;else C=s.pendingLanes&-536870913,C=C!==0?C:C&536870912?536870912:0;if(C!==0){l=C;e:{var O=s;m=Su;var I=O.current.memoizedState.isDehydrated;if(I&&(qa(O,C).flags|=256),C=Vg(O,C,!1),C!==2){if(jg&&!I){O.errorRecoveryDisabledLanes|=y,Mo|=y,m=4;break e}y=Ai,Ai=m,y!==null&&(Ai===null?Ai=y:Ai.push.apply(Ai,y))}m=C}if(y=!1,m!==2)continue}}if(m===1){qa(s,0),bl(s,l,0,!0);break}e:{switch(h=s,y=m,y){case 0:case 1:throw Error(i(345));case 4:if((l&4194048)!==l)break;case 6:bl(h,l,Ui,!pl);break e;case 2:Ai=null;break;case 3:case 5:break;default:throw Error(i(329))}if((l&62914560)===l&&(m=jh+300-Ae(),10<m)){if(bl(h,l,Ui,!pl),Et(h,0,!0)!==0)break e;Tr=l,h.timeoutHandle=JS(CS.bind(null,h,c,Ai,Lh,Lg,l,Ui,Mo,_a,pl,y,"Throttled",-0,0),m);break e}CS(h,c,Ai,Lh,Lg,l,Ui,Mo,_a,pl,y,null,-0,0)}}break}while(!0);qs(s)}function CS(s,l,c,h,m,y,C,O,I,W,oe,ue,Z,re){if(s.timeoutHandle=-1,ue=l.subtreeFlags,ue&8192||(ue&16785408)===16785408){ue={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:xs},mS(l,y,ue);var Pe=(y&62914560)===y?jh-Ae():(y&4194048)===y?vS-Ae():0;if(Pe=JM(ue,Pe),Pe!==null){Tr=y,s.cancelPendingCommit=Pe(NS.bind(null,s,l,y,c,h,m,C,O,I,oe,ue,null,Z,re)),bl(s,y,C,!W);return}}NS(s,l,y,c,h,m,C,O,I)}function mM(s){for(var l=s;;){var c=l.tag;if((c===0||c===11||c===15)&&l.flags&16384&&(c=l.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var h=0;h<c.length;h++){var m=c[h],y=m.getSnapshot;m=m.value;try{if(!Ii(y(),m))return!1}catch{return!1}}if(c=l.child,l.subtreeFlags&16384&&c!==null)c.return=l,l=c;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function bl(s,l,c,h){l&=~Bg,l&=~Mo,s.suspendedLanes|=l,s.pingedLanes&=~l,h&&(s.warmLanes|=l),h=s.expirationTimes;for(var m=l;0<m;){var y=31-Pt(m),C=1<<y;h[y]=-1,m&=~C}c!==0&<(s,c,l)}function zh(){return(Nt&6)===0?(Cu(0),!1):!0}function Hg(){if(gt!==null){if(zt===0)var s=gt.return;else s=gt,yr=So=null,tg(s),ja=null,ru=0,s=gt;for(;s!==null;)eS(s.alternate,s),s=s.return;gt=null}}function qa(s,l){var c=s.timeoutHandle;c!==-1&&(s.timeoutHandle=-1,LM(c)),c=s.cancelPendingCommit,c!==null&&(s.cancelPendingCommit=null,c()),Tr=0,Hg(),qt=s,gt=c=mr(s.current,null),bt=l,zt=0,_i=null,pl=!1,Va=Qt(s,l),jg=!1,_a=Ui=Bg=Mo=ml=an=0,Ai=Su=null,Lg=!1,(l&8)!==0&&(l|=l&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=l;0<h;){var m=31-Pt(h),y=1<<m;l|=s[m],h&=~y}return Rr=l,ih(),c}function kS(s,l){ct=null,z.H=du,l===Da||l===fh?(l=Vx(),zt=3):l===qm?(l=Vx(),zt=4):zt=l===yg?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,_i=l,gt===null&&(an=1,Ah(s,is(l,s.current)))}function AS(){var s=Hi.current;return s===null?!0:(bt&4194048)===bt?os===null:(bt&62914560)===bt||(bt&536870912)!==0?s===os:!1}function ES(){var s=z.H;return z.H=du,s===null?du:s}function RS(){var s=z.A;return z.A=dM,s}function Ih(){an=4,pl||(bt&4194048)!==bt&&Hi.current!==null||(Va=!0),(ml&134217727)===0&&(Mo&134217727)===0||qt===null||bl(qt,bt,Ui,!1)}function Vg(s,l,c){var h=Nt;Nt|=2;var m=ES(),y=RS();(qt!==s||bt!==l)&&(Lh=null,qa(s,l)),l=!1;var C=an;e:do try{if(zt!==0&>!==null){var O=gt,I=_i;switch(zt){case 8:Hg(),C=6;break e;case 3:case 2:case 9:case 6:Hi.current===null&&(l=!0);var W=zt;if(zt=0,_i=null,Fa(s,O,I,W),c&&Va){C=0;break e}break;default:W=zt,zt=0,_i=null,Fa(s,O,I,W)}}gM(),C=an;break}catch(oe){kS(s,oe)}while(!0);return l&&s.shellSuspendCounter++,yr=So=null,Nt=h,z.H=m,z.A=y,gt===null&&(qt=null,bt=0,ih()),C}function gM(){for(;gt!==null;)TS(gt)}function yM(s,l){var c=Nt;Nt|=2;var h=ES(),m=RS();qt!==s||bt!==l?(Lh=null,Bh=Ae()+500,qa(s,l)):Va=Qt(s,l);e:do try{if(zt!==0&>!==null){l=gt;var y=_i;t:switch(zt){case 1:zt=0,_i=null,Fa(s,l,y,1);break;case 2:case 9:if(Px(y)){zt=0,_i=null,OS(l);break}l=function(){zt!==2&&zt!==9||qt!==s||(zt=7),qs(s)},y.then(l,l);break e;case 3:zt=7;break e;case 4:zt=5;break e;case 7:Px(y)?(zt=0,_i=null,OS(l)):(zt=0,_i=null,Fa(s,l,y,7));break;case 5:var C=null;switch(gt.tag){case 26:C=gt.memoizedState;case 5:case 27:var O=gt;if(C?pw(C):O.stateNode.complete){zt=0,_i=null;var I=O.sibling;if(I!==null)gt=I;else{var W=O.return;W!==null?(gt=W,Ph(W)):gt=null}break t}}zt=0,_i=null,Fa(s,l,y,5);break;case 6:zt=0,_i=null,Fa(s,l,y,6);break;case 8:Hg(),an=6;break e;default:throw Error(i(462))}}bM();break}catch(oe){kS(s,oe)}while(!0);return yr=So=null,z.H=h,z.A=m,Nt=c,gt!==null?0:(qt=null,bt=0,ih(),an)}function bM(){for(;gt!==null&&!Te();)TS(gt)}function TS(s){var l=Z1(s.alternate,s,Rr);s.memoizedProps=s.pendingProps,l===null?Ph(s):gt=l}function OS(s){var l=s,c=l.alternate;switch(l.tag){case 15:case 0:l=Q1(c,l,l.pendingProps,l.type,void 0,bt);break;case 11:l=Q1(c,l,l.pendingProps,l.type.render,l.ref,bt);break;case 5:tg(l);default:eS(c,l),l=gt=Rx(l,Rr),l=Z1(c,l,Rr)}s.memoizedProps=s.pendingProps,l===null?Ph(s):gt=l}function Fa(s,l,c,h){yr=So=null,tg(l),ja=null,ru=0;var m=l.return;try{if(lM(s,m,l,c,bt)){an=1,Ah(s,is(c,s.current)),gt=null;return}}catch(y){if(m!==null)throw gt=m,y;an=1,Ah(s,is(c,s.current)),gt=null;return}l.flags&32768?(xt||h===1?s=!0:Va||(bt&536870912)!==0?s=!1:(pl=s=!0,(h===2||h===9||h===3||h===6)&&(h=Hi.current,h!==null&&h.tag===13&&(h.flags|=16384))),MS(l,s)):Ph(l)}function Ph(s){var l=s;do{if((l.flags&32768)!==0){MS(l,pl);return}s=l.return;var c=cM(l.alternate,l,Rr);if(c!==null){gt=c;return}if(l=l.sibling,l!==null){gt=l;return}gt=l=s}while(l!==null);an===0&&(an=5)}function MS(s,l){do{var c=uM(s.alternate,s);if(c!==null){c.flags&=32767,gt=c;return}if(c=s.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!l&&(s=s.sibling,s!==null)){gt=s;return}gt=s=c}while(s!==null);an=6,gt=null}function NS(s,l,c,h,m,y,C,O,I){s.cancelPendingCommit=null;do Hh();while(Mn!==0);if((Nt&6)!==0)throw Error(i(327));if(l!==null){if(l===s.current)throw Error(i(177));if(y=l.lanes|l.childLanes,y|=Tm,ai(s,c,y,C,O,I),s===qt&&(gt=qt=null,bt=0),Ua=l,yl=s,Tr=c,zg=y,Ig=m,xS=h,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,wM(_e,function(){return zS(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||h){h=z.T,z.T=null,m=Q.p,Q.p=2,C=Nt,Nt|=4;try{fM(s,l,c)}finally{Nt=C,Q.p=m,z.T=h}}Mn=1,DS(),jS(),BS()}}function DS(){if(Mn===1){Mn=0;var s=yl,l=Ua,c=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||c){c=z.T,z.T=null;var h=Q.p;Q.p=2;var m=Nt;Nt|=4;try{hS(l,s);var y=Zg,C=bx(s.containerInfo),O=y.focusedElem,I=y.selectionRange;if(C!==O&&O&&O.ownerDocument&&yx(O.ownerDocument.documentElement,O)){if(I!==null&&Cm(O)){var W=I.start,oe=I.end;if(oe===void 0&&(oe=W),"selectionStart"in O)O.selectionStart=W,O.selectionEnd=Math.min(oe,O.value.length);else{var ue=O.ownerDocument||document,Z=ue&&ue.defaultView||window;if(Z.getSelection){var re=Z.getSelection(),Pe=O.textContent.length,$e=Math.min(I.start,Pe),_t=I.end===void 0?$e:Math.min(I.end,Pe);!re.extend&&$e>_t&&(C=_t,_t=$e,$e=C);var q=gx(O,$e),_=gx(O,_t);if(q&&_&&(re.rangeCount!==1||re.anchorNode!==q.node||re.anchorOffset!==q.offset||re.focusNode!==_.node||re.focusOffset!==_.offset)){var Y=ue.createRange();Y.setStart(q.node,q.offset),re.removeAllRanges(),$e>_t?(re.addRange(Y),re.extend(_.node,_.offset)):(Y.setEnd(_.node,_.offset),re.addRange(Y))}}}}for(ue=[],re=O;re=re.parentNode;)re.nodeType===1&&ue.push({element:re,left:re.scrollLeft,top:re.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;O<ue.length;O++){var ce=ue[O];ce.element.scrollLeft=ce.left,ce.element.scrollTop=ce.top}}$h=!!$g,Zg=$g=null}finally{Nt=m,Q.p=h,z.T=c}}s.current=l,Mn=2}}function jS(){if(Mn===2){Mn=0;var s=yl,l=Ua,c=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||c){c=z.T,z.T=null;var h=Q.p;Q.p=2;var m=Nt;Nt|=4;try{oS(s,l.alternate,l)}finally{Nt=m,Q.p=h,z.T=c}}Mn=3}}function BS(){if(Mn===4||Mn===3){Mn=0,we();var s=yl,l=Ua,c=Tr,h=xS;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Mn=5:(Mn=0,Ua=yl=null,LS(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(gl=null),zs(c),l=l.stateNode,Ue&&typeof Ue.onCommitFiberRoot=="function")try{Ue.onCommitFiberRoot(ht,l,void 0,(l.current.flags&128)===128)}catch{}if(h!==null){l=z.T,m=Q.p,Q.p=2,z.T=null;try{for(var y=s.onRecoverableError,C=0;C<h.length;C++){var O=h[C];y(O.value,{componentStack:O.stack})}}finally{z.T=l,Q.p=m}}(Tr&3)!==0&&Hh(),qs(s),m=s.pendingLanes,(c&261930)!==0&&(m&42)!==0?s===Pg?wu++:(wu=0,Pg=s):wu=0,Cu(0)}}function LS(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,iu(l)))}function Hh(){return DS(),jS(),BS(),zS()}function zS(){if(Mn!==5)return!1;var s=yl,l=zg;zg=0;var c=zs(Tr),h=z.T,m=Q.p;try{Q.p=32>c?32:c,z.T=null,c=Ig,Ig=null;var y=yl,C=Tr;if(Mn=0,Ua=yl=null,Tr=0,(Nt&6)!==0)throw Error(i(331));var O=Nt;if(Nt|=4,yS(y.current),pS(y,y.current,C,c),Nt=O,Cu(0,!1),Ue&&typeof Ue.onPostCommitFiberRoot=="function")try{Ue.onPostCommitFiberRoot(ht,y)}catch{}return!0}finally{Q.p=m,z.T=h,LS(s,l)}}function IS(s,l,c){l=is(c,l),l=gg(s.stateNode,l,2),s=ul(s,l,2),s!==null&&(oi(s,2),qs(s))}function It(s,l,c){if(s.tag===3)IS(s,s,c);else for(;l!==null;){if(l.tag===3){IS(l,s,c);break}else if(l.tag===1){var h=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(gl===null||!gl.has(h))){s=is(c,s),c=P1(2),h=ul(l,c,2),h!==null&&(H1(c,h,l,s),oi(h,2),qs(h));break}}l=l.return}}function _g(s,l,c){var h=s.pingCache;if(h===null){h=s.pingCache=new pM;var m=new Set;h.set(l,m)}else m=h.get(l),m===void 0&&(m=new Set,h.set(l,m));m.has(c)||(jg=!0,m.add(c),s=vM.bind(null,s,l,c),l.then(s,s))}function vM(s,l,c){var h=s.pingCache;h!==null&&h.delete(l),s.pingedLanes|=s.suspendedLanes&c,s.warmLanes&=~c,qt===s&&(bt&c)===c&&(an===4||an===3&&(bt&62914560)===bt&&300>Ae()-jh?(Nt&2)===0&&qa(s,0):Bg|=c,_a===bt&&(_a=0)),qs(s)}function PS(s,l){l===0&&(l=Rn()),s=bo(s,l),s!==null&&(oi(s,l),qs(s))}function xM(s){var l=s.memoizedState,c=0;l!==null&&(c=l.retryLane),PS(s,c)}function SM(s,l){var c=0;switch(s.tag){case 31:case 13:var h=s.stateNode,m=s.memoizedState;m!==null&&(c=m.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(l),PS(s,c)}function wM(s,l){return qe(s,l)}var Vh=null,Ga=null,Ug=!1,_h=!1,qg=!1,vl=0;function qs(s){s!==Ga&&s.next===null&&(Ga===null?Vh=Ga=s:Ga=Ga.next=s),_h=!0,Ug||(Ug=!0,kM())}function Cu(s,l){if(!qg&&_h){qg=!0;do for(var c=!1,h=Vh;h!==null;){if(s!==0){var m=h.pendingLanes;if(m===0)var y=0;else{var C=h.suspendedLanes,O=h.pingedLanes;y=(1<<31-Pt(42|s)+1)-1,y&=m&~(C&~O),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(c=!0,US(h,y))}else y=bt,y=Et(h,h===qt?y:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(y&3)===0||Qt(h,y)||(c=!0,US(h,y));h=h.next}while(c);qg=!1}}function CM(){HS()}function HS(){_h=Ug=!1;var s=0;vl!==0&&BM()&&(s=vl);for(var l=Ae(),c=null,h=Vh;h!==null;){var m=h.next,y=VS(h,l);y===0?(h.next=null,c===null?Vh=m:c.next=m,m===null&&(Ga=c)):(c=h,(s!==0||(y&3)!==0)&&(_h=!0)),h=m}Mn!==0&&Mn!==5||Cu(s),vl!==0&&(vl=0)}function VS(s,l){for(var c=s.suspendedLanes,h=s.pingedLanes,m=s.expirationTimes,y=s.pendingLanes&-62914561;0<y;){var C=31-Pt(y),O=1<<C,I=m[C];I===-1?((O&c)===0||(O&h)!==0)&&(m[C]=sn(O,l)):I<=l&&(s.expiredLanes|=O),y&=~O}if(l=qt,c=bt,c=Et(s,s===l?c:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,c===0||s===l&&(zt===2||zt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&je(h),s.callbackNode=null,s.callbackPriority=0;if((c&3)===0||Qt(s,c)){if(l=c&-c,l===s.callbackPriority)return l;switch(h!==null&&je(h),zs(c)){case 2:case 8:c=nt;break;case 32:c=_e;break;case 268435456:c=at;break;default:c=_e}return h=_S.bind(null,s),c=qe(c,h),s.callbackPriority=l,s.callbackNode=c,l}return h!==null&&h!==null&&je(h),s.callbackPriority=2,s.callbackNode=null,2}function _S(s,l){if(Mn!==0&&Mn!==5)return s.callbackNode=null,s.callbackPriority=0,null;var c=s.callbackNode;if(Hh()&&s.callbackNode!==c)return null;var h=bt;return h=Et(s,s===qt?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(wS(s,h,l),VS(s,Ae()),s.callbackNode!=null&&s.callbackNode===c?_S.bind(null,s):null)}function US(s,l){if(Hh())return null;wS(s,l,!0)}function kM(){zM(function(){(Nt&6)!==0?qe(Ze,CM):HS()})}function Fg(){if(vl===0){var s=Ma;s===0&&(s=st,st<<=1,(st&261888)===0&&(st=256)),vl=s}return vl}function qS(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Gc(""+s)}function FS(s,l){var c=l.ownerDocument.createElement("input");return c.name=l.name,c.value=l.value,s.id&&c.setAttribute("form",s.id),l.parentNode.insertBefore(c,l),s=new FormData(s),c.parentNode.removeChild(c),s}function AM(s,l,c,h,m){if(l==="submit"&&c&&c.stateNode===m){var y=qS((m[rn]||null).action),C=h.submitter;C&&(l=(l=C[rn]||null)?qS(l.formAction):C.getAttribute("formAction"),l!==null&&(y=l,C=null));var O=new Jf("action","action",null,h,m);s.push({event:O,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(vl!==0){var I=C?FS(m,C):new FormData(m);ug(c,{pending:!0,data:I,method:m.method,action:y},null,I)}}else typeof y=="function"&&(O.preventDefault(),I=C?FS(m,C):new FormData(m),ug(c,{pending:!0,data:I,method:m.method,action:y},y,I))},currentTarget:m}]})}}for(var Gg=0;Gg<Rm.length;Gg++){var Qg=Rm[Gg],EM=Qg.toLowerCase(),RM=Qg[0].toUpperCase()+Qg.slice(1);Ss(EM,"on"+RM)}Ss(Sx,"onAnimationEnd"),Ss(wx,"onAnimationIteration"),Ss(Cx,"onAnimationStart"),Ss("dblclick","onDoubleClick"),Ss("focusin","onFocus"),Ss("focusout","onBlur"),Ss(qO,"onTransitionRun"),Ss(FO,"onTransitionStart"),Ss(GO,"onTransitionCancel"),Ss(kx,"onTransitionEnd"),$r("onMouseEnter",["mouseout","mouseover"]),$r("onMouseLeave",["mouseout","mouseover"]),$r("onPointerEnter",["pointerout","pointerover"]),$r("onPointerLeave",["pointerout","pointerover"]),bi("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),bi("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),bi("onBeforeInput",["compositionend","keypress","textInput","paste"]),bi("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),bi("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),bi("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ku="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(" "),TM=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ku));function GS(s,l){l=(l&4)!==0;for(var c=0;c<s.length;c++){var h=s[c],m=h.event;h=h.listeners;e:{var y=void 0;if(l)for(var C=h.length-1;0<=C;C--){var O=h[C],I=O.instance,W=O.currentTarget;if(O=O.listener,I!==y&&m.isPropagationStopped())break e;y=O,m.currentTarget=W;try{y(m)}catch(oe){nh(oe)}m.currentTarget=null,y=I}else for(C=0;C<h.length;C++){if(O=h[C],I=O.instance,W=O.currentTarget,O=O.listener,I!==y&&m.isPropagationStopped())break e;y=O,m.currentTarget=W;try{y(m)}catch(oe){nh(oe)}m.currentTarget=null,y=I}}}}function yt(s,l){var c=l[yi];c===void 0&&(c=l[yi]=new Set);var h=s+"__bubble";c.has(h)||(QS(l,s,2,!1),c.add(h))}function Kg(s,l,c){var h=0;l&&(h|=4),QS(c,s,h,l)}var Uh="_reactListening"+Math.random().toString(36).slice(2);function Yg(s){if(!s[Uh]){s[Uh]=!0,ci.forEach(function(c){c!=="selectionchange"&&(TM.has(c)||Kg(c,!1,s),Kg(c,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Uh]||(l[Uh]=!0,Kg("selectionchange",!1,l))}}function QS(s,l,c,h){switch(Sw(l)){case 2:var m=nN;break;case 8:m=iN;break;default:m=cy}c=m.bind(null,l,c,s),m=void 0,!pm||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),h?m!==void 0?s.addEventListener(l,c,{capture:!0,passive:m}):s.addEventListener(l,c,!0):m!==void 0?s.addEventListener(l,c,{passive:m}):s.addEventListener(l,c,!1)}function Wg(s,l,c,h,m){var y=h;if((l&1)===0&&(l&2)===0&&h!==null)e:for(;;){if(h===null)return;var C=h.tag;if(C===3||C===4){var O=h.stateNode.containerInfo;if(O===m)break;if(C===4)for(C=h.return;C!==null;){var I=C.tag;if((I===3||I===4)&&C.stateNode.containerInfo===m)return;C=C.return}for(;O!==null;){if(C=Ps(O),C===null)return;if(I=C.tag,I===5||I===6||I===26||I===27){h=y=C;continue e}O=O.parentNode}}h=h.return}$v(function(){var W=y,oe=hm(c),ue=[];e:{var Z=Ax.get(s);if(Z!==void 0){var re=Jf,Pe=s;switch(s){case"keypress":if($f(c)===0)break e;case"keydown":case"keyup":re=SO;break;case"focusin":Pe="focus",re=bm;break;case"focusout":Pe="blur",re=bm;break;case"beforeblur":case"afterblur":re=bm;break;case"click":if(c.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":re=ex;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":re=cO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":re=kO;break;case Sx:case wx:case Cx:re=hO;break;case kx:re=EO;break;case"scroll":case"scrollend":re=oO;break;case"wheel":re=TO;break;case"copy":case"cut":case"paste":re=pO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":re=nx;break;case"toggle":case"beforetoggle":re=MO}var $e=(l&4)!==0,_t=!$e&&(s==="scroll"||s==="scrollend"),q=$e?Z!==null?Z+"Capture":null:Z;$e=[];for(var _=W,Y;_!==null;){var ce=_;if(Y=ce.stateNode,ce=ce.tag,ce!==5&&ce!==26&&ce!==27||Y===null||q===null||(ce=Qc(_,q),ce!=null&&$e.push(Au(_,ce,Y))),_t)break;_=_.return}0<$e.length&&(Z=new re(Z,Pe,null,c,oe),ue.push({event:Z,listeners:$e}))}}if((l&7)===0){e:{if(Z=s==="mouseover"||s==="pointerover",re=s==="mouseout"||s==="pointerout",Z&&c!==Wf&&(Pe=c.relatedTarget||c.fromElement)&&(Ps(Pe)||Pe[Tn]))break e;if((re||Z)&&(Z=oe.window===oe?oe:(Z=oe.ownerDocument)?Z.defaultView||Z.parentWindow:window,re?(Pe=c.relatedTarget||c.toElement,re=W,Pe=Pe?Ps(Pe):null,Pe!==null&&(_t=o(Pe),$e=Pe.tag,Pe!==_t||$e!==5&&$e!==27&&$e!==6)&&(Pe=null)):(re=null,Pe=W),re!==Pe)){if($e=ex,ce="onMouseLeave",q="onMouseEnter",_="mouse",(s==="pointerout"||s==="pointerover")&&($e=nx,ce="onPointerLeave",q="onPointerEnter",_="pointer"),_t=re==null?Z:Hs(re),Y=Pe==null?Z:Hs(Pe),Z=new $e(ce,_+"leave",re,c,oe),Z.target=_t,Z.relatedTarget=Y,ce=null,Ps(oe)===W&&($e=new $e(q,_+"enter",Pe,c,oe),$e.target=Y,$e.relatedTarget=_t,ce=$e),_t=ce,re&&Pe)t:{for($e=OM,q=re,_=Pe,Y=0,ce=q;ce;ce=$e(ce))Y++;ce=0;for(var Xe=_;Xe;Xe=$e(Xe))ce++;for(;0<Y-ce;)q=$e(q),Y--;for(;0<ce-Y;)_=$e(_),ce--;for(;Y--;){if(q===_||_!==null&&q===_.alternate){$e=q;break t}q=$e(q),_=$e(_)}$e=null}else $e=null;re!==null&&KS(ue,Z,re,$e,!1),Pe!==null&&_t!==null&&KS(ue,_t,Pe,$e,!0)}}e:{if(Z=W?Hs(W):window,re=Z.nodeName&&Z.nodeName.toLowerCase(),re==="select"||re==="input"&&Z.type==="file")var Rt=ux;else if(ax(Z))if(fx)Rt=VO;else{Rt=PO;var Fe=IO}else re=Z.nodeName,!re||re.toLowerCase()!=="input"||Z.type!=="checkbox"&&Z.type!=="radio"?W&&vs(W.elementType)&&(Rt=ux):Rt=HO;if(Rt&&(Rt=Rt(s,W))){cx(ue,Rt,c,oe);break e}Fe&&Fe(s,Z,W),s==="focusout"&&W&&Z.type==="number"&&W.memoizedProps.value!=null&&Fc(Z,"number",Z.value)}switch(Fe=W?Hs(W):window,s){case"focusin":(ax(Fe)||Fe.contentEditable==="true")&&(wa=Fe,km=W,eu=null);break;case"focusout":eu=km=wa=null;break;case"mousedown":Am=!0;break;case"contextmenu":case"mouseup":case"dragend":Am=!1,vx(ue,c,oe);break;case"selectionchange":if(UO)break;case"keydown":case"keyup":vx(ue,c,oe)}var ut;if(xm)e:{switch(s){case"compositionstart":var vt="onCompositionStart";break e;case"compositionend":vt="onCompositionEnd";break e;case"compositionupdate":vt="onCompositionUpdate";break e}vt=void 0}else Sa?lx(s,c)&&(vt="onCompositionEnd"):s==="keydown"&&c.keyCode===229&&(vt="onCompositionStart");vt&&(ix&&c.locale!=="ko"&&(Sa||vt!=="onCompositionStart"?vt==="onCompositionEnd"&&Sa&&(ut=Zv()):(il=oe,mm="value"in il?il.value:il.textContent,Sa=!0)),Fe=qh(W,vt),0<Fe.length&&(vt=new tx(vt,s,null,c,oe),ue.push({event:vt,listeners:Fe}),ut?vt.data=ut:(ut=ox(c),ut!==null&&(vt.data=ut)))),(ut=DO?jO(s,c):BO(s,c))&&(vt=qh(W,"onBeforeInput"),0<vt.length&&(Fe=new tx("onBeforeInput","beforeinput",null,c,oe),ue.push({event:Fe,listeners:vt}),Fe.data=ut)),AM(ue,s,W,c,oe)}GS(ue,l)})}function Au(s,l,c){return{instance:s,listener:l,currentTarget:c}}function qh(s,l){for(var c=l+"Capture",h=[];s!==null;){var m=s,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=Qc(s,c),m!=null&&h.unshift(Au(s,m,y)),m=Qc(s,l),m!=null&&h.push(Au(s,m,y))),s.tag===3)return h;s=s.return}return[]}function OM(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function KS(s,l,c,h,m){for(var y=l._reactName,C=[];c!==null&&c!==h;){var O=c,I=O.alternate,W=O.stateNode;if(O=O.tag,I!==null&&I===h)break;O!==5&&O!==26&&O!==27||W===null||(I=W,m?(W=Qc(c,y),W!=null&&C.unshift(Au(c,W,I))):m||(W=Qc(c,y),W!=null&&C.push(Au(c,W,I)))),c=c.return}C.length!==0&&s.push({event:l,listeners:C})}var MM=/\r\n?/g,NM=/\u0000|\uFFFD/g;function YS(s){return(typeof s=="string"?s:""+s).replace(MM,`
|
|
49
|
+
`).replace(NM,"")}function WS(s,l){return l=YS(l),YS(s)===l}function Vt(s,l,c,h,m,y){switch(c){case"children":typeof h=="string"?l==="body"||l==="textarea"&&h===""||Je(s,h):(typeof h=="number"||typeof h=="bigint")&&l!=="body"&&Je(s,""+h);break;case"className":Jr(s,"class",h);break;case"tabIndex":Jr(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Jr(s,c,h);break;case"style":On(s,h,y);break;case"data":if(l!=="object"){Jr(s,"data",h);break}case"src":case"href":if(h===""&&(l!=="a"||c!=="href")){s.removeAttribute(c);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=Gc(""+h),s.setAttribute(c,h);break;case"action":case"formAction":if(typeof h=="function"){s.setAttribute(c,"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"&&(c==="formAction"?(l!=="input"&&Vt(s,l,"name",m.name,m,null),Vt(s,l,"formEncType",m.formEncType,m,null),Vt(s,l,"formMethod",m.formMethod,m,null),Vt(s,l,"formTarget",m.formTarget,m,null)):(Vt(s,l,"encType",m.encType,m,null),Vt(s,l,"method",m.method,m,null),Vt(s,l,"target",m.target,m,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(c);break}h=Gc(""+h),s.setAttribute(c,h);break;case"onClick":h!=null&&(s.onclick=xs);break;case"onScroll":h!=null&&yt("scroll",s);break;case"onScrollEnd":h!=null&&yt("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}c=Gc(""+h),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""+h):s.removeAttribute(c);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":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,""):s.removeAttribute(c);break;case"capture":case"download":h===!0?s.setAttribute(c,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(c,h):s.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(c,h):s.removeAttribute(c);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(c):s.setAttribute(c,h);break;case"popover":yt("beforetoggle",s),yt("toggle",s),Zr(s,"popover",h);break;case"xlinkActuate":bs(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":bs(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":bs(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":bs(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":bs(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":bs(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":bs(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":bs(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":bs(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Zr(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=nl.get(c)||c,Zr(s,c,h))}}function Xg(s,l,c,h,m,y){switch(c){case"style":On(s,h,y);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(i(61));if(c=h.__html,c!=null){if(m.children!=null)throw Error(i(60));s.innerHTML=c}}break;case"children":typeof h=="string"?Je(s,h):(typeof h=="number"||typeof h=="bigint")&&Je(s,""+h);break;case"onScroll":h!=null&&yt("scroll",s);break;case"onScrollEnd":h!=null&&yt("scrollend",s);break;case"onClick":h!=null&&(s.onclick=xs);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Xr.hasOwnProperty(c))e:{if(c[0]==="o"&&c[1]==="n"&&(m=c.endsWith("Capture"),l=c.slice(2,m?c.length-7:void 0),y=s[rn]||null,y=y!=null?y[c]:null,typeof y=="function"&&s.removeEventListener(l,y,m),typeof h=="function")){typeof y!="function"&&y!==null&&(c in s?s[c]=null:s.hasAttribute(c)&&s.removeAttribute(c)),s.addEventListener(l,h,m);break e}c in s?s[c]=h:h===!0?s.setAttribute(c,""):Zr(s,c,h)}}}function Kn(s,l,c){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":yt("error",s),yt("load",s);var h=!1,m=!1,y;for(y in c)if(c.hasOwnProperty(y)){var C=c[y];if(C!=null)switch(y){case"src":h=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:Vt(s,l,y,C,c,null)}}m&&Vt(s,l,"srcSet",c.srcSet,c,null),h&&Vt(s,l,"src",c.src,c,null);return;case"input":yt("invalid",s);var O=y=C=m=null,I=null,W=null;for(h in c)if(c.hasOwnProperty(h)){var oe=c[h];if(oe!=null)switch(h){case"name":m=oe;break;case"type":C=oe;break;case"checked":I=oe;break;case"defaultChecked":W=oe;break;case"value":y=oe;break;case"defaultValue":O=oe;break;case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,l));break;default:Vt(s,l,h,oe,c,null)}}Yf(s,y,O,I,W,C,m,!1);return;case"select":yt("invalid",s),h=C=y=null;for(m in c)if(c.hasOwnProperty(m)&&(O=c[m],O!=null))switch(m){case"value":y=O;break;case"defaultValue":C=O;break;case"multiple":h=O;default:Vt(s,l,m,O,c,null)}l=y,c=C,s.multiple=!!h,l!=null?tl(s,!!h,l,!1):c!=null&&tl(s,!!h,c,!0);return;case"textarea":yt("invalid",s),y=m=h=null;for(C in c)if(c.hasOwnProperty(C)&&(O=c[C],O!=null))switch(C){case"value":h=O;break;case"defaultValue":m=O;break;case"children":y=O;break;case"dangerouslySetInnerHTML":if(O!=null)throw Error(i(91));break;default:Vt(s,l,C,O,c,null)}Ke(s,h,m,y);return;case"option":for(I in c)if(c.hasOwnProperty(I)&&(h=c[I],h!=null))switch(I){case"selected":s.selected=h&&typeof h!="function"&&typeof h!="symbol";break;default:Vt(s,l,I,h,c,null)}return;case"dialog":yt("beforetoggle",s),yt("toggle",s),yt("cancel",s),yt("close",s);break;case"iframe":case"object":yt("load",s);break;case"video":case"audio":for(h=0;h<ku.length;h++)yt(ku[h],s);break;case"image":yt("error",s),yt("load",s);break;case"details":yt("toggle",s);break;case"embed":case"source":case"link":yt("error",s),yt("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(W in c)if(c.hasOwnProperty(W)&&(h=c[W],h!=null))switch(W){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:Vt(s,l,W,h,c,null)}return;default:if(vs(l)){for(oe in c)c.hasOwnProperty(oe)&&(h=c[oe],h!==void 0&&Xg(s,l,oe,h,c,void 0));return}}for(O in c)c.hasOwnProperty(O)&&(h=c[O],h!=null&&Vt(s,l,O,h,c,null))}function DM(s,l,c,h){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,C=null,O=null,I=null,W=null,oe=null;for(re in c){var ue=c[re];if(c.hasOwnProperty(re)&&ue!=null)switch(re){case"checked":break;case"value":break;case"defaultValue":I=ue;default:h.hasOwnProperty(re)||Vt(s,l,re,null,h,ue)}}for(var Z in h){var re=h[Z];if(ue=c[Z],h.hasOwnProperty(Z)&&(re!=null||ue!=null))switch(Z){case"type":y=re;break;case"name":m=re;break;case"checked":W=re;break;case"defaultChecked":oe=re;break;case"value":C=re;break;case"defaultValue":O=re;break;case"children":case"dangerouslySetInnerHTML":if(re!=null)throw Error(i(137,l));break;default:re!==ue&&Vt(s,l,Z,re,h,ue)}}qc(s,C,O,I,W,oe,y,m);return;case"select":re=C=O=Z=null;for(y in c)if(I=c[y],c.hasOwnProperty(y)&&I!=null)switch(y){case"value":break;case"multiple":re=I;default:h.hasOwnProperty(y)||Vt(s,l,y,null,h,I)}for(m in h)if(y=h[m],I=c[m],h.hasOwnProperty(m)&&(y!=null||I!=null))switch(m){case"value":Z=y;break;case"defaultValue":O=y;break;case"multiple":C=y;default:y!==I&&Vt(s,l,m,y,h,I)}l=O,c=C,h=re,Z!=null?tl(s,!!c,Z,!1):!!h!=!!c&&(l!=null?tl(s,!!c,l,!0):tl(s,!!c,c?[]:"",!1));return;case"textarea":re=Z=null;for(O in c)if(m=c[O],c.hasOwnProperty(O)&&m!=null&&!h.hasOwnProperty(O))switch(O){case"value":break;case"children":break;default:Vt(s,l,O,null,h,m)}for(C in h)if(m=h[C],y=c[C],h.hasOwnProperty(C)&&(m!=null||y!=null))switch(C){case"value":Z=m;break;case"defaultValue":re=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==y&&Vt(s,l,C,m,h,y)}Me(s,Z,re);return;case"option":for(var Pe in c)if(Z=c[Pe],c.hasOwnProperty(Pe)&&Z!=null&&!h.hasOwnProperty(Pe))switch(Pe){case"selected":s.selected=!1;break;default:Vt(s,l,Pe,null,h,Z)}for(I in h)if(Z=h[I],re=c[I],h.hasOwnProperty(I)&&Z!==re&&(Z!=null||re!=null))switch(I){case"selected":s.selected=Z&&typeof Z!="function"&&typeof Z!="symbol";break;default:Vt(s,l,I,Z,h,re)}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 $e in c)Z=c[$e],c.hasOwnProperty($e)&&Z!=null&&!h.hasOwnProperty($e)&&Vt(s,l,$e,null,h,Z);for(W in h)if(Z=h[W],re=c[W],h.hasOwnProperty(W)&&Z!==re&&(Z!=null||re!=null))switch(W){case"children":case"dangerouslySetInnerHTML":if(Z!=null)throw Error(i(137,l));break;default:Vt(s,l,W,Z,h,re)}return;default:if(vs(l)){for(var _t in c)Z=c[_t],c.hasOwnProperty(_t)&&Z!==void 0&&!h.hasOwnProperty(_t)&&Xg(s,l,_t,void 0,h,Z);for(oe in h)Z=h[oe],re=c[oe],!h.hasOwnProperty(oe)||Z===re||Z===void 0&&re===void 0||Xg(s,l,oe,Z,h,re);return}}for(var q in c)Z=c[q],c.hasOwnProperty(q)&&Z!=null&&!h.hasOwnProperty(q)&&Vt(s,l,q,null,h,Z);for(ue in h)Z=h[ue],re=c[ue],!h.hasOwnProperty(ue)||Z===re||Z==null&&re==null||Vt(s,l,ue,Z,h,re)}function XS(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function jM(){if(typeof performance.getEntriesByType=="function"){for(var s=0,l=0,c=performance.getEntriesByType("resource"),h=0;h<c.length;h++){var m=c[h],y=m.transferSize,C=m.initiatorType,O=m.duration;if(y&&O&&XS(C)){for(C=0,O=m.responseEnd,h+=1;h<c.length;h++){var I=c[h],W=I.startTime;if(W>O)break;var oe=I.transferSize,ue=I.initiatorType;oe&&XS(ue)&&(I=I.responseEnd,C+=oe*(I<O?1:(O-W)/(I-W)))}if(--h,l+=8*(y+C)/(m.duration/1e3),s++,10<s)break}}if(0<s)return l/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var $g=null,Zg=null;function Fh(s){return s.nodeType===9?s:s.ownerDocument}function $S(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function ZS(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function Jg(s,l){return s==="textarea"||s==="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 ey=null;function BM(){var s=window.event;return s&&s.type==="popstate"?s===ey?!1:(ey=s,!0):(ey=null,!1)}var JS=typeof setTimeout=="function"?setTimeout:void 0,LM=typeof clearTimeout=="function"?clearTimeout:void 0,ew=typeof Promise=="function"?Promise:void 0,zM=typeof queueMicrotask=="function"?queueMicrotask:typeof ew<"u"?function(s){return ew.resolve(null).then(s).catch(IM)}:JS;function IM(s){setTimeout(function(){throw s})}function xl(s){return s==="head"}function tw(s,l){var c=l,h=0;do{var m=c.nextSibling;if(s.removeChild(c),m&&m.nodeType===8)if(c=m.data,c==="/$"||c==="/&"){if(h===0){s.removeChild(m),Wa(l);return}h--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")h++;else if(c==="html")Eu(s.ownerDocument.documentElement);else if(c==="head"){c=s.ownerDocument.head,Eu(c);for(var y=c.firstChild;y;){var C=y.nextSibling,O=y.nodeName;y[hr]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||c.removeChild(y),y=C}}else c==="body"&&Eu(s.ownerDocument.body);c=m}while(c);Wa(l)}function nw(s,l){var c=s;s=0;do{var h=c.nextSibling;if(c.nodeType===1?l?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(l?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),h&&h.nodeType===8)if(c=h.data,c==="/$"){if(s===0)break;s--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||s++;c=h}while(c)}function ty(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var c=l;switch(l=l.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":ty(c),ma(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}s.removeChild(c)}}function PM(s,l,c,h){for(;s.nodeType===1;){var m=c;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[hr])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(y=s.getAttribute("rel"),y==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(y!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(y=s.getAttribute("src"),(y!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===y)return s}else return s;if(s=as(s.nextSibling),s===null)break}return null}function HM(s,l,c){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!c||(s=as(s.nextSibling),s===null))return null;return s}function iw(s,l){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!l||(s=as(s.nextSibling),s===null))return null;return s}function ny(s){return s.data==="$?"||s.data==="$~"}function iy(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function VM(s,l){var c=s.ownerDocument;if(s.data==="$~")s._reactRetry=l;else if(s.data!=="$?"||c.readyState!=="loading")l();else{var h=function(){l(),c.removeEventListener("DOMContentLoaded",h)};c.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function as(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return s}var sy=null;function sw(s){s=s.nextSibling;for(var l=0;s;){if(s.nodeType===8){var c=s.data;if(c==="/$"||c==="/&"){if(l===0)return as(s.nextSibling);l--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||l++}s=s.nextSibling}return null}function rw(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var c=s.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(l===0)return s;l--}else c!=="/$"&&c!=="/&"||l++}s=s.previousSibling}return null}function lw(s,l,c){switch(l=Fh(c),s){case"html":if(s=l.documentElement,!s)throw Error(i(452));return s;case"head":if(s=l.head,!s)throw Error(i(453));return s;case"body":if(s=l.body,!s)throw Error(i(454));return s;default:throw Error(i(451))}}function Eu(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);ma(s)}var cs=new Map,ow=new Set;function Gh(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Or=Q.d;Q.d={f:_M,r:UM,D:qM,C:FM,L:GM,m:QM,X:YM,S:KM,M:WM};function _M(){var s=Or.f(),l=zh();return s||l}function UM(s){var l=Yr(s);l!==null&&l.tag===5&&l.type==="form"?k1(l):Or.r(s)}var Qa=typeof document>"u"?null:document;function aw(s,l,c){var h=Qa;if(h&&typeof l=="string"&&l){var m=xi(l);m='link[rel="'+s+'"][href="'+m+'"]',typeof c=="string"&&(m+='[crossorigin="'+c+'"]'),ow.has(m)||(ow.add(m),s={rel:s,crossOrigin:c,href:l},h.querySelector(m)===null&&(l=h.createElement("link"),Kn(l,"link",s),Ot(l),h.head.appendChild(l)))}}function qM(s){Or.D(s),aw("dns-prefetch",s,null)}function FM(s,l){Or.C(s,l),aw("preconnect",s,l)}function GM(s,l,c){Or.L(s,l,c);var h=Qa;if(h&&s&&l){var m='link[rel="preload"][as="'+xi(l)+'"]';l==="image"&&c&&c.imageSrcSet?(m+='[imagesrcset="'+xi(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(m+='[imagesizes="'+xi(c.imageSizes)+'"]')):m+='[href="'+xi(s)+'"]';var y=m;switch(l){case"style":y=Ka(s);break;case"script":y=Ya(s)}cs.has(y)||(s=g({rel:"preload",href:l==="image"&&c&&c.imageSrcSet?void 0:s,as:l},c),cs.set(y,s),h.querySelector(m)!==null||l==="style"&&h.querySelector(Ru(y))||l==="script"&&h.querySelector(Tu(y))||(l=h.createElement("link"),Kn(l,"link",s),Ot(l),h.head.appendChild(l)))}}function QM(s,l){Or.m(s,l);var c=Qa;if(c&&s){var h=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+xi(h)+'"][href="'+xi(s)+'"]',y=m;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=Ya(s)}if(!cs.has(y)&&(s=g({rel:"modulepreload",href:s},l),cs.set(y,s),c.querySelector(m)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Tu(y)))return}h=c.createElement("link"),Kn(h,"link",s),Ot(h),c.head.appendChild(h)}}}function KM(s,l,c){Or.S(s,l,c);var h=Qa;if(h&&s){var m=Wr(h).hoistableStyles,y=Ka(s);l=l||"default";var C=m.get(y);if(!C){var O={loading:0,preload:null};if(C=h.querySelector(Ru(y)))O.loading=5;else{s=g({rel:"stylesheet",href:s,"data-precedence":l},c),(c=cs.get(y))&&ry(s,c);var I=C=h.createElement("link");Ot(I),Kn(I,"link",s),I._p=new Promise(function(W,oe){I.onload=W,I.onerror=oe}),I.addEventListener("load",function(){O.loading|=1}),I.addEventListener("error",function(){O.loading|=2}),O.loading|=4,Qh(C,l,h)}C={type:"stylesheet",instance:C,count:1,state:O},m.set(y,C)}}}function YM(s,l){Or.X(s,l);var c=Qa;if(c&&s){var h=Wr(c).hoistableScripts,m=Ya(s),y=h.get(m);y||(y=c.querySelector(Tu(m)),y||(s=g({src:s,async:!0},l),(l=cs.get(m))&&ly(s,l),y=c.createElement("script"),Ot(y),Kn(y,"link",s),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},h.set(m,y))}}function WM(s,l){Or.M(s,l);var c=Qa;if(c&&s){var h=Wr(c).hoistableScripts,m=Ya(s),y=h.get(m);y||(y=c.querySelector(Tu(m)),y||(s=g({src:s,async:!0,type:"module"},l),(l=cs.get(m))&&ly(s,l),y=c.createElement("script"),Ot(y),Kn(y,"link",s),c.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},h.set(m,y))}}function cw(s,l,c,h){var m=(m=se.current)?Gh(m):null;if(!m)throw Error(i(446));switch(s){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(l=Ka(c.href),c=Wr(m).hoistableStyles,h=c.get(l),h||(h={type:"style",instance:null,count:0,state:null},c.set(l,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){s=Ka(c.href);var y=Wr(m).hoistableStyles,C=y.get(s);if(C||(m=m.ownerDocument||m,C={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(s,C),(y=m.querySelector(Ru(s)))&&!y._p&&(C.instance=y,C.state.loading=5),cs.has(s)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},cs.set(s,c),y||XM(m,s,c,C.state))),l&&h===null)throw Error(i(528,""));return C}if(l&&h!==null)throw Error(i(529,""));return null;case"script":return l=c.async,c=c.src,typeof c=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Ya(c),c=Wr(m).hoistableScripts,h=c.get(l),h||(h={type:"script",instance:null,count:0,state:null},c.set(l,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,s))}}function Ka(s){return'href="'+xi(s)+'"'}function Ru(s){return'link[rel="stylesheet"]['+s+"]"}function uw(s){return g({},s,{"data-precedence":s.precedence,precedence:null})}function XM(s,l,c,h){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?h.loading=1:(l=s.createElement("link"),h.preload=l,l.addEventListener("load",function(){return h.loading|=1}),l.addEventListener("error",function(){return h.loading|=2}),Kn(l,"link",c),Ot(l),s.head.appendChild(l))}function Ya(s){return'[src="'+xi(s)+'"]'}function Tu(s){return"script[async]"+s}function fw(s,l,c){if(l.count++,l.instance===null)switch(l.type){case"style":var h=s.querySelector('style[data-href~="'+xi(c.href)+'"]');if(h)return l.instance=h,Ot(h),h;var m=g({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),Ot(h),Kn(h,"style",m),Qh(h,c.precedence,s),l.instance=h;case"stylesheet":m=Ka(c.href);var y=s.querySelector(Ru(m));if(y)return l.state.loading|=4,l.instance=y,Ot(y),y;h=uw(c),(m=cs.get(m))&&ry(h,m),y=(s.ownerDocument||s).createElement("link"),Ot(y);var C=y;return C._p=new Promise(function(O,I){C.onload=O,C.onerror=I}),Kn(y,"link",h),l.state.loading|=4,Qh(y,c.precedence,s),l.instance=y;case"script":return y=Ya(c.src),(m=s.querySelector(Tu(y)))?(l.instance=m,Ot(m),m):(h=c,(m=cs.get(y))&&(h=g({},c),ly(h,m)),s=s.ownerDocument||s,m=s.createElement("script"),Ot(m),Kn(m,"link",h),s.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(i(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(h=l.instance,l.state.loading|=4,Qh(h,c.precedence,s));return l.instance}function Qh(s,l,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=h.length?h[h.length-1]:null,y=m,C=0;C<h.length;C++){var O=h[C];if(O.dataset.precedence===l)y=O;else if(y!==m)break}y?y.parentNode.insertBefore(s,y.nextSibling):(l=c.nodeType===9?c.head:c,l.insertBefore(s,l.firstChild))}function ry(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function ly(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Kh=null;function hw(s,l,c){if(Kh===null){var h=new Map,m=Kh=new Map;m.set(c,h)}else m=Kh,h=m.get(c),h||(h=new Map,m.set(c,h));if(h.has(s))return h;for(h.set(s,null),c=c.getElementsByTagName(s),m=0;m<c.length;m++){var y=c[m];if(!(y[hr]||y[Ut]||s==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var C=y.getAttribute(l)||"";C=s+C;var O=h.get(C);O?O.push(y):h.set(C,[y])}}return h}function dw(s,l,c){s=s.ownerDocument||s,s.head.insertBefore(c,l==="title"?s.querySelector("head > title"):null)}function $M(s,l,c){if(c===1||l.itemProp!=null)return!1;switch(s){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;switch(l.rel){case"stylesheet":return s=l.disabled,typeof l.precedence=="string"&&s==null;default:return!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 pw(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function ZM(s,l,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var m=Ka(h.href),y=l.querySelector(Ru(m));if(y){l=y._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(s.count++,s=Yh.bind(s),l.then(s,s)),c.state.loading|=4,c.instance=y,Ot(y);return}y=l.ownerDocument||l,h=uw(h),(m=cs.get(m))&&ry(h,m),y=y.createElement("link"),Ot(y);var C=y;C._p=new Promise(function(O,I){C.onload=O,C.onerror=I}),Kn(y,"link",h),c.instance=y}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(c,l),(l=c.state.preload)&&(c.state.loading&3)===0&&(s.count++,c=Yh.bind(s),l.addEventListener("load",c),l.addEventListener("error",c))}}var oy=0;function JM(s,l){return s.stylesheets&&s.count===0&&Xh(s,s.stylesheets),0<s.count||0<s.imgCount?function(c){var h=setTimeout(function(){if(s.stylesheets&&Xh(s,s.stylesheets),s.unsuspend){var y=s.unsuspend;s.unsuspend=null,y()}},6e4+l);0<s.imgBytes&&oy===0&&(oy=62500*jM());var m=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Xh(s,s.stylesheets),s.unsuspend)){var y=s.unsuspend;s.unsuspend=null,y()}},(s.imgBytes>oy?50:800)+l);return s.unsuspend=c,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(m)}}:null}function Yh(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Xh(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var Wh=null;function Xh(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,Wh=new Map,l.forEach(eN,s),Wh=null,Yh.call(s))}function eN(s,l){if(!(l.state.loading&4)){var c=Wh.get(s);if(c)var h=c.get(null);else{c=new Map,Wh.set(s,c);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var C=m[y];(C.nodeName==="LINK"||C.getAttribute("media")!=="not all")&&(c.set(C.dataset.precedence,C),h=C)}h&&c.set(null,h)}m=l.instance,C=m.getAttribute("data-precedence"),y=c.get(C)||h,y===h&&c.set(null,m),c.set(C,m),this.count++,h=Yh.bind(this),m.addEventListener("load",h),m.addEventListener("error",h),y?y.parentNode.insertBefore(m,y.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),l.state.loading|=4}}var Ou={$$typeof:N,Provider:null,Consumer:null,_currentValue:F,_currentValue2:F,_threadCount:0};function tN(s,l,c,h,m,y,C,O,I){this.tag=1,this.containerInfo=s,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=h,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=C,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function mw(s,l,c,h,m,y,C,O,I,W,oe,ue){return s=new tN(s,l,c,C,I,W,oe,ue,O),l=1,y===!0&&(l|=24),y=Pi(3,null,null,l),s.current=y,y.stateNode=s,l=Vm(),l.refCount++,s.pooledCache=l,l.refCount++,y.memoizedState={element:h,isDehydrated:c,cache:l},Fm(y),s}function gw(s){return s?(s=Aa,s):Aa}function yw(s,l,c,h,m,y){m=gw(m),h.context===null?h.context=m:h.pendingContext=m,h=cl(l),h.payload={element:c},y=y===void 0?null:y,y!==null&&(h.callback=y),c=ul(s,h,l),c!==null&&(Ei(c,s,l),ou(c,s,l))}function bw(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var c=s.retryLane;s.retryLane=c!==0&&c<l?c:l}}function ay(s,l){bw(s,l),(s=s.alternate)&&bw(s,l)}function vw(s){if(s.tag===13||s.tag===31){var l=bo(s,67108864);l!==null&&Ei(l,s,67108864),ay(s,67108864)}}function xw(s){if(s.tag===13||s.tag===31){var l=qi();l=ys(l);var c=bo(s,l);c!==null&&Ei(c,s,l),ay(s,l)}}var $h=!0;function nN(s,l,c,h){var m=z.T;z.T=null;var y=Q.p;try{Q.p=2,cy(s,l,c,h)}finally{Q.p=y,z.T=m}}function iN(s,l,c,h){var m=z.T;z.T=null;var y=Q.p;try{Q.p=8,cy(s,l,c,h)}finally{Q.p=y,z.T=m}}function cy(s,l,c,h){if($h){var m=uy(h);if(m===null)Wg(s,l,h,Zh,c),ww(s,h);else if(rN(m,s,l,c,h))h.stopPropagation();else if(ww(s,h),l&4&&-1<sN.indexOf(s)){for(;m!==null;){var y=Yr(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var C=it(y.pendingLanes);if(C!==0){var O=y;for(O.pendingLanes|=2,O.entangledLanes|=2;C;){var I=1<<31-Pt(C);O.entanglements[1]|=I,C&=~I}qs(y),(Nt&6)===0&&(Bh=Ae()+500,Cu(0))}}break;case 31:case 13:O=bo(y,2),O!==null&&Ei(O,y,2),zh(),ay(y,2)}if(y=uy(h),y===null&&Wg(s,l,h,Zh,c),y===m)break;m=y}m!==null&&h.stopPropagation()}else Wg(s,l,h,null,c)}}function uy(s){return s=hm(s),fy(s)}var Zh=null;function fy(s){if(Zh=null,s=Ps(s),s!==null){var l=o(s);if(l===null)s=null;else{var c=l.tag;if(c===13){if(s=a(l),s!==null)return s;s=null}else if(c===31){if(s=u(l),s!==null)return s;s=null}else if(c===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return Zh=s,null}function Sw(s){switch(s){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(Ce()){case Ze:return 2;case nt:return 8;case _e:case rt:return 32;case at:return 268435456;default:return 32}default:return 32}}var hy=!1,Sl=null,wl=null,Cl=null,Mu=new Map,Nu=new Map,kl=[],sN="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 ww(s,l){switch(s){case"focusin":case"focusout":Sl=null;break;case"dragenter":case"dragleave":wl=null;break;case"mouseover":case"mouseout":Cl=null;break;case"pointerover":case"pointerout":Mu.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Nu.delete(l.pointerId)}}function Du(s,l,c,h,m,y){return s===null||s.nativeEvent!==y?(s={blockedOn:l,domEventName:c,eventSystemFlags:h,nativeEvent:y,targetContainers:[m]},l!==null&&(l=Yr(l),l!==null&&vw(l)),s):(s.eventSystemFlags|=h,l=s.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),s)}function rN(s,l,c,h,m){switch(l){case"focusin":return Sl=Du(Sl,s,l,c,h,m),!0;case"dragenter":return wl=Du(wl,s,l,c,h,m),!0;case"mouseover":return Cl=Du(Cl,s,l,c,h,m),!0;case"pointerover":var y=m.pointerId;return Mu.set(y,Du(Mu.get(y)||null,s,l,c,h,m)),!0;case"gotpointercapture":return y=m.pointerId,Nu.set(y,Du(Nu.get(y)||null,s,l,c,h,m)),!0}return!1}function Cw(s){var l=Ps(s.target);if(l!==null){var c=o(l);if(c!==null){if(l=c.tag,l===13){if(l=a(c),l!==null){s.blockedOn=l,fr(s.priority,function(){xw(c)});return}}else if(l===31){if(l=u(c),l!==null){s.blockedOn=l,fr(s.priority,function(){xw(c)});return}}else if(l===3&&c.stateNode.current.memoizedState.isDehydrated){s.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Jh(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var c=uy(s.nativeEvent);if(c===null){c=s.nativeEvent;var h=new c.constructor(c.type,c);Wf=h,c.target.dispatchEvent(h),Wf=null}else return l=Yr(c),l!==null&&vw(l),s.blockedOn=c,!1;l.shift()}return!0}function kw(s,l,c){Jh(s)&&c.delete(l)}function lN(){hy=!1,Sl!==null&&Jh(Sl)&&(Sl=null),wl!==null&&Jh(wl)&&(wl=null),Cl!==null&&Jh(Cl)&&(Cl=null),Mu.forEach(kw),Nu.forEach(kw)}function ed(s,l){s.blockedOn===l&&(s.blockedOn=null,hy||(hy=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,lN)))}var td=null;function Aw(s){td!==s&&(td=s,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){td===s&&(td=null);for(var l=0;l<s.length;l+=3){var c=s[l],h=s[l+1],m=s[l+2];if(typeof h!="function"){if(fy(h||c)===null)continue;break}var y=Yr(c);y!==null&&(s.splice(l,3),l-=3,ug(y,{pending:!0,data:m,method:c.method,action:h},h,m))}}))}function Wa(s){function l(I){return ed(I,s)}Sl!==null&&ed(Sl,s),wl!==null&&ed(wl,s),Cl!==null&&ed(Cl,s),Mu.forEach(l),Nu.forEach(l);for(var c=0;c<kl.length;c++){var h=kl[c];h.blockedOn===s&&(h.blockedOn=null)}for(;0<kl.length&&(c=kl[0],c.blockedOn===null);)Cw(c),c.blockedOn===null&&kl.shift();if(c=(s.ownerDocument||s).$$reactFormReplay,c!=null)for(h=0;h<c.length;h+=3){var m=c[h],y=c[h+1],C=m[rn]||null;if(typeof y=="function")C||Aw(c);else if(C){var O=null;if(y&&y.hasAttribute("formAction")){if(m=y,C=y[rn]||null)O=C.formAction;else if(fy(m)!==null)continue}else O=C.action;typeof O=="function"?c[h+1]=O:(c.splice(h,3),h-=3),Aw(c)}}}function Ew(){function s(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(C){return m=C})},focusReset:"manual",scroll:"manual"})}function l(){m!==null&&(m(),m=null),h||setTimeout(c,20)}function c(){if(!h&&!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 h=!1,m=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(c,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),m!==null&&(m(),m=null)}}}function dy(s){this._internalRoot=s}nd.prototype.render=dy.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(i(409));var c=l.current,h=qi();yw(c,h,s,l,null,null)},nd.prototype.unmount=dy.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;yw(s.current,2,null,s,null,null),zh(),l[Tn]=null}};function nd(s){this._internalRoot=s}nd.prototype.unstable_scheduleHydration=function(s){if(s){var l=Is();s={blockedOn:null,target:s,priority:l};for(var c=0;c<kl.length&&l!==0&&l<kl[c].priority;c++);kl.splice(c,0,s),c===0&&Cw(s)}};var Rw=e.version;if(Rw!=="19.2.7")throw Error(i(527,Rw,"19.2.7"));Q.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(i(188)):(s=Object.keys(s).join(","),Error(i(268,s)));return s=d(l),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var oN={bundleType:0,version:"19.2.7",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.7"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var id=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!id.isDisabled&&id.supportsFiber)try{ht=id.inject(oN),Ue=id}catch{}}return Bu.createRoot=function(s,l){if(!r(s))throw Error(i(299));var c=!1,h="",m=B1,y=L1,C=z1;return l!=null&&(l.unstable_strictMode===!0&&(c=!0),l.identifierPrefix!==void 0&&(h=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(y=l.onCaughtError),l.onRecoverableError!==void 0&&(C=l.onRecoverableError)),l=mw(s,1,!1,null,null,c,h,null,m,y,C,Ew),s[Tn]=l.current,Yg(s),new dy(l)},Bu.hydrateRoot=function(s,l,c){if(!r(s))throw Error(i(299));var h=!1,m="",y=B1,C=L1,O=z1,I=null;return c!=null&&(c.unstable_strictMode===!0&&(h=!0),c.identifierPrefix!==void 0&&(m=c.identifierPrefix),c.onUncaughtError!==void 0&&(y=c.onUncaughtError),c.onCaughtError!==void 0&&(C=c.onCaughtError),c.onRecoverableError!==void 0&&(O=c.onRecoverableError),c.formState!==void 0&&(I=c.formState)),l=mw(s,1,!0,l,c??null,h,m,I,y,C,O,Ew),l.context=gw(null),c=l.current,h=qi(),h=ys(h),m=cl(h),m.callback=null,ul(c,m,h),c=h,l.current.lanes=c,oi(l,c),qs(l),s[Tn]=l.current,Yg(s),new nd(l)},Bu.version="19.2.7",Bu}var Pw;function xN(){if(Pw)return yy.exports;Pw=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),yy.exports=vN(),yy.exports}var SN=xN(),Sy={exports:{}},wy={};/**
|
|
50
50
|
* @license React
|
|
51
51
|
* use-sync-external-store-shim.production.js
|
|
52
52
|
*
|
|
@@ -54,27 +54,27 @@ Error generating stack: `+h.message+`
|
|
|
54
54
|
*
|
|
55
55
|
* This source code is licensed under the MIT license found in the
|
|
56
56
|
* LICENSE file in the root directory of this source tree.
|
|
57
|
-
*/var Pw;function SN(){if(Pw)return wy;Pw=1;var n=Rf();function e(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var t=typeof Object.is=="function"?Object.is:e,i=n.useState,r=n.useEffect,o=n.useLayoutEffect,a=n.useDebugValue;function u(g,b){var v=b(),S=i({inst:{value:v,getSnapshot:b}}),w=S[0].inst,E=S[1];return o(function(){w.value=v,w.getSnapshot=b,f(w)&&E({inst:w})},[g,v,b]),r(function(){return f(w)&&E({inst:w}),g(function(){f(w)&&E({inst:w})})},[g]),a(v),v}function f(g){var b=g.getSnapshot;g=g.value;try{var v=b();return!t(g,v)}catch{return!0}}function d(g,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:u;return wy.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:p,wy}var Hw;function TA(){return Hw||(Hw=1,Sy.exports=SN()),Sy.exports}var jb=TA();const wN=Db.useInsertionEffect,CN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",kN=CN?A.useLayoutEffect:A.useEffect,AN=wN||kN,Bb=n=>{const e=A.useRef([n,(...t)=>e[0](...t)]).current;return AN(()=>{e[0]=n}),e[1]},EN="popstate",Lb="pushState",zb="replaceState",RN="hashchange",Vw=[EN,Lb,zb,RN],TN=n=>{for(const e of Vw)addEventListener(e,n);return()=>{for(const e of Vw)removeEventListener(e,n)}},OA=(n,e)=>jb.useSyncExternalStore(TN,n,e),_w=()=>location.search,ON=({ssrSearch:n}={})=>OA(_w,n!=null?()=>n:_w),Uw=()=>location.pathname,MN=({ssrPath:n}={})=>OA(Uw,n!=null?()=>n:Uw),NN=(n,{replace:e=!1,state:t=null}={})=>history[e?zb:Lb](t,"",n),MA=(n={})=>[MN(n),NN],qw=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[qw]>"u"){for(const n of[Lb,zb]){const e=history[n];history[n]=function(){const t=e.apply(this,arguments),i=new Event(n);return i.arguments=arguments,dispatchEvent(i),t}}Object.defineProperty(window,qw,{value:!0})}var zc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},qo,zl,hc,mA,DN=(mA=class extends zc{constructor(){super();Ye(this,qo);Ye(this,zl);Ye(this,hc);Ne(this,hc,e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){P(this,zl)||this.setEventListener(P(this,hc))}onUnsubscribe(){var e;this.hasListeners()||((e=P(this,zl))==null||e.call(this),Ne(this,zl,void 0))}setEventListener(e){var t;Ne(this,hc,e),(t=P(this,zl))==null||t.call(this),Ne(this,zl,e(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(e){P(this,qo)!==e&&(Ne(this,qo,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof P(this,qo)=="boolean"?P(this,qo):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qo=new WeakMap,zl=new WeakMap,hc=new WeakMap,mA),Ib=new DN,jN={setTimeout:(n,e)=>setTimeout(n,e),clearTimeout:n=>clearTimeout(n),setInterval:(n,e)=>setInterval(n,e),clearInterval:n=>clearInterval(n)},Il,Mb,gA,BN=(gA=class{constructor(){Ye(this,Il,jN);Ye(this,Mb,!1)}setTimeoutProvider(n){Ne(this,Il,n)}setTimeout(n,e){return P(this,Il).setTimeout(n,e)}clearTimeout(n){P(this,Il).clearTimeout(n)}setInterval(n,e){return P(this,Il).setInterval(n,e)}clearInterval(n){P(this,Il).clearInterval(n)}},Il=new WeakMap,Mb=new WeakMap,gA),Po=new BN;function LN(n){setTimeout(n,0)}var zN=typeof window>"u"||"Deno"in globalThis;function hi(){}function IN(n,e){return typeof n=="function"?n(e):n}function c0(n){return typeof n=="number"&&n>=0&&n!==1/0}function NA(n,e){return Math.max(n+(e||0)-Date.now(),0)}function Yl(n,e){return typeof n=="function"?n(e):n}function Ki(n,e){return typeof n=="function"?n(e):n}function Fw(n,e){const{type:t="all",exact:i,fetchStatus:r,predicate:o,queryKey:a,stale:u}=n;if(a){if(i){if(e.queryHash!==Pb(a,e.options))return!1}else if(!of(e.queryKey,a))return!1}if(t!=="all"){const f=e.isActive();if(t==="active"&&!f||t==="inactive"&&f)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||r&&r!==e.state.fetchStatus||o&&!o(e))}function Gw(n,e){const{exact:t,status:i,predicate:r,mutationKey:o}=n;if(o){if(!e.options.mutationKey)return!1;if(t){if(ta(e.options.mutationKey)!==ta(o))return!1}else if(!of(e.options.mutationKey,o))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function Pb(n,e){return((e==null?void 0:e.queryKeyHashFn)||ta)(n)}function ta(n){return JSON.stringify(n,(e,t)=>u0(t)?Object.keys(t).sort().reduce((i,r)=>(i[r]=t[r],i),{}):t)}function of(n,e){return n===e?!0:typeof n!=typeof e?!1:n&&e&&typeof n=="object"&&typeof e=="object"?Object.keys(e).every(t=>of(n[t],e[t])):!1}var PN=Object.prototype.hasOwnProperty;function DA(n,e,t=0){if(n===e)return n;if(t>500)return e;const i=Qw(n)&&Qw(e);if(!i&&!(u0(n)&&u0(e)))return e;const o=(i?n:Object.keys(n)).length,a=i?e:Object.keys(e),u=a.length,f=i?new Array(u):{};let d=0;for(let p=0;p<u;p++){const g=i?p:a[p],b=n[g],v=e[g];if(b===v){f[g]=b,(i?p<o:PN.call(n,g))&&d++;continue}if(b===null||v===null||typeof b!="object"||typeof v!="object"){f[g]=v;continue}const S=DA(b,v,t+1);f[g]=S,S===b&&d++}return o===u&&d===o?n:f}function Yd(n,e){if(!e||Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(n[t]!==e[t])return!1;return!0}function Qw(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function u0(n){if(!Kw(n))return!1;const e=n.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!Kw(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function Kw(n){return Object.prototype.toString.call(n)==="[object Object]"}function HN(n){return new Promise(e=>{Po.setTimeout(e,n)})}function f0(n,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(n,e):t.structuralSharing!==!1?DA(n,e):e}function VN(n,e,t=0){const i=[...n,e];return t&&i.length>t?i.slice(1):i}function _N(n,e,t=0){const i=[e,...n];return t&&i.length>t?i.slice(0,-1):i}var Hb=Symbol();function jA(n,e){return!n.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!n.queryFn||n.queryFn===Hb?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Vb(n,e){return typeof n=="function"?n(...e):!!n}function UN(n,e,t){let i=!1,r;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(r??(r=e()),i||(i=!0,r.aborted?t():r.addEventListener("abort",t,{once:!0})),r)}),n}var af=(()=>{let n=()=>zN;return{isServer(){return n()},setIsServer(e){n=e}}})();function h0(){let n,e;const t=new Promise((r,o)=>{n=r,e=o});t.status="pending",t.catch(()=>{});function i(r){Object.assign(t,r),delete t.resolve,delete t.reject}return t.resolve=r=>{i({status:"fulfilled",value:r}),n(r)},t.reject=r=>{i({status:"rejected",reason:r}),e(r)},t}var qN=LN;function FN(){let n=[],e=0,t=u=>{u()},i=u=>{u()},r=qN;const o=u=>{e?n.push(u):r(()=>{t(u)})},a=()=>{const u=n;n=[],u.length&&r(()=>{i(()=>{u.forEach(f=>{t(f)})})})};return{batch:u=>{let f;e++;try{f=u()}finally{e--,e||a()}return f},batchCalls:u=>(...f)=>{o(()=>{u(...f)})},schedule:o,setNotifyFunction:u=>{t=u},setBatchNotifyFunction:u=>{i=u},setScheduler:u=>{r=u}}}var Bn=FN(),dc,Pl,pc,yA,GN=(yA=class extends zc{constructor(){super();Ye(this,dc,!0);Ye(this,Pl);Ye(this,pc);Ne(this,pc,e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",i)}}})}onSubscribe(){P(this,Pl)||this.setEventListener(P(this,pc))}onUnsubscribe(){var e;this.hasListeners()||((e=P(this,Pl))==null||e.call(this),Ne(this,Pl,void 0))}setEventListener(e){var t;Ne(this,pc,e),(t=P(this,Pl))==null||t.call(this),Ne(this,Pl,e(this.setOnline.bind(this)))}setOnline(e){P(this,dc)!==e&&(Ne(this,dc,e),this.listeners.forEach(i=>{i(e)}))}isOnline(){return P(this,dc)}},dc=new WeakMap,Pl=new WeakMap,pc=new WeakMap,yA),Wd=new GN;function QN(n){return Math.min(1e3*2**n,3e4)}function BA(n){return(n??"online")==="online"?Wd.isOnline():!0}var d0=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function LA(n){let e=!1,t=0,i;const r=h0(),o=()=>r.status!=="pending",a=w=>{var E;if(!o()){const k=new d0(w);b(k),(E=n.onCancel)==null||E.call(n,k)}},u=()=>{e=!0},f=()=>{e=!1},d=()=>Ib.isFocused()&&(n.networkMode==="always"||Wd.isOnline())&&n.canRun(),p=()=>BA(n.networkMode)&&n.canRun(),g=w=>{o()||(i==null||i(),r.resolve(w))},b=w=>{o()||(i==null||i(),r.reject(w))},v=()=>new Promise(w=>{var E;i=k=>{(o()||d())&&w(k)},(E=n.onPause)==null||E.call(n)}).then(()=>{var w;i=void 0,o()||(w=n.onContinue)==null||w.call(n)}),S=()=>{if(o())return;let w;const E=t===0?n.initialPromise:void 0;try{w=E??n.fn()}catch(k){w=Promise.reject(k)}Promise.resolve(w).then(g).catch(k=>{var L;if(o())return;const R=n.retry??(af.isServer()?0:3),N=n.retryDelay??QN,T=typeof N=="function"?N(t,k):N,B=R===!0||typeof R=="number"&&t<R||typeof R=="function"&&R(t,k);if(e||!B){b(k);return}t++,(L=n.onFail)==null||L.call(n,t,k),HN(T).then(()=>d()?void 0:v()).then(()=>{e?b(k):S()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(i==null||i(),r),cancelRetry:u,continueRetry:f,canStart:p,start:()=>(p()?S():v().then(S),r)}}var Fo,bA,zA=(bA=class{constructor(){Ye(this,Fo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),c0(this.gcTime)&&Ne(this,Fo,Po.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(af.isServer()?1/0:300*1e3))}clearGcTimeout(){P(this,Fo)!==void 0&&(Po.clearTimeout(P(this,Fo)),Ne(this,Fo,void 0))}},Fo=new WeakMap,bA);function KN(n){return{onFetch:(e,t)=>{var p,g,b,v,S;const i=e.options,r=(b=(g=(p=e.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:b.direction,o=((v=e.state.data)==null?void 0:v.pages)||[],a=((S=e.state.data)==null?void 0:S.pageParams)||[];let u={pages:[],pageParams:[]},f=0;const d=async()=>{let w=!1;const E=N=>{UN(N,()=>e.signal,()=>w=!0)},k=jA(e.options,e.fetchOptions),R=async(N,T,B)=>{if(w)return Promise.reject(e.signal.reason);if(T==null&&N.pages.length)return Promise.resolve(N);const D=(()=>{const V={client:e.client,queryKey:e.queryKey,pageParam:T,direction:B?"backward":"forward",meta:e.options.meta};return E(V),V})(),j=await k(D),{maxPages:X}=e.options,J=B?_N:VN;return{pages:J(N.pages,j,X),pageParams:J(N.pageParams,T,X)}};if(r&&o.length){const N=r==="backward",T=N?IA:p0,B={pages:o,pageParams:a},L=T(i,B);u=await R(B,L,N)}else{const N=n??o.length;do{const T=f===0?a[0]??i.initialPageParam:p0(i,u);if(f>0&&T==null)break;u=await R(u,T),f++}while(f<N)}return u};e.options.persister?e.fetchFn=()=>{var w,E;return(E=(w=e.options).persister)==null?void 0:E.call(w,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=d}}}function p0(n,{pages:e,pageParams:t}){const i=e.length-1;return e.length>0?n.getNextPageParam(e[i],e,t[i],t):void 0}function IA(n,{pages:e,pageParams:t}){var i;return e.length>0?(i=n.getPreviousPageParam)==null?void 0:i.call(n,e[0],e,t[0],t):void 0}function YN(n,e){return e?p0(n,e)!=null:!1}function WN(n,e){return!e||!n.getPreviousPageParam?!1:IA(n,e)!=null}var mc,Go,gc,us,Qo,Hn,wf,Ko,Qi,PA,Nr,vA,XN=(vA=class extends zA{constructor(e){super();Ye(this,Qi);Ye(this,mc);Ye(this,Go);Ye(this,gc);Ye(this,us);Ye(this,Qo);Ye(this,Hn);Ye(this,wf);Ye(this,Ko);Ne(this,Ko,!1),Ne(this,wf,e.defaultOptions),this.setOptions(e.options),this.observers=[],Ne(this,Qo,e.client),Ne(this,us,P(this,Qo).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Ne(this,Go,Ww(this.options)),this.state=e.state??P(this,Go),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return P(this,mc)}get promise(){var e;return(e=P(this,Hn))==null?void 0:e.promise}setOptions(e){if(this.options={...P(this,wf),...e},e!=null&&e._type&&Ne(this,mc,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Ww(this.options);t.data!==void 0&&(this.setState(Yw(t.data,t.dataUpdatedAt)),Ne(this,Go,t))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&P(this,us).remove(this)}setData(e,t){const i=f0(this.state.data,e,this.options);return ft(this,Qi,Nr).call(this,{data:i,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),i}setState(e){ft(this,Qi,Nr).call(this,{type:"setState",state:e})}cancel(e){var i,r;const t=(i=P(this,Hn))==null?void 0:i.promise;return(r=P(this,Hn))==null||r.cancel(e),t?t.then(hi).catch(hi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return P(this,Go)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ki(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hb||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Yl(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!NA(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(i=>i.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=P(this,Hn))==null||t.continue()}onOnline(){var t;const e=this.observers.find(i=>i.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=P(this,Hn))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),P(this,us).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(P(this,Hn)&&(P(this,Ko)||ft(this,Qi,PA).call(this)?P(this,Hn).cancel({revert:!0}):P(this,Hn).cancelRetry()),this.scheduleGc()),P(this,us).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ft(this,Qi,Nr).call(this,{type:"invalidate"})}async fetch(e,t){var d,p,g,b,v,S,w,E,k,R,N;if(this.state.fetchStatus!=="idle"&&((d=P(this,Hn))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(P(this,Hn))return P(this,Hn).continueRetry(),P(this,Hn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const T=this.observers.find(B=>B.options.queryFn);T&&this.setOptions(T.options)}const i=new AbortController,r=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(Ne(this,Ko,!0),i.signal)})},o=()=>{const T=jA(this.options,t),L=(()=>{const D={client:P(this,Qo),queryKey:this.queryKey,meta:this.meta};return r(D),D})();return Ne(this,Ko,!1),this.options.persister?this.options.persister(T,L,this):T(L)},u=(()=>{const T={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:P(this,Qo),state:this.state,fetchFn:o};return r(T),T})(),f=P(this,mc)==="infinite"?KN(this.options.pages):this.options.behavior;f==null||f.onFetch(u,this),Ne(this,gc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=u.fetchOptions)==null?void 0:p.meta))&&ft(this,Qi,Nr).call(this,{type:"fetch",meta:(g=u.fetchOptions)==null?void 0:g.meta}),Ne(this,Hn,LA({initialPromise:t==null?void 0:t.initialPromise,fn:u.fetchFn,onCancel:T=>{T instanceof d0&&T.revert&&this.setState({...P(this,gc),fetchStatus:"idle"}),i.abort()},onFail:(T,B)=>{ft(this,Qi,Nr).call(this,{type:"failed",failureCount:T,error:B})},onPause:()=>{ft(this,Qi,Nr).call(this,{type:"pause"})},onContinue:()=>{ft(this,Qi,Nr).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const T=await P(this,Hn).start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(v=(b=P(this,us).config).onSuccess)==null||v.call(b,T,this),(w=(S=P(this,us).config).onSettled)==null||w.call(S,T,this.state.error,this),T}catch(T){if(T instanceof d0){if(T.silent)return P(this,Hn).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw ft(this,Qi,Nr).call(this,{type:"error",error:T}),(k=(E=P(this,us).config).onError)==null||k.call(E,T,this),(N=(R=P(this,us).config).onSettled)==null||N.call(R,this.state.data,T,this),T}finally{this.scheduleGc()}}},mc=new WeakMap,Go=new WeakMap,gc=new WeakMap,us=new WeakMap,Qo=new WeakMap,Hn=new WeakMap,wf=new WeakMap,Ko=new WeakMap,Qi=new WeakSet,PA=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Nr=function(e){const t=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...HA(i.data,this.options),fetchMeta:e.meta??null};case"success":const r={...i,...Yw(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ne(this,gc,e.manual?r:void 0),r;case"error":const o=e.error;return{...i,error:o,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=t(this.state),Bn.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),P(this,us).notify({query:this,type:"updated",action:e})})},vA);function HA(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:BA(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function Yw(n,e){return{data:n,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Ww(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,i=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Ri,St,Cf,fi,Yo,yc,jr,Hl,kf,bc,vc,Wo,Xo,Vl,xc,Bt,qu,m0,g0,y0,b0,v0,x0,S0,_A,xA,VA=(xA=class extends zc{constructor(e,t){super();Ye(this,Bt);Ye(this,Ri);Ye(this,St);Ye(this,Cf);Ye(this,fi);Ye(this,Yo);Ye(this,yc);Ye(this,jr);Ye(this,Hl);Ye(this,kf);Ye(this,bc);Ye(this,vc);Ye(this,Wo);Ye(this,Xo);Ye(this,Vl);Ye(this,xc,new Set);this.options=t,Ne(this,Ri,e),Ne(this,Hl,null),Ne(this,jr,h0()),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(P(this,St).addObserver(this),Xw(P(this,St),this.options)?ft(this,Bt,qu).call(this):this.updateResult(),ft(this,Bt,b0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w0(P(this,St),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w0(P(this,St),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ft(this,Bt,v0).call(this),ft(this,Bt,x0).call(this),P(this,St).removeObserver(this)}setOptions(e){const t=this.options,i=P(this,St);if(this.options=P(this,Ri).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ki(this.options.enabled,P(this,St))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ft(this,Bt,S0).call(this),P(this,St).setOptions(this.options),t._defaulted&&!Yd(this.options,t)&&P(this,Ri).getQueryCache().notify({type:"observerOptionsUpdated",query:P(this,St),observer:this});const r=this.hasListeners();r&&$w(P(this,St),i,this.options,t)&&ft(this,Bt,qu).call(this),this.updateResult(),r&&(P(this,St)!==i||Ki(this.options.enabled,P(this,St))!==Ki(t.enabled,P(this,St))||Yl(this.options.staleTime,P(this,St))!==Yl(t.staleTime,P(this,St)))&&ft(this,Bt,m0).call(this);const o=ft(this,Bt,g0).call(this);r&&(P(this,St)!==i||Ki(this.options.enabled,P(this,St))!==Ki(t.enabled,P(this,St))||o!==P(this,Vl))&&ft(this,Bt,y0).call(this,o)}getOptimisticResult(e){const t=P(this,Ri).getQueryCache().build(P(this,Ri),e),i=this.createResult(t,e);return ZN(this,i)&&(Ne(this,fi,i),Ne(this,yc,this.options),Ne(this,Yo,P(this,St).state)),i}getCurrentResult(){return P(this,fi)}trackResult(e,t){return new Proxy(e,{get:(i,r)=>(this.trackProp(r),t==null||t(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&P(this,jr).status==="pending"&&P(this,jr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,r))})}trackProp(e){P(this,xc).add(e)}getCurrentQuery(){return P(this,St)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=P(this,Ri).defaultQueryOptions(e),i=P(this,Ri).getQueryCache().build(P(this,Ri),t);return i.fetch().then(()=>this.createResult(i,t))}fetch(e){return ft(this,Bt,qu).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),P(this,fi)))}createResult(e,t){var X;const i=P(this,St),r=this.options,o=P(this,fi),a=P(this,Yo),u=P(this,yc),d=e!==i?e.state:P(this,Cf),{state:p}=e;let g={...p},b=!1,v;if(t._optimisticResults){const J=this.hasListeners(),V=!J&&Xw(e,t),K=J&&$w(e,i,t,r);(V||K)&&(g={...g,...HA(p.data,e.options)}),t._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:S,errorUpdatedAt:w,status:E}=g;v=g.data;let k=!1;if(t.placeholderData!==void 0&&v===void 0&&E==="pending"){let J;o!=null&&o.isPlaceholderData&&t.placeholderData===(u==null?void 0:u.placeholderData)?(J=o.data,k=!0):J=typeof t.placeholderData=="function"?t.placeholderData((X=P(this,vc))==null?void 0:X.state.data,P(this,vc)):t.placeholderData,J!==void 0&&(E="success",v=f0(o==null?void 0:o.data,J,t),b=!0)}if(t.select&&v!==void 0&&!k)if(o&&v===(a==null?void 0:a.data)&&t.select===P(this,kf))v=P(this,bc);else try{Ne(this,kf,t.select),v=t.select(v),v=f0(o==null?void 0:o.data,v,t),Ne(this,bc,v),Ne(this,Hl,null)}catch(J){Ne(this,Hl,J)}P(this,Hl)&&(S=P(this,Hl),v=P(this,bc),w=Date.now(),E="error");const R=g.fetchStatus==="fetching",N=E==="pending",T=E==="error",B=N&&R,L=v!==void 0,j={status:E,fetchStatus:g.fetchStatus,isPending:N,isSuccess:E==="success",isError:T,isInitialLoading:B,isLoading:B,data:v,dataUpdatedAt:g.dataUpdatedAt,error:S,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:g.dataUpdateCount>d.dataUpdateCount||g.errorUpdateCount>d.errorUpdateCount,isFetching:R,isRefetching:R&&!N,isLoadingError:T&&!L,isPaused:g.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:T&&L,isStale:_b(e,t),refetch:this.refetch,promise:P(this,jr),isEnabled:Ki(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const J=j.data!==void 0,V=j.status==="error"&&!J,K=H=>{V?H.reject(j.error):J&&H.resolve(j.data)},ae=()=>{const H=Ne(this,jr,j.promise=h0());K(H)},$=P(this,jr);switch($.status){case"pending":e.queryHash===i.queryHash&&K($);break;case"fulfilled":(V||j.data!==$.value)&&ae();break;case"rejected":(!V||j.error!==$.reason)&&ae();break}}return j}updateResult(){const e=P(this,fi),t=this.createResult(P(this,St),this.options);if(Ne(this,Yo,P(this,St).state),Ne(this,yc,this.options),P(this,Yo).data!==void 0&&Ne(this,vc,P(this,St)),Yd(t,e))return;Ne(this,fi,t);const i=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!P(this,xc).size)return!0;const a=new Set(o??P(this,xc));return this.options.throwOnError&&a.add("error"),Object.keys(P(this,fi)).some(u=>{const f=u;return P(this,fi)[f]!==e[f]&&a.has(f)})};ft(this,Bt,_A).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ft(this,Bt,b0).call(this)}},Ri=new WeakMap,St=new WeakMap,Cf=new WeakMap,fi=new WeakMap,Yo=new WeakMap,yc=new WeakMap,jr=new WeakMap,Hl=new WeakMap,kf=new WeakMap,bc=new WeakMap,vc=new WeakMap,Wo=new WeakMap,Xo=new WeakMap,Vl=new WeakMap,xc=new WeakMap,Bt=new WeakSet,qu=function(e){ft(this,Bt,S0).call(this);let t=P(this,St).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(hi)),t},m0=function(){ft(this,Bt,v0).call(this);const e=Yl(this.options.staleTime,P(this,St));if(af.isServer()||P(this,fi).isStale||!c0(e))return;const i=NA(P(this,fi).dataUpdatedAt,e)+1;Ne(this,Wo,Po.setTimeout(()=>{P(this,fi).isStale||this.updateResult()},i))},g0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(P(this,St)):this.options.refetchInterval)??!1},y0=function(e){ft(this,Bt,x0).call(this),Ne(this,Vl,e),!(af.isServer()||Ki(this.options.enabled,P(this,St))===!1||!c0(P(this,Vl))||P(this,Vl)===0)&&Ne(this,Xo,Po.setInterval(()=>{(this.options.refetchIntervalInBackground||Ib.isFocused())&&ft(this,Bt,qu).call(this)},P(this,Vl)))},b0=function(){ft(this,Bt,m0).call(this),ft(this,Bt,y0).call(this,ft(this,Bt,g0).call(this))},v0=function(){P(this,Wo)!==void 0&&(Po.clearTimeout(P(this,Wo)),Ne(this,Wo,void 0))},x0=function(){P(this,Xo)!==void 0&&(Po.clearInterval(P(this,Xo)),Ne(this,Xo,void 0))},S0=function(){const e=P(this,Ri).getQueryCache().build(P(this,Ri),this.options);if(e===P(this,St))return;const t=P(this,St);Ne(this,St,e),Ne(this,Cf,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))},_A=function(e){Bn.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(P(this,fi))}),P(this,Ri).getQueryCache().notify({query:P(this,St),type:"observerResultsUpdated"})})},xA);function $N(n,e){return Ki(e.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&Ki(e.retryOnMount,n)===!1)}function Xw(n,e){return $N(n,e)||n.state.data!==void 0&&w0(n,e,e.refetchOnMount)}function w0(n,e,t){if(Ki(e.enabled,n)!==!1&&Yl(e.staleTime,n)!=="static"){const i=typeof t=="function"?t(n):t;return i==="always"||i!==!1&&_b(n,e)}return!1}function $w(n,e,t,i){return(n!==e||Ki(i.enabled,n)===!1)&&(!t.suspense||n.state.status!=="error")&&_b(n,t)}function _b(n,e){return Ki(e.enabled,n)!==!1&&n.isStaleByTime(Yl(e.staleTime,n))}function ZN(n,e){return!Yd(n.getCurrentResult(),e)}var JN=class extends VA{constructor(n,e){super(n,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(n){n._type="infinite",super.setOptions(n)}getOptimisticResult(n){return n._type="infinite",super.getOptimisticResult(n)}fetchNextPage(n){return this.fetch({...n,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(n){return this.fetch({...n,meta:{fetchMore:{direction:"backward"}}})}createResult(n,e){var S,w;const{state:t}=n,i=super.createResult(n,e),{isFetching:r,isRefetching:o,isError:a,isRefetchError:u}=i,f=(w=(S=t.fetchMeta)==null?void 0:S.fetchMore)==null?void 0:w.direction,d=a&&f==="forward",p=r&&f==="forward",g=a&&f==="backward",b=r&&f==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:YN(e,t.data),hasPreviousPage:WN(e,t.data),isFetchNextPageError:d,isFetchingNextPage:p,isFetchPreviousPageError:g,isFetchingPreviousPage:b,isRefetchError:u&&!d&&!g,isRefetching:o&&!p&&!b}}},Af,Ws,Jn,$o,Xs,Rl,SA,eD=(SA=class extends zA{constructor(e){super();Ye(this,Xs);Ye(this,Af);Ye(this,Ws);Ye(this,Jn);Ye(this,$o);Ne(this,Af,e.client),this.mutationId=e.mutationId,Ne(this,Jn,e.mutationCache),Ne(this,Ws,[]),this.state=e.state||UA(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){P(this,Ws).includes(e)||(P(this,Ws).push(e),this.clearGcTimeout(),P(this,Jn).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Ne(this,Ws,P(this,Ws).filter(t=>t!==e)),this.scheduleGc(),P(this,Jn).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){P(this,Ws).length||(this.state.status==="pending"?this.scheduleGc():P(this,Jn).remove(this))}continue(){var e;return((e=P(this,$o))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,u,f,d,p,g,b,v,S,w,E,k,R,N,T,B,L,D;const t=()=>{ft(this,Xs,Rl).call(this,{type:"continue"})},i={client:P(this,Af),meta:this.options.meta,mutationKey:this.options.mutationKey};Ne(this,$o,LA({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(j,X)=>{ft(this,Xs,Rl).call(this,{type:"failed",failureCount:j,error:X})},onPause:()=>{ft(this,Xs,Rl).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>P(this,Jn).canRun(this)}));const r=this.state.status==="pending",o=!P(this,$o).canStart();try{if(r)t();else{ft(this,Xs,Rl).call(this,{type:"pending",variables:e,isPaused:o}),P(this,Jn).config.onMutate&&await P(this,Jn).config.onMutate(e,this,i);const X=await((u=(a=this.options).onMutate)==null?void 0:u.call(a,e,i));X!==this.state.context&&ft(this,Xs,Rl).call(this,{type:"pending",context:X,variables:e,isPaused:o})}const j=await P(this,$o).start();return await((d=(f=P(this,Jn).config).onSuccess)==null?void 0:d.call(f,j,e,this.state.context,this,i)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,j,e,this.state.context,i)),await((v=(b=P(this,Jn).config).onSettled)==null?void 0:v.call(b,j,null,this.state.variables,this.state.context,this,i)),await((w=(S=this.options).onSettled)==null?void 0:w.call(S,j,null,e,this.state.context,i)),ft(this,Xs,Rl).call(this,{type:"success",data:j}),j}catch(j){try{await((k=(E=P(this,Jn).config).onError)==null?void 0:k.call(E,j,e,this.state.context,this,i))}catch(X){Promise.reject(X)}try{await((N=(R=this.options).onError)==null?void 0:N.call(R,j,e,this.state.context,i))}catch(X){Promise.reject(X)}try{await((B=(T=P(this,Jn).config).onSettled)==null?void 0:B.call(T,void 0,j,this.state.variables,this.state.context,this,i))}catch(X){Promise.reject(X)}try{await((D=(L=this.options).onSettled)==null?void 0:D.call(L,void 0,j,e,this.state.context,i))}catch(X){Promise.reject(X)}throw ft(this,Xs,Rl).call(this,{type:"error",error:j}),j}finally{P(this,Jn).runNext(this)}}},Af=new WeakMap,Ws=new WeakMap,Jn=new WeakMap,$o=new WeakMap,Xs=new WeakSet,Rl=function(e){const t=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Bn.batch(()=>{P(this,Ws).forEach(i=>{i.onMutationUpdate(e)}),P(this,Jn).notify({mutation:this,type:"updated",action:e})})},SA);function UA(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Br,As,Ef,wA,tD=(wA=class extends zc{constructor(e={}){super();Ye(this,Br);Ye(this,As);Ye(this,Ef);this.config=e,Ne(this,Br,new Set),Ne(this,As,new Map),Ne(this,Ef,0)}build(e,t,i){const r=new eD({client:e,mutationCache:this,mutationId:++sd(this,Ef)._,options:e.defaultMutationOptions(t),state:i});return this.add(r),r}add(e){P(this,Br).add(e);const t=rd(e);if(typeof t=="string"){const i=P(this,As).get(t);i?i.push(e):P(this,As).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(P(this,Br).delete(e)){const t=rd(e);if(typeof t=="string"){const i=P(this,As).get(t);if(i)if(i.length>1){const r=i.indexOf(e);r!==-1&&i.splice(r,1)}else i[0]===e&&P(this,As).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=rd(e);if(typeof t=="string"){const i=P(this,As).get(t),r=i==null?void 0:i.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){var i;const t=rd(e);if(typeof t=="string"){const r=(i=P(this,As).get(t))==null?void 0:i.find(o=>o!==e&&o.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bn.batch(()=>{P(this,Br).forEach(e=>{this.notify({type:"removed",mutation:e})}),P(this,Br).clear(),P(this,As).clear()})}getAll(){return Array.from(P(this,Br))}find(e){const t={exact:!0,...e};return this.getAll().find(i=>Gw(t,i))}findAll(e={}){return this.getAll().filter(t=>Gw(e,t))}notify(e){Bn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Bn.batch(()=>Promise.all(e.map(t=>t.continue().catch(hi))))}},Br=new WeakMap,As=new WeakMap,Ef=new WeakMap,wA);function rd(n){var e;return(e=n.options.scope)==null?void 0:e.id}var Lr,_l,Ti,zr,_r,zd,C0,CA,nD=(CA=class extends zc{constructor(t,i){super();Ye(this,_r);Ye(this,Lr);Ye(this,_l);Ye(this,Ti);Ye(this,zr);Ne(this,Lr,t),this.setOptions(i),this.bindMethods(),ft(this,_r,zd).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const i=this.options;this.options=P(this,Lr).defaultMutationOptions(t),Yd(this.options,i)||P(this,Lr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:P(this,Ti),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&ta(i.mutationKey)!==ta(this.options.mutationKey)?this.reset():((r=P(this,Ti))==null?void 0:r.state.status)==="pending"&&P(this,Ti).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=P(this,Ti))==null||t.removeObserver(this)}onMutationUpdate(t){ft(this,_r,zd).call(this),ft(this,_r,C0).call(this,t)}getCurrentResult(){return P(this,_l)}reset(){var t;(t=P(this,Ti))==null||t.removeObserver(this),Ne(this,Ti,void 0),ft(this,_r,zd).call(this),ft(this,_r,C0).call(this)}mutate(t,i){var r;return Ne(this,zr,i),(r=P(this,Ti))==null||r.removeObserver(this),Ne(this,Ti,P(this,Lr).getMutationCache().build(P(this,Lr),this.options)),P(this,Ti).addObserver(this),P(this,Ti).execute(t)}},Lr=new WeakMap,_l=new WeakMap,Ti=new WeakMap,zr=new WeakMap,_r=new WeakSet,zd=function(){var i;const t=((i=P(this,Ti))==null?void 0:i.state)??UA();Ne(this,_l,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},C0=function(t){Bn.batch(()=>{var i,r,o,a,u,f,d,p;if(P(this,zr)&&this.hasListeners()){const g=P(this,_l).variables,b=P(this,_l).context,v={client:P(this,Lr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(i=P(this,zr)).onSuccess)==null||r.call(i,t.data,g,b,v)}catch(S){Promise.reject(S)}try{(a=(o=P(this,zr)).onSettled)==null||a.call(o,t.data,null,g,b,v)}catch(S){Promise.reject(S)}}else if((t==null?void 0:t.type)==="error"){try{(f=(u=P(this,zr)).onError)==null||f.call(u,t.error,g,b,v)}catch(S){Promise.reject(S)}try{(p=(d=P(this,zr)).onSettled)==null||p.call(d,void 0,t.error,g,b,v)}catch(S){Promise.reject(S)}}}this.listeners.forEach(g=>{g(P(this,_l))})})},CA),$s,kA,iD=(kA=class extends zc{constructor(e={}){super();Ye(this,$s);this.config=e,Ne(this,$s,new Map)}build(e,t,i){const r=t.queryKey,o=t.queryHash??Pb(r,t);let a=this.get(o);return a||(a=new XN({client:e,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:i,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){P(this,$s).has(e.queryHash)||(P(this,$s).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=P(this,$s).get(e.queryHash);t&&(e.destroy(),t===e&&P(this,$s).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Bn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return P(this,$s).get(e)}getAll(){return[...P(this,$s).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(i=>Fw(t,i))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(i=>Fw(e,i)):t}notify(e){Bn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Bn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Bn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$s=new WeakMap,kA),cn,Ul,ql,Sc,wc,Fl,Cc,kc,AA,sD=(AA=class{constructor(n={}){Ye(this,cn);Ye(this,Ul);Ye(this,ql);Ye(this,Sc);Ye(this,wc);Ye(this,Fl);Ye(this,Cc);Ye(this,kc);Ne(this,cn,n.queryCache||new iD),Ne(this,Ul,n.mutationCache||new tD),Ne(this,ql,n.defaultOptions||{}),Ne(this,Sc,new Map),Ne(this,wc,new Map),Ne(this,Fl,0)}mount(){sd(this,Fl)._++,P(this,Fl)===1&&(Ne(this,Cc,Ib.subscribe(async n=>{n&&(await this.resumePausedMutations(),P(this,cn).onFocus())})),Ne(this,kc,Wd.subscribe(async n=>{n&&(await this.resumePausedMutations(),P(this,cn).onOnline())})))}unmount(){var n,e;sd(this,Fl)._--,P(this,Fl)===0&&((n=P(this,Cc))==null||n.call(this),Ne(this,Cc,void 0),(e=P(this,kc))==null||e.call(this),Ne(this,kc,void 0))}isFetching(n){return P(this,cn).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return P(this,Ul).findAll({...n,status:"pending"}).length}getQueryData(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=P(this,cn).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(n){const e=this.defaultQueryOptions(n),t=P(this,cn).build(this,e),i=t.state.data;return i===void 0?this.fetchQuery(n):(n.revalidateIfStale&&t.isStaleByTime(Yl(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(n){return P(this,cn).findAll(n).map(({queryKey:e,state:t})=>{const i=t.data;return[e,i]})}setQueryData(n,e,t){const i=this.defaultQueryOptions({queryKey:n}),r=P(this,cn).get(i.queryHash),o=r==null?void 0:r.state.data,a=IN(e,o);if(a!==void 0)return P(this,cn).build(this,i).setData(a,{...t,manual:!0})}setQueriesData(n,e,t){return Bn.batch(()=>P(this,cn).findAll(n).map(({queryKey:i})=>[i,this.setQueryData(i,e,t)]))}getQueryState(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=P(this,cn).get(e.queryHash))==null?void 0:t.state}removeQueries(n){const e=P(this,cn);Bn.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=P(this,cn);return Bn.batch(()=>(t.findAll(n).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...n},e)))}cancelQueries(n,e={}){const t={revert:!0,...e},i=Bn.batch(()=>P(this,cn).findAll(n).map(r=>r.cancel(t)));return Promise.all(i).then(hi).catch(hi)}invalidateQueries(n,e={}){return Bn.batch(()=>(P(this,cn).findAll(n).forEach(t=>{t.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},e)))}refetchQueries(n,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},i=Bn.batch(()=>P(this,cn).findAll(n).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let o=r.fetch(void 0,t);return t.throwOnError||(o=o.catch(hi)),r.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(i).then(hi)}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=P(this,cn).build(this,e);return t.isStaleByTime(Yl(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(hi).catch(hi)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(hi).catch(hi)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Wd.isOnline()?P(this,Ul).resumePausedMutations():Promise.resolve()}getQueryCache(){return P(this,cn)}getMutationCache(){return P(this,Ul)}getDefaultOptions(){return P(this,ql)}setDefaultOptions(n){Ne(this,ql,n)}setQueryDefaults(n,e){P(this,Sc).set(ta(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...P(this,Sc).values()],t={};return e.forEach(i=>{of(n,i.queryKey)&&Object.assign(t,i.defaultOptions)}),t}setMutationDefaults(n,e){P(this,wc).set(ta(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...P(this,wc).values()],t={};return e.forEach(i=>{of(n,i.mutationKey)&&Object.assign(t,i.defaultOptions)}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...P(this,ql).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=Pb(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Hb&&(e.enabled=!1),e}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...P(this,ql).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){P(this,cn).clear(),P(this,Ul).clear()}},cn=new WeakMap,Ul=new WeakMap,ql=new WeakMap,Sc=new WeakMap,wc=new WeakMap,Fl=new WeakMap,Cc=new WeakMap,kc=new WeakMap,AA),qA=A.createContext(void 0),io=n=>{const e=A.useContext(qA);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},rD=({client:n,children:e})=>(A.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),x.jsx(qA.Provider,{value:n,children:e})),FA=A.createContext(!1),lD=()=>A.useContext(FA);FA.Provider;function oD(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var aD=A.createContext(oD()),cD=()=>A.useContext(aD),uD=(n,e,t)=>{const i=t!=null&&t.state.error&&typeof n.throwOnError=="function"?Vb(n.throwOnError,[t.state.error,t]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||i)&&(e.isReset()||(n.retryOnMount=!1))},fD=n=>{A.useEffect(()=>{n.clearReset()},[n])},hD=({result:n,errorResetBoundary:e,throwOnError:t,query:i,suspense:r})=>n.isError&&!e.isReset()&&!n.isFetching&&i&&(r&&n.data===void 0||Vb(t,[n.error,i])),dD=n=>{if(n.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),i=n.staleTime;n.staleTime=typeof i=="function"?(...r)=>t(i(...r)):t(i),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},pD=(n,e)=>n.isLoading&&n.isFetching&&!e,mD=(n,e)=>(n==null?void 0:n.suspense)&&e.isPending,Zw=(n,e,t)=>e.fetchOptimistic(n).catch(()=>{t.clearReset()});function GA(n,e,t){var v,S,w,E;const i=lD(),r=cD(),o=io(),a=o.defaultQueryOptions(n);(S=(v=o.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||S.call(v,a);const u=o.getQueryCache().get(a.queryHash),f=n.subscribed!==!1;a._optimisticResults=i?"isRestoring":f?"optimistic":void 0,dD(a),uD(a,r,u),fD(r);const d=!o.getQueryCache().get(a.queryHash),[p]=A.useState(()=>new e(o,a)),g=p.getOptimisticResult(a),b=!i&&f;if(A.useSyncExternalStore(A.useCallback(k=>{const R=b?p.subscribe(Bn.batchCalls(k)):hi;return p.updateResult(),R},[p,b]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),A.useEffect(()=>{p.setOptions(a)},[a,p]),mD(a,g))throw Zw(a,p,r);if(hD({result:g,errorResetBoundary:r,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw g.error;if((E=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||E.call(w,a,g),a.experimental_prefetchInRender&&!af.isServer()&&pD(g,i)){const k=d?Zw(a,p,r):u==null?void 0:u.promise;k==null||k.catch(hi).finally(()=>{p.updateResult()})}return a.notifyOnChangeProps?g:p.trackResult(g)}function ji(n,e){return GA(n,VA)}function Yi(n,e){const t=io(),[i]=A.useState(()=>new nD(t,n));A.useEffect(()=>{i.setOptions(n)},[i,n]);const r=A.useSyncExternalStore(A.useCallback(a=>i.subscribe(Bn.batchCalls(a)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=A.useCallback((a,u)=>{i.mutate(a,u).catch(hi)},[i]);if(r.error&&Vb(i.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:o,mutateAsync:r.mutate}}function QA(n,e){return GA(n,JN)}function gD(n,e){if(n instanceof RegExp)return{keys:!1,pattern:n};var t,i,r,o,a=[],u="",f=n.split("/");for(f[0]||f.shift();r=f.shift();)t=r[0],t==="*"?(a.push(t),u+=r[1]==="?"?"(?:/(.*))?":"/(.*)"):t===":"?(i=r.indexOf("?",1),o=r.indexOf(".",1),a.push(r.substring(1,~i?i:~o?o:r.length)),u+=~i&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(u+=(~i?"?":"")+"\\"+r.substring(o))):u+="/"+r;return{keys:a,pattern:new RegExp("^"+u+(e?"(?=$|/)":"/?$"),"i")}}const yD=(n,e)=>e.toLowerCase().indexOf(n.toLowerCase())?"~"+e:e.slice(n.length)||"/",KA=(n="")=>n==="/"?"":n,bD=(n,e)=>n[0]==="~"?n.slice(1):KA(e)+n,vD=(n="",e)=>yD(k0(KA(n)),k0(e)),xD=n=>n[0]==="?"?n.slice(1):n,k0=n=>{try{return decodeURI(n)}catch{return n}},SD=n=>k0(xD(n)),YA={hook:MA,searchHook:ON,parser:gD,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:n=>n,aroundNav:(n,e,t)=>n(e,t)},WA=A.createContext(YA),Ic=()=>A.useContext(WA),XA={},$A=A.createContext(XA),wD=()=>A.useContext($A),Mp=n=>{const[e,t]=n.hook(n);return[vD(n.base,e),Bb((i,r)=>n.aroundNav(t,bD(i,n.base),r))]},ZA=()=>Mp(Ic()),CD=()=>{const n=Ic();return SD(n.searchHook(n))},JA=(n,e,t,i)=>{const{pattern:r,keys:o}=e instanceof RegExp?{keys:!1,pattern:e}:n(e||"*",i),a=r.exec(t)||[],[u,...f]=a;return u!==void 0?[!0,(()=>{const d=o!==!1?Object.fromEntries(o.map((g,b)=>[g,f[b]])):a.groups;let p={...f};return d&&Object.assign(p,d),p})(),...i?[u]:[]]:[!1,null]},eE=({children:n,...e})=>{var p,g,b;const t=Ic(),i=e.hook?YA:t;let r=i;const[o,a=e.ssrSearch??""]=((p=e.ssrPath)==null?void 0:p.split("?"))??[];o&&(e.ssrSearch=a,e.ssrPath=o),e.hrefs=e.hrefs??((g=e.hook)==null?void 0:g.hrefs),e.searchHook=e.searchHook??((b=e.hook)==null?void 0:b.searchHook);let u=A.useRef({}),f=u.current,d=f;for(let v in i){const S=v==="base"?i[v]+(e[v]??""):e[v]??i[v];f===d&&S!==d[v]&&(u.current=d={...d}),d[v]=S,(S!==i[v]||S!==r[v])&&(r=d)}return A.createElement(WA.Provider,{value:r,children:n})},Jw=({children:n,component:e},t)=>e?A.createElement(e,{params:t}):typeof n=="function"?n(t):n,kD=n=>{let e=A.useRef(XA);const t=e.current;return e.current=Object.keys(n).length!==Object.keys(t).length||Object.entries(n).some(([i,r])=>r!==t[i])?n:t};function AD(){const[n,e]=ZA(),t=CD(),i=A.useMemo(()=>new URLSearchParams(t),[t]);let r=i;const o=Bb((a,u)=>{r=new URLSearchParams(typeof a=="function"?a(r):a),e(n+(r.size?"?"+r:""),u)});return[i,o]}const Xa=({path:n,nest:e,match:t,...i})=>{const r=Ic(),[o]=Mp(r),[a,u,f]=t??JA(r.parser,n,o,e),d=kD({...wD(),...u});if(!a)return null;const p=f?A.createElement(eE,{base:f},Jw(i,d)):Jw(i,d);return A.createElement($A.Provider,{value:d,children:p})};A.forwardRef((n,e)=>{const t=Ic(),[i,r]=Mp(t),{to:o="",href:a=o,onClick:u,asChild:f,children:d,className:p,replace:g,state:b,transition:v,...S}=n,w=Bb(k=>{k.ctrlKey||k.metaKey||k.altKey||k.shiftKey||k.button!==0||(u==null||u(k),k.defaultPrevented||(k.preventDefault(),r(a,n)))}),E=t.hrefs(a[0]==="~"?a.slice(1):t.base+a,t);return f&&A.isValidElement(d)?A.cloneElement(d,{onClick:w,href:E}):A.createElement("a",{...S,onClick:w,href:E,className:p!=null&&p.call?p(i===a):p,children:d,ref:e})});const tE=n=>Array.isArray(n)?n.flatMap(e=>tE(e&&e.type===A.Fragment?e.props.children:e)):[n],ED=({children:n,location:e})=>{const t=Ic(),[i]=Mp(t);for(const r of tE(n)){let o=0;if(A.isValidElement(r)&&(o=JA(t.parser,r.props.path,e||i,r.props.nest))[0])return A.cloneElement(r,{match:o})}return null},Fu={v:[]},eC=()=>Fu.v.forEach(n=>n()),RD=n=>(Fu.v.push(n)===1&&addEventListener("hashchange",eC),()=>{Fu.v=Fu.v.filter(e=>e!==n),Fu.v.length||removeEventListener("hashchange",eC)}),TD=()=>"/"+location.hash.replace(/^#?\/?/,""),OD=(n,{state:e=null,replace:t=!1}={})=>{const i=location.href,[r,o]=n.replace(/^#?\/?/,"").split("?"),a=new URL(location.href);a.hash=`/${r}`,o&&(a.search=o);const u=a.href;t?history.replaceState(e,"",u):history.pushState(e,"",u);const f=typeof HashChangeEvent<"u"?new HashChangeEvent("hashchange",{oldURL:i,newURL:u}):new Event("hashchange",{detail:{oldURL:i,newURL:u}});dispatchEvent(f)},nE=({ssrPath:n="/"}={})=>[jb.useSyncExternalStore(RD,TD,()=>n),OD];nE.hrefs=n=>"#"+n;/**
|
|
57
|
+
*/var Hw;function wN(){if(Hw)return wy;Hw=1;var n=Rf();function e(g,b){return g===b&&(g!==0||1/g===1/b)||g!==g&&b!==b}var t=typeof Object.is=="function"?Object.is:e,i=n.useState,r=n.useEffect,o=n.useLayoutEffect,a=n.useDebugValue;function u(g,b){var v=b(),S=i({inst:{value:v,getSnapshot:b}}),w=S[0].inst,E=S[1];return o(function(){w.value=v,w.getSnapshot=b,f(w)&&E({inst:w})},[g,v,b]),r(function(){return f(w)&&E({inst:w}),g(function(){f(w)&&E({inst:w})})},[g]),a(v),v}function f(g){var b=g.getSnapshot;g=g.value;try{var v=b();return!t(g,v)}catch{return!0}}function d(g,b){return b()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:u;return wy.useSyncExternalStore=n.useSyncExternalStore!==void 0?n.useSyncExternalStore:p,wy}var Vw;function OA(){return Vw||(Vw=1,Sy.exports=wN()),Sy.exports}var jb=OA();const CN=Db.useInsertionEffect,kN=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",AN=kN?A.useLayoutEffect:A.useEffect,EN=CN||AN,Bb=n=>{const e=A.useRef([n,(...t)=>e[0](...t)]).current;return EN(()=>{e[0]=n}),e[1]},RN="popstate",Lb="pushState",zb="replaceState",TN="hashchange",_w=[RN,Lb,zb,TN],ON=n=>{for(const e of _w)addEventListener(e,n);return()=>{for(const e of _w)removeEventListener(e,n)}},MA=(n,e)=>jb.useSyncExternalStore(ON,n,e),Uw=()=>location.search,MN=({ssrSearch:n}={})=>MA(Uw,n!=null?()=>n:Uw),qw=()=>location.pathname,NN=({ssrPath:n}={})=>MA(qw,n!=null?()=>n:qw),DN=(n,{replace:e=!1,state:t=null}={})=>history[e?zb:Lb](t,"",n),NA=(n={})=>[NN(n),DN],Fw=Symbol.for("wouter_v3");if(typeof history<"u"&&typeof window[Fw]>"u"){for(const n of[Lb,zb]){const e=history[n];history[n]=function(){const t=e.apply(this,arguments),i=new Event(n);return i.arguments=arguments,dispatchEvent(i),t}}Object.defineProperty(window,Fw,{value:!0})}var zc=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(n){return this.listeners.add(n),this.onSubscribe(),()=>{this.listeners.delete(n),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},qo,zl,hc,gA,jN=(gA=class extends zc{constructor(){super();Ye(this,qo);Ye(this,zl);Ye(this,hc);Ne(this,hc,e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){P(this,zl)||this.setEventListener(P(this,hc))}onUnsubscribe(){var e;this.hasListeners()||((e=P(this,zl))==null||e.call(this),Ne(this,zl,void 0))}setEventListener(e){var t;Ne(this,hc,e),(t=P(this,zl))==null||t.call(this),Ne(this,zl,e(i=>{typeof i=="boolean"?this.setFocused(i):this.onFocus()}))}setFocused(e){P(this,qo)!==e&&(Ne(this,qo,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof P(this,qo)=="boolean"?P(this,qo):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},qo=new WeakMap,zl=new WeakMap,hc=new WeakMap,gA),Ib=new jN,BN={setTimeout:(n,e)=>setTimeout(n,e),clearTimeout:n=>clearTimeout(n),setInterval:(n,e)=>setInterval(n,e),clearInterval:n=>clearInterval(n)},Il,Mb,yA,LN=(yA=class{constructor(){Ye(this,Il,BN);Ye(this,Mb,!1)}setTimeoutProvider(n){Ne(this,Il,n)}setTimeout(n,e){return P(this,Il).setTimeout(n,e)}clearTimeout(n){P(this,Il).clearTimeout(n)}setInterval(n,e){return P(this,Il).setInterval(n,e)}clearInterval(n){P(this,Il).clearInterval(n)}},Il=new WeakMap,Mb=new WeakMap,yA),Po=new LN;function zN(n){setTimeout(n,0)}var IN=typeof window>"u"||"Deno"in globalThis;function hi(){}function PN(n,e){return typeof n=="function"?n(e):n}function c0(n){return typeof n=="number"&&n>=0&&n!==1/0}function DA(n,e){return Math.max(n+(e||0)-Date.now(),0)}function Yl(n,e){return typeof n=="function"?n(e):n}function Ki(n,e){return typeof n=="function"?n(e):n}function Gw(n,e){const{type:t="all",exact:i,fetchStatus:r,predicate:o,queryKey:a,stale:u}=n;if(a){if(i){if(e.queryHash!==Pb(a,e.options))return!1}else if(!of(e.queryKey,a))return!1}if(t!=="all"){const f=e.isActive();if(t==="active"&&!f||t==="inactive"&&f)return!1}return!(typeof u=="boolean"&&e.isStale()!==u||r&&r!==e.state.fetchStatus||o&&!o(e))}function Qw(n,e){const{exact:t,status:i,predicate:r,mutationKey:o}=n;if(o){if(!e.options.mutationKey)return!1;if(t){if(ta(e.options.mutationKey)!==ta(o))return!1}else if(!of(e.options.mutationKey,o))return!1}return!(i&&e.state.status!==i||r&&!r(e))}function Pb(n,e){return((e==null?void 0:e.queryKeyHashFn)||ta)(n)}function ta(n){return JSON.stringify(n,(e,t)=>u0(t)?Object.keys(t).sort().reduce((i,r)=>(i[r]=t[r],i),{}):t)}function of(n,e){return n===e?!0:typeof n!=typeof e?!1:n&&e&&typeof n=="object"&&typeof e=="object"?Object.keys(e).every(t=>of(n[t],e[t])):!1}var HN=Object.prototype.hasOwnProperty;function jA(n,e,t=0){if(n===e)return n;if(t>500)return e;const i=Kw(n)&&Kw(e);if(!i&&!(u0(n)&&u0(e)))return e;const o=(i?n:Object.keys(n)).length,a=i?e:Object.keys(e),u=a.length,f=i?new Array(u):{};let d=0;for(let p=0;p<u;p++){const g=i?p:a[p],b=n[g],v=e[g];if(b===v){f[g]=b,(i?p<o:HN.call(n,g))&&d++;continue}if(b===null||v===null||typeof b!="object"||typeof v!="object"){f[g]=v;continue}const S=jA(b,v,t+1);f[g]=S,S===b&&d++}return o===u&&d===o?n:f}function Yd(n,e){if(!e||Object.keys(n).length!==Object.keys(e).length)return!1;for(const t in n)if(n[t]!==e[t])return!1;return!0}function Kw(n){return Array.isArray(n)&&n.length===Object.keys(n).length}function u0(n){if(!Yw(n))return!1;const e=n.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!Yw(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(n)!==Object.prototype)}function Yw(n){return Object.prototype.toString.call(n)==="[object Object]"}function VN(n){return new Promise(e=>{Po.setTimeout(e,n)})}function f0(n,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(n,e):t.structuralSharing!==!1?jA(n,e):e}function _N(n,e,t=0){const i=[...n,e];return t&&i.length>t?i.slice(1):i}function UN(n,e,t=0){const i=[e,...n];return t&&i.length>t?i.slice(0,-1):i}var Hb=Symbol();function BA(n,e){return!n.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!n.queryFn||n.queryFn===Hb?()=>Promise.reject(new Error(`Missing queryFn: '${n.queryHash}'`)):n.queryFn}function Vb(n,e){return typeof n=="function"?n(...e):!!n}function qN(n,e,t){let i=!1,r;return Object.defineProperty(n,"signal",{enumerable:!0,get:()=>(r??(r=e()),i||(i=!0,r.aborted?t():r.addEventListener("abort",t,{once:!0})),r)}),n}var af=(()=>{let n=()=>IN;return{isServer(){return n()},setIsServer(e){n=e}}})();function h0(){let n,e;const t=new Promise((r,o)=>{n=r,e=o});t.status="pending",t.catch(()=>{});function i(r){Object.assign(t,r),delete t.resolve,delete t.reject}return t.resolve=r=>{i({status:"fulfilled",value:r}),n(r)},t.reject=r=>{i({status:"rejected",reason:r}),e(r)},t}var FN=zN;function GN(){let n=[],e=0,t=u=>{u()},i=u=>{u()},r=FN;const o=u=>{e?n.push(u):r(()=>{t(u)})},a=()=>{const u=n;n=[],u.length&&r(()=>{i(()=>{u.forEach(f=>{t(f)})})})};return{batch:u=>{let f;e++;try{f=u()}finally{e--,e||a()}return f},batchCalls:u=>(...f)=>{o(()=>{u(...f)})},schedule:o,setNotifyFunction:u=>{t=u},setBatchNotifyFunction:u=>{i=u},setScheduler:u=>{r=u}}}var Bn=GN(),dc,Pl,pc,bA,QN=(bA=class extends zc{constructor(){super();Ye(this,dc,!0);Ye(this,Pl);Ye(this,pc);Ne(this,pc,e=>{if(typeof window<"u"&&window.addEventListener){const t=()=>e(!0),i=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",i,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",i)}}})}onSubscribe(){P(this,Pl)||this.setEventListener(P(this,pc))}onUnsubscribe(){var e;this.hasListeners()||((e=P(this,Pl))==null||e.call(this),Ne(this,Pl,void 0))}setEventListener(e){var t;Ne(this,pc,e),(t=P(this,Pl))==null||t.call(this),Ne(this,Pl,e(this.setOnline.bind(this)))}setOnline(e){P(this,dc)!==e&&(Ne(this,dc,e),this.listeners.forEach(i=>{i(e)}))}isOnline(){return P(this,dc)}},dc=new WeakMap,Pl=new WeakMap,pc=new WeakMap,bA),Wd=new QN;function KN(n){return Math.min(1e3*2**n,3e4)}function LA(n){return(n??"online")==="online"?Wd.isOnline():!0}var d0=class extends Error{constructor(n){super("CancelledError"),this.revert=n==null?void 0:n.revert,this.silent=n==null?void 0:n.silent}};function zA(n){let e=!1,t=0,i;const r=h0(),o=()=>r.status!=="pending",a=w=>{var E;if(!o()){const k=new d0(w);b(k),(E=n.onCancel)==null||E.call(n,k)}},u=()=>{e=!0},f=()=>{e=!1},d=()=>Ib.isFocused()&&(n.networkMode==="always"||Wd.isOnline())&&n.canRun(),p=()=>LA(n.networkMode)&&n.canRun(),g=w=>{o()||(i==null||i(),r.resolve(w))},b=w=>{o()||(i==null||i(),r.reject(w))},v=()=>new Promise(w=>{var E;i=k=>{(o()||d())&&w(k)},(E=n.onPause)==null||E.call(n)}).then(()=>{var w;i=void 0,o()||(w=n.onContinue)==null||w.call(n)}),S=()=>{if(o())return;let w;const E=t===0?n.initialPromise:void 0;try{w=E??n.fn()}catch(k){w=Promise.reject(k)}Promise.resolve(w).then(g).catch(k=>{var L;if(o())return;const R=n.retry??(af.isServer()?0:3),N=n.retryDelay??KN,T=typeof N=="function"?N(t,k):N,B=R===!0||typeof R=="number"&&t<R||typeof R=="function"&&R(t,k);if(e||!B){b(k);return}t++,(L=n.onFail)==null||L.call(n,t,k),VN(T).then(()=>d()?void 0:v()).then(()=>{e?b(k):S()})})};return{promise:r,status:()=>r.status,cancel:a,continue:()=>(i==null||i(),r),cancelRetry:u,continueRetry:f,canStart:p,start:()=>(p()?S():v().then(S),r)}}var Fo,vA,IA=(vA=class{constructor(){Ye(this,Fo)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),c0(this.gcTime)&&Ne(this,Fo,Po.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(n){this.gcTime=Math.max(this.gcTime||0,n??(af.isServer()?1/0:300*1e3))}clearGcTimeout(){P(this,Fo)!==void 0&&(Po.clearTimeout(P(this,Fo)),Ne(this,Fo,void 0))}},Fo=new WeakMap,vA);function YN(n){return{onFetch:(e,t)=>{var p,g,b,v,S;const i=e.options,r=(b=(g=(p=e.fetchOptions)==null?void 0:p.meta)==null?void 0:g.fetchMore)==null?void 0:b.direction,o=((v=e.state.data)==null?void 0:v.pages)||[],a=((S=e.state.data)==null?void 0:S.pageParams)||[];let u={pages:[],pageParams:[]},f=0;const d=async()=>{let w=!1;const E=N=>{qN(N,()=>e.signal,()=>w=!0)},k=BA(e.options,e.fetchOptions),R=async(N,T,B)=>{if(w)return Promise.reject(e.signal.reason);if(T==null&&N.pages.length)return Promise.resolve(N);const D=(()=>{const V={client:e.client,queryKey:e.queryKey,pageParam:T,direction:B?"backward":"forward",meta:e.options.meta};return E(V),V})(),j=await k(D),{maxPages:X}=e.options,J=B?UN:_N;return{pages:J(N.pages,j,X),pageParams:J(N.pageParams,T,X)}};if(r&&o.length){const N=r==="backward",T=N?PA:p0,B={pages:o,pageParams:a},L=T(i,B);u=await R(B,L,N)}else{const N=n??o.length;do{const T=f===0?a[0]??i.initialPageParam:p0(i,u);if(f>0&&T==null)break;u=await R(u,T),f++}while(f<N)}return u};e.options.persister?e.fetchFn=()=>{var w,E;return(E=(w=e.options).persister)==null?void 0:E.call(w,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=d}}}function p0(n,{pages:e,pageParams:t}){const i=e.length-1;return e.length>0?n.getNextPageParam(e[i],e,t[i],t):void 0}function PA(n,{pages:e,pageParams:t}){var i;return e.length>0?(i=n.getPreviousPageParam)==null?void 0:i.call(n,e[0],e,t[0],t):void 0}function WN(n,e){return e?p0(n,e)!=null:!1}function XN(n,e){return!e||!n.getPreviousPageParam?!1:PA(n,e)!=null}var mc,Go,gc,us,Qo,Hn,wf,Ko,Qi,HA,Nr,xA,$N=(xA=class extends IA{constructor(e){super();Ye(this,Qi);Ye(this,mc);Ye(this,Go);Ye(this,gc);Ye(this,us);Ye(this,Qo);Ye(this,Hn);Ye(this,wf);Ye(this,Ko);Ne(this,Ko,!1),Ne(this,wf,e.defaultOptions),this.setOptions(e.options),this.observers=[],Ne(this,Qo,e.client),Ne(this,us,P(this,Qo).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Ne(this,Go,Xw(this.options)),this.state=e.state??P(this,Go),this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return P(this,mc)}get promise(){var e;return(e=P(this,Hn))==null?void 0:e.promise}setOptions(e){if(this.options={...P(this,wf),...e},e!=null&&e._type&&Ne(this,mc,e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=Xw(this.options);t.data!==void 0&&(this.setState(Ww(t.data,t.dataUpdatedAt)),Ne(this,Go,t))}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&P(this,us).remove(this)}setData(e,t){const i=f0(this.state.data,e,this.options);return ft(this,Qi,Nr).call(this,{data:i,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),i}setState(e){ft(this,Qi,Nr).call(this,{type:"setState",state:e})}cancel(e){var i,r;const t=(i=P(this,Hn))==null?void 0:i.promise;return(r=P(this,Hn))==null||r.cancel(e),t?t.then(hi).catch(hi):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return P(this,Go)}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Ki(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Hb||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Yl(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!DA(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(i=>i.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=P(this,Hn))==null||t.continue()}onOnline(){var t;const e=this.observers.find(i=>i.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=P(this,Hn))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),P(this,us).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(P(this,Hn)&&(P(this,Ko)||ft(this,Qi,HA).call(this)?P(this,Hn).cancel({revert:!0}):P(this,Hn).cancelRetry()),this.scheduleGc()),P(this,us).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||ft(this,Qi,Nr).call(this,{type:"invalidate"})}async fetch(e,t){var d,p,g,b,v,S,w,E,k,R,N;if(this.state.fetchStatus!=="idle"&&((d=P(this,Hn))==null?void 0:d.status())!=="rejected"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(P(this,Hn))return P(this,Hn).continueRetry(),P(this,Hn).promise}if(e&&this.setOptions(e),!this.options.queryFn){const T=this.observers.find(B=>B.options.queryFn);T&&this.setOptions(T.options)}const i=new AbortController,r=T=>{Object.defineProperty(T,"signal",{enumerable:!0,get:()=>(Ne(this,Ko,!0),i.signal)})},o=()=>{const T=BA(this.options,t),L=(()=>{const D={client:P(this,Qo),queryKey:this.queryKey,meta:this.meta};return r(D),D})();return Ne(this,Ko,!1),this.options.persister?this.options.persister(T,L,this):T(L)},u=(()=>{const T={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:P(this,Qo),state:this.state,fetchFn:o};return r(T),T})(),f=P(this,mc)==="infinite"?YN(this.options.pages):this.options.behavior;f==null||f.onFetch(u,this),Ne(this,gc,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((p=u.fetchOptions)==null?void 0:p.meta))&&ft(this,Qi,Nr).call(this,{type:"fetch",meta:(g=u.fetchOptions)==null?void 0:g.meta}),Ne(this,Hn,zA({initialPromise:t==null?void 0:t.initialPromise,fn:u.fetchFn,onCancel:T=>{T instanceof d0&&T.revert&&this.setState({...P(this,gc),fetchStatus:"idle"}),i.abort()},onFail:(T,B)=>{ft(this,Qi,Nr).call(this,{type:"failed",failureCount:T,error:B})},onPause:()=>{ft(this,Qi,Nr).call(this,{type:"pause"})},onContinue:()=>{ft(this,Qi,Nr).call(this,{type:"continue"})},retry:u.options.retry,retryDelay:u.options.retryDelay,networkMode:u.options.networkMode,canRun:()=>!0}));try{const T=await P(this,Hn).start();if(T===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(T),(v=(b=P(this,us).config).onSuccess)==null||v.call(b,T,this),(w=(S=P(this,us).config).onSettled)==null||w.call(S,T,this.state.error,this),T}catch(T){if(T instanceof d0){if(T.silent)return P(this,Hn).promise;if(T.revert){if(this.state.data===void 0)throw T;return this.state.data}}throw ft(this,Qi,Nr).call(this,{type:"error",error:T}),(k=(E=P(this,us).config).onError)==null||k.call(E,T,this),(N=(R=P(this,us).config).onSettled)==null||N.call(R,this.state.data,T,this),T}finally{this.scheduleGc()}}},mc=new WeakMap,Go=new WeakMap,gc=new WeakMap,us=new WeakMap,Qo=new WeakMap,Hn=new WeakMap,wf=new WeakMap,Ko=new WeakMap,Qi=new WeakSet,HA=function(){return this.state.fetchStatus==="paused"&&this.state.status==="pending"},Nr=function(e){const t=i=>{switch(e.type){case"failed":return{...i,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...i,fetchStatus:"paused"};case"continue":return{...i,fetchStatus:"fetching"};case"fetch":return{...i,...VA(i.data,this.options),fetchMeta:e.meta??null};case"success":const r={...i,...Ww(e.data,e.dataUpdatedAt),dataUpdateCount:i.dataUpdateCount+1,...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return Ne(this,gc,e.manual?r:void 0),r;case"error":const o=e.error;return{...i,error:o,errorUpdateCount:i.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:i.fetchFailureCount+1,fetchFailureReason:o,fetchStatus:"idle",status:"error",isInvalidated:!0};case"invalidate":return{...i,isInvalidated:!0};case"setState":return{...i,...e.state}}};this.state=t(this.state),Bn.batch(()=>{this.observers.forEach(i=>{i.onQueryUpdate()}),P(this,us).notify({query:this,type:"updated",action:e})})},xA);function VA(n,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:LA(e.networkMode)?"fetching":"paused",...n===void 0&&{error:null,status:"pending"}}}function Ww(n,e){return{data:n,dataUpdatedAt:e??Date.now(),error:null,isInvalidated:!1,status:"success"}}function Xw(n){const e=typeof n.initialData=="function"?n.initialData():n.initialData,t=e!==void 0,i=t?typeof n.initialDataUpdatedAt=="function"?n.initialDataUpdatedAt():n.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var Ri,St,Cf,fi,Yo,yc,jr,Hl,kf,bc,vc,Wo,Xo,Vl,xc,Bt,qu,m0,g0,y0,b0,v0,x0,S0,UA,SA,_A=(SA=class extends zc{constructor(e,t){super();Ye(this,Bt);Ye(this,Ri);Ye(this,St);Ye(this,Cf);Ye(this,fi);Ye(this,Yo);Ye(this,yc);Ye(this,jr);Ye(this,Hl);Ye(this,kf);Ye(this,bc);Ye(this,vc);Ye(this,Wo);Ye(this,Xo);Ye(this,Vl);Ye(this,xc,new Set);this.options=t,Ne(this,Ri,e),Ne(this,Hl,null),Ne(this,jr,h0()),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(P(this,St).addObserver(this),$w(P(this,St),this.options)?ft(this,Bt,qu).call(this):this.updateResult(),ft(this,Bt,b0).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w0(P(this,St),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w0(P(this,St),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,ft(this,Bt,v0).call(this),ft(this,Bt,x0).call(this),P(this,St).removeObserver(this)}setOptions(e){const t=this.options,i=P(this,St);if(this.options=P(this,Ri).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Ki(this.options.enabled,P(this,St))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");ft(this,Bt,S0).call(this),P(this,St).setOptions(this.options),t._defaulted&&!Yd(this.options,t)&&P(this,Ri).getQueryCache().notify({type:"observerOptionsUpdated",query:P(this,St),observer:this});const r=this.hasListeners();r&&Zw(P(this,St),i,this.options,t)&&ft(this,Bt,qu).call(this),this.updateResult(),r&&(P(this,St)!==i||Ki(this.options.enabled,P(this,St))!==Ki(t.enabled,P(this,St))||Yl(this.options.staleTime,P(this,St))!==Yl(t.staleTime,P(this,St)))&&ft(this,Bt,m0).call(this);const o=ft(this,Bt,g0).call(this);r&&(P(this,St)!==i||Ki(this.options.enabled,P(this,St))!==Ki(t.enabled,P(this,St))||o!==P(this,Vl))&&ft(this,Bt,y0).call(this,o)}getOptimisticResult(e){const t=P(this,Ri).getQueryCache().build(P(this,Ri),e),i=this.createResult(t,e);return JN(this,i)&&(Ne(this,fi,i),Ne(this,yc,this.options),Ne(this,Yo,P(this,St).state)),i}getCurrentResult(){return P(this,fi)}trackResult(e,t){return new Proxy(e,{get:(i,r)=>(this.trackProp(r),t==null||t(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&P(this,jr).status==="pending"&&P(this,jr).reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(i,r))})}trackProp(e){P(this,xc).add(e)}getCurrentQuery(){return P(this,St)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=P(this,Ri).defaultQueryOptions(e),i=P(this,Ri).getQueryCache().build(P(this,Ri),t);return i.fetch().then(()=>this.createResult(i,t))}fetch(e){return ft(this,Bt,qu).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),P(this,fi)))}createResult(e,t){var X;const i=P(this,St),r=this.options,o=P(this,fi),a=P(this,Yo),u=P(this,yc),d=e!==i?e.state:P(this,Cf),{state:p}=e;let g={...p},b=!1,v;if(t._optimisticResults){const J=this.hasListeners(),V=!J&&$w(e,t),K=J&&Zw(e,i,t,r);(V||K)&&(g={...g,...VA(p.data,e.options)}),t._optimisticResults==="isRestoring"&&(g.fetchStatus="idle")}let{error:S,errorUpdatedAt:w,status:E}=g;v=g.data;let k=!1;if(t.placeholderData!==void 0&&v===void 0&&E==="pending"){let J;o!=null&&o.isPlaceholderData&&t.placeholderData===(u==null?void 0:u.placeholderData)?(J=o.data,k=!0):J=typeof t.placeholderData=="function"?t.placeholderData((X=P(this,vc))==null?void 0:X.state.data,P(this,vc)):t.placeholderData,J!==void 0&&(E="success",v=f0(o==null?void 0:o.data,J,t),b=!0)}if(t.select&&v!==void 0&&!k)if(o&&v===(a==null?void 0:a.data)&&t.select===P(this,kf))v=P(this,bc);else try{Ne(this,kf,t.select),v=t.select(v),v=f0(o==null?void 0:o.data,v,t),Ne(this,bc,v),Ne(this,Hl,null)}catch(J){Ne(this,Hl,J)}P(this,Hl)&&(S=P(this,Hl),v=P(this,bc),w=Date.now(),E="error");const R=g.fetchStatus==="fetching",N=E==="pending",T=E==="error",B=N&&R,L=v!==void 0,j={status:E,fetchStatus:g.fetchStatus,isPending:N,isSuccess:E==="success",isError:T,isInitialLoading:B,isLoading:B,data:v,dataUpdatedAt:g.dataUpdatedAt,error:S,errorUpdatedAt:w,failureCount:g.fetchFailureCount,failureReason:g.fetchFailureReason,errorUpdateCount:g.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:g.dataUpdateCount>d.dataUpdateCount||g.errorUpdateCount>d.errorUpdateCount,isFetching:R,isRefetching:R&&!N,isLoadingError:T&&!L,isPaused:g.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:T&&L,isStale:_b(e,t),refetch:this.refetch,promise:P(this,jr),isEnabled:Ki(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const J=j.data!==void 0,V=j.status==="error"&&!J,K=H=>{V?H.reject(j.error):J&&H.resolve(j.data)},ae=()=>{const H=Ne(this,jr,j.promise=h0());K(H)},$=P(this,jr);switch($.status){case"pending":e.queryHash===i.queryHash&&K($);break;case"fulfilled":(V||j.data!==$.value)&&ae();break;case"rejected":(!V||j.error!==$.reason)&&ae();break}}return j}updateResult(){const e=P(this,fi),t=this.createResult(P(this,St),this.options);if(Ne(this,Yo,P(this,St).state),Ne(this,yc,this.options),P(this,Yo).data!==void 0&&Ne(this,vc,P(this,St)),Yd(t,e))return;Ne(this,fi,t);const i=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,o=typeof r=="function"?r():r;if(o==="all"||!o&&!P(this,xc).size)return!0;const a=new Set(o??P(this,xc));return this.options.throwOnError&&a.add("error"),Object.keys(P(this,fi)).some(u=>{const f=u;return P(this,fi)[f]!==e[f]&&a.has(f)})};ft(this,Bt,UA).call(this,{listeners:i()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&ft(this,Bt,b0).call(this)}},Ri=new WeakMap,St=new WeakMap,Cf=new WeakMap,fi=new WeakMap,Yo=new WeakMap,yc=new WeakMap,jr=new WeakMap,Hl=new WeakMap,kf=new WeakMap,bc=new WeakMap,vc=new WeakMap,Wo=new WeakMap,Xo=new WeakMap,Vl=new WeakMap,xc=new WeakMap,Bt=new WeakSet,qu=function(e){ft(this,Bt,S0).call(this);let t=P(this,St).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(hi)),t},m0=function(){ft(this,Bt,v0).call(this);const e=Yl(this.options.staleTime,P(this,St));if(af.isServer()||P(this,fi).isStale||!c0(e))return;const i=DA(P(this,fi).dataUpdatedAt,e)+1;Ne(this,Wo,Po.setTimeout(()=>{P(this,fi).isStale||this.updateResult()},i))},g0=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(P(this,St)):this.options.refetchInterval)??!1},y0=function(e){ft(this,Bt,x0).call(this),Ne(this,Vl,e),!(af.isServer()||Ki(this.options.enabled,P(this,St))===!1||!c0(P(this,Vl))||P(this,Vl)===0)&&Ne(this,Xo,Po.setInterval(()=>{(this.options.refetchIntervalInBackground||Ib.isFocused())&&ft(this,Bt,qu).call(this)},P(this,Vl)))},b0=function(){ft(this,Bt,m0).call(this),ft(this,Bt,y0).call(this,ft(this,Bt,g0).call(this))},v0=function(){P(this,Wo)!==void 0&&(Po.clearTimeout(P(this,Wo)),Ne(this,Wo,void 0))},x0=function(){P(this,Xo)!==void 0&&(Po.clearInterval(P(this,Xo)),Ne(this,Xo,void 0))},S0=function(){const e=P(this,Ri).getQueryCache().build(P(this,Ri),this.options);if(e===P(this,St))return;const t=P(this,St);Ne(this,St,e),Ne(this,Cf,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))},UA=function(e){Bn.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(P(this,fi))}),P(this,Ri).getQueryCache().notify({query:P(this,St),type:"observerResultsUpdated"})})},SA);function ZN(n,e){return Ki(e.enabled,n)!==!1&&n.state.data===void 0&&!(n.state.status==="error"&&Ki(e.retryOnMount,n)===!1)}function $w(n,e){return ZN(n,e)||n.state.data!==void 0&&w0(n,e,e.refetchOnMount)}function w0(n,e,t){if(Ki(e.enabled,n)!==!1&&Yl(e.staleTime,n)!=="static"){const i=typeof t=="function"?t(n):t;return i==="always"||i!==!1&&_b(n,e)}return!1}function Zw(n,e,t,i){return(n!==e||Ki(i.enabled,n)===!1)&&(!t.suspense||n.state.status!=="error")&&_b(n,t)}function _b(n,e){return Ki(e.enabled,n)!==!1&&n.isStaleByTime(Yl(e.staleTime,n))}function JN(n,e){return!Yd(n.getCurrentResult(),e)}var eD=class extends _A{constructor(n,e){super(n,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(n){n._type="infinite",super.setOptions(n)}getOptimisticResult(n){return n._type="infinite",super.getOptimisticResult(n)}fetchNextPage(n){return this.fetch({...n,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(n){return this.fetch({...n,meta:{fetchMore:{direction:"backward"}}})}createResult(n,e){var S,w;const{state:t}=n,i=super.createResult(n,e),{isFetching:r,isRefetching:o,isError:a,isRefetchError:u}=i,f=(w=(S=t.fetchMeta)==null?void 0:S.fetchMore)==null?void 0:w.direction,d=a&&f==="forward",p=r&&f==="forward",g=a&&f==="backward",b=r&&f==="backward";return{...i,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:WN(e,t.data),hasPreviousPage:XN(e,t.data),isFetchNextPageError:d,isFetchingNextPage:p,isFetchPreviousPageError:g,isFetchingPreviousPage:b,isRefetchError:u&&!d&&!g,isRefetching:o&&!p&&!b}}},Af,Ws,Jn,$o,Xs,Rl,wA,tD=(wA=class extends IA{constructor(e){super();Ye(this,Xs);Ye(this,Af);Ye(this,Ws);Ye(this,Jn);Ye(this,$o);Ne(this,Af,e.client),this.mutationId=e.mutationId,Ne(this,Jn,e.mutationCache),Ne(this,Ws,[]),this.state=e.state||qA(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){P(this,Ws).includes(e)||(P(this,Ws).push(e),this.clearGcTimeout(),P(this,Jn).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Ne(this,Ws,P(this,Ws).filter(t=>t!==e)),this.scheduleGc(),P(this,Jn).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){P(this,Ws).length||(this.state.status==="pending"?this.scheduleGc():P(this,Jn).remove(this))}continue(){var e;return((e=P(this,$o))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,u,f,d,p,g,b,v,S,w,E,k,R,N,T,B,L,D;const t=()=>{ft(this,Xs,Rl).call(this,{type:"continue"})},i={client:P(this,Af),meta:this.options.meta,mutationKey:this.options.mutationKey};Ne(this,$o,zA({fn:()=>this.options.mutationFn?this.options.mutationFn(e,i):Promise.reject(new Error("No mutationFn found")),onFail:(j,X)=>{ft(this,Xs,Rl).call(this,{type:"failed",failureCount:j,error:X})},onPause:()=>{ft(this,Xs,Rl).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>P(this,Jn).canRun(this)}));const r=this.state.status==="pending",o=!P(this,$o).canStart();try{if(r)t();else{ft(this,Xs,Rl).call(this,{type:"pending",variables:e,isPaused:o}),P(this,Jn).config.onMutate&&await P(this,Jn).config.onMutate(e,this,i);const X=await((u=(a=this.options).onMutate)==null?void 0:u.call(a,e,i));X!==this.state.context&&ft(this,Xs,Rl).call(this,{type:"pending",context:X,variables:e,isPaused:o})}const j=await P(this,$o).start();return await((d=(f=P(this,Jn).config).onSuccess)==null?void 0:d.call(f,j,e,this.state.context,this,i)),await((g=(p=this.options).onSuccess)==null?void 0:g.call(p,j,e,this.state.context,i)),await((v=(b=P(this,Jn).config).onSettled)==null?void 0:v.call(b,j,null,this.state.variables,this.state.context,this,i)),await((w=(S=this.options).onSettled)==null?void 0:w.call(S,j,null,e,this.state.context,i)),ft(this,Xs,Rl).call(this,{type:"success",data:j}),j}catch(j){try{await((k=(E=P(this,Jn).config).onError)==null?void 0:k.call(E,j,e,this.state.context,this,i))}catch(X){Promise.reject(X)}try{await((N=(R=this.options).onError)==null?void 0:N.call(R,j,e,this.state.context,i))}catch(X){Promise.reject(X)}try{await((B=(T=P(this,Jn).config).onSettled)==null?void 0:B.call(T,void 0,j,this.state.variables,this.state.context,this,i))}catch(X){Promise.reject(X)}try{await((D=(L=this.options).onSettled)==null?void 0:D.call(L,void 0,j,e,this.state.context,i))}catch(X){Promise.reject(X)}throw ft(this,Xs,Rl).call(this,{type:"error",error:j}),j}finally{P(this,Jn).runNext(this)}}},Af=new WeakMap,Ws=new WeakMap,Jn=new WeakMap,$o=new WeakMap,Xs=new WeakSet,Rl=function(e){const t=i=>{switch(e.type){case"failed":return{...i,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...i,isPaused:!0};case"continue":return{...i,isPaused:!1};case"pending":return{...i,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...i,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...i,data:void 0,error:e.error,failureCount:i.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),Bn.batch(()=>{P(this,Ws).forEach(i=>{i.onMutationUpdate(e)}),P(this,Jn).notify({mutation:this,type:"updated",action:e})})},wA);function qA(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Br,As,Ef,CA,nD=(CA=class extends zc{constructor(e={}){super();Ye(this,Br);Ye(this,As);Ye(this,Ef);this.config=e,Ne(this,Br,new Set),Ne(this,As,new Map),Ne(this,Ef,0)}build(e,t,i){const r=new tD({client:e,mutationCache:this,mutationId:++sd(this,Ef)._,options:e.defaultMutationOptions(t),state:i});return this.add(r),r}add(e){P(this,Br).add(e);const t=rd(e);if(typeof t=="string"){const i=P(this,As).get(t);i?i.push(e):P(this,As).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(P(this,Br).delete(e)){const t=rd(e);if(typeof t=="string"){const i=P(this,As).get(t);if(i)if(i.length>1){const r=i.indexOf(e);r!==-1&&i.splice(r,1)}else i[0]===e&&P(this,As).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=rd(e);if(typeof t=="string"){const i=P(this,As).get(t),r=i==null?void 0:i.find(o=>o.state.status==="pending");return!r||r===e}else return!0}runNext(e){var i;const t=rd(e);if(typeof t=="string"){const r=(i=P(this,As).get(t))==null?void 0:i.find(o=>o!==e&&o.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Bn.batch(()=>{P(this,Br).forEach(e=>{this.notify({type:"removed",mutation:e})}),P(this,Br).clear(),P(this,As).clear()})}getAll(){return Array.from(P(this,Br))}find(e){const t={exact:!0,...e};return this.getAll().find(i=>Qw(t,i))}findAll(e={}){return this.getAll().filter(t=>Qw(e,t))}notify(e){Bn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return Bn.batch(()=>Promise.all(e.map(t=>t.continue().catch(hi))))}},Br=new WeakMap,As=new WeakMap,Ef=new WeakMap,CA);function rd(n){var e;return(e=n.options.scope)==null?void 0:e.id}var Lr,_l,Ti,zr,_r,zd,C0,kA,iD=(kA=class extends zc{constructor(t,i){super();Ye(this,_r);Ye(this,Lr);Ye(this,_l);Ye(this,Ti);Ye(this,zr);Ne(this,Lr,t),this.setOptions(i),this.bindMethods(),ft(this,_r,zd).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const i=this.options;this.options=P(this,Lr).defaultMutationOptions(t),Yd(this.options,i)||P(this,Lr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:P(this,Ti),observer:this}),i!=null&&i.mutationKey&&this.options.mutationKey&&ta(i.mutationKey)!==ta(this.options.mutationKey)?this.reset():((r=P(this,Ti))==null?void 0:r.state.status)==="pending"&&P(this,Ti).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=P(this,Ti))==null||t.removeObserver(this)}onMutationUpdate(t){ft(this,_r,zd).call(this),ft(this,_r,C0).call(this,t)}getCurrentResult(){return P(this,_l)}reset(){var t;(t=P(this,Ti))==null||t.removeObserver(this),Ne(this,Ti,void 0),ft(this,_r,zd).call(this),ft(this,_r,C0).call(this)}mutate(t,i){var r;return Ne(this,zr,i),(r=P(this,Ti))==null||r.removeObserver(this),Ne(this,Ti,P(this,Lr).getMutationCache().build(P(this,Lr),this.options)),P(this,Ti).addObserver(this),P(this,Ti).execute(t)}},Lr=new WeakMap,_l=new WeakMap,Ti=new WeakMap,zr=new WeakMap,_r=new WeakSet,zd=function(){var i;const t=((i=P(this,Ti))==null?void 0:i.state)??qA();Ne(this,_l,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},C0=function(t){Bn.batch(()=>{var i,r,o,a,u,f,d,p;if(P(this,zr)&&this.hasListeners()){const g=P(this,_l).variables,b=P(this,_l).context,v={client:P(this,Lr),meta:this.options.meta,mutationKey:this.options.mutationKey};if((t==null?void 0:t.type)==="success"){try{(r=(i=P(this,zr)).onSuccess)==null||r.call(i,t.data,g,b,v)}catch(S){Promise.reject(S)}try{(a=(o=P(this,zr)).onSettled)==null||a.call(o,t.data,null,g,b,v)}catch(S){Promise.reject(S)}}else if((t==null?void 0:t.type)==="error"){try{(f=(u=P(this,zr)).onError)==null||f.call(u,t.error,g,b,v)}catch(S){Promise.reject(S)}try{(p=(d=P(this,zr)).onSettled)==null||p.call(d,void 0,t.error,g,b,v)}catch(S){Promise.reject(S)}}}this.listeners.forEach(g=>{g(P(this,_l))})})},kA),$s,AA,sD=(AA=class extends zc{constructor(e={}){super();Ye(this,$s);this.config=e,Ne(this,$s,new Map)}build(e,t,i){const r=t.queryKey,o=t.queryHash??Pb(r,t);let a=this.get(o);return a||(a=new $N({client:e,queryKey:r,queryHash:o,options:e.defaultQueryOptions(t),state:i,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){P(this,$s).has(e.queryHash)||(P(this,$s).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=P(this,$s).get(e.queryHash);t&&(e.destroy(),t===e&&P(this,$s).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Bn.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return P(this,$s).get(e)}getAll(){return[...P(this,$s).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(i=>Gw(t,i))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(i=>Gw(e,i)):t}notify(e){Bn.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Bn.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Bn.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$s=new WeakMap,AA),cn,Ul,ql,Sc,wc,Fl,Cc,kc,EA,rD=(EA=class{constructor(n={}){Ye(this,cn);Ye(this,Ul);Ye(this,ql);Ye(this,Sc);Ye(this,wc);Ye(this,Fl);Ye(this,Cc);Ye(this,kc);Ne(this,cn,n.queryCache||new sD),Ne(this,Ul,n.mutationCache||new nD),Ne(this,ql,n.defaultOptions||{}),Ne(this,Sc,new Map),Ne(this,wc,new Map),Ne(this,Fl,0)}mount(){sd(this,Fl)._++,P(this,Fl)===1&&(Ne(this,Cc,Ib.subscribe(async n=>{n&&(await this.resumePausedMutations(),P(this,cn).onFocus())})),Ne(this,kc,Wd.subscribe(async n=>{n&&(await this.resumePausedMutations(),P(this,cn).onOnline())})))}unmount(){var n,e;sd(this,Fl)._--,P(this,Fl)===0&&((n=P(this,Cc))==null||n.call(this),Ne(this,Cc,void 0),(e=P(this,kc))==null||e.call(this),Ne(this,kc,void 0))}isFetching(n){return P(this,cn).findAll({...n,fetchStatus:"fetching"}).length}isMutating(n){return P(this,Ul).findAll({...n,status:"pending"}).length}getQueryData(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=P(this,cn).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(n){const e=this.defaultQueryOptions(n),t=P(this,cn).build(this,e),i=t.state.data;return i===void 0?this.fetchQuery(n):(n.revalidateIfStale&&t.isStaleByTime(Yl(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(i))}getQueriesData(n){return P(this,cn).findAll(n).map(({queryKey:e,state:t})=>{const i=t.data;return[e,i]})}setQueryData(n,e,t){const i=this.defaultQueryOptions({queryKey:n}),r=P(this,cn).get(i.queryHash),o=r==null?void 0:r.state.data,a=PN(e,o);if(a!==void 0)return P(this,cn).build(this,i).setData(a,{...t,manual:!0})}setQueriesData(n,e,t){return Bn.batch(()=>P(this,cn).findAll(n).map(({queryKey:i})=>[i,this.setQueryData(i,e,t)]))}getQueryState(n){var t;const e=this.defaultQueryOptions({queryKey:n});return(t=P(this,cn).get(e.queryHash))==null?void 0:t.state}removeQueries(n){const e=P(this,cn);Bn.batch(()=>{e.findAll(n).forEach(t=>{e.remove(t)})})}resetQueries(n,e){const t=P(this,cn);return Bn.batch(()=>(t.findAll(n).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...n},e)))}cancelQueries(n,e={}){const t={revert:!0,...e},i=Bn.batch(()=>P(this,cn).findAll(n).map(r=>r.cancel(t)));return Promise.all(i).then(hi).catch(hi)}invalidateQueries(n,e={}){return Bn.batch(()=>(P(this,cn).findAll(n).forEach(t=>{t.invalidate()}),(n==null?void 0:n.refetchType)==="none"?Promise.resolve():this.refetchQueries({...n,type:(n==null?void 0:n.refetchType)??(n==null?void 0:n.type)??"active"},e)))}refetchQueries(n,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},i=Bn.batch(()=>P(this,cn).findAll(n).filter(r=>!r.isDisabled()&&!r.isStatic()).map(r=>{let o=r.fetch(void 0,t);return t.throwOnError||(o=o.catch(hi)),r.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(i).then(hi)}fetchQuery(n){const e=this.defaultQueryOptions(n);e.retry===void 0&&(e.retry=!1);const t=P(this,cn).build(this,e);return t.isStaleByTime(Yl(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(n){return this.fetchQuery(n).then(hi).catch(hi)}fetchInfiniteQuery(n){return n._type="infinite",this.fetchQuery(n)}prefetchInfiniteQuery(n){return this.fetchInfiniteQuery(n).then(hi).catch(hi)}ensureInfiniteQueryData(n){return n._type="infinite",this.ensureQueryData(n)}resumePausedMutations(){return Wd.isOnline()?P(this,Ul).resumePausedMutations():Promise.resolve()}getQueryCache(){return P(this,cn)}getMutationCache(){return P(this,Ul)}getDefaultOptions(){return P(this,ql)}setDefaultOptions(n){Ne(this,ql,n)}setQueryDefaults(n,e){P(this,Sc).set(ta(n),{queryKey:n,defaultOptions:e})}getQueryDefaults(n){const e=[...P(this,Sc).values()],t={};return e.forEach(i=>{of(n,i.queryKey)&&Object.assign(t,i.defaultOptions)}),t}setMutationDefaults(n,e){P(this,wc).set(ta(n),{mutationKey:n,defaultOptions:e})}getMutationDefaults(n){const e=[...P(this,wc).values()],t={};return e.forEach(i=>{of(n,i.mutationKey)&&Object.assign(t,i.defaultOptions)}),t}defaultQueryOptions(n){if(n._defaulted)return n;const e={...P(this,ql).queries,...this.getQueryDefaults(n.queryKey),...n,_defaulted:!0};return e.queryHash||(e.queryHash=Pb(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Hb&&(e.enabled=!1),e}defaultMutationOptions(n){return n!=null&&n._defaulted?n:{...P(this,ql).mutations,...(n==null?void 0:n.mutationKey)&&this.getMutationDefaults(n.mutationKey),...n,_defaulted:!0}}clear(){P(this,cn).clear(),P(this,Ul).clear()}},cn=new WeakMap,Ul=new WeakMap,ql=new WeakMap,Sc=new WeakMap,wc=new WeakMap,Fl=new WeakMap,Cc=new WeakMap,kc=new WeakMap,EA),FA=A.createContext(void 0),io=n=>{const e=A.useContext(FA);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},lD=({client:n,children:e})=>(A.useEffect(()=>(n.mount(),()=>{n.unmount()}),[n]),x.jsx(FA.Provider,{value:n,children:e})),GA=A.createContext(!1),oD=()=>A.useContext(GA);GA.Provider;function aD(){let n=!1;return{clearReset:()=>{n=!1},reset:()=>{n=!0},isReset:()=>n}}var cD=A.createContext(aD()),uD=()=>A.useContext(cD),fD=(n,e,t)=>{const i=t!=null&&t.state.error&&typeof n.throwOnError=="function"?Vb(n.throwOnError,[t.state.error,t]):n.throwOnError;(n.suspense||n.experimental_prefetchInRender||i)&&(e.isReset()||(n.retryOnMount=!1))},hD=n=>{A.useEffect(()=>{n.clearReset()},[n])},dD=({result:n,errorResetBoundary:e,throwOnError:t,query:i,suspense:r})=>n.isError&&!e.isReset()&&!n.isFetching&&i&&(r&&n.data===void 0||Vb(t,[n.error,i])),pD=n=>{if(n.suspense){const t=r=>r==="static"?r:Math.max(r??1e3,1e3),i=n.staleTime;n.staleTime=typeof i=="function"?(...r)=>t(i(...r)):t(i),typeof n.gcTime=="number"&&(n.gcTime=Math.max(n.gcTime,1e3))}},mD=(n,e)=>n.isLoading&&n.isFetching&&!e,gD=(n,e)=>(n==null?void 0:n.suspense)&&e.isPending,Jw=(n,e,t)=>e.fetchOptimistic(n).catch(()=>{t.clearReset()});function QA(n,e,t){var v,S,w,E;const i=oD(),r=uD(),o=io(),a=o.defaultQueryOptions(n);(S=(v=o.getDefaultOptions().queries)==null?void 0:v._experimental_beforeQuery)==null||S.call(v,a);const u=o.getQueryCache().get(a.queryHash),f=n.subscribed!==!1;a._optimisticResults=i?"isRestoring":f?"optimistic":void 0,pD(a),fD(a,r,u),hD(r);const d=!o.getQueryCache().get(a.queryHash),[p]=A.useState(()=>new e(o,a)),g=p.getOptimisticResult(a),b=!i&&f;if(A.useSyncExternalStore(A.useCallback(k=>{const R=b?p.subscribe(Bn.batchCalls(k)):hi;return p.updateResult(),R},[p,b]),()=>p.getCurrentResult(),()=>p.getCurrentResult()),A.useEffect(()=>{p.setOptions(a)},[a,p]),gD(a,g))throw Jw(a,p,r);if(dD({result:g,errorResetBoundary:r,throwOnError:a.throwOnError,query:u,suspense:a.suspense}))throw g.error;if((E=(w=o.getDefaultOptions().queries)==null?void 0:w._experimental_afterQuery)==null||E.call(w,a,g),a.experimental_prefetchInRender&&!af.isServer()&&mD(g,i)){const k=d?Jw(a,p,r):u==null?void 0:u.promise;k==null||k.catch(hi).finally(()=>{p.updateResult()})}return a.notifyOnChangeProps?g:p.trackResult(g)}function ji(n,e){return QA(n,_A)}function Yi(n,e){const t=io(),[i]=A.useState(()=>new iD(t,n));A.useEffect(()=>{i.setOptions(n)},[i,n]);const r=A.useSyncExternalStore(A.useCallback(a=>i.subscribe(Bn.batchCalls(a)),[i]),()=>i.getCurrentResult(),()=>i.getCurrentResult()),o=A.useCallback((a,u)=>{i.mutate(a,u).catch(hi)},[i]);if(r.error&&Vb(i.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:o,mutateAsync:r.mutate}}function KA(n,e){return QA(n,eD)}function yD(n,e){if(n instanceof RegExp)return{keys:!1,pattern:n};var t,i,r,o,a=[],u="",f=n.split("/");for(f[0]||f.shift();r=f.shift();)t=r[0],t==="*"?(a.push(t),u+=r[1]==="?"?"(?:/(.*))?":"/(.*)"):t===":"?(i=r.indexOf("?",1),o=r.indexOf(".",1),a.push(r.substring(1,~i?i:~o?o:r.length)),u+=~i&&!~o?"(?:/([^/]+?))?":"/([^/]+?)",~o&&(u+=(~i?"?":"")+"\\"+r.substring(o))):u+="/"+r;return{keys:a,pattern:new RegExp("^"+u+(e?"(?=$|/)":"/?$"),"i")}}const bD=(n,e)=>e.toLowerCase().indexOf(n.toLowerCase())?"~"+e:e.slice(n.length)||"/",YA=(n="")=>n==="/"?"":n,vD=(n,e)=>n[0]==="~"?n.slice(1):YA(e)+n,xD=(n="",e)=>bD(k0(YA(n)),k0(e)),SD=n=>n[0]==="?"?n.slice(1):n,k0=n=>{try{return decodeURI(n)}catch{return n}},wD=n=>k0(SD(n)),WA={hook:NA,searchHook:MN,parser:yD,base:"",ssrPath:void 0,ssrSearch:void 0,ssrContext:void 0,hrefs:n=>n,aroundNav:(n,e,t)=>n(e,t)},XA=A.createContext(WA),Ic=()=>A.useContext(XA),$A={},ZA=A.createContext($A),CD=()=>A.useContext(ZA),Mp=n=>{const[e,t]=n.hook(n);return[xD(n.base,e),Bb((i,r)=>n.aroundNav(t,vD(i,n.base),r))]},JA=()=>Mp(Ic()),kD=()=>{const n=Ic();return wD(n.searchHook(n))},eE=(n,e,t,i)=>{const{pattern:r,keys:o}=e instanceof RegExp?{keys:!1,pattern:e}:n(e||"*",i),a=r.exec(t)||[],[u,...f]=a;return u!==void 0?[!0,(()=>{const d=o!==!1?Object.fromEntries(o.map((g,b)=>[g,f[b]])):a.groups;let p={...f};return d&&Object.assign(p,d),p})(),...i?[u]:[]]:[!1,null]},tE=({children:n,...e})=>{var p,g,b;const t=Ic(),i=e.hook?WA:t;let r=i;const[o,a=e.ssrSearch??""]=((p=e.ssrPath)==null?void 0:p.split("?"))??[];o&&(e.ssrSearch=a,e.ssrPath=o),e.hrefs=e.hrefs??((g=e.hook)==null?void 0:g.hrefs),e.searchHook=e.searchHook??((b=e.hook)==null?void 0:b.searchHook);let u=A.useRef({}),f=u.current,d=f;for(let v in i){const S=v==="base"?i[v]+(e[v]??""):e[v]??i[v];f===d&&S!==d[v]&&(u.current=d={...d}),d[v]=S,(S!==i[v]||S!==r[v])&&(r=d)}return A.createElement(XA.Provider,{value:r,children:n})},eC=({children:n,component:e},t)=>e?A.createElement(e,{params:t}):typeof n=="function"?n(t):n,AD=n=>{let e=A.useRef($A);const t=e.current;return e.current=Object.keys(n).length!==Object.keys(t).length||Object.entries(n).some(([i,r])=>r!==t[i])?n:t};function ED(){const[n,e]=JA(),t=kD(),i=A.useMemo(()=>new URLSearchParams(t),[t]);let r=i;const o=Bb((a,u)=>{r=new URLSearchParams(typeof a=="function"?a(r):a),e(n+(r.size?"?"+r:""),u)});return[i,o]}const Xa=({path:n,nest:e,match:t,...i})=>{const r=Ic(),[o]=Mp(r),[a,u,f]=t??eE(r.parser,n,o,e),d=AD({...CD(),...u});if(!a)return null;const p=f?A.createElement(tE,{base:f},eC(i,d)):eC(i,d);return A.createElement(ZA.Provider,{value:d,children:p})};A.forwardRef((n,e)=>{const t=Ic(),[i,r]=Mp(t),{to:o="",href:a=o,onClick:u,asChild:f,children:d,className:p,replace:g,state:b,transition:v,...S}=n,w=Bb(k=>{k.ctrlKey||k.metaKey||k.altKey||k.shiftKey||k.button!==0||(u==null||u(k),k.defaultPrevented||(k.preventDefault(),r(a,n)))}),E=t.hrefs(a[0]==="~"?a.slice(1):t.base+a,t);return f&&A.isValidElement(d)?A.cloneElement(d,{onClick:w,href:E}):A.createElement("a",{...S,onClick:w,href:E,className:p!=null&&p.call?p(i===a):p,children:d,ref:e})});const nE=n=>Array.isArray(n)?n.flatMap(e=>nE(e&&e.type===A.Fragment?e.props.children:e)):[n],RD=({children:n,location:e})=>{const t=Ic(),[i]=Mp(t);for(const r of nE(n)){let o=0;if(A.isValidElement(r)&&(o=eE(t.parser,r.props.path,e||i,r.props.nest))[0])return A.cloneElement(r,{match:o})}return null},Fu={v:[]},tC=()=>Fu.v.forEach(n=>n()),TD=n=>(Fu.v.push(n)===1&&addEventListener("hashchange",tC),()=>{Fu.v=Fu.v.filter(e=>e!==n),Fu.v.length||removeEventListener("hashchange",tC)}),OD=()=>"/"+location.hash.replace(/^#?\/?/,""),MD=(n,{state:e=null,replace:t=!1}={})=>{const i=location.href,[r,o]=n.replace(/^#?\/?/,"").split("?"),a=new URL(location.href);a.hash=`/${r}`,o&&(a.search=o);const u=a.href;t?history.replaceState(e,"",u):history.pushState(e,"",u);const f=typeof HashChangeEvent<"u"?new HashChangeEvent("hashchange",{oldURL:i,newURL:u}):new Event("hashchange",{detail:{oldURL:i,newURL:u}});dispatchEvent(f)},iE=({ssrPath:n="/"}={})=>[jb.useSyncExternalStore(TD,OD,()=>n),MD];iE.hrefs=n=>"#"+n;/**
|
|
58
58
|
* @license lucide-react v1.23.0 - ISC
|
|
59
59
|
*
|
|
60
60
|
* This source code is licensed under the ISC license.
|
|
61
61
|
* See the LICENSE file in the root directory of this source tree.
|
|
62
|
-
*/const
|
|
62
|
+
*/const sE=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim();/**
|
|
63
63
|
* @license lucide-react v1.23.0 - ISC
|
|
64
64
|
*
|
|
65
65
|
* This source code is licensed under the ISC license.
|
|
66
66
|
* See the LICENSE file in the root directory of this source tree.
|
|
67
|
-
*/const
|
|
67
|
+
*/const ND=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
|
|
68
68
|
* @license lucide-react v1.23.0 - ISC
|
|
69
69
|
*
|
|
70
70
|
* This source code is licensed under the ISC license.
|
|
71
71
|
* See the LICENSE file in the root directory of this source tree.
|
|
72
|
-
*/const
|
|
72
|
+
*/const DD=n=>n.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,i)=>i?i.toUpperCase():t.toLowerCase());/**
|
|
73
73
|
* @license lucide-react v1.23.0 - ISC
|
|
74
74
|
*
|
|
75
75
|
* This source code is licensed under the ISC license.
|
|
76
76
|
* See the LICENSE file in the root directory of this source tree.
|
|
77
|
-
*/const
|
|
77
|
+
*/const nC=n=>{const e=DD(n);return e.charAt(0).toUpperCase()+e.slice(1)};/**
|
|
78
78
|
* @license lucide-react v1.23.0 - ISC
|
|
79
79
|
*
|
|
80
80
|
* This source code is licensed under the ISC license.
|
|
@@ -84,100 +84,100 @@ Error generating stack: `+h.message+`
|
|
|
84
84
|
*
|
|
85
85
|
* This source code is licensed under the ISC license.
|
|
86
86
|
* See the LICENSE file in the root directory of this source tree.
|
|
87
|
-
*/const
|
|
87
|
+
*/const jD=n=>{for(const e in n)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1},BD=A.createContext({}),LD=()=>A.useContext(BD),zD=A.forwardRef(({color:n,size:e,strokeWidth:t,absoluteStrokeWidth:i,className:r="",children:o,iconNode:a,...u},f)=>{const{size:d=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:b="currentColor",className:v=""}=LD()??{},S=i??g?Number(t??p)*24/Number(e??d):t??p;return A.createElement("svg",{ref:f,...Cy,width:e??d??Cy.width,height:e??d??Cy.height,stroke:n??b,strokeWidth:S,className:sE("lucide",v,r),...!o&&!jD(u)&&{"aria-hidden":"true"},...u},[...a.map(([w,E])=>A.createElement(w,E)),...Array.isArray(o)?o:[o]])});/**
|
|
88
88
|
* @license lucide-react v1.23.0 - ISC
|
|
89
89
|
*
|
|
90
90
|
* This source code is licensed under the ISC license.
|
|
91
91
|
* See the LICENSE file in the root directory of this source tree.
|
|
92
|
-
*/const si=(n,e)=>{const t=A.forwardRef(({className:i,...r},o)=>A.createElement(
|
|
92
|
+
*/const si=(n,e)=>{const t=A.forwardRef(({className:i,...r},o)=>A.createElement(zD,{ref:o,iconNode:e,className:sE(`lucide-${ND(nC(n))}`,`lucide-${n}`,i),...r}));return t.displayName=nC(n),t};/**
|
|
93
93
|
* @license lucide-react v1.23.0 - ISC
|
|
94
94
|
*
|
|
95
95
|
* This source code is licensed under the ISC license.
|
|
96
96
|
* See the LICENSE file in the root directory of this source tree.
|
|
97
|
-
*/const
|
|
97
|
+
*/const ID=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Np=si("arrow-left",ID);/**
|
|
98
98
|
* @license lucide-react v1.23.0 - ISC
|
|
99
99
|
*
|
|
100
100
|
* This source code is licensed under the ISC license.
|
|
101
101
|
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const
|
|
102
|
+
*/const PD=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],rE=si("check",PD);/**
|
|
103
103
|
* @license lucide-react v1.23.0 - ISC
|
|
104
104
|
*
|
|
105
105
|
* This source code is licensed under the ISC license.
|
|
106
106
|
* See the LICENSE file in the root directory of this source tree.
|
|
107
|
-
*/const
|
|
107
|
+
*/const HD=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],aa=si("chevron-right",HD);/**
|
|
108
108
|
* @license lucide-react v1.23.0 - ISC
|
|
109
109
|
*
|
|
110
110
|
* This source code is licensed under the ISC license.
|
|
111
111
|
* See the LICENSE file in the root directory of this source tree.
|
|
112
|
-
*/const
|
|
112
|
+
*/const VD=[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]],lE=si("chevrons-up-down",VD);/**
|
|
113
113
|
* @license lucide-react v1.23.0 - ISC
|
|
114
114
|
*
|
|
115
115
|
* This source code is licensed under the ISC license.
|
|
116
116
|
* See the LICENSE file in the root directory of this source tree.
|
|
117
|
-
*/const
|
|
117
|
+
*/const _D=[["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"}]],UD=si("copy",_D);/**
|
|
118
118
|
* @license lucide-react v1.23.0 - ISC
|
|
119
119
|
*
|
|
120
120
|
* This source code is licensed under the ISC license.
|
|
121
121
|
* See the LICENSE file in the root directory of this source tree.
|
|
122
|
-
*/const
|
|
122
|
+
*/const qD=[["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"}]],FD=si("lock",qD);/**
|
|
123
123
|
* @license lucide-react v1.23.0 - ISC
|
|
124
124
|
*
|
|
125
125
|
* This source code is licensed under the ISC license.
|
|
126
126
|
* See the LICENSE file in the root directory of this source tree.
|
|
127
|
-
*/const
|
|
127
|
+
*/const GD=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],QD=si("monitor",GD);/**
|
|
128
128
|
* @license lucide-react v1.23.0 - ISC
|
|
129
129
|
*
|
|
130
130
|
* This source code is licensed under the ISC license.
|
|
131
131
|
* See the LICENSE file in the root directory of this source tree.
|
|
132
|
-
*/const
|
|
132
|
+
*/const KD=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],YD=si("moon",KD);/**
|
|
133
133
|
* @license lucide-react v1.23.0 - ISC
|
|
134
134
|
*
|
|
135
135
|
* This source code is licensed under the ISC license.
|
|
136
136
|
* See the LICENSE file in the root directory of this source tree.
|
|
137
|
-
*/const
|
|
137
|
+
*/const WD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Dp=si("plus",WD);/**
|
|
138
138
|
* @license lucide-react v1.23.0 - ISC
|
|
139
139
|
*
|
|
140
140
|
* This source code is licensed under the ISC license.
|
|
141
141
|
* See the LICENSE file in the root directory of this source tree.
|
|
142
|
-
*/const
|
|
142
|
+
*/const XD=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],$D=si("refresh-cw",XD);/**
|
|
143
143
|
* @license lucide-react v1.23.0 - ISC
|
|
144
144
|
*
|
|
145
145
|
* This source code is licensed under the ISC license.
|
|
146
146
|
* See the LICENSE file in the root directory of this source tree.
|
|
147
|
-
*/const
|
|
147
|
+
*/const ZD=[["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"}]],JD=si("rotate-ccw",ZD);/**
|
|
148
148
|
* @license lucide-react v1.23.0 - ISC
|
|
149
149
|
*
|
|
150
150
|
* This source code is licensed under the ISC license.
|
|
151
151
|
* See the LICENSE file in the root directory of this source tree.
|
|
152
|
-
*/const
|
|
152
|
+
*/const e3=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],t3=si("send",e3);/**
|
|
153
153
|
* @license lucide-react v1.23.0 - ISC
|
|
154
154
|
*
|
|
155
155
|
* This source code is licensed under the ISC license.
|
|
156
156
|
* See the LICENSE file in the root directory of this source tree.
|
|
157
|
-
*/const
|
|
157
|
+
*/const n3=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],i3=si("sun",n3);/**
|
|
158
158
|
* @license lucide-react v1.23.0 - ISC
|
|
159
159
|
*
|
|
160
160
|
* This source code is licensed under the ISC license.
|
|
161
161
|
* See the LICENSE file in the root directory of this source tree.
|
|
162
|
-
*/const
|
|
162
|
+
*/const s3=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],r3=si("terminal",s3);/**
|
|
163
163
|
* @license lucide-react v1.23.0 - ISC
|
|
164
164
|
*
|
|
165
165
|
* This source code is licensed under the ISC license.
|
|
166
166
|
* See the LICENSE file in the root directory of this source tree.
|
|
167
|
-
*/const
|
|
167
|
+
*/const l3=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Ub=si("trash-2",l3);/**
|
|
168
168
|
* @license lucide-react v1.23.0 - ISC
|
|
169
169
|
*
|
|
170
170
|
* This source code is licensed under the ISC license.
|
|
171
171
|
* See the LICENSE file in the root directory of this source tree.
|
|
172
|
-
*/const l3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],o3=si("x",l3);class Tf extends Error{constructor(e,t){super(t.error),this.status=e,this.body=t,this.name="WebhooksApiError"}}let a3="same-origin",c3=(n,e)=>fetch(n,e),A0=null;function u3(n){A0=n}async function tn(n,e){const t=await c3(n,{credentials:a3,...e,headers:{"Content-Type":"application/json",...A0?{Authorization:`Bearer ${A0}`}:{},...(e==null?void 0:e.headers)??{}}});if(!t.ok){let r;try{r=await t.json()}catch{r={status:t.status,error:t.statusText}}throw new Tf(t.status,r)}const i=await t.text();if(i)return JSON.parse(i)}const $n=n=>`api/applications/${encodeURIComponent(n)}`,lE=n=>{const e=new URLSearchParams;for(const[i,r]of Object.entries(n))r!==void 0&&r!==""&&e.set(i,String(r));const t=e.toString();return t?`?${t}`:""};function f3(){return tn("config")}function h3(){return tn("api/applications")}function d3(n){return tn("api/applications",{method:"POST",body:JSON.stringify(n)})}function qb(){return tn("api/event-types")}function p3(n){return tn("api/event-types",{method:"POST",body:JSON.stringify(n)})}function m3(n,e){return tn(`api/event-types/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(e)})}function g3(n){return tn(`api/event-types/${encodeURIComponent(n)}`,{method:"DELETE"})}function Fb(n){return tn(`${$n(n)}/endpoints`)}function y3(n,e){return tn(`${$n(n)}/endpoints`,{method:"POST",body:JSON.stringify(e)})}function b3(n,e,t){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function v3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}`,{method:"DELETE"})}function x3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/secret`)}function S3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/rotate-secret`,{method:"POST"})}function w3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/enable`,{method:"POST"})}function C3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/disable`,{method:"POST"})}function k3(n,e,t){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify(t)})}function A3(n,e,t){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/recover`,{method:"POST",body:JSON.stringify(t)})}function E3(n,e={}){return tn(`${$n(n)}/messages${lE({...e})}`)}function R3(n,e){return tn(`${$n(n)}/messages/${encodeURIComponent(e)}`)}function Gb(n,e={}){return tn(`${$n(n)}/deliveries${lE({...e})}`)}function T3(n,e){return tn(`${$n(n)}/deliveries/${encodeURIComponent(e)}`)}function O3(n,e){return tn(`${$n(n)}/deliveries/${encodeURIComponent(e)}/request`)}function M3(n,e){return tn(`${$n(n)}/deliveries/${encodeURIComponent(e)}/retry`,{method:"POST"})}function N3(n){return tn(`${$n(n)}/audit`)}function oE(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=oE(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function D3(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=oE(n))&&(i&&(i+=" "),i+=e);return i}const j3=(n,e)=>{const t=new Array(n.length+e.length);for(let i=0;i<n.length;i++)t[i]=n[i];for(let i=0;i<e.length;i++)t[n.length+i]=e[i];return t},B3=(n,e)=>({classGroupId:n,validator:e}),aE=(n=new Map,e=null,t)=>({nextPart:n,validators:e,classGroupId:t}),Xd="-",nC=[],L3="arbitrary..",z3=n=>{const e=P3(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return I3(a);const u=a.split(Xd),f=u[0]===""&&u.length>1?1:0;return cE(u,f,e)},getConflictingClassGroupIds:(a,u)=>{if(u){const f=i[a],d=t[a];return f?d?j3(d,f):f:d||nC}return t[a]||nC}}},cE=(n,e,t)=>{if(n.length-e===0)return t.classGroupId;const r=n[e],o=t.nextPart.get(r);if(o){const d=cE(n,e+1,o);if(d)return d}const a=t.validators;if(a===null)return;const u=e===0?n.join(Xd):n.slice(e).join(Xd),f=a.length;for(let d=0;d<f;d++){const p=a[d];if(p.validator(u))return p.classGroupId}},I3=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),t=e.indexOf(":"),i=e.slice(0,t);return i?L3+i:void 0})(),P3=n=>{const{theme:e,classGroups:t}=n;return H3(t,e)},H3=(n,e)=>{const t=aE();for(const i in n){const r=n[i];Qb(r,t,i,e)}return t},Qb=(n,e,t,i)=>{const r=n.length;for(let o=0;o<r;o++){const a=n[o];V3(a,e,t,i)}},V3=(n,e,t,i)=>{if(typeof n=="string"){_3(n,e,t);return}if(typeof n=="function"){U3(n,e,t,i);return}q3(n,e,t,i)},_3=(n,e,t)=>{const i=n===""?e:uE(e,n);i.classGroupId=t},U3=(n,e,t,i)=>{if(F3(n)){Qb(n(i),e,t,i);return}e.validators===null&&(e.validators=[]),e.validators.push(B3(t,n))},q3=(n,e,t,i)=>{const r=Object.entries(n),o=r.length;for(let a=0;a<o;a++){const[u,f]=r[a];Qb(f,uE(e,u),t,i)}},uE=(n,e)=>{let t=n;const i=e.split(Xd),r=i.length;for(let o=0;o<r;o++){const a=i[o];let u=t.nextPart.get(a);u||(u=aE(),t.nextPart.set(a,u)),t=u}return t},F3=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,G3=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),i=Object.create(null);const r=(o,a)=>{t[o]=a,e++,e>n&&(e=0,i=t,t=Object.create(null))};return{get(o){let a=t[o];if(a!==void 0)return a;if((a=i[o])!==void 0)return r(o,a),a},set(o,a){o in t?t[o]=a:r(o,a)}}},E0="!",iC=":",Q3=[],sC=(n,e,t,i,r)=>({modifiers:n,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:i,isExternal:r}),K3=n=>{const{prefix:e,experimentalParseClassName:t}=n;let i=r=>{const o=[];let a=0,u=0,f=0,d;const p=r.length;for(let w=0;w<p;w++){const E=r[w];if(a===0&&u===0){if(E===iC){o.push(r.slice(f,w)),f=w+1;continue}if(E==="/"){d=w;continue}}E==="["?a++:E==="]"?a--:E==="("?u++:E===")"&&u--}const g=o.length===0?r:r.slice(f);let b=g,v=!1;g.endsWith(E0)?(b=g.slice(0,-1),v=!0):g.startsWith(E0)&&(b=g.slice(1),v=!0);const S=d&&d>f?d-f:void 0;return sC(o,v,b,S)};if(e){const r=e+iC,o=i;i=a=>a.startsWith(r)?o(a.slice(r.length)):sC(Q3,!1,a,void 0,!0)}if(t){const r=i;i=o=>t({className:o,parseClassName:r})}return i},Y3=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((t,i)=>{e.set(t,1e6+i)}),t=>{const i=[];let r=[];for(let o=0;o<t.length;o++){const a=t[o],u=a[0]==="[",f=e.has(a);u||f?(r.length>0&&(r.sort(),i.push(...r),r=[]),i.push(a)):r.push(a)}return r.length>0&&(r.sort(),i.push(...r)),i}},W3=n=>({cache:G3(n.cacheSize),parseClassName:K3(n),sortModifiers:Y3(n),postfixLookupClassGroupIds:X3(n),...z3(n)}),X3=n=>{const e=Object.create(null),t=n.postfixLookupClassGroups;if(t)for(let i=0;i<t.length;i++)e[t[i]]=!0;return e},$3=/\s+/,Z3=(n,e)=>{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:o,postfixLookupClassGroupIds:a}=e,u=[],f=n.trim().split($3);let d="";for(let p=f.length-1;p>=0;p-=1){const g=f[p],{isExternal:b,modifiers:v,hasImportantModifier:S,baseClassName:w,maybePostfixModifierPosition:E}=t(g);if(b){d=g+(d.length>0?" "+d:d);continue}let k=!!E,R;if(k){const D=w.substring(0,E);R=i(D);const j=R&&a[R]?i(w):void 0;j&&j!==R&&(R=j,k=!1)}else R=i(w);if(!R){if(!k){d=g+(d.length>0?" "+d:d);continue}if(R=i(w),!R){d=g+(d.length>0?" "+d:d);continue}k=!1}const N=v.length===0?"":v.length===1?v[0]:o(v).join(":"),T=S?N+E0:N,B=T+R;if(u.indexOf(B)>-1)continue;u.push(B);const L=r(R,k);for(let D=0;D<L.length;++D){const j=L[D];u.push(T+j)}d=g+(d.length>0?" "+d:d)}return d},J3=(...n)=>{let e=0,t,i,r="";for(;e<n.length;)(t=n[e++])&&(i=fE(t))&&(r&&(r+=" "),r+=i);return r},fE=n=>{if(typeof n=="string")return n;let e,t="";for(let i=0;i<n.length;i++)n[i]&&(e=fE(n[i]))&&(t&&(t+=" "),t+=e);return t},ej=(n,...e)=>{let t,i,r,o;const a=f=>{const d=e.reduce((p,g)=>g(p),n());return t=W3(d),i=t.cache.get,r=t.cache.set,o=u,u(f)},u=f=>{const d=i(f);if(d)return d;const p=Z3(f,t);return r(f,p),p};return o=a,(...f)=>o(J3(...f))},tj=[],Nn=n=>{const e=t=>t[n]||tj;return e.isThemeGetter=!0,e},hE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,dE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nj=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,ij=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lj=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,oj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,El=n=>nj.test(n),dt=n=>!!n&&!Number.isNaN(Number(n)),Fs=n=>!!n&&Number.isInteger(Number(n)),ky=n=>n.endsWith("%")&&dt(n.slice(0,-1)),Mr=n=>ij.test(n),pE=()=>!0,aj=n=>sj.test(n)&&!rj.test(n),Kb=()=>!1,cj=n=>lj.test(n),uj=n=>oj.test(n),fj=n=>!Le(n)&&!Ie(n),hj=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),dj=n=>so(n,yE,Kb),Le=n=>hE.test(n),No=n=>so(n,bE,aj),rC=n=>so(n,Sj,dt),pj=n=>so(n,xE,pE),mj=n=>so(n,vE,Kb),lC=n=>so(n,mE,Kb),gj=n=>so(n,gE,uj),ld=n=>so(n,SE,cj),Ie=n=>dE.test(n),Lu=n=>ca(n,bE),yj=n=>ca(n,vE),oC=n=>ca(n,mE),bj=n=>ca(n,yE),vj=n=>ca(n,gE),od=n=>ca(n,SE,!0),xj=n=>ca(n,xE,!0),so=(n,e,t)=>{const i=hE.exec(n);return i?i[1]?e(i[1]):t(i[2]):!1},ca=(n,e,t=!1)=>{const i=dE.exec(n);return i?i[1]?e(i[1]):t:!1},mE=n=>n==="position"||n==="percentage",gE=n=>n==="image"||n==="url",yE=n=>n==="length"||n==="size"||n==="bg-size",bE=n=>n==="length",Sj=n=>n==="number",vE=n=>n==="family-name",xE=n=>n==="number"||n==="weight",SE=n=>n==="shadow",wj=()=>{const n=Nn("color"),e=Nn("font"),t=Nn("text"),i=Nn("font-weight"),r=Nn("tracking"),o=Nn("leading"),a=Nn("breakpoint"),u=Nn("container"),f=Nn("spacing"),d=Nn("radius"),p=Nn("shadow"),g=Nn("inset-shadow"),b=Nn("text-shadow"),v=Nn("drop-shadow"),S=Nn("blur"),w=Nn("perspective"),E=Nn("aspect"),k=Nn("ease"),R=Nn("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...T(),Ie,Le],L=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],j=()=>[Ie,Le,f],X=()=>[El,"full","auto",...j()],J=()=>[Fs,"none","subgrid",Ie,Le],V=()=>["auto",{span:["full",Fs,Ie,Le]},Fs,Ie,Le],K=()=>[Fs,"auto",Ie,Le],ae=()=>["auto","min","max","fr",Ie,Le],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...j()],Q=()=>[El,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],F=()=>[El,"screen","full","dvw","lvw","svw","min","max","fit",...j()],ee=()=>[El,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],G=()=>[n,Ie,Le],M=()=>[...T(),oC,lC,{position:[Ie,Le]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",bj,dj,{size:[Ie,Le]}],le=()=>[ky,Lu,No],ne=()=>["","none","full",d,Ie,Le],se=()=>["",dt,Lu,No],he=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],xe=()=>[dt,ky,oC,lC],fe=()=>["","none",S,Ie,Le],ie=()=>["none",dt,Ie,Le],ye=()=>["none",dt,Ie,Le],ve=()=>[dt,Ie,Le],Qe=()=>[El,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Mr],breakpoint:[Mr],color:[pE],container:[Mr],"drop-shadow":[Mr],ease:["in","out","in-out"],font:[fj],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Mr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Mr],shadow:[Mr],spacing:["px",dt],text:[Mr],"text-shadow":[Mr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",El,Le,Ie,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Ie,Le]}],"container-named":[hj],columns:[{columns:[dt,Le,Ie,u]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:B()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:X()}],"inset-x":[{"inset-x":X()}],"inset-y":[{"inset-y":X()}],start:[{"inset-s":X(),start:X()}],end:[{"inset-e":X(),end:X()}],"inset-bs":[{"inset-bs":X()}],"inset-be":[{"inset-be":X()}],top:[{top:X()}],right:[{right:X()}],bottom:[{bottom:X()}],left:[{left:X()}],visibility:["visible","invisible","collapse"],z:[{z:[Fs,"auto",Ie,Le]}],basis:[{basis:[El,"full","auto",u,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[dt,El,"auto","initial","none",Le]}],grow:[{grow:["",dt,Ie,Le]}],shrink:[{shrink:["",dt,Ie,Le]}],order:[{order:[Fs,"first","last","none",Ie,Le]}],"grid-cols":[{"grid-cols":J()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":J()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[u,"screen",...Q()]}],"min-w":[{"min-w":[u,"screen","none",...Q()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[a]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",t,Lu,No]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,xj,pj]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ky,Le]}],"font-family":[{font:[yj,mj,e]}],"font-features":[{"font-features":[Le]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Ie,Le]}],"line-clamp":[{"line-clamp":[dt,"none",Ie,rC]}],leading:[{leading:[o,...j()]}],"list-image":[{"list-image":["none",Ie,Le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ie,Le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[dt,"from-font","auto",Ie,No]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[dt,"auto",Ie,Le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"tab-size":[{tab:[Fs,Ie,Le]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ie,Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ie,Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fs,Ie,Le],radial:["",Ie,Le],conic:[Fs,Ie,Le]},vj,gj]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-bs":[{"border-bs":G()}],"border-color-be":[{"border-be":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[dt,Ie,Le]}],"outline-w":[{outline:["",dt,Lu,No]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",p,od,ld]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",g,od,ld]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[dt,No]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",b,od,ld]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[dt,Ie,Le]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[dt]}],"mask-image-linear-from-pos":[{"mask-linear-from":xe()}],"mask-image-linear-to-pos":[{"mask-linear-to":xe()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":xe()}],"mask-image-t-to-pos":[{"mask-t-to":xe()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":xe()}],"mask-image-r-to-pos":[{"mask-r-to":xe()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":xe()}],"mask-image-b-to-pos":[{"mask-b-to":xe()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":xe()}],"mask-image-l-to-pos":[{"mask-l-to":xe()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":xe()}],"mask-image-x-to-pos":[{"mask-x-to":xe()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":xe()}],"mask-image-y-to-pos":[{"mask-y-to":xe()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[Ie,Le]}],"mask-image-radial-from-pos":[{"mask-radial-from":xe()}],"mask-image-radial-to-pos":[{"mask-radial-to":xe()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[dt]}],"mask-image-conic-from-pos":[{"mask-conic-from":xe()}],"mask-image-conic-to-pos":[{"mask-conic-to":xe()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ie,Le]}],filter:[{filter:["","none",Ie,Le]}],blur:[{blur:fe()}],brightness:[{brightness:[dt,Ie,Le]}],contrast:[{contrast:[dt,Ie,Le]}],"drop-shadow":[{"drop-shadow":["","none",v,od,ld]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",dt,Ie,Le]}],"hue-rotate":[{"hue-rotate":[dt,Ie,Le]}],invert:[{invert:["",dt,Ie,Le]}],saturate:[{saturate:[dt,Ie,Le]}],sepia:[{sepia:["",dt,Ie,Le]}],"backdrop-filter":[{"backdrop-filter":["","none",Ie,Le]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[dt,Ie,Le]}],"backdrop-contrast":[{"backdrop-contrast":[dt,Ie,Le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dt,Ie,Le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dt,Ie,Le]}],"backdrop-invert":[{"backdrop-invert":["",dt,Ie,Le]}],"backdrop-opacity":[{"backdrop-opacity":[dt,Ie,Le]}],"backdrop-saturate":[{"backdrop-saturate":[dt,Ie,Le]}],"backdrop-sepia":[{"backdrop-sepia":["",dt,Ie,Le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ie,Le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dt,"initial",Ie,Le]}],ease:[{ease:["linear","initial",k,Ie,Le]}],delay:[{delay:[dt,Ie,Le]}],animate:[{animate:["none",R,Ie,Le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ie,Le]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[Ie,Le,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Qe()}],"translate-x":[{"translate-x":Qe()}],"translate-y":[{"translate-y":Qe()}],"translate-z":[{"translate-z":Qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Fs,Ie,Le]}],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ie,Le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":G()}],"scrollbar-track-color":[{"scrollbar-track":G()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ie,Le]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[dt,Lu,No,rC]}],stroke:[{stroke:["none",...G()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Cj=ej(wj);function jt(...n){return Cj(D3(n))}function kj(n,e){switch(e.type){case"add":return{toasts:[...n.toasts,e.toast]};case"remove":return{toasts:n.toasts.filter(t=>t.id!==e.id)};default:return n}}const wE=A.createContext(null);function ua(){const n=A.useContext(wE);if(!n)throw new Error("useToast must be used within ToastProvider");return n}const Aj={success:"bg-success",error:"bg-destructive",warning:"bg-warning",info:"bg-accent"},Ej={success:"border-l-[var(--success)]",error:"border-l-[var(--destructive)]",warning:"border-l-[var(--warning)]",info:"border-l-[var(--accent)]"};function Rj({toast:n,onRemove:e}){return A.useEffect(()=>{const t=setTimeout(()=>e(n.id),4500);return()=>clearTimeout(t)},[n.id,e]),x.jsxs("div",{role:"alert",className:jt("flex min-w-[280px] max-w-sm items-start gap-2.5 rounded-lg border border-border bg-card px-3.5 py-3 shadow-lg","border-l-[3px]",Ej[n.kind]),style:{animation:"toastIn 160ms ease-out"},children:[x.jsx("span",{className:jt("mt-1 size-2 shrink-0 rounded-full",Aj[n.kind]),"aria-hidden":!0}),x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsx("p",{className:"m-0 text-[13px] font-medium text-foreground leading-snug",children:n.message}),n.detail&&x.jsx("p",{className:"mt-1 text-xs text-muted-foreground leading-snug",children:n.detail})]}),x.jsx("button",{"aria-label":"Dismiss",onClick:()=>e(n.id),className:"shrink-0 rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring outline-none",children:x.jsx(o3,{className:"size-3.5"})}),x.jsx("style",{children:`
|
|
172
|
+
*/const o3=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],a3=si("x",o3);class Tf extends Error{constructor(e,t){super(t.error),this.status=e,this.body=t,this.name="WebhooksApiError"}}let c3="same-origin",u3=(n,e)=>fetch(n,e),A0=null;function f3(n){A0=n}async function tn(n,e){const t=await u3(n,{credentials:c3,...e,headers:{"Content-Type":"application/json",...A0?{Authorization:`Bearer ${A0}`}:{},...(e==null?void 0:e.headers)??{}}});if(!t.ok){let r;try{r=await t.json()}catch{r={status:t.status,error:t.statusText}}throw new Tf(t.status,r)}const i=await t.text();if(i)return JSON.parse(i)}const $n=n=>`api/applications/${encodeURIComponent(n)}`,oE=n=>{const e=new URLSearchParams;for(const[i,r]of Object.entries(n))r!==void 0&&r!==""&&e.set(i,String(r));const t=e.toString();return t?`?${t}`:""};function h3(){return tn("config")}function d3(){return tn("api/applications")}function p3(n){return tn("api/applications",{method:"POST",body:JSON.stringify(n)})}function qb(){return tn("api/event-types")}function m3(n){return tn("api/event-types",{method:"POST",body:JSON.stringify(n)})}function g3(n,e){return tn(`api/event-types/${encodeURIComponent(n)}`,{method:"PUT",body:JSON.stringify(e)})}function y3(n){return tn(`api/event-types/${encodeURIComponent(n)}`,{method:"DELETE"})}function Fb(n){return tn(`${$n(n)}/endpoints`)}function b3(n,e){return tn(`${$n(n)}/endpoints`,{method:"POST",body:JSON.stringify(e)})}function v3(n,e,t){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}`,{method:"PUT",body:JSON.stringify(t)})}function x3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}`,{method:"DELETE"})}function S3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/secret`)}function w3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/rotate-secret`,{method:"POST"})}function C3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/enable`,{method:"POST"})}function k3(n,e){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/disable`,{method:"POST"})}function A3(n,e,t){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/test`,{method:"POST",body:JSON.stringify(t)})}function E3(n,e,t){return tn(`${$n(n)}/endpoints/${encodeURIComponent(e)}/recover`,{method:"POST",body:JSON.stringify(t)})}function R3(n,e={}){return tn(`${$n(n)}/messages${oE({...e})}`)}function T3(n,e){return tn(`${$n(n)}/messages/${encodeURIComponent(e)}`)}function Gb(n,e={}){return tn(`${$n(n)}/deliveries${oE({...e})}`)}function O3(n,e){return tn(`${$n(n)}/deliveries/${encodeURIComponent(e)}`)}function M3(n,e){return tn(`${$n(n)}/deliveries/${encodeURIComponent(e)}/request`)}function N3(n,e){return tn(`${$n(n)}/deliveries/${encodeURIComponent(e)}/retry`,{method:"POST"})}function D3(n){return tn(`${$n(n)}/audit`)}function aE(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=aE(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function j3(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=aE(n))&&(i&&(i+=" "),i+=e);return i}const B3=(n,e)=>{const t=new Array(n.length+e.length);for(let i=0;i<n.length;i++)t[i]=n[i];for(let i=0;i<e.length;i++)t[n.length+i]=e[i];return t},L3=(n,e)=>({classGroupId:n,validator:e}),cE=(n=new Map,e=null,t)=>({nextPart:n,validators:e,classGroupId:t}),Xd="-",iC=[],z3="arbitrary..",I3=n=>{const e=H3(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:a=>{if(a.startsWith("[")&&a.endsWith("]"))return P3(a);const u=a.split(Xd),f=u[0]===""&&u.length>1?1:0;return uE(u,f,e)},getConflictingClassGroupIds:(a,u)=>{if(u){const f=i[a],d=t[a];return f?d?B3(d,f):f:d||iC}return t[a]||iC}}},uE=(n,e,t)=>{if(n.length-e===0)return t.classGroupId;const r=n[e],o=t.nextPart.get(r);if(o){const d=uE(n,e+1,o);if(d)return d}const a=t.validators;if(a===null)return;const u=e===0?n.join(Xd):n.slice(e).join(Xd),f=a.length;for(let d=0;d<f;d++){const p=a[d];if(p.validator(u))return p.classGroupId}},P3=n=>n.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=n.slice(1,-1),t=e.indexOf(":"),i=e.slice(0,t);return i?z3+i:void 0})(),H3=n=>{const{theme:e,classGroups:t}=n;return V3(t,e)},V3=(n,e)=>{const t=cE();for(const i in n){const r=n[i];Qb(r,t,i,e)}return t},Qb=(n,e,t,i)=>{const r=n.length;for(let o=0;o<r;o++){const a=n[o];_3(a,e,t,i)}},_3=(n,e,t,i)=>{if(typeof n=="string"){U3(n,e,t);return}if(typeof n=="function"){q3(n,e,t,i);return}F3(n,e,t,i)},U3=(n,e,t)=>{const i=n===""?e:fE(e,n);i.classGroupId=t},q3=(n,e,t,i)=>{if(G3(n)){Qb(n(i),e,t,i);return}e.validators===null&&(e.validators=[]),e.validators.push(L3(t,n))},F3=(n,e,t,i)=>{const r=Object.entries(n),o=r.length;for(let a=0;a<o;a++){const[u,f]=r[a];Qb(f,fE(e,u),t,i)}},fE=(n,e)=>{let t=n;const i=e.split(Xd),r=i.length;for(let o=0;o<r;o++){const a=i[o];let u=t.nextPart.get(a);u||(u=cE(),t.nextPart.set(a,u)),t=u}return t},G3=n=>"isThemeGetter"in n&&n.isThemeGetter===!0,Q3=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=Object.create(null),i=Object.create(null);const r=(o,a)=>{t[o]=a,e++,e>n&&(e=0,i=t,t=Object.create(null))};return{get(o){let a=t[o];if(a!==void 0)return a;if((a=i[o])!==void 0)return r(o,a),a},set(o,a){o in t?t[o]=a:r(o,a)}}},E0="!",sC=":",K3=[],rC=(n,e,t,i,r)=>({modifiers:n,hasImportantModifier:e,baseClassName:t,maybePostfixModifierPosition:i,isExternal:r}),Y3=n=>{const{prefix:e,experimentalParseClassName:t}=n;let i=r=>{const o=[];let a=0,u=0,f=0,d;const p=r.length;for(let w=0;w<p;w++){const E=r[w];if(a===0&&u===0){if(E===sC){o.push(r.slice(f,w)),f=w+1;continue}if(E==="/"){d=w;continue}}E==="["?a++:E==="]"?a--:E==="("?u++:E===")"&&u--}const g=o.length===0?r:r.slice(f);let b=g,v=!1;g.endsWith(E0)?(b=g.slice(0,-1),v=!0):g.startsWith(E0)&&(b=g.slice(1),v=!0);const S=d&&d>f?d-f:void 0;return rC(o,v,b,S)};if(e){const r=e+sC,o=i;i=a=>a.startsWith(r)?o(a.slice(r.length)):rC(K3,!1,a,void 0,!0)}if(t){const r=i;i=o=>t({className:o,parseClassName:r})}return i},W3=n=>{const e=new Map;return n.orderSensitiveModifiers.forEach((t,i)=>{e.set(t,1e6+i)}),t=>{const i=[];let r=[];for(let o=0;o<t.length;o++){const a=t[o],u=a[0]==="[",f=e.has(a);u||f?(r.length>0&&(r.sort(),i.push(...r),r=[]),i.push(a)):r.push(a)}return r.length>0&&(r.sort(),i.push(...r)),i}},X3=n=>({cache:Q3(n.cacheSize),parseClassName:Y3(n),sortModifiers:W3(n),postfixLookupClassGroupIds:$3(n),...I3(n)}),$3=n=>{const e=Object.create(null),t=n.postfixLookupClassGroups;if(t)for(let i=0;i<t.length;i++)e[t[i]]=!0;return e},Z3=/\s+/,J3=(n,e)=>{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:r,sortModifiers:o,postfixLookupClassGroupIds:a}=e,u=[],f=n.trim().split(Z3);let d="";for(let p=f.length-1;p>=0;p-=1){const g=f[p],{isExternal:b,modifiers:v,hasImportantModifier:S,baseClassName:w,maybePostfixModifierPosition:E}=t(g);if(b){d=g+(d.length>0?" "+d:d);continue}let k=!!E,R;if(k){const D=w.substring(0,E);R=i(D);const j=R&&a[R]?i(w):void 0;j&&j!==R&&(R=j,k=!1)}else R=i(w);if(!R){if(!k){d=g+(d.length>0?" "+d:d);continue}if(R=i(w),!R){d=g+(d.length>0?" "+d:d);continue}k=!1}const N=v.length===0?"":v.length===1?v[0]:o(v).join(":"),T=S?N+E0:N,B=T+R;if(u.indexOf(B)>-1)continue;u.push(B);const L=r(R,k);for(let D=0;D<L.length;++D){const j=L[D];u.push(T+j)}d=g+(d.length>0?" "+d:d)}return d},ej=(...n)=>{let e=0,t,i,r="";for(;e<n.length;)(t=n[e++])&&(i=hE(t))&&(r&&(r+=" "),r+=i);return r},hE=n=>{if(typeof n=="string")return n;let e,t="";for(let i=0;i<n.length;i++)n[i]&&(e=hE(n[i]))&&(t&&(t+=" "),t+=e);return t},tj=(n,...e)=>{let t,i,r,o;const a=f=>{const d=e.reduce((p,g)=>g(p),n());return t=X3(d),i=t.cache.get,r=t.cache.set,o=u,u(f)},u=f=>{const d=i(f);if(d)return d;const p=J3(f,t);return r(f,p),p};return o=a,(...f)=>o(ej(...f))},nj=[],Nn=n=>{const e=t=>t[n]||nj;return e.isThemeGetter=!0,e},dE=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,pE=/^\((?:(\w[\w-]*):)?(.+)\)$/i,ij=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,sj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,rj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,lj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,oj=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,El=n=>ij.test(n),dt=n=>!!n&&!Number.isNaN(Number(n)),Fs=n=>!!n&&Number.isInteger(Number(n)),ky=n=>n.endsWith("%")&&dt(n.slice(0,-1)),Mr=n=>sj.test(n),mE=()=>!0,cj=n=>rj.test(n)&&!lj.test(n),Kb=()=>!1,uj=n=>oj.test(n),fj=n=>aj.test(n),hj=n=>!Le(n)&&!Ie(n),dj=n=>n.startsWith("@container")&&(n[10]==="/"&&n[11]!==void 0||n[11]==="s"&&n[16]!==void 0&&n.startsWith("-size/",10)||n[11]==="n"&&n[18]!==void 0&&n.startsWith("-normal/",10)),pj=n=>so(n,bE,Kb),Le=n=>dE.test(n),No=n=>so(n,vE,cj),lC=n=>so(n,wj,dt),mj=n=>so(n,SE,mE),gj=n=>so(n,xE,Kb),oC=n=>so(n,gE,Kb),yj=n=>so(n,yE,fj),ld=n=>so(n,wE,uj),Ie=n=>pE.test(n),Lu=n=>ca(n,vE),bj=n=>ca(n,xE),aC=n=>ca(n,gE),vj=n=>ca(n,bE),xj=n=>ca(n,yE),od=n=>ca(n,wE,!0),Sj=n=>ca(n,SE,!0),so=(n,e,t)=>{const i=dE.exec(n);return i?i[1]?e(i[1]):t(i[2]):!1},ca=(n,e,t=!1)=>{const i=pE.exec(n);return i?i[1]?e(i[1]):t:!1},gE=n=>n==="position"||n==="percentage",yE=n=>n==="image"||n==="url",bE=n=>n==="length"||n==="size"||n==="bg-size",vE=n=>n==="length",wj=n=>n==="number",xE=n=>n==="family-name",SE=n=>n==="number"||n==="weight",wE=n=>n==="shadow",Cj=()=>{const n=Nn("color"),e=Nn("font"),t=Nn("text"),i=Nn("font-weight"),r=Nn("tracking"),o=Nn("leading"),a=Nn("breakpoint"),u=Nn("container"),f=Nn("spacing"),d=Nn("radius"),p=Nn("shadow"),g=Nn("inset-shadow"),b=Nn("text-shadow"),v=Nn("drop-shadow"),S=Nn("blur"),w=Nn("perspective"),E=Nn("aspect"),k=Nn("ease"),R=Nn("animate"),N=()=>["auto","avoid","all","avoid-page","page","left","right","column"],T=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],B=()=>[...T(),Ie,Le],L=()=>["auto","hidden","clip","visible","scroll"],D=()=>["auto","contain","none"],j=()=>[Ie,Le,f],X=()=>[El,"full","auto",...j()],J=()=>[Fs,"none","subgrid",Ie,Le],V=()=>["auto",{span:["full",Fs,Ie,Le]},Fs,Ie,Le],K=()=>[Fs,"auto",Ie,Le],ae=()=>["auto","min","max","fr",Ie,Le],$=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],z=()=>["auto",...j()],Q=()=>[El,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...j()],F=()=>[El,"screen","full","dvw","lvw","svw","min","max","fit",...j()],ee=()=>[El,"screen","full","lh","dvh","lvh","svh","min","max","fit",...j()],G=()=>[n,Ie,Le],M=()=>[...T(),aC,oC,{position:[Ie,Le]}],U=()=>["no-repeat",{repeat:["","x","y","space","round"]}],te=()=>["auto","cover","contain",vj,pj,{size:[Ie,Le]}],le=()=>[ky,Lu,No],ne=()=>["","none","full",d,Ie,Le],se=()=>["",dt,Lu,No],he=()=>["solid","dashed","dotted","double"],pe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],xe=()=>[dt,ky,aC,oC],fe=()=>["","none",S,Ie,Le],ie=()=>["none",dt,Ie,Le],ye=()=>["none",dt,Ie,Le],ve=()=>[dt,Ie,Le],Qe=()=>[El,"full",...j()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Mr],breakpoint:[Mr],color:[mE],container:[Mr],"drop-shadow":[Mr],ease:["in","out","in-out"],font:[hj],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Mr],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Mr],shadow:[Mr],spacing:["px",dt],text:[Mr],"text-shadow":[Mr],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",El,Le,Ie,E]}],container:["container"],"container-type":[{"@container":["","normal","size",Ie,Le]}],"container-named":[dj],columns:[{columns:[dt,Le,Ie,u]}],"break-after":[{"break-after":N()}],"break-before":[{"break-before":N()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:B()}],overflow:[{overflow:L()}],"overflow-x":[{"overflow-x":L()}],"overflow-y":[{"overflow-y":L()}],overscroll:[{overscroll:D()}],"overscroll-x":[{"overscroll-x":D()}],"overscroll-y":[{"overscroll-y":D()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:X()}],"inset-x":[{"inset-x":X()}],"inset-y":[{"inset-y":X()}],start:[{"inset-s":X(),start:X()}],end:[{"inset-e":X(),end:X()}],"inset-bs":[{"inset-bs":X()}],"inset-be":[{"inset-be":X()}],top:[{top:X()}],right:[{right:X()}],bottom:[{bottom:X()}],left:[{left:X()}],visibility:["visible","invisible","collapse"],z:[{z:[Fs,"auto",Ie,Le]}],basis:[{basis:[El,"full","auto",u,...j()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[dt,El,"auto","initial","none",Le]}],grow:[{grow:["",dt,Ie,Le]}],shrink:[{shrink:["",dt,Ie,Le]}],order:[{order:[Fs,"first","last","none",Ie,Le]}],"grid-cols":[{"grid-cols":J()}],"col-start-end":[{col:V()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":J()}],"row-start-end":[{row:V()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":ae()}],"auto-rows":[{"auto-rows":ae()}],gap:[{gap:j()}],"gap-x":[{"gap-x":j()}],"gap-y":[{"gap-y":j()}],"justify-content":[{justify:[...$(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...$()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":$()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:j()}],px:[{px:j()}],py:[{py:j()}],ps:[{ps:j()}],pe:[{pe:j()}],pbs:[{pbs:j()}],pbe:[{pbe:j()}],pt:[{pt:j()}],pr:[{pr:j()}],pb:[{pb:j()}],pl:[{pl:j()}],m:[{m:z()}],mx:[{mx:z()}],my:[{my:z()}],ms:[{ms:z()}],me:[{me:z()}],mbs:[{mbs:z()}],mbe:[{mbe:z()}],mt:[{mt:z()}],mr:[{mr:z()}],mb:[{mb:z()}],ml:[{ml:z()}],"space-x":[{"space-x":j()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":j()}],"space-y-reverse":["space-y-reverse"],size:[{size:Q()}],"inline-size":[{inline:["auto",...F()]}],"min-inline-size":[{"min-inline":["auto",...F()]}],"max-inline-size":[{"max-inline":["none",...F()]}],"block-size":[{block:["auto",...ee()]}],"min-block-size":[{"min-block":["auto",...ee()]}],"max-block-size":[{"max-block":["none",...ee()]}],w:[{w:[u,"screen",...Q()]}],"min-w":[{"min-w":[u,"screen","none",...Q()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[a]},...Q()]}],h:[{h:["screen","lh",...Q()]}],"min-h":[{"min-h":["screen","lh","none",...Q()]}],"max-h":[{"max-h":["screen","lh",...Q()]}],"font-size":[{text:["base",t,Lu,No]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,Sj,mj]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",ky,Le]}],"font-family":[{font:[bj,gj,e]}],"font-features":[{"font-features":[Le]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,Ie,Le]}],"line-clamp":[{"line-clamp":[dt,"none",Ie,lC]}],leading:[{leading:[o,...j()]}],"list-image":[{"list-image":["none",Ie,Le]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ie,Le]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:[dt,"from-font","auto",Ie,No]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[dt,"auto",Ie,Le]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:j()}],"tab-size":[{tab:[Fs,Ie,Le]}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ie,Le]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ie,Le]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:M()}],"bg-repeat":[{bg:U()}],"bg-size":[{bg:te()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},Fs,Ie,Le],radial:["",Ie,Le],conic:[Fs,Ie,Le]},xj,yj]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:le()}],"gradient-via-pos":[{via:le()}],"gradient-to-pos":[{to:le()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:ne()}],"rounded-s":[{"rounded-s":ne()}],"rounded-e":[{"rounded-e":ne()}],"rounded-t":[{"rounded-t":ne()}],"rounded-r":[{"rounded-r":ne()}],"rounded-b":[{"rounded-b":ne()}],"rounded-l":[{"rounded-l":ne()}],"rounded-ss":[{"rounded-ss":ne()}],"rounded-se":[{"rounded-se":ne()}],"rounded-ee":[{"rounded-ee":ne()}],"rounded-es":[{"rounded-es":ne()}],"rounded-tl":[{"rounded-tl":ne()}],"rounded-tr":[{"rounded-tr":ne()}],"rounded-br":[{"rounded-br":ne()}],"rounded-bl":[{"rounded-bl":ne()}],"border-w":[{border:se()}],"border-w-x":[{"border-x":se()}],"border-w-y":[{"border-y":se()}],"border-w-s":[{"border-s":se()}],"border-w-e":[{"border-e":se()}],"border-w-bs":[{"border-bs":se()}],"border-w-be":[{"border-be":se()}],"border-w-t":[{"border-t":se()}],"border-w-r":[{"border-r":se()}],"border-w-b":[{"border-b":se()}],"border-w-l":[{"border-l":se()}],"divide-x":[{"divide-x":se()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":se()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...he(),"hidden","none"]}],"divide-style":[{divide:[...he(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-bs":[{"border-bs":G()}],"border-color-be":[{"border-be":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...he(),"none","hidden"]}],"outline-offset":[{"outline-offset":[dt,Ie,Le]}],"outline-w":[{outline:["",dt,Lu,No]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",p,od,ld]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",g,od,ld]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:se()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[dt,No]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":se()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",b,od,ld]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[dt,Ie,Le]}],"mix-blend":[{"mix-blend":[...pe(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":pe()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[dt]}],"mask-image-linear-from-pos":[{"mask-linear-from":xe()}],"mask-image-linear-to-pos":[{"mask-linear-to":xe()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":xe()}],"mask-image-t-to-pos":[{"mask-t-to":xe()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":xe()}],"mask-image-r-to-pos":[{"mask-r-to":xe()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":xe()}],"mask-image-b-to-pos":[{"mask-b-to":xe()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":xe()}],"mask-image-l-to-pos":[{"mask-l-to":xe()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":xe()}],"mask-image-x-to-pos":[{"mask-x-to":xe()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":xe()}],"mask-image-y-to-pos":[{"mask-y-to":xe()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[Ie,Le]}],"mask-image-radial-from-pos":[{"mask-radial-from":xe()}],"mask-image-radial-to-pos":[{"mask-radial-to":xe()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":T()}],"mask-image-conic-pos":[{"mask-conic":[dt]}],"mask-image-conic-from-pos":[{"mask-conic-from":xe()}],"mask-image-conic-to-pos":[{"mask-conic-to":xe()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:M()}],"mask-repeat":[{mask:U()}],"mask-size":[{mask:te()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ie,Le]}],filter:[{filter:["","none",Ie,Le]}],blur:[{blur:fe()}],brightness:[{brightness:[dt,Ie,Le]}],contrast:[{contrast:[dt,Ie,Le]}],"drop-shadow":[{"drop-shadow":["","none",v,od,ld]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",dt,Ie,Le]}],"hue-rotate":[{"hue-rotate":[dt,Ie,Le]}],invert:[{invert:["",dt,Ie,Le]}],saturate:[{saturate:[dt,Ie,Le]}],sepia:[{sepia:["",dt,Ie,Le]}],"backdrop-filter":[{"backdrop-filter":["","none",Ie,Le]}],"backdrop-blur":[{"backdrop-blur":fe()}],"backdrop-brightness":[{"backdrop-brightness":[dt,Ie,Le]}],"backdrop-contrast":[{"backdrop-contrast":[dt,Ie,Le]}],"backdrop-grayscale":[{"backdrop-grayscale":["",dt,Ie,Le]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[dt,Ie,Le]}],"backdrop-invert":[{"backdrop-invert":["",dt,Ie,Le]}],"backdrop-opacity":[{"backdrop-opacity":[dt,Ie,Le]}],"backdrop-saturate":[{"backdrop-saturate":[dt,Ie,Le]}],"backdrop-sepia":[{"backdrop-sepia":["",dt,Ie,Le]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":j()}],"border-spacing-x":[{"border-spacing-x":j()}],"border-spacing-y":[{"border-spacing-y":j()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ie,Le]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[dt,"initial",Ie,Le]}],ease:[{ease:["linear","initial",k,Ie,Le]}],delay:[{delay:[dt,Ie,Le]}],animate:[{animate:["none",R,Ie,Le]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ie,Le]}],"perspective-origin":[{"perspective-origin":B()}],rotate:[{rotate:ie()}],"rotate-x":[{"rotate-x":ie()}],"rotate-y":[{"rotate-y":ie()}],"rotate-z":[{"rotate-z":ie()}],scale:[{scale:ye()}],"scale-x":[{"scale-x":ye()}],"scale-y":[{"scale-y":ye()}],"scale-z":[{"scale-z":ye()}],"scale-3d":["scale-3d"],skew:[{skew:ve()}],"skew-x":[{"skew-x":ve()}],"skew-y":[{"skew-y":ve()}],transform:[{transform:[Ie,Le,"","none","gpu","cpu"]}],"transform-origin":[{origin:B()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Qe()}],"translate-x":[{"translate-x":Qe()}],"translate-y":[{"translate-y":Qe()}],"translate-z":[{"translate-z":Qe()}],"translate-none":["translate-none"],zoom:[{zoom:[Fs,Ie,Le]}],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ie,Le]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scrollbar-thumb-color":[{"scrollbar-thumb":G()}],"scrollbar-track-color":[{"scrollbar-track":G()}],"scrollbar-gutter":[{"scrollbar-gutter":["auto","stable","both"]}],"scrollbar-w":[{scrollbar:["auto","thin","none"]}],"scroll-m":[{"scroll-m":j()}],"scroll-mx":[{"scroll-mx":j()}],"scroll-my":[{"scroll-my":j()}],"scroll-ms":[{"scroll-ms":j()}],"scroll-me":[{"scroll-me":j()}],"scroll-mbs":[{"scroll-mbs":j()}],"scroll-mbe":[{"scroll-mbe":j()}],"scroll-mt":[{"scroll-mt":j()}],"scroll-mr":[{"scroll-mr":j()}],"scroll-mb":[{"scroll-mb":j()}],"scroll-ml":[{"scroll-ml":j()}],"scroll-p":[{"scroll-p":j()}],"scroll-px":[{"scroll-px":j()}],"scroll-py":[{"scroll-py":j()}],"scroll-ps":[{"scroll-ps":j()}],"scroll-pe":[{"scroll-pe":j()}],"scroll-pbs":[{"scroll-pbs":j()}],"scroll-pbe":[{"scroll-pbe":j()}],"scroll-pt":[{"scroll-pt":j()}],"scroll-pr":[{"scroll-pr":j()}],"scroll-pb":[{"scroll-pb":j()}],"scroll-pl":[{"scroll-pl":j()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ie,Le]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[dt,Lu,No,lC]}],stroke:[{stroke:["none",...G()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{"container-named":["container-type"],overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},postfixLookupClassGroups:["container-type"],orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},kj=tj(Cj);function jt(...n){return kj(j3(n))}function Aj(n,e){switch(e.type){case"add":return{toasts:[...n.toasts,e.toast]};case"remove":return{toasts:n.toasts.filter(t=>t.id!==e.id)};default:return n}}const CE=A.createContext(null);function ua(){const n=A.useContext(CE);if(!n)throw new Error("useToast must be used within ToastProvider");return n}const Ej={success:"bg-success",error:"bg-destructive",warning:"bg-warning",info:"bg-accent"},Rj={success:"border-l-[var(--success)]",error:"border-l-[var(--destructive)]",warning:"border-l-[var(--warning)]",info:"border-l-[var(--accent)]"};function Tj({toast:n,onRemove:e}){return A.useEffect(()=>{const t=setTimeout(()=>e(n.id),4500);return()=>clearTimeout(t)},[n.id,e]),x.jsxs("div",{role:"alert",className:jt("flex min-w-[280px] max-w-sm items-start gap-2.5 rounded-lg border border-border bg-card px-3.5 py-3 shadow-lg","border-l-[3px]",Rj[n.kind]),style:{animation:"toastIn 160ms ease-out"},children:[x.jsx("span",{className:jt("mt-1 size-2 shrink-0 rounded-full",Ej[n.kind]),"aria-hidden":!0}),x.jsxs("div",{className:"flex-1 min-w-0",children:[x.jsx("p",{className:"m-0 text-[13px] font-medium text-foreground leading-snug",children:n.message}),n.detail&&x.jsx("p",{className:"mt-1 text-xs text-muted-foreground leading-snug",children:n.detail})]}),x.jsx("button",{"aria-label":"Dismiss",onClick:()=>e(n.id),className:"shrink-0 rounded-sm text-muted-foreground hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring outline-none",children:x.jsx(a3,{className:"size-3.5"})}),x.jsx("style",{children:`
|
|
173
173
|
@keyframes toastIn {
|
|
174
174
|
from { opacity: 0; transform: translateY(8px); }
|
|
175
175
|
to { opacity: 1; transform: translateY(0); }
|
|
176
176
|
}
|
|
177
|
-
`})]})}function Tj({children:n}){const[e,t]=A.useReducer(kj,{toasts:[]}),i=A.useCallback((o,a,u)=>{const f=`${Date.now()}-${Math.random()}`;t({type:"add",toast:{id:f,kind:o,message:a,detail:u}})},[]),r=A.useCallback(o=>{t({type:"remove",id:o})},[]);return x.jsxs(wE.Provider,{value:{add:i},children:[n,x.jsx("div",{"aria-live":"polite","aria-atomic":"false",className:"fixed bottom-6 right-6 z-[9999] flex flex-col gap-2",children:e.toasts.map(o=>x.jsx(Rj,{toast:o,onRemove:r},o.id))})]})}const CE="xtandard-webhooks:theme";function R0(){try{const n=localStorage.getItem(CE);if(n==="light"||n==="dark"||n==="system")return n}catch{}return"system"}function Oj(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}function Mj(n){return n==="system"?Oj()?"dark":"light":n}function T0(n){typeof document<"u"&&(document.documentElement.dataset.theme=Mj(n))}function Nj(n){try{localStorage.setItem(CE,n)}catch{}T0(n)}function Dj(){T0(R0()),typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{R0()==="system"&&T0("system")})}const jj=[{value:"system",label:"System theme",Icon:GD},{value:"light",label:"Light theme",Icon:n3},{value:"dark",label:"Dark theme",Icon:KD}];function Bj(){const[n,e]=A.useState(()=>R0()),t=i=>{e(i),Nj(i)};return x.jsx("div",{role:"group","aria-label":"Theme",className:"inline-flex gap-0.5 rounded-md border border-border bg-secondary/50 p-0.5",children:jj.map(({value:i,label:r,Icon:o})=>{const a=n===i;return x.jsx("button",{type:"button",title:r,"aria-label":r,"aria-pressed":a,onClick:()=>t(i),className:jt("inline-flex h-6 w-7 items-center justify-center rounded-[5px] outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring",a?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:x.jsx(o,{className:"size-3.5"})},i)})})}function Xn(n){if(!n)return"—";const e=new Date(n);return Number.isNaN(e.getTime())?"—":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)}function Of(n,e=Date.now()){if(!n)return"—";const t=Date.parse(n);if(Number.isNaN(t))return"—";const i=e-t,r=Math.abs(i);if(r<1e4)return"just now";const o=[[1e3,"s"],[6e4,"m"],[36e5,"h"],[864e5,"d"]];let a=Math.round(r/1e3),u="s";for(const[f,d]of o)r>=f&&(a=Math.round(r/f),u=d);return i>=0?`${a}${u} ago`:`in ${a}${u}`}function Lj(n){return n==null||!Number.isFinite(n)||n<0?"—":n<1e3?`${Math.round(n)} ms`:`${(n/1e3).toFixed(2).replace(/\.?0+$/,"")} s`}function zj(n){switch(n){case"pending":return"Pending";case"delivering":return"Delivering";case"succeeded":return"Succeeded";case"failed":return"Dead-letter"}}function Ij(n){switch(n){case"succeeded":return"border-success/30 bg-success/10 text-success";case"failed":return"border-destructive/30 bg-destructive/10 text-destructive";case"delivering":return"border-chart-2/30 bg-chart-2/10 text-chart-2";case"pending":return"border-warning/30 bg-warning/10 text-warning"}}function Pj(n){const e=new Map;for(const t of[...n].sort((i,r)=>i.name.localeCompare(r.name))){const i=t.groupName??"",r=e.get(i)??[];r.push(t),e.set(i,r)}return[...e.entries()].sort(([t],[i])=>t===""?1:i===""?-1:t.localeCompare(i)).map(([t,i])=>({group:t||"Ungrouped",types:i}))}function Hj(n,e){const t=n+e;return t===0?null:Math.round(n/t*100)}function Vj(n,e,t=Date.now()){if(!n)return!1;const i=Date.parse(n);return Number.isNaN(i)?!1:i<=t&&t-i<=e}function ri(n,...e){const t=new URL(`https://base-ui.com/production-error/${n}`);return e.forEach(i=>t.searchParams.append("args[]",i)),`Base UI error #${n}; visit ${t} for the full message.`}const kE=A.createContext(void 0);function Mf(n){const e=A.useContext(kE);if(n===!1&&e===void 0)throw new Error(ri(27));return e}const aC={};function Bi(n,e){const t=A.useRef(aC);return t.current===aC&&(t.current=n(e)),t}function Zl(n,e,t,i){const r=Bi(AE).current;return Uj(r,n,e,t,i)&&EE(r,[n,e,t,i]),r.callback}function _j(n){const e=Bi(AE).current;return qj(e,n)&&EE(e,n),e.callback}function AE(){return{callback:null,cleanup:null,refs:[]}}function Uj(n,e,t,i,r){return n.refs[0]!==e||n.refs[1]!==t||n.refs[2]!==i||n.refs[3]!==r}function qj(n,e){return n.refs.length!==e.length||n.refs.some((t,i)=>t!==e[i])}function EE(n,e){if(n.refs=e,e.every(t=>t==null)){n.callback=null;return}n.callback=t=>{if(n.cleanup&&(n.cleanup(),n.cleanup=null),t!=null){const i=Array(e.length).fill(null);for(let r=0;r<e.length;r+=1){const o=e[r];if(o!=null)switch(typeof o){case"function":{const a=o(t);typeof a=="function"&&(i[r]=a);break}case"object":{o.current=t;break}}}n.cleanup=()=>{for(let r=0;r<e.length;r+=1){const o=e[r];if(o!=null)switch(typeof o){case"function":{const a=i[r];typeof a=="function"?a():o(null);break}case"object":{o.current=null;break}}}}}}}const Fj=parseInt(A.version,10);function Yb(n){return Fj>=n}function cC(n){if(!A.isValidElement(n))return null;const e=n,t=e.props;return(Yb(19)?t==null?void 0:t.ref:e.ref)??null}function O0(n,e){if(n&&!e)return n;if(!n&&e)return e;if(n||e)return{...n,...e}}function Gj(n,e){const t={};for(const i in n){const r=n[i];if(e!=null&&e.hasOwnProperty(i)){const o=e[i](r);o!=null&&Object.assign(t,o);continue}r===!0?t[`data-${i.toLowerCase()}`]="":r&&(t[`data-${i.toLowerCase()}`]=r.toString())}return t}function Qj(n,e){return typeof n=="function"?n(e):n}function Kj(n,e){return typeof n=="function"?n(e):n}const Yu={};function jp(n,e,t,i,r){let o={...M0(n,Yu)};return e&&(o=Gu(o,e)),t&&(o=Gu(o,t)),i&&(o=Gu(o,i)),r&&(o=Gu(o,r)),o}function Yj(n){if(n.length===0)return Yu;if(n.length===1)return M0(n[0],Yu);let e={...M0(n[0],Yu)};for(let t=1;t<n.length;t+=1)e=Gu(e,n[t]);return e}function Gu(n,e){return RE(e)?e(n):Wj(n,e)}function Wj(n,e){if(!e)return n;for(const t in e){const i=e[t];switch(t){case"style":{n[t]=O0(n.style,i);break}case"className":{n[t]=TE(n.className,i);break}default:Xj(t,i)?n[t]=$j(n[t],i):n[t]=i}}return n}function Xj(n,e){const t=n.charCodeAt(0),i=n.charCodeAt(1),r=n.charCodeAt(2);return t===111&&i===110&&r>=65&&r<=90&&(typeof e=="function"||typeof e>"u")}function RE(n){return typeof n=="function"}function M0(n,e){return RE(n)?n(e):n??Yu}function $j(n,e){return e?n?t=>{if(Zj(t)){const r=t;N0(r);const o=e(r);return r.baseUIHandlerPrevented||n==null||n(r),o}const i=e(t);return n==null||n(t),i}:e:n}function N0(n){return n.preventBaseUIHandler=()=>{n.baseUIHandlerPrevented=!0},n}function TE(n,e){return e?n?e+" "+n:e:n}function Zj(n){return n!=null&&typeof n=="object"&&"nativeEvent"in n}function un(){}const Dl=Object.freeze([]),_n=Object.freeze({}),Jj={style:{transition:"none"}},eB="data-base-ui-click-trigger",OE={fallbackAxisSide:"none"},tB={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function wn(n,e,t={}){const i=e.render,r=nB(e,t);if(t.enabled===!1)return null;const o=t.state??_n;return iB(n,i,r,o)}function nB(n,e={}){const{className:t,style:i,render:r}=n,{state:o=_n,ref:a,props:u,stateAttributesMapping:f,enabled:d=!0}=e,p=d?Qj(t,o):void 0,g=d?Kj(i,o):void 0,b=d?Gj(o,f):_n,v=d?O0(b,Array.isArray(u)?Yj(u):u)??_n:_n;return typeof document<"u"&&(d?Array.isArray(a)?v.ref=_j([v.ref,cC(r),...a]):v.ref=Zl(v.ref,cC(r),a):Zl(null,null)),d?(p!==void 0&&(v.className=TE(v.className,p)),g!==void 0&&(v.style=O0(v.style,g)),v):_n}function iB(n,e,t,i){if(e){if(typeof e=="function")return e(t,i);const r=jp(t,e.props);return r.ref=t.ref,A.cloneElement(e,r)}if(n&&typeof n=="string")return sB(n,t);throw new Error(ri(8))}function sB(n,e){return n==="button"?A.createElement("button",{type:"button",...e,key:e.key}):n==="img"?A.createElement("img",{alt:"",...e,key:e.key}):A.createElement(n,e)}let $d=(function(n){return n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n})({});const rB={[$d.startingStyle]:""},lB={[$d.endingStyle]:""},Nf={transitionStatus(n){return n==="starting"?rB:n==="ending"?lB:null}};let Ho=(function(n){return n.open="data-open",n.closed="data-closed",n[n.startingStyle=$d.startingStyle]="startingStyle",n[n.endingStyle=$d.endingStyle]="endingStyle",n.anchorHidden="data-anchor-hidden",n})({}),D0=(function(n){return n.popupOpen="data-popup-open",n.pressed="data-pressed",n})({});const oB={[D0.popupOpen]:""},aB={[D0.popupOpen]:"",[D0.pressed]:""},cB={[Ho.open]:""},uB={[Ho.closed]:""},fB={[Ho.anchorHidden]:""},hB={open(n){return n?oB:null}},Wb={open(n){return n?aB:null}},Pc={open(n){return n?cB:uB},anchorHidden(n){return n?fB:null}},dB={...Pc,...Nf},pB=A.forwardRef(function(e,t){const{render:i,className:r,forceRender:o=!1,...a}=e,{store:u}=Mf(),f=u.useState("open"),d=u.useState("nested"),p=u.useState("mounted"),g=u.useState("transitionStatus"),b=A.useMemo(()=>({open:f,transitionStatus:g}),[f,g]);return wn("div",e,{state:b,ref:[u.context.backdropRef,t],stateAttributesMapping:dB,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:o||!d})});function Bp(){return typeof window<"u"}function ro(n){return Xb(n)?(n.nodeName||"").toLowerCase():"#document"}function In(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function cr(n){var e;return(e=(Xb(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Xb(n){return Bp()?n instanceof Node||n instanceof In(n).Node:!1}function Zt(n){return Bp()?n instanceof Element||n instanceof In(n).Element:!1}function Ln(n){return Bp()?n instanceof HTMLElement||n instanceof In(n).HTMLElement:!1}function j0(n){return!Bp()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof In(n).ShadowRoot}function fa(n){const{overflow:e,overflowX:t,overflowY:i,display:r}=Ji(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&r!=="inline"&&r!=="contents"}function mB(n){return/^(table|td|th)$/.test(ro(n))}function Lp(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const gB=/transform|translate|scale|rotate|perspective|filter/,yB=/paint|layout|strict|content/,Do=n=>!!n&&n!=="none";let Ay;function $b(n){const e=Zt(n)?Ji(n):n;return Do(e.transform)||Do(e.translate)||Do(e.scale)||Do(e.rotate)||Do(e.perspective)||!zp()&&(Do(e.backdropFilter)||Do(e.filter))||gB.test(e.willChange||"")||yB.test(e.contain||"")}function bB(n){let e=Ur(n);for(;Ln(e)&&!Hr(e);){if($b(e))return e;if(Lp(e))return null;e=Ur(e)}return null}function zp(){return Ay==null&&(Ay=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ay}function Hr(n){return/^(html|body|#document)$/.test(ro(n))}function Ji(n){return In(n).getComputedStyle(n)}function Ip(n){return Zt(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ur(n){if(ro(n)==="html")return n;const e=n.assignedSlot||n.parentNode||j0(n)&&n.host||cr(n);return j0(e)?e.host:e}function ME(n){const e=Ur(n);return Hr(e)?n.ownerDocument?n.ownerDocument.body:n.body:Ln(e)&&fa(e)?e:ME(e)}function Wl(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=ME(n),o=r===((i=n.ownerDocument)==null?void 0:i.body),a=In(r);if(o){const u=B0(a);return e.concat(a,a.visualViewport||[],fa(r)?r:[],u&&t?Wl(u):[])}else return e.concat(r,Wl(r,[],t))}function B0(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}const Ey=Db[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],vB=Ey&&Ey!==A.useLayoutEffect?Ey:n=>n();function He(n){const e=Bi(xB).current;return e.next=n,vB(e.effect),e.trampoline}function xB(){const n={next:void 0,callback:SB,trampoline:(...e)=>{var t;return(t=n.callback)==null?void 0:t.call(n,...e)},effect:()=>{n.callback=n.next}};return n}function SB(){}const wB=()=>{},ze=typeof document<"u"?A.useLayoutEffect:wB,CB=A.createContext(void 0);function kB(n=!1){const e=A.useContext(CB);if(e===void 0&&!n)throw new Error(ri(16));return e}function AB(n){const{focusableWhenDisabled:e,disabled:t,composite:i=!1,tabIndex:r=0,isNativeButton:o}=n,a=i&&e!==!1,u=i&&e===!1;return{props:A.useMemo(()=>{const d={onKeyDown(p){t&&e&&p.key!=="Tab"&&p.preventDefault()}};return i||(d.tabIndex=r,!o&&t&&(d.tabIndex=e?r:-1)),(o&&(e||a)||!o&&t)&&(d["aria-disabled"]=t),o&&(!e||u)&&(d.disabled=t),d},[i,t,e,a,u,o,r])}}function Df(n={}){const{disabled:e=!1,focusableWhenDisabled:t,tabIndex:i=0,native:r=!0}=n,o=A.useRef(null),a=kB(!0)!==void 0,u=He(()=>{const b=o.current;return!!((b==null?void 0:b.tagName)==="A"&&(b!=null&&b.href))}),{props:f}=AB({focusableWhenDisabled:t,disabled:e,composite:a,tabIndex:i,isNativeButton:r}),d=A.useCallback(()=>{const b=o.current;EB(b)&&a&&e&&f.disabled===void 0&&b.disabled&&(b.disabled=!1)},[e,f.disabled,a]);ze(d,[d]);const p=A.useCallback((b={})=>{const{onClick:v,onMouseDown:S,onKeyUp:w,onKeyDown:E,onPointerDown:k,...R}=b;return jp({type:r?"button":void 0,onClick(T){if(e){T.preventDefault();return}v==null||v(T)},onMouseDown(T){e||S==null||S(T)},onKeyDown(T){if(e||(N0(T),E==null||E(T)),T.baseUIHandlerPrevented)return;const B=T.target===T.currentTarget&&!r&&!u()&&!e,L=T.key==="Enter",D=T.key===" ";B&&((D||L)&&T.preventDefault(),L&&(v==null||v(T)))},onKeyUp(T){e||(N0(T),w==null||w(T)),!T.baseUIHandlerPrevented&&T.target===T.currentTarget&&!r&&!e&&T.key===" "&&(v==null||v(T))},onPointerDown(T){if(e){T.preventDefault();return}k==null||k(T)}},r?void 0:{role:"button"},f,R)},[e,f,r,u]),g=He(b=>{o.current=b,d()});return{getButtonProps:p,buttonRef:g}}function EB(n){return Ln(n)&&n.tagName==="BUTTON"}const Oi="none",Wu="trigger-press",RB="trigger-hover",NE="outside-press",Id="item-press",Vo="input-change",Ol="input-clear",Pp="focus-out",DE="escape-key",Pd="list-navigation",TB="cancel-open",OB="imperative-action",MB="window-resize";function tt(n,e,t,i){let r=!1,o=!1;const a=_n;return{reason:n,event:e??new Event("base-ui"),cancel(){r=!0},allowPropagation(){o=!0},get isCanceled(){return r},get isPropagationAllowed(){return o},trigger:t,...a}}function zu(n,e,t){const i=t??_n;return{reason:n,event:e??new Event("base-ui"),...i}}const NB={...Db};let uC=0;function DB(n,e="mui"){const[t,i]=A.useState(n),r=n||t;return A.useEffect(()=>{t==null&&(uC+=1,i(`${e}-${uC}`))},[t,e]),r}const fC=NB.useId;function jf(n,e){if(fC!==void 0){const t=fC();return n??(e?`${e}-${t}`:t)}return DB(n,e)}function Hp(n){return jf(n,"base-ui")}const jB=[];function jE(n){A.useEffect(n,jB)}const Iu=0;class Ac{constructor(){Kt(this,"currentId",Iu);Kt(this,"clear",()=>{this.currentId!==Iu&&(clearTimeout(this.currentId),this.currentId=Iu)});Kt(this,"disposeEffect",()=>this.clear)}static create(){return new Ac}start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Iu,t()},e)}isStarted(){return this.currentId!==Iu}}function $i(){const n=Bi(Ac.create).current;return jE(n.disposeEffect),n}function Vn(n){const e=Bi(BB,n).current;return e.next=n,ze(e.effect),e}function BB(n){const e={current:n,next:n,effect:()=>{e.current=e.next}};return e}const ha=typeof navigator<"u",Ry=PB(),BE=VB(),Zb=HB(),LE=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),LB=Ry.platform==="MacIntel"&&Ry.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Ry.platform),hC=ha&&/firefox/i.test(Zb),zB=ha&&/apple/i.test(navigator.vendor),Zd=ha&&/android/i.test(BE)||/android/i.test(Zb);ha&&BE.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const IB=Zb.includes("jsdom/");function PB(){if(!ha)return{platform:"",maxTouchPoints:-1};const n=navigator.userAgentData;return n!=null&&n.platform?{platform:n.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function HB(){if(!ha)return"";const n=navigator.userAgentData;return n&&Array.isArray(n.brands)?n.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(" "):navigator.userAgent}function VB(){if(!ha)return"";const n=navigator.userAgentData;return n!=null&&n.platform?n.platform:navigator.platform??""}const L0="data-base-ui-focusable",zE="active",IE="selected",_B="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Xl="ArrowLeft",$l="ArrowRight",Jb="ArrowUp",Bf="ArrowDown";function jl(n){var t;let e=n.activeElement;for(;((t=e==null?void 0:e.shadowRoot)==null?void 0:t.activeElement)!=null;)e=e.shadowRoot.activeElement;return e}function Dt(n,e){var i;if(!n||!e)return!1;const t=(i=e.getRootNode)==null?void 0:i.call(e);if(n.contains(e))return!0;if(t&&j0(t)){let r=e;for(;r;){if(n===r)return!0;r=r.parentNode||r.host}}return!1}function ni(n){return"composedPath"in n?n.composedPath()[0]:n.target}function ks(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function UB(n){return n.matches("html,body")}function di(n){return(n==null?void 0:n.ownerDocument)||document}function PE(n){return Ln(n)&&n.matches(_B)}function z0(n){return n?n.getAttribute("role")==="combobox"&&PE(n):!1}function cf(n){return n?n.hasAttribute(L0)?n:n.querySelector(`[${L0}]`)||n:null}function ic(n,e,t=!0){return n.filter(r=>{var o;return r.parentId===e&&(!t||((o=r.context)==null?void 0:o.open))}).flatMap(r=>[r,...ic(n,r.id,t)])}function dC(n,e){var r;let t=[],i=(r=n.find(o=>o.id===e))==null?void 0:r.parentId;for(;i;){const o=n.find(a=>a.id===i);i=o==null?void 0:o.parentId,o&&(t=t.concat(o))}return t}function bn(n){n.preventDefault(),n.stopPropagation()}function qB(n){return"nativeEvent"in n}function HE(n){return n.mozInputSource===0&&n.isTrusted?!0:Zd&&n.pointerType?n.type==="click"&&n.buttons===1:n.detail===0&&!n.pointerType}function VE(n){return IB?!1:!Zd&&n.width===0&&n.height===0||Zd&&n.width===1&&n.height===1&&n.pressure===0&&n.detail===0&&n.pointerType==="mouse"||n.width<1&&n.height<1&&n.pressure===0&&n.detail===0&&n.pointerType==="touch"}function pC(n,e){return["mouse","pen"].includes(n)}function _E(n){const e=n.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}const FB=["top","right","bottom","left"],Ec=Math.min,Wi=Math.max,Jd=Math.round,Za=Math.floor,rr=n=>({x:n,y:n}),GB={left:"right",right:"left",bottom:"top",top:"bottom"};function I0(n,e,t){return Wi(n,Ec(e,t))}function qr(n,e){return typeof n=="function"?n(e):n}function Zi(n){return n.split("-")[0]}function lo(n){return n.split("-")[1]}function ev(n){return n==="x"?"y":"x"}function tv(n){return n==="y"?"height":"width"}function hs(n){const e=n[0];return e==="t"||e==="b"?"y":"x"}function nv(n){return ev(hs(n))}function QB(n,e,t){t===void 0&&(t=!1);const i=lo(n),r=nv(n),o=tv(r);let a=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=ep(a)),[a,ep(a)]}function KB(n){const e=ep(n);return[P0(n),e,P0(e)]}function P0(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const mC=["left","right"],gC=["right","left"],YB=["top","bottom"],WB=["bottom","top"];function XB(n,e,t){switch(n){case"top":case"bottom":return t?e?gC:mC:e?mC:gC;case"left":case"right":return e?YB:WB;default:return[]}}function $B(n,e,t,i){const r=lo(n);let o=XB(Zi(n),t==="start",i);return r&&(o=o.map(a=>a+"-"+r),e&&(o=o.concat(o.map(P0)))),o}function ep(n){const e=Zi(n);return GB[e]+n.slice(e.length)}function ZB(n){return{top:0,right:0,bottom:0,left:0,...n}}function UE(n){return typeof n!="number"?ZB(n):{top:n,right:n,bottom:n,left:n}}function tp(n){const{x:e,y:t,width:i,height:r}=n;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function ad(n,e,t){return Math.floor(n/e)!==t}function Xu(n,e){return e<0||e>=n.current.length}function Ty(n,e){return ei(n,{disabledIndices:e})}function yC(n,e){return ei(n,{decrement:!0,startingIndex:n.current.length,disabledIndices:e})}function ei(n,{startingIndex:e=-1,decrement:t=!1,disabledIndices:i,amount:r=1}={}){let o=e;do o+=t?-r:r;while(o>=0&&o<=n.current.length-1&&$u(n,o,i));return o}function JB(n,{event:e,orientation:t,loopFocus:i,rtl:r,cols:o,disabledIndices:a,minIndex:u,maxIndex:f,prevIndex:d,stopEvent:p=!1}){let g=d;const b=[],v={};let S=!1;{let k=null,R=-1;n.current.forEach((N,T)=>{if(N==null)return;const B=N.closest('[role="row"]');B&&(S=!0),(B!==k||R===-1)&&(k=B,R+=1,b[R]=[]),b[R].push(T),v[T]=R})}const w=S&&b.length>0&&b.some(k=>k.length!==o);function E(k){if(!w||d===-1)return;const R=v[d];if(R==null)return;const N=b[R].indexOf(d);let T=k==="up"?R-1:R+1;i&&(T<0?T=b.length-1:T>=b.length&&(T=0));const B=new Set;for(;T>=0&&T<b.length&&!B.has(T);){B.add(T);const L=b[T];if(L.length===0){T=k==="up"?T-1:T+1;continue}const D=Math.min(N,L.length-1);for(let j=D;j>=0;j-=1){const X=L[j];if(!$u(n,X,a))return X}T=k==="up"?T-1:T+1,i&&(T<0?T=b.length-1:T>=b.length&&(T=0))}}if(e.key===Jb){const k=E("up");if(k!==void 0)p&&bn(e),g=k;else{if(p&&bn(e),d===-1)g=f;else if(g=ei(n,{startingIndex:g,amount:o,decrement:!0,disabledIndices:a}),i&&(d-o<u||g<0)){const R=d%o,N=f%o,T=f-(N-R);N===R?g=f:g=N>R?T:T-o}Xu(n,g)&&(g=d)}}if(e.key===Bf){const k=E("down");k!==void 0?(p&&bn(e),g=k):(p&&bn(e),d===-1?g=u:(g=ei(n,{startingIndex:d,amount:o,disabledIndices:a}),i&&d+o>f&&(g=ei(n,{startingIndex:d%o-o,amount:o,disabledIndices:a}))),Xu(n,g)&&(g=d))}if(t==="both"){const k=Za(d/o);e.key===(r?Xl:$l)&&(p&&bn(e),d%o!==o-1?(g=ei(n,{startingIndex:d,disabledIndices:a}),i&&ad(g,o,k)&&(g=ei(n,{startingIndex:d-d%o-1,disabledIndices:a}))):i&&(g=ei(n,{startingIndex:d-d%o-1,disabledIndices:a})),ad(g,o,k)&&(g=d)),e.key===(r?$l:Xl)&&(p&&bn(e),d%o!==0?(g=ei(n,{startingIndex:d,decrement:!0,disabledIndices:a}),i&&ad(g,o,k)&&(g=ei(n,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:a}))):i&&(g=ei(n,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:a})),ad(g,o,k)&&(g=d));const R=Za(f/o)===k;Xu(n,g)&&(i&&R?g=e.key===(r?$l:Xl)?f:ei(n,{startingIndex:d-d%o-1,disabledIndices:a}):g=d)}return g}function e4(n,e,t){const i=[];let r=0;return n.forEach(({width:o,height:a},u)=>{let f=!1;for(t&&(r=0);!f;){const d=[];for(let p=0;p<o;p+=1)for(let g=0;g<a;g+=1)d.push(r+p+g*e);r%e+o<=e&&d.every(p=>i[p]==null)?(d.forEach(p=>{i[p]=u}),f=!0):r+=1}}),[...i]}function t4(n,e,t,i,r){if(n===-1)return-1;const o=t.indexOf(n),a=e[n];switch(r){case"tl":return o;case"tr":return a?o+a.width-1:o;case"bl":return a?o+(a.height-1)*i:o;case"br":return t.lastIndexOf(n);default:return-1}}function n4(n,e){return e.flatMap((t,i)=>n.includes(t)?[i]:[])}function $u(n,e,t){if(typeof t=="function")return t(e);if(t)return t.includes(e);const i=n.current[e];return i?i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true":!1}/*!
|
|
177
|
+
`})]})}function Oj({children:n}){const[e,t]=A.useReducer(Aj,{toasts:[]}),i=A.useCallback((o,a,u)=>{const f=`${Date.now()}-${Math.random()}`;t({type:"add",toast:{id:f,kind:o,message:a,detail:u}})},[]),r=A.useCallback(o=>{t({type:"remove",id:o})},[]);return x.jsxs(CE.Provider,{value:{add:i},children:[n,x.jsx("div",{"aria-live":"polite","aria-atomic":"false",className:"fixed bottom-6 right-6 z-[9999] flex flex-col gap-2",children:e.toasts.map(o=>x.jsx(Tj,{toast:o,onRemove:r},o.id))})]})}const kE="xtandard-webhooks:theme";function R0(){try{const n=localStorage.getItem(kE);if(n==="light"||n==="dark"||n==="system")return n}catch{}return"system"}function Mj(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}function Nj(n){return n==="system"?Mj()?"dark":"light":n}function T0(n){typeof document<"u"&&(document.documentElement.dataset.theme=Nj(n))}function Dj(n){try{localStorage.setItem(kE,n)}catch{}T0(n)}function jj(){T0(R0()),typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{R0()==="system"&&T0("system")})}const Bj=[{value:"system",label:"System theme",Icon:QD},{value:"light",label:"Light theme",Icon:i3},{value:"dark",label:"Dark theme",Icon:YD}];function Lj(){const[n,e]=A.useState(()=>R0()),t=i=>{e(i),Dj(i)};return x.jsx("div",{role:"group","aria-label":"Theme",className:"inline-flex gap-0.5 rounded-md border border-border bg-secondary/50 p-0.5",children:Bj.map(({value:i,label:r,Icon:o})=>{const a=n===i;return x.jsx("button",{type:"button",title:r,"aria-label":r,"aria-pressed":a,onClick:()=>t(i),className:jt("inline-flex h-6 w-7 items-center justify-center rounded-[5px] outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring",a?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:x.jsx(o,{className:"size-3.5"})},i)})})}function Xn(n){if(!n)return"—";const e=new Date(n);return Number.isNaN(e.getTime())?"—":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(e)}function Of(n,e=Date.now()){if(!n)return"—";const t=Date.parse(n);if(Number.isNaN(t))return"—";const i=e-t,r=Math.abs(i);if(r<1e4)return"just now";const o=[[1e3,"s"],[6e4,"m"],[36e5,"h"],[864e5,"d"]];let a=Math.round(r/1e3),u="s";for(const[f,d]of o)r>=f&&(a=Math.round(r/f),u=d);return i>=0?`${a}${u} ago`:`in ${a}${u}`}function zj(n){return n==null||!Number.isFinite(n)||n<0?"—":n<1e3?`${Math.round(n)} ms`:`${(n/1e3).toFixed(2).replace(/\.?0+$/,"")} s`}function Ij(n){switch(n){case"pending":return"Pending";case"delivering":return"Delivering";case"succeeded":return"Succeeded";case"failed":return"Dead-letter"}}function Pj(n){switch(n){case"succeeded":return"border-success/30 bg-success/10 text-success";case"failed":return"border-destructive/30 bg-destructive/10 text-destructive";case"delivering":return"border-chart-2/30 bg-chart-2/10 text-chart-2";case"pending":return"border-warning/30 bg-warning/10 text-warning"}}function Hj(n){const e=new Map;for(const t of[...n].sort((i,r)=>i.name.localeCompare(r.name))){const i=t.groupName??"",r=e.get(i)??[];r.push(t),e.set(i,r)}return[...e.entries()].sort(([t],[i])=>t===""?1:i===""?-1:t.localeCompare(i)).map(([t,i])=>({group:t||"Ungrouped",types:i}))}function Vj(n,e){const t=n+e;return t===0?null:Math.round(n/t*100)}function _j(n,e,t=Date.now()){if(!n)return!1;const i=Date.parse(n);return Number.isNaN(i)?!1:i<=t&&t-i<=e}function ri(n,...e){const t=new URL(`https://base-ui.com/production-error/${n}`);return e.forEach(i=>t.searchParams.append("args[]",i)),`Base UI error #${n}; visit ${t} for the full message.`}const AE=A.createContext(void 0);function Mf(n){const e=A.useContext(AE);if(n===!1&&e===void 0)throw new Error(ri(27));return e}const cC={};function Bi(n,e){const t=A.useRef(cC);return t.current===cC&&(t.current=n(e)),t}function Zl(n,e,t,i){const r=Bi(EE).current;return qj(r,n,e,t,i)&&RE(r,[n,e,t,i]),r.callback}function Uj(n){const e=Bi(EE).current;return Fj(e,n)&&RE(e,n),e.callback}function EE(){return{callback:null,cleanup:null,refs:[]}}function qj(n,e,t,i,r){return n.refs[0]!==e||n.refs[1]!==t||n.refs[2]!==i||n.refs[3]!==r}function Fj(n,e){return n.refs.length!==e.length||n.refs.some((t,i)=>t!==e[i])}function RE(n,e){if(n.refs=e,e.every(t=>t==null)){n.callback=null;return}n.callback=t=>{if(n.cleanup&&(n.cleanup(),n.cleanup=null),t!=null){const i=Array(e.length).fill(null);for(let r=0;r<e.length;r+=1){const o=e[r];if(o!=null)switch(typeof o){case"function":{const a=o(t);typeof a=="function"&&(i[r]=a);break}case"object":{o.current=t;break}}}n.cleanup=()=>{for(let r=0;r<e.length;r+=1){const o=e[r];if(o!=null)switch(typeof o){case"function":{const a=i[r];typeof a=="function"?a():o(null);break}case"object":{o.current=null;break}}}}}}}const Gj=parseInt(A.version,10);function Yb(n){return Gj>=n}function uC(n){if(!A.isValidElement(n))return null;const e=n,t=e.props;return(Yb(19)?t==null?void 0:t.ref:e.ref)??null}function O0(n,e){if(n&&!e)return n;if(!n&&e)return e;if(n||e)return{...n,...e}}function Qj(n,e){const t={};for(const i in n){const r=n[i];if(e!=null&&e.hasOwnProperty(i)){const o=e[i](r);o!=null&&Object.assign(t,o);continue}r===!0?t[`data-${i.toLowerCase()}`]="":r&&(t[`data-${i.toLowerCase()}`]=r.toString())}return t}function Kj(n,e){return typeof n=="function"?n(e):n}function Yj(n,e){return typeof n=="function"?n(e):n}const Yu={};function jp(n,e,t,i,r){let o={...M0(n,Yu)};return e&&(o=Gu(o,e)),t&&(o=Gu(o,t)),i&&(o=Gu(o,i)),r&&(o=Gu(o,r)),o}function Wj(n){if(n.length===0)return Yu;if(n.length===1)return M0(n[0],Yu);let e={...M0(n[0],Yu)};for(let t=1;t<n.length;t+=1)e=Gu(e,n[t]);return e}function Gu(n,e){return TE(e)?e(n):Xj(n,e)}function Xj(n,e){if(!e)return n;for(const t in e){const i=e[t];switch(t){case"style":{n[t]=O0(n.style,i);break}case"className":{n[t]=OE(n.className,i);break}default:$j(t,i)?n[t]=Zj(n[t],i):n[t]=i}}return n}function $j(n,e){const t=n.charCodeAt(0),i=n.charCodeAt(1),r=n.charCodeAt(2);return t===111&&i===110&&r>=65&&r<=90&&(typeof e=="function"||typeof e>"u")}function TE(n){return typeof n=="function"}function M0(n,e){return TE(n)?n(e):n??Yu}function Zj(n,e){return e?n?t=>{if(Jj(t)){const r=t;N0(r);const o=e(r);return r.baseUIHandlerPrevented||n==null||n(r),o}const i=e(t);return n==null||n(t),i}:e:n}function N0(n){return n.preventBaseUIHandler=()=>{n.baseUIHandlerPrevented=!0},n}function OE(n,e){return e?n?e+" "+n:e:n}function Jj(n){return n!=null&&typeof n=="object"&&"nativeEvent"in n}function un(){}const Dl=Object.freeze([]),_n=Object.freeze({}),eB={style:{transition:"none"}},tB="data-base-ui-click-trigger",ME={fallbackAxisSide:"none"},nB={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function wn(n,e,t={}){const i=e.render,r=iB(e,t);if(t.enabled===!1)return null;const o=t.state??_n;return sB(n,i,r,o)}function iB(n,e={}){const{className:t,style:i,render:r}=n,{state:o=_n,ref:a,props:u,stateAttributesMapping:f,enabled:d=!0}=e,p=d?Kj(t,o):void 0,g=d?Yj(i,o):void 0,b=d?Qj(o,f):_n,v=d?O0(b,Array.isArray(u)?Wj(u):u)??_n:_n;return typeof document<"u"&&(d?Array.isArray(a)?v.ref=Uj([v.ref,uC(r),...a]):v.ref=Zl(v.ref,uC(r),a):Zl(null,null)),d?(p!==void 0&&(v.className=OE(v.className,p)),g!==void 0&&(v.style=O0(v.style,g)),v):_n}function sB(n,e,t,i){if(e){if(typeof e=="function")return e(t,i);const r=jp(t,e.props);return r.ref=t.ref,A.cloneElement(e,r)}if(n&&typeof n=="string")return rB(n,t);throw new Error(ri(8))}function rB(n,e){return n==="button"?A.createElement("button",{type:"button",...e,key:e.key}):n==="img"?A.createElement("img",{alt:"",...e,key:e.key}):A.createElement(n,e)}let $d=(function(n){return n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n})({});const lB={[$d.startingStyle]:""},oB={[$d.endingStyle]:""},Nf={transitionStatus(n){return n==="starting"?lB:n==="ending"?oB:null}};let Ho=(function(n){return n.open="data-open",n.closed="data-closed",n[n.startingStyle=$d.startingStyle]="startingStyle",n[n.endingStyle=$d.endingStyle]="endingStyle",n.anchorHidden="data-anchor-hidden",n})({}),D0=(function(n){return n.popupOpen="data-popup-open",n.pressed="data-pressed",n})({});const aB={[D0.popupOpen]:""},cB={[D0.popupOpen]:"",[D0.pressed]:""},uB={[Ho.open]:""},fB={[Ho.closed]:""},hB={[Ho.anchorHidden]:""},dB={open(n){return n?aB:null}},Wb={open(n){return n?cB:null}},Pc={open(n){return n?uB:fB},anchorHidden(n){return n?hB:null}},pB={...Pc,...Nf},mB=A.forwardRef(function(e,t){const{render:i,className:r,forceRender:o=!1,...a}=e,{store:u}=Mf(),f=u.useState("open"),d=u.useState("nested"),p=u.useState("mounted"),g=u.useState("transitionStatus"),b=A.useMemo(()=>({open:f,transitionStatus:g}),[f,g]);return wn("div",e,{state:b,ref:[u.context.backdropRef,t],stateAttributesMapping:pB,props:[{role:"presentation",hidden:!p,style:{userSelect:"none",WebkitUserSelect:"none"}},a],enabled:o||!d})});function Bp(){return typeof window<"u"}function ro(n){return Xb(n)?(n.nodeName||"").toLowerCase():"#document"}function In(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function cr(n){var e;return(e=(Xb(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Xb(n){return Bp()?n instanceof Node||n instanceof In(n).Node:!1}function Zt(n){return Bp()?n instanceof Element||n instanceof In(n).Element:!1}function Ln(n){return Bp()?n instanceof HTMLElement||n instanceof In(n).HTMLElement:!1}function j0(n){return!Bp()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof In(n).ShadowRoot}function fa(n){const{overflow:e,overflowX:t,overflowY:i,display:r}=Ji(n);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&r!=="inline"&&r!=="contents"}function gB(n){return/^(table|td|th)$/.test(ro(n))}function Lp(n){try{if(n.matches(":popover-open"))return!0}catch{}try{return n.matches(":modal")}catch{return!1}}const yB=/transform|translate|scale|rotate|perspective|filter/,bB=/paint|layout|strict|content/,Do=n=>!!n&&n!=="none";let Ay;function $b(n){const e=Zt(n)?Ji(n):n;return Do(e.transform)||Do(e.translate)||Do(e.scale)||Do(e.rotate)||Do(e.perspective)||!zp()&&(Do(e.backdropFilter)||Do(e.filter))||yB.test(e.willChange||"")||bB.test(e.contain||"")}function vB(n){let e=Ur(n);for(;Ln(e)&&!Hr(e);){if($b(e))return e;if(Lp(e))return null;e=Ur(e)}return null}function zp(){return Ay==null&&(Ay=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ay}function Hr(n){return/^(html|body|#document)$/.test(ro(n))}function Ji(n){return In(n).getComputedStyle(n)}function Ip(n){return Zt(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ur(n){if(ro(n)==="html")return n;const e=n.assignedSlot||n.parentNode||j0(n)&&n.host||cr(n);return j0(e)?e.host:e}function NE(n){const e=Ur(n);return Hr(e)?n.ownerDocument?n.ownerDocument.body:n.body:Ln(e)&&fa(e)?e:NE(e)}function Wl(n,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=NE(n),o=r===((i=n.ownerDocument)==null?void 0:i.body),a=In(r);if(o){const u=B0(a);return e.concat(a,a.visualViewport||[],fa(r)?r:[],u&&t?Wl(u):[])}else return e.concat(r,Wl(r,[],t))}function B0(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}const Ey=Db[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],xB=Ey&&Ey!==A.useLayoutEffect?Ey:n=>n();function He(n){const e=Bi(SB).current;return e.next=n,xB(e.effect),e.trampoline}function SB(){const n={next:void 0,callback:wB,trampoline:(...e)=>{var t;return(t=n.callback)==null?void 0:t.call(n,...e)},effect:()=>{n.callback=n.next}};return n}function wB(){}const CB=()=>{},ze=typeof document<"u"?A.useLayoutEffect:CB,kB=A.createContext(void 0);function AB(n=!1){const e=A.useContext(kB);if(e===void 0&&!n)throw new Error(ri(16));return e}function EB(n){const{focusableWhenDisabled:e,disabled:t,composite:i=!1,tabIndex:r=0,isNativeButton:o}=n,a=i&&e!==!1,u=i&&e===!1;return{props:A.useMemo(()=>{const d={onKeyDown(p){t&&e&&p.key!=="Tab"&&p.preventDefault()}};return i||(d.tabIndex=r,!o&&t&&(d.tabIndex=e?r:-1)),(o&&(e||a)||!o&&t)&&(d["aria-disabled"]=t),o&&(!e||u)&&(d.disabled=t),d},[i,t,e,a,u,o,r])}}function Df(n={}){const{disabled:e=!1,focusableWhenDisabled:t,tabIndex:i=0,native:r=!0}=n,o=A.useRef(null),a=AB(!0)!==void 0,u=He(()=>{const b=o.current;return!!((b==null?void 0:b.tagName)==="A"&&(b!=null&&b.href))}),{props:f}=EB({focusableWhenDisabled:t,disabled:e,composite:a,tabIndex:i,isNativeButton:r}),d=A.useCallback(()=>{const b=o.current;RB(b)&&a&&e&&f.disabled===void 0&&b.disabled&&(b.disabled=!1)},[e,f.disabled,a]);ze(d,[d]);const p=A.useCallback((b={})=>{const{onClick:v,onMouseDown:S,onKeyUp:w,onKeyDown:E,onPointerDown:k,...R}=b;return jp({type:r?"button":void 0,onClick(T){if(e){T.preventDefault();return}v==null||v(T)},onMouseDown(T){e||S==null||S(T)},onKeyDown(T){if(e||(N0(T),E==null||E(T)),T.baseUIHandlerPrevented)return;const B=T.target===T.currentTarget&&!r&&!u()&&!e,L=T.key==="Enter",D=T.key===" ";B&&((D||L)&&T.preventDefault(),L&&(v==null||v(T)))},onKeyUp(T){e||(N0(T),w==null||w(T)),!T.baseUIHandlerPrevented&&T.target===T.currentTarget&&!r&&!e&&T.key===" "&&(v==null||v(T))},onPointerDown(T){if(e){T.preventDefault();return}k==null||k(T)}},r?void 0:{role:"button"},f,R)},[e,f,r,u]),g=He(b=>{o.current=b,d()});return{getButtonProps:p,buttonRef:g}}function RB(n){return Ln(n)&&n.tagName==="BUTTON"}const Oi="none",Wu="trigger-press",TB="trigger-hover",DE="outside-press",Id="item-press",Vo="input-change",Ol="input-clear",Pp="focus-out",jE="escape-key",Pd="list-navigation",OB="cancel-open",MB="imperative-action",NB="window-resize";function tt(n,e,t,i){let r=!1,o=!1;const a=_n;return{reason:n,event:e??new Event("base-ui"),cancel(){r=!0},allowPropagation(){o=!0},get isCanceled(){return r},get isPropagationAllowed(){return o},trigger:t,...a}}function zu(n,e,t){const i=t??_n;return{reason:n,event:e??new Event("base-ui"),...i}}const DB={...Db};let fC=0;function jB(n,e="mui"){const[t,i]=A.useState(n),r=n||t;return A.useEffect(()=>{t==null&&(fC+=1,i(`${e}-${fC}`))},[t,e]),r}const hC=DB.useId;function jf(n,e){if(hC!==void 0){const t=hC();return n??(e?`${e}-${t}`:t)}return jB(n,e)}function Hp(n){return jf(n,"base-ui")}const BB=[];function BE(n){A.useEffect(n,BB)}const Iu=0;class Ac{constructor(){Kt(this,"currentId",Iu);Kt(this,"clear",()=>{this.currentId!==Iu&&(clearTimeout(this.currentId),this.currentId=Iu)});Kt(this,"disposeEffect",()=>this.clear)}static create(){return new Ac}start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Iu,t()},e)}isStarted(){return this.currentId!==Iu}}function $i(){const n=Bi(Ac.create).current;return BE(n.disposeEffect),n}function Vn(n){const e=Bi(LB,n).current;return e.next=n,ze(e.effect),e}function LB(n){const e={current:n,next:n,effect:()=>{e.current=e.next}};return e}const ha=typeof navigator<"u",Ry=HB(),LE=_B(),Zb=VB(),zE=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),zB=Ry.platform==="MacIntel"&&Ry.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Ry.platform),dC=ha&&/firefox/i.test(Zb),IB=ha&&/apple/i.test(navigator.vendor),Zd=ha&&/android/i.test(LE)||/android/i.test(Zb);ha&&LE.toLowerCase().startsWith("mac")&&navigator.maxTouchPoints;const PB=Zb.includes("jsdom/");function HB(){if(!ha)return{platform:"",maxTouchPoints:-1};const n=navigator.userAgentData;return n!=null&&n.platform?{platform:n.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function VB(){if(!ha)return"";const n=navigator.userAgentData;return n&&Array.isArray(n.brands)?n.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(" "):navigator.userAgent}function _B(){if(!ha)return"";const n=navigator.userAgentData;return n!=null&&n.platform?n.platform:navigator.platform??""}const L0="data-base-ui-focusable",IE="active",PE="selected",UB="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Xl="ArrowLeft",$l="ArrowRight",Jb="ArrowUp",Bf="ArrowDown";function jl(n){var t;let e=n.activeElement;for(;((t=e==null?void 0:e.shadowRoot)==null?void 0:t.activeElement)!=null;)e=e.shadowRoot.activeElement;return e}function Dt(n,e){var i;if(!n||!e)return!1;const t=(i=e.getRootNode)==null?void 0:i.call(e);if(n.contains(e))return!0;if(t&&j0(t)){let r=e;for(;r;){if(n===r)return!0;r=r.parentNode||r.host}}return!1}function ni(n){return"composedPath"in n?n.composedPath()[0]:n.target}function ks(n,e){if(e==null)return!1;if("composedPath"in n)return n.composedPath().includes(e);const t=n;return t.target!=null&&e.contains(t.target)}function qB(n){return n.matches("html,body")}function di(n){return(n==null?void 0:n.ownerDocument)||document}function HE(n){return Ln(n)&&n.matches(UB)}function z0(n){return n?n.getAttribute("role")==="combobox"&&HE(n):!1}function cf(n){return n?n.hasAttribute(L0)?n:n.querySelector(`[${L0}]`)||n:null}function ic(n,e,t=!0){return n.filter(r=>{var o;return r.parentId===e&&(!t||((o=r.context)==null?void 0:o.open))}).flatMap(r=>[r,...ic(n,r.id,t)])}function pC(n,e){var r;let t=[],i=(r=n.find(o=>o.id===e))==null?void 0:r.parentId;for(;i;){const o=n.find(a=>a.id===i);i=o==null?void 0:o.parentId,o&&(t=t.concat(o))}return t}function bn(n){n.preventDefault(),n.stopPropagation()}function FB(n){return"nativeEvent"in n}function VE(n){return n.mozInputSource===0&&n.isTrusted?!0:Zd&&n.pointerType?n.type==="click"&&n.buttons===1:n.detail===0&&!n.pointerType}function _E(n){return PB?!1:!Zd&&n.width===0&&n.height===0||Zd&&n.width===1&&n.height===1&&n.pressure===0&&n.detail===0&&n.pointerType==="mouse"||n.width<1&&n.height<1&&n.pressure===0&&n.detail===0&&n.pointerType==="touch"}function mC(n,e){return["mouse","pen"].includes(n)}function UE(n){const e=n.type;return e==="click"||e==="mousedown"||e==="keydown"||e==="keyup"}const GB=["top","right","bottom","left"],Ec=Math.min,Wi=Math.max,Jd=Math.round,Za=Math.floor,rr=n=>({x:n,y:n}),QB={left:"right",right:"left",bottom:"top",top:"bottom"};function I0(n,e,t){return Wi(n,Ec(e,t))}function qr(n,e){return typeof n=="function"?n(e):n}function Zi(n){return n.split("-")[0]}function lo(n){return n.split("-")[1]}function ev(n){return n==="x"?"y":"x"}function tv(n){return n==="y"?"height":"width"}function hs(n){const e=n[0];return e==="t"||e==="b"?"y":"x"}function nv(n){return ev(hs(n))}function KB(n,e,t){t===void 0&&(t=!1);const i=lo(n),r=nv(n),o=tv(r);let a=r==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=ep(a)),[a,ep(a)]}function YB(n){const e=ep(n);return[P0(n),e,P0(e)]}function P0(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}const gC=["left","right"],yC=["right","left"],WB=["top","bottom"],XB=["bottom","top"];function $B(n,e,t){switch(n){case"top":case"bottom":return t?e?yC:gC:e?gC:yC;case"left":case"right":return e?WB:XB;default:return[]}}function ZB(n,e,t,i){const r=lo(n);let o=$B(Zi(n),t==="start",i);return r&&(o=o.map(a=>a+"-"+r),e&&(o=o.concat(o.map(P0)))),o}function ep(n){const e=Zi(n);return QB[e]+n.slice(e.length)}function JB(n){return{top:0,right:0,bottom:0,left:0,...n}}function qE(n){return typeof n!="number"?JB(n):{top:n,right:n,bottom:n,left:n}}function tp(n){const{x:e,y:t,width:i,height:r}=n;return{width:i,height:r,top:t,left:e,right:e+i,bottom:t+r,x:e,y:t}}function ad(n,e,t){return Math.floor(n/e)!==t}function Xu(n,e){return e<0||e>=n.current.length}function Ty(n,e){return ei(n,{disabledIndices:e})}function bC(n,e){return ei(n,{decrement:!0,startingIndex:n.current.length,disabledIndices:e})}function ei(n,{startingIndex:e=-1,decrement:t=!1,disabledIndices:i,amount:r=1}={}){let o=e;do o+=t?-r:r;while(o>=0&&o<=n.current.length-1&&$u(n,o,i));return o}function e4(n,{event:e,orientation:t,loopFocus:i,rtl:r,cols:o,disabledIndices:a,minIndex:u,maxIndex:f,prevIndex:d,stopEvent:p=!1}){let g=d;const b=[],v={};let S=!1;{let k=null,R=-1;n.current.forEach((N,T)=>{if(N==null)return;const B=N.closest('[role="row"]');B&&(S=!0),(B!==k||R===-1)&&(k=B,R+=1,b[R]=[]),b[R].push(T),v[T]=R})}const w=S&&b.length>0&&b.some(k=>k.length!==o);function E(k){if(!w||d===-1)return;const R=v[d];if(R==null)return;const N=b[R].indexOf(d);let T=k==="up"?R-1:R+1;i&&(T<0?T=b.length-1:T>=b.length&&(T=0));const B=new Set;for(;T>=0&&T<b.length&&!B.has(T);){B.add(T);const L=b[T];if(L.length===0){T=k==="up"?T-1:T+1;continue}const D=Math.min(N,L.length-1);for(let j=D;j>=0;j-=1){const X=L[j];if(!$u(n,X,a))return X}T=k==="up"?T-1:T+1,i&&(T<0?T=b.length-1:T>=b.length&&(T=0))}}if(e.key===Jb){const k=E("up");if(k!==void 0)p&&bn(e),g=k;else{if(p&&bn(e),d===-1)g=f;else if(g=ei(n,{startingIndex:g,amount:o,decrement:!0,disabledIndices:a}),i&&(d-o<u||g<0)){const R=d%o,N=f%o,T=f-(N-R);N===R?g=f:g=N>R?T:T-o}Xu(n,g)&&(g=d)}}if(e.key===Bf){const k=E("down");k!==void 0?(p&&bn(e),g=k):(p&&bn(e),d===-1?g=u:(g=ei(n,{startingIndex:d,amount:o,disabledIndices:a}),i&&d+o>f&&(g=ei(n,{startingIndex:d%o-o,amount:o,disabledIndices:a}))),Xu(n,g)&&(g=d))}if(t==="both"){const k=Za(d/o);e.key===(r?Xl:$l)&&(p&&bn(e),d%o!==o-1?(g=ei(n,{startingIndex:d,disabledIndices:a}),i&&ad(g,o,k)&&(g=ei(n,{startingIndex:d-d%o-1,disabledIndices:a}))):i&&(g=ei(n,{startingIndex:d-d%o-1,disabledIndices:a})),ad(g,o,k)&&(g=d)),e.key===(r?$l:Xl)&&(p&&bn(e),d%o!==0?(g=ei(n,{startingIndex:d,decrement:!0,disabledIndices:a}),i&&ad(g,o,k)&&(g=ei(n,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:a}))):i&&(g=ei(n,{startingIndex:d+(o-d%o),decrement:!0,disabledIndices:a})),ad(g,o,k)&&(g=d));const R=Za(f/o)===k;Xu(n,g)&&(i&&R?g=e.key===(r?$l:Xl)?f:ei(n,{startingIndex:d-d%o-1,disabledIndices:a}):g=d)}return g}function t4(n,e,t){const i=[];let r=0;return n.forEach(({width:o,height:a},u)=>{let f=!1;for(t&&(r=0);!f;){const d=[];for(let p=0;p<o;p+=1)for(let g=0;g<a;g+=1)d.push(r+p+g*e);r%e+o<=e&&d.every(p=>i[p]==null)?(d.forEach(p=>{i[p]=u}),f=!0):r+=1}}),[...i]}function n4(n,e,t,i,r){if(n===-1)return-1;const o=t.indexOf(n),a=e[n];switch(r){case"tl":return o;case"tr":return a?o+a.width-1:o;case"bl":return a?o+(a.height-1)*i:o;case"br":return t.lastIndexOf(n);default:return-1}}function i4(n,e){return e.flatMap((t,i)=>n.includes(t)?[i]:[])}function $u(n,e,t){if(typeof t=="function")return t(e);if(t)return t.includes(e);const i=n.current[e];return i?i.hasAttribute("disabled")||i.getAttribute("aria-disabled")==="true":!1}/*!
|
|
178
178
|
* tabbable 6.5.0
|
|
179
179
|
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
180
|
-
*/var i4=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],np=i4.join(","),qE=typeof Element>"u",Rc=qE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ip=!qE&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n==null?void 0:n.ownerDocument},sp=function(e,t){var i;t===void 0&&(t=!0);var r=e==null||(i=e.getAttribute)===null||i===void 0?void 0:i.call(e,"inert"),o=r===""||r==="true",a=o||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):sp(e.parentNode));return a},s4=function(e){var t,i=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return i===""||i==="true"},FE=function(e,t,i){if(sp(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(np));return t&&Rc.call(e,np)&&r.unshift(e),r=r.filter(i),r},rp=function(e,t,i){for(var r=[],o=Array.from(e);o.length;){var a=o.shift();if(!sp(a,!1))if(a.tagName==="SLOT"){var u=a.assignedElements(),f=u.length?u:a.children,d=rp(f,!0,i);i.flatten?r.push.apply(r,d):r.push({scopeParent:a,candidates:d})}else{var p=Rc.call(a,np);p&&i.filter(a)&&(t||!e.includes(a))&&r.push(a);var g=a.shadowRoot||typeof i.getShadowRoot=="function"&&i.getShadowRoot(a),b=!sp(g,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(a));if(g&&b){var v=rp(g===!0?a.children:g.children,!0,i);i.flatten?r.push.apply(r,v):r.push({scopeParent:a,candidates:v})}else o.unshift.apply(o,a.children)}}return r},GE=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},QE=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||s4(e))&&!GE(e)?0:e.tabIndex},r4=function(e,t){var i=QE(e);return i<0&&t&&!GE(e)?0:i},l4=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},KE=function(e){return e.tagName==="INPUT"},o4=function(e){return KE(e)&&e.type==="hidden"},a4=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(i){return i.tagName==="SUMMARY"});return t},c4=function(e,t){for(var i=0;i<e.length;i++)if(e[i].checked&&e[i].form===t)return e[i]},u4=function(e){if(!e.name)return!0;var t=e.form||ip(e),i=function(u){return t.querySelectorAll('input[type="radio"][name="'+u+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=i(window.CSS.escape(e.name));else try{r=i(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var o=c4(r,e.form);return!o||o===e},f4=function(e){return KE(e)&&e.type==="radio"},h4=function(e){return f4(e)&&!u4(e)},d4=function(e){var t,i=e&&ip(e),r=(t=i)===null||t===void 0?void 0:t.host,o=!1;if(i&&i!==e){var a,u,f;for(o=!!((a=r)!==null&&a!==void 0&&(u=a.ownerDocument)!==null&&u!==void 0&&u.contains(r)||e!=null&&(f=e.ownerDocument)!==null&&f!==void 0&&f.contains(e));!o&&r;){var d,p,g;i=ip(r),r=(d=i)===null||d===void 0?void 0:d.host,o=!!((p=r)!==null&&p!==void 0&&(g=p.ownerDocument)!==null&&g!==void 0&&g.contains(r))}}return o},bC=function(e){var t=e.getBoundingClientRect(),i=t.width,r=t.height;return i===0&&r===0},p4=function(e,t){var i=t.displayCheck,r=t.getShadowRoot;if(i==="full-native"&&"checkVisibility"in e){var o=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}var a=getComputedStyle(e),u=a.visibility;if(u==="hidden"||u==="collapse")return!0;var f=Rc.call(e,"details>summary:first-of-type"),d=f?e.parentElement:e;if(Rc.call(d,"details:not([open]) *"))return!0;if(!i||i==="full"||i==="full-native"||i==="legacy-full"){if(typeof r=="function"){for(var p=e;e;){var g=e.parentElement,b=ip(e);if(g&&!g.shadowRoot&&r(g)===!0)return bC(e);e.assignedSlot?e=e.assignedSlot:!g&&b!==e.ownerDocument?e=b.host:e=g}e=p}if(d4(e))return!e.getClientRects().length;if(i!=="legacy-full")return!0}else if(i==="non-zero-area")return bC(e);return!1},m4=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var i=0;i<t.children.length;i++){var r=t.children.item(i);if(r.tagName==="LEGEND")return Rc.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},H0=function(e,t){return!(t.disabled||o4(t)||p4(t,e)||a4(t)||m4(t))},V0=function(e,t){return!(h4(t)||QE(t)<0||!H0(e,t))},g4=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},YE=function(e){var t=[],i=[];return e.forEach(function(r,o){var a=!!r.scopeParent,u=a?r.scopeParent:r,f=r4(u,a),d=a?YE(r.candidates):u;f===0?a?t.push.apply(t,d):t.push(u):i.push({documentOrder:o,tabIndex:f,item:r,isScope:a,content:d})}),i.sort(l4).reduce(function(r,o){return o.isScope?r.push.apply(r,o.content):r.push(o.content),r},[]).concat(t)},Vp=function(e,t){t=t||{};var i;return t.getShadowRoot?i=rp([e],t.includeContainer,{filter:V0.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:g4}):i=FE(e,t.includeContainer,V0.bind(null,t)),YE(i)},y4=function(e,t){t=t||{};var i;return t.getShadowRoot?i=rp([e],t.includeContainer,{filter:H0.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):i=FE(e,t.includeContainer,H0.bind(null,t)),i},WE=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Rc.call(e,np)===!1?!1:V0(t,e)};const Lf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function XE(n,e){const t=Vp(n,Lf()),i=t.length;if(i===0)return;const r=jl(di(n)),o=t.indexOf(r),a=o===-1?e===1?0:i-1:o+e;return t[a]}function $E(n){return XE(di(n).body,1)||n}function ZE(n){return XE(di(n).body,-1)||n}function Zu(n,e){const t=e||n.currentTarget,i=n.relatedTarget;return!i||!Dt(t,i)}function b4(n){Vp(n,Lf()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function vC(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const i=t.dataset.tabindex;delete t.dataset.tabindex,i?t.setAttribute("tabindex",i):t.removeAttribute("tabindex")})}function v4(){const n=new Map;return{emit(e,t){var i;(i=n.get(e))==null||i.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var i;(i=n.get(e))==null||i.delete(t)}}}const x4=A.createContext(null),S4=A.createContext(null),_p=()=>{var n;return((n=A.useContext(x4))==null?void 0:n.id)||null},Up=n=>{const e=A.useContext(S4);return n??e};function lp(n){return`data-base-ui-${n}`}const zf={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},cd=null;class w4{constructor(){Kt(this,"callbacks",[]);Kt(this,"callbacksCount",0);Kt(this,"nextId",1);Kt(this,"startId",1);Kt(this,"isScheduled",!1);Kt(this,"tick",e=>{var r;this.isScheduled=!1;const t=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let o=0;o<t.length;o+=1)(r=t[o])==null||r.call(t,e)})}request(e){const t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(e){const t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}}const ud=new w4;class Zs{constructor(){Kt(this,"currentId",cd);Kt(this,"cancel",()=>{this.currentId!==cd&&(ud.cancel(this.currentId),this.currentId=cd)});Kt(this,"disposeEffect",()=>this.cancel)}static create(){return new Zs}static request(e){return ud.request(e)}static cancel(e){return ud.cancel(e)}request(e){this.cancel(),this.currentId=ud.request(()=>{this.currentId=cd,e()})}}function qp(){const n=Bi(Zs.create).current;return jE(n.disposeEffect),n}function Fr(n){return(n==null?void 0:n.ownerDocument)||document}const op=A.forwardRef(function(e,t){const[i,r]=A.useState();ze(()=>{zB&&r("button")},[]);const o={tabIndex:0,role:i};return x.jsx("span",{...e,ref:t,style:zf,"aria-hidden":i?void 0:!0,...o,"data-base-ui-focus-guard":""})});let xC=0;function Hd(n,e={}){const{preventScroll:t=!1,cancelPrevious:i=!0,sync:r=!1}=e;i&&cancelAnimationFrame(xC);const o=()=>n==null?void 0:n.focus({preventScroll:t});r?o():xC=requestAnimationFrame(o)}const sc={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function SC(n){return n==="inert"?sc.inert:n==="aria-hidden"?sc["aria-hidden"]:sc.none}let fd=new WeakSet,hd={},Oy=0;const JE=n=>n&&(n.host||JE(n.parentNode)),C4=(n,e)=>e.map(t=>{if(n.contains(t))return t;const i=JE(t);return n.contains(i)?i:null}).filter(t=>t!=null);function k4(n,e,t,i){const r="data-base-ui-inert",o=i?"inert":t?"aria-hidden":null,a=C4(e,n),u=new Set,f=new Set(a),d=[];hd[r]||(hd[r]=new WeakMap);const p=hd[r];a.forEach(g),b(e),u.clear();function g(v){!v||u.has(v)||(u.add(v),v.parentNode&&g(v.parentNode))}function b(v){!v||f.has(v)||[].forEach.call(v.children,S=>{if(ro(S)!=="script")if(u.has(S))b(S);else{const w=o?S.getAttribute(o):null,E=w!==null&&w!=="false",k=SC(o),R=(k.get(S)||0)+1,N=(p.get(S)||0)+1;k.set(S,R),p.set(S,N),d.push(S),R===1&&E&&fd.add(S),N===1&&S.setAttribute(r,""),!E&&o&&S.setAttribute(o,o==="inert"?"":"true")}})}return Oy+=1,()=>{d.forEach(v=>{const S=SC(o),E=(S.get(v)||0)-1,k=(p.get(v)||0)-1;S.set(v,E),p.set(v,k),E||(!fd.has(v)&&o&&v.removeAttribute(o),fd.delete(v)),k||v.removeAttribute(r)}),Oy-=1,Oy||(sc.inert=new WeakMap,sc["aria-hidden"]=new WeakMap,sc.none=new WeakMap,fd=new WeakSet,hd={})}}function A4(n,e=!1,t=!1){const i=di(n[0]).body;return k4(n.concat(Array.from(i.querySelectorAll("[aria-live]"))),i,e,t)}var Gr=RA();const e2=A.createContext(null),t2=()=>A.useContext(e2),E4=lp("portal");function R4(n={}){const{ref:e,container:t,componentProps:i=_n,elementProps:r,elementState:o}=n,a=jf(),u=t2(),f=u==null?void 0:u.portalNode,[d,p]=A.useState(null),[g,b]=A.useState(null),v=A.useRef(null);ze(()=>{if(t===null){v.current&&(v.current=null,b(null),p(null));return}if(a==null)return;const E=(t&&(Xb(t)?t:t.current))??f??document.body;if(E==null){v.current&&(v.current=null,b(null),p(null));return}v.current!==E&&(v.current=E,b(null),p(E))},[t,f,a]);const S=wn("div",i,{ref:[e,b],state:o,props:[{id:a,[E4]:""},r]});return{portalNode:g,portalSubtree:d&&S?Gr.createPortal(S,d):null}}const iv=A.forwardRef(function(e,t){const{children:i,container:r,className:o,render:a,renderGuards:u,...f}=e,{portalNode:d,portalSubtree:p}=R4({container:r,ref:t,componentProps:e,elementProps:f}),g=A.useRef(null),b=A.useRef(null),v=A.useRef(null),S=A.useRef(null),[w,E]=A.useState(null),k=w==null?void 0:w.modal,R=w==null?void 0:w.open,N=typeof u=="boolean"?u:!!w&&!w.modal&&w.open&&!!d;A.useEffect(()=>{if(!d||k)return;function B(L){d&&Zu(L)&&(L.type==="focusin"?vC:b4)(d)}return d.addEventListener("focusin",B,!0),d.addEventListener("focusout",B,!0),()=>{d.removeEventListener("focusin",B,!0),d.removeEventListener("focusout",B,!0)}},[d,k]),A.useEffect(()=>{!d||R||vC(d)},[R,d]);const T=A.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:b,beforeInsideRef:v,afterInsideRef:S,portalNode:d,setFocusManagerState:E}),[d]);return x.jsxs(A.Fragment,{children:[p,x.jsxs(e2.Provider,{value:T,children:[N&&d&&x.jsx(op,{"data-type":"outside",ref:g,onFocus:B=>{var L;if(Zu(B,d))(L=v.current)==null||L.focus();else{const D=w?w.domReference:null,j=ZE(D);j==null||j.focus()}}}),N&&d&&x.jsx("span",{"aria-owns":d.id,style:tB}),d&&Gr.createPortal(i,d),N&&d&&x.jsx(op,{"data-type":"outside",ref:b,onFocus:B=>{var L;if(Zu(B,d))(L=S.current)==null||L.focus();else{const D=w?w.domReference:null,j=$E(D);j==null||j.focus(),w!=null&&w.closeOnFocusOut&&(w==null||w.onOpenChange(!1,tt(Pp,B.nativeEvent)))}}})]})]})});function Lo(n){return n==null?n:"current"in n?n.current:n}function T4(n,e){const t=In(n.target);return n instanceof t.KeyboardEvent?"keyboard":n instanceof t.FocusEvent?e||"keyboard":"pointerType"in n?n.pointerType||"keyboard":"touches"in n?"touch":n instanceof t.MouseEvent?e||(n.detail===0?"keyboard":"mouse"):""}const wC=20;let Gl=[];function sv(){Gl=Gl.filter(n=>n.isConnected)}function O4(n){sv(),n&&ro(n)!=="body"&&(Gl.push(n),Gl.length>wC&&(Gl=Gl.slice(-wC)))}function My(){return sv(),Gl[Gl.length-1]}function M4(n){if(!n)return null;const e=Lf();return WE(n,e)?n:Vp(n,e)[0]||n}function N4(n){return!n||!n.isConnected?!1:typeof n.checkVisibility=="function"?n.checkVisibility():Ji(n).display!=="none"}function CC(n,e){var a;if(!e.current.includes("floating")&&!((a=n.getAttribute("role"))!=null&&a.includes("dialog")))return;const t=Lf(),r=y4(n,t).filter(u=>{const f=u.getAttribute("data-tabindex")||"";return WE(u,t)||u.hasAttribute("data-tabindex")&&!f.startsWith("-")}),o=n.getAttribute("tabindex");e.current.includes("floating")||r.length===0?o!=="0"&&n.setAttribute("tabindex","0"):(o!=="-1"||n.hasAttribute("data-tabindex")&&n.getAttribute("data-tabindex")!=="-1")&&(n.setAttribute("tabindex","-1"),n.setAttribute("data-tabindex","-1"))}function rv(n){const{context:e,children:t,disabled:i=!1,order:r=["content"],initialFocus:o=!0,returnFocus:a=!0,restoreFocus:u=!1,modal:f=!0,closeOnFocusOut:d=!0,openInteractionType:p="",getInsideElements:g=()=>[],nextFocusableElement:b,previousFocusableElement:v,beforeContentFocusGuardRef:S,externalTree:w}=n,E="rootStore"in e?e.rootStore:e,k=E.useState("open"),R=E.useState("domReferenceElement"),N=E.useState("floatingElement"),{events:T,dataRef:B}=E.context,L=He(()=>{var me;return(me=B.current.floatingContext)==null?void 0:me.nodeId}),D=He(g),j=o===!1,X=z0(R)&&j,J=Vn(r),V=Vn(o),K=Vn(a),ae=Vn(p),$=Up(w),H=t2(),z=A.useRef(null),Q=A.useRef(null),F=A.useRef(!1),ee=A.useRef(!1),G=A.useRef(!1),M=A.useRef(-1),U=A.useRef(""),te=A.useRef(""),le=$i(),ne=$i(),se=qp(),he=H!=null,pe=cf(N),xe=He((me=pe)=>me?Vp(me,Lf()):[]),fe=He(me=>{const ke=xe(me);return J.current.map(()=>ke).filter(Boolean).flat()});A.useEffect(()=>{if(i||!f)return;function me(be){be.key==="Tab"&&Dt(pe,jl(di(pe)))&&xe().length===0&&!X&&bn(be)}const ke=di(pe);return ke.addEventListener("keydown",me),()=>{ke.removeEventListener("keydown",me)}},[i,R,pe,f,J,X,xe,fe]),A.useEffect(()=>{if(i||!N)return;function me(ke){const be=ni(ke),qe=xe().indexOf(be);qe!==-1&&(M.current=qe)}return N.addEventListener("focusin",me),()=>{N.removeEventListener("focusin",me)}},[i,N,xe]),A.useEffect(()=>{if(i||!k)return;const me=di(pe);function ke(){G.current=!1}function be(qe){const je=ni(qe),Te=Dt(N,je)||Dt(R,je)||Dt(H==null?void 0:H.portalNode,je);G.current=!Te,te.current=qe.pointerType||"keyboard"}function De(){te.current="keyboard"}return me.addEventListener("pointerdown",be,!0),me.addEventListener("pointerup",ke,!0),me.addEventListener("pointercancel",ke,!0),me.addEventListener("keydown",De,!0),()=>{me.removeEventListener("pointerdown",be,!0),me.removeEventListener("pointerup",ke,!0),me.removeEventListener("pointercancel",ke,!0),me.removeEventListener("keydown",De,!0)}},[i,N,R,pe,k,H]),A.useEffect(()=>{if(i||!d)return;function me(){ee.current=!0,ne.start(0,()=>{ee.current=!1})}function ke(je){const Te=je.relatedTarget,we=je.currentTarget,Ae=ni(je);queueMicrotask(()=>{const Ce=L(),Ze=E.context.triggerElements,nt=!(Dt(R,Te)||Dt(N,Te)||Dt(Te,N)||Dt(H==null?void 0:H.portalNode,Te)||Te!=null&&Ze.hasElement(Te)||Ze.hasMatchingElement(_e=>Dt(_e,Te))||Te!=null&&Te.hasAttribute(lp("focus-guard"))||$&&(ic($.nodesRef.current,Ce).find(_e=>{var rt,at;return Dt((rt=_e.context)==null?void 0:rt.elements.floating,Te)||Dt((at=_e.context)==null?void 0:at.elements.domReference,Te)})||dC($.nodesRef.current,Ce).find(_e=>{var rt,at,Lt;return[(rt=_e.context)==null?void 0:rt.elements.floating,cf((at=_e.context)==null?void 0:at.elements.floating)].includes(Te)||((Lt=_e.context)==null?void 0:Lt.elements.domReference)===Te})));if(we===R&&pe&&CC(pe,J),u&&we!==R&&!N4(Ae)&&jl(di(pe))===di(pe).body){if(Ln(pe)&&(pe.focus(),u==="popup")){se.request(()=>{pe.focus()});return}const _e=M.current,rt=xe(),at=rt[_e]||rt[rt.length-1]||pe;Ln(at)&&at.focus()}if(B.current.insideReactTree){B.current.insideReactTree=!1;return}(X||!f)&&Te&&nt&&!ee.current&&(X||Te!==My())&&(F.current=!0,E.setOpen(!1,tt(Pp,je)))})}function be(){G.current||(B.current.insideReactTree=!0,le.start(0,()=>{B.current.insideReactTree=!1}))}const De=Ln(R)?R:null,qe=[];if(!(!N&&!De))return De&&(De.addEventListener("focusout",ke),De.addEventListener("pointerdown",me),qe.push(()=>{De.removeEventListener("focusout",ke),De.removeEventListener("pointerdown",me)})),N&&(N.addEventListener("focusout",ke),H&&(N.addEventListener("focusout",be,!0),qe.push(()=>{N.removeEventListener("focusout",be,!0)})),qe.push(()=>{N.removeEventListener("focusout",ke)})),()=>{qe.forEach(je=>{je()})}},[i,R,N,pe,f,$,H,E,d,u,xe,X,L,J,B,le,ne,se]);const ie=A.useRef(null),ye=A.useRef(null),ve=Zl(ie,S,H==null?void 0:H.beforeInsideRef),Qe=Zl(ye,H==null?void 0:H.afterInsideRef);A.useEffect(()=>{var je,Te,we;if(i||!N||!k)return;const me=Array.from(((je=H==null?void 0:H.portalNode)==null?void 0:je.querySelectorAll(`[${lp("portal")}]`))||[]),be=(we=(Te=($?dC($.nodesRef.current,L()):[]).find(Ae=>{var Ce;return z0(((Ce=Ae.context)==null?void 0:Ce.elements.domReference)||null)}))==null?void 0:Te.context)==null?void 0:we.elements.domReference,De=[N,be,...me,...D(),z.current,Q.current,ie.current,ye.current,H==null?void 0:H.beforeOutsideRef.current,H==null?void 0:H.afterOutsideRef.current,Lo(v),Lo(b),X?R:null].filter(Ae=>Ae!=null),qe=A4(De,f||X);return()=>{qe()}},[k,i,R,N,f,J,H,X,$,L,D,b,v]),ze(()=>{if(!k||i||!Ln(pe))return;const me=di(pe),ke=jl(me);queueMicrotask(()=>{const be=fe(pe),De=V.current,qe=typeof De=="function"?De(ae.current||""):De;if(qe===void 0||qe===!1)return;let je;qe===!0||qe===null?je=be[0]||pe:je=Lo(qe),je=je||be[0]||pe,!Dt(pe,ke)&&Hd(je,{preventScroll:je===pe})})},[i,k,pe,j,fe,V,ae]),ze(()=>{if(i||!pe)return;const me=di(pe),ke=jl(me);O4(ke);function be(je){if(je.open||(U.current=T4(je.nativeEvent,te.current)),je.reason===RB&&je.nativeEvent.type==="mouseleave"&&(F.current=!0),je.reason===NE)if(je.nested)F.current=!1;else if(HE(je.nativeEvent)||VE(je.nativeEvent))F.current=!1;else{let Te=!1;document.createElement("div").focus({get preventScroll(){return Te=!0,!1}}),Te?F.current=!1:F.current=!0}}T.on("openchange",be);const De=me.createElement("span");De.setAttribute("tabindex","-1"),De.setAttribute("aria-hidden","true"),Object.assign(De.style,zf),he&&R&&R.insertAdjacentElement("afterend",De);function qe(){const je=K.current;let Te=typeof je=="function"?je(U.current):je;if(Te===void 0||Te===!1)return null;if(Te===null&&(Te=!0),typeof Te=="boolean"){const Ae=R||My();return Ae&&Ae.isConnected?Ae:De}const we=R||My()||De;return Lo(Te)||we}return()=>{T.off("openchange",be);const je=jl(me),Te=Dt(N,je)||$&&ic($.nodesRef.current,L(),!1).some(Ae=>{var Ce;return Dt((Ce=Ae.context)==null?void 0:Ce.elements.floating,je)}),we=qe();queueMicrotask(()=>{const Ae=M4(we),Ce=typeof K.current!="boolean";K.current&&!F.current&&Ln(Ae)&&(!(!Ce&&Ae!==je&&je!==me.body)||Te)&&Ae.focus({preventScroll:!0}),De.remove()})}},[i,N,pe,K,B,T,$,he,R,L]),A.useEffect(()=>{queueMicrotask(()=>{F.current=!1})},[i]),A.useEffect(()=>{if(i||!k)return;function me(be){const De=ni(be);De!=null&&De.closest(`[${eB}]`)&&(ee.current=!0)}const ke=di(pe);return ke.addEventListener("pointerdown",me,!0),()=>{ke.removeEventListener("pointerdown",me,!0)}},[i,k,pe]),ze(()=>{if(!i&&H)return H.setFocusManagerState({modal:f,closeOnFocusOut:d,open:k,onOpenChange:E.setOpen,domReference:R}),()=>{H.setFocusManagerState(null)}},[i,H,f,k,E,d,R]),ze(()=>{if(!(i||!pe))return CC(pe,J),()=>{queueMicrotask(sv)}},[i,pe,J]);const Re=!i&&(f?!X:!0)&&(he||f);return x.jsxs(A.Fragment,{children:[Re&&x.jsx(op,{"data-type":"inside",ref:ve,onFocus:me=>{var ke;if(f){const be=fe();Hd(be[be.length-1])}else if(H!=null&&H.portalNode)if(F.current=!1,Zu(me,H.portalNode)){const be=$E(R);be==null||be.focus()}else(ke=Lo(v??H.beforeOutsideRef))==null||ke.focus()}}),t,Re&&x.jsx(op,{"data-type":"inside",ref:Qe,onFocus:me=>{var ke;if(f)Hd(fe()[0]);else if(H!=null&&H.portalNode)if(d&&(F.current=!0),Zu(me,H.portalNode)){const be=ZE(R);be==null||be.focus()}else(ke=Lo(b??H.afterOutsideRef))==null||ke.focus()}})]})}function lv(n,e={}){const t="rootStore"in n?n.rootStore:n,i=t.context.dataRef,{enabled:r=!0,event:o="click",toggle:a=!0,ignoreMouse:u=!1,stickIfOpen:f=!0,touchOpenDelay:d=0}=e,p=A.useRef(void 0),g=qp(),b=$i(),v=A.useMemo(()=>({onPointerDown(S){p.current=S.pointerType},onMouseDown(S){const w=p.current,E=S.nativeEvent,k=t.select("open");if(S.button!==0||o==="click"||pC(w)&&u)return;const R=i.current.openEvent,N=R==null?void 0:R.type,T=t.select("domReferenceElement")!==S.currentTarget,B=k&&T||!(k&&a&&(!(R&&f)||N==="click"||N==="mousedown"));if(PE(E.target)){const D=tt(Wu,E,E.target);B&&w==="touch"&&d>0?b.start(d,()=>{t.setOpen(!0,D)}):t.setOpen(B,D);return}const L=S.currentTarget;g.request(()=>{const D=tt(Wu,E,L);B&&w==="touch"&&d>0?b.start(d,()=>{t.setOpen(!0,D)}):t.setOpen(B,D)})},onClick(S){if(o==="mousedown-only")return;const w=p.current;if(o==="mousedown"&&w){p.current=void 0;return}if(pC(w)&&u)return;const E=t.select("open"),k=i.current.openEvent,R=t.select("domReferenceElement")!==S.currentTarget,N=E&&R||!(E&&a&&(!(k&&f)||_E(k))),T=tt(Wu,S.nativeEvent,S.currentTarget);N&&w==="touch"&&d>0?b.start(d,()=>{t.setOpen(!0,T)}):t.setOpen(N,T)},onKeyDown(){p.current=void 0}}),[i,o,u,t,f,a,g,b,d]);return A.useMemo(()=>r?{reference:v}:_n,[r,v])}function kC(n,e,t){let{reference:i,floating:r}=n;const o=hs(e),a=nv(e),u=tv(a),f=Zi(e),d=o==="y",p=i.x+i.width/2-r.width/2,g=i.y+i.height/2-r.height/2,b=i[u]/2-r[u]/2;let v;switch(f){case"top":v={x:p,y:i.y-r.height};break;case"bottom":v={x:p,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y:g};break;case"left":v={x:i.x-r.width,y:g};break;default:v={x:i.x,y:i.y}}switch(lo(e)){case"start":v[a]-=b*(t&&d?-1:1);break;case"end":v[a]+=b*(t&&d?-1:1);break}return v}async function D4(n,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:o,rects:a,elements:u,strategy:f}=n,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:b=!1,padding:v=0}=qr(e,n),S=UE(v),E=u[b?g==="floating"?"reference":"floating":g],k=tp(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(E)))==null||t?E:E.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:d,rootBoundary:p,strategy:f})),R=g==="floating"?{x:i,y:r,width:a.floating.width,height:a.floating.height}:a.reference,N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),T=await(o.isElement==null?void 0:o.isElement(N))?await(o.getScale==null?void 0:o.getScale(N))||{x:1,y:1}:{x:1,y:1},B=tp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:N,strategy:f}):R);return{top:(k.top-B.top+S.top)/T.y,bottom:(B.bottom-k.bottom+S.bottom)/T.y,left:(k.left-B.left+S.left)/T.x,right:(B.right-k.right+S.right)/T.x}}const j4=50,B4=async(n,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:a}=t,u=a.detectOverflow?a:{...a,detectOverflow:D4},f=await(a.isRTL==null?void 0:a.isRTL(e));let d=await a.getElementRects({reference:n,floating:e,strategy:r}),{x:p,y:g}=kC(d,i,f),b=i,v=0;const S={};for(let w=0;w<o.length;w++){const E=o[w];if(!E)continue;const{name:k,fn:R}=E,{x:N,y:T,data:B,reset:L}=await R({x:p,y:g,initialPlacement:i,placement:b,strategy:r,middlewareData:S,rects:d,platform:u,elements:{reference:n,floating:e}});p=N??p,g=T??g,S[k]={...S[k],...B},L&&v<j4&&(v++,typeof L=="object"&&(L.placement&&(b=L.placement),L.rects&&(d=L.rects===!0?await a.getElementRects({reference:n,floating:e,strategy:r}):L.rects),{x:p,y:g}=kC(d,b,f)),w=-1)}return{x:p,y:g,placement:b,strategy:r,middlewareData:S}},L4=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,i;const{placement:r,middlewareData:o,rects:a,initialPlacement:u,platform:f,elements:d}=e,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...E}=qr(n,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const k=Zi(r),R=hs(u),N=Zi(u)===u,T=await(f.isRTL==null?void 0:f.isRTL(d.floating)),B=b||(N||!w?[ep(u)]:KB(u)),L=S!=="none";!b&&L&&B.push(...$B(u,w,S,T));const D=[u,...B],j=await f.detectOverflow(e,E),X=[];let J=((i=o.flip)==null?void 0:i.overflows)||[];if(p&&X.push(j[k]),g){const $=QB(r,a,T);X.push(j[$[0]],j[$[1]])}if(J=[...J,{placement:r,overflows:X}],!X.every($=>$<=0)){var V,K;const $=(((V=o.flip)==null?void 0:V.index)||0)+1,H=D[$];if(H&&(!(g==="alignment"?R!==hs(H):!1)||J.every(F=>hs(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:J},reset:{placement:H}};let z=(K=J.filter(Q=>Q.overflows[0]<=0).sort((Q,F)=>Q.overflows[1]-F.overflows[1])[0])==null?void 0:K.placement;if(!z)switch(v){case"bestFit":{var ae;const Q=(ae=J.filter(F=>{if(L){const ee=hs(F.placement);return ee===R||ee==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(ee=>ee>0).reduce((ee,G)=>ee+G,0)]).sort((F,ee)=>F[1]-ee[1])[0])==null?void 0:ae[0];Q&&(z=Q);break}case"initialPlacement":z=u;break}if(r!==z)return{reset:{placement:z}}}return{}}}};function AC(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function EC(n){return FB.some(e=>n[e]>=0)}const z4=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t,platform:i}=e,{strategy:r="referenceHidden",...o}=qr(n,e);switch(r){case"referenceHidden":{const a=await i.detectOverflow(e,{...o,elementContext:"reference"}),u=AC(a,t.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:EC(u)}}}case"escaped":{const a=await i.detectOverflow(e,{...o,altBoundary:!0}),u=AC(a,t.floating);return{data:{escapedOffsets:u,escaped:EC(u)}}}default:return{}}}}},n2=new Set(["left","top"]);async function I4(n,e){const{placement:t,platform:i,elements:r}=n,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),a=Zi(t),u=lo(t),f=hs(t)==="y",d=n2.has(a)?-1:1,p=o&&f?-1:1,g=qr(e,n);let{mainAxis:b,crossAxis:v,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof S=="number"&&(v=u==="end"?S*-1:S),f?{x:v*p,y:b*d}:{x:b*d,y:v*p}}const P4=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,i;const{x:r,y:o,placement:a,middlewareData:u}=e,f=await I4(e,n);return a===((t=u.offset)==null?void 0:t.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:r+f.x,y:o+f.y,data:{...f,placement:a}}}}},H4=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:r,platform:o}=e,{mainAxis:a=!0,crossAxis:u=!1,limiter:f={fn:k=>{let{x:R,y:N}=k;return{x:R,y:N}}},...d}=qr(n,e),p={x:t,y:i},g=await o.detectOverflow(e,d),b=hs(Zi(r)),v=ev(b);let S=p[v],w=p[b];if(a){const k=v==="y"?"top":"left",R=v==="y"?"bottom":"right",N=S+g[k],T=S-g[R];S=I0(N,S,T)}if(u){const k=b==="y"?"top":"left",R=b==="y"?"bottom":"right",N=w+g[k],T=w-g[R];w=I0(N,w,T)}const E=f.fn({...e,[v]:S,[b]:w});return{...E,data:{x:E.x-t,y:E.y-i,enabled:{[v]:a,[b]:u}}}}}},V4=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:i,placement:r,rects:o,middlewareData:a}=e,{offset:u=0,mainAxis:f=!0,crossAxis:d=!0}=qr(n,e),p={x:t,y:i},g=hs(r),b=ev(g);let v=p[b],S=p[g];const w=qr(u,e),E=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(f){const N=b==="y"?"height":"width",T=o.reference[b]-o.floating[N]+E.mainAxis,B=o.reference[b]+o.reference[N]-E.mainAxis;v<T?v=T:v>B&&(v=B)}if(d){var k,R;const N=b==="y"?"width":"height",T=n2.has(Zi(r)),B=o.reference[g]-o.floating[N]+(T&&((k=a.offset)==null?void 0:k[g])||0)+(T?0:E.crossAxis),L=o.reference[g]+o.reference[N]+(T?0:((R=a.offset)==null?void 0:R[g])||0)-(T?E.crossAxis:0);S<B?S=B:S>L&&(S=L)}return{[b]:v,[g]:S}}}},_4=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,i;const{placement:r,rects:o,platform:a,elements:u}=e,{apply:f=()=>{},...d}=qr(n,e),p=await a.detectOverflow(e,d),g=Zi(r),b=lo(r),v=hs(r)==="y",{width:S,height:w}=o.floating;let E,k;g==="top"||g==="bottom"?(E=g,k=b===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,E=b==="end"?"top":"bottom");const R=w-p.top-p.bottom,N=S-p.left-p.right,T=Ec(w-p[E],R),B=Ec(S-p[k],N),L=!e.middlewareData.shift;let D=T,j=B;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(j=N),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(D=R),L&&!b){const J=Wi(p.left,0),V=Wi(p.right,0),K=Wi(p.top,0),ae=Wi(p.bottom,0);v?j=S-2*(J!==0||V!==0?J+V:Wi(p.left,p.right)):D=w-2*(K!==0||ae!==0?K+ae:Wi(p.top,p.bottom))}await f({...e,availableWidth:j,availableHeight:D});const X=await a.getDimensions(u.floating);return S!==X.width||w!==X.height?{reset:{rects:!0}}:{}}}};function i2(n){const e=Ji(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=Ln(n),o=r?n.offsetWidth:t,a=r?n.offsetHeight:i,u=Jd(t)!==o||Jd(i)!==a;return u&&(t=o,i=a),{width:t,height:i,$:u}}function ov(n){return Zt(n)?n:n.contextElement}function rc(n){const e=ov(n);if(!Ln(e))return rr(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:o}=i2(e);let a=(o?Jd(t.width):t.width)/i,u=(o?Jd(t.height):t.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const U4=rr(0);function s2(n){const e=In(n);return!zp()||!e.visualViewport?U4:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function q4(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==In(n)?!1:e}function na(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),o=ov(n);let a=rr(1);e&&(i?Zt(i)&&(a=rc(i)):a=rc(n));const u=q4(o,t,i)?s2(o):rr(0);let f=(r.left+u.x)/a.x,d=(r.top+u.y)/a.y,p=r.width/a.x,g=r.height/a.y;if(o){const b=In(o),v=i&&Zt(i)?In(i):i;let S=b,w=B0(S);for(;w&&i&&v!==S;){const E=rc(w),k=w.getBoundingClientRect(),R=Ji(w),N=k.left+(w.clientLeft+parseFloat(R.paddingLeft))*E.x,T=k.top+(w.clientTop+parseFloat(R.paddingTop))*E.y;f*=E.x,d*=E.y,p*=E.x,g*=E.y,f+=N,d+=T,S=In(w),w=B0(S)}}return tp({width:p,height:g,x:f,y:d})}function Fp(n,e){const t=Ip(n).scrollLeft;return e?e.left+t:na(cr(n)).left+t}function r2(n,e){const t=n.getBoundingClientRect(),i=t.left+e.scrollLeft-Fp(n,t),r=t.top+e.scrollTop;return{x:i,y:r}}function F4(n){let{elements:e,rect:t,offsetParent:i,strategy:r}=n;const o=r==="fixed",a=cr(i),u=e?Lp(e.floating):!1;if(i===a||u&&o)return t;let f={scrollLeft:0,scrollTop:0},d=rr(1);const p=rr(0),g=Ln(i);if((g||!g&&!o)&&((ro(i)!=="body"||fa(a))&&(f=Ip(i)),g)){const v=na(i);d=rc(i),p.x=v.x+i.clientLeft,p.y=v.y+i.clientTop}const b=a&&!g&&!o?r2(a,f):rr(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-f.scrollLeft*d.x+p.x+b.x,y:t.y*d.y-f.scrollTop*d.y+p.y+b.y}}function G4(n){return Array.from(n.getClientRects())}function Q4(n){const e=cr(n),t=Ip(n),i=n.ownerDocument.body,r=Wi(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=Wi(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let a=-t.scrollLeft+Fp(n);const u=-t.scrollTop;return Ji(i).direction==="rtl"&&(a+=Wi(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:a,y:u}}const RC=25;function K4(n,e){const t=In(n),i=cr(n),r=t.visualViewport;let o=i.clientWidth,a=i.clientHeight,u=0,f=0;if(r){o=r.width,a=r.height;const p=zp();(!p||p&&e==="fixed")&&(u=r.offsetLeft,f=r.offsetTop)}const d=Fp(i);if(d<=0){const p=i.ownerDocument,g=p.body,b=getComputedStyle(g),v=p.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,S=Math.abs(i.clientWidth-g.clientWidth-v);S<=RC&&(o-=S)}else d<=RC&&(o+=d);return{width:o,height:a,x:u,y:f}}function Y4(n,e){const t=na(n,!0,e==="fixed"),i=t.top+n.clientTop,r=t.left+n.clientLeft,o=Ln(n)?rc(n):rr(1),a=n.clientWidth*o.x,u=n.clientHeight*o.y,f=r*o.x,d=i*o.y;return{width:a,height:u,x:f,y:d}}function TC(n,e,t){let i;if(e==="viewport")i=K4(n,t);else if(e==="document")i=Q4(cr(n));else if(Zt(e))i=Y4(e,t);else{const r=s2(n);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return tp(i)}function l2(n,e){const t=Ur(n);return t===e||!Zt(t)||Hr(t)?!1:Ji(t).position==="fixed"||l2(t,e)}function W4(n,e){const t=e.get(n);if(t)return t;let i=Wl(n,[],!1).filter(u=>Zt(u)&&ro(u)!=="body"),r=null;const o=Ji(n).position==="fixed";let a=o?Ur(n):n;for(;Zt(a)&&!Hr(a);){const u=Ji(a),f=$b(a);!f&&u.position==="fixed"&&(r=null),(o?!f&&!r:!f&&u.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||fa(a)&&!f&&l2(n,a))?i=i.filter(p=>p!==a):r=u,a=Ur(a)}return e.set(n,i),i}function X4(n){let{element:e,boundary:t,rootBoundary:i,strategy:r}=n;const a=[...t==="clippingAncestors"?Lp(e)?[]:W4(e,this._c):[].concat(t),i],u=TC(e,a[0],r);let f=u.top,d=u.right,p=u.bottom,g=u.left;for(let b=1;b<a.length;b++){const v=TC(e,a[b],r);f=Wi(v.top,f),d=Ec(v.right,d),p=Ec(v.bottom,p),g=Wi(v.left,g)}return{width:d-g,height:p-f,x:g,y:f}}function $4(n){const{width:e,height:t}=i2(n);return{width:e,height:t}}function Z4(n,e,t){const i=Ln(e),r=cr(e),o=t==="fixed",a=na(n,!0,o,e);let u={scrollLeft:0,scrollTop:0};const f=rr(0);function d(){f.x=Fp(r)}if(i||!i&&!o)if((ro(e)!=="body"||fa(r))&&(u=Ip(e)),i){const v=na(e,!0,o,e);f.x=v.x+e.clientLeft,f.y=v.y+e.clientTop}else r&&d();o&&!i&&r&&d();const p=r&&!i&&!o?r2(r,u):rr(0),g=a.left+u.scrollLeft-f.x-p.x,b=a.top+u.scrollTop-f.y-p.y;return{x:g,y:b,width:a.width,height:a.height}}function Ny(n){return Ji(n).position==="static"}function OC(n,e){if(!Ln(n)||Ji(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return cr(n)===t&&(t=t.ownerDocument.body),t}function o2(n,e){const t=In(n);if(Lp(n))return t;if(!Ln(n)){let r=Ur(n);for(;r&&!Hr(r);){if(Zt(r)&&!Ny(r))return r;r=Ur(r)}return t}let i=OC(n,e);for(;i&&mB(i)&&Ny(i);)i=OC(i,e);return i&&Hr(i)&&Ny(i)&&!$b(i)?t:i||bB(n)||t}const J4=async function(n){const e=this.getOffsetParent||o2,t=this.getDimensions,i=await t(n.floating);return{reference:Z4(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function eL(n){return Ji(n).direction==="rtl"}const tL={convertOffsetParentRelativeRectToViewportRelativeRect:F4,getDocumentElement:cr,getClippingRect:X4,getOffsetParent:o2,getElementRects:J4,getClientRects:G4,getDimensions:$4,getScale:rc,isElement:Zt,isRTL:eL};function a2(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function nL(n,e){let t=null,i;const r=cr(n);function o(){var u;clearTimeout(i),(u=t)==null||u.disconnect(),t=null}function a(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),o();const d=n.getBoundingClientRect(),{left:p,top:g,width:b,height:v}=d;if(u||e(),!b||!v)return;const S=Za(g),w=Za(r.clientWidth-(p+b)),E=Za(r.clientHeight-(g+v)),k=Za(p),N={rootMargin:-S+"px "+-w+"px "+-E+"px "+-k+"px",threshold:Wi(0,Ec(1,f))||1};let T=!0;function B(L){const D=L[0].intersectionRatio;if(D!==f){if(!T)return a();D?a(!1,D):i=setTimeout(()=>{a(!1,1e-7)},1e3)}D===1&&!a2(d,n.getBoundingClientRect())&&a(),T=!1}try{t=new IntersectionObserver(B,{...N,root:r.ownerDocument})}catch{t=new IntersectionObserver(B,N)}t.observe(n)}return a(!0),o}function MC(n,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=i,d=ov(n),p=r||o?[...d?Wl(d):[],...e?Wl(e):[]]:[];p.forEach(k=>{r&&k.addEventListener("scroll",t,{passive:!0}),o&&k.addEventListener("resize",t)});const g=d&&u?nL(d,t):null;let b=-1,v=null;a&&(v=new ResizeObserver(k=>{let[R]=k;R&&R.target===d&&v&&e&&(v.unobserve(e),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var N;(N=v)==null||N.observe(e)})),t()}),d&&!f&&v.observe(d),e&&v.observe(e));let S,w=f?na(n):null;f&&E();function E(){const k=na(n);w&&!a2(w,k)&&t(),w=k,S=requestAnimationFrame(E)}return t(),()=>{var k;p.forEach(R=>{r&&R.removeEventListener("scroll",t),o&&R.removeEventListener("resize",t)}),g==null||g(),(k=v)==null||k.disconnect(),v=null,f&&cancelAnimationFrame(S)}}const iL=P4,sL=H4,rL=L4,lL=_4,oL=z4,aL=V4,cL=(n,e,t)=>{const i=new Map,r={platform:tL,...t},o={...r.platform,_c:i};return B4(n,e,{...r,platform:o})};var uL=typeof document<"u",fL=function(){},Vd=uL?A.useLayoutEffect:fL;function ap(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,i,r;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(i=t;i--!==0;)if(!ap(n[i],e[i]))return!1;return!0}if(r=Object.keys(n),t=r.length,t!==Object.keys(e).length)return!1;for(i=t;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=t;i--!==0;){const o=r[i];if(!(o==="_owner"&&n.$$typeof)&&!ap(n[o],e[o]))return!1}return!0}return n!==n&&e!==e}function c2(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function NC(n,e){const t=c2(n);return Math.round(e*t)/t}function Dy(n){const e=A.useRef(n);return Vd(()=>{e.current=n}),e}function hL(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:i=[],platform:r,elements:{reference:o,floating:a}={},transform:u=!0,whileElementsMounted:f,open:d}=n,[p,g]=A.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[b,v]=A.useState(i);ap(b,i)||v(i);const[S,w]=A.useState(null),[E,k]=A.useState(null),R=A.useCallback(F=>{F!==L.current&&(L.current=F,w(F))},[]),N=A.useCallback(F=>{F!==D.current&&(D.current=F,k(F))},[]),T=o||S,B=a||E,L=A.useRef(null),D=A.useRef(null),j=A.useRef(p),X=f!=null,J=Dy(f),V=Dy(r),K=Dy(d),ae=A.useCallback(()=>{if(!L.current||!D.current)return;const F={placement:e,strategy:t,middleware:b};V.current&&(F.platform=V.current),cL(L.current,D.current,F).then(ee=>{const G={...ee,isPositioned:K.current!==!1};$.current&&!ap(j.current,G)&&(j.current=G,Gr.flushSync(()=>{g(G)}))})},[b,e,t,V,K]);Vd(()=>{d===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,g(F=>({...F,isPositioned:!1})))},[d]);const $=A.useRef(!1);Vd(()=>($.current=!0,()=>{$.current=!1}),[]),Vd(()=>{if(T&&(L.current=T),B&&(D.current=B),T&&B){if(J.current)return J.current(T,B,ae);ae()}},[T,B,ae,J,X]);const H=A.useMemo(()=>({reference:L,floating:D,setReference:R,setFloating:N}),[R,N]),z=A.useMemo(()=>({reference:T,floating:B}),[T,B]),Q=A.useMemo(()=>{const F={position:t,left:0,top:0};if(!z.floating)return F;const ee=NC(z.floating,p.x),G=NC(z.floating,p.y);return u?{...F,transform:"translate("+ee+"px, "+G+"px)",...c2(z.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ee,top:G}},[t,u,z.floating,p.x,p.y]);return A.useMemo(()=>({...p,update:ae,refs:H,elements:z,floatingStyles:Q}),[p,ae,H,z,Q])}const dL=(n,e)=>{const t=iL(n);return{name:t.name,fn:t.fn,options:[n,e]}},pL=(n,e)=>{const t=sL(n);return{name:t.name,fn:t.fn,options:[n,e]}},mL=(n,e)=>({fn:aL(n).fn,options:[n,e]}),gL=(n,e)=>{const t=rL(n);return{name:t.name,fn:t.fn,options:[n,e]}},yL=(n,e)=>{const t=lL(n);return{name:t.name,fn:t.fn,options:[n,e]}},bL=(n,e)=>{const t=oL(n);return{name:t.name,fn:t.fn,options:[n,e]}},vL={intentional:"onClick",sloppy:"onPointerDown"};function xL(n){return{escapeKey:typeof n=="boolean"?n:(n==null?void 0:n.escapeKey)??!1,outsidePress:typeof n=="boolean"?n:(n==null?void 0:n.outsidePress)??!0}}function av(n,e={}){const t="rootStore"in n?n.rootStore:n,i=t.useState("open"),r=t.useState("floatingElement"),o=t.useState("referenceElement"),a=t.useState("domReferenceElement"),{onOpenChange:u,dataRef:f}=t.context,{enabled:d=!0,escapeKey:p=!0,outsidePress:g=!0,outsidePressEvent:b="sloppy",referencePress:v=!1,referencePressEvent:S="sloppy",ancestorScroll:w=!1,bubbles:E,externalTree:k}=e,R=Up(k),N=He(typeof g=="function"?g:()=>!1),T=typeof g=="function"?N:g,B=A.useRef(!1),{escapeKey:L,outsidePress:D}=xL(E),j=A.useRef(null),X=$i(),J=$i(),V=He(()=>{J.clear(),f.current.insideReactTree=!1}),K=A.useRef(!1),ae=A.useRef(""),$=He(ie=>{ae.current=ie.pointerType}),H=He(()=>{const ie=ae.current,ye=ie==="pen"||!ie?"mouse":ie,ve=typeof b=="function"?b():b;return typeof ve=="string"?ve:ve[ye]}),z=He(ie=>{var me;if(!i||!d||!p||ie.key!=="Escape"||K.current)return;const ye=(me=f.current.floatingContext)==null?void 0:me.nodeId,ve=R?ic(R.nodesRef.current,ye):[];if(!L&&ve.length>0){let ke=!0;if(ve.forEach(be=>{var De;(De=be.context)!=null&&De.open&&!be.context.dataRef.current.__escapeKeyBubbles&&(ke=!1)}),!ke)return}const Qe=qB(ie)?ie.nativeEvent:ie,Re=tt(DE,Qe);t.setOpen(!1,Re),!L&&!Re.isPropagationAllowed&&ie.stopPropagation()}),Q=He(ie=>{const ye=H();return ye==="intentional"&&ie.type!=="click"||ye==="sloppy"&&ie.type==="click"}),F=He(()=>{f.current.insideReactTree=!0,J.start(0,V)}),ee=He((ie,ye=!1)=>{var je;if(Q(ie)){V();return}if(f.current.insideReactTree){V();return}if(H()==="intentional"&&ye||typeof T=="function"&&!T(ie))return;const ve=ni(ie),Qe=`[${lp("inert")}]`,Re=di(t.select("floatingElement")).querySelectorAll(Qe),me=t.context.triggerElements;if(ve&&(me.hasElement(ve)||me.hasMatchingElement(Te=>Dt(Te,ve))))return;let ke=Zt(ve)?ve:null;for(;ke&&!Hr(ke);){const Te=Ur(ke);if(Hr(Te)||!Zt(Te))break;ke=Te}if(Re.length&&Zt(ve)&&!UB(ve)&&!Dt(ve,t.select("floatingElement"))&&Array.from(Re).every(Te=>!Dt(ke,Te)))return;if(Ln(ve)&&!("touches"in ie)){const Te=Hr(ve),we=Ji(ve),Ae=/auto|scroll/,Ce=Te||Ae.test(we.overflowX),Ze=Te||Ae.test(we.overflowY),nt=Ce&&ve.clientWidth>0&&ve.scrollWidth>ve.clientWidth,_e=Ze&&ve.clientHeight>0&&ve.scrollHeight>ve.clientHeight,rt=we.direction==="rtl",at=_e&&(rt?ie.offsetX<=ve.offsetWidth-ve.clientWidth:ie.offsetX>ve.clientWidth),Lt=nt&&ie.offsetY>ve.clientHeight;if(at||Lt)return}const be=(je=f.current.floatingContext)==null?void 0:je.nodeId,De=R&&ic(R.nodesRef.current,be).some(Te=>{var we;return ks(ie,(we=Te.context)==null?void 0:we.elements.floating)});if(ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement"))||De)return;const qe=R?ic(R.nodesRef.current,be):[];if(qe.length>0){let Te=!0;if(qe.forEach(we=>{var Ae;(Ae=we.context)!=null&&Ae.open&&!we.context.dataRef.current.__outsidePressBubbles&&(Te=!1)}),!Te)return}t.setOpen(!1,tt(NE,ie)),V()}),G=He(ie=>{H()!=="sloppy"||ie.pointerType==="touch"||!t.select("open")||!d||ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement"))||ee(ie)}),M=He(ie=>{if(H()!=="sloppy"||!t.select("open")||!d||ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement")))return;const ye=ie.touches[0];ye&&(j.current={startTime:Date.now(),startX:ye.clientX,startY:ye.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},X.start(1e3,()=>{j.current&&(j.current.dismissOnTouchEnd=!1,j.current.dismissOnMouseDown=!1)}))}),U=He(ie=>{const ye=ni(ie);function ve(){M(ie),ye==null||ye.removeEventListener(ie.type,ve)}ye==null||ye.addEventListener(ie.type,ve)}),te=He(ie=>{const ye=B.current;if(B.current=!1,X.clear(),ie.type==="mousedown"&&j.current&&!j.current.dismissOnMouseDown)return;const ve=ni(ie);function Qe(){ie.type==="pointerdown"?G(ie):ee(ie,ye),ve==null||ve.removeEventListener(ie.type,Qe)}ve==null||ve.addEventListener(ie.type,Qe)}),le=He(ie=>{if(H()!=="sloppy"||!j.current||ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement")))return;const ye=ie.touches[0];if(!ye)return;const ve=Math.abs(ye.clientX-j.current.startX),Qe=Math.abs(ye.clientY-j.current.startY),Re=Math.sqrt(ve*ve+Qe*Qe);Re>5&&(j.current.dismissOnTouchEnd=!0),Re>10&&(ee(ie),X.clear(),j.current=null)}),ne=He(ie=>{const ye=ni(ie);function ve(){le(ie),ye==null||ye.removeEventListener(ie.type,ve)}ye==null||ye.addEventListener(ie.type,ve)}),se=He(ie=>{H()!=="sloppy"||!j.current||ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement"))||(j.current.dismissOnTouchEnd&&ee(ie),X.clear(),j.current=null)}),he=He(ie=>{const ye=ni(ie);function ve(){se(ie),ye==null||ye.removeEventListener(ie.type,ve)}ye==null||ye.addEventListener(ie.type,ve)});A.useEffect(()=>{if(!i||!d)return;f.current.__escapeKeyBubbles=L,f.current.__outsidePressBubbles=D;const ie=new Ac;function ye(ke){t.setOpen(!1,tt(Oi,ke))}function ve(){ie.clear(),K.current=!0}function Qe(){ie.start(zp()?5:0,()=>{K.current=!1})}const Re=di(r);Re.addEventListener("pointerdown",$,!0),p&&(Re.addEventListener("keydown",z),Re.addEventListener("compositionstart",ve),Re.addEventListener("compositionend",Qe)),T&&(Re.addEventListener("click",te,!0),Re.addEventListener("pointerdown",te,!0),Re.addEventListener("touchstart",U,!0),Re.addEventListener("touchmove",ne,!0),Re.addEventListener("touchend",he,!0),Re.addEventListener("mousedown",te,!0));let me=[];return w&&(Zt(a)&&(me=Wl(a)),Zt(r)&&(me=me.concat(Wl(r))),!Zt(o)&&o&&o.contextElement&&(me=me.concat(Wl(o.contextElement)))),me=me.filter(ke=>{var be;return ke!==((be=Re.defaultView)==null?void 0:be.visualViewport)}),me.forEach(ke=>{ke.addEventListener("scroll",ye,{passive:!0})}),()=>{Re.removeEventListener("pointerdown",$,!0),p&&(Re.removeEventListener("keydown",z),Re.removeEventListener("compositionstart",ve),Re.removeEventListener("compositionend",Qe)),T&&(Re.removeEventListener("click",te,!0),Re.removeEventListener("pointerdown",te,!0),Re.removeEventListener("touchstart",U,!0),Re.removeEventListener("touchmove",ne,!0),Re.removeEventListener("touchend",he,!0),Re.removeEventListener("mousedown",te,!0)),me.forEach(ke=>{ke.removeEventListener("scroll",ye)}),ie.clear()}},[f,r,o,a,p,T,i,u,w,d,L,D,z,ee,te,G,U,ne,he,$,t]),A.useEffect(V,[T,V]);const pe=A.useMemo(()=>({onKeyDown:z,...v&&{[vL[S]]:ie=>{t.setOpen(!1,tt(Wu,ie.nativeEvent))},...S!=="intentional"&&{onClick(ie){t.setOpen(!1,tt(Wu,ie.nativeEvent))}}}}),[z,t,v,S]),xe=He(ie=>{const ye=ni(ie.nativeEvent);!Dt(t.select("floatingElement"),ye)||ie.button!==0||(B.current=!0)}),fe=A.useMemo(()=>({onKeyDown:z,onPointerDown:xe,onMouseDown:xe,onMouseUp:xe,onClickCapture:F,onMouseDownCapture:F,onPointerDownCapture:F,onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[z,xe,F]);return A.useMemo(()=>d?{reference:pe,floating:fe,trigger:pe}:{},[d,pe,fe])}var cp=Symbol("NOT_FOUND");function SL(n,e=`expected a function, instead received ${typeof n}`){if(typeof n!="function")throw new TypeError(e)}function wL(n,e="expected all items to be functions, instead received the following types: "){if(!n.every(t=>typeof t=="function")){const t=n.map(i=>typeof i=="function"?`function ${i.name||"unnamed"}()`:typeof i).join(", ");throw new TypeError(`${e}[${t}]`)}}var DC=n=>Array.isArray(n)?n:[n];function CL(n){const e=Array.isArray(n[0])?n[0]:n;return wL(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function kL(n,e){const t=[],{length:i}=n;for(let r=0;r<i;r++)t.push(n[r].apply(null,e));return t}function AL(n){let e;return{get(t){return e&&n(e.key,t)?e.value:cp},put(t,i){e={key:t,value:i}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function EL(n,e){let t=[];function i(u){const f=t.findIndex(d=>e(u,d.key));if(f>-1){const d=t[f];return f>0&&(t.splice(f,1),t.unshift(d)),d.value}return cp}function r(u,f){i(u)===cp&&(t.unshift({key:u,value:f}),t.length>n&&t.pop())}function o(){return t}function a(){t=[]}return{get:i,put:r,getEntries:o,clear:a}}var RL=(n,e)=>n===e;function TL(n){return function(t,i){if(t===null||i===null||t.length!==i.length)return!1;const{length:r}=t;for(let o=0;o<r;o++)if(!n(t[o],i[o]))return!1;return!0}}function OL(n,e){const t=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:i=RL,maxSize:r=1,resultEqualityCheck:o}=t,a=TL(i);let u=0;const f=r<=1?AL(a):EL(r,a);function d(){let p=f.get(arguments);if(p===cp){if(p=n.apply(null,arguments),u++,o){const b=f.getEntries().find(v=>o(v.value,p));b&&(p=b.value,u!==0&&u--)}f.put(arguments,p)}return p}return d.clearCache=()=>{f.clear(),d.resetResultsCount()},d.resultsCount=()=>u,d.resetResultsCount=()=>{u=0},d}var ML=class{constructor(n){this.value=n}deref(){return this.value}},NL=()=>typeof WeakRef>"u"?ML:WeakRef,u2=NL(),DL=0,jC=1;function dd(){return{s:DL,v:void 0,o:null,p:null}}function jL(n){return n instanceof u2?n.deref():n}function BL(n,e={}){let t=dd();const{resultEqualityCheck:i}=e;let r,o=0;function a(){let u=t;const{length:f}=arguments;for(let g=0,b=f;g<b;g++){const v=arguments[g];if(typeof v=="function"||typeof v=="object"&&v!==null){let S=u.o;S===null&&(u.o=S=new WeakMap);const w=S.get(v);w===void 0?(u=dd(),S.set(v,u)):u=w}else{let S=u.p;S===null&&(u.p=S=new Map);const w=S.get(v);w===void 0?(u=dd(),S.set(v,u)):u=w}}const d=u;let p;if(u.s===jC)p=u.v;else if(p=n.apply(null,arguments),o++,i){const g=jL(r);g!=null&&i(g,p)&&(p=g,o!==0&&o--),r=typeof p=="object"&&p!==null||typeof p=="function"?new u2(p):p}return d.s=jC,d.v=p,p}return a.clearCache=()=>{t=dd(),a.resetResultsCount()},a.resultsCount=()=>o,a.resetResultsCount=()=>{o=0},a}function LL(n,...e){const t=typeof n=="function"?{memoize:n,memoizeOptions:e}:n,i=(...r)=>{let o=0,a=0,u,f={},d=r.pop();typeof d=="object"&&(f=d,d=r.pop()),SL(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const p={...t,...f},{memoize:g,memoizeOptions:b=[],argsMemoize:v=BL,argsMemoizeOptions:S=[]}=p,w=DC(b),E=DC(S),k=CL(r),R=g(function(){return o++,d.apply(null,arguments)},...w),N=v(function(){a++;const B=kL(k,arguments);return u=R.apply(null,B),u},...E);return Object.assign(N,{resultFunc:d,memoizedResultFunc:R,dependencies:k,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>u,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:g,argsMemoize:v})};return Object.assign(i,{withTypes:()=>i}),i}LL({memoize:OL,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const de=(n,e,t,i,r,o,...a)=>{if(a.length>0)throw new Error(ri(1));let u;if(n)u=n;else throw new Error("Missing arguments");return u};var jy={exports:{}},By={};/**
|
|
180
|
+
*/var s4=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","area[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],np=s4.join(","),FE=typeof Element>"u",Rc=FE?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,ip=!FE&&Element.prototype.getRootNode?function(n){var e;return n==null||(e=n.getRootNode)===null||e===void 0?void 0:e.call(n)}:function(n){return n==null?void 0:n.ownerDocument},sp=function(e,t){var i;t===void 0&&(t=!0);var r=e==null||(i=e.getAttribute)===null||i===void 0?void 0:i.call(e,"inert"),o=r===""||r==="true",a=o||t&&e&&(typeof e.closest=="function"?e.closest("[inert]"):sp(e.parentNode));return a},r4=function(e){var t,i=e==null||(t=e.getAttribute)===null||t===void 0?void 0:t.call(e,"contenteditable");return i===""||i==="true"},GE=function(e,t,i){if(sp(e))return[];var r=Array.prototype.slice.apply(e.querySelectorAll(np));return t&&Rc.call(e,np)&&r.unshift(e),r=r.filter(i),r},rp=function(e,t,i){for(var r=[],o=Array.from(e);o.length;){var a=o.shift();if(!sp(a,!1))if(a.tagName==="SLOT"){var u=a.assignedElements(),f=u.length?u:a.children,d=rp(f,!0,i);i.flatten?r.push.apply(r,d):r.push({scopeParent:a,candidates:d})}else{var p=Rc.call(a,np);p&&i.filter(a)&&(t||!e.includes(a))&&r.push(a);var g=a.shadowRoot||typeof i.getShadowRoot=="function"&&i.getShadowRoot(a),b=!sp(g,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(a));if(g&&b){var v=rp(g===!0?a.children:g.children,!0,i);i.flatten?r.push.apply(r,v):r.push({scopeParent:a,candidates:v})}else o.unshift.apply(o,a.children)}}return r},QE=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},KE=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||r4(e))&&!QE(e)?0:e.tabIndex},l4=function(e,t){var i=KE(e);return i<0&&t&&!QE(e)?0:i},o4=function(e,t){return e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex},YE=function(e){return e.tagName==="INPUT"},a4=function(e){return YE(e)&&e.type==="hidden"},c4=function(e){var t=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(i){return i.tagName==="SUMMARY"});return t},u4=function(e,t){for(var i=0;i<e.length;i++)if(e[i].checked&&e[i].form===t)return e[i]},f4=function(e){if(!e.name)return!0;var t=e.form||ip(e),i=function(u){return t.querySelectorAll('input[type="radio"][name="'+u+'"]')},r;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")r=i(window.CSS.escape(e.name));else try{r=i(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var o=u4(r,e.form);return!o||o===e},h4=function(e){return YE(e)&&e.type==="radio"},d4=function(e){return h4(e)&&!f4(e)},p4=function(e){var t,i=e&&ip(e),r=(t=i)===null||t===void 0?void 0:t.host,o=!1;if(i&&i!==e){var a,u,f;for(o=!!((a=r)!==null&&a!==void 0&&(u=a.ownerDocument)!==null&&u!==void 0&&u.contains(r)||e!=null&&(f=e.ownerDocument)!==null&&f!==void 0&&f.contains(e));!o&&r;){var d,p,g;i=ip(r),r=(d=i)===null||d===void 0?void 0:d.host,o=!!((p=r)!==null&&p!==void 0&&(g=p.ownerDocument)!==null&&g!==void 0&&g.contains(r))}}return o},vC=function(e){var t=e.getBoundingClientRect(),i=t.width,r=t.height;return i===0&&r===0},m4=function(e,t){var i=t.displayCheck,r=t.getShadowRoot;if(i==="full-native"&&"checkVisibility"in e){var o=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!o}var a=getComputedStyle(e),u=a.visibility;if(u==="hidden"||u==="collapse")return!0;var f=Rc.call(e,"details>summary:first-of-type"),d=f?e.parentElement:e;if(Rc.call(d,"details:not([open]) *"))return!0;if(!i||i==="full"||i==="full-native"||i==="legacy-full"){if(typeof r=="function"){for(var p=e;e;){var g=e.parentElement,b=ip(e);if(g&&!g.shadowRoot&&r(g)===!0)return vC(e);e.assignedSlot?e=e.assignedSlot:!g&&b!==e.ownerDocument?e=b.host:e=g}e=p}if(p4(e))return!e.getClientRects().length;if(i!=="legacy-full")return!0}else if(i==="non-zero-area")return vC(e);return!1},g4=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var t=e.parentElement;t;){if(t.tagName==="FIELDSET"&&t.disabled){for(var i=0;i<t.children.length;i++){var r=t.children.item(i);if(r.tagName==="LEGEND")return Rc.call(t,"fieldset[disabled] *")?!0:!r.contains(e)}return!0}t=t.parentElement}return!1},H0=function(e,t){return!(t.disabled||a4(t)||m4(t,e)||c4(t)||g4(t))},V0=function(e,t){return!(d4(t)||KE(t)<0||!H0(e,t))},y4=function(e){var t=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(t)||t>=0)},WE=function(e){var t=[],i=[];return e.forEach(function(r,o){var a=!!r.scopeParent,u=a?r.scopeParent:r,f=l4(u,a),d=a?WE(r.candidates):u;f===0?a?t.push.apply(t,d):t.push(u):i.push({documentOrder:o,tabIndex:f,item:r,isScope:a,content:d})}),i.sort(o4).reduce(function(r,o){return o.isScope?r.push.apply(r,o.content):r.push(o.content),r},[]).concat(t)},Vp=function(e,t){t=t||{};var i;return t.getShadowRoot?i=rp([e],t.includeContainer,{filter:V0.bind(null,t),flatten:!1,getShadowRoot:t.getShadowRoot,shadowRootFilter:y4}):i=GE(e,t.includeContainer,V0.bind(null,t)),WE(i)},b4=function(e,t){t=t||{};var i;return t.getShadowRoot?i=rp([e],t.includeContainer,{filter:H0.bind(null,t),flatten:!0,getShadowRoot:t.getShadowRoot}):i=GE(e,t.includeContainer,H0.bind(null,t)),i},XE=function(e,t){if(t=t||{},!e)throw new Error("No node provided");return Rc.call(e,np)===!1?!1:V0(t,e)};const Lf=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function $E(n,e){const t=Vp(n,Lf()),i=t.length;if(i===0)return;const r=jl(di(n)),o=t.indexOf(r),a=o===-1?e===1?0:i-1:o+e;return t[a]}function ZE(n){return $E(di(n).body,1)||n}function JE(n){return $E(di(n).body,-1)||n}function Zu(n,e){const t=e||n.currentTarget,i=n.relatedTarget;return!i||!Dt(t,i)}function v4(n){Vp(n,Lf()).forEach(t=>{t.dataset.tabindex=t.getAttribute("tabindex")||"",t.setAttribute("tabindex","-1")})}function xC(n){n.querySelectorAll("[data-tabindex]").forEach(t=>{const i=t.dataset.tabindex;delete t.dataset.tabindex,i?t.setAttribute("tabindex",i):t.removeAttribute("tabindex")})}function x4(){const n=new Map;return{emit(e,t){var i;(i=n.get(e))==null||i.forEach(r=>r(t))},on(e,t){n.has(e)||n.set(e,new Set),n.get(e).add(t)},off(e,t){var i;(i=n.get(e))==null||i.delete(t)}}}const S4=A.createContext(null),w4=A.createContext(null),_p=()=>{var n;return((n=A.useContext(S4))==null?void 0:n.id)||null},Up=n=>{const e=A.useContext(w4);return n??e};function lp(n){return`data-base-ui-${n}`}const zf={clip:"rect(0 0 0 0)",overflow:"hidden",whiteSpace:"nowrap",position:"fixed",top:0,left:0,border:0,padding:0,width:1,height:1,margin:-1},cd=null;class C4{constructor(){Kt(this,"callbacks",[]);Kt(this,"callbacksCount",0);Kt(this,"nextId",1);Kt(this,"startId",1);Kt(this,"isScheduled",!1);Kt(this,"tick",e=>{var r;this.isScheduled=!1;const t=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let o=0;o<t.length;o+=1)(r=t[o])==null||r.call(t,e)})}request(e){const t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,(!this.isScheduled||!1)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),t}cancel(e){const t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,this.callbacksCount-=1)}}const ud=new C4;class Zs{constructor(){Kt(this,"currentId",cd);Kt(this,"cancel",()=>{this.currentId!==cd&&(ud.cancel(this.currentId),this.currentId=cd)});Kt(this,"disposeEffect",()=>this.cancel)}static create(){return new Zs}static request(e){return ud.request(e)}static cancel(e){return ud.cancel(e)}request(e){this.cancel(),this.currentId=ud.request(()=>{this.currentId=cd,e()})}}function qp(){const n=Bi(Zs.create).current;return BE(n.disposeEffect),n}function Fr(n){return(n==null?void 0:n.ownerDocument)||document}const op=A.forwardRef(function(e,t){const[i,r]=A.useState();ze(()=>{IB&&r("button")},[]);const o={tabIndex:0,role:i};return x.jsx("span",{...e,ref:t,style:zf,"aria-hidden":i?void 0:!0,...o,"data-base-ui-focus-guard":""})});let SC=0;function Hd(n,e={}){const{preventScroll:t=!1,cancelPrevious:i=!0,sync:r=!1}=e;i&&cancelAnimationFrame(SC);const o=()=>n==null?void 0:n.focus({preventScroll:t});r?o():SC=requestAnimationFrame(o)}const sc={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function wC(n){return n==="inert"?sc.inert:n==="aria-hidden"?sc["aria-hidden"]:sc.none}let fd=new WeakSet,hd={},Oy=0;const e2=n=>n&&(n.host||e2(n.parentNode)),k4=(n,e)=>e.map(t=>{if(n.contains(t))return t;const i=e2(t);return n.contains(i)?i:null}).filter(t=>t!=null);function A4(n,e,t,i){const r="data-base-ui-inert",o=i?"inert":t?"aria-hidden":null,a=k4(e,n),u=new Set,f=new Set(a),d=[];hd[r]||(hd[r]=new WeakMap);const p=hd[r];a.forEach(g),b(e),u.clear();function g(v){!v||u.has(v)||(u.add(v),v.parentNode&&g(v.parentNode))}function b(v){!v||f.has(v)||[].forEach.call(v.children,S=>{if(ro(S)!=="script")if(u.has(S))b(S);else{const w=o?S.getAttribute(o):null,E=w!==null&&w!=="false",k=wC(o),R=(k.get(S)||0)+1,N=(p.get(S)||0)+1;k.set(S,R),p.set(S,N),d.push(S),R===1&&E&&fd.add(S),N===1&&S.setAttribute(r,""),!E&&o&&S.setAttribute(o,o==="inert"?"":"true")}})}return Oy+=1,()=>{d.forEach(v=>{const S=wC(o),E=(S.get(v)||0)-1,k=(p.get(v)||0)-1;S.set(v,E),p.set(v,k),E||(!fd.has(v)&&o&&v.removeAttribute(o),fd.delete(v)),k||v.removeAttribute(r)}),Oy-=1,Oy||(sc.inert=new WeakMap,sc["aria-hidden"]=new WeakMap,sc.none=new WeakMap,fd=new WeakSet,hd={})}}function E4(n,e=!1,t=!1){const i=di(n[0]).body;return A4(n.concat(Array.from(i.querySelectorAll("[aria-live]"))),i,e,t)}var Gr=TA();const t2=A.createContext(null),n2=()=>A.useContext(t2),R4=lp("portal");function T4(n={}){const{ref:e,container:t,componentProps:i=_n,elementProps:r,elementState:o}=n,a=jf(),u=n2(),f=u==null?void 0:u.portalNode,[d,p]=A.useState(null),[g,b]=A.useState(null),v=A.useRef(null);ze(()=>{if(t===null){v.current&&(v.current=null,b(null),p(null));return}if(a==null)return;const E=(t&&(Xb(t)?t:t.current))??f??document.body;if(E==null){v.current&&(v.current=null,b(null),p(null));return}v.current!==E&&(v.current=E,b(null),p(E))},[t,f,a]);const S=wn("div",i,{ref:[e,b],state:o,props:[{id:a,[R4]:""},r]});return{portalNode:g,portalSubtree:d&&S?Gr.createPortal(S,d):null}}const iv=A.forwardRef(function(e,t){const{children:i,container:r,className:o,render:a,renderGuards:u,...f}=e,{portalNode:d,portalSubtree:p}=T4({container:r,ref:t,componentProps:e,elementProps:f}),g=A.useRef(null),b=A.useRef(null),v=A.useRef(null),S=A.useRef(null),[w,E]=A.useState(null),k=w==null?void 0:w.modal,R=w==null?void 0:w.open,N=typeof u=="boolean"?u:!!w&&!w.modal&&w.open&&!!d;A.useEffect(()=>{if(!d||k)return;function B(L){d&&Zu(L)&&(L.type==="focusin"?xC:v4)(d)}return d.addEventListener("focusin",B,!0),d.addEventListener("focusout",B,!0),()=>{d.removeEventListener("focusin",B,!0),d.removeEventListener("focusout",B,!0)}},[d,k]),A.useEffect(()=>{!d||R||xC(d)},[R,d]);const T=A.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:b,beforeInsideRef:v,afterInsideRef:S,portalNode:d,setFocusManagerState:E}),[d]);return x.jsxs(A.Fragment,{children:[p,x.jsxs(t2.Provider,{value:T,children:[N&&d&&x.jsx(op,{"data-type":"outside",ref:g,onFocus:B=>{var L;if(Zu(B,d))(L=v.current)==null||L.focus();else{const D=w?w.domReference:null,j=JE(D);j==null||j.focus()}}}),N&&d&&x.jsx("span",{"aria-owns":d.id,style:nB}),d&&Gr.createPortal(i,d),N&&d&&x.jsx(op,{"data-type":"outside",ref:b,onFocus:B=>{var L;if(Zu(B,d))(L=S.current)==null||L.focus();else{const D=w?w.domReference:null,j=ZE(D);j==null||j.focus(),w!=null&&w.closeOnFocusOut&&(w==null||w.onOpenChange(!1,tt(Pp,B.nativeEvent)))}}})]})]})});function Lo(n){return n==null?n:"current"in n?n.current:n}function O4(n,e){const t=In(n.target);return n instanceof t.KeyboardEvent?"keyboard":n instanceof t.FocusEvent?e||"keyboard":"pointerType"in n?n.pointerType||"keyboard":"touches"in n?"touch":n instanceof t.MouseEvent?e||(n.detail===0?"keyboard":"mouse"):""}const CC=20;let Gl=[];function sv(){Gl=Gl.filter(n=>n.isConnected)}function M4(n){sv(),n&&ro(n)!=="body"&&(Gl.push(n),Gl.length>CC&&(Gl=Gl.slice(-CC)))}function My(){return sv(),Gl[Gl.length-1]}function N4(n){if(!n)return null;const e=Lf();return XE(n,e)?n:Vp(n,e)[0]||n}function D4(n){return!n||!n.isConnected?!1:typeof n.checkVisibility=="function"?n.checkVisibility():Ji(n).display!=="none"}function kC(n,e){var a;if(!e.current.includes("floating")&&!((a=n.getAttribute("role"))!=null&&a.includes("dialog")))return;const t=Lf(),r=b4(n,t).filter(u=>{const f=u.getAttribute("data-tabindex")||"";return XE(u,t)||u.hasAttribute("data-tabindex")&&!f.startsWith("-")}),o=n.getAttribute("tabindex");e.current.includes("floating")||r.length===0?o!=="0"&&n.setAttribute("tabindex","0"):(o!=="-1"||n.hasAttribute("data-tabindex")&&n.getAttribute("data-tabindex")!=="-1")&&(n.setAttribute("tabindex","-1"),n.setAttribute("data-tabindex","-1"))}function rv(n){const{context:e,children:t,disabled:i=!1,order:r=["content"],initialFocus:o=!0,returnFocus:a=!0,restoreFocus:u=!1,modal:f=!0,closeOnFocusOut:d=!0,openInteractionType:p="",getInsideElements:g=()=>[],nextFocusableElement:b,previousFocusableElement:v,beforeContentFocusGuardRef:S,externalTree:w}=n,E="rootStore"in e?e.rootStore:e,k=E.useState("open"),R=E.useState("domReferenceElement"),N=E.useState("floatingElement"),{events:T,dataRef:B}=E.context,L=He(()=>{var me;return(me=B.current.floatingContext)==null?void 0:me.nodeId}),D=He(g),j=o===!1,X=z0(R)&&j,J=Vn(r),V=Vn(o),K=Vn(a),ae=Vn(p),$=Up(w),H=n2(),z=A.useRef(null),Q=A.useRef(null),F=A.useRef(!1),ee=A.useRef(!1),G=A.useRef(!1),M=A.useRef(-1),U=A.useRef(""),te=A.useRef(""),le=$i(),ne=$i(),se=qp(),he=H!=null,pe=cf(N),xe=He((me=pe)=>me?Vp(me,Lf()):[]),fe=He(me=>{const ke=xe(me);return J.current.map(()=>ke).filter(Boolean).flat()});A.useEffect(()=>{if(i||!f)return;function me(be){be.key==="Tab"&&Dt(pe,jl(di(pe)))&&xe().length===0&&!X&&bn(be)}const ke=di(pe);return ke.addEventListener("keydown",me),()=>{ke.removeEventListener("keydown",me)}},[i,R,pe,f,J,X,xe,fe]),A.useEffect(()=>{if(i||!N)return;function me(ke){const be=ni(ke),qe=xe().indexOf(be);qe!==-1&&(M.current=qe)}return N.addEventListener("focusin",me),()=>{N.removeEventListener("focusin",me)}},[i,N,xe]),A.useEffect(()=>{if(i||!k)return;const me=di(pe);function ke(){G.current=!1}function be(qe){const je=ni(qe),Te=Dt(N,je)||Dt(R,je)||Dt(H==null?void 0:H.portalNode,je);G.current=!Te,te.current=qe.pointerType||"keyboard"}function De(){te.current="keyboard"}return me.addEventListener("pointerdown",be,!0),me.addEventListener("pointerup",ke,!0),me.addEventListener("pointercancel",ke,!0),me.addEventListener("keydown",De,!0),()=>{me.removeEventListener("pointerdown",be,!0),me.removeEventListener("pointerup",ke,!0),me.removeEventListener("pointercancel",ke,!0),me.removeEventListener("keydown",De,!0)}},[i,N,R,pe,k,H]),A.useEffect(()=>{if(i||!d)return;function me(){ee.current=!0,ne.start(0,()=>{ee.current=!1})}function ke(je){const Te=je.relatedTarget,we=je.currentTarget,Ae=ni(je);queueMicrotask(()=>{const Ce=L(),Ze=E.context.triggerElements,nt=!(Dt(R,Te)||Dt(N,Te)||Dt(Te,N)||Dt(H==null?void 0:H.portalNode,Te)||Te!=null&&Ze.hasElement(Te)||Ze.hasMatchingElement(_e=>Dt(_e,Te))||Te!=null&&Te.hasAttribute(lp("focus-guard"))||$&&(ic($.nodesRef.current,Ce).find(_e=>{var rt,at;return Dt((rt=_e.context)==null?void 0:rt.elements.floating,Te)||Dt((at=_e.context)==null?void 0:at.elements.domReference,Te)})||pC($.nodesRef.current,Ce).find(_e=>{var rt,at,Lt;return[(rt=_e.context)==null?void 0:rt.elements.floating,cf((at=_e.context)==null?void 0:at.elements.floating)].includes(Te)||((Lt=_e.context)==null?void 0:Lt.elements.domReference)===Te})));if(we===R&&pe&&kC(pe,J),u&&we!==R&&!D4(Ae)&&jl(di(pe))===di(pe).body){if(Ln(pe)&&(pe.focus(),u==="popup")){se.request(()=>{pe.focus()});return}const _e=M.current,rt=xe(),at=rt[_e]||rt[rt.length-1]||pe;Ln(at)&&at.focus()}if(B.current.insideReactTree){B.current.insideReactTree=!1;return}(X||!f)&&Te&&nt&&!ee.current&&(X||Te!==My())&&(F.current=!0,E.setOpen(!1,tt(Pp,je)))})}function be(){G.current||(B.current.insideReactTree=!0,le.start(0,()=>{B.current.insideReactTree=!1}))}const De=Ln(R)?R:null,qe=[];if(!(!N&&!De))return De&&(De.addEventListener("focusout",ke),De.addEventListener("pointerdown",me),qe.push(()=>{De.removeEventListener("focusout",ke),De.removeEventListener("pointerdown",me)})),N&&(N.addEventListener("focusout",ke),H&&(N.addEventListener("focusout",be,!0),qe.push(()=>{N.removeEventListener("focusout",be,!0)})),qe.push(()=>{N.removeEventListener("focusout",ke)})),()=>{qe.forEach(je=>{je()})}},[i,R,N,pe,f,$,H,E,d,u,xe,X,L,J,B,le,ne,se]);const ie=A.useRef(null),ye=A.useRef(null),ve=Zl(ie,S,H==null?void 0:H.beforeInsideRef),Qe=Zl(ye,H==null?void 0:H.afterInsideRef);A.useEffect(()=>{var je,Te,we;if(i||!N||!k)return;const me=Array.from(((je=H==null?void 0:H.portalNode)==null?void 0:je.querySelectorAll(`[${lp("portal")}]`))||[]),be=(we=(Te=($?pC($.nodesRef.current,L()):[]).find(Ae=>{var Ce;return z0(((Ce=Ae.context)==null?void 0:Ce.elements.domReference)||null)}))==null?void 0:Te.context)==null?void 0:we.elements.domReference,De=[N,be,...me,...D(),z.current,Q.current,ie.current,ye.current,H==null?void 0:H.beforeOutsideRef.current,H==null?void 0:H.afterOutsideRef.current,Lo(v),Lo(b),X?R:null].filter(Ae=>Ae!=null),qe=E4(De,f||X);return()=>{qe()}},[k,i,R,N,f,J,H,X,$,L,D,b,v]),ze(()=>{if(!k||i||!Ln(pe))return;const me=di(pe),ke=jl(me);queueMicrotask(()=>{const be=fe(pe),De=V.current,qe=typeof De=="function"?De(ae.current||""):De;if(qe===void 0||qe===!1)return;let je;qe===!0||qe===null?je=be[0]||pe:je=Lo(qe),je=je||be[0]||pe,!Dt(pe,ke)&&Hd(je,{preventScroll:je===pe})})},[i,k,pe,j,fe,V,ae]),ze(()=>{if(i||!pe)return;const me=di(pe),ke=jl(me);M4(ke);function be(je){if(je.open||(U.current=O4(je.nativeEvent,te.current)),je.reason===TB&&je.nativeEvent.type==="mouseleave"&&(F.current=!0),je.reason===DE)if(je.nested)F.current=!1;else if(VE(je.nativeEvent)||_E(je.nativeEvent))F.current=!1;else{let Te=!1;document.createElement("div").focus({get preventScroll(){return Te=!0,!1}}),Te?F.current=!1:F.current=!0}}T.on("openchange",be);const De=me.createElement("span");De.setAttribute("tabindex","-1"),De.setAttribute("aria-hidden","true"),Object.assign(De.style,zf),he&&R&&R.insertAdjacentElement("afterend",De);function qe(){const je=K.current;let Te=typeof je=="function"?je(U.current):je;if(Te===void 0||Te===!1)return null;if(Te===null&&(Te=!0),typeof Te=="boolean"){const Ae=R||My();return Ae&&Ae.isConnected?Ae:De}const we=R||My()||De;return Lo(Te)||we}return()=>{T.off("openchange",be);const je=jl(me),Te=Dt(N,je)||$&&ic($.nodesRef.current,L(),!1).some(Ae=>{var Ce;return Dt((Ce=Ae.context)==null?void 0:Ce.elements.floating,je)}),we=qe();queueMicrotask(()=>{const Ae=N4(we),Ce=typeof K.current!="boolean";K.current&&!F.current&&Ln(Ae)&&(!(!Ce&&Ae!==je&&je!==me.body)||Te)&&Ae.focus({preventScroll:!0}),De.remove()})}},[i,N,pe,K,B,T,$,he,R,L]),A.useEffect(()=>{queueMicrotask(()=>{F.current=!1})},[i]),A.useEffect(()=>{if(i||!k)return;function me(be){const De=ni(be);De!=null&&De.closest(`[${tB}]`)&&(ee.current=!0)}const ke=di(pe);return ke.addEventListener("pointerdown",me,!0),()=>{ke.removeEventListener("pointerdown",me,!0)}},[i,k,pe]),ze(()=>{if(!i&&H)return H.setFocusManagerState({modal:f,closeOnFocusOut:d,open:k,onOpenChange:E.setOpen,domReference:R}),()=>{H.setFocusManagerState(null)}},[i,H,f,k,E,d,R]),ze(()=>{if(!(i||!pe))return kC(pe,J),()=>{queueMicrotask(sv)}},[i,pe,J]);const Re=!i&&(f?!X:!0)&&(he||f);return x.jsxs(A.Fragment,{children:[Re&&x.jsx(op,{"data-type":"inside",ref:ve,onFocus:me=>{var ke;if(f){const be=fe();Hd(be[be.length-1])}else if(H!=null&&H.portalNode)if(F.current=!1,Zu(me,H.portalNode)){const be=ZE(R);be==null||be.focus()}else(ke=Lo(v??H.beforeOutsideRef))==null||ke.focus()}}),t,Re&&x.jsx(op,{"data-type":"inside",ref:Qe,onFocus:me=>{var ke;if(f)Hd(fe()[0]);else if(H!=null&&H.portalNode)if(d&&(F.current=!0),Zu(me,H.portalNode)){const be=JE(R);be==null||be.focus()}else(ke=Lo(b??H.afterOutsideRef))==null||ke.focus()}})]})}function lv(n,e={}){const t="rootStore"in n?n.rootStore:n,i=t.context.dataRef,{enabled:r=!0,event:o="click",toggle:a=!0,ignoreMouse:u=!1,stickIfOpen:f=!0,touchOpenDelay:d=0}=e,p=A.useRef(void 0),g=qp(),b=$i(),v=A.useMemo(()=>({onPointerDown(S){p.current=S.pointerType},onMouseDown(S){const w=p.current,E=S.nativeEvent,k=t.select("open");if(S.button!==0||o==="click"||mC(w)&&u)return;const R=i.current.openEvent,N=R==null?void 0:R.type,T=t.select("domReferenceElement")!==S.currentTarget,B=k&&T||!(k&&a&&(!(R&&f)||N==="click"||N==="mousedown"));if(HE(E.target)){const D=tt(Wu,E,E.target);B&&w==="touch"&&d>0?b.start(d,()=>{t.setOpen(!0,D)}):t.setOpen(B,D);return}const L=S.currentTarget;g.request(()=>{const D=tt(Wu,E,L);B&&w==="touch"&&d>0?b.start(d,()=>{t.setOpen(!0,D)}):t.setOpen(B,D)})},onClick(S){if(o==="mousedown-only")return;const w=p.current;if(o==="mousedown"&&w){p.current=void 0;return}if(mC(w)&&u)return;const E=t.select("open"),k=i.current.openEvent,R=t.select("domReferenceElement")!==S.currentTarget,N=E&&R||!(E&&a&&(!(k&&f)||UE(k))),T=tt(Wu,S.nativeEvent,S.currentTarget);N&&w==="touch"&&d>0?b.start(d,()=>{t.setOpen(!0,T)}):t.setOpen(N,T)},onKeyDown(){p.current=void 0}}),[i,o,u,t,f,a,g,b,d]);return A.useMemo(()=>r?{reference:v}:_n,[r,v])}function AC(n,e,t){let{reference:i,floating:r}=n;const o=hs(e),a=nv(e),u=tv(a),f=Zi(e),d=o==="y",p=i.x+i.width/2-r.width/2,g=i.y+i.height/2-r.height/2,b=i[u]/2-r[u]/2;let v;switch(f){case"top":v={x:p,y:i.y-r.height};break;case"bottom":v={x:p,y:i.y+i.height};break;case"right":v={x:i.x+i.width,y:g};break;case"left":v={x:i.x-r.width,y:g};break;default:v={x:i.x,y:i.y}}switch(lo(e)){case"start":v[a]-=b*(t&&d?-1:1);break;case"end":v[a]+=b*(t&&d?-1:1);break}return v}async function j4(n,e){var t;e===void 0&&(e={});const{x:i,y:r,platform:o,rects:a,elements:u,strategy:f}=n,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:b=!1,padding:v=0}=qr(e,n),S=qE(v),E=u[b?g==="floating"?"reference":"floating":g],k=tp(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(E)))==null||t?E:E.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(u.floating)),boundary:d,rootBoundary:p,strategy:f})),R=g==="floating"?{x:i,y:r,width:a.floating.width,height:a.floating.height}:a.reference,N=await(o.getOffsetParent==null?void 0:o.getOffsetParent(u.floating)),T=await(o.isElement==null?void 0:o.isElement(N))?await(o.getScale==null?void 0:o.getScale(N))||{x:1,y:1}:{x:1,y:1},B=tp(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:R,offsetParent:N,strategy:f}):R);return{top:(k.top-B.top+S.top)/T.y,bottom:(B.bottom-k.bottom+S.bottom)/T.y,left:(k.left-B.left+S.left)/T.x,right:(B.right-k.right+S.right)/T.x}}const B4=50,L4=async(n,e,t)=>{const{placement:i="bottom",strategy:r="absolute",middleware:o=[],platform:a}=t,u=a.detectOverflow?a:{...a,detectOverflow:j4},f=await(a.isRTL==null?void 0:a.isRTL(e));let d=await a.getElementRects({reference:n,floating:e,strategy:r}),{x:p,y:g}=AC(d,i,f),b=i,v=0;const S={};for(let w=0;w<o.length;w++){const E=o[w];if(!E)continue;const{name:k,fn:R}=E,{x:N,y:T,data:B,reset:L}=await R({x:p,y:g,initialPlacement:i,placement:b,strategy:r,middlewareData:S,rects:d,platform:u,elements:{reference:n,floating:e}});p=N??p,g=T??g,S[k]={...S[k],...B},L&&v<B4&&(v++,typeof L=="object"&&(L.placement&&(b=L.placement),L.rects&&(d=L.rects===!0?await a.getElementRects({reference:n,floating:e,strategy:r}):L.rects),{x:p,y:g}=AC(d,b,f)),w=-1)}return{x:p,y:g,placement:b,strategy:r,middlewareData:S}},z4=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,i;const{placement:r,middlewareData:o,rects:a,initialPlacement:u,platform:f,elements:d}=e,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:b,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:S="none",flipAlignment:w=!0,...E}=qr(n,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const k=Zi(r),R=hs(u),N=Zi(u)===u,T=await(f.isRTL==null?void 0:f.isRTL(d.floating)),B=b||(N||!w?[ep(u)]:YB(u)),L=S!=="none";!b&&L&&B.push(...ZB(u,w,S,T));const D=[u,...B],j=await f.detectOverflow(e,E),X=[];let J=((i=o.flip)==null?void 0:i.overflows)||[];if(p&&X.push(j[k]),g){const $=KB(r,a,T);X.push(j[$[0]],j[$[1]])}if(J=[...J,{placement:r,overflows:X}],!X.every($=>$<=0)){var V,K;const $=(((V=o.flip)==null?void 0:V.index)||0)+1,H=D[$];if(H&&(!(g==="alignment"?R!==hs(H):!1)||J.every(F=>hs(F.placement)===R?F.overflows[0]>0:!0)))return{data:{index:$,overflows:J},reset:{placement:H}};let z=(K=J.filter(Q=>Q.overflows[0]<=0).sort((Q,F)=>Q.overflows[1]-F.overflows[1])[0])==null?void 0:K.placement;if(!z)switch(v){case"bestFit":{var ae;const Q=(ae=J.filter(F=>{if(L){const ee=hs(F.placement);return ee===R||ee==="y"}return!0}).map(F=>[F.placement,F.overflows.filter(ee=>ee>0).reduce((ee,G)=>ee+G,0)]).sort((F,ee)=>F[1]-ee[1])[0])==null?void 0:ae[0];Q&&(z=Q);break}case"initialPlacement":z=u;break}if(r!==z)return{reset:{placement:z}}}return{}}}};function EC(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function RC(n){return GB.some(e=>n[e]>=0)}const I4=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t,platform:i}=e,{strategy:r="referenceHidden",...o}=qr(n,e);switch(r){case"referenceHidden":{const a=await i.detectOverflow(e,{...o,elementContext:"reference"}),u=EC(a,t.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:RC(u)}}}case"escaped":{const a=await i.detectOverflow(e,{...o,altBoundary:!0}),u=EC(a,t.floating);return{data:{escapedOffsets:u,escaped:RC(u)}}}default:return{}}}}},i2=new Set(["left","top"]);async function P4(n,e){const{placement:t,platform:i,elements:r}=n,o=await(i.isRTL==null?void 0:i.isRTL(r.floating)),a=Zi(t),u=lo(t),f=hs(t)==="y",d=i2.has(a)?-1:1,p=o&&f?-1:1,g=qr(e,n);let{mainAxis:b,crossAxis:v,alignmentAxis:S}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return u&&typeof S=="number"&&(v=u==="end"?S*-1:S),f?{x:v*p,y:b*d}:{x:b*d,y:v*p}}const H4=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,i;const{x:r,y:o,placement:a,middlewareData:u}=e,f=await P4(e,n);return a===((t=u.offset)==null?void 0:t.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:r+f.x,y:o+f.y,data:{...f,placement:a}}}}},V4=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:i,placement:r,platform:o}=e,{mainAxis:a=!0,crossAxis:u=!1,limiter:f={fn:k=>{let{x:R,y:N}=k;return{x:R,y:N}}},...d}=qr(n,e),p={x:t,y:i},g=await o.detectOverflow(e,d),b=hs(Zi(r)),v=ev(b);let S=p[v],w=p[b];if(a){const k=v==="y"?"top":"left",R=v==="y"?"bottom":"right",N=S+g[k],T=S-g[R];S=I0(N,S,T)}if(u){const k=b==="y"?"top":"left",R=b==="y"?"bottom":"right",N=w+g[k],T=w-g[R];w=I0(N,w,T)}const E=f.fn({...e,[v]:S,[b]:w});return{...E,data:{x:E.x-t,y:E.y-i,enabled:{[v]:a,[b]:u}}}}}},_4=function(n){return n===void 0&&(n={}),{options:n,fn(e){const{x:t,y:i,placement:r,rects:o,middlewareData:a}=e,{offset:u=0,mainAxis:f=!0,crossAxis:d=!0}=qr(n,e),p={x:t,y:i},g=hs(r),b=ev(g);let v=p[b],S=p[g];const w=qr(u,e),E=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(f){const N=b==="y"?"height":"width",T=o.reference[b]-o.floating[N]+E.mainAxis,B=o.reference[b]+o.reference[N]-E.mainAxis;v<T?v=T:v>B&&(v=B)}if(d){var k,R;const N=b==="y"?"width":"height",T=i2.has(Zi(r)),B=o.reference[g]-o.floating[N]+(T&&((k=a.offset)==null?void 0:k[g])||0)+(T?0:E.crossAxis),L=o.reference[g]+o.reference[N]+(T?0:((R=a.offset)==null?void 0:R[g])||0)-(T?E.crossAxis:0);S<B?S=B:S>L&&(S=L)}return{[b]:v,[g]:S}}}},U4=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,i;const{placement:r,rects:o,platform:a,elements:u}=e,{apply:f=()=>{},...d}=qr(n,e),p=await a.detectOverflow(e,d),g=Zi(r),b=lo(r),v=hs(r)==="y",{width:S,height:w}=o.floating;let E,k;g==="top"||g==="bottom"?(E=g,k=b===(await(a.isRTL==null?void 0:a.isRTL(u.floating))?"start":"end")?"left":"right"):(k=g,E=b==="end"?"top":"bottom");const R=w-p.top-p.bottom,N=S-p.left-p.right,T=Ec(w-p[E],R),B=Ec(S-p[k],N),L=!e.middlewareData.shift;let D=T,j=B;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(j=N),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(D=R),L&&!b){const J=Wi(p.left,0),V=Wi(p.right,0),K=Wi(p.top,0),ae=Wi(p.bottom,0);v?j=S-2*(J!==0||V!==0?J+V:Wi(p.left,p.right)):D=w-2*(K!==0||ae!==0?K+ae:Wi(p.top,p.bottom))}await f({...e,availableWidth:j,availableHeight:D});const X=await a.getDimensions(u.floating);return S!==X.width||w!==X.height?{reset:{rects:!0}}:{}}}};function s2(n){const e=Ji(n);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const r=Ln(n),o=r?n.offsetWidth:t,a=r?n.offsetHeight:i,u=Jd(t)!==o||Jd(i)!==a;return u&&(t=o,i=a),{width:t,height:i,$:u}}function ov(n){return Zt(n)?n:n.contextElement}function rc(n){const e=ov(n);if(!Ln(e))return rr(1);const t=e.getBoundingClientRect(),{width:i,height:r,$:o}=s2(e);let a=(o?Jd(t.width):t.width)/i,u=(o?Jd(t.height):t.height)/r;return(!a||!Number.isFinite(a))&&(a=1),(!u||!Number.isFinite(u))&&(u=1),{x:a,y:u}}const q4=rr(0);function r2(n){const e=In(n);return!zp()||!e.visualViewport?q4:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function F4(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==In(n)?!1:e}function na(n,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),o=ov(n);let a=rr(1);e&&(i?Zt(i)&&(a=rc(i)):a=rc(n));const u=F4(o,t,i)?r2(o):rr(0);let f=(r.left+u.x)/a.x,d=(r.top+u.y)/a.y,p=r.width/a.x,g=r.height/a.y;if(o){const b=In(o),v=i&&Zt(i)?In(i):i;let S=b,w=B0(S);for(;w&&i&&v!==S;){const E=rc(w),k=w.getBoundingClientRect(),R=Ji(w),N=k.left+(w.clientLeft+parseFloat(R.paddingLeft))*E.x,T=k.top+(w.clientTop+parseFloat(R.paddingTop))*E.y;f*=E.x,d*=E.y,p*=E.x,g*=E.y,f+=N,d+=T,S=In(w),w=B0(S)}}return tp({width:p,height:g,x:f,y:d})}function Fp(n,e){const t=Ip(n).scrollLeft;return e?e.left+t:na(cr(n)).left+t}function l2(n,e){const t=n.getBoundingClientRect(),i=t.left+e.scrollLeft-Fp(n,t),r=t.top+e.scrollTop;return{x:i,y:r}}function G4(n){let{elements:e,rect:t,offsetParent:i,strategy:r}=n;const o=r==="fixed",a=cr(i),u=e?Lp(e.floating):!1;if(i===a||u&&o)return t;let f={scrollLeft:0,scrollTop:0},d=rr(1);const p=rr(0),g=Ln(i);if((g||!g&&!o)&&((ro(i)!=="body"||fa(a))&&(f=Ip(i)),g)){const v=na(i);d=rc(i),p.x=v.x+i.clientLeft,p.y=v.y+i.clientTop}const b=a&&!g&&!o?l2(a,f):rr(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-f.scrollLeft*d.x+p.x+b.x,y:t.y*d.y-f.scrollTop*d.y+p.y+b.y}}function Q4(n){return Array.from(n.getClientRects())}function K4(n){const e=cr(n),t=Ip(n),i=n.ownerDocument.body,r=Wi(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=Wi(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let a=-t.scrollLeft+Fp(n);const u=-t.scrollTop;return Ji(i).direction==="rtl"&&(a+=Wi(e.clientWidth,i.clientWidth)-r),{width:r,height:o,x:a,y:u}}const TC=25;function Y4(n,e){const t=In(n),i=cr(n),r=t.visualViewport;let o=i.clientWidth,a=i.clientHeight,u=0,f=0;if(r){o=r.width,a=r.height;const p=zp();(!p||p&&e==="fixed")&&(u=r.offsetLeft,f=r.offsetTop)}const d=Fp(i);if(d<=0){const p=i.ownerDocument,g=p.body,b=getComputedStyle(g),v=p.compatMode==="CSS1Compat"&&parseFloat(b.marginLeft)+parseFloat(b.marginRight)||0,S=Math.abs(i.clientWidth-g.clientWidth-v);S<=TC&&(o-=S)}else d<=TC&&(o+=d);return{width:o,height:a,x:u,y:f}}function W4(n,e){const t=na(n,!0,e==="fixed"),i=t.top+n.clientTop,r=t.left+n.clientLeft,o=Ln(n)?rc(n):rr(1),a=n.clientWidth*o.x,u=n.clientHeight*o.y,f=r*o.x,d=i*o.y;return{width:a,height:u,x:f,y:d}}function OC(n,e,t){let i;if(e==="viewport")i=Y4(n,t);else if(e==="document")i=K4(cr(n));else if(Zt(e))i=W4(e,t);else{const r=r2(n);i={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return tp(i)}function o2(n,e){const t=Ur(n);return t===e||!Zt(t)||Hr(t)?!1:Ji(t).position==="fixed"||o2(t,e)}function X4(n,e){const t=e.get(n);if(t)return t;let i=Wl(n,[],!1).filter(u=>Zt(u)&&ro(u)!=="body"),r=null;const o=Ji(n).position==="fixed";let a=o?Ur(n):n;for(;Zt(a)&&!Hr(a);){const u=Ji(a),f=$b(a);!f&&u.position==="fixed"&&(r=null),(o?!f&&!r:!f&&u.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||fa(a)&&!f&&o2(n,a))?i=i.filter(p=>p!==a):r=u,a=Ur(a)}return e.set(n,i),i}function $4(n){let{element:e,boundary:t,rootBoundary:i,strategy:r}=n;const a=[...t==="clippingAncestors"?Lp(e)?[]:X4(e,this._c):[].concat(t),i],u=OC(e,a[0],r);let f=u.top,d=u.right,p=u.bottom,g=u.left;for(let b=1;b<a.length;b++){const v=OC(e,a[b],r);f=Wi(v.top,f),d=Ec(v.right,d),p=Ec(v.bottom,p),g=Wi(v.left,g)}return{width:d-g,height:p-f,x:g,y:f}}function Z4(n){const{width:e,height:t}=s2(n);return{width:e,height:t}}function J4(n,e,t){const i=Ln(e),r=cr(e),o=t==="fixed",a=na(n,!0,o,e);let u={scrollLeft:0,scrollTop:0};const f=rr(0);function d(){f.x=Fp(r)}if(i||!i&&!o)if((ro(e)!=="body"||fa(r))&&(u=Ip(e)),i){const v=na(e,!0,o,e);f.x=v.x+e.clientLeft,f.y=v.y+e.clientTop}else r&&d();o&&!i&&r&&d();const p=r&&!i&&!o?l2(r,u):rr(0),g=a.left+u.scrollLeft-f.x-p.x,b=a.top+u.scrollTop-f.y-p.y;return{x:g,y:b,width:a.width,height:a.height}}function Ny(n){return Ji(n).position==="static"}function MC(n,e){if(!Ln(n)||Ji(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return cr(n)===t&&(t=t.ownerDocument.body),t}function a2(n,e){const t=In(n);if(Lp(n))return t;if(!Ln(n)){let r=Ur(n);for(;r&&!Hr(r);){if(Zt(r)&&!Ny(r))return r;r=Ur(r)}return t}let i=MC(n,e);for(;i&&gB(i)&&Ny(i);)i=MC(i,e);return i&&Hr(i)&&Ny(i)&&!$b(i)?t:i||vB(n)||t}const eL=async function(n){const e=this.getOffsetParent||a2,t=this.getDimensions,i=await t(n.floating);return{reference:J4(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function tL(n){return Ji(n).direction==="rtl"}const nL={convertOffsetParentRelativeRectToViewportRelativeRect:G4,getDocumentElement:cr,getClippingRect:$4,getOffsetParent:a2,getElementRects:eL,getClientRects:Q4,getDimensions:Z4,getScale:rc,isElement:Zt,isRTL:tL};function c2(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function iL(n,e){let t=null,i;const r=cr(n);function o(){var u;clearTimeout(i),(u=t)==null||u.disconnect(),t=null}function a(u,f){u===void 0&&(u=!1),f===void 0&&(f=1),o();const d=n.getBoundingClientRect(),{left:p,top:g,width:b,height:v}=d;if(u||e(),!b||!v)return;const S=Za(g),w=Za(r.clientWidth-(p+b)),E=Za(r.clientHeight-(g+v)),k=Za(p),N={rootMargin:-S+"px "+-w+"px "+-E+"px "+-k+"px",threshold:Wi(0,Ec(1,f))||1};let T=!0;function B(L){const D=L[0].intersectionRatio;if(D!==f){if(!T)return a();D?a(!1,D):i=setTimeout(()=>{a(!1,1e-7)},1e3)}D===1&&!c2(d,n.getBoundingClientRect())&&a(),T=!1}try{t=new IntersectionObserver(B,{...N,root:r.ownerDocument})}catch{t=new IntersectionObserver(B,N)}t.observe(n)}return a(!0),o}function NC(n,e,t,i){i===void 0&&(i={});const{ancestorScroll:r=!0,ancestorResize:o=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:f=!1}=i,d=ov(n),p=r||o?[...d?Wl(d):[],...e?Wl(e):[]]:[];p.forEach(k=>{r&&k.addEventListener("scroll",t,{passive:!0}),o&&k.addEventListener("resize",t)});const g=d&&u?iL(d,t):null;let b=-1,v=null;a&&(v=new ResizeObserver(k=>{let[R]=k;R&&R.target===d&&v&&e&&(v.unobserve(e),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var N;(N=v)==null||N.observe(e)})),t()}),d&&!f&&v.observe(d),e&&v.observe(e));let S,w=f?na(n):null;f&&E();function E(){const k=na(n);w&&!c2(w,k)&&t(),w=k,S=requestAnimationFrame(E)}return t(),()=>{var k;p.forEach(R=>{r&&R.removeEventListener("scroll",t),o&&R.removeEventListener("resize",t)}),g==null||g(),(k=v)==null||k.disconnect(),v=null,f&&cancelAnimationFrame(S)}}const sL=H4,rL=V4,lL=z4,oL=U4,aL=I4,cL=_4,uL=(n,e,t)=>{const i=new Map,r={platform:nL,...t},o={...r.platform,_c:i};return L4(n,e,{...r,platform:o})};var fL=typeof document<"u",hL=function(){},Vd=fL?A.useLayoutEffect:hL;function ap(n,e){if(n===e)return!0;if(typeof n!=typeof e)return!1;if(typeof n=="function"&&n.toString()===e.toString())return!0;let t,i,r;if(n&&e&&typeof n=="object"){if(Array.isArray(n)){if(t=n.length,t!==e.length)return!1;for(i=t;i--!==0;)if(!ap(n[i],e[i]))return!1;return!0}if(r=Object.keys(n),t=r.length,t!==Object.keys(e).length)return!1;for(i=t;i--!==0;)if(!{}.hasOwnProperty.call(e,r[i]))return!1;for(i=t;i--!==0;){const o=r[i];if(!(o==="_owner"&&n.$$typeof)&&!ap(n[o],e[o]))return!1}return!0}return n!==n&&e!==e}function u2(n){return typeof window>"u"?1:(n.ownerDocument.defaultView||window).devicePixelRatio||1}function DC(n,e){const t=u2(n);return Math.round(e*t)/t}function Dy(n){const e=A.useRef(n);return Vd(()=>{e.current=n}),e}function dL(n){n===void 0&&(n={});const{placement:e="bottom",strategy:t="absolute",middleware:i=[],platform:r,elements:{reference:o,floating:a}={},transform:u=!0,whileElementsMounted:f,open:d}=n,[p,g]=A.useState({x:0,y:0,strategy:t,placement:e,middlewareData:{},isPositioned:!1}),[b,v]=A.useState(i);ap(b,i)||v(i);const[S,w]=A.useState(null),[E,k]=A.useState(null),R=A.useCallback(F=>{F!==L.current&&(L.current=F,w(F))},[]),N=A.useCallback(F=>{F!==D.current&&(D.current=F,k(F))},[]),T=o||S,B=a||E,L=A.useRef(null),D=A.useRef(null),j=A.useRef(p),X=f!=null,J=Dy(f),V=Dy(r),K=Dy(d),ae=A.useCallback(()=>{if(!L.current||!D.current)return;const F={placement:e,strategy:t,middleware:b};V.current&&(F.platform=V.current),uL(L.current,D.current,F).then(ee=>{const G={...ee,isPositioned:K.current!==!1};$.current&&!ap(j.current,G)&&(j.current=G,Gr.flushSync(()=>{g(G)}))})},[b,e,t,V,K]);Vd(()=>{d===!1&&j.current.isPositioned&&(j.current.isPositioned=!1,g(F=>({...F,isPositioned:!1})))},[d]);const $=A.useRef(!1);Vd(()=>($.current=!0,()=>{$.current=!1}),[]),Vd(()=>{if(T&&(L.current=T),B&&(D.current=B),T&&B){if(J.current)return J.current(T,B,ae);ae()}},[T,B,ae,J,X]);const H=A.useMemo(()=>({reference:L,floating:D,setReference:R,setFloating:N}),[R,N]),z=A.useMemo(()=>({reference:T,floating:B}),[T,B]),Q=A.useMemo(()=>{const F={position:t,left:0,top:0};if(!z.floating)return F;const ee=DC(z.floating,p.x),G=DC(z.floating,p.y);return u?{...F,transform:"translate("+ee+"px, "+G+"px)",...u2(z.floating)>=1.5&&{willChange:"transform"}}:{position:t,left:ee,top:G}},[t,u,z.floating,p.x,p.y]);return A.useMemo(()=>({...p,update:ae,refs:H,elements:z,floatingStyles:Q}),[p,ae,H,z,Q])}const pL=(n,e)=>{const t=sL(n);return{name:t.name,fn:t.fn,options:[n,e]}},mL=(n,e)=>{const t=rL(n);return{name:t.name,fn:t.fn,options:[n,e]}},gL=(n,e)=>({fn:cL(n).fn,options:[n,e]}),yL=(n,e)=>{const t=lL(n);return{name:t.name,fn:t.fn,options:[n,e]}},bL=(n,e)=>{const t=oL(n);return{name:t.name,fn:t.fn,options:[n,e]}},vL=(n,e)=>{const t=aL(n);return{name:t.name,fn:t.fn,options:[n,e]}},xL={intentional:"onClick",sloppy:"onPointerDown"};function SL(n){return{escapeKey:typeof n=="boolean"?n:(n==null?void 0:n.escapeKey)??!1,outsidePress:typeof n=="boolean"?n:(n==null?void 0:n.outsidePress)??!0}}function av(n,e={}){const t="rootStore"in n?n.rootStore:n,i=t.useState("open"),r=t.useState("floatingElement"),o=t.useState("referenceElement"),a=t.useState("domReferenceElement"),{onOpenChange:u,dataRef:f}=t.context,{enabled:d=!0,escapeKey:p=!0,outsidePress:g=!0,outsidePressEvent:b="sloppy",referencePress:v=!1,referencePressEvent:S="sloppy",ancestorScroll:w=!1,bubbles:E,externalTree:k}=e,R=Up(k),N=He(typeof g=="function"?g:()=>!1),T=typeof g=="function"?N:g,B=A.useRef(!1),{escapeKey:L,outsidePress:D}=SL(E),j=A.useRef(null),X=$i(),J=$i(),V=He(()=>{J.clear(),f.current.insideReactTree=!1}),K=A.useRef(!1),ae=A.useRef(""),$=He(ie=>{ae.current=ie.pointerType}),H=He(()=>{const ie=ae.current,ye=ie==="pen"||!ie?"mouse":ie,ve=typeof b=="function"?b():b;return typeof ve=="string"?ve:ve[ye]}),z=He(ie=>{var me;if(!i||!d||!p||ie.key!=="Escape"||K.current)return;const ye=(me=f.current.floatingContext)==null?void 0:me.nodeId,ve=R?ic(R.nodesRef.current,ye):[];if(!L&&ve.length>0){let ke=!0;if(ve.forEach(be=>{var De;(De=be.context)!=null&&De.open&&!be.context.dataRef.current.__escapeKeyBubbles&&(ke=!1)}),!ke)return}const Qe=FB(ie)?ie.nativeEvent:ie,Re=tt(jE,Qe);t.setOpen(!1,Re),!L&&!Re.isPropagationAllowed&&ie.stopPropagation()}),Q=He(ie=>{const ye=H();return ye==="intentional"&&ie.type!=="click"||ye==="sloppy"&&ie.type==="click"}),F=He(()=>{f.current.insideReactTree=!0,J.start(0,V)}),ee=He((ie,ye=!1)=>{var je;if(Q(ie)){V();return}if(f.current.insideReactTree){V();return}if(H()==="intentional"&&ye||typeof T=="function"&&!T(ie))return;const ve=ni(ie),Qe=`[${lp("inert")}]`,Re=di(t.select("floatingElement")).querySelectorAll(Qe),me=t.context.triggerElements;if(ve&&(me.hasElement(ve)||me.hasMatchingElement(Te=>Dt(Te,ve))))return;let ke=Zt(ve)?ve:null;for(;ke&&!Hr(ke);){const Te=Ur(ke);if(Hr(Te)||!Zt(Te))break;ke=Te}if(Re.length&&Zt(ve)&&!qB(ve)&&!Dt(ve,t.select("floatingElement"))&&Array.from(Re).every(Te=>!Dt(ke,Te)))return;if(Ln(ve)&&!("touches"in ie)){const Te=Hr(ve),we=Ji(ve),Ae=/auto|scroll/,Ce=Te||Ae.test(we.overflowX),Ze=Te||Ae.test(we.overflowY),nt=Ce&&ve.clientWidth>0&&ve.scrollWidth>ve.clientWidth,_e=Ze&&ve.clientHeight>0&&ve.scrollHeight>ve.clientHeight,rt=we.direction==="rtl",at=_e&&(rt?ie.offsetX<=ve.offsetWidth-ve.clientWidth:ie.offsetX>ve.clientWidth),Lt=nt&&ie.offsetY>ve.clientHeight;if(at||Lt)return}const be=(je=f.current.floatingContext)==null?void 0:je.nodeId,De=R&&ic(R.nodesRef.current,be).some(Te=>{var we;return ks(ie,(we=Te.context)==null?void 0:we.elements.floating)});if(ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement"))||De)return;const qe=R?ic(R.nodesRef.current,be):[];if(qe.length>0){let Te=!0;if(qe.forEach(we=>{var Ae;(Ae=we.context)!=null&&Ae.open&&!we.context.dataRef.current.__outsidePressBubbles&&(Te=!1)}),!Te)return}t.setOpen(!1,tt(DE,ie)),V()}),G=He(ie=>{H()!=="sloppy"||ie.pointerType==="touch"||!t.select("open")||!d||ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement"))||ee(ie)}),M=He(ie=>{if(H()!=="sloppy"||!t.select("open")||!d||ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement")))return;const ye=ie.touches[0];ye&&(j.current={startTime:Date.now(),startX:ye.clientX,startY:ye.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},X.start(1e3,()=>{j.current&&(j.current.dismissOnTouchEnd=!1,j.current.dismissOnMouseDown=!1)}))}),U=He(ie=>{const ye=ni(ie);function ve(){M(ie),ye==null||ye.removeEventListener(ie.type,ve)}ye==null||ye.addEventListener(ie.type,ve)}),te=He(ie=>{const ye=B.current;if(B.current=!1,X.clear(),ie.type==="mousedown"&&j.current&&!j.current.dismissOnMouseDown)return;const ve=ni(ie);function Qe(){ie.type==="pointerdown"?G(ie):ee(ie,ye),ve==null||ve.removeEventListener(ie.type,Qe)}ve==null||ve.addEventListener(ie.type,Qe)}),le=He(ie=>{if(H()!=="sloppy"||!j.current||ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement")))return;const ye=ie.touches[0];if(!ye)return;const ve=Math.abs(ye.clientX-j.current.startX),Qe=Math.abs(ye.clientY-j.current.startY),Re=Math.sqrt(ve*ve+Qe*Qe);Re>5&&(j.current.dismissOnTouchEnd=!0),Re>10&&(ee(ie),X.clear(),j.current=null)}),ne=He(ie=>{const ye=ni(ie);function ve(){le(ie),ye==null||ye.removeEventListener(ie.type,ve)}ye==null||ye.addEventListener(ie.type,ve)}),se=He(ie=>{H()!=="sloppy"||!j.current||ks(ie,t.select("floatingElement"))||ks(ie,t.select("domReferenceElement"))||(j.current.dismissOnTouchEnd&&ee(ie),X.clear(),j.current=null)}),he=He(ie=>{const ye=ni(ie);function ve(){se(ie),ye==null||ye.removeEventListener(ie.type,ve)}ye==null||ye.addEventListener(ie.type,ve)});A.useEffect(()=>{if(!i||!d)return;f.current.__escapeKeyBubbles=L,f.current.__outsidePressBubbles=D;const ie=new Ac;function ye(ke){t.setOpen(!1,tt(Oi,ke))}function ve(){ie.clear(),K.current=!0}function Qe(){ie.start(zp()?5:0,()=>{K.current=!1})}const Re=di(r);Re.addEventListener("pointerdown",$,!0),p&&(Re.addEventListener("keydown",z),Re.addEventListener("compositionstart",ve),Re.addEventListener("compositionend",Qe)),T&&(Re.addEventListener("click",te,!0),Re.addEventListener("pointerdown",te,!0),Re.addEventListener("touchstart",U,!0),Re.addEventListener("touchmove",ne,!0),Re.addEventListener("touchend",he,!0),Re.addEventListener("mousedown",te,!0));let me=[];return w&&(Zt(a)&&(me=Wl(a)),Zt(r)&&(me=me.concat(Wl(r))),!Zt(o)&&o&&o.contextElement&&(me=me.concat(Wl(o.contextElement)))),me=me.filter(ke=>{var be;return ke!==((be=Re.defaultView)==null?void 0:be.visualViewport)}),me.forEach(ke=>{ke.addEventListener("scroll",ye,{passive:!0})}),()=>{Re.removeEventListener("pointerdown",$,!0),p&&(Re.removeEventListener("keydown",z),Re.removeEventListener("compositionstart",ve),Re.removeEventListener("compositionend",Qe)),T&&(Re.removeEventListener("click",te,!0),Re.removeEventListener("pointerdown",te,!0),Re.removeEventListener("touchstart",U,!0),Re.removeEventListener("touchmove",ne,!0),Re.removeEventListener("touchend",he,!0),Re.removeEventListener("mousedown",te,!0)),me.forEach(ke=>{ke.removeEventListener("scroll",ye)}),ie.clear()}},[f,r,o,a,p,T,i,u,w,d,L,D,z,ee,te,G,U,ne,he,$,t]),A.useEffect(V,[T,V]);const pe=A.useMemo(()=>({onKeyDown:z,...v&&{[xL[S]]:ie=>{t.setOpen(!1,tt(Wu,ie.nativeEvent))},...S!=="intentional"&&{onClick(ie){t.setOpen(!1,tt(Wu,ie.nativeEvent))}}}}),[z,t,v,S]),xe=He(ie=>{const ye=ni(ie.nativeEvent);!Dt(t.select("floatingElement"),ye)||ie.button!==0||(B.current=!0)}),fe=A.useMemo(()=>({onKeyDown:z,onPointerDown:xe,onMouseDown:xe,onMouseUp:xe,onClickCapture:F,onMouseDownCapture:F,onPointerDownCapture:F,onMouseUpCapture:F,onTouchEndCapture:F,onTouchMoveCapture:F}),[z,xe,F]);return A.useMemo(()=>d?{reference:pe,floating:fe,trigger:pe}:{},[d,pe,fe])}var cp=Symbol("NOT_FOUND");function wL(n,e=`expected a function, instead received ${typeof n}`){if(typeof n!="function")throw new TypeError(e)}function CL(n,e="expected all items to be functions, instead received the following types: "){if(!n.every(t=>typeof t=="function")){const t=n.map(i=>typeof i=="function"?`function ${i.name||"unnamed"}()`:typeof i).join(", ");throw new TypeError(`${e}[${t}]`)}}var jC=n=>Array.isArray(n)?n:[n];function kL(n){const e=Array.isArray(n[0])?n[0]:n;return CL(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function AL(n,e){const t=[],{length:i}=n;for(let r=0;r<i;r++)t.push(n[r].apply(null,e));return t}function EL(n){let e;return{get(t){return e&&n(e.key,t)?e.value:cp},put(t,i){e={key:t,value:i}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function RL(n,e){let t=[];function i(u){const f=t.findIndex(d=>e(u,d.key));if(f>-1){const d=t[f];return f>0&&(t.splice(f,1),t.unshift(d)),d.value}return cp}function r(u,f){i(u)===cp&&(t.unshift({key:u,value:f}),t.length>n&&t.pop())}function o(){return t}function a(){t=[]}return{get:i,put:r,getEntries:o,clear:a}}var TL=(n,e)=>n===e;function OL(n){return function(t,i){if(t===null||i===null||t.length!==i.length)return!1;const{length:r}=t;for(let o=0;o<r;o++)if(!n(t[o],i[o]))return!1;return!0}}function ML(n,e){const t=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:i=TL,maxSize:r=1,resultEqualityCheck:o}=t,a=OL(i);let u=0;const f=r<=1?EL(a):RL(r,a);function d(){let p=f.get(arguments);if(p===cp){if(p=n.apply(null,arguments),u++,o){const b=f.getEntries().find(v=>o(v.value,p));b&&(p=b.value,u!==0&&u--)}f.put(arguments,p)}return p}return d.clearCache=()=>{f.clear(),d.resetResultsCount()},d.resultsCount=()=>u,d.resetResultsCount=()=>{u=0},d}var NL=class{constructor(n){this.value=n}deref(){return this.value}},DL=()=>typeof WeakRef>"u"?NL:WeakRef,f2=DL(),jL=0,BC=1;function dd(){return{s:jL,v:void 0,o:null,p:null}}function BL(n){return n instanceof f2?n.deref():n}function LL(n,e={}){let t=dd();const{resultEqualityCheck:i}=e;let r,o=0;function a(){let u=t;const{length:f}=arguments;for(let g=0,b=f;g<b;g++){const v=arguments[g];if(typeof v=="function"||typeof v=="object"&&v!==null){let S=u.o;S===null&&(u.o=S=new WeakMap);const w=S.get(v);w===void 0?(u=dd(),S.set(v,u)):u=w}else{let S=u.p;S===null&&(u.p=S=new Map);const w=S.get(v);w===void 0?(u=dd(),S.set(v,u)):u=w}}const d=u;let p;if(u.s===BC)p=u.v;else if(p=n.apply(null,arguments),o++,i){const g=BL(r);g!=null&&i(g,p)&&(p=g,o!==0&&o--),r=typeof p=="object"&&p!==null||typeof p=="function"?new f2(p):p}return d.s=BC,d.v=p,p}return a.clearCache=()=>{t=dd(),a.resetResultsCount()},a.resultsCount=()=>o,a.resetResultsCount=()=>{o=0},a}function zL(n,...e){const t=typeof n=="function"?{memoize:n,memoizeOptions:e}:n,i=(...r)=>{let o=0,a=0,u,f={},d=r.pop();typeof d=="object"&&(f=d,d=r.pop()),wL(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const p={...t,...f},{memoize:g,memoizeOptions:b=[],argsMemoize:v=LL,argsMemoizeOptions:S=[]}=p,w=jC(b),E=jC(S),k=kL(r),R=g(function(){return o++,d.apply(null,arguments)},...w),N=v(function(){a++;const B=AL(k,arguments);return u=R.apply(null,B),u},...E);return Object.assign(N,{resultFunc:d,memoizedResultFunc:R,dependencies:k,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>u,recomputations:()=>o,resetRecomputations:()=>{o=0},memoize:g,argsMemoize:v})};return Object.assign(i,{withTypes:()=>i}),i}zL({memoize:ML,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const de=(n,e,t,i,r,o,...a)=>{if(a.length>0)throw new Error(ri(1));let u;if(n)u=n;else throw new Error("Missing arguments");return u};var jy={exports:{}},By={};/**
|
|
181
181
|
* @license React
|
|
182
182
|
* use-sync-external-store-shim/with-selector.production.js
|
|
183
183
|
*
|
|
@@ -185,7 +185,7 @@ Error generating stack: `+h.message+`
|
|
|
185
185
|
*
|
|
186
186
|
* This source code is licensed under the MIT license found in the
|
|
187
187
|
* LICENSE file in the root directory of this source tree.
|
|
188
|
-
*/var BC;function zL(){if(BC)return By;BC=1;var n=Rf(),e=TA();function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var i=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=n.useRef,a=n.useEffect,u=n.useMemo,f=n.useDebugValue;return By.useSyncExternalStoreWithSelector=function(d,p,g,b,v){var S=o(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=u(function(){function k(L){if(!R){if(R=!0,N=L,L=b(L),v!==void 0&&w.hasValue){var D=w.value;if(v(D,L))return T=D}return T=L}if(D=T,i(N,L))return D;var j=b(L);return v!==void 0&&v(D,j)?(N=L,D):(N=L,T=j)}var R=!1,N,T,B=g===void 0?null:g;return[function(){return k(p())},B===null?void 0:function(){return k(B())}]},[p,g,b,v]);var E=r(d,S[0],S[1]);return a(function(){w.hasValue=!0,w.value=E},[E]),f(E),E},By}var LC;function IL(){return LC||(LC=1,jy.exports=zL()),jy.exports}var PL=IL();const HL=Yb(19),VL=HL?_L:UL;function ge(n,e,t,i,r){return VL(n,e,t,i,r)}function _L(n,e,t,i,r){const o=A.useCallback(()=>e(n.getSnapshot(),t,i,r),[n,e,t,i,r]);return jb.useSyncExternalStore(n.subscribe,o,o)}function UL(n,e,t,i,r){return PL.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getSnapshot,o=>e(o,t,i,r))}class Zo{constructor(e){Kt(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Kt(this,"getSnapshot",()=>this.state);this.state=e,this.listeners=new Set,this.updateTick=0}setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const t=this.updateTick;for(const i of this.listeners){if(t!==this.updateTick)return;i(e)}}update(e){for(const t in e)if(!Object.is(this.state[t],e[t])){Zo.prototype.setState.call(this,{...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||Zo.prototype.setState.call(this,{...this.state,[e]:t})}notifyAll(){const e={...this.state};Zo.prototype.setState.call(this,e)}}class f2 extends Zo{constructor(t,i={},r){super(t);Kt(this,"controlledValues",new Map);Kt(this,"select",(t,i,r,o)=>{const a=this.selectors[t];return a(this.state,i,r,o)});Kt(this,"useState",(t,i,r,o)=>{A.useDebugValue(t);const a=this.selectors[t];return ge(this,a,i,r,o)});this.context=i,this.selectors=r}useSyncedValue(t,i){A.useDebugValue(t),ze(()=>{this.state[t]!==i&&this.set(t,i)},[t,i])}useSyncedValueWithCleanup(t,i){ze(()=>(this.state[t]!==i&&this.set(t,i),()=>{this.set(t,void 0)}),[t,i])}useSyncedValues(t){const i=Object.values(t);ze(()=>{this.update(t)},i)}useControlledProp(t,i,r){A.useDebugValue(t);const o=i!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,o),!o&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),ze(()=>{o&&!Object.is(this.state[t],i)&&super.setState({...this.state,[t]:i})},[t,i,r,o])}set(t,i){this.controlledValues.get(t)!==!0&&super.set(t,i)}update(t){const i={...t};for(const r in i)if(Object.hasOwn(i,r)&&this.controlledValues.get(r)===!0){delete i[r];continue}super.update(i)}setState(t){const i={...t};for(const r in i)if(Object.hasOwn(i,r)&&this.controlledValues.get(r)===!0){delete i[r];continue}super.setState({...this.state,...i})}useContextCallback(t,i){A.useDebugValue(t);const r=He(i??un);this.context[t]=r}useStateSetter(t){const i=A.useRef(void 0);return i.current===void 0&&(i.current=r=>{this.set(t,r)}),i.current}observe(t,i){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return i(o,o,this),this.subscribe(a=>{const u=r(a);if(!Object.is(o,u)){const f=o;o=u,i(u,f,this)}})}}const qL={open:de(n=>n.open),domReferenceElement:de(n=>n.domReferenceElement),referenceElement:de(n=>n.positionReference??n.referenceElement),floatingElement:de(n=>n.floatingElement),floatingId:de(n=>n.floatingId)};class cv extends f2{constructor(t){const{nested:i,noEmit:r,onOpenChange:o,triggerElements:a,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:v4(),nested:i,noEmit:r,triggerElements:a},qL);Kt(this,"setOpen",(t,i)=>{var r,o;if((!t||!this.state.open||_E(i.event))&&(this.context.dataRef.current.openEvent=t?i.event:void 0),!this.context.noEmit){const a={open:t,reason:i.reason,nativeEvent:i.event,nested:this.context.nested,triggerElement:i.trigger};this.context.events.emit("openchange",a)}(o=(r=this.context).onOpenChange)==null||o.call(r,t,i)})}}function Gp(n,e=!1,t=!1){const[i,r]=A.useState(n&&e?"idle":void 0),[o,a]=A.useState(n);return n&&!o&&(a(!0),r("starting")),!n&&o&&i!=="ending"&&!t&&r("ending"),!n&&!o&&i==="ending"&&r(void 0),ze(()=>{if(!n&&o&&i!=="ending"&&t){const u=Zs.request(()=>{r("ending")});return()=>{Zs.cancel(u)}}},[n,o,i,t]),ze(()=>{if(!n||e)return;const u=Zs.request(()=>{Gr.flushSync(()=>{r(void 0)})});return()=>{Zs.cancel(u)}},[e,n]),ze(()=>{if(!n||!e)return;n&&o&&i!=="idle"&&r("starting");const u=Zs.request(()=>{r("idle")});return()=>{Zs.cancel(u)}},[e,n,o,r,i]),A.useMemo(()=>({mounted:o,setMounted:a,transitionStatus:i}),[o,i])}function FL(n,e=!1,t=!0){const i=qp();return He((r,o=null)=>{i.cancel();const a=Lo(n);a!=null&&(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?r():i.request(()=>{function u(){a&&Promise.all(a.getAnimations().map(f=>f.finished)).then(()=>{o!=null&&o.aborted||Gr.flushSync(r)}).catch(()=>{if(t){if(o!=null&&o.aborted)return;Gr.flushSync(r)}else a.getAnimations().length>0&&a.getAnimations().some(f=>f.pending||f.playState!=="finished")&&u()})}e?i.request(u):u()}))})}function da(n){const{enabled:e=!0,open:t,ref:i,onComplete:r}=n,o=Vn(t),a=He(r),u=FL(i,t);A.useEffect(()=>{e&&u(()=>{t===o.current&&a()})},[e,t,a,u,o])}function GL(n){const e=n.useState("open");ze(()=>{if(e&&!n.select("activeTriggerId")&&n.context.triggerElements.size===1){const t=n.context.triggerElements.entries().next();if(!t.done){const[i,r]=t.value;n.update({activeTriggerId:i,activeTriggerElement:r})}}},[e,n])}function QL(n,e,t){const{mounted:i,setMounted:r,transitionStatus:o}=Gp(n);e.useSyncedValues({mounted:i,transitionStatus:o});const a=He(()=>{var f,d;r(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),t==null||t(),(d=(f=e.context).onOpenChangeComplete)==null||d.call(f,!1)}),u=e.useState("preventUnmountingOnClose");return da({enabled:!u,open:n,ref:e.context.popupRef,onComplete(){n||a()}}),{forceUnmount:a,transitionStatus:o}}class uv{constructor(){this.elements=new Set,this.idMap=new Map}add(e,t){const i=this.idMap.get(e);i!==t&&(i!==void 0&&this.elements.delete(i),this.elements.add(t),this.idMap.set(e,t))}delete(e){const t=this.idMap.get(e);t&&(this.elements.delete(t),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(const t of this.elements)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function KL(){return new cv({open:!1,floatingElement:null,referenceElement:null,triggerElements:new uv,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function YL(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:KL(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:_n,inactiveTriggerProps:_n,popupProps:_n}}const WL={open:de(n=>n.open),mounted:de(n=>n.mounted),transitionStatus:de(n=>n.transitionStatus),floatingRootContext:de(n=>n.floatingRootContext),preventUnmountingOnClose:de(n=>n.preventUnmountingOnClose),payload:de(n=>n.payload),activeTriggerId:de(n=>n.activeTriggerId),activeTriggerElement:de(n=>n.mounted?n.activeTriggerElement:null),isTriggerActive:de((n,e)=>e!==void 0&&n.activeTriggerId===e),isOpenedByTrigger:de((n,e)=>e!==void 0&&n.activeTriggerId===e&&n.open),isMountedByTrigger:de((n,e)=>e!==void 0&&n.activeTriggerId===e&&n.mounted),triggerProps:de((n,e)=>e?n.activeTriggerProps:n.inactiveTriggerProps),popupProps:de(n=>n.popupProps),popupElement:de(n=>n.popupElement),positionerElement:de(n=>n.positionerElement)};function fv(n){const{open:e=!1,onOpenChange:t,elements:i={}}=n,r=jf(),o=_p()!=null,a=Bi(()=>new cv({open:e,onOpenChange:t,referenceElement:i.reference??null,floatingElement:i.floating??null,triggerElements:i.triggers??new uv,floatingId:r,nested:o,noEmit:n.noEmit||!1})).current;return ze(()=>{const u={open:e,floatingId:r};i.reference!==void 0&&(u.referenceElement=i.reference,u.domReferenceElement=Zt(i.reference)?i.reference:null),i.floating!==void 0&&(u.floatingElement=i.floating),a.update(u)},[e,r,i.reference,i.floating,a]),a.context.onOpenChange=t,a.context.nested=o,a.context.noEmit=n.noEmit||!1,a}function XL(n={}){const{nodeId:e,externalTree:t}=n,i=fv(n),r=n.rootContext||i,o={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[a,u]=A.useState(null),f=A.useRef(null),d=Up(t);ze(()=>{o.domReference&&(f.current=o.domReference)},[o.domReference]);const p=hL({...n,elements:{...o,...a&&{reference:a}}}),g=A.useCallback(D=>{const j=Zt(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;u(j),p.refs.setReference(j)},[p.refs]),[b,v]=A.useState(null),[S,w]=A.useState(null);r.useSyncedValue("referenceElement",b),r.useSyncedValue("domReferenceElement",Zt(b)?b:null),r.useSyncedValue("floatingElement",S);const E=A.useCallback(D=>{(Zt(D)||D===null)&&(f.current=D,v(D)),(Zt(p.refs.reference.current)||p.refs.reference.current===null||D!==null&&!Zt(D))&&p.refs.setReference(D)},[p.refs,v]),k=A.useCallback(D=>{w(D),p.refs.setFloating(D)},[p.refs]),R=A.useMemo(()=>({...p.refs,setReference:E,setFloating:k,setPositionReference:g,domReference:f}),[p.refs,E,k,g]),N=A.useMemo(()=>({...p.elements,domReference:o.domReference}),[p.elements,o.domReference]),T=r.useState("open"),B=r.useState("floatingId"),L=A.useMemo(()=>({...p,dataRef:r.context.dataRef,open:T,onOpenChange:r.setOpen,events:r.context.events,floatingId:B,refs:R,elements:N,nodeId:e,rootStore:r}),[p,R,N,e,r,T,B]);return ze(()=>{r.context.dataRef.current.floatingContext=L;const D=d==null?void 0:d.nodesRef.current.find(j=>j.id===e);D&&(D.context=L)}),A.useMemo(()=>({...p,context:L,refs:R,elements:N,rootStore:r}),[p,R,N,L,r])}function $L(n){const{popupStore:e,noEmit:t=!1,treatPopupAsFloatingElement:i=!1,onOpenChange:r}=n,o=jf(),a=_p()!=null,u=e.useState("open"),f=e.useState("activeTriggerElement"),d=e.useState(i?"popupElement":"positionerElement"),p=e.context.triggerElements,g=Bi(()=>new cv({open:u,referenceElement:f,floatingElement:d,triggerElements:p,onOpenChange:r,floatingId:o,nested:a,noEmit:t})).current;return ze(()=>{const b={open:u,floatingId:o,referenceElement:f,floatingElement:d};Zt(f)&&(b.domReferenceElement=f),g.update(b)},[u,o,f,d,g]),g.context.onOpenChange=r,g.context.nested=a,g.context.noEmit=t,g}function hv(n=[]){const e=n.map(d=>d==null?void 0:d.reference),t=n.map(d=>d==null?void 0:d.floating),i=n.map(d=>d==null?void 0:d.item),r=n.map(d=>d==null?void 0:d.trigger),o=A.useCallback(d=>pd(d,n,"reference"),e),a=A.useCallback(d=>pd(d,n,"floating"),t),u=A.useCallback(d=>pd(d,n,"item"),i),f=A.useCallback(d=>pd(d,n,"trigger"),r);return A.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:u,getTriggerProps:f}),[o,a,u,f])}function pd(n,e,t){var a;const i=new Map,r=t==="item",o={};t==="floating"&&(o.tabIndex=-1,o[L0]="");for(const u in n)r&&n&&(u===zE||u===IE)||(o[u]=n[u]);for(let u=0;u<e.length;u+=1){let f;const d=(a=e[u])==null?void 0:a[t];typeof d=="function"?f=n?d(n):null:f=d,f&&zC(o,f,r,i)}return zC(o,n,r,i),o}function zC(n,e,t,i){var r;for(const o in e){const a=e[o];t&&(o===zE||o===IE)||(o.startsWith("on")?(i.has(o)||i.set(o,[]),typeof a=="function"&&((r=i.get(o))==null||r.push(a),n[o]=(...u)=>{var f;return(f=i.get(o))==null?void 0:f.map(d=>d(...u)).find(d=>d!==void 0)})):n[o]=a)}}const ZL="Escape";function Qp(n,e,t){switch(n){case"vertical":return e;case"horizontal":return t;default:return e||t}}function md(n,e){return Qp(e,n===Jb||n===Bf,n===Xl||n===$l)}function Ly(n,e,t){return Qp(e,n===Bf,t?n===Xl:n===$l)||n==="Enter"||n===" "||n===""}function JL(n,e,t){return Qp(e,t?n===Xl:n===$l,n===Bf)}function ez(n,e,t,i){const r=t?n===$l:n===Xl,o=n===Jb;return e==="both"||e==="horizontal"&&i&&i>1?n===ZL:Qp(e,r,o)}function h2(n,e){const t="rootStore"in n?n.rootStore:n,i=t.useState("open"),r=t.useState("floatingElement"),o=t.useState("domReferenceElement"),a=t.context.dataRef,{listRef:u,activeIndex:f,onNavigate:d=()=>{},enabled:p=!0,selectedIndex:g=null,allowEscape:b=!1,loopFocus:v=!1,nested:S=!1,rtl:w=!1,virtual:E=!1,focusItemOnOpen:k="auto",focusItemOnHover:R=!0,openOnArrowKeyDown:N=!0,disabledIndices:T=void 0,orientation:B="vertical",parentOrientation:L,cols:D=1,scrollItemIntoView:j=!0,itemSizes:X,dense:J=!1,id:V,resetOnPointerLeave:K=!0,externalTree:ae}=e,$=cf(r),H=Vn($),z=_p(),Q=Up(ae);ze(()=>{a.current.orientation=B},[a,B]);const F=z0(o),ee=A.useRef(k),G=A.useRef(g??-1),M=A.useRef(null),U=A.useRef(!0),te=He(we=>{d(G.current===-1?null:G.current,we)}),le=A.useRef(te),ne=A.useRef(!!r),se=A.useRef(i),he=A.useRef(!1),pe=A.useRef(!1),xe=Vn(T),fe=Vn(i),ie=Vn(j),ye=Vn(g),ve=Vn(K),Qe=He(()=>{function we(nt){E?Q==null||Q.events.emit("virtualfocus",nt):Hd(nt,{sync:he.current,preventScroll:!0})}const Ae=u.current[G.current],Ce=pe.current;Ae&&we(Ae),(he.current?nt=>nt():requestAnimationFrame)(()=>{var at;const nt=u.current[G.current]||Ae;if(!nt)return;Ae||we(nt);const _e=ie.current;_e&&me&&(Ce||!U.current)&&((at=nt.scrollIntoView)==null||at.call(nt,typeof _e=="boolean"?{block:"nearest",inline:"nearest"}:_e))})});ze(()=>{p&&(i&&r?(G.current=g??-1,ee.current&&g!=null&&(pe.current=!0,te())):ne.current&&(G.current=-1,le.current()))},[p,i,r,g,te]),ze(()=>{if(p){if(!i){he.current=!1;return}if(r)if(f==null){if(he.current=!1,ye.current!=null)return;if(ne.current&&(G.current=-1,Qe()),(!se.current||!ne.current)&&ee.current&&(M.current!=null||ee.current===!0&&M.current==null)){let we=0;const Ae=()=>{u.current[0]==null?(we<2&&(we?requestAnimationFrame:queueMicrotask)(Ae),we+=1):(G.current=M.current==null||Ly(M.current,B,w)||S?Ty(u):yC(u),M.current=null,te())};Ae()}}else Xu(u,f)||(G.current=f,Qe(),pe.current=!1)}},[p,i,r,f,ye,S,u,B,w,te,Qe,xe]),ze(()=>{var nt,_e;if(!p||r||!Q||E||!ne.current)return;const we=Q.nodesRef.current,Ae=(_e=(nt=we.find(rt=>rt.id===z))==null?void 0:nt.context)==null?void 0:_e.elements.floating,Ce=jl(di(r)),Ze=we.some(rt=>rt.context&&Dt(rt.context.elements.floating,Ce));Ae&&!Ze&&U.current&&Ae.focus({preventScroll:!0})},[p,r,Q,z,E]),ze(()=>{le.current=te,se.current=i,ne.current=!!r}),ze(()=>{i||(M.current=null,ee.current=k)},[i,k]);const Re=f!=null,me=A.useMemo(()=>{function we(Ce){if(!fe.current)return;const Ze=u.current.indexOf(Ce.currentTarget);Ze!==-1&&G.current!==Ze&&(G.current=Ze,te(Ce))}return{onFocus(Ce){he.current=!0,we(Ce)},onClick:({currentTarget:Ce})=>Ce.focus({preventScroll:!0}),onMouseMove(Ce){he.current=!0,pe.current=!1,R&&we(Ce)},onPointerLeave(Ce){var nt;if(!fe.current||!U.current||Ce.pointerType==="touch")return;he.current=!0;const Ze=Ce.relatedTarget;!R||u.current.includes(Ze)||ve.current&&(G.current=-1,te(Ce),E||(nt=H.current)==null||nt.focus({preventScroll:!0}))}}},[fe,H,R,u,te,ve,E]),ke=A.useCallback(()=>{var we,Ae,Ce;return L??((Ce=(Ae=(we=Q==null?void 0:Q.nodesRef.current.find(Ze=>Ze.id===z))==null?void 0:we.context)==null?void 0:Ae.dataRef)==null?void 0:Ce.current.orientation)},[z,Q,L]),be=He(we=>{if(U.current=!1,he.current=!0,we.which===229||!fe.current&&we.currentTarget===H.current)return;if(S&&ez(we.key,B,w,D)){md(we.key,ke())||bn(we),t.setOpen(!1,tt(Pd,we.nativeEvent)),Ln(o)&&(E?Q==null||Q.events.emit("virtualfocus",o):o.focus());return}const Ae=G.current,Ce=Ty(u,T),Ze=yC(u,T);if(F||(we.key==="Home"&&(bn(we),G.current=Ce,te(we)),we.key==="End"&&(bn(we),G.current=Ze,te(we))),D>1){const nt=X||Array.from({length:u.current.length},()=>({width:1,height:1})),_e=e4(nt,D,J),rt=_e.findIndex(nn=>nn!=null&&!$u(u,nn,T)),at=_e.reduce((nn,ht,Ue)=>ht!=null&&!$u(u,ht,T)?Ue:nn,-1),Lt=_e[JB({current:_e.map(nn=>nn!=null?u.current[nn]:null)},{event:we,orientation:B,loopFocus:v,rtl:w,cols:D,disabledIndices:n4([...(typeof T!="function"?T:null)||u.current.map((nn,ht)=>$u(u,ht,T)?ht:void 0),void 0],_e),minIndex:rt,maxIndex:at,prevIndex:t4(G.current>Ze?Ce:G.current,nt,_e,D,we.key===Bf?"bl":we.key===(w?Xl:$l)?"tr":"tl"),stopEvent:!0})];if(Lt!=null&&(G.current=Lt,te(we)),B==="both")return}if(md(we.key,B)){if(bn(we),i&&!E&&jl(we.currentTarget.ownerDocument)===we.currentTarget){G.current=Ly(we.key,B,w)?Ce:Ze,te(we);return}Ly(we.key,B,w)?v?Ae>=Ze?b&&Ae!==u.current.length?G.current=-1:(he.current=!1,G.current=Ce):G.current=ei(u,{startingIndex:Ae,disabledIndices:T}):G.current=Math.min(Ze,ei(u,{startingIndex:Ae,disabledIndices:T})):v?Ae<=Ce?b&&Ae!==-1?G.current=u.current.length:(he.current=!1,G.current=Ze):G.current=ei(u,{startingIndex:Ae,decrement:!0,disabledIndices:T}):G.current=Math.max(Ce,ei(u,{startingIndex:Ae,decrement:!0,disabledIndices:T})),Xu(u,G.current)&&(G.current=-1),te(we)}}),De=A.useMemo(()=>E&&i&&Re&&{"aria-activedescendant":`${V}-${f}`},[E,i,Re,V,f]),qe=A.useMemo(()=>({"aria-orientation":B==="both"?void 0:B,...F?{}:De,onKeyDown(we){if(we.key==="Tab"&&we.shiftKey&&i&&!E){const Ae=ni(we.nativeEvent);if(Ae&&!Dt(H.current,Ae))return;bn(we),t.setOpen(!1,tt(Pp,we.nativeEvent)),Ln(o)&&o.focus();return}be(we)},onPointerMove(){U.current=!0}}),[De,be,H,B,F,t,i,E,o]),je=A.useMemo(()=>{function we(Ce){k==="auto"&&HE(Ce.nativeEvent)&&(ee.current=!E)}function Ae(Ce){ee.current=k,k==="auto"&&VE(Ce.nativeEvent)&&(ee.current=!0)}return{onKeyDown(Ce){const Ze=t.select("open");U.current=!1;const nt=Ce.key.startsWith("Arrow"),_e=JL(Ce.key,ke(),w),rt=md(Ce.key,B),at=(S?_e:rt)||Ce.key==="Enter"||Ce.key.trim()==="";if(E&&Ze)return be(Ce);if(!(!Ze&&!N&&nt)){if(at){const Lt=md(Ce.key,ke());M.current=S&&Lt?null:Ce.key}if(S){_e&&(bn(Ce),Ze?(G.current=Ty(u,xe.current),te(Ce)):t.setOpen(!0,tt(Pd,Ce.nativeEvent,Ce.currentTarget)));return}rt&&(ye.current!=null&&(G.current=ye.current),bn(Ce),!Ze&&N?t.setOpen(!0,tt(Pd,Ce.nativeEvent,Ce.currentTarget)):be(Ce),Ze&&te(Ce))}},onFocus(Ce){t.select("open")&&!E&&(G.current=-1,te(Ce))},onPointerDown:Ae,onPointerEnter:Ae,onMouseDown:we,onClick:we}},[be,xe,k,u,S,te,t,N,B,ke,w,ye,E]),Te=A.useMemo(()=>({...De,...je}),[De,je]);return A.useMemo(()=>p?{reference:Te,floating:qe,item:me,trigger:je}:{},[p,Te,qe,je,me])}const tz=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function nz(n,e={}){const t="rootStore"in n?n.rootStore:n,i=t.useState("open"),r=t.useState("floatingId"),o=t.useState("domReferenceElement"),a=t.useState("floatingElement"),{enabled:u=!0,role:f="dialog"}=e,d=jf(),p=(o==null?void 0:o.id)||d,g=A.useMemo(()=>{var N;return((N=cf(a))==null?void 0:N.id)||r},[a,r]),b=tz.get(f)??f,S=_p()!=null,w=A.useMemo(()=>b==="tooltip"||f==="label"?_n:{"aria-haspopup":b==="alertdialog"?"dialog":b,"aria-expanded":"false",...b==="listbox"&&{role:"combobox"},...b==="menu"&&S&&{role:"menuitem"},...f==="select"&&{"aria-autocomplete":"none"},...f==="combobox"&&{"aria-autocomplete":"list"}},[b,S,f]),E=A.useMemo(()=>b==="tooltip"||f==="label"?{[`aria-${f==="label"?"labelledby":"describedby"}`]:i?g:void 0}:{...w,"aria-expanded":i?"true":"false","aria-controls":i?g:void 0,...b==="menu"&&{id:p}},[b,g,i,p,f,w]),k=A.useMemo(()=>{const N={id:g,...b&&{role:b}};return b==="tooltip"||f==="label"?N:{...N,...b==="menu"&&{"aria-labelledby":p}}},[b,g,p,f]),R=A.useCallback(({active:N,selected:T})=>{const B={role:"option",...N&&{id:`${g}-fui-option`}};switch(f){case"select":case"combobox":return{...B,"aria-selected":T}}return{}},[g,f]);return A.useMemo(()=>u?{reference:E,floating:k,item:R,trigger:w}:{},[u,E,k,w,R])}function d2(n,e){const t="rootStore"in n?n.rootStore:n,i=t.useState("open"),r=t.context.dataRef,{listRef:o,activeIndex:a,onMatch:u,onTypingChange:f,enabled:d=!0,findMatch:p=null,resetMs:g=750,ignoreKeys:b=Dl,selectedIndex:v=null}=e,S=$i(),w=A.useRef(""),E=A.useRef(v??a??-1),k=A.useRef(null);ze(()=>{i&&(S.clear(),k.current=null,w.current="")},[i,S]),ze(()=>{i&&w.current===""&&(E.current=v??a??-1)},[i,v,a]);const R=He(L=>{L?r.current.typing||(r.current.typing=L,f==null||f(L)):r.current.typing&&(r.current.typing=L,f==null||f(L))}),N=He(L=>{function D(K,ae,$){const H=p?p(ae,$):ae.find(z=>(z==null?void 0:z.toLocaleLowerCase().indexOf($.toLocaleLowerCase()))===0);return H?K.indexOf(H):-1}const j=o.current;if(w.current.length>0&&w.current[0]!==" "&&(D(j,j,w.current)===-1?R(!1):L.key===" "&&bn(L)),j==null||b.includes(L.key)||L.key.length!==1||L.ctrlKey||L.metaKey||L.altKey)return;i&&L.key!==" "&&(bn(L),R(!0)),j.every(K=>{var ae,$;return K?((ae=K[0])==null?void 0:ae.toLocaleLowerCase())!==(($=K[1])==null?void 0:$.toLocaleLowerCase()):!0})&&w.current===L.key&&(w.current="",E.current=k.current),w.current+=L.key,S.start(g,()=>{w.current="",E.current=k.current,R(!1)});const J=E.current,V=D(j,[...j.slice((J||0)+1),...j.slice(0,(J||0)+1)],w.current);V!==-1?(u==null||u(V),k.current=V):L.key!==" "&&(w.current="",R(!1))}),T=A.useMemo(()=>({onKeyDown:N}),[N]),B=A.useMemo(()=>({onKeyDown:N,onKeyUp(L){L.key===" "&&R(!1)}}),[N,R]);return A.useMemo(()=>d?{reference:T,floating:B}:{},[d,T,B])}let iz=(function(n){return n.nestedDialogs="--nested-dialogs",n})({}),sz=(function(n){return n[n.open=Ho.open]="open",n[n.closed=Ho.closed]="closed",n[n.startingStyle=Ho.startingStyle]="startingStyle",n[n.endingStyle=Ho.endingStyle]="endingStyle",n.nested="data-nested",n.nestedDialogOpen="data-nested-dialog-open",n})({});const p2=A.createContext(void 0);function rz(){const n=A.useContext(p2);if(n===void 0)throw new Error(ri(26));return n}const m2="ArrowUp",g2="ArrowDown",y2="ArrowLeft",b2="ArrowRight",v2="Home",x2="End",lz=new Set([y2,b2]),oz=new Set([m2,g2]),az=new Set([...lz,...oz]);[...az];const S2=new Set([m2,g2,y2,b2,v2,x2]),cz={...Pc,...Nf,nestedDialogOpen(n){return n?{[sz.nestedDialogOpen]:""}:null}},uz=A.forwardRef(function(e,t){const{className:i,finalFocus:r,initialFocus:o,render:a,...u}=e,{store:f}=Mf(),d=f.useState("descriptionElementId"),p=f.useState("disablePointerDismissal"),g=f.useState("floatingRootContext"),b=f.useState("popupProps"),v=f.useState("modal"),S=f.useState("mounted"),w=f.useState("nested"),E=f.useState("nestedOpenDialogCount"),k=f.useState("open"),R=f.useState("openMethod"),N=f.useState("titleElementId"),T=f.useState("transitionStatus"),B=f.useState("role");rz(),da({open:k,ref:f.context.popupRef,onComplete(){var V,K;k&&((K=(V=f.context).onOpenChangeComplete)==null||K.call(V,!0))}});function L(V){return V==="touch"?f.context.popupRef.current:!0}const D=o===void 0?L:o,j=E>0,X=A.useMemo(()=>({open:k,nested:w,transitionStatus:T,nestedDialogOpen:j}),[k,w,T,j]),J=wn("div",e,{state:X,props:[b,{"aria-labelledby":N??void 0,"aria-describedby":d??void 0,role:B,tabIndex:-1,hidden:!S,onKeyDown(V){S2.has(V.key)&&V.stopPropagation()},style:{[iz.nestedDialogs]:E}},u],ref:[t,f.context.popupRef,f.useStateSetter("popupElement")],stateAttributesMapping:cz});return x.jsx(rv,{context:g,openInteractionType:R,disabled:!S,closeOnFocusOut:!p,initialFocus:D,returnFocus:r,modal:v!==!1,restoreFocus:"popup",children:J})});function dv(n){return Yb(19)?n:n?"true":void 0}const pv=A.forwardRef(function(e,t){const{cutout:i,...r}=e;let o;if(i){const a=i==null?void 0:i.getBoundingClientRect();o=`polygon(
|
|
188
|
+
*/var LC;function IL(){if(LC)return By;LC=1;var n=Rf(),e=OA();function t(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var i=typeof Object.is=="function"?Object.is:t,r=e.useSyncExternalStore,o=n.useRef,a=n.useEffect,u=n.useMemo,f=n.useDebugValue;return By.useSyncExternalStoreWithSelector=function(d,p,g,b,v){var S=o(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=u(function(){function k(L){if(!R){if(R=!0,N=L,L=b(L),v!==void 0&&w.hasValue){var D=w.value;if(v(D,L))return T=D}return T=L}if(D=T,i(N,L))return D;var j=b(L);return v!==void 0&&v(D,j)?(N=L,D):(N=L,T=j)}var R=!1,N,T,B=g===void 0?null:g;return[function(){return k(p())},B===null?void 0:function(){return k(B())}]},[p,g,b,v]);var E=r(d,S[0],S[1]);return a(function(){w.hasValue=!0,w.value=E},[E]),f(E),E},By}var zC;function PL(){return zC||(zC=1,jy.exports=IL()),jy.exports}var HL=PL();const VL=Yb(19),_L=VL?UL:qL;function ge(n,e,t,i,r){return _L(n,e,t,i,r)}function UL(n,e,t,i,r){const o=A.useCallback(()=>e(n.getSnapshot(),t,i,r),[n,e,t,i,r]);return jb.useSyncExternalStore(n.subscribe,o,o)}function qL(n,e,t,i,r){return HL.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getSnapshot,o=>e(o,t,i,r))}class Zo{constructor(e){Kt(this,"subscribe",e=>(this.listeners.add(e),()=>{this.listeners.delete(e)}));Kt(this,"getSnapshot",()=>this.state);this.state=e,this.listeners=new Set,this.updateTick=0}setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const t=this.updateTick;for(const i of this.listeners){if(t!==this.updateTick)return;i(e)}}update(e){for(const t in e)if(!Object.is(this.state[t],e[t])){Zo.prototype.setState.call(this,{...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||Zo.prototype.setState.call(this,{...this.state,[e]:t})}notifyAll(){const e={...this.state};Zo.prototype.setState.call(this,e)}}class h2 extends Zo{constructor(t,i={},r){super(t);Kt(this,"controlledValues",new Map);Kt(this,"select",(t,i,r,o)=>{const a=this.selectors[t];return a(this.state,i,r,o)});Kt(this,"useState",(t,i,r,o)=>{A.useDebugValue(t);const a=this.selectors[t];return ge(this,a,i,r,o)});this.context=i,this.selectors=r}useSyncedValue(t,i){A.useDebugValue(t),ze(()=>{this.state[t]!==i&&this.set(t,i)},[t,i])}useSyncedValueWithCleanup(t,i){ze(()=>(this.state[t]!==i&&this.set(t,i),()=>{this.set(t,void 0)}),[t,i])}useSyncedValues(t){const i=Object.values(t);ze(()=>{this.update(t)},i)}useControlledProp(t,i,r){A.useDebugValue(t);const o=i!==void 0;this.controlledValues.has(t)||(this.controlledValues.set(t,o),!o&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})),ze(()=>{o&&!Object.is(this.state[t],i)&&super.setState({...this.state,[t]:i})},[t,i,r,o])}set(t,i){this.controlledValues.get(t)!==!0&&super.set(t,i)}update(t){const i={...t};for(const r in i)if(Object.hasOwn(i,r)&&this.controlledValues.get(r)===!0){delete i[r];continue}super.update(i)}setState(t){const i={...t};for(const r in i)if(Object.hasOwn(i,r)&&this.controlledValues.get(r)===!0){delete i[r];continue}super.setState({...this.state,...i})}useContextCallback(t,i){A.useDebugValue(t);const r=He(i??un);this.context[t]=r}useStateSetter(t){const i=A.useRef(void 0);return i.current===void 0&&(i.current=r=>{this.set(t,r)}),i.current}observe(t,i){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return i(o,o,this),this.subscribe(a=>{const u=r(a);if(!Object.is(o,u)){const f=o;o=u,i(u,f,this)}})}}const FL={open:de(n=>n.open),domReferenceElement:de(n=>n.domReferenceElement),referenceElement:de(n=>n.positionReference??n.referenceElement),floatingElement:de(n=>n.floatingElement),floatingId:de(n=>n.floatingId)};class cv extends h2{constructor(t){const{nested:i,noEmit:r,onOpenChange:o,triggerElements:a,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:o,dataRef:{current:{}},events:x4(),nested:i,noEmit:r,triggerElements:a},FL);Kt(this,"setOpen",(t,i)=>{var r,o;if((!t||!this.state.open||UE(i.event))&&(this.context.dataRef.current.openEvent=t?i.event:void 0),!this.context.noEmit){const a={open:t,reason:i.reason,nativeEvent:i.event,nested:this.context.nested,triggerElement:i.trigger};this.context.events.emit("openchange",a)}(o=(r=this.context).onOpenChange)==null||o.call(r,t,i)})}}function Gp(n,e=!1,t=!1){const[i,r]=A.useState(n&&e?"idle":void 0),[o,a]=A.useState(n);return n&&!o&&(a(!0),r("starting")),!n&&o&&i!=="ending"&&!t&&r("ending"),!n&&!o&&i==="ending"&&r(void 0),ze(()=>{if(!n&&o&&i!=="ending"&&t){const u=Zs.request(()=>{r("ending")});return()=>{Zs.cancel(u)}}},[n,o,i,t]),ze(()=>{if(!n||e)return;const u=Zs.request(()=>{Gr.flushSync(()=>{r(void 0)})});return()=>{Zs.cancel(u)}},[e,n]),ze(()=>{if(!n||!e)return;n&&o&&i!=="idle"&&r("starting");const u=Zs.request(()=>{r("idle")});return()=>{Zs.cancel(u)}},[e,n,o,r,i]),A.useMemo(()=>({mounted:o,setMounted:a,transitionStatus:i}),[o,i])}function GL(n,e=!1,t=!0){const i=qp();return He((r,o=null)=>{i.cancel();const a=Lo(n);a!=null&&(typeof a.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED?r():i.request(()=>{function u(){a&&Promise.all(a.getAnimations().map(f=>f.finished)).then(()=>{o!=null&&o.aborted||Gr.flushSync(r)}).catch(()=>{if(t){if(o!=null&&o.aborted)return;Gr.flushSync(r)}else a.getAnimations().length>0&&a.getAnimations().some(f=>f.pending||f.playState!=="finished")&&u()})}e?i.request(u):u()}))})}function da(n){const{enabled:e=!0,open:t,ref:i,onComplete:r}=n,o=Vn(t),a=He(r),u=GL(i,t);A.useEffect(()=>{e&&u(()=>{t===o.current&&a()})},[e,t,a,u,o])}function QL(n){const e=n.useState("open");ze(()=>{if(e&&!n.select("activeTriggerId")&&n.context.triggerElements.size===1){const t=n.context.triggerElements.entries().next();if(!t.done){const[i,r]=t.value;n.update({activeTriggerId:i,activeTriggerElement:r})}}},[e,n])}function KL(n,e,t){const{mounted:i,setMounted:r,transitionStatus:o}=Gp(n);e.useSyncedValues({mounted:i,transitionStatus:o});const a=He(()=>{var f,d;r(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),t==null||t(),(d=(f=e.context).onOpenChangeComplete)==null||d.call(f,!1)}),u=e.useState("preventUnmountingOnClose");return da({enabled:!u,open:n,ref:e.context.popupRef,onComplete(){n||a()}}),{forceUnmount:a,transitionStatus:o}}class uv{constructor(){this.elements=new Set,this.idMap=new Map}add(e,t){const i=this.idMap.get(e);i!==t&&(i!==void 0&&this.elements.delete(i),this.elements.add(t),this.idMap.set(e,t))}delete(e){const t=this.idMap.get(e);t&&(this.elements.delete(t),this.idMap.delete(e))}hasElement(e){return this.elements.has(e)}hasMatchingElement(e){for(const t of this.elements)if(e(t))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}get size(){return this.idMap.size}}function YL(){return new cv({open:!1,floatingElement:null,referenceElement:null,triggerElements:new uv,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function WL(){return{open:!1,mounted:!1,transitionStatus:"idle",floatingRootContext:YL(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,popupElement:null,positionerElement:null,activeTriggerProps:_n,inactiveTriggerProps:_n,popupProps:_n}}const XL={open:de(n=>n.open),mounted:de(n=>n.mounted),transitionStatus:de(n=>n.transitionStatus),floatingRootContext:de(n=>n.floatingRootContext),preventUnmountingOnClose:de(n=>n.preventUnmountingOnClose),payload:de(n=>n.payload),activeTriggerId:de(n=>n.activeTriggerId),activeTriggerElement:de(n=>n.mounted?n.activeTriggerElement:null),isTriggerActive:de((n,e)=>e!==void 0&&n.activeTriggerId===e),isOpenedByTrigger:de((n,e)=>e!==void 0&&n.activeTriggerId===e&&n.open),isMountedByTrigger:de((n,e)=>e!==void 0&&n.activeTriggerId===e&&n.mounted),triggerProps:de((n,e)=>e?n.activeTriggerProps:n.inactiveTriggerProps),popupProps:de(n=>n.popupProps),popupElement:de(n=>n.popupElement),positionerElement:de(n=>n.positionerElement)};function fv(n){const{open:e=!1,onOpenChange:t,elements:i={}}=n,r=jf(),o=_p()!=null,a=Bi(()=>new cv({open:e,onOpenChange:t,referenceElement:i.reference??null,floatingElement:i.floating??null,triggerElements:i.triggers??new uv,floatingId:r,nested:o,noEmit:n.noEmit||!1})).current;return ze(()=>{const u={open:e,floatingId:r};i.reference!==void 0&&(u.referenceElement=i.reference,u.domReferenceElement=Zt(i.reference)?i.reference:null),i.floating!==void 0&&(u.floatingElement=i.floating),a.update(u)},[e,r,i.reference,i.floating,a]),a.context.onOpenChange=t,a.context.nested=o,a.context.noEmit=n.noEmit||!1,a}function $L(n={}){const{nodeId:e,externalTree:t}=n,i=fv(n),r=n.rootContext||i,o={reference:r.useState("referenceElement"),floating:r.useState("floatingElement"),domReference:r.useState("domReferenceElement")},[a,u]=A.useState(null),f=A.useRef(null),d=Up(t);ze(()=>{o.domReference&&(f.current=o.domReference)},[o.domReference]);const p=dL({...n,elements:{...o,...a&&{reference:a}}}),g=A.useCallback(D=>{const j=Zt(D)?{getBoundingClientRect:()=>D.getBoundingClientRect(),getClientRects:()=>D.getClientRects(),contextElement:D}:D;u(j),p.refs.setReference(j)},[p.refs]),[b,v]=A.useState(null),[S,w]=A.useState(null);r.useSyncedValue("referenceElement",b),r.useSyncedValue("domReferenceElement",Zt(b)?b:null),r.useSyncedValue("floatingElement",S);const E=A.useCallback(D=>{(Zt(D)||D===null)&&(f.current=D,v(D)),(Zt(p.refs.reference.current)||p.refs.reference.current===null||D!==null&&!Zt(D))&&p.refs.setReference(D)},[p.refs,v]),k=A.useCallback(D=>{w(D),p.refs.setFloating(D)},[p.refs]),R=A.useMemo(()=>({...p.refs,setReference:E,setFloating:k,setPositionReference:g,domReference:f}),[p.refs,E,k,g]),N=A.useMemo(()=>({...p.elements,domReference:o.domReference}),[p.elements,o.domReference]),T=r.useState("open"),B=r.useState("floatingId"),L=A.useMemo(()=>({...p,dataRef:r.context.dataRef,open:T,onOpenChange:r.setOpen,events:r.context.events,floatingId:B,refs:R,elements:N,nodeId:e,rootStore:r}),[p,R,N,e,r,T,B]);return ze(()=>{r.context.dataRef.current.floatingContext=L;const D=d==null?void 0:d.nodesRef.current.find(j=>j.id===e);D&&(D.context=L)}),A.useMemo(()=>({...p,context:L,refs:R,elements:N,rootStore:r}),[p,R,N,L,r])}function ZL(n){const{popupStore:e,noEmit:t=!1,treatPopupAsFloatingElement:i=!1,onOpenChange:r}=n,o=jf(),a=_p()!=null,u=e.useState("open"),f=e.useState("activeTriggerElement"),d=e.useState(i?"popupElement":"positionerElement"),p=e.context.triggerElements,g=Bi(()=>new cv({open:u,referenceElement:f,floatingElement:d,triggerElements:p,onOpenChange:r,floatingId:o,nested:a,noEmit:t})).current;return ze(()=>{const b={open:u,floatingId:o,referenceElement:f,floatingElement:d};Zt(f)&&(b.domReferenceElement=f),g.update(b)},[u,o,f,d,g]),g.context.onOpenChange=r,g.context.nested=a,g.context.noEmit=t,g}function hv(n=[]){const e=n.map(d=>d==null?void 0:d.reference),t=n.map(d=>d==null?void 0:d.floating),i=n.map(d=>d==null?void 0:d.item),r=n.map(d=>d==null?void 0:d.trigger),o=A.useCallback(d=>pd(d,n,"reference"),e),a=A.useCallback(d=>pd(d,n,"floating"),t),u=A.useCallback(d=>pd(d,n,"item"),i),f=A.useCallback(d=>pd(d,n,"trigger"),r);return A.useMemo(()=>({getReferenceProps:o,getFloatingProps:a,getItemProps:u,getTriggerProps:f}),[o,a,u,f])}function pd(n,e,t){var a;const i=new Map,r=t==="item",o={};t==="floating"&&(o.tabIndex=-1,o[L0]="");for(const u in n)r&&n&&(u===IE||u===PE)||(o[u]=n[u]);for(let u=0;u<e.length;u+=1){let f;const d=(a=e[u])==null?void 0:a[t];typeof d=="function"?f=n?d(n):null:f=d,f&&IC(o,f,r,i)}return IC(o,n,r,i),o}function IC(n,e,t,i){var r;for(const o in e){const a=e[o];t&&(o===IE||o===PE)||(o.startsWith("on")?(i.has(o)||i.set(o,[]),typeof a=="function"&&((r=i.get(o))==null||r.push(a),n[o]=(...u)=>{var f;return(f=i.get(o))==null?void 0:f.map(d=>d(...u)).find(d=>d!==void 0)})):n[o]=a)}}const JL="Escape";function Qp(n,e,t){switch(n){case"vertical":return e;case"horizontal":return t;default:return e||t}}function md(n,e){return Qp(e,n===Jb||n===Bf,n===Xl||n===$l)}function Ly(n,e,t){return Qp(e,n===Bf,t?n===Xl:n===$l)||n==="Enter"||n===" "||n===""}function ez(n,e,t){return Qp(e,t?n===Xl:n===$l,n===Bf)}function tz(n,e,t,i){const r=t?n===$l:n===Xl,o=n===Jb;return e==="both"||e==="horizontal"&&i&&i>1?n===JL:Qp(e,r,o)}function d2(n,e){const t="rootStore"in n?n.rootStore:n,i=t.useState("open"),r=t.useState("floatingElement"),o=t.useState("domReferenceElement"),a=t.context.dataRef,{listRef:u,activeIndex:f,onNavigate:d=()=>{},enabled:p=!0,selectedIndex:g=null,allowEscape:b=!1,loopFocus:v=!1,nested:S=!1,rtl:w=!1,virtual:E=!1,focusItemOnOpen:k="auto",focusItemOnHover:R=!0,openOnArrowKeyDown:N=!0,disabledIndices:T=void 0,orientation:B="vertical",parentOrientation:L,cols:D=1,scrollItemIntoView:j=!0,itemSizes:X,dense:J=!1,id:V,resetOnPointerLeave:K=!0,externalTree:ae}=e,$=cf(r),H=Vn($),z=_p(),Q=Up(ae);ze(()=>{a.current.orientation=B},[a,B]);const F=z0(o),ee=A.useRef(k),G=A.useRef(g??-1),M=A.useRef(null),U=A.useRef(!0),te=He(we=>{d(G.current===-1?null:G.current,we)}),le=A.useRef(te),ne=A.useRef(!!r),se=A.useRef(i),he=A.useRef(!1),pe=A.useRef(!1),xe=Vn(T),fe=Vn(i),ie=Vn(j),ye=Vn(g),ve=Vn(K),Qe=He(()=>{function we(nt){E?Q==null||Q.events.emit("virtualfocus",nt):Hd(nt,{sync:he.current,preventScroll:!0})}const Ae=u.current[G.current],Ce=pe.current;Ae&&we(Ae),(he.current?nt=>nt():requestAnimationFrame)(()=>{var at;const nt=u.current[G.current]||Ae;if(!nt)return;Ae||we(nt);const _e=ie.current;_e&&me&&(Ce||!U.current)&&((at=nt.scrollIntoView)==null||at.call(nt,typeof _e=="boolean"?{block:"nearest",inline:"nearest"}:_e))})});ze(()=>{p&&(i&&r?(G.current=g??-1,ee.current&&g!=null&&(pe.current=!0,te())):ne.current&&(G.current=-1,le.current()))},[p,i,r,g,te]),ze(()=>{if(p){if(!i){he.current=!1;return}if(r)if(f==null){if(he.current=!1,ye.current!=null)return;if(ne.current&&(G.current=-1,Qe()),(!se.current||!ne.current)&&ee.current&&(M.current!=null||ee.current===!0&&M.current==null)){let we=0;const Ae=()=>{u.current[0]==null?(we<2&&(we?requestAnimationFrame:queueMicrotask)(Ae),we+=1):(G.current=M.current==null||Ly(M.current,B,w)||S?Ty(u):bC(u),M.current=null,te())};Ae()}}else Xu(u,f)||(G.current=f,Qe(),pe.current=!1)}},[p,i,r,f,ye,S,u,B,w,te,Qe,xe]),ze(()=>{var nt,_e;if(!p||r||!Q||E||!ne.current)return;const we=Q.nodesRef.current,Ae=(_e=(nt=we.find(rt=>rt.id===z))==null?void 0:nt.context)==null?void 0:_e.elements.floating,Ce=jl(di(r)),Ze=we.some(rt=>rt.context&&Dt(rt.context.elements.floating,Ce));Ae&&!Ze&&U.current&&Ae.focus({preventScroll:!0})},[p,r,Q,z,E]),ze(()=>{le.current=te,se.current=i,ne.current=!!r}),ze(()=>{i||(M.current=null,ee.current=k)},[i,k]);const Re=f!=null,me=A.useMemo(()=>{function we(Ce){if(!fe.current)return;const Ze=u.current.indexOf(Ce.currentTarget);Ze!==-1&&G.current!==Ze&&(G.current=Ze,te(Ce))}return{onFocus(Ce){he.current=!0,we(Ce)},onClick:({currentTarget:Ce})=>Ce.focus({preventScroll:!0}),onMouseMove(Ce){he.current=!0,pe.current=!1,R&&we(Ce)},onPointerLeave(Ce){var nt;if(!fe.current||!U.current||Ce.pointerType==="touch")return;he.current=!0;const Ze=Ce.relatedTarget;!R||u.current.includes(Ze)||ve.current&&(G.current=-1,te(Ce),E||(nt=H.current)==null||nt.focus({preventScroll:!0}))}}},[fe,H,R,u,te,ve,E]),ke=A.useCallback(()=>{var we,Ae,Ce;return L??((Ce=(Ae=(we=Q==null?void 0:Q.nodesRef.current.find(Ze=>Ze.id===z))==null?void 0:we.context)==null?void 0:Ae.dataRef)==null?void 0:Ce.current.orientation)},[z,Q,L]),be=He(we=>{if(U.current=!1,he.current=!0,we.which===229||!fe.current&&we.currentTarget===H.current)return;if(S&&tz(we.key,B,w,D)){md(we.key,ke())||bn(we),t.setOpen(!1,tt(Pd,we.nativeEvent)),Ln(o)&&(E?Q==null||Q.events.emit("virtualfocus",o):o.focus());return}const Ae=G.current,Ce=Ty(u,T),Ze=bC(u,T);if(F||(we.key==="Home"&&(bn(we),G.current=Ce,te(we)),we.key==="End"&&(bn(we),G.current=Ze,te(we))),D>1){const nt=X||Array.from({length:u.current.length},()=>({width:1,height:1})),_e=t4(nt,D,J),rt=_e.findIndex(nn=>nn!=null&&!$u(u,nn,T)),at=_e.reduce((nn,ht,Ue)=>ht!=null&&!$u(u,ht,T)?Ue:nn,-1),Lt=_e[e4({current:_e.map(nn=>nn!=null?u.current[nn]:null)},{event:we,orientation:B,loopFocus:v,rtl:w,cols:D,disabledIndices:i4([...(typeof T!="function"?T:null)||u.current.map((nn,ht)=>$u(u,ht,T)?ht:void 0),void 0],_e),minIndex:rt,maxIndex:at,prevIndex:n4(G.current>Ze?Ce:G.current,nt,_e,D,we.key===Bf?"bl":we.key===(w?Xl:$l)?"tr":"tl"),stopEvent:!0})];if(Lt!=null&&(G.current=Lt,te(we)),B==="both")return}if(md(we.key,B)){if(bn(we),i&&!E&&jl(we.currentTarget.ownerDocument)===we.currentTarget){G.current=Ly(we.key,B,w)?Ce:Ze,te(we);return}Ly(we.key,B,w)?v?Ae>=Ze?b&&Ae!==u.current.length?G.current=-1:(he.current=!1,G.current=Ce):G.current=ei(u,{startingIndex:Ae,disabledIndices:T}):G.current=Math.min(Ze,ei(u,{startingIndex:Ae,disabledIndices:T})):v?Ae<=Ce?b&&Ae!==-1?G.current=u.current.length:(he.current=!1,G.current=Ze):G.current=ei(u,{startingIndex:Ae,decrement:!0,disabledIndices:T}):G.current=Math.max(Ce,ei(u,{startingIndex:Ae,decrement:!0,disabledIndices:T})),Xu(u,G.current)&&(G.current=-1),te(we)}}),De=A.useMemo(()=>E&&i&&Re&&{"aria-activedescendant":`${V}-${f}`},[E,i,Re,V,f]),qe=A.useMemo(()=>({"aria-orientation":B==="both"?void 0:B,...F?{}:De,onKeyDown(we){if(we.key==="Tab"&&we.shiftKey&&i&&!E){const Ae=ni(we.nativeEvent);if(Ae&&!Dt(H.current,Ae))return;bn(we),t.setOpen(!1,tt(Pp,we.nativeEvent)),Ln(o)&&o.focus();return}be(we)},onPointerMove(){U.current=!0}}),[De,be,H,B,F,t,i,E,o]),je=A.useMemo(()=>{function we(Ce){k==="auto"&&VE(Ce.nativeEvent)&&(ee.current=!E)}function Ae(Ce){ee.current=k,k==="auto"&&_E(Ce.nativeEvent)&&(ee.current=!0)}return{onKeyDown(Ce){const Ze=t.select("open");U.current=!1;const nt=Ce.key.startsWith("Arrow"),_e=ez(Ce.key,ke(),w),rt=md(Ce.key,B),at=(S?_e:rt)||Ce.key==="Enter"||Ce.key.trim()==="";if(E&&Ze)return be(Ce);if(!(!Ze&&!N&&nt)){if(at){const Lt=md(Ce.key,ke());M.current=S&&Lt?null:Ce.key}if(S){_e&&(bn(Ce),Ze?(G.current=Ty(u,xe.current),te(Ce)):t.setOpen(!0,tt(Pd,Ce.nativeEvent,Ce.currentTarget)));return}rt&&(ye.current!=null&&(G.current=ye.current),bn(Ce),!Ze&&N?t.setOpen(!0,tt(Pd,Ce.nativeEvent,Ce.currentTarget)):be(Ce),Ze&&te(Ce))}},onFocus(Ce){t.select("open")&&!E&&(G.current=-1,te(Ce))},onPointerDown:Ae,onPointerEnter:Ae,onMouseDown:we,onClick:we}},[be,xe,k,u,S,te,t,N,B,ke,w,ye,E]),Te=A.useMemo(()=>({...De,...je}),[De,je]);return A.useMemo(()=>p?{reference:Te,floating:qe,item:me,trigger:je}:{},[p,Te,qe,je,me])}const nz=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function iz(n,e={}){const t="rootStore"in n?n.rootStore:n,i=t.useState("open"),r=t.useState("floatingId"),o=t.useState("domReferenceElement"),a=t.useState("floatingElement"),{enabled:u=!0,role:f="dialog"}=e,d=jf(),p=(o==null?void 0:o.id)||d,g=A.useMemo(()=>{var N;return((N=cf(a))==null?void 0:N.id)||r},[a,r]),b=nz.get(f)??f,S=_p()!=null,w=A.useMemo(()=>b==="tooltip"||f==="label"?_n:{"aria-haspopup":b==="alertdialog"?"dialog":b,"aria-expanded":"false",...b==="listbox"&&{role:"combobox"},...b==="menu"&&S&&{role:"menuitem"},...f==="select"&&{"aria-autocomplete":"none"},...f==="combobox"&&{"aria-autocomplete":"list"}},[b,S,f]),E=A.useMemo(()=>b==="tooltip"||f==="label"?{[`aria-${f==="label"?"labelledby":"describedby"}`]:i?g:void 0}:{...w,"aria-expanded":i?"true":"false","aria-controls":i?g:void 0,...b==="menu"&&{id:p}},[b,g,i,p,f,w]),k=A.useMemo(()=>{const N={id:g,...b&&{role:b}};return b==="tooltip"||f==="label"?N:{...N,...b==="menu"&&{"aria-labelledby":p}}},[b,g,p,f]),R=A.useCallback(({active:N,selected:T})=>{const B={role:"option",...N&&{id:`${g}-fui-option`}};switch(f){case"select":case"combobox":return{...B,"aria-selected":T}}return{}},[g,f]);return A.useMemo(()=>u?{reference:E,floating:k,item:R,trigger:w}:{},[u,E,k,w,R])}function p2(n,e){const t="rootStore"in n?n.rootStore:n,i=t.useState("open"),r=t.context.dataRef,{listRef:o,activeIndex:a,onMatch:u,onTypingChange:f,enabled:d=!0,findMatch:p=null,resetMs:g=750,ignoreKeys:b=Dl,selectedIndex:v=null}=e,S=$i(),w=A.useRef(""),E=A.useRef(v??a??-1),k=A.useRef(null);ze(()=>{i&&(S.clear(),k.current=null,w.current="")},[i,S]),ze(()=>{i&&w.current===""&&(E.current=v??a??-1)},[i,v,a]);const R=He(L=>{L?r.current.typing||(r.current.typing=L,f==null||f(L)):r.current.typing&&(r.current.typing=L,f==null||f(L))}),N=He(L=>{function D(K,ae,$){const H=p?p(ae,$):ae.find(z=>(z==null?void 0:z.toLocaleLowerCase().indexOf($.toLocaleLowerCase()))===0);return H?K.indexOf(H):-1}const j=o.current;if(w.current.length>0&&w.current[0]!==" "&&(D(j,j,w.current)===-1?R(!1):L.key===" "&&bn(L)),j==null||b.includes(L.key)||L.key.length!==1||L.ctrlKey||L.metaKey||L.altKey)return;i&&L.key!==" "&&(bn(L),R(!0)),j.every(K=>{var ae,$;return K?((ae=K[0])==null?void 0:ae.toLocaleLowerCase())!==(($=K[1])==null?void 0:$.toLocaleLowerCase()):!0})&&w.current===L.key&&(w.current="",E.current=k.current),w.current+=L.key,S.start(g,()=>{w.current="",E.current=k.current,R(!1)});const J=E.current,V=D(j,[...j.slice((J||0)+1),...j.slice(0,(J||0)+1)],w.current);V!==-1?(u==null||u(V),k.current=V):L.key!==" "&&(w.current="",R(!1))}),T=A.useMemo(()=>({onKeyDown:N}),[N]),B=A.useMemo(()=>({onKeyDown:N,onKeyUp(L){L.key===" "&&R(!1)}}),[N,R]);return A.useMemo(()=>d?{reference:T,floating:B}:{},[d,T,B])}let sz=(function(n){return n.nestedDialogs="--nested-dialogs",n})({}),rz=(function(n){return n[n.open=Ho.open]="open",n[n.closed=Ho.closed]="closed",n[n.startingStyle=Ho.startingStyle]="startingStyle",n[n.endingStyle=Ho.endingStyle]="endingStyle",n.nested="data-nested",n.nestedDialogOpen="data-nested-dialog-open",n})({});const m2=A.createContext(void 0);function lz(){const n=A.useContext(m2);if(n===void 0)throw new Error(ri(26));return n}const g2="ArrowUp",y2="ArrowDown",b2="ArrowLeft",v2="ArrowRight",x2="Home",S2="End",oz=new Set([b2,v2]),az=new Set([g2,y2]),cz=new Set([...oz,...az]);[...cz];const w2=new Set([g2,y2,b2,v2,x2,S2]),uz={...Pc,...Nf,nestedDialogOpen(n){return n?{[rz.nestedDialogOpen]:""}:null}},fz=A.forwardRef(function(e,t){const{className:i,finalFocus:r,initialFocus:o,render:a,...u}=e,{store:f}=Mf(),d=f.useState("descriptionElementId"),p=f.useState("disablePointerDismissal"),g=f.useState("floatingRootContext"),b=f.useState("popupProps"),v=f.useState("modal"),S=f.useState("mounted"),w=f.useState("nested"),E=f.useState("nestedOpenDialogCount"),k=f.useState("open"),R=f.useState("openMethod"),N=f.useState("titleElementId"),T=f.useState("transitionStatus"),B=f.useState("role");lz(),da({open:k,ref:f.context.popupRef,onComplete(){var V,K;k&&((K=(V=f.context).onOpenChangeComplete)==null||K.call(V,!0))}});function L(V){return V==="touch"?f.context.popupRef.current:!0}const D=o===void 0?L:o,j=E>0,X=A.useMemo(()=>({open:k,nested:w,transitionStatus:T,nestedDialogOpen:j}),[k,w,T,j]),J=wn("div",e,{state:X,props:[b,{"aria-labelledby":N??void 0,"aria-describedby":d??void 0,role:B,tabIndex:-1,hidden:!S,onKeyDown(V){w2.has(V.key)&&V.stopPropagation()},style:{[sz.nestedDialogs]:E}},u],ref:[t,f.context.popupRef,f.useStateSetter("popupElement")],stateAttributesMapping:uz});return x.jsx(rv,{context:g,openInteractionType:R,disabled:!S,closeOnFocusOut:!p,initialFocus:D,returnFocus:r,modal:v!==!1,restoreFocus:"popup",children:J})});function dv(n){return Yb(19)?n:n?"true":void 0}const pv=A.forwardRef(function(e,t){const{cutout:i,...r}=e;let o;if(i){const a=i==null?void 0:i.getBoundingClientRect();o=`polygon(
|
|
189
189
|
0% 0%,
|
|
190
190
|
100% 0%,
|
|
191
191
|
100% 100%,
|
|
@@ -196,14 +196,14 @@ Error generating stack: `+h.message+`
|
|
|
196
196
|
${a.right}px ${a.bottom}px,
|
|
197
197
|
${a.right}px ${a.top}px,
|
|
198
198
|
${a.left}px ${a.top}px
|
|
199
|
-
)`}return x.jsx("div",{ref:t,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),fz=A.forwardRef(function(e,t){const{keepMounted:i=!1,...r}=e,{store:o}=Mf(),a=o.useState("mounted"),u=o.useState("modal");return a||i?x.jsx(p2.Provider,{value:i,children:x.jsxs(iv,{ref:t,...r,children:[a&&u===!0&&x.jsx(pv,{ref:o.context.internalBackdropRef,inert:dv(!open)}),e.children]})}):null});let IC={},PC={},HC="";function hz(n){if(typeof document>"u")return!1;const e=Fr(n);return In(e).innerWidth-e.documentElement.clientWidth>0}function dz(n){const e=Fr(n),t=e.documentElement,i=e.body,r=fa(t)?t:i,o=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=o}}function pz(n){var b,v;const e=Fr(n),t=e.documentElement,i=e.body,r=In(t);let o=0,a=0;const u=Zs.create(),f=typeof CSS<"u"&&((b=CSS.supports)==null?void 0:b.call(CSS,"scrollbar-gutter","stable"));if(LE&&(((v=r.visualViewport)==null?void 0:v.scale)??1)!==1)return()=>{};function d(){const S=r.getComputedStyle(t),w=r.getComputedStyle(i),R=(S.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=t.scrollTop,a=t.scrollLeft,IC={scrollbarGutter:t.style.scrollbarGutter,overflowY:t.style.overflowY,overflowX:t.style.overflowX},HC=t.style.scrollBehavior,PC={position:i.style.position,height:i.style.height,width:i.style.width,boxSizing:i.style.boxSizing,overflowY:i.style.overflowY,overflowX:i.style.overflowX,scrollBehavior:i.style.scrollBehavior};const N=t.scrollHeight>t.clientHeight,T=t.scrollWidth>t.clientWidth,B=S.overflowY==="scroll"||w.overflowY==="scroll",L=S.overflowX==="scroll"||w.overflowX==="scroll",D=Math.max(0,r.innerWidth-t.clientWidth),j=Math.max(0,r.innerHeight-t.clientHeight),X=parseFloat(w.marginTop)+parseFloat(w.marginBottom),J=parseFloat(w.marginLeft)+parseFloat(w.marginRight),V=fa(t)?t:i;if(f){t.style.scrollbarGutter=R,V.style.overflowY="hidden",V.style.overflowX="hidden";return}Object.assign(t.style,{scrollbarGutter:R,overflowY:"hidden",overflowX:"hidden"}),(N||B)&&(t.style.overflowY="scroll"),(T||L)&&(t.style.overflowX="scroll"),Object.assign(i.style,{position:"relative",height:X||j?`calc(100dvh - ${X+j}px)`:"100dvh",width:J||D?`calc(100vw - ${J+D}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),i.scrollTop=o,i.scrollLeft=a,t.setAttribute("data-base-ui-scroll-locked",""),t.style.scrollBehavior="unset"}function p(){Object.assign(t.style,IC),Object.assign(i.style,PC),f||(t.scrollTop=o,t.scrollLeft=a,t.removeAttribute("data-base-ui-scroll-locked"),t.style.scrollBehavior=HC)}function g(){p(),u.request(d)}return d(),r.addEventListener("resize",g),()=>{u.cancel(),p(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",g)}}class mz{constructor(){Kt(this,"lockCount",0);Kt(this,"restore",null);Kt(this,"timeoutLock",Ac.create());Kt(this,"timeoutUnlock",Ac.create());Kt(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Kt(this,"unlock",()=>{var e;this.lockCount===0&&this.restore&&((e=this.restore)==null||e.call(this),this.restore=null)})}acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}lock(e){if(this.lockCount===0||this.restore!==null)return;const i=Fr(e).documentElement,r=In(i).getComputedStyle(i).overflowY;if(r==="hidden"||r==="clip"){this.restore=un;return}const o=LB||!hz(e);this.restore=o?dz(e):pz(e)}}const gz=new mz;function mv(n=!0,e=null){ze(()=>{if(n)return gz.acquire(e)},[n,e])}function yz(n){const e=A.useRef(""),t=A.useCallback(r=>{r.defaultPrevented||(e.current=r.pointerType,n(r,r.pointerType))},[n]);return{onClick:A.useCallback(r=>{if(r.detail===0){n(r,"keyboard");return}"pointerType"in r&&n(r,r.pointerType),n(r,e.current),e.current=""},[n]),onPointerDown:t}}function w2(n){const[e,t]=A.useState(null),i=He((u,f)=>{n||t(f)}),r=A.useCallback(()=>{t(null)},[]),{onClick:o,onPointerDown:a}=yz(i);return A.useMemo(()=>({openMethod:e,reset:r,triggerProps:{onClick:o,onPointerDown:a}}),[e,r,o,a])}function bz(n){const{store:e,parentContext:t,actionsRef:i}=n,r=e.useState("open"),o=e.useState("disablePointerDismissal"),a=e.useState("modal"),u=e.useState("popupElement"),{openMethod:f,triggerProps:d,reset:p}=w2(r);GL(e);const{forceUnmount:g}=QL(r,e,()=>{p()}),b=He(J=>{const V=tt(J);return V.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},V}),v=A.useCallback(()=>{e.setOpen(!1,b(OB))},[e,b]);A.useImperativeHandle(i,()=>({unmount:g,close:v}),[g,v]);const S=$L({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,E]=A.useState(0),k=w===0,R=nz(S),N=av(S,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(J){if("button"in J&&J.button!==0||"touches"in J&&J.touches.length!==1)return!1;const V=ni(J);if(k&&!o){const K=V;return a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===K||e.context.backdropRef.current===K||Dt(K,u)&&!(K!=null&&K.hasAttribute("data-base-ui-portal")):!0}return!1},escapeKey:k});mv(r&&a===!0,u);const{getReferenceProps:T,getFloatingProps:B,getTriggerProps:L}=hv([R,N]);e.useContextCallback("onNestedDialogOpen",J=>{E(J+1)}),e.useContextCallback("onNestedDialogClose",()=>{E(0)}),A.useEffect(()=>(t!=null&&t.onNestedDialogOpen&&r&&t.onNestedDialogOpen(w),t!=null&&t.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t!=null&&t.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[r,t,w]);const D=A.useMemo(()=>T(d),[T,d]),j=A.useMemo(()=>L(d),[L,d]),X=A.useMemo(()=>B(),[B]);e.useSyncedValues({openMethod:f,activeTriggerProps:D,inactiveTriggerProps:j,popupProps:X,floatingRootContext:S,nestedOpenDialogCount:w})}const vz={...WL,modal:de(n=>n.modal),nested:de(n=>n.nested),nestedOpenDialogCount:de(n=>n.nestedOpenDialogCount),disablePointerDismissal:de(n=>n.disablePointerDismissal),openMethod:de(n=>n.openMethod),descriptionElementId:de(n=>n.descriptionElementId),titleElementId:de(n=>n.titleElementId),viewportElement:de(n=>n.viewportElement),role:de(n=>n.role)};class xz extends f2{constructor(t){super(Sz(t),{popupRef:A.createRef(),backdropRef:A.createRef(),internalBackdropRef:A.createRef(),triggerElements:new uv,onOpenChange:void 0,onOpenChangeComplete:void 0},vz);Kt(this,"setOpen",(t,i)=>{var u,f,d,p;if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&i.trigger==null&&this.state.activeTriggerId!=null&&(i.trigger=this.state.activeTriggerElement??void 0),(f=(u=this.context).onOpenChange)==null||f.call(u,t,i),i.isCanceled)return;const r={open:t,nativeEvent:i.event,reason:i.reason,nested:this.state.nested};(d=this.state.floatingRootContext.context.events)==null||d.emit("openchange",r);const o={open:t},a=((p=i.trigger)==null?void 0:p.id)??null;(a||t)&&(o.activeTriggerId=a,o.activeTriggerElement=i.trigger??null),this.update(o)})}}function Sz(n={}){return{...YL(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...n}}function wz(n){const{children:e,open:t,defaultOpen:i=!1,onOpenChange:r,onOpenChangeComplete:o,disablePointerDismissal:a=!1,modal:u=!0,actionsRef:f,handle:d,triggerId:p,defaultTriggerId:g=null}=n,b=Mf(!0),v=!!b,S=Bi(()=>(d==null?void 0:d.store)??new xz({open:t??i,activeTriggerId:p!==void 0?p:g,modal:u,disablePointerDismissal:a,nested:v})).current;S.useControlledProp("open",t,i),S.useControlledProp("activeTriggerId",p,g),S.useSyncedValues({disablePointerDismissal:a,nested:v,modal:u}),S.useContextCallback("onOpenChange",r),S.useContextCallback("onOpenChangeComplete",o);const w=S.useState("payload");bz({store:S,actionsRef:f,parentContext:b==null?void 0:b.store.context});const E=A.useMemo(()=>({store:S}),[S]);return x.jsx(kE.Provider,{value:E,children:typeof e=="function"?e({payload:w}):e})}const Cz=A.forwardRef(function(e,t){const{render:i,className:r,id:o,...a}=e,{store:u}=Mf(),f=Hp(o);return u.useSyncedValueWithCleanup("titleElementId",f),wn("h2",e,{ref:t,props:[{id:f},a]})}),kz={primary:"bg-primary text-primary-foreground hover:bg-primary/90 border border-transparent",secondary:"bg-secondary/60 text-foreground border border-border hover:bg-secondary",ghost:"bg-transparent text-muted-foreground hover:bg-secondary/60 hover:text-foreground border border-transparent",danger:"bg-transparent text-destructive border border-destructive/30 hover:bg-destructive/10"},Az={sm:"h-7 px-2.5 text-xs gap-1.5",md:"h-9 px-3.5 text-[13px] gap-2",icon:"h-8 w-8 justify-center"},Wt=A.forwardRef(function({className:e,variant:t="secondary",size:i="md",loading:r=!1,icon:o,children:a,disabled:u,...f},d){return x.jsxs("button",{ref:d,disabled:u||r,className:jt("inline-flex shrink-0 items-center rounded-md font-medium outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:pointer-events-none disabled:opacity-50",kz[t],Az[i],e),...f,children:[r?x.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:"animate-spin","aria-hidden":!0,children:x.jsx("circle",{cx:"7",cy:"7",r:"5",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"20",strokeDashoffset:"10",strokeLinecap:"round"})}):o,a]})});function lr({className:n,children:e}){return x.jsx("span",{className:jt("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium uppercase tracking-wide","border-border bg-secondary/60 text-muted-foreground",n),children:e})}function Ez({className:n}){return x.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:jt("animate-spin",n),"aria-hidden":!0,children:x.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"24",strokeDashoffset:"12",strokeLinecap:"round"})})}function Ns({label:n}){return x.jsxs("div",{className:"mt-8 flex items-center justify-center gap-2 text-[13px] text-muted-foreground",children:[x.jsx(Ez,{}),n]})}function If({status:n}){return x.jsx("span",{className:jt("inline-flex items-center rounded-md border px-1.5 py-0.5 text-[11px] font-medium uppercase tracking-wide",Ij(n)),children:zj(n)})}function Tc({className:n,children:e}){return x.jsx("span",{className:jt("font-mono text-[12px] text-foreground",n),children:e})}function Hc({title:n,description:e,actions:t}){return x.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:n}),e?x.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:e}):null]}),t]})}function Es({title:n,description:e,children:t,className:i}){return x.jsxs("section",{className:jt("rounded-xl border border-border bg-card",i),children:[x.jsxs("div",{className:"border-b border-border px-4 py-3",children:[x.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:n}),e?x.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:e}):null]}),x.jsx("div",{className:"px-4 py-4",children:t})]})}function up({open:n,onClose:e,title:t,children:i,footer:r,wide:o}){return x.jsx(wz,{open:n,onOpenChange:a=>!a&&e(),children:x.jsxs(fz,{children:[x.jsx(pB,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"}),x.jsxs(uz,{className:jt("fixed left-1/2 top-1/2 z-50 flex max-h-[85vh] w-full -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-border bg-card shadow-2xl outline-none",o?"max-w-2xl":"max-w-md"),children:[x.jsx("div",{className:"border-b border-border px-5 py-4",children:x.jsx(Cz,{className:"text-[15px] font-semibold text-foreground",children:t})}),x.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-5 py-5",children:i}),r?x.jsx("div",{className:"flex items-center justify-end gap-2 border-t border-border px-5 py-3",children:r}):null]})]})})}function _d({open:n,onClose:e,onConfirm:t,title:i,confirmLabel:r,danger:o,loading:a,children:u,confirmDisabled:f}){return x.jsx(up,{open:n,onClose:e,title:i,footer:x.jsxs(x.Fragment,{children:[x.jsx(Wt,{variant:"secondary",onClick:e,disabled:a,children:"Cancel"}),x.jsx(Wt,{variant:o?"danger":"primary",loading:a,disabled:f,onClick:t,children:r})]}),children:u})}function Li({children:n}){return x.jsx("div",{className:"mt-4 rounded-xl border border-border bg-card px-4 py-16 text-center",children:x.jsx("p",{className:"text-[13px] text-muted-foreground",children:n})})}function Kp(){return x.jsx("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:x.jsx(Li,{children:"No application selected. Create one from the application switcher in the top bar."})})}const Rz=864e5;function zy({label:n,value:e,hint:t,tone:i}){return x.jsxs("div",{className:"rounded-xl border border-border bg-card px-4 py-4",children:[x.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:n}),x.jsx("p",{className:jt("mt-1.5 text-2xl font-semibold tabular-nums tracking-tight",i),children:e}),t?x.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}):null]})}function Tz({app:n,onOpenDelivery:e,onCreateEndpoint:t}){const i=ji({queryKey:["deliveries",n,{view:"overview"}],queryFn:()=>Gb(n,{limit:200}),staleTime:1e4,enabled:n!==""}),r=ji({queryKey:["endpoints",n],queryFn:()=>Fb(n),staleTime:3e4,enabled:n!==""});if(!n)return x.jsx(Kp,{});const o=i.data??[],a=r.data??[],u=E=>{var k;return((k=a.find(R=>R.id===E))==null?void 0:k.url)??E},f=Date.now(),d=o.filter(E=>Vj(E.updatedAt,Rz,f)),p=d.reduce((E,k)=>E+k.attemptCount,0),g=d.filter(E=>E.status==="succeeded").length,b=d.filter(E=>E.status==="failed").length,v=Hj(g,b),S=o.filter(E=>E.status==="failed"),w=S.slice(0,8);return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Overview",description:x.jsxs(x.Fragment,{children:["Delivery health for ",x.jsx("span",{className:"font-mono",children:n})," over the last 24 hours."]})}),i.isLoading?x.jsx(Ns,{label:"Loading deliveries…"}):i.isError?x.jsx(Li,{children:"Failed to load deliveries."}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-3 sm:grid-cols-3",children:[x.jsx(zy,{label:"Attempts (24h)",value:String(p),hint:`${d.length} deliver${d.length===1?"y":"ies"} touched`,tone:"text-chart-1"}),x.jsx(zy,{label:"Success rate (24h)",value:v===null?"—":`${v}%`,hint:v===null?"No terminal deliveries yet":`${g} succeeded · ${b} dead-lettered`,tone:v!==null&&v<90?"text-warning":"text-success"}),x.jsx(zy,{label:"Dead-letter",value:String(S.length),hint:"Exhausted deliveries awaiting retry",tone:S.length>0?"text-destructive":void 0})]}),x.jsxs("div",{className:"mt-8",children:[x.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Recent failures"}),w.length===0?x.jsx(Li,{children:"No dead-lettered deliveries. Everything is flowing."}):x.jsx("div",{className:"mt-3 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:w.map(E=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>e(E.id),className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary/30",children:[x.jsx(If,{status:E.status}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx(Tc,{className:"block truncate",children:E.id}),x.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[u(E.endpointId)," · ",E.attemptCount," attempt",E.attemptCount===1?"":"s"]})]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(E.updatedAt),children:Of(E.updatedAt)}),x.jsx(aa,{className:"size-4 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},E.id))})})]})]})]})}function lc({controlled:n,default:e,name:t,state:i="value"}){const{current:r}=A.useRef(n!==void 0),[o,a]=A.useState(e),u=r?n:o,f=A.useCallback(d=>{r||a(d)},[]);return[u,f]}const C2=A.createContext(void 0);function Oz(){const n=A.useContext(C2);if(n===void 0)throw new Error(ri(63));return n}let VC=(function(n){return n.disabled="data-disabled",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});const Mz={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Yp={valid(n){return n===null?null:n?{[VC.valid]:""}:{[VC.invalid]:""}}};let _C=(function(n){return n.checked="data-checked",n.unchecked="data-unchecked",n.disabled="data-disabled",n.readonly="data-readonly",n.required="data-required",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});const k2={...Yp,checked(n){return n?{[_C.checked]:""}:{[_C.unchecked]:""}}};function Nz(n,e){return{...n,state:{...n.state,valid:!e&&n.state.valid}}}const Dz=A.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:un,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Wp(){return A.useContext(Dz)}const jz=A.createContext({invalid:void 0,name:void 0,validityData:{state:Mz,errors:[],error:"",value:"",initialValue:null},setValidityData:un,disabled:void 0,touched:!1,setTouched:un,dirty:!1,setDirty:un,filled:!1,setFilled:un,focused:!1,setFocused:un,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(n=_n)=>n,getInputValidationProps:(n=_n)=>n,inputRef:{current:null},commit:async()=>{}}});function oo(n=!0){const e=A.useContext(jz);if(e.setValidityData===un&&!n)throw new Error(ri(28));return e}function gv(n){const{enabled:e=!0,value:t,id:i,name:r,controlRef:o,commit:a}=n,{formRef:u}=Wp(),{invalid:f,markedDirtyRef:d,validityData:p,setValidityData:g}=oo(),b=He(n.getValue);ze(()=>{if(!e)return;let v=t;v===void 0&&(v=b()),p.initialValue===null&&v!==null&&g(S=>({...S,initialValue:v}))},[e,g,t,p.initialValue,b]),ze(()=>{!e||!i||u.current.fields.set(i,{getValue:b,name:r,controlRef:o,validityData:Nz(p,f),validate(){let v=t;v===void 0&&(v=b()),d.current=!0,Gr.flushSync(()=>a(v))}})},[a,o,e,u,b,i,f,d,r,p,t]),ze(()=>{const v=u.current.fields;return()=>{i&&v.delete(i)}},[u,i])}const Bz=A.createContext({controlId:void 0,setControlId:un,labelId:void 0,setLabelId:un,messageIds:[],setMessageIds:un,getDescriptionProps:n=>n});function Vc(){return A.useContext(Bz)}function yv(n={}){const{id:e,implicit:t=!1,controlRef:i}=n,{controlId:r,setControlId:o}=Vc(),a=Hp(e);return ze(()=>{if(!(!t&&!e||o===un)){if(t){const u=i==null?void 0:i.current;Zt(u)&&u.closest("label")!=null?o(e??null):o(r??a)}else e&&o(e);return()=>{e&&o(void 0)}}},[e,i,r,o,t,a]),r??a}function Ja(n,e){const t=A.useRef(n),i=He(e);ze(()=>{t.current!==n&&i(t.current)},[n,i]),ze(()=>{t.current=n},[n])}const Lz=A.forwardRef(function(e,t){const{checked:i,className:r,defaultChecked:o,id:a,inputRef:u,name:f,nativeButton:d=!1,onCheckedChange:p,readOnly:g=!1,required:b=!1,disabled:v=!1,render:S,uncheckedValue:w,...E}=e,{clearErrors:k}=Wp(),{state:R,setTouched:N,setDirty:T,validityData:B,setFilled:L,setFocused:D,shouldValidateOnChange:j,validationMode:X,disabled:J,name:V,validation:K}=oo(),{labelId:ae}=Vc(),$=J||v,H=V??f,z=He(p),Q=A.useRef(null),F=Zl(Q,u,K.inputRef),ee=A.useRef(null),G=Hp(),M=yv({id:a,implicit:!1,controlRef:ee}),[U,te]=lc({controlled:i,default:!!o,name:"Switch",state:"checked"});gv({id:G,commit:K.commit,value:U,controlRef:ee,name:H,getValue:()=>U}),ze(()=>{Q.current&&L(Q.current.checked)},[Q,L]),Ja(U,()=>{k(H),T(U!==B.initialValue),L(U),j()?K.commit(U):K.commit(U,!0)});const{getButtonProps:le,buttonRef:ne}=Df({disabled:$,native:d}),se={id:G,role:"switch","aria-checked":U,"aria-readonly":g||void 0,"aria-labelledby":ae,onFocus(){$||D(!0)},onBlur(){const fe=Q.current;!fe||$||(N(!0),D(!1),X==="onBlur"&&K.commit(fe.checked))},onClick(fe){var ie;g||$||(fe.preventDefault(),(ie=Q==null?void 0:Q.current)==null||ie.click())}},he=A.useMemo(()=>jp({checked:U,disabled:$,id:M,name:H,required:b,style:zf,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:F,onChange(fe){if(fe.nativeEvent.defaultPrevented)return;const ie=fe.target.checked,ye=tt(Oi,fe.nativeEvent);z==null||z(ie,ye),!ye.isCanceled&&te(ie)},onFocus(){var fe;(fe=ee.current)==null||fe.focus()}},K.getInputValidationProps),[U,$,F,M,H,z,b,te,K]),pe=A.useMemo(()=>({...R,checked:U,disabled:$,readOnly:g,required:b}),[R,U,$,g,b]),xe=wn("span",e,{state:pe,ref:[t,ee,ne],props:[se,K.getValidationProps,E,le],stateAttributesMapping:k2});return x.jsxs(C2.Provider,{value:pe,children:[xe,!U&&H&&w!==void 0&&x.jsx("input",{type:"hidden",name:H,value:w}),x.jsx("input",{...he})]})}),zz=A.forwardRef(function(e,t){const{render:i,className:r,...o}=e,{state:a}=oo(),u=Oz(),f={...a,...u};return wn("span",e,{state:f,ref:t,stateAttributesMapping:k2,props:o})});function A2(n){const e=A.useRef(!0);e.current&&(e.current=!1,n())}const E2=A.createContext(null),R2=A.createContext(null);function ao(){const n=A.useContext(E2);if(n===null)throw new Error(ri(60));return n}function T2(){const n=A.useContext(R2);if(n===null)throw new Error(ri(61));return n}const O2=(n,e)=>Object.is(n,e);function Qr(n,e,t){return n==null||e==null?Object.is(n,e):t(n,e)}function _o(n,e,t){return!n||n.length===0?!1:n.some(i=>i===void 0?!1:Qr(i,e,t))}function Oc(n,e,t){return!n||n.length===0?-1:n.findIndex(i=>i===void 0?!1:Qr(i,e,t))}function M2(n,e,t){return n.filter(i=>!Qr(i,e,t))}function _0(n){if(n==null)return"";if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}}function N2(n){return n!=null&&n.length>0&&typeof n[0]=="object"&&n[0]!=null&&"items"in n[0]}function Dn(n,e){if(e&&n!=null)return e(n)??"";if(n&&typeof n=="object"){if("label"in n&&n.label!=null)return String(n.label);if("value"in n)return String(n.value)}return _0(n)}function Jo(n,e){return e&&n!=null?e(n)??"":n&&typeof n=="object"&&"value"in n&&"label"in n?_0(n.value):_0(n)}function Iz(n,e,t){if(t&&n!=null)return t(n);if(n&&typeof n=="object"&&"label"in n&&n.label!=null)return n.label;if(e&&!Array.isArray(e))return e[n]??Dn(n,t);if(Array.isArray(e)){const i=N2(e)?e.flatMap(r=>r.items):e;if(n==null){const r=i.find(o=>o.value==null);return r&&r.label!=null?r.label:Dn(n,t)}if(typeof n!="object"){const r=i.find(o=>o&&o.value===n);return r&&r.label!=null?r.label:Dn(n,t)}if("value"in n){const r=i.find(o=>o&&o.value===n.value);if(r&&r.label!=null)return r.label}}return Dn(n,t)}function Pz(n,e){return!Array.isArray(n)||n.length===0?"":n.map(t=>Dn(t,e)).join(", ")}const pt={id:de(n=>n.id),modal:de(n=>n.modal),multiple:de(n=>n.multiple),items:de(n=>n.items),itemToStringLabel:de(n=>n.itemToStringLabel),itemToStringValue:de(n=>n.itemToStringValue),isItemEqualToValue:de(n=>n.isItemEqualToValue),value:de(n=>n.value),open:de(n=>n.open),mounted:de(n=>n.mounted),forceMount:de(n=>n.forceMount),transitionStatus:de(n=>n.transitionStatus),touchModality:de(n=>n.touchModality),activeIndex:de(n=>n.activeIndex),selectedIndex:de(n=>n.selectedIndex),isActive:de((n,e)=>n.activeIndex===e),isSelected:de((n,e,t)=>{const i=n.isItemEqualToValue,r=n.value;return n.multiple?Array.isArray(r)&&r.some(o=>Qr(o,t,i)):n.selectedIndex===e&&n.selectedIndex!==null?!0:Qr(r,t,i)}),isSelectedByFocus:de((n,e)=>n.selectedIndex===e),popupProps:de(n=>n.popupProps),triggerProps:de(n=>n.triggerProps),triggerElement:de(n=>n.triggerElement),positionerElement:de(n=>n.positionerElement),listElement:de(n=>n.listElement),scrollUpArrowVisible:de(n=>n.scrollUpArrowVisible),scrollDownArrowVisible:de(n=>n.scrollDownArrowVisible),hasScrollArrows:de(n=>n.hasScrollArrows),serializedValue:de(n=>{const{multiple:e,value:t,itemToStringValue:i}=n;return e&&Array.isArray(t)&&t.length===0?"":Jo(t,i)})};function Hz(n){const{id:e,value:t,defaultValue:i=null,onValueChange:r,open:o,defaultOpen:a=!1,onOpenChange:u,name:f,disabled:d=!1,readOnly:p=!1,required:g=!1,modal:b=!0,actionsRef:v,inputRef:S,onOpenChangeComplete:w,items:E,multiple:k=!1,itemToStringLabel:R,itemToStringValue:N,isItemEqualToValue:T=O2,highlightItemOnHover:B=!0,children:L}=n,{clearErrors:D}=Wp(),{setDirty:j,shouldValidateOnChange:X,validityData:J,setFilled:V,name:K,disabled:ae,validation:$}=oo(),{controlId:H}=Vc(),z=yv({id:e}),Q=ae||d,F=K??f,[ee,G]=lc({controlled:t,default:k?i??Dl:i,name:"Select",state:"value"}),[M,U]=lc({controlled:o,default:a,name:"Select",state:"open"}),te=A.useRef([]),le=A.useRef([]),ne=A.useRef(null),se=A.useRef(null),he=A.useRef(0),pe=A.useRef(null),xe=A.useRef([]),fe=A.useRef(!1),ie=A.useRef(!1),ye=A.useRef(null),ve=A.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Qe=A.useRef(!1),{mounted:Re,setMounted:me,transitionStatus:ke}=Gp(M),be=Bi(()=>new Zo({id:z,modal:b,multiple:k,itemToStringLabel:R,itemToStringValue:N,isItemEqualToValue:T,value:ee,open:M,mounted:Re,transitionStatus:ke,items:E,forceMount:!1,touchModality:!1,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,De=ge(be,pt.activeIndex),qe=ge(be,pt.selectedIndex),je=ge(be,pt.triggerElement),Te=ge(be,pt.positionerElement),we=A.useMemo(()=>k&&Array.isArray(ee)&&ee.length===0?"":Jo(ee,N),[k,ee,N]),Ae=Vn(be.state.triggerElement);gv({id:z,commit:$.commit,value:ee,controlRef:Ae,name:F,getValue:()=>ee});const Ce=A.useRef(ee);ze(()=>{ee!==Ce.current&&be.set("forceMount",!0)},[be,ee]),ze(()=>{V(ee!==null)},[ee,V]),ze(function(){if(M)return;const it=xe.current;if(k){const Qt=Array.isArray(ee)?ee:[];if(Qt.length===0){be.set("selectedIndex",null);return}const sn=Qt[Qt.length-1],Rn=Oc(it,sn,T);be.set("selectedIndex",Rn===-1?null:Rn);return}const Et=Oc(it,ee,T);be.set("selectedIndex",Et===-1?null:Et)},[k,M,ee,xe,T,be]),Ja(ee,()=>{D(F),j(ee!==J.initialValue),X()?$.commit(ee):$.commit(ee,!0)});const Ze=He((Ge,it)=>{if(u==null||u(Ge,it),!it.isCanceled&&(U(Ge),!Ge&&be.state.activeIndex!==null)){const Et=te.current[be.state.activeIndex];queueMicrotask(()=>{Et==null||Et.setAttribute("tabindex","-1")})}}),nt=He(()=>{me(!1),be.set("activeIndex",null),w==null||w(!1)});da({enabled:!v,open:M,ref:ne,onComplete(){M||nt()}}),A.useImperativeHandle(v,()=>({unmount:nt}),[nt]);const _e=He((Ge,it)=>{r==null||r(Ge,it),!it.isCanceled&&G(Ge)}),rt=He(()=>{const Ge=be.state.listElement||ne.current;if(!Ge)return;const it=Ge.scrollTop,Et=Ge.scrollTop+Ge.clientHeight,Qt=it>1,sn=Et<Ge.scrollHeight-1;be.state.scrollUpArrowVisible!==Qt&&be.set("scrollUpArrowVisible",Qt),be.state.scrollDownArrowVisible!==sn&&be.set("scrollDownArrowVisible",sn)}),at=fv({open:M,onOpenChange:Ze,elements:{reference:je,floating:Te}}),Lt=lv(at,{enabled:!p&&!Q,event:"mousedown"}),nn=av(at,{bubbles:!1}),ht=h2(at,{enabled:!p&&!Q,listRef:te,activeIndex:De,selectedIndex:qe,disabledIndices:Dl,onNavigate(Ge){Ge===null&&!M||be.set("activeIndex",Ge)},focusItemOnHover:!1}),Ue=d2(at,{enabled:!p&&!Q&&(M||!k),listRef:le,activeIndex:De,selectedIndex:qe,onMatch(Ge){M?be.set("activeIndex",Ge):_e(xe.current[Ge],tt("none"))},onTypingChange(Ge){fe.current=Ge}}),{getReferenceProps:Jt,getFloatingProps:Pt,getItemProps:es}=hv([Lt,nn,ht,Ue]);A2(()=>{be.update({popupProps:Pt(),triggerProps:Jt()})}),ze(()=>{be.update({id:z,modal:b,multiple:k,value:ee,open:M,mounted:Re,transitionStatus:ke,popupProps:Pt(),triggerProps:Jt(),items:E,itemToStringLabel:R,itemToStringValue:N,isItemEqualToValue:T})},[be,z,b,k,ee,M,Re,ke,Pt,Jt,E,R,N,T]);const dn=A.useMemo(()=>({store:be,name:F,required:g,disabled:Q,readOnly:p,multiple:k,itemToStringLabel:R,itemToStringValue:N,highlightItemOnHover:B,setValue:_e,setOpen:Ze,listRef:te,popupRef:ne,scrollHandlerRef:se,handleScrollArrowVisibility:rt,scrollArrowsMountedCountRef:he,getItemProps:es,events:at.context.events,valueRef:pe,valuesRef:xe,labelsRef:le,typingRef:fe,selectionRef:ve,selectedItemTextRef:ye,validation:$,onOpenChangeComplete:w,keyboardActiveRef:ie,alignItemWithTriggerActiveRef:Qe,initialValueRef:Ce}),[be,F,g,Q,p,k,R,N,B,_e,Ze,es,at.context.events,$,w,rt]),At=Zl(S,$.inputRef),st=k&&Array.isArray(ee)&&ee.length>0,pn=A.useMemo(()=>!k||!Array.isArray(ee)||!F?null:ee.map(Ge=>{const it=Jo(Ge,N);return x.jsx("input",{type:"hidden",name:F,value:it},it)}),[k,ee,F,N]);return x.jsx(E2.Provider,{value:dn,children:x.jsxs(R2.Provider,{value:at,children:[L,x.jsx("input",{...$.getInputValidationProps({onFocus(){var Ge;(Ge=be.state.triggerElement)==null||Ge.focus()},onChange(Ge){if(Ge.nativeEvent.defaultPrevented)return;const it=Ge.target.value,Et=tt(Oi,Ge.nativeEvent);function Qt(){if(k)return;const sn=xe.current.find(Rn=>Jo(Rn,N).toLowerCase()===it.toLowerCase());sn!=null&&(j(sn!==J.initialValue),_e(sn,Et),X()&&$.commit(sn))}be.set("forceMount",!0),queueMicrotask(Qt)}}),id:e||H||void 0,name:k?void 0:F,value:we,disabled:Q,required:g&&!st,readOnly:p,ref:At,style:zf,tabIndex:-1,"aria-hidden":!0}),pn]})})}function D2(n){const e=n.getBoundingClientRect(),t=window.getComputedStyle(n,"::before"),i=window.getComputedStyle(n,"::after");if(!(t.content!=="none"||i.content!=="none"))return e;const o=parseFloat(t.width)||0,a=parseFloat(t.height)||0,u=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d=Math.max(e.width,o,u),p=Math.max(e.height,a,f),g=d-e.width,b=p-e.height;return{left:e.left-g/2,right:e.right+g/2,top:e.top-b/2,bottom:e.bottom+b/2}}const gd=2,Vz={...Wb,...Yp,value:()=>null},_z=A.forwardRef(function(e,t){const{render:i,className:r,disabled:o=!1,nativeButton:a=!0,...u}=e,{setTouched:f,setFocused:d,validationMode:p,state:g,disabled:b}=oo(),{labelId:v}=Vc(),{store:S,setOpen:w,selectionRef:E,validation:k,readOnly:R,alignItemWithTriggerActiveRef:N,disabled:T,keyboardActiveRef:B}=ao(),L=b||T||o,D=ge(S,pt.open),j=ge(S,pt.value),X=ge(S,pt.triggerProps),J=ge(S,pt.positionerElement),V=ge(S,pt.listElement),K=ge(S,pt.serializedValue),ae=Vn(J),$=A.useRef(null),H=$i(),z=$i(),{getButtonProps:Q,buttonRef:F}=Df({disabled:L,native:a}),ee=He(se=>{S.set("triggerElement",se)}),G=Zl(t,$,F,ee),M=$i(),U=$i();A.useEffect(()=>{if(D)return U.start(200,()=>{E.current.allowUnselectedMouseUp=!0,M.start(200,()=>{E.current.allowSelectedMouseUp=!0})}),()=>{M.clear(),U.clear()};E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},z.clear()},[D,E,z,M,U]);const te=A.useMemo(()=>{var se;return(V==null?void 0:V.id)??((se=cf(J))==null?void 0:se.id)},[V,J]),le=jp(X,{role:"combobox","aria-expanded":D?"true":"false","aria-haspopup":"listbox","aria-controls":D?te:void 0,"aria-labelledby":v,"aria-readonly":R||void 0,tabIndex:L?-1:0,ref:G,onFocus(se){d(!0),D&&N.current&&w(!1,tt(Pp,se.nativeEvent)),H.start(0,()=>{S.set("forceMount",!0)})},onBlur(){f(!0),d(!1),p==="onBlur"&&k.commit(j)},onPointerMove({pointerType:se}){B.current=!1,S.set("touchModality",se==="touch")},onPointerDown({pointerType:se}){S.set("touchModality",se==="touch")},onKeyDown(){B.current=!0},onMouseDown(se){if(D)return;const he=Fr(se.currentTarget);function pe(xe){if(!$.current)return;const fe=xe.target;if(Dt($.current,fe)||Dt(ae.current,fe)||fe===$.current)return;const ie=D2($.current);xe.clientX>=ie.left-gd&&xe.clientX<=ie.right+gd&&xe.clientY>=ie.top-gd&&xe.clientY<=ie.bottom+gd||w(!1,tt(TB,xe))}z.start(0,()=>{he.addEventListener("mouseup",pe,{once:!0})})}},k.getValidationProps,u,Q);le.role="combobox";const ne=A.useMemo(()=>({...g,open:D,disabled:L,value:j,readOnly:R,placeholder:!K}),[g,D,L,j,R,K]);return wn("button",e,{ref:[t,$],state:ne,stateAttributesMapping:Vz,props:le})}),Uz={value:()=>null},qz=A.forwardRef(function(e,t){const{className:i,render:r,children:o,...a}=e,{store:u,valueRef:f}=ao(),d=ge(u,pt.value),p=ge(u,pt.items),g=ge(u,pt.itemToStringLabel),b=ge(u,pt.serializedValue),v=A.useMemo(()=>({value:d,placeholder:!b}),[d,b]),S=typeof o=="function"?o(d):o??(Array.isArray(d)?Pz(d,g):Iz(d,p,g));return wn("span",e,{state:v,ref:[t,f],props:[{children:S},a],stateAttributesMapping:Uz})}),Fz=A.forwardRef(function(e,t){const{className:i,render:r,...o}=e,{store:a}=ao(),u=ge(a,pt.open),f=A.useMemo(()=>({open:u}),[u]);return wn("span",e,{state:f,ref:t,props:[{"aria-hidden":!0,children:"▼"},o],stateAttributesMapping:hB})}),Gz=A.createContext(void 0),Qz=A.forwardRef(function(e,t){const{store:i}=ao(),r=ge(i,pt.mounted),o=ge(i,pt.forceMount);return r||o?x.jsx(Gz.Provider,{value:!0,children:x.jsx(iv,{ref:t,...e})}):null}),j2=A.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Kz(){return A.useContext(j2)}function B2(n){const{children:e,elementsRef:t,labelsRef:i,onMapChange:r}=n,o=He(r),a=A.useRef(0),u=Bi(Wz).current,f=Bi(Yz).current,[d,p]=A.useState(0),g=A.useRef(d),b=He((k,R)=>{f.set(k,R??null),g.current+=1,p(g.current)}),v=He(k=>{f.delete(k),g.current+=1,p(g.current)}),S=A.useMemo(()=>{const k=new Map;return Array.from(f.keys()).filter(N=>N.isConnected).sort(Xz).forEach((N,T)=>{const B=f.get(N)??{};k.set(N,{...B,index:T})}),k},[f,d]);ze(()=>{if(typeof MutationObserver!="function"||S.size===0)return;const k=new MutationObserver(R=>{const N=new Set,T=B=>N.has(B)?N.delete(B):N.add(B);R.forEach(B=>{B.removedNodes.forEach(T),B.addedNodes.forEach(T)}),N.size===0&&(g.current+=1,p(g.current))});return S.forEach((R,N)=>{N.parentElement&&k.observe(N.parentElement,{childList:!0})}),()=>{k.disconnect()}},[S]),ze(()=>{g.current===d&&(t.current.length!==S.size&&(t.current.length=S.size),i&&i.current.length!==S.size&&(i.current.length=S.size),a.current=S.size),o(S)},[o,S,t,i,d]),ze(()=>()=>{t.current=[]},[t]),ze(()=>()=>{i&&(i.current=[])},[i]);const w=He(k=>(u.add(k),()=>{u.delete(k)}));ze(()=>{u.forEach(k=>k(S))},[u,S]);const E=A.useMemo(()=>({register:b,unregister:v,subscribeMapChange:w,elementsRef:t,labelsRef:i,nextIndexRef:a}),[b,v,w,t,i,a]);return x.jsx(j2.Provider,{value:E,children:e})}function Yz(){return new Map}function Wz(){return new Set}function Xz(n,e){const t=n.compareDocumentPosition(e);return t&Node.DOCUMENT_POSITION_FOLLOWING||t&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:t&Node.DOCUMENT_POSITION_PRECEDING||t&Node.DOCUMENT_POSITION_CONTAINS?1:0}const $z=A.createContext(void 0);function L2(){const n=A.useContext($z);return(n==null?void 0:n.direction)??"ltr"}const Zz=n=>({name:"arrow",options:n,async fn(e){var ee,G;const{x:t,y:i,placement:r,rects:o,platform:a,elements:u,middlewareData:f}=e,{element:d,padding:p=0,offsetParent:g="real"}=qr(n,e)||{};if(d==null)return{};const b=UE(p),v={x:t,y:i},S=nv(r),w=tv(S),E=await a.getDimensions(d),k=S==="y",R=k?"top":"left",N=k?"bottom":"right",T=k?"clientHeight":"clientWidth",B=o.reference[w]+o.reference[S]-v[S]-o.floating[w],L=v[S]-o.reference[S],D=g==="real"?await((ee=a.getOffsetParent)==null?void 0:ee.call(a,d)):u.floating;let j=u.floating[T]||o.floating[w];(!j||!await((G=a.isElement)==null?void 0:G.call(a,D)))&&(j=u.floating[T]||o.floating[w]);const X=B/2-L/2,J=j/2-E[w]/2-1,V=Math.min(b[R],J),K=Math.min(b[N],J),ae=V,$=j-E[w]-K,H=j/2-E[w]/2+X,z=I0(ae,H,$),Q=!f.arrow&&lo(r)!=null&&H!==z&&o.reference[w]/2-(H<ae?V:K)-E[w]/2<0,F=Q?H<ae?H-ae:H-$:0;return{[S]:v[S]+F,data:{[S]:z,centerOffset:H-z-F,...Q&&{alignmentOffset:F}},reset:Q}}}),Jz=(n,e)=>({...Zz(n),options:[n,e]}),e5={name:"hide",async fn(n){var u;const{width:e,height:t,x:i,y:r}=n.rects.reference,o=e===0&&t===0&&i===0&&r===0;return{data:{referenceHidden:((u=(await bL().fn(n)).data)==null?void 0:u.referenceHidden)||o}}}},t5={sideX:"left",sideY:"top"};function z2(n,e,t){const i=n==="inline-start"||n==="inline-end";return{top:"top",right:i?t?"inline-start":"inline-end":"right",bottom:"bottom",left:i?t?"inline-end":"inline-start":"left"}[e]}function UC(n,e,t){const{rects:i,placement:r}=n;return{side:z2(e,Zi(r),t),align:lo(r)||"center",anchor:{width:i.reference.width,height:i.reference.height},positioner:{width:i.floating.width,height:i.floating.height}}}function I2(n){var es,dn;const{anchor:e,positionMethod:t="absolute",side:i="bottom",sideOffset:r=0,align:o="center",alignOffset:a=0,collisionBoundary:u,collisionPadding:f=5,sticky:d=!1,arrowPadding:p=5,disableAnchorTracking:g=!1,keepMounted:b=!1,floatingRootContext:v,mounted:S,collisionAvoidance:w,shiftCrossAxis:E=!1,nodeId:k,adaptiveOrigin:R,lazyFlip:N=!1,externalTree:T}=n,[B,L]=A.useState(null);!S&&B!==null&&L(null);const D=w.side||"flip",j=w.align||"flip",X=w.fallbackAxisSide||"end",J=typeof e=="function"?e:void 0,V=He(J),K=J?V:e,ae=Vn(e),H=L2()==="rtl",z=B||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":H?"left":"right","inline-start":H?"right":"left"}[i],Q=o==="center"?z:`${z}-${o}`;let F=f;const ee=1,G=i==="bottom"?ee:0,M=i==="top"?ee:0,U=i==="right"?ee:0,te=i==="left"?ee:0;typeof F=="number"?F={top:F+G,right:F+te,bottom:F+M,left:F+U}:F&&(F={top:(F.top||0)+G,right:(F.right||0)+te,bottom:(F.bottom||0)+M,left:(F.left||0)+U});const le={boundary:u==="clipping-ancestors"?"clippingAncestors":u,padding:F},ne=A.useRef(null),se=Vn(r),he=Vn(a),fe=[dL(At=>{const st=UC(At,i,H),pn=typeof se.current=="function"?se.current(st):se.current,Ge=typeof he.current=="function"?he.current(st):he.current;return{mainAxis:pn,crossAxis:Ge,alignmentAxis:Ge}},[typeof r!="function"?r:0,typeof a!="function"?a:0,H,i])],ie=j==="none"&&D!=="shift",ye=!ie&&(d||E||D==="shift"),ve=D==="none"?null:gL({...le,padding:{top:F.top+ee,right:F.right+ee,bottom:F.bottom+ee,left:F.left+ee},mainAxis:!E&&D==="flip",crossAxis:j==="flip"?"alignment":!1,fallbackAxisSideDirection:X}),Qe=ie?null:pL(At=>{const st=Fr(At.elements.floating).documentElement;return{...le,rootBoundary:E?{x:0,y:0,width:st.clientWidth,height:st.clientHeight}:void 0,mainAxis:j!=="none",crossAxis:ye,limiter:d||E?void 0:mL(pn=>{if(!ne.current)return{};const{width:Ge,height:it}=ne.current.getBoundingClientRect(),Et=hs(Zi(pn.placement)),Qt=Et==="y"?Ge:it,sn=Et==="y"?F.left+F.right:F.top+F.bottom;return{offset:Qt/2+sn/2}})}},[le,d,E,F,j]);D==="shift"||j==="shift"||o==="center"?fe.push(Qe,ve):fe.push(ve,Qe),fe.push(yL({...le,apply({elements:{floating:At},rects:{reference:st},availableWidth:pn,availableHeight:Ge}){Object.entries({"--available-width":`${pn}px`,"--available-height":`${Ge}px`,"--anchor-width":`${st.width}px`,"--anchor-height":`${st.height}px`}).forEach(([it,Et])=>{At.style.setProperty(it,Et)})}}),Jz(()=>({element:ne.current||document.createElement("div"),padding:p,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(At){var rn,Tn,yi;const{elements:st,middlewareData:pn,placement:Ge,rects:it,y:Et}=At,Qt=Zi(Ge),sn=hs(Qt),Rn=ne.current,Un=((rn=pn.arrow)==null?void 0:rn.x)||0,oi=((Tn=pn.arrow)==null?void 0:Tn.y)||0,ai=(Rn==null?void 0:Rn.clientWidth)||0,lt=(Rn==null?void 0:Rn.clientHeight)||0,ts=Un+ai/2,ur=oi+lt/2,ys=Math.abs(((yi=pn.shift)==null?void 0:yi.y)||0),zs=it.reference.height/2,Is=typeof r=="function"?r(UC(At,i,H)):r,fr=ys>Is,qn={top:`${ts}px calc(100% + ${Is}px)`,bottom:`${ts}px ${-Is}px`,left:`calc(100% + ${Is}px) ${ur}px`,right:`${-Is}px ${ur}px`}[Qt],Ut=`${ts}px ${it.reference.y+zs-Et}px`;return st.floating.style.setProperty("--transform-origin",ye&&sn==="y"&&fr?Ut:qn),{}}},e5,R),ze(()=>{!S&&v&&v.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[S,v]);const Re=A.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:me,elements:ke,x:be,y:De,middlewareData:qe,update:je,placement:Te,context:we,isPositioned:Ae,floatingStyles:Ce}=XL({rootContext:v,placement:Q,middleware:fe,strategy:t,whileElementsMounted:b?void 0:(...At)=>MC(...At,Re),nodeId:k,externalTree:T}),{sideX:Ze,sideY:nt}=qe.adaptiveOrigin||t5,_e=Ae?t:"fixed",rt=A.useMemo(()=>R?{position:_e,[Ze]:be,[nt]:De}:{position:_e,...Ce},[R,_e,Ze,be,nt,De,Ce]),at=A.useRef(null);ze(()=>{if(!S)return;const At=ae.current,st=typeof At=="function"?At():At,Ge=(qC(st)?st.current:st)||null||null;Ge!==at.current&&(me.setPositionReference(Ge),at.current=Ge)},[S,me,K,ae]),A.useEffect(()=>{if(!S)return;const At=ae.current;typeof At!="function"&&qC(At)&&At.current!==at.current&&(me.setPositionReference(At.current),at.current=At.current)},[S,me,K,ae]),A.useEffect(()=>{if(b&&S&&ke.domReference&&ke.floating)return MC(ke.domReference,ke.floating,je,Re)},[b,S,ke,je,Re]);const Lt=Zi(Te),nn=z2(i,Lt,H),ht=lo(Te)||"center",Ue=!!((es=qe.hide)!=null&&es.referenceHidden);ze(()=>{N&&S&&Ae&&L(Lt)},[N,S,Ae,Lt]);const Jt=A.useMemo(()=>{var At,st;return{position:"absolute",top:(At=qe.arrow)==null?void 0:At.y,left:(st=qe.arrow)==null?void 0:st.x}},[qe.arrow]),Pt=((dn=qe.arrow)==null?void 0:dn.centerOffset)!==0;return A.useMemo(()=>({positionerStyles:rt,arrowStyles:Jt,arrowRef:ne,arrowUncentered:Pt,side:nn,align:ht,physicalSide:Lt,anchorHidden:Ue,refs:me,context:we,isPositioned:Ae,update:je}),[rt,Jt,ne,Pt,nn,ht,Lt,Ue,me,we,Ae,je])}function qC(n){return n!=null&&"current"in n}const P2=A.createContext(void 0);function n5(){const n=A.useContext(P2);if(!n)throw new Error(ri(59));return n}function fp(n,e){n&&Object.assign(n.style,e)}const i5={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},s5={position:"fixed"},r5=A.forwardRef(function(e,t){const{anchor:i,positionMethod:r="absolute",className:o,render:a,side:u="bottom",align:f="center",sideOffset:d=0,alignOffset:p=0,collisionBoundary:g="clipping-ancestors",collisionPadding:b,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:w,alignItemWithTrigger:E=!0,collisionAvoidance:k=OE,...R}=e,{store:N,listRef:T,labelsRef:B,alignItemWithTriggerActiveRef:L,selectedItemTextRef:D,valuesRef:j,initialValueRef:X,popupRef:J,setValue:V}=ao(),K=T2(),ae=ge(N,pt.open),$=ge(N,pt.mounted),H=ge(N,pt.modal),z=ge(N,pt.value),Q=ge(N,pt.touchModality),F=ge(N,pt.positionerElement),ee=ge(N,pt.triggerElement),G=ge(N,pt.isItemEqualToValue),M=A.useRef(null),U=A.useRef(null),[te,le]=A.useState(E),ne=$&&te&&!Q;!$&&te!==E&&le(E),ze(()=>{$||(pt.scrollUpArrowVisible(N.state)&&N.set("scrollUpArrowVisible",!1),pt.scrollDownArrowVisible(N.state)&&N.set("scrollDownArrowVisible",!1))},[N,$]),A.useImperativeHandle(L,()=>ne),mv((ne||H)&&ae&&!Q,ee);const se=I2({anchor:i,floatingRootContext:K,positionMethod:r,mounted:$,side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:v,collisionBoundary:g,collisionPadding:b,sticky:S,disableAnchorTracking:w??ne,collisionAvoidance:k,keepMounted:!0}),he=ne?"none":se.side,pe=ne?s5:se.positionerStyles,xe=A.useMemo(()=>{const me={};return ae||(me.pointerEvents="none"),{role:"presentation",hidden:!$,style:{...pe,...me}}},[ae,$,pe]),fe=A.useMemo(()=>({open:ae,side:he,align:se.align,anchorHidden:se.anchorHidden}),[ae,he,se.align,se.anchorHidden]),ie=He(me=>{N.set("positionerElement",me)}),ye=wn("div",e,{ref:[t,ie],state:fe,stateAttributesMapping:Pc,props:[xe,R]}),ve=A.useRef(0),Qe=He(me=>{if(me.size===0&&ve.current===0||j.current.length===0)return;const ke=ve.current;if(ve.current=me.size,me.size===ke)return;const be=tt(Oi);if(ke!==0&&!N.state.multiple&&z!==null&&Oc(j.current,z,G)===-1){const qe=X.current,Te=qe!=null&&_o(j.current,qe,G)?qe:null;V(Te,be),Te===null&&(N.set("selectedIndex",null),D.current=null)}if(ke!==0&&N.state.multiple&&Array.isArray(z)){const De=z.filter(qe=>_o(j.current,qe,G));(De.length!==z.length||De.some(qe=>!_o(z,qe,G)))&&(V(De,be),De.length===0&&(N.set("selectedIndex",null),D.current=null))}if(ae&&ne){N.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const De={height:""};fp(F,De),fp(J.current,De)}}),Re=A.useMemo(()=>({...se,side:he,alignItemWithTriggerActive:ne,setControlledAlignItemWithTrigger:le,scrollUpArrowRef:M,scrollDownArrowRef:U}),[se,he,ne,le]);return x.jsx(B2,{elementsRef:T,labelsRef:B,onMapChange:Qe,children:x.jsxs(P2.Provider,{value:Re,children:[$&&H&&x.jsx(pv,{inert:dv(!ae),cutout:ee}),ye]})})});function H2(n){const e=n.currentTarget.getBoundingClientRect();return e.top+1<=n.clientY&&n.clientY<=e.bottom-1&&e.left+1<=n.clientX&&n.clientX<=e.right-1}const yd="base-ui-disable-scrollbar",FC={className:yd,element:x.jsx("style",{href:yd,precedence:"base-ui:low",children:`.${yd}{scrollbar-width:none}.${yd}::-webkit-scrollbar{display:none}`})},l5=A.createContext(void 0);function o5(n){return A.useContext(l5)}function V2(n){return n==="starting"?Jj:_n}const a5={...Pc,...Nf},c5=A.forwardRef(function(e,t){const{render:i,className:r,...o}=e,{store:a,popupRef:u,onOpenChangeComplete:f,setOpen:d,valueRef:p,selectedItemTextRef:g,keyboardActiveRef:b,multiple:v,handleScrollArrowVisibility:S,scrollHandlerRef:w}=ao(),{side:E,align:k,alignItemWithTriggerActive:R,setControlledAlignItemWithTrigger:N,scrollDownArrowRef:T,scrollUpArrowRef:B}=n5(),L=o5()!=null,D=T2(),j=$i(),X=ge(a,pt.id),J=ge(a,pt.open),V=ge(a,pt.mounted),K=ge(a,pt.popupProps),ae=ge(a,pt.transitionStatus),$=ge(a,pt.triggerElement),H=ge(a,pt.positionerElement),z=ge(a,pt.listElement),Q=A.useRef(0),F=A.useRef(!1),ee=A.useRef(0),G=A.useRef(!1),M=A.useRef({}),U=qp(),te=He(he=>{if(!H||!u.current||!G.current)return;if(F.current||!R){S();return}const pe=H.style.top==="0px",xe=H.style.bottom==="0px",fe=H.getBoundingClientRect().height,ie=Fr(H),ye=getComputedStyle(H),ve=parseFloat(ye.marginTop),Qe=parseFloat(ye.marginBottom),Re=ie.documentElement.clientHeight-ve-Qe,me=he.scrollTop,ke=he.scrollHeight,be=he.clientHeight,De=ke-be;let qe=null,je=null,Te=!1;if(pe){const we=De-me,Ae=fe+we,Ce=Math.min(Ae,Re);qe=Ce,Ce!==Re?je=De:Te=!0}else if(xe){const we=me-0,Ae=fe+we,Ce=Math.min(Ae,Re),Ze=Ae-Re;qe=Ce,Ce!==Re?je=0:(Te=!0,me<De&&(je=me-(we-Ze)))}qe!=null&&(H.style.height=`${qe}px`),je!=null&&(he.scrollTop=je),Te&&(F.current=!0),S()});A.useImperativeHandle(w,()=>te,[te]),da({open:J,ref:u,onComplete(){J&&(f==null||f(!0))}});const le=A.useMemo(()=>({open:J,transitionStatus:ae,side:E,align:k}),[J,ae,E,k]);ze(()=>{!H||!u.current||Object.keys(M.current).length||(M.current={top:H.style.top||"0",left:H.style.left||"0",right:H.style.right,height:H.style.height,bottom:H.style.bottom,minHeight:H.style.minHeight,maxHeight:H.style.maxHeight,marginTop:H.style.marginTop,marginBottom:H.style.marginBottom})},[u,H]),ze(()=>{V||R||(G.current=!1,F.current=!1,Q.current=0,ee.current=0,fp(H,M.current))},[V,R,H,u]),ze(()=>{const he=u.current;if(!(!V||!$||!H||!he)){if(!R){G.current=!0,U.request(S);return}queueMicrotask(()=>{var it;const pe=getComputedStyle(H),xe=getComputedStyle(he),fe=Fr($),ie=In(H),ye=$.getBoundingClientRect(),ve=H.getBoundingClientRect(),Qe=ye.left,Re=ye.height,me=z||he,ke=me.scrollHeight,be=parseFloat(xe.borderBottomWidth),De=parseFloat(pe.marginTop)||10,qe=parseFloat(pe.marginBottom)||10,je=parseFloat(pe.minHeight)||100,Te=5,we=5,Ae=20,Ce=fe.documentElement.clientHeight-De-qe,Ze=fe.documentElement.clientWidth,nt=Ce-ye.bottom+Re,_e=g.current,rt=p.current;let at=0,Lt=0;if(_e&&rt){const Et=rt.getBoundingClientRect(),Qt=_e.getBoundingClientRect(),sn=Et.left-Qe,Rn=Qt.left-ve.left,Un=Et.top-ye.top+Et.height/2,oi=Qt.top-ve.top+Qt.height/2;at=sn-Rn,Lt=oi-Un}const nn=nt+Lt+qe+be;let ht=Math.min(Ce,nn);const Ue=Ce-De-qe,Jt=nn-ht,Pt=Math.max(Te,Qe+at),es=Ze-we,dn=Math.max(0,Pt+ve.width-es);H.style.left=`${Pt-dn}px`,H.style.height=`${ht}px`,H.style.maxHeight="auto",H.style.marginTop=`${De}px`,H.style.marginBottom=`${qe}px`,he.style.height="100%";const At=me.scrollHeight-me.clientHeight,st=Jt>=At;st&&(ht=Math.min(Ce,ve.height)-(Jt-At));const pn=ye.top<Ae||ye.bottom>Ce-Ae||ht<Math.min(ke,je),Ge=(((it=ie.visualViewport)==null?void 0:it.scale)??1)!==1&&LE;if(pn||Ge){G.current=!0,fp(H,M.current),Gr.flushSync(()=>N(!1));return}if(st){const Et=Math.max(0,Ce-nn);H.style.top=ve.height>=Ue?"0":`${Et}px`,H.style.height=`${ht}px`,me.scrollTop=me.scrollHeight-me.clientHeight,Q.current=Math.max(je,ht)}else H.style.bottom="0",Q.current=Math.max(je,ht),me.scrollTop=Jt;Q.current===Ce&&(F.current=!0),S(),setTimeout(()=>{G.current=!0})})}},[a,V,H,$,p,g,u,S,R,N,U,T,B,z]),A.useEffect(()=>{if(!R||!H||!V)return;const he=In(H);function pe(xe){d(!1,tt(MB,xe))}return he.addEventListener("resize",pe),()=>{he.removeEventListener("resize",pe)}},[d,R,H,V]);const ne={...z?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":v||void 0,id:`${X}-list`},onKeyDown(he){b.current=!0,L&&S2.has(he.key)&&he.stopPropagation()},onMouseMove(){b.current=!1},onPointerLeave(he){if(H2(he)||he.pointerType==="touch")return;const pe=he.currentTarget;j.start(0,()=>{a.set("activeIndex",null),pe.focus({preventScroll:!0})})},onScroll(he){var pe;z||(pe=w.current)==null||pe.call(w,he.currentTarget)},...R&&{style:z?{height:"100%"}:i5}},se=wn("div",e,{ref:[t,u],state:le,stateAttributesMapping:a5,props:[K,ne,V2(ae),{className:!z&&R?FC.className:void 0},o]});return x.jsxs(A.Fragment,{children:[FC.element,x.jsx(rv,{context:D,modal:!1,disabled:!V,restoreFocus:!0,children:se})]})});let bv=(function(n){return n[n.None=0]="None",n[n.GuessFromOrder=1]="GuessFromOrder",n})({});function _2(n={}){const{label:e,metadata:t,textRef:i,indexGuessBehavior:r,index:o}=n,{register:a,unregister:u,subscribeMapChange:f,elementsRef:d,labelsRef:p,nextIndexRef:g}=Kz(),b=A.useRef(-1),[v,S]=A.useState(o??(r===bv.GuessFromOrder?()=>{if(b.current===-1){const k=g.current;g.current+=1,b.current=k}return b.current}:-1)),w=A.useRef(null),E=A.useCallback(k=>{var R;if(w.current=k,v!==-1&&k!==null&&(d.current[v]=k,p)){const N=e!==void 0;p.current[v]=N?e:((R=i==null?void 0:i.current)==null?void 0:R.textContent)??k.textContent}},[v,d,p,e,i]);return ze(()=>{if(o!=null)return;const k=w.current;if(k)return a(k,t),()=>{u(k)}},[o,a,u,t]),ze(()=>{if(o==null)return f(k=>{var N;const R=w.current?(N=k.get(w.current))==null?void 0:N.index:null;R!=null&&S(R)})},[o,f,S]),A.useMemo(()=>({ref:E,index:v}),[v,E])}const U2=A.createContext(void 0);function vv(){const n=A.useContext(U2);if(!n)throw new Error(ri(57));return n}const u5=A.memo(A.forwardRef(function(e,t){const{render:i,className:r,value:o=null,label:a,disabled:u=!1,nativeButton:f=!1,...d}=e,p=A.useRef(null),g=_2({label:a,textRef:p,indexGuessBehavior:bv.GuessFromOrder}),{store:b,getItemProps:v,setOpen:S,setValue:w,selectionRef:E,typingRef:k,valuesRef:R,keyboardActiveRef:N,multiple:T,highlightItemOnHover:B}=ao(),L=$i(),D=ge(b,pt.isActive,g.index),j=ge(b,pt.isSelected,g.index,o),X=ge(b,pt.isSelectedByFocus,g.index),J=ge(b,pt.isItemEqualToValue),V=g.index,K=V!==-1,ae=A.useRef(null),$=Vn(V);ze(()=>{if(!K)return;const se=R.current;return se[V]=o,()=>{delete se[V]}},[K,V,o,R]),ze(()=>{if(!K)return;const se=b.state.value;let he=se;T&&Array.isArray(se)&&se.length>0&&(he=se[se.length-1]),he!==void 0&&Qr(he,o,J)&&b.set("selectedIndex",V)},[K,V,T,J,b,o]);const H=A.useMemo(()=>({disabled:u,selected:j,highlighted:D}),[u,j,D]),z=v({active:D,selected:j});z.onFocus=void 0,z.id=void 0;const Q=A.useRef(null),F=A.useRef("mouse"),ee=A.useRef(!1),{getButtonProps:G,buttonRef:M}=Df({disabled:u,focusableWhenDisabled:!0,native:f});function U(se){const he=b.state.value;if(T){const pe=Array.isArray(he)?he:[],xe=j?M2(pe,o,J):[...pe,o];w(xe,tt(Id,se))}else w(o,tt(Id,se)),S(!1,tt(Id,se))}const te={role:"option","aria-selected":j,"aria-disabled":u||void 0,tabIndex:D?0:-1,onFocus(){b.set("activeIndex",V)},onMouseEnter(){!N.current&&b.state.selectedIndex===null&&b.set("activeIndex",V)},onMouseMove(){B&&b.set("activeIndex",V)},onMouseLeave(se){!B||N.current||H2(se)||L.start(0,()=>{b.state.activeIndex===V&&b.set("activeIndex",null)})},onTouchStart(){E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(se){Q.current=se.key,b.set("activeIndex",V)},onClick(se){ee.current=!1,!(se.type==="keydown"&&Q.current===null)&&(u||Q.current===" "&&k.current||F.current!=="touch"&&!D||(Q.current=null,U(se.nativeEvent)))},onPointerEnter(se){F.current=se.pointerType},onPointerDown(se){F.current=se.pointerType,ee.current=!0},onMouseUp(se){if(u)return;if(ee.current){ee.current=!1;return}const he=!E.current.allowSelectedMouseUp&&j,pe=!E.current.allowUnselectedMouseUp&&!j;he||pe||F.current!=="touch"&&!D||U(se.nativeEvent)}},le=wn("div",e,{ref:[M,t,g.ref,ae],state:H,props:[z,te,d,G]}),ne=A.useMemo(()=>({selected:j,indexRef:$,textRef:p,selectedByFocus:X,hasRegistered:K}),[j,$,p,X,K]);return x.jsx(U2.Provider,{value:ne,children:le})})),f5=A.forwardRef(function(e,t){const i=e.keepMounted??!1,{selected:r}=vv();return i||r?x.jsx(h5,{...e,ref:t}):null}),h5=A.memo(A.forwardRef((n,e)=>{const{render:t,className:i,keepMounted:r,...o}=n,{selected:a}=vv(),u=A.useRef(null),{transitionStatus:f,setMounted:d}=Gp(a),p=A.useMemo(()=>({selected:a,transitionStatus:f}),[a,f]),g=wn("span",n,{ref:[e,u],state:p,props:[{"aria-hidden":!0,children:"✔️"},o],stateAttributesMapping:Nf});return da({open:a,ref:u,onComplete(){a||d(!1)}}),g})),d5=A.memo(A.forwardRef(function(e,t){const{indexRef:i,textRef:r,selectedByFocus:o,hasRegistered:a}=vv(),{selectedItemTextRef:u}=ao(),{className:f,render:d,...p}=e,g=A.useCallback(v=>{if(!v||!a)return;const S=u.current===null||!u.current.isConnected;(o||S&&i.current===0)&&(u.current=v)},[u,i,o,a]);return wn("div",e,{ref:[g,t,r],props:p})})),q2=A.createContext(void 0),F2=A.createContext(void 0),G2=A.createContext(void 0),Q2=A.createContext("");function co(){const n=A.useContext(q2);if(!n)throw new Error(ri(22));return n}function Xp(){const n=A.useContext(F2);if(!n)throw new Error(ri(23));return n}function pa(){const n=A.useContext(G2);if(!n)throw new Error(ri(24));return n}function K2(){return A.useContext(Q2)}const Ve={id:de(n=>n.id),query:de(n=>n.query),items:de(n=>n.items),selectedValue:de(n=>n.selectedValue),open:de(n=>n.open),mounted:de(n=>n.mounted),forceMounted:de(n=>n.forceMounted),inline:de(n=>n.inline),activeIndex:de(n=>n.activeIndex),selectedIndex:de(n=>n.selectedIndex),isActive:de((n,e)=>n.activeIndex===e),isSelected:de((n,e)=>{const t=n.isItemEqualToValue,i=n.selectedValue;return Array.isArray(i)?i.some(r=>Qr(r,e,t)):Qr(i,e,t)}),transitionStatus:de(n=>n.transitionStatus),popupProps:de(n=>n.popupProps),inputProps:de(n=>n.inputProps),triggerProps:de(n=>n.triggerProps),getItemProps:de(n=>n.getItemProps),positionerElement:de(n=>n.positionerElement),listElement:de(n=>n.listElement),triggerElement:de(n=>n.triggerElement),inputElement:de(n=>n.inputElement),popupSide:de(n=>n.popupSide),openMethod:de(n=>n.openMethod),inputInsidePopup:de(n=>n.inputInsidePopup),selectionMode:de(n=>n.selectionMode),listRef:de(n=>n.listRef),labelsRef:de(n=>n.labelsRef),popupRef:de(n=>n.popupRef),emptyRef:de(n=>n.emptyRef),inputRef:de(n=>n.inputRef),keyboardActiveRef:de(n=>n.keyboardActiveRef),chipsContainerRef:de(n=>n.chipsContainerRef),clearRef:de(n=>n.clearRef),valuesRef:de(n=>n.valuesRef),allValuesRef:de(n=>n.allValuesRef),name:de(n=>n.name),disabled:de(n=>n.disabled),readOnly:de(n=>n.readOnly),required:de(n=>n.required),grid:de(n=>n.grid),isGrouped:de(n=>n.isGrouped),virtualized:de(n=>n.virtualized),onOpenChangeComplete:de(n=>n.onOpenChangeComplete),openOnInputClick:de(n=>n.openOnInputClick),itemToStringLabel:de(n=>n.itemToStringLabel),isItemEqualToValue:de(n=>n.isItemEqualToValue),modal:de(n=>n.modal),autoHighlight:de(n=>n.autoHighlight),submitOnItemClick:de(n=>n.submitOnItemClick)};function p5(n,e){return(t,i)=>{if(t==null)return!1;const r=Dn(t,e);return n.contains(r,i)}}function m5(n,e,t){return(i,r)=>{if(i==null)return!1;if(!r)return!0;const o=Dn(i,e),a=t!=null?Dn(t,e):"";return a&&n.contains(a,r)&&a.length===r.length?!0:n.contains(o,r)}}const GC=new Map;function Y2(n){return Array.isArray(n)?n.map(e=>Y2(e)).join(","):n==null?"":String(n)}function g5(n={}){const e={usage:"search",sensitivity:"base",ignorePunctuation:!0,...n},t=`${Y2(n.locale)}|${JSON.stringify(e)}`,i=GC.get(t);if(i)return i;const r=new Intl.Collator(n.locale,e),o={contains(a,u,f){if(!u)return!0;const d=Dn(a,f);for(let p=0;p<=d.length-u.length;p+=1)if(r.compare(d.slice(p,p+u.length),u)===0)return!0;return!1},startsWith(a,u,f){if(!u)return!0;const d=Dn(a,f);return r.compare(d.slice(0,u.length),u)===0},endsWith(a,u,f){if(!u)return!0;const d=Dn(a,f),p=u.length;return d.length>=p&&r.compare(d.slice(d.length-p),u)===0}};return GC.set(t,o),o}const y5=g5,W2=Symbol("none"),jo={value:W2,index:-1};function b5(n){const{id:e,onOpenChangeComplete:t,defaultSelectedValue:i=null,selectedValue:r,onSelectedValueChange:o,defaultInputValue:a,inputValue:u,selectionMode:f="none",onItemHighlighted:d,name:p,disabled:g=!1,readOnly:b=!1,required:v=!1,inputRef:S,grid:w=!1,items:E,filteredItems:k,filter:R,openOnInputClick:N=!0,autoHighlight:T=!1,keepHighlight:B=!1,highlightItemOnHover:L=!0,itemToStringLabel:D,itemToStringValue:j,isItemEqualToValue:X=O2,virtualized:J=!1,inline:V=!1,fillInputOnItemPress:K=!0,modal:ae=!1,limit:$=-1,autoComplete:H="list",locale:z,submitOnItemClick:Q=!1}=n,{clearErrors:F}=Wp(),{setDirty:ee,validityData:G,shouldValidateOnChange:M,setFilled:U,name:te,disabled:le,validation:ne}=oo(),se=yv({id:e}),he=y5({locale:z}),[pe,xe]=A.useState(!1),[fe,ie]=A.useState(null),ye=A.useRef([]),ve=A.useRef([]),Qe=A.useRef(null),Re=A.useRef(null),me=A.useRef(null),ke=A.useRef(!0),be=A.useRef(!1),De=A.useRef(null),qe=A.useRef(null),je=A.useRef(null),Te=A.useRef(jo),we=A.useRef(null),Ae=A.useRef([]),Ce=A.useRef([]),Ze=le||g,nt=te??p,_e=f==="multiple",rt=f==="single",at=u!==void 0||a!==void 0,Lt=E!==void 0,nn=k!==void 0;let ht;T==="always"?ht="always":ht=T?"input-change":!1;const[Ue,Jt]=lc({controlled:r,default:_e?i??Dl:i,name:"Combobox",state:"selectedValue"}),Pt=A.useMemo(()=>R===null?()=>!0:R!==void 0?R:rt&&!pe?m5(he,D,Ue):p5(he,D),[R,rt,Ue,pe,he,D]),es=Bi(()=>at?a??"":rt?Dn(Ue,D):"").current,[dn,At]=lc({controlled:u,default:es,name:"Combobox",state:"inputValue"}),[st,pn]=lc({controlled:n.open,default:n.defaultOpen,name:"Combobox",state:"open"}),Ge=N2(E),it=fe??(dn===""?"":String(dn).trim()),Et=rt?Dn(Ue,D):"",Qt=rt&&!pe&&it!==""&&Et!==""&&Et.length===it.length&&he.contains(Et,it),sn=Qt?"":it,Rn=Lt&&nn&&Qt,Un=A.useMemo(()=>E?Ge?E.flatMap(Me=>Me.items):E:Dl,[E,Ge]),oi=A.useMemo(()=>{if(k&&!Rn)return k;if(!E)return Dl;if(Ge){const Ke=E,Je=[];let Mt=0;for(const ln of Ke){if($>-1&&Mt>=$)break;const On=sn===""?ln.items:ln.items.filter(dr=>Pt(dr,sn,D));if(On.length===0)continue;const vs=$>-1?$-Mt:1/0,nl=On.slice(0,vs);if(nl.length>0){const dr={...ln,items:nl};Je.push(dr),Mt+=nl.length}}return Je}if(sn==="")return $>-1?Un.slice(0,$):Un;const Me=[];for(const Ke of Un){if($>-1&&Me.length>=$)break;Pt(Ke,sn,D)&&Me.push(Ke)}return Me},[k,Rn,E,Ge,sn,$,Pt,D,Un]),ai=A.useMemo(()=>Ge?oi.flatMap(Ke=>Ke.items):oi,[oi,Ge]),lt=Bi(()=>new Zo({id:se,selectedValue:Ue,open:st,filter:Pt,query:it,items:E,selectionMode:f,listRef:ye,labelsRef:ve,popupRef:Qe,emptyRef:me,inputRef:Re,keyboardActiveRef:ke,chipsContainerRef:De,clearRef:qe,valuesRef:Ae,allValuesRef:Ce,selectionEventRef:je,name:nt,disabled:Ze,readOnly:b,required:v,grid:w,isGrouped:Ge,virtualized:J,openOnInputClick:N,itemToStringLabel:D,isItemEqualToValue:X,modal:ae,autoHighlight:ht,submitOnItemClick:Q,hasInputValue:at,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:V,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:t||un,setOpen:un,setInputValue:un,setSelectedValue:un,setIndices:un,onItemHighlighted:un,handleSelection:un,getItemProps:()=>_n,forceMount:un,requestSubmit:un})).current,ts=f==="none"?dn:Ue,ur=He(d),ys=He(t),zs=ge(lt,Ve.activeIndex),Is=ge(lt,Ve.selectedIndex),fr=ge(lt,Ve.positionerElement),qn=ge(lt,Ve.listElement),Ut=ge(lt,Ve.triggerElement),rn=ge(lt,Ve.inputElement),Tn=ge(lt,Ve.inline),yi=ge(lt,Ve.inputInsidePopup),cm=Vn(Ut),{mounted:Ff,setMounted:Gf,transitionStatus:hr}=Gp(st),{openMethod:ma,triggerProps:Ps,reset:Yr}=w2(st);gv({id:se,name:nt,commit:ne.commit,value:ts,controlRef:yi?cm:Re,getValue:()=>ts});const Hs=He(()=>{E?ve.current=ai.map(Me=>Dn(Me,D)):lt.set("forceMounted",!0)}),Wr=A.useRef(Ue);ze(()=>{Ue!==Wr.current&&Hs()},[Hs,Ue]);const Ot=He(Me=>{lt.update(Me);const Ke=Me.type||"none";if(Me.activeIndex!==void 0)if(Me.activeIndex===null)Te.current!==jo&&(Te.current=jo,ur(void 0,zu(Ke,void 0,{index:-1})));else{const Je=Ae.current[Me.activeIndex];Te.current={value:Je,index:Me.activeIndex},ur(Je,zu(Ke,void 0,{index:Me.activeIndex}))}}),ci=He((Me,Ke)=>{var Je;if(be.current=Ke.reason===Ol,(Je=n.onInputValueChange)==null||Je.call(n,Me,Ke),!Ke.isCanceled){if(Ke.reason===Vo){const Mt=Me.trim()!=="";Mt&&xe(!0),we.current={hasQuery:Mt},Mt&&ht&<.state.activeIndex==null&<.set("activeIndex",0)}At(Me)}}),Xr=He((Me,Ke)=>{var Je;st!==Me&&(Ke.reason==="escape-key"&&Lt&&ai.length===0&&!lt.state.emptyRef.current&&Ke.allowPropagation(),(Je=n.onOpenChange)==null||Je.call(n,Me,Ke),!Ke.isCanceled&&(!Me&&pe&&(rt?(ie(it),it===""&&xe(!1)):_e&&(Tn||yi?Ot({activeIndex:null}):ie(it),ci("",tt(Ol,Ke.event)))),pn(Me)))}),bi=He((Me,Ke)=>{if(o==null||o(Me,Ke),Ke.isCanceled)return;Jt(Me),(f==="none"&&Qe.current&&K||rt&&!lt.state.inputInsidePopup)&&ci(Dn(Me,D),tt(Ke.reason,Ke.event)),rt&&Me!=null&&Ke.reason!==Vo&&pe&&ie(it)}),$r=He((Me,Ke)=>{var nl;let Je=Ke;if(Je===void 0){if(zs===null)return;Je=Ae.current[zs]}const Mt=ni(Me),ln=je.current??Me;je.current=null;const On=tt(Id,ln),vs=(nl=Mt==null?void 0:Mt.closest("a"))==null?void 0:nl.getAttribute("href");if(vs){vs.startsWith("#")&&Xr(!1,On);return}if(_e){const dr=Array.isArray(Ue)?Ue:[],xs=_o(dr,Je,lt.state.isItemEqualToValue)?M2(dr,Je,lt.state.isItemEqualToValue):[...dr,Je];if(bi(xs,On),!(Re.current?Re.current.value.trim()!=="":!1))return;lt.state.inputInsidePopup?ci("",tt(Ol,On.event)):Xr(!1,On)}else bi(Je,On),Xr(!1,On)}),Uc=He(()=>{var Ke;if(!lt.state.submitOnItemClick)return;const Me=(Ke=lt.state.inputElement)==null?void 0:Ke.form;Me&&typeof Me.requestSubmit=="function"&&Me.requestSubmit()}),ga=He(()=>{if(Gf(!1),ys==null||ys(!1),xe(!1),Yr(),ie(null),Ot(f==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),_e&&Re.current&&Re.current.value!==""&&!be.current&&ci("",tt(Ol)),rt)if(lt.state.inputInsidePopup)Re.current&&Re.current.value!==""&&ci("",tt(Ol));else{const Me=Dn(Ue,D);Re.current&&Re.current.value!==Me&&ci(Me,tt(Me===""?Ol:Oi))}}),Qf=A.useMemo(()=>Tn&&fr?{current:fr.closest('[role="dialog"]')}:Qe,[Tn,fr]);da({enabled:!n.actionsRef,open:st,ref:Qf,onComplete(){st||ga()}}),A.useImperativeHandle(n.actionsRef,()=>({unmount:ga}),[ga]),ze(function(){if(st||f==="none")return;const Ke=E?Un:Ce.current;if(_e){const Je=Array.isArray(Ue)?Ue:[],Mt=Je[Je.length-1],ln=Oc(Ke,Mt,X);Ot({selectedIndex:ln===-1?null:ln})}else{const Je=Oc(Ke,Ue,X);Ot({selectedIndex:Je===-1?null:Je})}},[st,Ue,E,f,Un,_e,X,Ot]),ze(()=>{E&&(Ae.current=ai,ye.current.length=ai.length)},[E,ai]),ze(()=>{const Me=we.current;if(Me&&(Me.hasQuery?ht&<.set("activeIndex",0):ht==="always"&<.set("activeIndex",0),we.current=null),!st&&!Tn)return;const Je=Lt||nn?ai:Ae.current,Mt=lt.state.activeIndex;if(Mt==null){if(ht==="always"&&Je.length>0){lt.set("activeIndex",0);return}Te.current!==jo&&(Te.current=jo,lt.state.onItemHighlighted(void 0,zu(Oi,void 0,{index:-1})));return}if(Mt>=Je.length){Te.current!==jo&&(Te.current=jo,lt.state.onItemHighlighted(void 0,zu(Oi,void 0,{index:-1}))),lt.set("activeIndex",null);return}const ln=Je[Mt],On=Te.current.value,vs=On!==W2&<.state.isItemEqualToValue(ln,On);(Te.current.index!==Mt||!vs)&&(Te.current={value:ln,index:Mt},lt.state.onItemHighlighted(ln,zu(Oi,void 0,{index:Mt})))},[zs,ht,nn,Lt,ai,Tn,st,lt]),ze(()=>{if(!E||f==="none")return;const Me=Un;if(_e){const Mt=Array.isArray(Ue)?Ue:Dl,ln=Mt.filter(On=>_o(Me,On,lt.state.isItemEqualToValue));ln.length!==Mt.length&&Jt(ln);return}if(Ue==null?!0:_o(Me,Ue,lt.state.isItemEqualToValue))return;let Je=null;if(i!=null&&_o(Me,i,lt.state.isItemEqualToValue)&&(Je=i),Jt(Je),!lt.state.inputInsidePopup){const Mt=Dn(Je,D);Re.current&&Re.current.value!==Mt&&ci(Mt,tt(Oi))}},[E,Un,_e,f,Ue,i,Jt,D,lt,ci]),ze(()=>{if(f==="none"){U(String(dn)!=="");return}U(_e?Array.isArray(Ue)&&Ue.length>0:Ue!=null)},[U,f,dn,Ue,_e]),A.useEffect(()=>{Lt&&ht&&ai.length===0&&Ot({activeIndex:null})},[Lt,ht,ai.length,Ot]),Ja(it,()=>{!st||it===""||it===String(es)||xe(!0)}),Ja(Ue,()=>{if(f!=="none"&&(F(nt),ee(Ue!==G.initialValue),M()?ne.commit(Ue):ne.commit(Ue,!0),_e&<.state.selectedIndex!==null&&(!Array.isArray(Ue)||Ue.length===0)&&Ot({activeIndex:null,selectedIndex:null}),rt&&!at&&!yi)){const Me=Dn(Ue,D);dn!==Me&&ci(Me,tt(Oi))}}),Ja(dn,()=>{f==="none"&&(F(nt),ee(dn!==G.initialValue),M()?ne.commit(dn):ne.commit(dn,!0))}),Ja(E,()=>{if(!rt||at||yi||pe)return;const Me=Dn(Ue,D);dn!==Me&&ci(Me,tt(Oi))});const ya=fv({open:Tn?!0:st,onOpenChange:Xr,elements:{reference:yi?Ut:rn,floating:fr}});let Zr,Jr;Tn||(Zr=w?"grid":"listbox",Jr=st?"true":"false");const bs=A.useMemo(()=>{const Me=(rn==null?void 0:rn.tagName)==="INPUT",Ke=Me||st,Je=Me?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ke&&(Je.role="combobox",Je["aria-expanded"]=Jr,Je["aria-haspopup"]=Zr,Je["aria-controls"]=st?qn==null?void 0:qn.id:void 0,Je["aria-autocomplete"]=H),{reference:Je,floating:{role:"presentation"}}},[rn,st,Jr,Zr,qn==null?void 0:qn.id,H]),vi=lv(ya,{enabled:!b&&!Ze&&N,event:"mousedown-only",toggle:!1,touchOpenDelay:yi?0:50}),Kf=av(ya,{enabled:!b&&!Ze&&!Tn,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Tn?!0:void 0,outsidePress(Me){const Ke=ni(Me);return!Dt(Ut,Ke)&&!Dt(qe.current,Ke)&&!Dt(De.current,Ke)}}),um=h2(ya,{enabled:!b&&!Ze,id:se,listRef:ye,activeIndex:zs,selectedIndex:Is,virtual:!0,loopFocus:!0,allowEscape:!ht,focusItemOnOpen:pe||f==="none"&&!ht?!1:"auto",focusItemOnHover:L,resetOnPointerLeave:!B,cols:w?2:1,orientation:w?"horizontal":void 0,disabledIndices:Dl,onNavigate(Me,Ke){!Ke&&!st||hr==="ending"||Ot(Ke?{activeIndex:Me,type:ke.current?"keyboard":"pointer"}:{activeIndex:Me})}}),{getReferenceProps:po,getFloatingProps:ba,getItemProps:el}=hv([bs,vi,Kf,um]);A2(()=>{lt.update({inline:V,popupProps:ba(),inputProps:po(),triggerProps:Ps,getItemProps:el,setOpen:Xr,setInputValue:ci,setSelectedValue:bi,setIndices:Ot,onItemHighlighted:ur,handleSelection:$r,forceMount:Hs,requestSubmit:Uc})}),ze(()=>{lt.update({id:se,selectedValue:Ue,open:st,mounted:Ff,transitionStatus:hr,items:E,inline:V,popupProps:ba(),inputProps:po(),triggerProps:Ps,openMethod:ma,getItemProps:el,selectionMode:f,name:nt,disabled:Ze,readOnly:b,required:v,grid:w,isGrouped:Ge,virtualized:J,onOpenChangeComplete:ys,openOnInputClick:N,itemToStringLabel:D,modal:ae,autoHighlight:ht,isItemEqualToValue:X,submitOnItemClick:Q,hasInputValue:at,requestSubmit:Uc})},[lt,se,Ue,st,Ff,hr,E,ba,po,el,ma,Ps,f,nt,Ze,b,v,ne,w,Ge,J,ys,N,D,ae,X,Q,at,V,Uc,ht]);const fm=Zl(S,ne.inputRef),xi=A.useMemo(()=>({query:it,filteredItems:oi,flatFilteredItems:ai}),[it,oi,ai]),qc=A.useMemo(()=>Array.isArray(ts)?"":Jo(ts,j),[ts,j]),Yf=_e&&Array.isArray(Ue)&&Ue.length>0,Fc=A.useMemo(()=>!_e||!Array.isArray(Ue)||!nt?null:Ue.map(Me=>{const Ke=Jo(Me,j);return x.jsx("input",{type:"hidden",name:nt,value:Ke},Ke)}),[_e,Ue,nt,j]),tl=x.jsxs(A.Fragment,{children:[n.children,x.jsx("input",{...ne.getInputValidationProps({onFocus(){var Me;if(yi){Ut==null||Ut.focus();return}(Me=Re.current||Ut)==null||Me.focus()},onChange(Me){if(Me.nativeEvent.defaultPrevented)return;const Ke=Me.target.value,Je=tt(Vo,Me.nativeEvent);function Mt(){if(_e)return;if(f==="none"){ee(Ke!==G.initialValue),ci(Ke,Je),M()&&ne.commit(Ke);return}const ln=Ae.current.find(On=>Jo(On,j).toLowerCase()===Ke.toLowerCase());ln!=null&&(ee(ln!==G.initialValue),bi==null||bi(ln,Je),M()&&ne.commit(ln))}E?Mt():(Hs(),queueMicrotask(Mt))}}),id:se,name:_e||f==="none"?void 0:nt,disabled:Ze,required:v&&!Yf,readOnly:b,value:qc,ref:fm,style:zf,tabIndex:-1,"aria-hidden":!0}),Fc]});return x.jsx(q2.Provider,{value:lt,children:x.jsx(F2.Provider,{value:ya,children:x.jsx(G2.Provider,{value:xi,children:x.jsx(Q2.Provider,{value:dn,children:tl})})})})}function v5(n){const{multiple:e=!1,defaultValue:t,value:i,onValueChange:r,...o}=n;return x.jsx(b5,{...o,selectionMode:e?"multiple":"single",selectedValue:i,defaultSelectedValue:t,onSelectedValueChange:r})}const x5=A.createContext(void 0);function S5(){return A.useContext(x5)}const X2=A.createContext(void 0);function xv(n){const e=A.useContext(X2);if(e===void 0&&!n)throw new Error(ri(21));return e}const w5={...Wb,...Yp,popupSide:n=>n?{"data-popup-side":n}:null,listEmpty:n=>n?{"data-list-empty":""}:null},C5=A.forwardRef(function(e,t){const{render:i,className:r,disabled:o=!1,id:a,...u}=e,{state:f,disabled:d,setTouched:p,setFocused:g,validationMode:b,validation:v}=oo(),{labelId:S}=Vc(),w=S5(),k=!!xv(!0),R=co(),{filteredItems:N}=pa(),T=K2(),B=Hp(a),L=L2(),D=ge(R,Ve.disabled),j=ge(R,Ve.readOnly),X=ge(R,Ve.name),J=ge(R,Ve.selectionMode),V=ge(R,Ve.autoHighlight),K=ge(R,Ve.inputProps),ae=ge(R,Ve.triggerProps),$=ge(R,Ve.open),H=ge(R,Ve.mounted),z=ge(R,Ve.selectedValue),Q=ge(R,Ve.popupSide),F=ge(R,Ve.positionerElement),ee=!!V,G=H&&F?Q:null,M=d||D||o,U=N.length===0,[te,le]=A.useState(null),ne=A.useRef(!1),se=He(fe=>{const ie=k||R.state.inline;ie&&!R.state.hasInputValue&&R.state.setInputValue("",tt(Oi)),R.update({inputElement:fe,inputInsidePopup:ie})}),he=A.useMemo(()=>({...f,open:$,disabled:M,readOnly:j,popupSide:G,listEmpty:U}),[f,$,M,j,G,U]);function pe(fe){if(!w)return;let ie;const{highlightedChipIndex:ye}=w;if(ye!==void 0){if(fe.key==="ArrowLeft")fe.preventDefault(),ye>0?ie=ye-1:ie=void 0;else if(fe.key==="ArrowRight")fe.preventDefault(),ye<z.length-1?ie=ye+1:ie=void 0;else if(fe.key==="Backspace"||fe.key==="Delete"){fe.preventDefault();const ve=ye>=z.length-1?z.length-2:ye;ie=ve>=0?ve:void 0,R.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return ie}return fe.key==="ArrowLeft"&&(fe.currentTarget.selectionStart??0)===0&&z.length>0?(fe.preventDefault(),ie=Math.max(z.length-1,0)):fe.key==="Backspace"&&fe.currentTarget.value===""&&z.length>0&&(R.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),fe.preventDefault()),ie}return wn("input",e,{state:he,ref:[t,R.state.inputRef,se],props:[K,ae,{type:"text",value:e.value??te??T,"aria-readonly":j||void 0,"aria-labelledby":S,disabled:M,readOnly:j,...J==="none"&&X&&{name:X},id:B,onFocus(){g(!0)},onBlur(){if(p(!0),g(!1),b==="onBlur"){const fe=J==="none"?T:z;v.commit(fe)}},onCompositionStart(fe){Zd||(ne.current=!0,le(fe.currentTarget.value))},onCompositionEnd(fe){ne.current=!1;const ie=fe.currentTarget.value;le(null),R.state.setInputValue(ie,tt(Vo,fe.nativeEvent))},onChange(fe){if(ne.current){const Qe=fe.currentTarget.value;le(Qe),Qe===""&&!R.state.openOnInputClick&&!R.state.inputInsidePopup&&R.state.setOpen(!1,tt(Ol,fe.nativeEvent));const Re=Qe.trim(),me=ee&&Re!=="";!j&&!M&&Re!==""&&(R.state.setOpen(!0,tt(Vo,fe.nativeEvent)),ee||R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"})),$&&R.state.activeIndex!==null&&!me&&R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"});return}R.state.setInputValue(fe.currentTarget.value,tt(Vo,fe.nativeEvent));const ie=fe.currentTarget.value==="",ye=tt(Ol,fe.nativeEvent);ie&&!R.state.inputInsidePopup&&(J==="single"&&R.state.setSelectedValue(null,ye),R.state.openOnInputClick||R.state.setOpen(!1,ye));const ve=fe.currentTarget.value.trim();!j&&!M&&ve!==""&&(R.state.setOpen(!0,tt(Vo,fe.nativeEvent)),ee||R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"})),$&&R.state.activeIndex!==null&&!ee&&R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(fe){var Re,me;if(M||j||fe.ctrlKey||fe.shiftKey||fe.altKey||fe.metaKey)return;R.state.keyboardActiveRef.current=!0;const ie=fe.currentTarget,ye=ie.scrollWidth-ie.clientWidth,ve=L==="rtl";if(fe.key==="Home"){bn(fe);const ke=hC&&ve?ie.value.length:0;ie.setSelectionRange(ke,ke),ie.scrollLeft=0;return}if(fe.key==="End"){bn(fe);const ke=hC&&ve?0:ie.value.length;ie.setSelectionRange(ke,ke),ie.scrollLeft=ve?-ye:ye;return}if(!H&&fe.key==="Escape"){const ke=J==="multiple"&&Array.isArray(z)?z.length===0:z===null,be=tt(DE,fe.nativeEvent),De=J==="multiple"?[]:null;R.state.setInputValue("",be),R.state.setSelectedValue(De,be),!ke&&!R.state.inline&&!be.isPropagationAllowed&&fe.stopPropagation();return}if(w&&fe.key==="Backspace"&&ie.value===""&&w.highlightedChipIndex===void 0&&Array.isArray(z)&&z.length>0){const ke=z.slice(0,-1);R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"}),R.state.setSelectedValue(ke,tt(Oi,fe.nativeEvent));return}const Qe=pe(fe);if(w==null||w.setHighlightedChipIndex(Qe),Qe!==void 0?(Re=w==null?void 0:w.chipsRef.current[Qe])==null||Re.focus():(me=R.state.inputRef.current)==null||me.focus(),fe.which!==229&&fe.key==="Enter"&&$){const ke=R.state.activeIndex,be=fe.nativeEvent;if(ke===null){R.state.setOpen(!1,tt(Oi,be));return}bn(fe);const De=R.state.listRef.current[ke];De&&(R.state.selectionEventRef.current=be,De.click(),R.state.selectionEventRef.current=null)}},onPointerMove(){R.state.keyboardActiveRef.current=!1},onPointerDown(){R.state.keyboardActiveRef.current=!1}},v?v.getValidationProps(u):u],stateAttributesMapping:w5})}),bd=2,k5={...Wb,...Yp},A5=A.forwardRef(function(e,t){const{render:i,className:r,nativeButton:o=!0,disabled:a=!1,...u}=e,{state:f,disabled:d,setTouched:p,setFocused:g,validationMode:b,validation:v}=oo(),{labelId:S}=Vc(),w=co(),E=ge(w,Ve.selectionMode),k=ge(w,Ve.disabled),R=ge(w,Ve.readOnly),N=ge(w,Ve.listElement),T=ge(w,Ve.triggerProps),B=ge(w,Ve.triggerElement),L=ge(w,Ve.inputInsidePopup),D=ge(w,Ve.open),j=ge(w,Ve.selectedValue),X=ge(w,Ve.activeIndex),J=ge(w,Ve.selectedIndex),V=Xp(),K=K2(),ae=$i(),$=d||k||a,H=A.useRef("");function z(ne){H.current=ne.pointerType}const Q=V.select("domReferenceElement");A.useEffect(()=>{L&&B&&B!==Q&&V.set("domReferenceElement",B)},[B,Q,V,L]);const{reference:F}=d2(V,{enabled:!D&&!R&&!k&&E==="single",listRef:w.state.labelsRef,activeIndex:X,selectedIndex:J,onMatch(ne){const se=w.state.valuesRef.current[ne];se!==void 0&&w.state.setSelectedValue(se,tt("none"))}}),{reference:ee}=lv(V,{enabled:!R&&!k,event:"mousedown"}),{buttonRef:G,getButtonProps:M}=Df({native:o,disabled:$}),U=A.useMemo(()=>({...f,open:D,disabled:$}),[f,D,$]),te=He(ne=>{w.set("triggerElement",ne)});return wn("button",e,{ref:[t,G,te],state:U,props:[T,ee,F,{tabIndex:L?0:-1,disabled:$,role:L?"combobox":void 0,"aria-expanded":D?"true":"false","aria-haspopup":L?"dialog":"listbox","aria-controls":D?N==null?void 0:N.id:void 0,"aria-readonly":R||void 0,"aria-labelledby":S,onPointerDown:z,onPointerEnter:z,onFocus(){g(!0),!($||R)&&ae.start(0,w.state.forceMount)},onBlur(){if(p(!0),g(!1),b==="onBlur"){const ne=E==="none"?K:j;v.commit(ne)}},onMouseDown(ne){var pe;if($||R||(L||V.set("domReferenceElement",ne.currentTarget),w.state.forceMount(),H.current!=="touch"&&((pe=w.state.inputRef.current)==null||pe.focus(),L||ne.preventDefault()),D))return;const se=Fr(ne.currentTarget);function he(xe){if(!B)return;const fe=ni(xe),ie=w.state.positionerElement,ye=w.state.listElement;if(Dt(B,fe)||Dt(ie,fe)||Dt(ye,fe)||fe===B)return;const ve=D2(B),Qe=xe.clientX>=ve.left-bd&&xe.clientX<=ve.right+bd,Re=xe.clientY>=ve.top-bd&&xe.clientY<=ve.bottom+bd;Qe&&Re||w.state.setOpen(!1,tt("cancel-open",xe))}L&&se.addEventListener("mouseup",he,{once:!0})},onKeyDown(ne){var se;$||R||(ne.key==="ArrowDown"||ne.key==="ArrowUp")&&(bn(ne),w.state.setOpen(!0,tt(Pd,ne.nativeEvent)),(se=w.state.inputRef.current)==null||se.focus())}},v?v.getValidationProps(u):u,M],stateAttributesMapping:k5})}),E5=A.createContext(null);function R5(){return A.useContext(E5)}function T5(n){const{children:e}=n,{filteredItems:t}=pa(),i=R5(),r=i?i.items:t;return r?x.jsx(A.Fragment,{children:r.map(e)}):null}const O5=A.forwardRef(function(e,t){var i;const{render:r,className:o,children:a,...u}=e,f=co(),d=Xp(),p=!!xv(!0),{filteredItems:g}=pa(),b=ge(f,Ve.items),v=ge(f,Ve.labelsRef),S=ge(f,Ve.listRef),w=ge(f,Ve.selectionMode),E=ge(f,Ve.grid),k=ge(f,Ve.popupProps),R=ge(f,Ve.disabled),N=ge(f,Ve.readOnly),T=ge(f,Ve.virtualized),B=w==="multiple",L=g.length===0,D=He(ae=>{f.set("positionerElement",ae)}),j=He(ae=>{f.set("listElement",ae)}),X=A.useMemo(()=>typeof a=="function"?i||(i=x.jsx(T5,{children:a})):a,[a]),J=A.useMemo(()=>({empty:L}),[L]),V=d.useState("floatingId"),K=wn("div",e,{state:J,ref:[t,j,p?null:D],props:[k,{children:X,tabIndex:-1,id:V,role:E?"grid":"listbox","aria-multiselectable":B?"true":void 0,onKeyDown(ae){if(!(R||N)&&ae.key==="Enter"){const $=f.state.activeIndex;if($==null)return;bn(ae);const H=ae.nativeEvent,z=f.state.listRef.current[$];z&&(f.state.selectionEventRef.current=H,z.click(),f.state.selectionEventRef.current=null)}},onKeyDownCapture(){f.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){f.state.keyboardActiveRef.current=!1}},u]});return T?K:x.jsx(B2,{elementsRef:S,labelsRef:b?void 0:v,children:K})}),$2=A.createContext(void 0);function M5(){const n=A.useContext($2);if(n===void 0)throw new Error(ri(20));return n}const N5=A.forwardRef(function(e,t){const{keepMounted:i=!1,...r}=e,o=co(),a=ge(o,Ve.mounted),u=ge(o,Ve.forceMounted);return a||i||u?x.jsx($2.Provider,{value:i,children:x.jsx(iv,{ref:t,...r})}):null}),D5=A.forwardRef(function(e,t){const{render:i,className:r,anchor:o,positionMethod:a="absolute",side:u="bottom",align:f="center",sideOffset:d=0,alignOffset:p=0,collisionBoundary:g="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:w=!1,collisionAvoidance:E=OE,...k}=e,R=co(),{filteredItems:N}=pa(),T=Xp(),B=M5(),L=ge(R,Ve.modal),D=ge(R,Ve.open),j=ge(R,Ve.mounted),X=ge(R,Ve.openMethod),J=ge(R,Ve.triggerElement),V=ge(R,Ve.inputElement),K=ge(R,Ve.inputInsidePopup),ae=N.length===0,H=I2({anchor:o??(K?J:V),floatingRootContext:T,positionMethod:a,mounted:j,side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:v,collisionBoundary:g,collisionPadding:b,sticky:S,disableAnchorTracking:w,keepMounted:B,collisionAvoidance:E,lazyFlip:!0});mv(D&&L&&X!=="touch",J);const z=A.useMemo(()=>{const M={...H.positionerStyles};return D||(M.pointerEvents="none"),{role:"presentation",hidden:!j,style:M}},[D,j,H.positionerStyles]),Q=A.useMemo(()=>({open:D,side:H.side,align:H.align,anchorHidden:H.anchorHidden,empty:ae}),[D,H.side,H.align,H.anchorHidden,ae]);ze(()=>{R.set("popupSide",H.side)},[R,H.side]);const F=A.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,anchorHidden:H.anchorHidden,isPositioned:H.isPositioned}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.anchorHidden,H.isPositioned]),ee=He(M=>{R.set("positionerElement",M)}),G=wn("div",e,{state:Q,ref:[t,ee],props:[z,k],stateAttributesMapping:Pc});return x.jsxs(X2.Provider,{value:F,children:[j&&L&&x.jsx(pv,{inert:dv(!D),cutout:V??J}),G]})}),j5={...Pc,...Nf},B5=A.forwardRef(function(e,t){const{render:i,className:r,initialFocus:o,finalFocus:a,...u}=e,f=co(),d=xv(),p=Xp(),{filteredItems:g}=pa(),b=ge(f,Ve.mounted),v=ge(f,Ve.open),S=ge(f,Ve.openMethod),w=ge(f,Ve.transitionStatus),E=ge(f,Ve.inputInsidePopup),k=ge(f,Ve.inputElement),R=g.length===0;da({open:v,ref:f.state.popupRef,onComplete(){v&&f.state.onOpenChangeComplete(!0)}});const N=A.useMemo(()=>({open:v,side:d.side,align:d.align,anchorHidden:d.anchorHidden,transitionStatus:w,empty:R}),[v,d.side,d.align,d.anchorHidden,w,R]),T=wn("div",e,{state:N,ref:[t,f.state.popupRef],props:[{role:E?"dialog":"presentation",tabIndex:-1,onFocus(j){var J;const X=ni(j.nativeEvent);S!=="touch"&&(Dt(f.state.listElement,X)||X===j.currentTarget)&&((J=f.state.inputRef.current)==null||J.focus())}},V2(w),u],stateAttributesMapping:j5}),L=o===void 0?E?j=>j==="touch"?f.state.popupRef.current:k:!1:o;let D;return a!=null?D=a:D=E?void 0:!1,x.jsx(rv,{context:p,disabled:!b,modal:!E,openInteractionType:S,initialFocus:L,returnFocus:D,children:T})}),L5=A.createContext(void 0),z5=A.createContext(!1);function I5(){return A.useContext(z5)}const P5=A.memo(A.forwardRef(function(e,t){const{render:i,className:r,value:o=null,index:a,disabled:u=!1,nativeButton:f=!1,...d}=e,p=A.useRef(!1),g=A.useRef(null),b=_2({index:a,textRef:g,indexGuessBehavior:bv.GuessFromOrder}),v=co(),S=I5(),{flatFilteredItems:w}=pa(),E=ge(v,Ve.open),k=ge(v,Ve.selectionMode),R=ge(v,Ve.readOnly),N=ge(v,Ve.virtualized),T=ge(v,Ve.isItemEqualToValue),B=k!=="none",L=a??(N?Oc(w,o,T):b.index),D=b.index!==-1,j=ge(v,Ve.id),X=ge(v,Ve.isActive,L),J=ge(v,Ve.isSelected,o),V=ge(v,Ve.items),K=ge(v,Ve.getItemProps),ae=A.useRef(null),$=j!=null&&D?`${j}-${L}`:void 0,H=J&&B;ze(()=>{if(!(D&&(N||a!=null)))return;const ne=v.state.listRef.current;return ne[L]=ae.current,()=>{delete ne[L]}},[D,N,L,a,v]),ze(()=>{if(!D||V)return;const le=v.state.valuesRef.current;return le[L]=o,k!=="none"&&v.state.allValuesRef.current.push(o),()=>{delete le[L]}},[D,V,L,o,v,k]),ze(()=>{if(!E){p.current=!1;return}if(!D||V)return;const le=v.state.selectedValue,ne=Array.isArray(le)?le[le.length-1]:le;Qr(ne,o,T)&&v.set("selectedIndex",L)},[D,V,E,v,L,o,T]);const z=A.useMemo(()=>({disabled:u,selected:H,highlighted:X}),[u,H,X]),Q=K({active:X,selected:H});Q.id=void 0,Q.onFocus=void 0;const{getButtonProps:F,buttonRef:ee}=Df({disabled:u,focusableWhenDisabled:!0,native:f});function G(le){function ne(){v.state.handleSelection(le,o)}v.state.submitOnItemClick?(Gr.flushSync(ne),v.state.requestSubmit()):ne()}const M={id:$,role:S?"gridcell":"option","aria-disabled":u||void 0,"aria-selected":B?H:void 0,tabIndex:void 0,onPointerDownCapture(le){p.current=!0,le.preventDefault()},onClick(le){u||R||G(le.nativeEvent)},onMouseUp(le){const ne=p.current;p.current=!1,!(u||R||le.button!==0||ne||!X)&&G(le.nativeEvent)}},U=wn("div",e,{ref:[ee,t,b.ref,ae],state:z,props:[Q,M,d,F]}),te=A.useMemo(()=>({selected:H,textRef:g}),[H,g]);return x.jsx(L5.Provider,{value:te,children:U})})),H5=A.forwardRef(function(e,t){const{render:i,className:r,children:o,...a}=e,{filteredItems:u}=pa(),f=co(),d=u.length===0?o:null;return wn("div",e,{ref:[t,f.state.emptyRef],props:[{children:d,role:"status","aria-live":"polite","aria-atomic":!0},a]})});function V5({checked:n,onCheckedChange:e,disabled:t,"aria-label":i}){return x.jsx(Lz,{checked:n,onCheckedChange:r=>e(r),disabled:t,"aria-label":i,className:jt("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent outline-none transition-colors","bg-input data-[checked]:bg-success","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50"),children:x.jsx(zz,{className:"size-4 translate-x-0.5 rounded-full bg-background shadow-sm transition-transform data-[checked]:translate-x-[18px]"})})}function Sv({value:n,onValueChange:e,options:t,placeholder:i="Select…",disabled:r,className:o,"aria-label":a}){return x.jsxs(Hz,{items:t,value:n,onValueChange:u=>e(u),disabled:r,children:[x.jsxs(_z,{"aria-label":a,className:jt("inline-flex h-9 min-w-0 items-center justify-between gap-2 rounded-md border border-input bg-secondary/40 px-3 text-[13px] text-foreground outline-none transition-colors","hover:bg-secondary/70 focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50 data-[popup-open]:border-ring",o),children:[x.jsx(qz,{className:"truncate",children:u=>{const f=t.find(d=>d.value===u);return f?f.label:x.jsx("span",{className:"text-muted-foreground",children:i})}}),x.jsx(Fz,{children:x.jsx(rE,{className:"size-3.5 shrink-0 text-muted-foreground"})})]}),x.jsx(Qz,{children:x.jsx(r5,{sideOffset:6,className:"z-50 outline-none",alignItemWithTrigger:!1,children:x.jsx(c5,{className:jt("max-h-[min(20rem,var(--available-height))] min-w-[var(--anchor-width)] overflow-y-auto rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-xl outline-none","origin-[var(--transform-origin)] transition-[transform,opacity] data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0"),children:t.map(u=>x.jsxs(u5,{value:u.value,className:jt("flex cursor-pointer select-none items-start gap-2 rounded-md py-1.5 pl-2 pr-2 text-[13px] outline-none","data-[highlighted]:bg-accent/15 data-[highlighted]:text-foreground"),children:[x.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center pt-0.5",children:x.jsx(f5,{children:x.jsx(sE,{className:"size-3.5 text-accent"})})}),x.jsxs("span",{className:"flex flex-col",children:[x.jsx(d5,{children:u.label}),u.description?x.jsx("span",{className:"text-xs text-muted-foreground",children:u.description}):null]})]},u.value))})})})]})}function _5({value:n,options:e,onSelect:t,onCreate:i,placeholder:r="Select…",createLabel:o=d=>`Create "${d}"`,disabled:a,className:u,"aria-label":f}){const[d,p]=A.useState(""),g=d.trim(),b=g.toLowerCase(),v=e.map(k=>({value:k,label:k})),S=g?v.filter(k=>k.label.toLowerCase().includes(b)):v,w=e.some(k=>k.toLowerCase()===b),E=g&&!w?[...S,{value:"\0create",label:o(g),create:!0}]:S;return x.jsxs(v5,{items:E,filter:null,inputValue:d,onInputValueChange:p,onOpenChange:k=>{k||p("")},onValueChange:k=>{k&&(k.create?i(g):t(k.value),p(""))},itemToStringLabel:k=>k.label,disabled:a,children:[x.jsxs(A5,{"aria-label":f,className:jt("inline-flex h-9 min-w-0 items-center justify-between gap-2 rounded-md border border-input bg-secondary/40 px-3 text-[13px] text-foreground outline-none transition-colors","hover:bg-secondary/70 focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50 data-[popup-open]:border-ring",u),children:[x.jsx("span",{className:jt("truncate",!n&&"text-muted-foreground"),children:n||r}),x.jsx(rE,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),x.jsx(N5,{children:x.jsx(D5,{sideOffset:6,className:"z-50 outline-none",children:x.jsxs(B5,{className:jt("w-[max(var(--anchor-width),13rem)] overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-xl outline-none","origin-[var(--transform-origin)] transition-[transform,opacity] data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0"),children:[x.jsx(C5,{placeholder:"Search or create…",className:"mb-1 h-8 w-full rounded-md border border-input bg-secondary/40 px-2.5 text-[13px] text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"}),x.jsx(H5,{className:"px-2 py-2 text-[13px] text-muted-foreground",children:"No matches."}),x.jsx(O5,{className:"max-h-64 overflow-y-auto",children:k=>x.jsxs(P5,{value:k,className:jt("flex cursor-pointer select-none items-center gap-2 rounded-md py-1.5 pl-2 pr-2 text-[13px] outline-none","data-[highlighted]:bg-accent/15 data-[highlighted]:text-foreground",k.create&&"text-accent"),children:[k.create?x.jsx(Dp,{className:"size-3.5 shrink-0"}):x.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:k.value===n&&x.jsx(sE,{className:"size-3.5 text-accent"})}),x.jsx("span",{className:"truncate",children:k.label})]},k.value)})]})})})]})}const Ms=A.forwardRef(function({className:e,...t},i){return x.jsx("input",{ref:i,className:jt("h-9 w-full rounded-md border border-input bg-secondary/40 px-3 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground","hover:bg-secondary/60 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",e),...t})});A.forwardRef(function({className:e,...t},i){return x.jsx("textarea",{ref:i,className:jt("w-full rounded-md border border-input bg-secondary/40 px-3 py-2 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground","hover:bg-secondary/60 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",e),...t})});let uf=null;function Z2(n){uf=n}function J2(n){uf===n&&(uf=null)}function QC(){return uf?uf():!0}const Tl=(n,e)=>n instanceof Tf?n.body.error:e;function eR({secret:n,testId:e}){return x.jsx("code",{"data-testid":e,className:"block w-full select-all break-all rounded-md border border-border bg-secondary/40 px-3 py-2 font-mono text-[12px] text-foreground",children:n})}function U5({rows:n,onChange:e,readonly:t}){return x.jsxs("div",{className:"flex flex-col gap-2",children:[n.length===0&&x.jsx("p",{className:"text-xs text-muted-foreground",children:"No custom headers. They are merged into every delivery request."}),n.map((i,r)=>x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Ms,{className:"font-mono",placeholder:"X-Header-Name","aria-label":`Header ${r+1} name`,value:i.key,disabled:t,onChange:o=>e(n.map((a,u)=>u===r?{...a,key:o.target.value}:a))}),x.jsx(Ms,{className:"font-mono",placeholder:"value","aria-label":`Header ${r+1} value`,value:i.value,disabled:t,onChange:o=>e(n.map((a,u)=>u===r?{...a,value:o.target.value}:a))}),!t&&x.jsx("button",{onClick:()=>e(n.filter((o,a)=>a!==r)),className:"shrink-0 rounded-md p-1.5 text-muted-foreground/60 hover:bg-destructive/10 hover:text-destructive","aria-label":`Remove header ${i.key||r+1}`,children:x.jsx(Ub,{className:"size-4"})})]},r)),!t&&x.jsx("div",{children:x.jsx(Wt,{size:"sm",variant:"secondary",icon:x.jsx(Dp,{className:"size-3.5"}),onClick:()=>e([...n,{key:"",value:""}]),children:"Add header"})})]})}const Iy=n=>({url:n.url,description:n.description??"",eventTypes:[...n.eventTypes??[]],headers:Object.entries(n.headers??{}).map(([e,t])=>({key:e,value:t}))}),q5=(n,e)=>n.url===e.url&&n.description===e.description&&JSON.stringify([...n.eventTypes].sort())===JSON.stringify([...e.eventTypes].sort())&&JSON.stringify(n.headers)===JSON.stringify(e.headers);function F5({app:n,endpoint:e,readonly:t,onBack:i,onOpenDelivery:r}){const o=ua(),a=io(),u=()=>a.invalidateQueries({queryKey:["endpoints",n]}),[f,d]=A.useState(()=>Iy(e)),p=A.useMemo(()=>Iy(e),[e]),g=!q5(f,p);A.useEffect(()=>{d(Iy(e))},[e.id]),A.useEffect(()=>{const M=()=>!g||window.confirm("Discard unsaved endpoint changes?");return Z2(M),()=>J2(M)},[g]);const v=ji({queryKey:["event-types"],queryFn:qb}).data??[],S=ji({queryKey:["deliveries",n,{endpoint:e.id}],queryFn:()=>Gb(n,{endpoint:e.id,limit:20}),staleTime:5e3}),w=Yi({mutationFn:()=>b3(n,e.id,{url:f.url,description:f.description||void 0,eventTypes:f.eventTypes,headers:Object.fromEntries(f.headers.filter(M=>M.key.trim()!=="").map(M=>[M.key.trim(),M.value]))}),onSuccess:()=>{o.add("success","Endpoint saved"),u()},onError:M=>o.add("error",Tl(M,"Failed to save endpoint"))}),[E,k]=A.useState(null),R=Yi({mutationFn:()=>x3(n,e.id),onSuccess:k,onError:M=>o.add("error",Tl(M,"Failed to reveal the secret"))}),[N,T]=A.useState(!1),B=Yi({mutationFn:()=>S3(n,e.id),onSuccess:M=>{k(M.secrets),T(!1),o.add("success","Secret rotated","The previous secret keeps verifying until grace expiry."),u()},onError:M=>o.add("error",Tl(M,"Failed to rotate the secret"))}),L=Yi({mutationFn:()=>e.disabled?w3(n,e.id):C3(n,e.id),onSuccess:M=>{o.add("success",M.disabled?"Endpoint disabled":"Endpoint enabled"),u()},onError:M=>o.add("error",Tl(M,"Failed to update endpoint"))}),[D,j]=A.useState(""),X=Yi({mutationFn:()=>k3(n,e.id,{eventType:D}),onSuccess:M=>{M.outcome.ok?o.add("success","Example delivered",`HTTP ${M.outcome.httpStatus} in ${Math.round(M.outcome.durationMs)} ms`):o.add("error","Example delivery failed",M.outcome.httpStatus?`HTTP ${M.outcome.httpStatus}`:M.outcome.error??"network error"),a.invalidateQueries({queryKey:["deliveries",n]})},onError:M=>o.add("error",Tl(M,"Failed to send example"))}),[J,V]=A.useState(""),[K,ae]=A.useState(!1),$=Yi({mutationFn:()=>A3(n,e.id,{since:new Date(J).toISOString()}),onSuccess:M=>{ae(!1),o.add("success",`Recovered ${M.deliveryIds.length} deliver${M.deliveryIds.length===1?"y":"ies"}`,"Failed deliveries were re-queued for immediate retry."),a.invalidateQueries({queryKey:["deliveries",n]})},onError:M=>o.add("error",Tl(M,"Failed to recover deliveries"))}),[H,z]=A.useState(!1),[Q,F]=A.useState(""),ee=Yi({mutationFn:()=>v3(n,e.id),onSuccess:()=>{o.add("success","Endpoint deleted"),u(),z(!1),i()},onError:M=>o.add("error",Tl(M,"Failed to delete endpoint"))}),G=S.data??[];return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsxs("button",{onClick:i,className:"mb-4 inline-flex items-center gap-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[x.jsx(Np,{className:"size-3.5"}),"Endpoints"]}),x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx("h1",{className:"break-all font-mono text-xl font-semibold tracking-tight",children:e.url}),e.disabled?x.jsxs(lr,{className:"border-destructive/30 bg-destructive/10 text-destructive",children:["Disabled (",e.disabledReason??"manual",")"]}):x.jsx(lr,{className:"border-success/30 bg-success/10 text-success",children:"Active"}),e.firstFailingAt?x.jsxs(lr,{className:"border-warning/30 bg-warning/10 text-warning",children:["Failing since ",Xn(e.firstFailingAt)]}):null]}),x.jsx("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:e.id}),x.jsxs("div",{className:"mt-6 flex flex-col gap-5",children:[x.jsx(Es,{title:"Settings",description:"Destination URL, subscriptions, and custom headers.",children:x.jsxs("div",{className:"flex flex-col gap-4",children:[x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"ep-url",className:"text-xs font-medium text-muted-foreground",children:"URL"}),x.jsx(Ms,{id:"ep-url",className:"font-mono",value:f.url,disabled:t,onChange:M=>d({...f,url:M.target.value})})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"ep-desc",className:"text-xs font-medium text-muted-foreground",children:"Description"}),x.jsx(Ms,{id:"ep-desc",placeholder:"What receives these webhooks?",value:f.description,disabled:t,onChange:M=>d({...f,description:M.target.value})})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Subscribed event types"}),x.jsxs("p",{className:"text-xs text-muted-foreground/70",children:["None selected = the endpoint receives ",x.jsx("em",{children:"all"})," event types."]}),v.length===0?x.jsx("p",{className:"text-xs text-muted-foreground",children:"The event-type catalog is empty."}):x.jsx("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:v.map(M=>{const U=f.eventTypes.includes(M.name);return x.jsxs("label",{className:jt("flex cursor-pointer items-center gap-2 rounded-md border px-2.5 py-1.5 text-[13px] transition-colors",U?"border-accent/40 bg-accent/10 text-foreground":"border-border bg-secondary/30 text-muted-foreground hover:text-foreground",t&&"cursor-not-allowed opacity-60"),children:[x.jsx("input",{type:"checkbox",className:"accent-[var(--accent)]",checked:U,disabled:t,onChange:te=>d({...f,eventTypes:te.target.checked?[...f.eventTypes,M.name]:f.eventTypes.filter(le=>le!==M.name)})}),x.jsx("span",{className:"truncate font-mono",children:M.name}),M.deprecated?x.jsx("span",{className:"ml-auto text-[10px] uppercase text-warning",children:"deprecated"}):null]},M.name)})})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Custom headers"}),x.jsx(U5,{rows:f.headers,onChange:M=>d({...f,headers:M}),readonly:t})]}),!t&&x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Wt,{variant:"primary",disabled:!g,loading:w.isPending,onClick:()=>w.mutate(),children:"Save changes"}),g&&x.jsxs(x.Fragment,{children:[x.jsx(Wt,{variant:"secondary",onClick:()=>d(p),children:"Revert"}),x.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-warning",children:[x.jsx("span",{className:"size-2 rounded-full bg-warning","aria-hidden":!0}),"Unsaved changes"]})]})]})]})}),x.jsx(Es,{title:"Signing secret",description:"Standard Webhooks whsec_ secret used to sign every delivery.",children:x.jsxs("div",{className:"flex flex-col gap-3",children:[E===null?x.jsx("div",{children:x.jsx(Wt,{variant:"secondary",loading:R.isPending,onClick:()=>R.mutate(),children:"Reveal secret"})}):x.jsx("div",{className:"flex flex-col gap-2",children:E.map((M,U)=>x.jsxs("div",{className:"flex flex-col gap-1",children:[x.jsx(eR,{secret:M.secret,testId:U===0?"current-secret":void 0}),x.jsx("p",{className:"text-xs text-muted-foreground",children:U===0?`Current — created ${Xn(M.createdAt)}`:`Previous — still verifying until ${Xn(M.expiresAt)}`})]},M.secret))}),!t&&x.jsx("div",{children:x.jsx(Wt,{variant:"secondary",icon:x.jsx(XD,{className:"size-3.5"}),onClick:()=>T(!0),children:"Rotate secret"})})]})}),!t&&x.jsx(Es,{title:"Send example",description:"Fire a one-off signed test delivery through the real wire path.",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx(Sv,{"aria-label":"Example event type",value:D,onValueChange:j,options:v.map(M=>({value:M.name,label:M.name})),placeholder:"Choose event type…",className:"w-64"}),x.jsx(Wt,{variant:"secondary",icon:x.jsx(e3,{className:"size-3.5"}),disabled:!D,loading:X.isPending,onClick:()=>X.mutate(),children:"Send example"})]})}),!t&&x.jsx(Es,{title:"Recover",description:"Re-queue every dead-lettered delivery for this endpoint created at or after a point in time.",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx("input",{type:"datetime-local","aria-label":"Recover since",value:J,onChange:M=>V(M.target.value),className:"h-9 rounded-md border border-input bg-secondary/40 px-3 text-[13px] text-foreground outline-none hover:bg-secondary/60 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring"}),x.jsx(Wt,{variant:"secondary",disabled:!J,onClick:()=>ae(!0),children:"Recover"})]})}),x.jsx(Es,{title:"Recent deliveries",description:"The latest deliveries to this endpoint.",children:S.isLoading?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Loading deliveries…"}):G.length===0?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No deliveries yet."}):x.jsx("ul",{className:"divide-y divide-border",children:G.map(M=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>r(M.id),className:"group flex w-full items-center gap-3 py-2.5 text-left",children:[x.jsx(If,{status:M.status}),x.jsx(Tc,{className:"min-w-0 flex-1 truncate",children:M.id}),x.jsxs("span",{className:"text-xs text-muted-foreground",children:[M.attemptCount," attempt",M.attemptCount===1?"":"s"]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(M.updatedAt),children:Of(M.updatedAt)}),x.jsx(aa,{className:"size-4 text-muted-foreground/50 group-hover:text-muted-foreground"})]})},M.id))})}),!t&&x.jsx(Es,{title:"Danger zone",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx(Wt,{variant:"secondary",loading:L.isPending,onClick:()=>L.mutate(),children:e.disabled?"Enable endpoint":"Disable endpoint"}),x.jsx(Wt,{variant:"danger",icon:x.jsx(Ub,{className:"size-3.5"}),onClick:()=>{F(""),z(!0)},children:"Delete endpoint"})]})})]}),x.jsx(_d,{open:N,onClose:()=>T(!1),onConfirm:()=>B.mutate(),title:"Rotate signing secret",confirmLabel:"Rotate secret",loading:B.isPending,children:x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"A new signing secret is minted immediately. The current secret keeps verifying until its grace window expires (default 24 hours), and deliveries carry both signatures during grace — receivers can migrate without dropping webhooks."})}),x.jsx(_d,{open:K,onClose:()=>ae(!1),onConfirm:()=>$.mutate(),title:"Recover failed deliveries",confirmLabel:"Recover deliveries",loading:$.isPending,children:x.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["Every dead-lettered delivery for this endpoint created at or after"," ",x.jsx("span",{className:"font-mono text-foreground",children:J?Xn(new Date(J).toISOString()):"—"})," ","is re-queued for immediate retry."]})}),x.jsxs(_d,{open:H,onClose:()=>z(!1),onConfirm:()=>ee.mutate(),title:"Delete endpoint",confirmLabel:"Delete permanently",danger:!0,loading:ee.isPending,confirmDisabled:Q!==e.id,children:[x.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["This permanently removes the endpoint and stops all deliveries to"," ",x.jsx("code",{className:"break-all font-mono text-foreground",children:e.url}),". Pending deliveries for it become terminal. This can't be undone."]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("label",{htmlFor:"ep-delete-confirm",className:"text-xs font-medium text-muted-foreground",children:["Type ",x.jsx("code",{className:"font-mono text-foreground",children:e.id})," to confirm"]}),x.jsx(Ms,{id:"ep-delete-confirm",className:"font-mono",value:Q,onChange:M=>F(M.target.value),autoFocus:!0})]})]})]})}function KC({app:n,readonly:e,selectedId:t,onOpen:i,onBack:r,onOpenDelivery:o}){const a=ua(),u=io(),f=ji({queryKey:["endpoints",n],queryFn:()=>Fb(n),staleTime:1e4,enabled:n!==""}),[d,p]=A.useState(!1),[g,b]=A.useState(""),[v,S]=A.useState(""),[w,E]=A.useState(null),k=Yi({mutationFn:()=>y3(n,{url:g,description:v||void 0}),onSuccess:T=>{var B;u.invalidateQueries({queryKey:["endpoints",n]}),p(!1),b(""),S(""),E({id:T.id,secret:((B=T.secrets[0])==null?void 0:B.secret)??""})},onError:T=>a.add("error",Tl(T,"Failed to create endpoint"))});if(!n)return x.jsx(Kp,{});const R=f.data??[],N=t?R.find(T=>T.id===t):void 0;return N?x.jsx(F5,{app:n,endpoint:N,readonly:e,onBack:r,onOpenDelivery:o}):t&&f.isLoading?x.jsx(Ns,{label:"Loading endpoint…"}):x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Endpoints",description:`${R.length} endpoint${R.length===1?"":"s"} receiving webhooks for this application.`,actions:e?void 0:x.jsx(Wt,{variant:"primary",icon:x.jsx(Dp,{className:"size-4"}),onClick:()=>p(!0),children:"New endpoint"})}),f.isLoading?x.jsx(Ns,{label:"Loading endpoints…"}):f.isError?x.jsx(Li,{children:"Failed to load endpoints."}):R.length===0?x.jsx(Li,{children:"No endpoints yet. Register a customer URL to start delivering webhooks."}):x.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:R.map(T=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>i(T.id),className:"group flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-secondary/30",children:[x.jsx("span",{className:jt("size-2 shrink-0 rounded-full",T.disabled?"bg-muted-foreground/40":"bg-success"),"aria-hidden":!0}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"truncate font-mono text-[13px] font-medium text-foreground",children:T.url}),T.disabled&&x.jsxs(lr,{className:"border-destructive/30 bg-destructive/10 text-destructive",children:["Disabled (",T.disabledReason??"manual",")"]}),T.firstFailingAt&&!T.disabled&&x.jsx(lr,{className:"border-warning/30 bg-warning/10 text-warning",children:"Failing"})]}),x.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[x.jsx("span",{className:"font-mono",children:T.id}),T.description?` · ${T.description}`:"",T.firstFailingAt?` · failing since ${Xn(T.firstFailingAt)}`:""]})]}),x.jsxs("div",{className:"hidden items-center gap-1.5 lg:flex",children:[(T.eventTypes??[]).length===0?x.jsx(lr,{children:"All events"}):(T.eventTypes??[]).slice(0,3).map(B=>x.jsx("span",{className:"rounded-md bg-secondary/60 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:B},B)),(T.eventTypes??[]).length>3&&x.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["+",(T.eventTypes??[]).length-3]})]}),x.jsx(aa,{className:"size-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},T.id))})}),x.jsxs(up,{open:d,onClose:()=>p(!1),title:"New endpoint",footer:x.jsxs(x.Fragment,{children:[x.jsx(Wt,{variant:"secondary",onClick:()=>p(!1),children:"Cancel"}),x.jsx(Wt,{variant:"primary",disabled:!g.trim(),loading:k.isPending,onClick:()=>k.mutate(),children:"Create endpoint"})]}),children:[x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Register a URL to receive signed webhook deliveries. A signing secret is minted on creation and shown once."}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"new-ep-url",className:"text-xs font-medium text-muted-foreground",children:"URL"}),x.jsx(Ms,{id:"new-ep-url",className:"font-mono",placeholder:"https://example.com/webhooks",value:g,onChange:T=>b(T.target.value),autoFocus:!0})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"new-ep-desc",className:"text-xs font-medium text-muted-foreground",children:"Description (optional)"}),x.jsx(Ms,{id:"new-ep-desc",placeholder:"What receives these webhooks?",value:v,onChange:T=>S(T.target.value)})]})]}),x.jsxs(up,{open:w!==null,onClose:()=>{const T=w==null?void 0:w.id;E(null),T&&i(T)},title:"Endpoint created",footer:x.jsx(Wt,{variant:"primary",onClick:()=>{const T=w==null?void 0:w.id;E(null),T&&i(T)},children:"I saved the secret"}),children:[x.jsx("p",{className:"text-[13px] text-muted-foreground",children:`This is the endpoint's signing secret. Hand it to the receiver team now — it is shown only this once (afterwards it is only reachable via "Reveal secret").`}),x.jsx(eR,{secret:(w==null?void 0:w.secret)??"",testId:"endpoint-secret"})]})]})}let U0=[],tR=[];(()=>{let n="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,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?tR:U0).push(t=t+n[e])})();function G5(n){if(n<768)return!1;for(let e=0,t=U0.length;;){let i=e+t>>1;if(n<U0[i])t=i;else if(n>=tR[i])e=i+1;else return!0;if(e==t)return!1}}function YC(n){return n>=127462&&n<=127487}const WC=8205;function Q5(n,e,t=!0,i=!0){return(t?nR:K5)(n,e,i)}function nR(n,e,t){if(e==n.length)return e;e&&iR(n.charCodeAt(e))&&sR(n.charCodeAt(e-1))&&e--;let i=Py(n,e);for(e+=XC(i);e<n.length;){let r=Py(n,e);if(i==WC||r==WC||t&&G5(r))e+=XC(r),i=r;else if(YC(r)){let o=0,a=e-2;for(;a>=0&&YC(Py(n,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function K5(n,e,t){for(;e>1;){let i=nR(n,e-2,t);if(i<e)return i;e--}return 0}function Py(n,e){let t=n.charCodeAt(e);if(!sR(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return iR(i)?(t-55296<<10)+(i-56320)+65536:t}function iR(n){return n>=56320&&n<57344}function sR(n){return n>=55296&&n<56320}function XC(n){return n<65536?1:2}class kt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Mc(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),Js.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Mc(this,e,t);let i=[];return this.decompose(e,t,i,0),Js.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Ju(this),o=new Ju(e);for(let a=t,u=t;;){if(r.next(a),o.next(a),a=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(u+=r.value.length,r.done||u>=i)return!0}}iter(e=1){return new Ju(this,e)}iterRange(e,t=this.length){return new rR(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new lR(i)}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]?kt.empty:e.length<=32?new yn(e):Js.from(yn.split(e,[]))}}class yn extends kt{constructor(e,t=Y5(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let o=0;;o++){let a=this.text[o],u=r+a.length;if((t?i:u)>=e)return new W5(r,u,i,a);r=u+1,i++}}decompose(e,t,i,r){let o=e<=0&&t>=this.length?this:new yn($C(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let a=i.pop(),u=Ud(o.text,a.text.slice(),0,o.length);if(u.length<=32)i.push(new yn(u,a.length+o.length));else{let f=u.length>>1;i.push(new yn(u.slice(0,f)),new yn(u.slice(f)))}}else i.push(o)}replace(e,t,i){if(!(i instanceof yn))return super.replace(e,t,i);[e,t]=Mc(this,e,t);let r=Ud(this.text,Ud(i.text,$C(this.text,0,e)),t),o=this.length+i.length-(t-e);return r.length<=32?new yn(r,o):Js.from(yn.split(r,[]),o)}sliceString(e,t=this.length,i=`
|
|
199
|
+
)`}return x.jsx("div",{ref:t,role:"presentation","data-base-ui-inert":"",...r,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:o}})}),hz=A.forwardRef(function(e,t){const{keepMounted:i=!1,...r}=e,{store:o}=Mf(),a=o.useState("mounted"),u=o.useState("modal");return a||i?x.jsx(m2.Provider,{value:i,children:x.jsxs(iv,{ref:t,...r,children:[a&&u===!0&&x.jsx(pv,{ref:o.context.internalBackdropRef,inert:dv(!open)}),e.children]})}):null});let PC={},HC={},VC="";function dz(n){if(typeof document>"u")return!1;const e=Fr(n);return In(e).innerWidth-e.documentElement.clientWidth>0}function pz(n){const e=Fr(n),t=e.documentElement,i=e.body,r=fa(t)?t:i,o=r.style.overflow;return r.style.overflow="hidden",()=>{r.style.overflow=o}}function mz(n){var b,v;const e=Fr(n),t=e.documentElement,i=e.body,r=In(t);let o=0,a=0;const u=Zs.create(),f=typeof CSS<"u"&&((b=CSS.supports)==null?void 0:b.call(CSS,"scrollbar-gutter","stable"));if(zE&&(((v=r.visualViewport)==null?void 0:v.scale)??1)!==1)return()=>{};function d(){const S=r.getComputedStyle(t),w=r.getComputedStyle(i),R=(S.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";o=t.scrollTop,a=t.scrollLeft,PC={scrollbarGutter:t.style.scrollbarGutter,overflowY:t.style.overflowY,overflowX:t.style.overflowX},VC=t.style.scrollBehavior,HC={position:i.style.position,height:i.style.height,width:i.style.width,boxSizing:i.style.boxSizing,overflowY:i.style.overflowY,overflowX:i.style.overflowX,scrollBehavior:i.style.scrollBehavior};const N=t.scrollHeight>t.clientHeight,T=t.scrollWidth>t.clientWidth,B=S.overflowY==="scroll"||w.overflowY==="scroll",L=S.overflowX==="scroll"||w.overflowX==="scroll",D=Math.max(0,r.innerWidth-t.clientWidth),j=Math.max(0,r.innerHeight-t.clientHeight),X=parseFloat(w.marginTop)+parseFloat(w.marginBottom),J=parseFloat(w.marginLeft)+parseFloat(w.marginRight),V=fa(t)?t:i;if(f){t.style.scrollbarGutter=R,V.style.overflowY="hidden",V.style.overflowX="hidden";return}Object.assign(t.style,{scrollbarGutter:R,overflowY:"hidden",overflowX:"hidden"}),(N||B)&&(t.style.overflowY="scroll"),(T||L)&&(t.style.overflowX="scroll"),Object.assign(i.style,{position:"relative",height:X||j?`calc(100dvh - ${X+j}px)`:"100dvh",width:J||D?`calc(100vw - ${J+D}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),i.scrollTop=o,i.scrollLeft=a,t.setAttribute("data-base-ui-scroll-locked",""),t.style.scrollBehavior="unset"}function p(){Object.assign(t.style,PC),Object.assign(i.style,HC),f||(t.scrollTop=o,t.scrollLeft=a,t.removeAttribute("data-base-ui-scroll-locked"),t.style.scrollBehavior=VC)}function g(){p(),u.request(d)}return d(),r.addEventListener("resize",g),()=>{u.cancel(),p(),typeof r.removeEventListener=="function"&&r.removeEventListener("resize",g)}}class gz{constructor(){Kt(this,"lockCount",0);Kt(this,"restore",null);Kt(this,"timeoutLock",Ac.create());Kt(this,"timeoutUnlock",Ac.create());Kt(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});Kt(this,"unlock",()=>{var e;this.lockCount===0&&this.restore&&((e=this.restore)==null||e.call(this),this.restore=null)})}acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}lock(e){if(this.lockCount===0||this.restore!==null)return;const i=Fr(e).documentElement,r=In(i).getComputedStyle(i).overflowY;if(r==="hidden"||r==="clip"){this.restore=un;return}const o=zB||!dz(e);this.restore=o?pz(e):mz(e)}}const yz=new gz;function mv(n=!0,e=null){ze(()=>{if(n)return yz.acquire(e)},[n,e])}function bz(n){const e=A.useRef(""),t=A.useCallback(r=>{r.defaultPrevented||(e.current=r.pointerType,n(r,r.pointerType))},[n]);return{onClick:A.useCallback(r=>{if(r.detail===0){n(r,"keyboard");return}"pointerType"in r&&n(r,r.pointerType),n(r,e.current),e.current=""},[n]),onPointerDown:t}}function C2(n){const[e,t]=A.useState(null),i=He((u,f)=>{n||t(f)}),r=A.useCallback(()=>{t(null)},[]),{onClick:o,onPointerDown:a}=bz(i);return A.useMemo(()=>({openMethod:e,reset:r,triggerProps:{onClick:o,onPointerDown:a}}),[e,r,o,a])}function vz(n){const{store:e,parentContext:t,actionsRef:i}=n,r=e.useState("open"),o=e.useState("disablePointerDismissal"),a=e.useState("modal"),u=e.useState("popupElement"),{openMethod:f,triggerProps:d,reset:p}=C2(r);QL(e);const{forceUnmount:g}=KL(r,e,()=>{p()}),b=He(J=>{const V=tt(J);return V.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},V}),v=A.useCallback(()=>{e.setOpen(!1,b(MB))},[e,b]);A.useImperativeHandle(i,()=>({unmount:g,close:v}),[g,v]);const S=ZL({popupStore:e,onOpenChange:e.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[w,E]=A.useState(0),k=w===0,R=iz(S),N=av(S,{outsidePressEvent(){return e.context.internalBackdropRef.current||e.context.backdropRef.current?"intentional":{mouse:a==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(J){if("button"in J&&J.button!==0||"touches"in J&&J.touches.length!==1)return!1;const V=ni(J);if(k&&!o){const K=V;return a&&(e.context.internalBackdropRef.current||e.context.backdropRef.current)?e.context.internalBackdropRef.current===K||e.context.backdropRef.current===K||Dt(K,u)&&!(K!=null&&K.hasAttribute("data-base-ui-portal")):!0}return!1},escapeKey:k});mv(r&&a===!0,u);const{getReferenceProps:T,getFloatingProps:B,getTriggerProps:L}=hv([R,N]);e.useContextCallback("onNestedDialogOpen",J=>{E(J+1)}),e.useContextCallback("onNestedDialogClose",()=>{E(0)}),A.useEffect(()=>(t!=null&&t.onNestedDialogOpen&&r&&t.onNestedDialogOpen(w),t!=null&&t.onNestedDialogClose&&!r&&t.onNestedDialogClose(),()=>{t!=null&&t.onNestedDialogClose&&r&&t.onNestedDialogClose()}),[r,t,w]);const D=A.useMemo(()=>T(d),[T,d]),j=A.useMemo(()=>L(d),[L,d]),X=A.useMemo(()=>B(),[B]);e.useSyncedValues({openMethod:f,activeTriggerProps:D,inactiveTriggerProps:j,popupProps:X,floatingRootContext:S,nestedOpenDialogCount:w})}const xz={...XL,modal:de(n=>n.modal),nested:de(n=>n.nested),nestedOpenDialogCount:de(n=>n.nestedOpenDialogCount),disablePointerDismissal:de(n=>n.disablePointerDismissal),openMethod:de(n=>n.openMethod),descriptionElementId:de(n=>n.descriptionElementId),titleElementId:de(n=>n.titleElementId),viewportElement:de(n=>n.viewportElement),role:de(n=>n.role)};class Sz extends h2{constructor(t){super(wz(t),{popupRef:A.createRef(),backdropRef:A.createRef(),internalBackdropRef:A.createRef(),triggerElements:new uv,onOpenChange:void 0,onOpenChangeComplete:void 0},xz);Kt(this,"setOpen",(t,i)=>{var u,f,d,p;if(i.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!t&&i.trigger==null&&this.state.activeTriggerId!=null&&(i.trigger=this.state.activeTriggerElement??void 0),(f=(u=this.context).onOpenChange)==null||f.call(u,t,i),i.isCanceled)return;const r={open:t,nativeEvent:i.event,reason:i.reason,nested:this.state.nested};(d=this.state.floatingRootContext.context.events)==null||d.emit("openchange",r);const o={open:t},a=((p=i.trigger)==null?void 0:p.id)??null;(a||t)&&(o.activeTriggerId=a,o.activeTriggerElement=i.trigger??null),this.update(o)})}}function wz(n={}){return{...WL(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...n}}function Cz(n){const{children:e,open:t,defaultOpen:i=!1,onOpenChange:r,onOpenChangeComplete:o,disablePointerDismissal:a=!1,modal:u=!0,actionsRef:f,handle:d,triggerId:p,defaultTriggerId:g=null}=n,b=Mf(!0),v=!!b,S=Bi(()=>(d==null?void 0:d.store)??new Sz({open:t??i,activeTriggerId:p!==void 0?p:g,modal:u,disablePointerDismissal:a,nested:v})).current;S.useControlledProp("open",t,i),S.useControlledProp("activeTriggerId",p,g),S.useSyncedValues({disablePointerDismissal:a,nested:v,modal:u}),S.useContextCallback("onOpenChange",r),S.useContextCallback("onOpenChangeComplete",o);const w=S.useState("payload");vz({store:S,actionsRef:f,parentContext:b==null?void 0:b.store.context});const E=A.useMemo(()=>({store:S}),[S]);return x.jsx(AE.Provider,{value:E,children:typeof e=="function"?e({payload:w}):e})}const kz=A.forwardRef(function(e,t){const{render:i,className:r,id:o,...a}=e,{store:u}=Mf(),f=Hp(o);return u.useSyncedValueWithCleanup("titleElementId",f),wn("h2",e,{ref:t,props:[{id:f},a]})});let Az;function gv(){return Az}const Ez={primary:"bg-primary text-primary-foreground hover:bg-primary/90 border border-transparent",secondary:"bg-secondary/60 text-foreground border border-border hover:bg-secondary",ghost:"bg-transparent text-muted-foreground hover:bg-secondary/60 hover:text-foreground border border-transparent",danger:"bg-transparent text-destructive border border-destructive/30 hover:bg-destructive/10"},Rz={sm:"h-7 px-2.5 text-xs gap-1.5",md:"h-9 px-3.5 text-[13px] gap-2",icon:"h-8 w-8 justify-center"},Wt=A.forwardRef(function({className:e,variant:t="secondary",size:i="md",loading:r=!1,icon:o,children:a,disabled:u,...f},d){return x.jsxs("button",{ref:d,disabled:u||r,className:jt("inline-flex shrink-0 items-center rounded-md font-medium outline-none transition-colors","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:pointer-events-none disabled:opacity-50",Ez[t],Rz[i],e),...f,children:[r?x.jsx("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",className:"animate-spin","aria-hidden":!0,children:x.jsx("circle",{cx:"7",cy:"7",r:"5",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"20",strokeDashoffset:"10",strokeLinecap:"round"})}):o,a]})});function lr({className:n,children:e}){return x.jsx("span",{className:jt("inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 text-[11px] font-medium uppercase tracking-wide","border-border bg-secondary/60 text-muted-foreground",n),children:e})}function Tz({className:n}){return x.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:jt("animate-spin",n),"aria-hidden":!0,children:x.jsx("circle",{cx:"8",cy:"8",r:"6",stroke:"currentColor",strokeWidth:"1.5",strokeDasharray:"24",strokeDashoffset:"12",strokeLinecap:"round"})})}function Ns({label:n}){return x.jsxs("div",{className:"mt-8 flex items-center justify-center gap-2 text-[13px] text-muted-foreground",children:[x.jsx(Tz,{}),n]})}function If({status:n}){return x.jsx("span",{className:jt("inline-flex items-center rounded-md border px-1.5 py-0.5 text-[11px] font-medium uppercase tracking-wide",Pj(n)),children:Ij(n)})}function Tc({className:n,children:e}){return x.jsx("span",{className:jt("font-mono text-[12px] text-foreground",n),children:e})}function Hc({title:n,description:e,actions:t}){return x.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[x.jsxs("div",{children:[x.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:n}),e?x.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:e}):null]}),t]})}function Es({title:n,description:e,children:t,className:i}){return x.jsxs("section",{className:jt("rounded-xl border border-border bg-card",i),children:[x.jsxs("div",{className:"border-b border-border px-4 py-3",children:[x.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:n}),e?x.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:e}):null]}),x.jsx("div",{className:"px-4 py-4",children:t})]})}function up({open:n,onClose:e,title:t,children:i,footer:r,wide:o}){return x.jsx(Cz,{open:n,onOpenChange:a=>!a&&e(),children:x.jsxs(hz,{container:gv(),children:[x.jsx(mB,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm"}),x.jsxs(fz,{className:jt("fixed left-1/2 top-1/2 z-50 flex max-h-[85vh] w-full -translate-x-1/2 -translate-y-1/2 flex-col rounded-xl border border-border bg-card shadow-2xl outline-none",o?"max-w-2xl":"max-w-md"),children:[x.jsx("div",{className:"border-b border-border px-5 py-4",children:x.jsx(kz,{className:"text-[15px] font-semibold text-foreground",children:t})}),x.jsx("div",{className:"flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto px-5 py-5",children:i}),r?x.jsx("div",{className:"flex items-center justify-end gap-2 border-t border-border px-5 py-3",children:r}):null]})]})})}function _d({open:n,onClose:e,onConfirm:t,title:i,confirmLabel:r,danger:o,loading:a,children:u,confirmDisabled:f}){return x.jsx(up,{open:n,onClose:e,title:i,footer:x.jsxs(x.Fragment,{children:[x.jsx(Wt,{variant:"secondary",onClick:e,disabled:a,children:"Cancel"}),x.jsx(Wt,{variant:o?"danger":"primary",loading:a,disabled:f,onClick:t,children:r})]}),children:u})}function Li({children:n}){return x.jsx("div",{className:"mt-4 rounded-xl border border-border bg-card px-4 py-16 text-center",children:x.jsx("p",{className:"text-[13px] text-muted-foreground",children:n})})}function Kp(){return x.jsx("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:x.jsx(Li,{children:"No application selected. Create one from the application switcher in the top bar."})})}const Oz=864e5;function zy({label:n,value:e,hint:t,tone:i}){return x.jsxs("div",{className:"rounded-xl border border-border bg-card px-4 py-4",children:[x.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:n}),x.jsx("p",{className:jt("mt-1.5 text-2xl font-semibold tabular-nums tracking-tight",i),children:e}),t?x.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t}):null]})}function Mz({app:n,onOpenDelivery:e,onCreateEndpoint:t}){const i=ji({queryKey:["deliveries",n,{view:"overview"}],queryFn:()=>Gb(n,{limit:200}),staleTime:1e4,enabled:n!==""}),r=ji({queryKey:["endpoints",n],queryFn:()=>Fb(n),staleTime:3e4,enabled:n!==""});if(!n)return x.jsx(Kp,{});const o=i.data??[],a=r.data??[],u=E=>{var k;return((k=a.find(R=>R.id===E))==null?void 0:k.url)??E},f=Date.now(),d=o.filter(E=>_j(E.updatedAt,Oz,f)),p=d.reduce((E,k)=>E+k.attemptCount,0),g=d.filter(E=>E.status==="succeeded").length,b=d.filter(E=>E.status==="failed").length,v=Vj(g,b),S=o.filter(E=>E.status==="failed"),w=S.slice(0,8);return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Overview",description:x.jsxs(x.Fragment,{children:["Delivery health for ",x.jsx("span",{className:"font-mono",children:n})," over the last 24 hours."]})}),i.isLoading?x.jsx(Ns,{label:"Loading deliveries…"}):i.isError?x.jsx(Li,{children:"Failed to load deliveries."}):x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"mt-6 grid grid-cols-1 gap-3 sm:grid-cols-3",children:[x.jsx(zy,{label:"Attempts (24h)",value:String(p),hint:`${d.length} deliver${d.length===1?"y":"ies"} touched`,tone:"text-chart-1"}),x.jsx(zy,{label:"Success rate (24h)",value:v===null?"—":`${v}%`,hint:v===null?"No terminal deliveries yet":`${g} succeeded · ${b} dead-lettered`,tone:v!==null&&v<90?"text-warning":"text-success"}),x.jsx(zy,{label:"Dead-letter",value:String(S.length),hint:"Exhausted deliveries awaiting retry",tone:S.length>0?"text-destructive":void 0})]}),x.jsxs("div",{className:"mt-8",children:[x.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Recent failures"}),w.length===0?x.jsx(Li,{children:"No dead-lettered deliveries. Everything is flowing."}):x.jsx("div",{className:"mt-3 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:w.map(E=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>e(E.id),className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary/30",children:[x.jsx(If,{status:E.status}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx(Tc,{className:"block truncate",children:E.id}),x.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[u(E.endpointId)," · ",E.attemptCount," attempt",E.attemptCount===1?"":"s"]})]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(E.updatedAt),children:Of(E.updatedAt)}),x.jsx(aa,{className:"size-4 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},E.id))})})]})]})]})}function lc({controlled:n,default:e,name:t,state:i="value"}){const{current:r}=A.useRef(n!==void 0),[o,a]=A.useState(e),u=r?n:o,f=A.useCallback(d=>{r||a(d)},[]);return[u,f]}const k2=A.createContext(void 0);function Nz(){const n=A.useContext(k2);if(n===void 0)throw new Error(ri(63));return n}let _C=(function(n){return n.disabled="data-disabled",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});const Dz={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Yp={valid(n){return n===null?null:n?{[_C.valid]:""}:{[_C.invalid]:""}}};let UC=(function(n){return n.checked="data-checked",n.unchecked="data-unchecked",n.disabled="data-disabled",n.readonly="data-readonly",n.required="data-required",n.valid="data-valid",n.invalid="data-invalid",n.touched="data-touched",n.dirty="data-dirty",n.filled="data-filled",n.focused="data-focused",n})({});const A2={...Yp,checked(n){return n?{[UC.checked]:""}:{[UC.unchecked]:""}}};function jz(n,e){return{...n,state:{...n.state,valid:!e&&n.state.valid}}}const Bz=A.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:un,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function Wp(){return A.useContext(Bz)}const Lz=A.createContext({invalid:void 0,name:void 0,validityData:{state:Dz,errors:[],error:"",value:"",initialValue:null},setValidityData:un,disabled:void 0,touched:!1,setTouched:un,dirty:!1,setDirty:un,filled:!1,setFilled:un,focused:!1,setFocused:un,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(n=_n)=>n,getInputValidationProps:(n=_n)=>n,inputRef:{current:null},commit:async()=>{}}});function oo(n=!0){const e=A.useContext(Lz);if(e.setValidityData===un&&!n)throw new Error(ri(28));return e}function yv(n){const{enabled:e=!0,value:t,id:i,name:r,controlRef:o,commit:a}=n,{formRef:u}=Wp(),{invalid:f,markedDirtyRef:d,validityData:p,setValidityData:g}=oo(),b=He(n.getValue);ze(()=>{if(!e)return;let v=t;v===void 0&&(v=b()),p.initialValue===null&&v!==null&&g(S=>({...S,initialValue:v}))},[e,g,t,p.initialValue,b]),ze(()=>{!e||!i||u.current.fields.set(i,{getValue:b,name:r,controlRef:o,validityData:jz(p,f),validate(){let v=t;v===void 0&&(v=b()),d.current=!0,Gr.flushSync(()=>a(v))}})},[a,o,e,u,b,i,f,d,r,p,t]),ze(()=>{const v=u.current.fields;return()=>{i&&v.delete(i)}},[u,i])}const zz=A.createContext({controlId:void 0,setControlId:un,labelId:void 0,setLabelId:un,messageIds:[],setMessageIds:un,getDescriptionProps:n=>n});function Vc(){return A.useContext(zz)}function bv(n={}){const{id:e,implicit:t=!1,controlRef:i}=n,{controlId:r,setControlId:o}=Vc(),a=Hp(e);return ze(()=>{if(!(!t&&!e||o===un)){if(t){const u=i==null?void 0:i.current;Zt(u)&&u.closest("label")!=null?o(e??null):o(r??a)}else e&&o(e);return()=>{e&&o(void 0)}}},[e,i,r,o,t,a]),r??a}function Ja(n,e){const t=A.useRef(n),i=He(e);ze(()=>{t.current!==n&&i(t.current)},[n,i]),ze(()=>{t.current=n},[n])}const Iz=A.forwardRef(function(e,t){const{checked:i,className:r,defaultChecked:o,id:a,inputRef:u,name:f,nativeButton:d=!1,onCheckedChange:p,readOnly:g=!1,required:b=!1,disabled:v=!1,render:S,uncheckedValue:w,...E}=e,{clearErrors:k}=Wp(),{state:R,setTouched:N,setDirty:T,validityData:B,setFilled:L,setFocused:D,shouldValidateOnChange:j,validationMode:X,disabled:J,name:V,validation:K}=oo(),{labelId:ae}=Vc(),$=J||v,H=V??f,z=He(p),Q=A.useRef(null),F=Zl(Q,u,K.inputRef),ee=A.useRef(null),G=Hp(),M=bv({id:a,implicit:!1,controlRef:ee}),[U,te]=lc({controlled:i,default:!!o,name:"Switch",state:"checked"});yv({id:G,commit:K.commit,value:U,controlRef:ee,name:H,getValue:()=>U}),ze(()=>{Q.current&&L(Q.current.checked)},[Q,L]),Ja(U,()=>{k(H),T(U!==B.initialValue),L(U),j()?K.commit(U):K.commit(U,!0)});const{getButtonProps:le,buttonRef:ne}=Df({disabled:$,native:d}),se={id:G,role:"switch","aria-checked":U,"aria-readonly":g||void 0,"aria-labelledby":ae,onFocus(){$||D(!0)},onBlur(){const fe=Q.current;!fe||$||(N(!0),D(!1),X==="onBlur"&&K.commit(fe.checked))},onClick(fe){var ie;g||$||(fe.preventDefault(),(ie=Q==null?void 0:Q.current)==null||ie.click())}},he=A.useMemo(()=>jp({checked:U,disabled:$,id:M,name:H,required:b,style:zf,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:F,onChange(fe){if(fe.nativeEvent.defaultPrevented)return;const ie=fe.target.checked,ye=tt(Oi,fe.nativeEvent);z==null||z(ie,ye),!ye.isCanceled&&te(ie)},onFocus(){var fe;(fe=ee.current)==null||fe.focus()}},K.getInputValidationProps),[U,$,F,M,H,z,b,te,K]),pe=A.useMemo(()=>({...R,checked:U,disabled:$,readOnly:g,required:b}),[R,U,$,g,b]),xe=wn("span",e,{state:pe,ref:[t,ee,ne],props:[se,K.getValidationProps,E,le],stateAttributesMapping:A2});return x.jsxs(k2.Provider,{value:pe,children:[xe,!U&&H&&w!==void 0&&x.jsx("input",{type:"hidden",name:H,value:w}),x.jsx("input",{...he})]})}),Pz=A.forwardRef(function(e,t){const{render:i,className:r,...o}=e,{state:a}=oo(),u=Nz(),f={...a,...u};return wn("span",e,{state:f,ref:t,stateAttributesMapping:A2,props:o})});function E2(n){const e=A.useRef(!0);e.current&&(e.current=!1,n())}const R2=A.createContext(null),T2=A.createContext(null);function ao(){const n=A.useContext(R2);if(n===null)throw new Error(ri(60));return n}function O2(){const n=A.useContext(T2);if(n===null)throw new Error(ri(61));return n}const M2=(n,e)=>Object.is(n,e);function Qr(n,e,t){return n==null||e==null?Object.is(n,e):t(n,e)}function _o(n,e,t){return!n||n.length===0?!1:n.some(i=>i===void 0?!1:Qr(i,e,t))}function Oc(n,e,t){return!n||n.length===0?-1:n.findIndex(i=>i===void 0?!1:Qr(i,e,t))}function N2(n,e,t){return n.filter(i=>!Qr(i,e,t))}function _0(n){if(n==null)return"";if(typeof n=="string")return n;try{return JSON.stringify(n)}catch{return String(n)}}function D2(n){return n!=null&&n.length>0&&typeof n[0]=="object"&&n[0]!=null&&"items"in n[0]}function Dn(n,e){if(e&&n!=null)return e(n)??"";if(n&&typeof n=="object"){if("label"in n&&n.label!=null)return String(n.label);if("value"in n)return String(n.value)}return _0(n)}function Jo(n,e){return e&&n!=null?e(n)??"":n&&typeof n=="object"&&"value"in n&&"label"in n?_0(n.value):_0(n)}function Hz(n,e,t){if(t&&n!=null)return t(n);if(n&&typeof n=="object"&&"label"in n&&n.label!=null)return n.label;if(e&&!Array.isArray(e))return e[n]??Dn(n,t);if(Array.isArray(e)){const i=D2(e)?e.flatMap(r=>r.items):e;if(n==null){const r=i.find(o=>o.value==null);return r&&r.label!=null?r.label:Dn(n,t)}if(typeof n!="object"){const r=i.find(o=>o&&o.value===n);return r&&r.label!=null?r.label:Dn(n,t)}if("value"in n){const r=i.find(o=>o&&o.value===n.value);if(r&&r.label!=null)return r.label}}return Dn(n,t)}function Vz(n,e){return!Array.isArray(n)||n.length===0?"":n.map(t=>Dn(t,e)).join(", ")}const pt={id:de(n=>n.id),modal:de(n=>n.modal),multiple:de(n=>n.multiple),items:de(n=>n.items),itemToStringLabel:de(n=>n.itemToStringLabel),itemToStringValue:de(n=>n.itemToStringValue),isItemEqualToValue:de(n=>n.isItemEqualToValue),value:de(n=>n.value),open:de(n=>n.open),mounted:de(n=>n.mounted),forceMount:de(n=>n.forceMount),transitionStatus:de(n=>n.transitionStatus),touchModality:de(n=>n.touchModality),activeIndex:de(n=>n.activeIndex),selectedIndex:de(n=>n.selectedIndex),isActive:de((n,e)=>n.activeIndex===e),isSelected:de((n,e,t)=>{const i=n.isItemEqualToValue,r=n.value;return n.multiple?Array.isArray(r)&&r.some(o=>Qr(o,t,i)):n.selectedIndex===e&&n.selectedIndex!==null?!0:Qr(r,t,i)}),isSelectedByFocus:de((n,e)=>n.selectedIndex===e),popupProps:de(n=>n.popupProps),triggerProps:de(n=>n.triggerProps),triggerElement:de(n=>n.triggerElement),positionerElement:de(n=>n.positionerElement),listElement:de(n=>n.listElement),scrollUpArrowVisible:de(n=>n.scrollUpArrowVisible),scrollDownArrowVisible:de(n=>n.scrollDownArrowVisible),hasScrollArrows:de(n=>n.hasScrollArrows),serializedValue:de(n=>{const{multiple:e,value:t,itemToStringValue:i}=n;return e&&Array.isArray(t)&&t.length===0?"":Jo(t,i)})};function _z(n){const{id:e,value:t,defaultValue:i=null,onValueChange:r,open:o,defaultOpen:a=!1,onOpenChange:u,name:f,disabled:d=!1,readOnly:p=!1,required:g=!1,modal:b=!0,actionsRef:v,inputRef:S,onOpenChangeComplete:w,items:E,multiple:k=!1,itemToStringLabel:R,itemToStringValue:N,isItemEqualToValue:T=M2,highlightItemOnHover:B=!0,children:L}=n,{clearErrors:D}=Wp(),{setDirty:j,shouldValidateOnChange:X,validityData:J,setFilled:V,name:K,disabled:ae,validation:$}=oo(),{controlId:H}=Vc(),z=bv({id:e}),Q=ae||d,F=K??f,[ee,G]=lc({controlled:t,default:k?i??Dl:i,name:"Select",state:"value"}),[M,U]=lc({controlled:o,default:a,name:"Select",state:"open"}),te=A.useRef([]),le=A.useRef([]),ne=A.useRef(null),se=A.useRef(null),he=A.useRef(0),pe=A.useRef(null),xe=A.useRef([]),fe=A.useRef(!1),ie=A.useRef(!1),ye=A.useRef(null),ve=A.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}),Qe=A.useRef(!1),{mounted:Re,setMounted:me,transitionStatus:ke}=Gp(M),be=Bi(()=>new Zo({id:z,modal:b,multiple:k,itemToStringLabel:R,itemToStringValue:N,isItemEqualToValue:T,value:ee,open:M,mounted:Re,transitionStatus:ke,items:E,forceMount:!1,touchModality:!1,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,De=ge(be,pt.activeIndex),qe=ge(be,pt.selectedIndex),je=ge(be,pt.triggerElement),Te=ge(be,pt.positionerElement),we=A.useMemo(()=>k&&Array.isArray(ee)&&ee.length===0?"":Jo(ee,N),[k,ee,N]),Ae=Vn(be.state.triggerElement);yv({id:z,commit:$.commit,value:ee,controlRef:Ae,name:F,getValue:()=>ee});const Ce=A.useRef(ee);ze(()=>{ee!==Ce.current&&be.set("forceMount",!0)},[be,ee]),ze(()=>{V(ee!==null)},[ee,V]),ze(function(){if(M)return;const it=xe.current;if(k){const Qt=Array.isArray(ee)?ee:[];if(Qt.length===0){be.set("selectedIndex",null);return}const sn=Qt[Qt.length-1],Rn=Oc(it,sn,T);be.set("selectedIndex",Rn===-1?null:Rn);return}const Et=Oc(it,ee,T);be.set("selectedIndex",Et===-1?null:Et)},[k,M,ee,xe,T,be]),Ja(ee,()=>{D(F),j(ee!==J.initialValue),X()?$.commit(ee):$.commit(ee,!0)});const Ze=He((Ge,it)=>{if(u==null||u(Ge,it),!it.isCanceled&&(U(Ge),!Ge&&be.state.activeIndex!==null)){const Et=te.current[be.state.activeIndex];queueMicrotask(()=>{Et==null||Et.setAttribute("tabindex","-1")})}}),nt=He(()=>{me(!1),be.set("activeIndex",null),w==null||w(!1)});da({enabled:!v,open:M,ref:ne,onComplete(){M||nt()}}),A.useImperativeHandle(v,()=>({unmount:nt}),[nt]);const _e=He((Ge,it)=>{r==null||r(Ge,it),!it.isCanceled&&G(Ge)}),rt=He(()=>{const Ge=be.state.listElement||ne.current;if(!Ge)return;const it=Ge.scrollTop,Et=Ge.scrollTop+Ge.clientHeight,Qt=it>1,sn=Et<Ge.scrollHeight-1;be.state.scrollUpArrowVisible!==Qt&&be.set("scrollUpArrowVisible",Qt),be.state.scrollDownArrowVisible!==sn&&be.set("scrollDownArrowVisible",sn)}),at=fv({open:M,onOpenChange:Ze,elements:{reference:je,floating:Te}}),Lt=lv(at,{enabled:!p&&!Q,event:"mousedown"}),nn=av(at,{bubbles:!1}),ht=d2(at,{enabled:!p&&!Q,listRef:te,activeIndex:De,selectedIndex:qe,disabledIndices:Dl,onNavigate(Ge){Ge===null&&!M||be.set("activeIndex",Ge)},focusItemOnHover:!1}),Ue=p2(at,{enabled:!p&&!Q&&(M||!k),listRef:le,activeIndex:De,selectedIndex:qe,onMatch(Ge){M?be.set("activeIndex",Ge):_e(xe.current[Ge],tt("none"))},onTypingChange(Ge){fe.current=Ge}}),{getReferenceProps:Jt,getFloatingProps:Pt,getItemProps:es}=hv([Lt,nn,ht,Ue]);E2(()=>{be.update({popupProps:Pt(),triggerProps:Jt()})}),ze(()=>{be.update({id:z,modal:b,multiple:k,value:ee,open:M,mounted:Re,transitionStatus:ke,popupProps:Pt(),triggerProps:Jt(),items:E,itemToStringLabel:R,itemToStringValue:N,isItemEqualToValue:T})},[be,z,b,k,ee,M,Re,ke,Pt,Jt,E,R,N,T]);const dn=A.useMemo(()=>({store:be,name:F,required:g,disabled:Q,readOnly:p,multiple:k,itemToStringLabel:R,itemToStringValue:N,highlightItemOnHover:B,setValue:_e,setOpen:Ze,listRef:te,popupRef:ne,scrollHandlerRef:se,handleScrollArrowVisibility:rt,scrollArrowsMountedCountRef:he,getItemProps:es,events:at.context.events,valueRef:pe,valuesRef:xe,labelsRef:le,typingRef:fe,selectionRef:ve,selectedItemTextRef:ye,validation:$,onOpenChangeComplete:w,keyboardActiveRef:ie,alignItemWithTriggerActiveRef:Qe,initialValueRef:Ce}),[be,F,g,Q,p,k,R,N,B,_e,Ze,es,at.context.events,$,w,rt]),At=Zl(S,$.inputRef),st=k&&Array.isArray(ee)&&ee.length>0,pn=A.useMemo(()=>!k||!Array.isArray(ee)||!F?null:ee.map(Ge=>{const it=Jo(Ge,N);return x.jsx("input",{type:"hidden",name:F,value:it},it)}),[k,ee,F,N]);return x.jsx(R2.Provider,{value:dn,children:x.jsxs(T2.Provider,{value:at,children:[L,x.jsx("input",{...$.getInputValidationProps({onFocus(){var Ge;(Ge=be.state.triggerElement)==null||Ge.focus()},onChange(Ge){if(Ge.nativeEvent.defaultPrevented)return;const it=Ge.target.value,Et=tt(Oi,Ge.nativeEvent);function Qt(){if(k)return;const sn=xe.current.find(Rn=>Jo(Rn,N).toLowerCase()===it.toLowerCase());sn!=null&&(j(sn!==J.initialValue),_e(sn,Et),X()&&$.commit(sn))}be.set("forceMount",!0),queueMicrotask(Qt)}}),id:e||H||void 0,name:k?void 0:F,value:we,disabled:Q,required:g&&!st,readOnly:p,ref:At,style:zf,tabIndex:-1,"aria-hidden":!0}),pn]})})}function j2(n){const e=n.getBoundingClientRect(),t=window.getComputedStyle(n,"::before"),i=window.getComputedStyle(n,"::after");if(!(t.content!=="none"||i.content!=="none"))return e;const o=parseFloat(t.width)||0,a=parseFloat(t.height)||0,u=parseFloat(i.width)||0,f=parseFloat(i.height)||0,d=Math.max(e.width,o,u),p=Math.max(e.height,a,f),g=d-e.width,b=p-e.height;return{left:e.left-g/2,right:e.right+g/2,top:e.top-b/2,bottom:e.bottom+b/2}}const gd=2,Uz={...Wb,...Yp,value:()=>null},qz=A.forwardRef(function(e,t){const{render:i,className:r,disabled:o=!1,nativeButton:a=!0,...u}=e,{setTouched:f,setFocused:d,validationMode:p,state:g,disabled:b}=oo(),{labelId:v}=Vc(),{store:S,setOpen:w,selectionRef:E,validation:k,readOnly:R,alignItemWithTriggerActiveRef:N,disabled:T,keyboardActiveRef:B}=ao(),L=b||T||o,D=ge(S,pt.open),j=ge(S,pt.value),X=ge(S,pt.triggerProps),J=ge(S,pt.positionerElement),V=ge(S,pt.listElement),K=ge(S,pt.serializedValue),ae=Vn(J),$=A.useRef(null),H=$i(),z=$i(),{getButtonProps:Q,buttonRef:F}=Df({disabled:L,native:a}),ee=He(se=>{S.set("triggerElement",se)}),G=Zl(t,$,F,ee),M=$i(),U=$i();A.useEffect(()=>{if(D)return U.start(200,()=>{E.current.allowUnselectedMouseUp=!0,M.start(200,()=>{E.current.allowSelectedMouseUp=!0})}),()=>{M.clear(),U.clear()};E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1},z.clear()},[D,E,z,M,U]);const te=A.useMemo(()=>{var se;return(V==null?void 0:V.id)??((se=cf(J))==null?void 0:se.id)},[V,J]),le=jp(X,{role:"combobox","aria-expanded":D?"true":"false","aria-haspopup":"listbox","aria-controls":D?te:void 0,"aria-labelledby":v,"aria-readonly":R||void 0,tabIndex:L?-1:0,ref:G,onFocus(se){d(!0),D&&N.current&&w(!1,tt(Pp,se.nativeEvent)),H.start(0,()=>{S.set("forceMount",!0)})},onBlur(){f(!0),d(!1),p==="onBlur"&&k.commit(j)},onPointerMove({pointerType:se}){B.current=!1,S.set("touchModality",se==="touch")},onPointerDown({pointerType:se}){S.set("touchModality",se==="touch")},onKeyDown(){B.current=!0},onMouseDown(se){if(D)return;const he=Fr(se.currentTarget);function pe(xe){if(!$.current)return;const fe=xe.target;if(Dt($.current,fe)||Dt(ae.current,fe)||fe===$.current)return;const ie=j2($.current);xe.clientX>=ie.left-gd&&xe.clientX<=ie.right+gd&&xe.clientY>=ie.top-gd&&xe.clientY<=ie.bottom+gd||w(!1,tt(OB,xe))}z.start(0,()=>{he.addEventListener("mouseup",pe,{once:!0})})}},k.getValidationProps,u,Q);le.role="combobox";const ne=A.useMemo(()=>({...g,open:D,disabled:L,value:j,readOnly:R,placeholder:!K}),[g,D,L,j,R,K]);return wn("button",e,{ref:[t,$],state:ne,stateAttributesMapping:Uz,props:le})}),Fz={value:()=>null},Gz=A.forwardRef(function(e,t){const{className:i,render:r,children:o,...a}=e,{store:u,valueRef:f}=ao(),d=ge(u,pt.value),p=ge(u,pt.items),g=ge(u,pt.itemToStringLabel),b=ge(u,pt.serializedValue),v=A.useMemo(()=>({value:d,placeholder:!b}),[d,b]),S=typeof o=="function"?o(d):o??(Array.isArray(d)?Vz(d,g):Hz(d,p,g));return wn("span",e,{state:v,ref:[t,f],props:[{children:S},a],stateAttributesMapping:Fz})}),Qz=A.forwardRef(function(e,t){const{className:i,render:r,...o}=e,{store:a}=ao(),u=ge(a,pt.open),f=A.useMemo(()=>({open:u}),[u]);return wn("span",e,{state:f,ref:t,props:[{"aria-hidden":!0,children:"▼"},o],stateAttributesMapping:dB})}),Kz=A.createContext(void 0),Yz=A.forwardRef(function(e,t){const{store:i}=ao(),r=ge(i,pt.mounted),o=ge(i,pt.forceMount);return r||o?x.jsx(Kz.Provider,{value:!0,children:x.jsx(iv,{ref:t,...e})}):null}),B2=A.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Wz(){return A.useContext(B2)}function L2(n){const{children:e,elementsRef:t,labelsRef:i,onMapChange:r}=n,o=He(r),a=A.useRef(0),u=Bi($z).current,f=Bi(Xz).current,[d,p]=A.useState(0),g=A.useRef(d),b=He((k,R)=>{f.set(k,R??null),g.current+=1,p(g.current)}),v=He(k=>{f.delete(k),g.current+=1,p(g.current)}),S=A.useMemo(()=>{const k=new Map;return Array.from(f.keys()).filter(N=>N.isConnected).sort(Zz).forEach((N,T)=>{const B=f.get(N)??{};k.set(N,{...B,index:T})}),k},[f,d]);ze(()=>{if(typeof MutationObserver!="function"||S.size===0)return;const k=new MutationObserver(R=>{const N=new Set,T=B=>N.has(B)?N.delete(B):N.add(B);R.forEach(B=>{B.removedNodes.forEach(T),B.addedNodes.forEach(T)}),N.size===0&&(g.current+=1,p(g.current))});return S.forEach((R,N)=>{N.parentElement&&k.observe(N.parentElement,{childList:!0})}),()=>{k.disconnect()}},[S]),ze(()=>{g.current===d&&(t.current.length!==S.size&&(t.current.length=S.size),i&&i.current.length!==S.size&&(i.current.length=S.size),a.current=S.size),o(S)},[o,S,t,i,d]),ze(()=>()=>{t.current=[]},[t]),ze(()=>()=>{i&&(i.current=[])},[i]);const w=He(k=>(u.add(k),()=>{u.delete(k)}));ze(()=>{u.forEach(k=>k(S))},[u,S]);const E=A.useMemo(()=>({register:b,unregister:v,subscribeMapChange:w,elementsRef:t,labelsRef:i,nextIndexRef:a}),[b,v,w,t,i,a]);return x.jsx(B2.Provider,{value:E,children:e})}function Xz(){return new Map}function $z(){return new Set}function Zz(n,e){const t=n.compareDocumentPosition(e);return t&Node.DOCUMENT_POSITION_FOLLOWING||t&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:t&Node.DOCUMENT_POSITION_PRECEDING||t&Node.DOCUMENT_POSITION_CONTAINS?1:0}const Jz=A.createContext(void 0);function z2(){const n=A.useContext(Jz);return(n==null?void 0:n.direction)??"ltr"}const e5=n=>({name:"arrow",options:n,async fn(e){var ee,G;const{x:t,y:i,placement:r,rects:o,platform:a,elements:u,middlewareData:f}=e,{element:d,padding:p=0,offsetParent:g="real"}=qr(n,e)||{};if(d==null)return{};const b=qE(p),v={x:t,y:i},S=nv(r),w=tv(S),E=await a.getDimensions(d),k=S==="y",R=k?"top":"left",N=k?"bottom":"right",T=k?"clientHeight":"clientWidth",B=o.reference[w]+o.reference[S]-v[S]-o.floating[w],L=v[S]-o.reference[S],D=g==="real"?await((ee=a.getOffsetParent)==null?void 0:ee.call(a,d)):u.floating;let j=u.floating[T]||o.floating[w];(!j||!await((G=a.isElement)==null?void 0:G.call(a,D)))&&(j=u.floating[T]||o.floating[w]);const X=B/2-L/2,J=j/2-E[w]/2-1,V=Math.min(b[R],J),K=Math.min(b[N],J),ae=V,$=j-E[w]-K,H=j/2-E[w]/2+X,z=I0(ae,H,$),Q=!f.arrow&&lo(r)!=null&&H!==z&&o.reference[w]/2-(H<ae?V:K)-E[w]/2<0,F=Q?H<ae?H-ae:H-$:0;return{[S]:v[S]+F,data:{[S]:z,centerOffset:H-z-F,...Q&&{alignmentOffset:F}},reset:Q}}}),t5=(n,e)=>({...e5(n),options:[n,e]}),n5={name:"hide",async fn(n){var u;const{width:e,height:t,x:i,y:r}=n.rects.reference,o=e===0&&t===0&&i===0&&r===0;return{data:{referenceHidden:((u=(await vL().fn(n)).data)==null?void 0:u.referenceHidden)||o}}}},i5={sideX:"left",sideY:"top"};function I2(n,e,t){const i=n==="inline-start"||n==="inline-end";return{top:"top",right:i?t?"inline-start":"inline-end":"right",bottom:"bottom",left:i?t?"inline-end":"inline-start":"left"}[e]}function qC(n,e,t){const{rects:i,placement:r}=n;return{side:I2(e,Zi(r),t),align:lo(r)||"center",anchor:{width:i.reference.width,height:i.reference.height},positioner:{width:i.floating.width,height:i.floating.height}}}function P2(n){var es,dn;const{anchor:e,positionMethod:t="absolute",side:i="bottom",sideOffset:r=0,align:o="center",alignOffset:a=0,collisionBoundary:u,collisionPadding:f=5,sticky:d=!1,arrowPadding:p=5,disableAnchorTracking:g=!1,keepMounted:b=!1,floatingRootContext:v,mounted:S,collisionAvoidance:w,shiftCrossAxis:E=!1,nodeId:k,adaptiveOrigin:R,lazyFlip:N=!1,externalTree:T}=n,[B,L]=A.useState(null);!S&&B!==null&&L(null);const D=w.side||"flip",j=w.align||"flip",X=w.fallbackAxisSide||"end",J=typeof e=="function"?e:void 0,V=He(J),K=J?V:e,ae=Vn(e),H=z2()==="rtl",z=B||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":H?"left":"right","inline-start":H?"right":"left"}[i],Q=o==="center"?z:`${z}-${o}`;let F=f;const ee=1,G=i==="bottom"?ee:0,M=i==="top"?ee:0,U=i==="right"?ee:0,te=i==="left"?ee:0;typeof F=="number"?F={top:F+G,right:F+te,bottom:F+M,left:F+U}:F&&(F={top:(F.top||0)+G,right:(F.right||0)+te,bottom:(F.bottom||0)+M,left:(F.left||0)+U});const le={boundary:u==="clipping-ancestors"?"clippingAncestors":u,padding:F},ne=A.useRef(null),se=Vn(r),he=Vn(a),fe=[pL(At=>{const st=qC(At,i,H),pn=typeof se.current=="function"?se.current(st):se.current,Ge=typeof he.current=="function"?he.current(st):he.current;return{mainAxis:pn,crossAxis:Ge,alignmentAxis:Ge}},[typeof r!="function"?r:0,typeof a!="function"?a:0,H,i])],ie=j==="none"&&D!=="shift",ye=!ie&&(d||E||D==="shift"),ve=D==="none"?null:yL({...le,padding:{top:F.top+ee,right:F.right+ee,bottom:F.bottom+ee,left:F.left+ee},mainAxis:!E&&D==="flip",crossAxis:j==="flip"?"alignment":!1,fallbackAxisSideDirection:X}),Qe=ie?null:mL(At=>{const st=Fr(At.elements.floating).documentElement;return{...le,rootBoundary:E?{x:0,y:0,width:st.clientWidth,height:st.clientHeight}:void 0,mainAxis:j!=="none",crossAxis:ye,limiter:d||E?void 0:gL(pn=>{if(!ne.current)return{};const{width:Ge,height:it}=ne.current.getBoundingClientRect(),Et=hs(Zi(pn.placement)),Qt=Et==="y"?Ge:it,sn=Et==="y"?F.left+F.right:F.top+F.bottom;return{offset:Qt/2+sn/2}})}},[le,d,E,F,j]);D==="shift"||j==="shift"||o==="center"?fe.push(Qe,ve):fe.push(ve,Qe),fe.push(bL({...le,apply({elements:{floating:At},rects:{reference:st},availableWidth:pn,availableHeight:Ge}){Object.entries({"--available-width":`${pn}px`,"--available-height":`${Ge}px`,"--anchor-width":`${st.width}px`,"--anchor-height":`${st.height}px`}).forEach(([it,Et])=>{At.style.setProperty(it,Et)})}}),t5(()=>({element:ne.current||document.createElement("div"),padding:p,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(At){var rn,Tn,yi;const{elements:st,middlewareData:pn,placement:Ge,rects:it,y:Et}=At,Qt=Zi(Ge),sn=hs(Qt),Rn=ne.current,Un=((rn=pn.arrow)==null?void 0:rn.x)||0,oi=((Tn=pn.arrow)==null?void 0:Tn.y)||0,ai=(Rn==null?void 0:Rn.clientWidth)||0,lt=(Rn==null?void 0:Rn.clientHeight)||0,ts=Un+ai/2,ur=oi+lt/2,ys=Math.abs(((yi=pn.shift)==null?void 0:yi.y)||0),zs=it.reference.height/2,Is=typeof r=="function"?r(qC(At,i,H)):r,fr=ys>Is,qn={top:`${ts}px calc(100% + ${Is}px)`,bottom:`${ts}px ${-Is}px`,left:`calc(100% + ${Is}px) ${ur}px`,right:`${-Is}px ${ur}px`}[Qt],Ut=`${ts}px ${it.reference.y+zs-Et}px`;return st.floating.style.setProperty("--transform-origin",ye&&sn==="y"&&fr?Ut:qn),{}}},n5,R),ze(()=>{!S&&v&&v.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[S,v]);const Re=A.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:me,elements:ke,x:be,y:De,middlewareData:qe,update:je,placement:Te,context:we,isPositioned:Ae,floatingStyles:Ce}=$L({rootContext:v,placement:Q,middleware:fe,strategy:t,whileElementsMounted:b?void 0:(...At)=>NC(...At,Re),nodeId:k,externalTree:T}),{sideX:Ze,sideY:nt}=qe.adaptiveOrigin||i5,_e=Ae?t:"fixed",rt=A.useMemo(()=>R?{position:_e,[Ze]:be,[nt]:De}:{position:_e,...Ce},[R,_e,Ze,be,nt,De,Ce]),at=A.useRef(null);ze(()=>{if(!S)return;const At=ae.current,st=typeof At=="function"?At():At,Ge=(FC(st)?st.current:st)||null||null;Ge!==at.current&&(me.setPositionReference(Ge),at.current=Ge)},[S,me,K,ae]),A.useEffect(()=>{if(!S)return;const At=ae.current;typeof At!="function"&&FC(At)&&At.current!==at.current&&(me.setPositionReference(At.current),at.current=At.current)},[S,me,K,ae]),A.useEffect(()=>{if(b&&S&&ke.domReference&&ke.floating)return NC(ke.domReference,ke.floating,je,Re)},[b,S,ke,je,Re]);const Lt=Zi(Te),nn=I2(i,Lt,H),ht=lo(Te)||"center",Ue=!!((es=qe.hide)!=null&&es.referenceHidden);ze(()=>{N&&S&&Ae&&L(Lt)},[N,S,Ae,Lt]);const Jt=A.useMemo(()=>{var At,st;return{position:"absolute",top:(At=qe.arrow)==null?void 0:At.y,left:(st=qe.arrow)==null?void 0:st.x}},[qe.arrow]),Pt=((dn=qe.arrow)==null?void 0:dn.centerOffset)!==0;return A.useMemo(()=>({positionerStyles:rt,arrowStyles:Jt,arrowRef:ne,arrowUncentered:Pt,side:nn,align:ht,physicalSide:Lt,anchorHidden:Ue,refs:me,context:we,isPositioned:Ae,update:je}),[rt,Jt,ne,Pt,nn,ht,Lt,Ue,me,we,Ae,je])}function FC(n){return n!=null&&"current"in n}const H2=A.createContext(void 0);function s5(){const n=A.useContext(H2);if(!n)throw new Error(ri(59));return n}function fp(n,e){n&&Object.assign(n.style,e)}const r5={position:"relative",maxHeight:"100%",overflowX:"hidden",overflowY:"auto"},l5={position:"fixed"},o5=A.forwardRef(function(e,t){const{anchor:i,positionMethod:r="absolute",className:o,render:a,side:u="bottom",align:f="center",sideOffset:d=0,alignOffset:p=0,collisionBoundary:g="clipping-ancestors",collisionPadding:b,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:w,alignItemWithTrigger:E=!0,collisionAvoidance:k=ME,...R}=e,{store:N,listRef:T,labelsRef:B,alignItemWithTriggerActiveRef:L,selectedItemTextRef:D,valuesRef:j,initialValueRef:X,popupRef:J,setValue:V}=ao(),K=O2(),ae=ge(N,pt.open),$=ge(N,pt.mounted),H=ge(N,pt.modal),z=ge(N,pt.value),Q=ge(N,pt.touchModality),F=ge(N,pt.positionerElement),ee=ge(N,pt.triggerElement),G=ge(N,pt.isItemEqualToValue),M=A.useRef(null),U=A.useRef(null),[te,le]=A.useState(E),ne=$&&te&&!Q;!$&&te!==E&&le(E),ze(()=>{$||(pt.scrollUpArrowVisible(N.state)&&N.set("scrollUpArrowVisible",!1),pt.scrollDownArrowVisible(N.state)&&N.set("scrollDownArrowVisible",!1))},[N,$]),A.useImperativeHandle(L,()=>ne),mv((ne||H)&&ae&&!Q,ee);const se=P2({anchor:i,floatingRootContext:K,positionMethod:r,mounted:$,side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:v,collisionBoundary:g,collisionPadding:b,sticky:S,disableAnchorTracking:w??ne,collisionAvoidance:k,keepMounted:!0}),he=ne?"none":se.side,pe=ne?l5:se.positionerStyles,xe=A.useMemo(()=>{const me={};return ae||(me.pointerEvents="none"),{role:"presentation",hidden:!$,style:{...pe,...me}}},[ae,$,pe]),fe=A.useMemo(()=>({open:ae,side:he,align:se.align,anchorHidden:se.anchorHidden}),[ae,he,se.align,se.anchorHidden]),ie=He(me=>{N.set("positionerElement",me)}),ye=wn("div",e,{ref:[t,ie],state:fe,stateAttributesMapping:Pc,props:[xe,R]}),ve=A.useRef(0),Qe=He(me=>{if(me.size===0&&ve.current===0||j.current.length===0)return;const ke=ve.current;if(ve.current=me.size,me.size===ke)return;const be=tt(Oi);if(ke!==0&&!N.state.multiple&&z!==null&&Oc(j.current,z,G)===-1){const qe=X.current,Te=qe!=null&&_o(j.current,qe,G)?qe:null;V(Te,be),Te===null&&(N.set("selectedIndex",null),D.current=null)}if(ke!==0&&N.state.multiple&&Array.isArray(z)){const De=z.filter(qe=>_o(j.current,qe,G));(De.length!==z.length||De.some(qe=>!_o(z,qe,G)))&&(V(De,be),De.length===0&&(N.set("selectedIndex",null),D.current=null))}if(ae&&ne){N.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});const De={height:""};fp(F,De),fp(J.current,De)}}),Re=A.useMemo(()=>({...se,side:he,alignItemWithTriggerActive:ne,setControlledAlignItemWithTrigger:le,scrollUpArrowRef:M,scrollDownArrowRef:U}),[se,he,ne,le]);return x.jsx(L2,{elementsRef:T,labelsRef:B,onMapChange:Qe,children:x.jsxs(H2.Provider,{value:Re,children:[$&&H&&x.jsx(pv,{inert:dv(!ae),cutout:ee}),ye]})})});function V2(n){const e=n.currentTarget.getBoundingClientRect();return e.top+1<=n.clientY&&n.clientY<=e.bottom-1&&e.left+1<=n.clientX&&n.clientX<=e.right-1}const yd="base-ui-disable-scrollbar",GC={className:yd,element:x.jsx("style",{href:yd,precedence:"base-ui:low",children:`.${yd}{scrollbar-width:none}.${yd}::-webkit-scrollbar{display:none}`})},a5=A.createContext(void 0);function c5(n){return A.useContext(a5)}function _2(n){return n==="starting"?eB:_n}const u5={...Pc,...Nf},f5=A.forwardRef(function(e,t){const{render:i,className:r,...o}=e,{store:a,popupRef:u,onOpenChangeComplete:f,setOpen:d,valueRef:p,selectedItemTextRef:g,keyboardActiveRef:b,multiple:v,handleScrollArrowVisibility:S,scrollHandlerRef:w}=ao(),{side:E,align:k,alignItemWithTriggerActive:R,setControlledAlignItemWithTrigger:N,scrollDownArrowRef:T,scrollUpArrowRef:B}=s5(),L=c5()!=null,D=O2(),j=$i(),X=ge(a,pt.id),J=ge(a,pt.open),V=ge(a,pt.mounted),K=ge(a,pt.popupProps),ae=ge(a,pt.transitionStatus),$=ge(a,pt.triggerElement),H=ge(a,pt.positionerElement),z=ge(a,pt.listElement),Q=A.useRef(0),F=A.useRef(!1),ee=A.useRef(0),G=A.useRef(!1),M=A.useRef({}),U=qp(),te=He(he=>{if(!H||!u.current||!G.current)return;if(F.current||!R){S();return}const pe=H.style.top==="0px",xe=H.style.bottom==="0px",fe=H.getBoundingClientRect().height,ie=Fr(H),ye=getComputedStyle(H),ve=parseFloat(ye.marginTop),Qe=parseFloat(ye.marginBottom),Re=ie.documentElement.clientHeight-ve-Qe,me=he.scrollTop,ke=he.scrollHeight,be=he.clientHeight,De=ke-be;let qe=null,je=null,Te=!1;if(pe){const we=De-me,Ae=fe+we,Ce=Math.min(Ae,Re);qe=Ce,Ce!==Re?je=De:Te=!0}else if(xe){const we=me-0,Ae=fe+we,Ce=Math.min(Ae,Re),Ze=Ae-Re;qe=Ce,Ce!==Re?je=0:(Te=!0,me<De&&(je=me-(we-Ze)))}qe!=null&&(H.style.height=`${qe}px`),je!=null&&(he.scrollTop=je),Te&&(F.current=!0),S()});A.useImperativeHandle(w,()=>te,[te]),da({open:J,ref:u,onComplete(){J&&(f==null||f(!0))}});const le=A.useMemo(()=>({open:J,transitionStatus:ae,side:E,align:k}),[J,ae,E,k]);ze(()=>{!H||!u.current||Object.keys(M.current).length||(M.current={top:H.style.top||"0",left:H.style.left||"0",right:H.style.right,height:H.style.height,bottom:H.style.bottom,minHeight:H.style.minHeight,maxHeight:H.style.maxHeight,marginTop:H.style.marginTop,marginBottom:H.style.marginBottom})},[u,H]),ze(()=>{V||R||(G.current=!1,F.current=!1,Q.current=0,ee.current=0,fp(H,M.current))},[V,R,H,u]),ze(()=>{const he=u.current;if(!(!V||!$||!H||!he)){if(!R){G.current=!0,U.request(S);return}queueMicrotask(()=>{var it;const pe=getComputedStyle(H),xe=getComputedStyle(he),fe=Fr($),ie=In(H),ye=$.getBoundingClientRect(),ve=H.getBoundingClientRect(),Qe=ye.left,Re=ye.height,me=z||he,ke=me.scrollHeight,be=parseFloat(xe.borderBottomWidth),De=parseFloat(pe.marginTop)||10,qe=parseFloat(pe.marginBottom)||10,je=parseFloat(pe.minHeight)||100,Te=5,we=5,Ae=20,Ce=fe.documentElement.clientHeight-De-qe,Ze=fe.documentElement.clientWidth,nt=Ce-ye.bottom+Re,_e=g.current,rt=p.current;let at=0,Lt=0;if(_e&&rt){const Et=rt.getBoundingClientRect(),Qt=_e.getBoundingClientRect(),sn=Et.left-Qe,Rn=Qt.left-ve.left,Un=Et.top-ye.top+Et.height/2,oi=Qt.top-ve.top+Qt.height/2;at=sn-Rn,Lt=oi-Un}const nn=nt+Lt+qe+be;let ht=Math.min(Ce,nn);const Ue=Ce-De-qe,Jt=nn-ht,Pt=Math.max(Te,Qe+at),es=Ze-we,dn=Math.max(0,Pt+ve.width-es);H.style.left=`${Pt-dn}px`,H.style.height=`${ht}px`,H.style.maxHeight="auto",H.style.marginTop=`${De}px`,H.style.marginBottom=`${qe}px`,he.style.height="100%";const At=me.scrollHeight-me.clientHeight,st=Jt>=At;st&&(ht=Math.min(Ce,ve.height)-(Jt-At));const pn=ye.top<Ae||ye.bottom>Ce-Ae||ht<Math.min(ke,je),Ge=(((it=ie.visualViewport)==null?void 0:it.scale)??1)!==1&&zE;if(pn||Ge){G.current=!0,fp(H,M.current),Gr.flushSync(()=>N(!1));return}if(st){const Et=Math.max(0,Ce-nn);H.style.top=ve.height>=Ue?"0":`${Et}px`,H.style.height=`${ht}px`,me.scrollTop=me.scrollHeight-me.clientHeight,Q.current=Math.max(je,ht)}else H.style.bottom="0",Q.current=Math.max(je,ht),me.scrollTop=Jt;Q.current===Ce&&(F.current=!0),S(),setTimeout(()=>{G.current=!0})})}},[a,V,H,$,p,g,u,S,R,N,U,T,B,z]),A.useEffect(()=>{if(!R||!H||!V)return;const he=In(H);function pe(xe){d(!1,tt(NB,xe))}return he.addEventListener("resize",pe),()=>{he.removeEventListener("resize",pe)}},[d,R,H,V]);const ne={...z?{role:"presentation","aria-orientation":void 0}:{role:"listbox","aria-multiselectable":v||void 0,id:`${X}-list`},onKeyDown(he){b.current=!0,L&&w2.has(he.key)&&he.stopPropagation()},onMouseMove(){b.current=!1},onPointerLeave(he){if(V2(he)||he.pointerType==="touch")return;const pe=he.currentTarget;j.start(0,()=>{a.set("activeIndex",null),pe.focus({preventScroll:!0})})},onScroll(he){var pe;z||(pe=w.current)==null||pe.call(w,he.currentTarget)},...R&&{style:z?{height:"100%"}:r5}},se=wn("div",e,{ref:[t,u],state:le,stateAttributesMapping:u5,props:[K,ne,_2(ae),{className:!z&&R?GC.className:void 0},o]});return x.jsxs(A.Fragment,{children:[GC.element,x.jsx(rv,{context:D,modal:!1,disabled:!V,restoreFocus:!0,children:se})]})});let vv=(function(n){return n[n.None=0]="None",n[n.GuessFromOrder=1]="GuessFromOrder",n})({});function U2(n={}){const{label:e,metadata:t,textRef:i,indexGuessBehavior:r,index:o}=n,{register:a,unregister:u,subscribeMapChange:f,elementsRef:d,labelsRef:p,nextIndexRef:g}=Wz(),b=A.useRef(-1),[v,S]=A.useState(o??(r===vv.GuessFromOrder?()=>{if(b.current===-1){const k=g.current;g.current+=1,b.current=k}return b.current}:-1)),w=A.useRef(null),E=A.useCallback(k=>{var R;if(w.current=k,v!==-1&&k!==null&&(d.current[v]=k,p)){const N=e!==void 0;p.current[v]=N?e:((R=i==null?void 0:i.current)==null?void 0:R.textContent)??k.textContent}},[v,d,p,e,i]);return ze(()=>{if(o!=null)return;const k=w.current;if(k)return a(k,t),()=>{u(k)}},[o,a,u,t]),ze(()=>{if(o==null)return f(k=>{var N;const R=w.current?(N=k.get(w.current))==null?void 0:N.index:null;R!=null&&S(R)})},[o,f,S]),A.useMemo(()=>({ref:E,index:v}),[v,E])}const q2=A.createContext(void 0);function xv(){const n=A.useContext(q2);if(!n)throw new Error(ri(57));return n}const h5=A.memo(A.forwardRef(function(e,t){const{render:i,className:r,value:o=null,label:a,disabled:u=!1,nativeButton:f=!1,...d}=e,p=A.useRef(null),g=U2({label:a,textRef:p,indexGuessBehavior:vv.GuessFromOrder}),{store:b,getItemProps:v,setOpen:S,setValue:w,selectionRef:E,typingRef:k,valuesRef:R,keyboardActiveRef:N,multiple:T,highlightItemOnHover:B}=ao(),L=$i(),D=ge(b,pt.isActive,g.index),j=ge(b,pt.isSelected,g.index,o),X=ge(b,pt.isSelectedByFocus,g.index),J=ge(b,pt.isItemEqualToValue),V=g.index,K=V!==-1,ae=A.useRef(null),$=Vn(V);ze(()=>{if(!K)return;const se=R.current;return se[V]=o,()=>{delete se[V]}},[K,V,o,R]),ze(()=>{if(!K)return;const se=b.state.value;let he=se;T&&Array.isArray(se)&&se.length>0&&(he=se[se.length-1]),he!==void 0&&Qr(he,o,J)&&b.set("selectedIndex",V)},[K,V,T,J,b,o]);const H=A.useMemo(()=>({disabled:u,selected:j,highlighted:D}),[u,j,D]),z=v({active:D,selected:j});z.onFocus=void 0,z.id=void 0;const Q=A.useRef(null),F=A.useRef("mouse"),ee=A.useRef(!1),{getButtonProps:G,buttonRef:M}=Df({disabled:u,focusableWhenDisabled:!0,native:f});function U(se){const he=b.state.value;if(T){const pe=Array.isArray(he)?he:[],xe=j?N2(pe,o,J):[...pe,o];w(xe,tt(Id,se))}else w(o,tt(Id,se)),S(!1,tt(Id,se))}const te={role:"option","aria-selected":j,"aria-disabled":u||void 0,tabIndex:D?0:-1,onFocus(){b.set("activeIndex",V)},onMouseEnter(){!N.current&&b.state.selectedIndex===null&&b.set("activeIndex",V)},onMouseMove(){B&&b.set("activeIndex",V)},onMouseLeave(se){!B||N.current||V2(se)||L.start(0,()=>{b.state.activeIndex===V&&b.set("activeIndex",null)})},onTouchStart(){E.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1}},onKeyDown(se){Q.current=se.key,b.set("activeIndex",V)},onClick(se){ee.current=!1,!(se.type==="keydown"&&Q.current===null)&&(u||Q.current===" "&&k.current||F.current!=="touch"&&!D||(Q.current=null,U(se.nativeEvent)))},onPointerEnter(se){F.current=se.pointerType},onPointerDown(se){F.current=se.pointerType,ee.current=!0},onMouseUp(se){if(u)return;if(ee.current){ee.current=!1;return}const he=!E.current.allowSelectedMouseUp&&j,pe=!E.current.allowUnselectedMouseUp&&!j;he||pe||F.current!=="touch"&&!D||U(se.nativeEvent)}},le=wn("div",e,{ref:[M,t,g.ref,ae],state:H,props:[z,te,d,G]}),ne=A.useMemo(()=>({selected:j,indexRef:$,textRef:p,selectedByFocus:X,hasRegistered:K}),[j,$,p,X,K]);return x.jsx(q2.Provider,{value:ne,children:le})})),d5=A.forwardRef(function(e,t){const i=e.keepMounted??!1,{selected:r}=xv();return i||r?x.jsx(p5,{...e,ref:t}):null}),p5=A.memo(A.forwardRef((n,e)=>{const{render:t,className:i,keepMounted:r,...o}=n,{selected:a}=xv(),u=A.useRef(null),{transitionStatus:f,setMounted:d}=Gp(a),p=A.useMemo(()=>({selected:a,transitionStatus:f}),[a,f]),g=wn("span",n,{ref:[e,u],state:p,props:[{"aria-hidden":!0,children:"✔️"},o],stateAttributesMapping:Nf});return da({open:a,ref:u,onComplete(){a||d(!1)}}),g})),m5=A.memo(A.forwardRef(function(e,t){const{indexRef:i,textRef:r,selectedByFocus:o,hasRegistered:a}=xv(),{selectedItemTextRef:u}=ao(),{className:f,render:d,...p}=e,g=A.useCallback(v=>{if(!v||!a)return;const S=u.current===null||!u.current.isConnected;(o||S&&i.current===0)&&(u.current=v)},[u,i,o,a]);return wn("div",e,{ref:[g,t,r],props:p})})),F2=A.createContext(void 0),G2=A.createContext(void 0),Q2=A.createContext(void 0),K2=A.createContext("");function co(){const n=A.useContext(F2);if(!n)throw new Error(ri(22));return n}function Xp(){const n=A.useContext(G2);if(!n)throw new Error(ri(23));return n}function pa(){const n=A.useContext(Q2);if(!n)throw new Error(ri(24));return n}function Y2(){return A.useContext(K2)}const Ve={id:de(n=>n.id),query:de(n=>n.query),items:de(n=>n.items),selectedValue:de(n=>n.selectedValue),open:de(n=>n.open),mounted:de(n=>n.mounted),forceMounted:de(n=>n.forceMounted),inline:de(n=>n.inline),activeIndex:de(n=>n.activeIndex),selectedIndex:de(n=>n.selectedIndex),isActive:de((n,e)=>n.activeIndex===e),isSelected:de((n,e)=>{const t=n.isItemEqualToValue,i=n.selectedValue;return Array.isArray(i)?i.some(r=>Qr(r,e,t)):Qr(i,e,t)}),transitionStatus:de(n=>n.transitionStatus),popupProps:de(n=>n.popupProps),inputProps:de(n=>n.inputProps),triggerProps:de(n=>n.triggerProps),getItemProps:de(n=>n.getItemProps),positionerElement:de(n=>n.positionerElement),listElement:de(n=>n.listElement),triggerElement:de(n=>n.triggerElement),inputElement:de(n=>n.inputElement),popupSide:de(n=>n.popupSide),openMethod:de(n=>n.openMethod),inputInsidePopup:de(n=>n.inputInsidePopup),selectionMode:de(n=>n.selectionMode),listRef:de(n=>n.listRef),labelsRef:de(n=>n.labelsRef),popupRef:de(n=>n.popupRef),emptyRef:de(n=>n.emptyRef),inputRef:de(n=>n.inputRef),keyboardActiveRef:de(n=>n.keyboardActiveRef),chipsContainerRef:de(n=>n.chipsContainerRef),clearRef:de(n=>n.clearRef),valuesRef:de(n=>n.valuesRef),allValuesRef:de(n=>n.allValuesRef),name:de(n=>n.name),disabled:de(n=>n.disabled),readOnly:de(n=>n.readOnly),required:de(n=>n.required),grid:de(n=>n.grid),isGrouped:de(n=>n.isGrouped),virtualized:de(n=>n.virtualized),onOpenChangeComplete:de(n=>n.onOpenChangeComplete),openOnInputClick:de(n=>n.openOnInputClick),itemToStringLabel:de(n=>n.itemToStringLabel),isItemEqualToValue:de(n=>n.isItemEqualToValue),modal:de(n=>n.modal),autoHighlight:de(n=>n.autoHighlight),submitOnItemClick:de(n=>n.submitOnItemClick)};function g5(n,e){return(t,i)=>{if(t==null)return!1;const r=Dn(t,e);return n.contains(r,i)}}function y5(n,e,t){return(i,r)=>{if(i==null)return!1;if(!r)return!0;const o=Dn(i,e),a=t!=null?Dn(t,e):"";return a&&n.contains(a,r)&&a.length===r.length?!0:n.contains(o,r)}}const QC=new Map;function W2(n){return Array.isArray(n)?n.map(e=>W2(e)).join(","):n==null?"":String(n)}function b5(n={}){const e={usage:"search",sensitivity:"base",ignorePunctuation:!0,...n},t=`${W2(n.locale)}|${JSON.stringify(e)}`,i=QC.get(t);if(i)return i;const r=new Intl.Collator(n.locale,e),o={contains(a,u,f){if(!u)return!0;const d=Dn(a,f);for(let p=0;p<=d.length-u.length;p+=1)if(r.compare(d.slice(p,p+u.length),u)===0)return!0;return!1},startsWith(a,u,f){if(!u)return!0;const d=Dn(a,f);return r.compare(d.slice(0,u.length),u)===0},endsWith(a,u,f){if(!u)return!0;const d=Dn(a,f),p=u.length;return d.length>=p&&r.compare(d.slice(d.length-p),u)===0}};return QC.set(t,o),o}const v5=b5,X2=Symbol("none"),jo={value:X2,index:-1};function x5(n){const{id:e,onOpenChangeComplete:t,defaultSelectedValue:i=null,selectedValue:r,onSelectedValueChange:o,defaultInputValue:a,inputValue:u,selectionMode:f="none",onItemHighlighted:d,name:p,disabled:g=!1,readOnly:b=!1,required:v=!1,inputRef:S,grid:w=!1,items:E,filteredItems:k,filter:R,openOnInputClick:N=!0,autoHighlight:T=!1,keepHighlight:B=!1,highlightItemOnHover:L=!0,itemToStringLabel:D,itemToStringValue:j,isItemEqualToValue:X=M2,virtualized:J=!1,inline:V=!1,fillInputOnItemPress:K=!0,modal:ae=!1,limit:$=-1,autoComplete:H="list",locale:z,submitOnItemClick:Q=!1}=n,{clearErrors:F}=Wp(),{setDirty:ee,validityData:G,shouldValidateOnChange:M,setFilled:U,name:te,disabled:le,validation:ne}=oo(),se=bv({id:e}),he=v5({locale:z}),[pe,xe]=A.useState(!1),[fe,ie]=A.useState(null),ye=A.useRef([]),ve=A.useRef([]),Qe=A.useRef(null),Re=A.useRef(null),me=A.useRef(null),ke=A.useRef(!0),be=A.useRef(!1),De=A.useRef(null),qe=A.useRef(null),je=A.useRef(null),Te=A.useRef(jo),we=A.useRef(null),Ae=A.useRef([]),Ce=A.useRef([]),Ze=le||g,nt=te??p,_e=f==="multiple",rt=f==="single",at=u!==void 0||a!==void 0,Lt=E!==void 0,nn=k!==void 0;let ht;T==="always"?ht="always":ht=T?"input-change":!1;const[Ue,Jt]=lc({controlled:r,default:_e?i??Dl:i,name:"Combobox",state:"selectedValue"}),Pt=A.useMemo(()=>R===null?()=>!0:R!==void 0?R:rt&&!pe?y5(he,D,Ue):g5(he,D),[R,rt,Ue,pe,he,D]),es=Bi(()=>at?a??"":rt?Dn(Ue,D):"").current,[dn,At]=lc({controlled:u,default:es,name:"Combobox",state:"inputValue"}),[st,pn]=lc({controlled:n.open,default:n.defaultOpen,name:"Combobox",state:"open"}),Ge=D2(E),it=fe??(dn===""?"":String(dn).trim()),Et=rt?Dn(Ue,D):"",Qt=rt&&!pe&&it!==""&&Et!==""&&Et.length===it.length&&he.contains(Et,it),sn=Qt?"":it,Rn=Lt&&nn&&Qt,Un=A.useMemo(()=>E?Ge?E.flatMap(Me=>Me.items):E:Dl,[E,Ge]),oi=A.useMemo(()=>{if(k&&!Rn)return k;if(!E)return Dl;if(Ge){const Ke=E,Je=[];let Mt=0;for(const ln of Ke){if($>-1&&Mt>=$)break;const On=sn===""?ln.items:ln.items.filter(dr=>Pt(dr,sn,D));if(On.length===0)continue;const vs=$>-1?$-Mt:1/0,nl=On.slice(0,vs);if(nl.length>0){const dr={...ln,items:nl};Je.push(dr),Mt+=nl.length}}return Je}if(sn==="")return $>-1?Un.slice(0,$):Un;const Me=[];for(const Ke of Un){if($>-1&&Me.length>=$)break;Pt(Ke,sn,D)&&Me.push(Ke)}return Me},[k,Rn,E,Ge,sn,$,Pt,D,Un]),ai=A.useMemo(()=>Ge?oi.flatMap(Ke=>Ke.items):oi,[oi,Ge]),lt=Bi(()=>new Zo({id:se,selectedValue:Ue,open:st,filter:Pt,query:it,items:E,selectionMode:f,listRef:ye,labelsRef:ve,popupRef:Qe,emptyRef:me,inputRef:Re,keyboardActiveRef:ke,chipsContainerRef:De,clearRef:qe,valuesRef:Ae,allValuesRef:Ce,selectionEventRef:je,name:nt,disabled:Ze,readOnly:b,required:v,grid:w,isGrouped:Ge,virtualized:J,openOnInputClick:N,itemToStringLabel:D,isItemEqualToValue:X,modal:ae,autoHighlight:ht,submitOnItemClick:Q,hasInputValue:at,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:V,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:t||un,setOpen:un,setInputValue:un,setSelectedValue:un,setIndices:un,onItemHighlighted:un,handleSelection:un,getItemProps:()=>_n,forceMount:un,requestSubmit:un})).current,ts=f==="none"?dn:Ue,ur=He(d),ys=He(t),zs=ge(lt,Ve.activeIndex),Is=ge(lt,Ve.selectedIndex),fr=ge(lt,Ve.positionerElement),qn=ge(lt,Ve.listElement),Ut=ge(lt,Ve.triggerElement),rn=ge(lt,Ve.inputElement),Tn=ge(lt,Ve.inline),yi=ge(lt,Ve.inputInsidePopup),cm=Vn(Ut),{mounted:Ff,setMounted:Gf,transitionStatus:hr}=Gp(st),{openMethod:ma,triggerProps:Ps,reset:Yr}=C2(st);yv({id:se,name:nt,commit:ne.commit,value:ts,controlRef:yi?cm:Re,getValue:()=>ts});const Hs=He(()=>{E?ve.current=ai.map(Me=>Dn(Me,D)):lt.set("forceMounted",!0)}),Wr=A.useRef(Ue);ze(()=>{Ue!==Wr.current&&Hs()},[Hs,Ue]);const Ot=He(Me=>{lt.update(Me);const Ke=Me.type||"none";if(Me.activeIndex!==void 0)if(Me.activeIndex===null)Te.current!==jo&&(Te.current=jo,ur(void 0,zu(Ke,void 0,{index:-1})));else{const Je=Ae.current[Me.activeIndex];Te.current={value:Je,index:Me.activeIndex},ur(Je,zu(Ke,void 0,{index:Me.activeIndex}))}}),ci=He((Me,Ke)=>{var Je;if(be.current=Ke.reason===Ol,(Je=n.onInputValueChange)==null||Je.call(n,Me,Ke),!Ke.isCanceled){if(Ke.reason===Vo){const Mt=Me.trim()!=="";Mt&&xe(!0),we.current={hasQuery:Mt},Mt&&ht&<.state.activeIndex==null&<.set("activeIndex",0)}At(Me)}}),Xr=He((Me,Ke)=>{var Je;st!==Me&&(Ke.reason==="escape-key"&&Lt&&ai.length===0&&!lt.state.emptyRef.current&&Ke.allowPropagation(),(Je=n.onOpenChange)==null||Je.call(n,Me,Ke),!Ke.isCanceled&&(!Me&&pe&&(rt?(ie(it),it===""&&xe(!1)):_e&&(Tn||yi?Ot({activeIndex:null}):ie(it),ci("",tt(Ol,Ke.event)))),pn(Me)))}),bi=He((Me,Ke)=>{if(o==null||o(Me,Ke),Ke.isCanceled)return;Jt(Me),(f==="none"&&Qe.current&&K||rt&&!lt.state.inputInsidePopup)&&ci(Dn(Me,D),tt(Ke.reason,Ke.event)),rt&&Me!=null&&Ke.reason!==Vo&&pe&&ie(it)}),$r=He((Me,Ke)=>{var nl;let Je=Ke;if(Je===void 0){if(zs===null)return;Je=Ae.current[zs]}const Mt=ni(Me),ln=je.current??Me;je.current=null;const On=tt(Id,ln),vs=(nl=Mt==null?void 0:Mt.closest("a"))==null?void 0:nl.getAttribute("href");if(vs){vs.startsWith("#")&&Xr(!1,On);return}if(_e){const dr=Array.isArray(Ue)?Ue:[],xs=_o(dr,Je,lt.state.isItemEqualToValue)?N2(dr,Je,lt.state.isItemEqualToValue):[...dr,Je];if(bi(xs,On),!(Re.current?Re.current.value.trim()!=="":!1))return;lt.state.inputInsidePopup?ci("",tt(Ol,On.event)):Xr(!1,On)}else bi(Je,On),Xr(!1,On)}),Uc=He(()=>{var Ke;if(!lt.state.submitOnItemClick)return;const Me=(Ke=lt.state.inputElement)==null?void 0:Ke.form;Me&&typeof Me.requestSubmit=="function"&&Me.requestSubmit()}),ga=He(()=>{if(Gf(!1),ys==null||ys(!1),xe(!1),Yr(),ie(null),Ot(f==="none"?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),_e&&Re.current&&Re.current.value!==""&&!be.current&&ci("",tt(Ol)),rt)if(lt.state.inputInsidePopup)Re.current&&Re.current.value!==""&&ci("",tt(Ol));else{const Me=Dn(Ue,D);Re.current&&Re.current.value!==Me&&ci(Me,tt(Me===""?Ol:Oi))}}),Qf=A.useMemo(()=>Tn&&fr?{current:fr.closest('[role="dialog"]')}:Qe,[Tn,fr]);da({enabled:!n.actionsRef,open:st,ref:Qf,onComplete(){st||ga()}}),A.useImperativeHandle(n.actionsRef,()=>({unmount:ga}),[ga]),ze(function(){if(st||f==="none")return;const Ke=E?Un:Ce.current;if(_e){const Je=Array.isArray(Ue)?Ue:[],Mt=Je[Je.length-1],ln=Oc(Ke,Mt,X);Ot({selectedIndex:ln===-1?null:ln})}else{const Je=Oc(Ke,Ue,X);Ot({selectedIndex:Je===-1?null:Je})}},[st,Ue,E,f,Un,_e,X,Ot]),ze(()=>{E&&(Ae.current=ai,ye.current.length=ai.length)},[E,ai]),ze(()=>{const Me=we.current;if(Me&&(Me.hasQuery?ht&<.set("activeIndex",0):ht==="always"&<.set("activeIndex",0),we.current=null),!st&&!Tn)return;const Je=Lt||nn?ai:Ae.current,Mt=lt.state.activeIndex;if(Mt==null){if(ht==="always"&&Je.length>0){lt.set("activeIndex",0);return}Te.current!==jo&&(Te.current=jo,lt.state.onItemHighlighted(void 0,zu(Oi,void 0,{index:-1})));return}if(Mt>=Je.length){Te.current!==jo&&(Te.current=jo,lt.state.onItemHighlighted(void 0,zu(Oi,void 0,{index:-1}))),lt.set("activeIndex",null);return}const ln=Je[Mt],On=Te.current.value,vs=On!==X2&<.state.isItemEqualToValue(ln,On);(Te.current.index!==Mt||!vs)&&(Te.current={value:ln,index:Mt},lt.state.onItemHighlighted(ln,zu(Oi,void 0,{index:Mt})))},[zs,ht,nn,Lt,ai,Tn,st,lt]),ze(()=>{if(!E||f==="none")return;const Me=Un;if(_e){const Mt=Array.isArray(Ue)?Ue:Dl,ln=Mt.filter(On=>_o(Me,On,lt.state.isItemEqualToValue));ln.length!==Mt.length&&Jt(ln);return}if(Ue==null?!0:_o(Me,Ue,lt.state.isItemEqualToValue))return;let Je=null;if(i!=null&&_o(Me,i,lt.state.isItemEqualToValue)&&(Je=i),Jt(Je),!lt.state.inputInsidePopup){const Mt=Dn(Je,D);Re.current&&Re.current.value!==Mt&&ci(Mt,tt(Oi))}},[E,Un,_e,f,Ue,i,Jt,D,lt,ci]),ze(()=>{if(f==="none"){U(String(dn)!=="");return}U(_e?Array.isArray(Ue)&&Ue.length>0:Ue!=null)},[U,f,dn,Ue,_e]),A.useEffect(()=>{Lt&&ht&&ai.length===0&&Ot({activeIndex:null})},[Lt,ht,ai.length,Ot]),Ja(it,()=>{!st||it===""||it===String(es)||xe(!0)}),Ja(Ue,()=>{if(f!=="none"&&(F(nt),ee(Ue!==G.initialValue),M()?ne.commit(Ue):ne.commit(Ue,!0),_e&<.state.selectedIndex!==null&&(!Array.isArray(Ue)||Ue.length===0)&&Ot({activeIndex:null,selectedIndex:null}),rt&&!at&&!yi)){const Me=Dn(Ue,D);dn!==Me&&ci(Me,tt(Oi))}}),Ja(dn,()=>{f==="none"&&(F(nt),ee(dn!==G.initialValue),M()?ne.commit(dn):ne.commit(dn,!0))}),Ja(E,()=>{if(!rt||at||yi||pe)return;const Me=Dn(Ue,D);dn!==Me&&ci(Me,tt(Oi))});const ya=fv({open:Tn?!0:st,onOpenChange:Xr,elements:{reference:yi?Ut:rn,floating:fr}});let Zr,Jr;Tn||(Zr=w?"grid":"listbox",Jr=st?"true":"false");const bs=A.useMemo(()=>{const Me=(rn==null?void 0:rn.tagName)==="INPUT",Ke=Me||st,Je=Me?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return Ke&&(Je.role="combobox",Je["aria-expanded"]=Jr,Je["aria-haspopup"]=Zr,Je["aria-controls"]=st?qn==null?void 0:qn.id:void 0,Je["aria-autocomplete"]=H),{reference:Je,floating:{role:"presentation"}}},[rn,st,Jr,Zr,qn==null?void 0:qn.id,H]),vi=lv(ya,{enabled:!b&&!Ze&&N,event:"mousedown-only",toggle:!1,touchOpenDelay:yi?0:50}),Kf=av(ya,{enabled:!b&&!Ze&&!Tn,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:Tn?!0:void 0,outsidePress(Me){const Ke=ni(Me);return!Dt(Ut,Ke)&&!Dt(qe.current,Ke)&&!Dt(De.current,Ke)}}),um=d2(ya,{enabled:!b&&!Ze,id:se,listRef:ye,activeIndex:zs,selectedIndex:Is,virtual:!0,loopFocus:!0,allowEscape:!ht,focusItemOnOpen:pe||f==="none"&&!ht?!1:"auto",focusItemOnHover:L,resetOnPointerLeave:!B,cols:w?2:1,orientation:w?"horizontal":void 0,disabledIndices:Dl,onNavigate(Me,Ke){!Ke&&!st||hr==="ending"||Ot(Ke?{activeIndex:Me,type:ke.current?"keyboard":"pointer"}:{activeIndex:Me})}}),{getReferenceProps:po,getFloatingProps:ba,getItemProps:el}=hv([bs,vi,Kf,um]);E2(()=>{lt.update({inline:V,popupProps:ba(),inputProps:po(),triggerProps:Ps,getItemProps:el,setOpen:Xr,setInputValue:ci,setSelectedValue:bi,setIndices:Ot,onItemHighlighted:ur,handleSelection:$r,forceMount:Hs,requestSubmit:Uc})}),ze(()=>{lt.update({id:se,selectedValue:Ue,open:st,mounted:Ff,transitionStatus:hr,items:E,inline:V,popupProps:ba(),inputProps:po(),triggerProps:Ps,openMethod:ma,getItemProps:el,selectionMode:f,name:nt,disabled:Ze,readOnly:b,required:v,grid:w,isGrouped:Ge,virtualized:J,onOpenChangeComplete:ys,openOnInputClick:N,itemToStringLabel:D,modal:ae,autoHighlight:ht,isItemEqualToValue:X,submitOnItemClick:Q,hasInputValue:at,requestSubmit:Uc})},[lt,se,Ue,st,Ff,hr,E,ba,po,el,ma,Ps,f,nt,Ze,b,v,ne,w,Ge,J,ys,N,D,ae,X,Q,at,V,Uc,ht]);const fm=Zl(S,ne.inputRef),xi=A.useMemo(()=>({query:it,filteredItems:oi,flatFilteredItems:ai}),[it,oi,ai]),qc=A.useMemo(()=>Array.isArray(ts)?"":Jo(ts,j),[ts,j]),Yf=_e&&Array.isArray(Ue)&&Ue.length>0,Fc=A.useMemo(()=>!_e||!Array.isArray(Ue)||!nt?null:Ue.map(Me=>{const Ke=Jo(Me,j);return x.jsx("input",{type:"hidden",name:nt,value:Ke},Ke)}),[_e,Ue,nt,j]),tl=x.jsxs(A.Fragment,{children:[n.children,x.jsx("input",{...ne.getInputValidationProps({onFocus(){var Me;if(yi){Ut==null||Ut.focus();return}(Me=Re.current||Ut)==null||Me.focus()},onChange(Me){if(Me.nativeEvent.defaultPrevented)return;const Ke=Me.target.value,Je=tt(Vo,Me.nativeEvent);function Mt(){if(_e)return;if(f==="none"){ee(Ke!==G.initialValue),ci(Ke,Je),M()&&ne.commit(Ke);return}const ln=Ae.current.find(On=>Jo(On,j).toLowerCase()===Ke.toLowerCase());ln!=null&&(ee(ln!==G.initialValue),bi==null||bi(ln,Je),M()&&ne.commit(ln))}E?Mt():(Hs(),queueMicrotask(Mt))}}),id:se,name:_e||f==="none"?void 0:nt,disabled:Ze,required:v&&!Yf,readOnly:b,value:qc,ref:fm,style:zf,tabIndex:-1,"aria-hidden":!0}),Fc]});return x.jsx(F2.Provider,{value:lt,children:x.jsx(G2.Provider,{value:ya,children:x.jsx(Q2.Provider,{value:xi,children:x.jsx(K2.Provider,{value:dn,children:tl})})})})}function S5(n){const{multiple:e=!1,defaultValue:t,value:i,onValueChange:r,...o}=n;return x.jsx(x5,{...o,selectionMode:e?"multiple":"single",selectedValue:i,defaultSelectedValue:t,onSelectedValueChange:r})}const w5=A.createContext(void 0);function C5(){return A.useContext(w5)}const $2=A.createContext(void 0);function Sv(n){const e=A.useContext($2);if(e===void 0&&!n)throw new Error(ri(21));return e}const k5={...Wb,...Yp,popupSide:n=>n?{"data-popup-side":n}:null,listEmpty:n=>n?{"data-list-empty":""}:null},A5=A.forwardRef(function(e,t){const{render:i,className:r,disabled:o=!1,id:a,...u}=e,{state:f,disabled:d,setTouched:p,setFocused:g,validationMode:b,validation:v}=oo(),{labelId:S}=Vc(),w=C5(),k=!!Sv(!0),R=co(),{filteredItems:N}=pa(),T=Y2(),B=Hp(a),L=z2(),D=ge(R,Ve.disabled),j=ge(R,Ve.readOnly),X=ge(R,Ve.name),J=ge(R,Ve.selectionMode),V=ge(R,Ve.autoHighlight),K=ge(R,Ve.inputProps),ae=ge(R,Ve.triggerProps),$=ge(R,Ve.open),H=ge(R,Ve.mounted),z=ge(R,Ve.selectedValue),Q=ge(R,Ve.popupSide),F=ge(R,Ve.positionerElement),ee=!!V,G=H&&F?Q:null,M=d||D||o,U=N.length===0,[te,le]=A.useState(null),ne=A.useRef(!1),se=He(fe=>{const ie=k||R.state.inline;ie&&!R.state.hasInputValue&&R.state.setInputValue("",tt(Oi)),R.update({inputElement:fe,inputInsidePopup:ie})}),he=A.useMemo(()=>({...f,open:$,disabled:M,readOnly:j,popupSide:G,listEmpty:U}),[f,$,M,j,G,U]);function pe(fe){if(!w)return;let ie;const{highlightedChipIndex:ye}=w;if(ye!==void 0){if(fe.key==="ArrowLeft")fe.preventDefault(),ye>0?ie=ye-1:ie=void 0;else if(fe.key==="ArrowRight")fe.preventDefault(),ye<z.length-1?ie=ye+1:ie=void 0;else if(fe.key==="Backspace"||fe.key==="Delete"){fe.preventDefault();const ve=ye>=z.length-1?z.length-2:ye;ie=ve>=0?ve:void 0,R.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return ie}return fe.key==="ArrowLeft"&&(fe.currentTarget.selectionStart??0)===0&&z.length>0?(fe.preventDefault(),ie=Math.max(z.length-1,0)):fe.key==="Backspace"&&fe.currentTarget.value===""&&z.length>0&&(R.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),fe.preventDefault()),ie}return wn("input",e,{state:he,ref:[t,R.state.inputRef,se],props:[K,ae,{type:"text",value:e.value??te??T,"aria-readonly":j||void 0,"aria-labelledby":S,disabled:M,readOnly:j,...J==="none"&&X&&{name:X},id:B,onFocus(){g(!0)},onBlur(){if(p(!0),g(!1),b==="onBlur"){const fe=J==="none"?T:z;v.commit(fe)}},onCompositionStart(fe){Zd||(ne.current=!0,le(fe.currentTarget.value))},onCompositionEnd(fe){ne.current=!1;const ie=fe.currentTarget.value;le(null),R.state.setInputValue(ie,tt(Vo,fe.nativeEvent))},onChange(fe){if(ne.current){const Qe=fe.currentTarget.value;le(Qe),Qe===""&&!R.state.openOnInputClick&&!R.state.inputInsidePopup&&R.state.setOpen(!1,tt(Ol,fe.nativeEvent));const Re=Qe.trim(),me=ee&&Re!=="";!j&&!M&&Re!==""&&(R.state.setOpen(!0,tt(Vo,fe.nativeEvent)),ee||R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"})),$&&R.state.activeIndex!==null&&!me&&R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"});return}R.state.setInputValue(fe.currentTarget.value,tt(Vo,fe.nativeEvent));const ie=fe.currentTarget.value==="",ye=tt(Ol,fe.nativeEvent);ie&&!R.state.inputInsidePopup&&(J==="single"&&R.state.setSelectedValue(null,ye),R.state.openOnInputClick||R.state.setOpen(!1,ye));const ve=fe.currentTarget.value.trim();!j&&!M&&ve!==""&&(R.state.setOpen(!0,tt(Vo,fe.nativeEvent)),ee||R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"})),$&&R.state.activeIndex!==null&&!ee&&R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(fe){var Re,me;if(M||j||fe.ctrlKey||fe.shiftKey||fe.altKey||fe.metaKey)return;R.state.keyboardActiveRef.current=!0;const ie=fe.currentTarget,ye=ie.scrollWidth-ie.clientWidth,ve=L==="rtl";if(fe.key==="Home"){bn(fe);const ke=dC&&ve?ie.value.length:0;ie.setSelectionRange(ke,ke),ie.scrollLeft=0;return}if(fe.key==="End"){bn(fe);const ke=dC&&ve?0:ie.value.length;ie.setSelectionRange(ke,ke),ie.scrollLeft=ve?-ye:ye;return}if(!H&&fe.key==="Escape"){const ke=J==="multiple"&&Array.isArray(z)?z.length===0:z===null,be=tt(jE,fe.nativeEvent),De=J==="multiple"?[]:null;R.state.setInputValue("",be),R.state.setSelectedValue(De,be),!ke&&!R.state.inline&&!be.isPropagationAllowed&&fe.stopPropagation();return}if(w&&fe.key==="Backspace"&&ie.value===""&&w.highlightedChipIndex===void 0&&Array.isArray(z)&&z.length>0){const ke=z.slice(0,-1);R.state.setIndices({activeIndex:null,selectedIndex:null,type:R.state.keyboardActiveRef.current?"keyboard":"pointer"}),R.state.setSelectedValue(ke,tt(Oi,fe.nativeEvent));return}const Qe=pe(fe);if(w==null||w.setHighlightedChipIndex(Qe),Qe!==void 0?(Re=w==null?void 0:w.chipsRef.current[Qe])==null||Re.focus():(me=R.state.inputRef.current)==null||me.focus(),fe.which!==229&&fe.key==="Enter"&&$){const ke=R.state.activeIndex,be=fe.nativeEvent;if(ke===null){R.state.setOpen(!1,tt(Oi,be));return}bn(fe);const De=R.state.listRef.current[ke];De&&(R.state.selectionEventRef.current=be,De.click(),R.state.selectionEventRef.current=null)}},onPointerMove(){R.state.keyboardActiveRef.current=!1},onPointerDown(){R.state.keyboardActiveRef.current=!1}},v?v.getValidationProps(u):u],stateAttributesMapping:k5})}),bd=2,E5={...Wb,...Yp},R5=A.forwardRef(function(e,t){const{render:i,className:r,nativeButton:o=!0,disabled:a=!1,...u}=e,{state:f,disabled:d,setTouched:p,setFocused:g,validationMode:b,validation:v}=oo(),{labelId:S}=Vc(),w=co(),E=ge(w,Ve.selectionMode),k=ge(w,Ve.disabled),R=ge(w,Ve.readOnly),N=ge(w,Ve.listElement),T=ge(w,Ve.triggerProps),B=ge(w,Ve.triggerElement),L=ge(w,Ve.inputInsidePopup),D=ge(w,Ve.open),j=ge(w,Ve.selectedValue),X=ge(w,Ve.activeIndex),J=ge(w,Ve.selectedIndex),V=Xp(),K=Y2(),ae=$i(),$=d||k||a,H=A.useRef("");function z(ne){H.current=ne.pointerType}const Q=V.select("domReferenceElement");A.useEffect(()=>{L&&B&&B!==Q&&V.set("domReferenceElement",B)},[B,Q,V,L]);const{reference:F}=p2(V,{enabled:!D&&!R&&!k&&E==="single",listRef:w.state.labelsRef,activeIndex:X,selectedIndex:J,onMatch(ne){const se=w.state.valuesRef.current[ne];se!==void 0&&w.state.setSelectedValue(se,tt("none"))}}),{reference:ee}=lv(V,{enabled:!R&&!k,event:"mousedown"}),{buttonRef:G,getButtonProps:M}=Df({native:o,disabled:$}),U=A.useMemo(()=>({...f,open:D,disabled:$}),[f,D,$]),te=He(ne=>{w.set("triggerElement",ne)});return wn("button",e,{ref:[t,G,te],state:U,props:[T,ee,F,{tabIndex:L?0:-1,disabled:$,role:L?"combobox":void 0,"aria-expanded":D?"true":"false","aria-haspopup":L?"dialog":"listbox","aria-controls":D?N==null?void 0:N.id:void 0,"aria-readonly":R||void 0,"aria-labelledby":S,onPointerDown:z,onPointerEnter:z,onFocus(){g(!0),!($||R)&&ae.start(0,w.state.forceMount)},onBlur(){if(p(!0),g(!1),b==="onBlur"){const ne=E==="none"?K:j;v.commit(ne)}},onMouseDown(ne){var pe;if($||R||(L||V.set("domReferenceElement",ne.currentTarget),w.state.forceMount(),H.current!=="touch"&&((pe=w.state.inputRef.current)==null||pe.focus(),L||ne.preventDefault()),D))return;const se=Fr(ne.currentTarget);function he(xe){if(!B)return;const fe=ni(xe),ie=w.state.positionerElement,ye=w.state.listElement;if(Dt(B,fe)||Dt(ie,fe)||Dt(ye,fe)||fe===B)return;const ve=j2(B),Qe=xe.clientX>=ve.left-bd&&xe.clientX<=ve.right+bd,Re=xe.clientY>=ve.top-bd&&xe.clientY<=ve.bottom+bd;Qe&&Re||w.state.setOpen(!1,tt("cancel-open",xe))}L&&se.addEventListener("mouseup",he,{once:!0})},onKeyDown(ne){var se;$||R||(ne.key==="ArrowDown"||ne.key==="ArrowUp")&&(bn(ne),w.state.setOpen(!0,tt(Pd,ne.nativeEvent)),(se=w.state.inputRef.current)==null||se.focus())}},v?v.getValidationProps(u):u,M],stateAttributesMapping:E5})}),T5=A.createContext(null);function O5(){return A.useContext(T5)}function M5(n){const{children:e}=n,{filteredItems:t}=pa(),i=O5(),r=i?i.items:t;return r?x.jsx(A.Fragment,{children:r.map(e)}):null}const N5=A.forwardRef(function(e,t){var i;const{render:r,className:o,children:a,...u}=e,f=co(),d=Xp(),p=!!Sv(!0),{filteredItems:g}=pa(),b=ge(f,Ve.items),v=ge(f,Ve.labelsRef),S=ge(f,Ve.listRef),w=ge(f,Ve.selectionMode),E=ge(f,Ve.grid),k=ge(f,Ve.popupProps),R=ge(f,Ve.disabled),N=ge(f,Ve.readOnly),T=ge(f,Ve.virtualized),B=w==="multiple",L=g.length===0,D=He(ae=>{f.set("positionerElement",ae)}),j=He(ae=>{f.set("listElement",ae)}),X=A.useMemo(()=>typeof a=="function"?i||(i=x.jsx(M5,{children:a})):a,[a]),J=A.useMemo(()=>({empty:L}),[L]),V=d.useState("floatingId"),K=wn("div",e,{state:J,ref:[t,j,p?null:D],props:[k,{children:X,tabIndex:-1,id:V,role:E?"grid":"listbox","aria-multiselectable":B?"true":void 0,onKeyDown(ae){if(!(R||N)&&ae.key==="Enter"){const $=f.state.activeIndex;if($==null)return;bn(ae);const H=ae.nativeEvent,z=f.state.listRef.current[$];z&&(f.state.selectionEventRef.current=H,z.click(),f.state.selectionEventRef.current=null)}},onKeyDownCapture(){f.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){f.state.keyboardActiveRef.current=!1}},u]});return T?K:x.jsx(L2,{elementsRef:S,labelsRef:b?void 0:v,children:K})}),Z2=A.createContext(void 0);function D5(){const n=A.useContext(Z2);if(n===void 0)throw new Error(ri(20));return n}const j5=A.forwardRef(function(e,t){const{keepMounted:i=!1,...r}=e,o=co(),a=ge(o,Ve.mounted),u=ge(o,Ve.forceMounted);return a||i||u?x.jsx(Z2.Provider,{value:i,children:x.jsx(iv,{ref:t,...r})}):null}),B5=A.forwardRef(function(e,t){const{render:i,className:r,anchor:o,positionMethod:a="absolute",side:u="bottom",align:f="center",sideOffset:d=0,alignOffset:p=0,collisionBoundary:g="clipping-ancestors",collisionPadding:b=5,arrowPadding:v=5,sticky:S=!1,disableAnchorTracking:w=!1,collisionAvoidance:E=ME,...k}=e,R=co(),{filteredItems:N}=pa(),T=Xp(),B=D5(),L=ge(R,Ve.modal),D=ge(R,Ve.open),j=ge(R,Ve.mounted),X=ge(R,Ve.openMethod),J=ge(R,Ve.triggerElement),V=ge(R,Ve.inputElement),K=ge(R,Ve.inputInsidePopup),ae=N.length===0,H=P2({anchor:o??(K?J:V),floatingRootContext:T,positionMethod:a,mounted:j,side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:v,collisionBoundary:g,collisionPadding:b,sticky:S,disableAnchorTracking:w,keepMounted:B,collisionAvoidance:E,lazyFlip:!0});mv(D&&L&&X!=="touch",J);const z=A.useMemo(()=>{const M={...H.positionerStyles};return D||(M.pointerEvents="none"),{role:"presentation",hidden:!j,style:M}},[D,j,H.positionerStyles]),Q=A.useMemo(()=>({open:D,side:H.side,align:H.align,anchorHidden:H.anchorHidden,empty:ae}),[D,H.side,H.align,H.anchorHidden,ae]);ze(()=>{R.set("popupSide",H.side)},[R,H.side]);const F=A.useMemo(()=>({side:H.side,align:H.align,arrowRef:H.arrowRef,arrowUncentered:H.arrowUncentered,arrowStyles:H.arrowStyles,anchorHidden:H.anchorHidden,isPositioned:H.isPositioned}),[H.side,H.align,H.arrowRef,H.arrowUncentered,H.arrowStyles,H.anchorHidden,H.isPositioned]),ee=He(M=>{R.set("positionerElement",M)}),G=wn("div",e,{state:Q,ref:[t,ee],props:[z,k],stateAttributesMapping:Pc});return x.jsxs($2.Provider,{value:F,children:[j&&L&&x.jsx(pv,{inert:dv(!D),cutout:V??J}),G]})}),L5={...Pc,...Nf},z5=A.forwardRef(function(e,t){const{render:i,className:r,initialFocus:o,finalFocus:a,...u}=e,f=co(),d=Sv(),p=Xp(),{filteredItems:g}=pa(),b=ge(f,Ve.mounted),v=ge(f,Ve.open),S=ge(f,Ve.openMethod),w=ge(f,Ve.transitionStatus),E=ge(f,Ve.inputInsidePopup),k=ge(f,Ve.inputElement),R=g.length===0;da({open:v,ref:f.state.popupRef,onComplete(){v&&f.state.onOpenChangeComplete(!0)}});const N=A.useMemo(()=>({open:v,side:d.side,align:d.align,anchorHidden:d.anchorHidden,transitionStatus:w,empty:R}),[v,d.side,d.align,d.anchorHidden,w,R]),T=wn("div",e,{state:N,ref:[t,f.state.popupRef],props:[{role:E?"dialog":"presentation",tabIndex:-1,onFocus(j){var J;const X=ni(j.nativeEvent);S!=="touch"&&(Dt(f.state.listElement,X)||X===j.currentTarget)&&((J=f.state.inputRef.current)==null||J.focus())}},_2(w),u],stateAttributesMapping:L5}),L=o===void 0?E?j=>j==="touch"?f.state.popupRef.current:k:!1:o;let D;return a!=null?D=a:D=E?void 0:!1,x.jsx(rv,{context:p,disabled:!b,modal:!E,openInteractionType:S,initialFocus:L,returnFocus:D,children:T})}),I5=A.createContext(void 0),P5=A.createContext(!1);function H5(){return A.useContext(P5)}const V5=A.memo(A.forwardRef(function(e,t){const{render:i,className:r,value:o=null,index:a,disabled:u=!1,nativeButton:f=!1,...d}=e,p=A.useRef(!1),g=A.useRef(null),b=U2({index:a,textRef:g,indexGuessBehavior:vv.GuessFromOrder}),v=co(),S=H5(),{flatFilteredItems:w}=pa(),E=ge(v,Ve.open),k=ge(v,Ve.selectionMode),R=ge(v,Ve.readOnly),N=ge(v,Ve.virtualized),T=ge(v,Ve.isItemEqualToValue),B=k!=="none",L=a??(N?Oc(w,o,T):b.index),D=b.index!==-1,j=ge(v,Ve.id),X=ge(v,Ve.isActive,L),J=ge(v,Ve.isSelected,o),V=ge(v,Ve.items),K=ge(v,Ve.getItemProps),ae=A.useRef(null),$=j!=null&&D?`${j}-${L}`:void 0,H=J&&B;ze(()=>{if(!(D&&(N||a!=null)))return;const ne=v.state.listRef.current;return ne[L]=ae.current,()=>{delete ne[L]}},[D,N,L,a,v]),ze(()=>{if(!D||V)return;const le=v.state.valuesRef.current;return le[L]=o,k!=="none"&&v.state.allValuesRef.current.push(o),()=>{delete le[L]}},[D,V,L,o,v,k]),ze(()=>{if(!E){p.current=!1;return}if(!D||V)return;const le=v.state.selectedValue,ne=Array.isArray(le)?le[le.length-1]:le;Qr(ne,o,T)&&v.set("selectedIndex",L)},[D,V,E,v,L,o,T]);const z=A.useMemo(()=>({disabled:u,selected:H,highlighted:X}),[u,H,X]),Q=K({active:X,selected:H});Q.id=void 0,Q.onFocus=void 0;const{getButtonProps:F,buttonRef:ee}=Df({disabled:u,focusableWhenDisabled:!0,native:f});function G(le){function ne(){v.state.handleSelection(le,o)}v.state.submitOnItemClick?(Gr.flushSync(ne),v.state.requestSubmit()):ne()}const M={id:$,role:S?"gridcell":"option","aria-disabled":u||void 0,"aria-selected":B?H:void 0,tabIndex:void 0,onPointerDownCapture(le){p.current=!0,le.preventDefault()},onClick(le){u||R||G(le.nativeEvent)},onMouseUp(le){const ne=p.current;p.current=!1,!(u||R||le.button!==0||ne||!X)&&G(le.nativeEvent)}},U=wn("div",e,{ref:[ee,t,b.ref,ae],state:z,props:[Q,M,d,F]}),te=A.useMemo(()=>({selected:H,textRef:g}),[H,g]);return x.jsx(I5.Provider,{value:te,children:U})})),_5=A.forwardRef(function(e,t){const{render:i,className:r,children:o,...a}=e,{filteredItems:u}=pa(),f=co(),d=u.length===0?o:null;return wn("div",e,{ref:[t,f.state.emptyRef],props:[{children:d,role:"status","aria-live":"polite","aria-atomic":!0},a]})});function U5({checked:n,onCheckedChange:e,disabled:t,"aria-label":i}){return x.jsx(Iz,{checked:n,onCheckedChange:r=>e(r),disabled:t,"aria-label":i,className:jt("relative inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border border-transparent outline-none transition-colors","bg-input data-[checked]:bg-success","focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background","disabled:cursor-not-allowed disabled:opacity-50"),children:x.jsx(Pz,{className:"size-4 translate-x-0.5 rounded-full bg-background shadow-sm transition-transform data-[checked]:translate-x-[18px]"})})}function wv({value:n,onValueChange:e,options:t,placeholder:i="Select…",disabled:r,className:o,"aria-label":a}){return x.jsxs(_z,{items:t,value:n,onValueChange:u=>e(u),disabled:r,children:[x.jsxs(qz,{"aria-label":a,className:jt("inline-flex h-9 min-w-0 items-center justify-between gap-2 rounded-md border border-input bg-secondary/40 px-3 text-[13px] text-foreground outline-none transition-colors","hover:bg-secondary/70 focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50 data-[popup-open]:border-ring",o),children:[x.jsx(Gz,{className:"truncate",children:u=>{const f=t.find(d=>d.value===u);return f?f.label:x.jsx("span",{className:"text-muted-foreground",children:i})}}),x.jsx(Qz,{children:x.jsx(lE,{className:"size-3.5 shrink-0 text-muted-foreground"})})]}),x.jsx(Yz,{container:gv(),children:x.jsx(o5,{sideOffset:6,className:"z-50 outline-none",alignItemWithTrigger:!1,children:x.jsx(f5,{className:jt("max-h-[min(20rem,var(--available-height))] min-w-[var(--anchor-width)] overflow-y-auto rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-xl outline-none","origin-[var(--transform-origin)] transition-[transform,opacity] data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0"),children:t.map(u=>x.jsxs(h5,{value:u.value,className:jt("flex cursor-pointer select-none items-start gap-2 rounded-md py-1.5 pl-2 pr-2 text-[13px] outline-none","data-[highlighted]:bg-accent/15 data-[highlighted]:text-foreground"),children:[x.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center pt-0.5",children:x.jsx(d5,{children:x.jsx(rE,{className:"size-3.5 text-accent"})})}),x.jsxs("span",{className:"flex flex-col",children:[x.jsx(m5,{children:u.label}),u.description?x.jsx("span",{className:"text-xs text-muted-foreground",children:u.description}):null]})]},u.value))})})})]})}function q5({value:n,options:e,onSelect:t,onCreate:i,placeholder:r="Select…",createLabel:o=d=>`Create "${d}"`,disabled:a,className:u,"aria-label":f}){const[d,p]=A.useState(""),g=d.trim(),b=g.toLowerCase(),v=e.map(k=>({value:k,label:k})),S=g?v.filter(k=>k.label.toLowerCase().includes(b)):v,w=e.some(k=>k.toLowerCase()===b),E=g&&!w?[...S,{value:"\0create",label:o(g),create:!0}]:S;return x.jsxs(S5,{items:E,filter:null,inputValue:d,onInputValueChange:p,onOpenChange:k=>{k||p("")},onValueChange:k=>{k&&(k.create?i(g):t(k.value),p(""))},itemToStringLabel:k=>k.label,disabled:a,children:[x.jsxs(R5,{"aria-label":f,className:jt("inline-flex h-9 min-w-0 items-center justify-between gap-2 rounded-md border border-input bg-secondary/40 px-3 text-[13px] text-foreground outline-none transition-colors","hover:bg-secondary/70 focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50 data-[popup-open]:border-ring",u),children:[x.jsx("span",{className:jt("truncate",!n&&"text-muted-foreground"),children:n||r}),x.jsx(lE,{className:"size-3.5 shrink-0 text-muted-foreground"})]}),x.jsx(j5,{container:gv(),children:x.jsx(B5,{sideOffset:6,className:"z-50 outline-none",children:x.jsxs(z5,{className:jt("w-[max(var(--anchor-width),13rem)] overflow-hidden rounded-lg border border-border bg-popover p-1 text-popover-foreground shadow-xl outline-none","origin-[var(--transform-origin)] transition-[transform,opacity] data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[starting-style]:scale-95 data-[starting-style]:opacity-0"),children:[x.jsx(A5,{placeholder:"Search or create…",className:"mb-1 h-8 w-full rounded-md border border-input bg-secondary/40 px-2.5 text-[13px] text-foreground outline-none focus-visible:ring-2 focus-visible:ring-ring"}),x.jsx(_5,{className:"px-2 py-2 text-[13px] text-muted-foreground",children:"No matches."}),x.jsx(N5,{className:"max-h-64 overflow-y-auto",children:k=>x.jsxs(V5,{value:k,className:jt("flex cursor-pointer select-none items-center gap-2 rounded-md py-1.5 pl-2 pr-2 text-[13px] outline-none","data-[highlighted]:bg-accent/15 data-[highlighted]:text-foreground",k.create&&"text-accent"),children:[k.create?x.jsx(Dp,{className:"size-3.5 shrink-0"}):x.jsx("span",{className:"flex w-4 shrink-0 items-center justify-center",children:k.value===n&&x.jsx(rE,{className:"size-3.5 text-accent"})}),x.jsx("span",{className:"truncate",children:k.label})]},k.value)})]})})})]})}const Ms=A.forwardRef(function({className:e,...t},i){return x.jsx("input",{ref:i,className:jt("h-9 w-full rounded-md border border-input bg-secondary/40 px-3 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground","hover:bg-secondary/60 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",e),...t})});A.forwardRef(function({className:e,...t},i){return x.jsx("textarea",{ref:i,className:jt("w-full rounded-md border border-input bg-secondary/40 px-3 py-2 text-[13px] text-foreground outline-none transition-colors placeholder:text-muted-foreground","hover:bg-secondary/60 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring","disabled:cursor-not-allowed disabled:opacity-50",e),...t})});let uf=null;function J2(n){uf=n}function eR(n){uf===n&&(uf=null)}function KC(){return uf?uf():!0}const Tl=(n,e)=>n instanceof Tf?n.body.error:e;function tR({secret:n,testId:e}){return x.jsx("code",{"data-testid":e,className:"block w-full select-all break-all rounded-md border border-border bg-secondary/40 px-3 py-2 font-mono text-[12px] text-foreground",children:n})}function F5({rows:n,onChange:e,readonly:t}){return x.jsxs("div",{className:"flex flex-col gap-2",children:[n.length===0&&x.jsx("p",{className:"text-xs text-muted-foreground",children:"No custom headers. They are merged into every delivery request."}),n.map((i,r)=>x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Ms,{className:"font-mono",placeholder:"X-Header-Name","aria-label":`Header ${r+1} name`,value:i.key,disabled:t,onChange:o=>e(n.map((a,u)=>u===r?{...a,key:o.target.value}:a))}),x.jsx(Ms,{className:"font-mono",placeholder:"value","aria-label":`Header ${r+1} value`,value:i.value,disabled:t,onChange:o=>e(n.map((a,u)=>u===r?{...a,value:o.target.value}:a))}),!t&&x.jsx("button",{onClick:()=>e(n.filter((o,a)=>a!==r)),className:"shrink-0 rounded-md p-1.5 text-muted-foreground/60 hover:bg-destructive/10 hover:text-destructive","aria-label":`Remove header ${i.key||r+1}`,children:x.jsx(Ub,{className:"size-4"})})]},r)),!t&&x.jsx("div",{children:x.jsx(Wt,{size:"sm",variant:"secondary",icon:x.jsx(Dp,{className:"size-3.5"}),onClick:()=>e([...n,{key:"",value:""}]),children:"Add header"})})]})}const Iy=n=>({url:n.url,description:n.description??"",eventTypes:[...n.eventTypes??[]],headers:Object.entries(n.headers??{}).map(([e,t])=>({key:e,value:t}))}),G5=(n,e)=>n.url===e.url&&n.description===e.description&&JSON.stringify([...n.eventTypes].sort())===JSON.stringify([...e.eventTypes].sort())&&JSON.stringify(n.headers)===JSON.stringify(e.headers);function Q5({app:n,endpoint:e,readonly:t,onBack:i,onOpenDelivery:r}){const o=ua(),a=io(),u=()=>a.invalidateQueries({queryKey:["endpoints",n]}),[f,d]=A.useState(()=>Iy(e)),p=A.useMemo(()=>Iy(e),[e]),g=!G5(f,p);A.useEffect(()=>{d(Iy(e))},[e.id]),A.useEffect(()=>{const M=()=>!g||window.confirm("Discard unsaved endpoint changes?");return J2(M),()=>eR(M)},[g]);const v=ji({queryKey:["event-types"],queryFn:qb}).data??[],S=ji({queryKey:["deliveries",n,{endpoint:e.id}],queryFn:()=>Gb(n,{endpoint:e.id,limit:20}),staleTime:5e3}),w=Yi({mutationFn:()=>v3(n,e.id,{url:f.url,description:f.description||void 0,eventTypes:f.eventTypes,headers:Object.fromEntries(f.headers.filter(M=>M.key.trim()!=="").map(M=>[M.key.trim(),M.value]))}),onSuccess:()=>{o.add("success","Endpoint saved"),u()},onError:M=>o.add("error",Tl(M,"Failed to save endpoint"))}),[E,k]=A.useState(null),R=Yi({mutationFn:()=>S3(n,e.id),onSuccess:k,onError:M=>o.add("error",Tl(M,"Failed to reveal the secret"))}),[N,T]=A.useState(!1),B=Yi({mutationFn:()=>w3(n,e.id),onSuccess:M=>{k(M.secrets),T(!1),o.add("success","Secret rotated","The previous secret keeps verifying until grace expiry."),u()},onError:M=>o.add("error",Tl(M,"Failed to rotate the secret"))}),L=Yi({mutationFn:()=>e.disabled?C3(n,e.id):k3(n,e.id),onSuccess:M=>{o.add("success",M.disabled?"Endpoint disabled":"Endpoint enabled"),u()},onError:M=>o.add("error",Tl(M,"Failed to update endpoint"))}),[D,j]=A.useState(""),X=Yi({mutationFn:()=>A3(n,e.id,{eventType:D}),onSuccess:M=>{M.outcome.ok?o.add("success","Example delivered",`HTTP ${M.outcome.httpStatus} in ${Math.round(M.outcome.durationMs)} ms`):o.add("error","Example delivery failed",M.outcome.httpStatus?`HTTP ${M.outcome.httpStatus}`:M.outcome.error??"network error"),a.invalidateQueries({queryKey:["deliveries",n]})},onError:M=>o.add("error",Tl(M,"Failed to send example"))}),[J,V]=A.useState(""),[K,ae]=A.useState(!1),$=Yi({mutationFn:()=>E3(n,e.id,{since:new Date(J).toISOString()}),onSuccess:M=>{ae(!1),o.add("success",`Recovered ${M.deliveryIds.length} deliver${M.deliveryIds.length===1?"y":"ies"}`,"Failed deliveries were re-queued for immediate retry."),a.invalidateQueries({queryKey:["deliveries",n]})},onError:M=>o.add("error",Tl(M,"Failed to recover deliveries"))}),[H,z]=A.useState(!1),[Q,F]=A.useState(""),ee=Yi({mutationFn:()=>x3(n,e.id),onSuccess:()=>{o.add("success","Endpoint deleted"),u(),z(!1),i()},onError:M=>o.add("error",Tl(M,"Failed to delete endpoint"))}),G=S.data??[];return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsxs("button",{onClick:i,className:"mb-4 inline-flex items-center gap-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[x.jsx(Np,{className:"size-3.5"}),"Endpoints"]}),x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx("h1",{className:"break-all font-mono text-xl font-semibold tracking-tight",children:e.url}),e.disabled?x.jsxs(lr,{className:"border-destructive/30 bg-destructive/10 text-destructive",children:["Disabled (",e.disabledReason??"manual",")"]}):x.jsx(lr,{className:"border-success/30 bg-success/10 text-success",children:"Active"}),e.firstFailingAt?x.jsxs(lr,{className:"border-warning/30 bg-warning/10 text-warning",children:["Failing since ",Xn(e.firstFailingAt)]}):null]}),x.jsx("p",{className:"mt-1 font-mono text-xs text-muted-foreground",children:e.id}),x.jsxs("div",{className:"mt-6 flex flex-col gap-5",children:[x.jsx(Es,{title:"Settings",description:"Destination URL, subscriptions, and custom headers.",children:x.jsxs("div",{className:"flex flex-col gap-4",children:[x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"ep-url",className:"text-xs font-medium text-muted-foreground",children:"URL"}),x.jsx(Ms,{id:"ep-url",className:"font-mono",value:f.url,disabled:t,onChange:M=>d({...f,url:M.target.value})})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"ep-desc",className:"text-xs font-medium text-muted-foreground",children:"Description"}),x.jsx(Ms,{id:"ep-desc",placeholder:"What receives these webhooks?",value:f.description,disabled:t,onChange:M=>d({...f,description:M.target.value})})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Subscribed event types"}),x.jsxs("p",{className:"text-xs text-muted-foreground/70",children:["None selected = the endpoint receives ",x.jsx("em",{children:"all"})," event types."]}),v.length===0?x.jsx("p",{className:"text-xs text-muted-foreground",children:"The event-type catalog is empty."}):x.jsx("div",{className:"grid grid-cols-1 gap-1 sm:grid-cols-2",children:v.map(M=>{const U=f.eventTypes.includes(M.name);return x.jsxs("label",{className:jt("flex cursor-pointer items-center gap-2 rounded-md border px-2.5 py-1.5 text-[13px] transition-colors",U?"border-accent/40 bg-accent/10 text-foreground":"border-border bg-secondary/30 text-muted-foreground hover:text-foreground",t&&"cursor-not-allowed opacity-60"),children:[x.jsx("input",{type:"checkbox",className:"accent-[var(--accent)]",checked:U,disabled:t,onChange:te=>d({...f,eventTypes:te.target.checked?[...f.eventTypes,M.name]:f.eventTypes.filter(le=>le!==M.name)})}),x.jsx("span",{className:"truncate font-mono",children:M.name}),M.deprecated?x.jsx("span",{className:"ml-auto text-[10px] uppercase text-warning",children:"deprecated"}):null]},M.name)})})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:"Custom headers"}),x.jsx(F5,{rows:f.headers,onChange:M=>d({...f,headers:M}),readonly:t})]}),!t&&x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Wt,{variant:"primary",disabled:!g,loading:w.isPending,onClick:()=>w.mutate(),children:"Save changes"}),g&&x.jsxs(x.Fragment,{children:[x.jsx(Wt,{variant:"secondary",onClick:()=>d(p),children:"Revert"}),x.jsxs("span",{className:"flex items-center gap-1.5 text-xs font-medium text-warning",children:[x.jsx("span",{className:"size-2 rounded-full bg-warning","aria-hidden":!0}),"Unsaved changes"]})]})]})]})}),x.jsx(Es,{title:"Signing secret",description:"Standard Webhooks whsec_ secret used to sign every delivery.",children:x.jsxs("div",{className:"flex flex-col gap-3",children:[E===null?x.jsx("div",{children:x.jsx(Wt,{variant:"secondary",loading:R.isPending,onClick:()=>R.mutate(),children:"Reveal secret"})}):x.jsx("div",{className:"flex flex-col gap-2",children:E.map((M,U)=>x.jsxs("div",{className:"flex flex-col gap-1",children:[x.jsx(tR,{secret:M.secret,testId:U===0?"current-secret":void 0}),x.jsx("p",{className:"text-xs text-muted-foreground",children:U===0?`Current — created ${Xn(M.createdAt)}`:`Previous — still verifying until ${Xn(M.expiresAt)}`})]},M.secret))}),!t&&x.jsx("div",{children:x.jsx(Wt,{variant:"secondary",icon:x.jsx($D,{className:"size-3.5"}),onClick:()=>T(!0),children:"Rotate secret"})})]})}),!t&&x.jsx(Es,{title:"Send example",description:"Fire a one-off signed test delivery through the real wire path.",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx(wv,{"aria-label":"Example event type",value:D,onValueChange:j,options:v.map(M=>({value:M.name,label:M.name})),placeholder:"Choose event type…",className:"w-64"}),x.jsx(Wt,{variant:"secondary",icon:x.jsx(t3,{className:"size-3.5"}),disabled:!D,loading:X.isPending,onClick:()=>X.mutate(),children:"Send example"})]})}),!t&&x.jsx(Es,{title:"Recover",description:"Re-queue every dead-lettered delivery for this endpoint created at or after a point in time.",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx("input",{type:"datetime-local","aria-label":"Recover since",value:J,onChange:M=>V(M.target.value),className:"h-9 rounded-md border border-input bg-secondary/40 px-3 text-[13px] text-foreground outline-none hover:bg-secondary/60 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring"}),x.jsx(Wt,{variant:"secondary",disabled:!J,onClick:()=>ae(!0),children:"Recover"})]})}),x.jsx(Es,{title:"Recent deliveries",description:"The latest deliveries to this endpoint.",children:S.isLoading?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Loading deliveries…"}):G.length===0?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No deliveries yet."}):x.jsx("ul",{className:"divide-y divide-border",children:G.map(M=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>r(M.id),className:"group flex w-full items-center gap-3 py-2.5 text-left",children:[x.jsx(If,{status:M.status}),x.jsx(Tc,{className:"min-w-0 flex-1 truncate",children:M.id}),x.jsxs("span",{className:"text-xs text-muted-foreground",children:[M.attemptCount," attempt",M.attemptCount===1?"":"s"]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(M.updatedAt),children:Of(M.updatedAt)}),x.jsx(aa,{className:"size-4 text-muted-foreground/50 group-hover:text-muted-foreground"})]})},M.id))})}),!t&&x.jsx(Es,{title:"Danger zone",children:x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx(Wt,{variant:"secondary",loading:L.isPending,onClick:()=>L.mutate(),children:e.disabled?"Enable endpoint":"Disable endpoint"}),x.jsx(Wt,{variant:"danger",icon:x.jsx(Ub,{className:"size-3.5"}),onClick:()=>{F(""),z(!0)},children:"Delete endpoint"})]})})]}),x.jsx(_d,{open:N,onClose:()=>T(!1),onConfirm:()=>B.mutate(),title:"Rotate signing secret",confirmLabel:"Rotate secret",loading:B.isPending,children:x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"A new signing secret is minted immediately. The current secret keeps verifying until its grace window expires (default 24 hours), and deliveries carry both signatures during grace — receivers can migrate without dropping webhooks."})}),x.jsx(_d,{open:K,onClose:()=>ae(!1),onConfirm:()=>$.mutate(),title:"Recover failed deliveries",confirmLabel:"Recover deliveries",loading:$.isPending,children:x.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["Every dead-lettered delivery for this endpoint created at or after"," ",x.jsx("span",{className:"font-mono text-foreground",children:J?Xn(new Date(J).toISOString()):"—"})," ","is re-queued for immediate retry."]})}),x.jsxs(_d,{open:H,onClose:()=>z(!1),onConfirm:()=>ee.mutate(),title:"Delete endpoint",confirmLabel:"Delete permanently",danger:!0,loading:ee.isPending,confirmDisabled:Q!==e.id,children:[x.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["This permanently removes the endpoint and stops all deliveries to"," ",x.jsx("code",{className:"break-all font-mono text-foreground",children:e.url}),". Pending deliveries for it become terminal. This can't be undone."]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("label",{htmlFor:"ep-delete-confirm",className:"text-xs font-medium text-muted-foreground",children:["Type ",x.jsx("code",{className:"font-mono text-foreground",children:e.id})," to confirm"]}),x.jsx(Ms,{id:"ep-delete-confirm",className:"font-mono",value:Q,onChange:M=>F(M.target.value),autoFocus:!0})]})]})]})}function YC({app:n,readonly:e,selectedId:t,onOpen:i,onBack:r,onOpenDelivery:o}){const a=ua(),u=io(),f=ji({queryKey:["endpoints",n],queryFn:()=>Fb(n),staleTime:1e4,enabled:n!==""}),[d,p]=A.useState(!1),[g,b]=A.useState(""),[v,S]=A.useState(""),[w,E]=A.useState(null),k=Yi({mutationFn:()=>b3(n,{url:g,description:v||void 0}),onSuccess:T=>{var B;u.invalidateQueries({queryKey:["endpoints",n]}),p(!1),b(""),S(""),E({id:T.id,secret:((B=T.secrets[0])==null?void 0:B.secret)??""})},onError:T=>a.add("error",Tl(T,"Failed to create endpoint"))});if(!n)return x.jsx(Kp,{});const R=f.data??[],N=t?R.find(T=>T.id===t):void 0;return N?x.jsx(Q5,{app:n,endpoint:N,readonly:e,onBack:r,onOpenDelivery:o}):t&&f.isLoading?x.jsx(Ns,{label:"Loading endpoint…"}):x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Endpoints",description:`${R.length} endpoint${R.length===1?"":"s"} receiving webhooks for this application.`,actions:e?void 0:x.jsx(Wt,{variant:"primary",icon:x.jsx(Dp,{className:"size-4"}),onClick:()=>p(!0),children:"New endpoint"})}),f.isLoading?x.jsx(Ns,{label:"Loading endpoints…"}):f.isError?x.jsx(Li,{children:"Failed to load endpoints."}):R.length===0?x.jsx(Li,{children:"No endpoints yet. Register a customer URL to start delivering webhooks."}):x.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:R.map(T=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>i(T.id),className:"group flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-secondary/30",children:[x.jsx("span",{className:jt("size-2 shrink-0 rounded-full",T.disabled?"bg-muted-foreground/40":"bg-success"),"aria-hidden":!0}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"truncate font-mono text-[13px] font-medium text-foreground",children:T.url}),T.disabled&&x.jsxs(lr,{className:"border-destructive/30 bg-destructive/10 text-destructive",children:["Disabled (",T.disabledReason??"manual",")"]}),T.firstFailingAt&&!T.disabled&&x.jsx(lr,{className:"border-warning/30 bg-warning/10 text-warning",children:"Failing"})]}),x.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[x.jsx("span",{className:"font-mono",children:T.id}),T.description?` · ${T.description}`:"",T.firstFailingAt?` · failing since ${Xn(T.firstFailingAt)}`:""]})]}),x.jsxs("div",{className:"hidden items-center gap-1.5 lg:flex",children:[(T.eventTypes??[]).length===0?x.jsx(lr,{children:"All events"}):(T.eventTypes??[]).slice(0,3).map(B=>x.jsx("span",{className:"rounded-md bg-secondary/60 px-1.5 py-0.5 font-mono text-[11px] text-muted-foreground",children:B},B)),(T.eventTypes??[]).length>3&&x.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["+",(T.eventTypes??[]).length-3]})]}),x.jsx(aa,{className:"size-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},T.id))})}),x.jsxs(up,{open:d,onClose:()=>p(!1),title:"New endpoint",footer:x.jsxs(x.Fragment,{children:[x.jsx(Wt,{variant:"secondary",onClick:()=>p(!1),children:"Cancel"}),x.jsx(Wt,{variant:"primary",disabled:!g.trim(),loading:k.isPending,onClick:()=>k.mutate(),children:"Create endpoint"})]}),children:[x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Register a URL to receive signed webhook deliveries. A signing secret is minted on creation and shown once."}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"new-ep-url",className:"text-xs font-medium text-muted-foreground",children:"URL"}),x.jsx(Ms,{id:"new-ep-url",className:"font-mono",placeholder:"https://example.com/webhooks",value:g,onChange:T=>b(T.target.value),autoFocus:!0})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"new-ep-desc",className:"text-xs font-medium text-muted-foreground",children:"Description (optional)"}),x.jsx(Ms,{id:"new-ep-desc",placeholder:"What receives these webhooks?",value:v,onChange:T=>S(T.target.value)})]})]}),x.jsxs(up,{open:w!==null,onClose:()=>{const T=w==null?void 0:w.id;E(null),T&&i(T)},title:"Endpoint created",footer:x.jsx(Wt,{variant:"primary",onClick:()=>{const T=w==null?void 0:w.id;E(null),T&&i(T)},children:"I saved the secret"}),children:[x.jsx("p",{className:"text-[13px] text-muted-foreground",children:`This is the endpoint's signing secret. Hand it to the receiver team now — it is shown only this once (afterwards it is only reachable via "Reveal secret").`}),x.jsx(tR,{secret:(w==null?void 0:w.secret)??"",testId:"endpoint-secret"})]})]})}let U0=[],nR=[];(()=>{let n="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,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?nR:U0).push(t=t+n[e])})();function K5(n){if(n<768)return!1;for(let e=0,t=U0.length;;){let i=e+t>>1;if(n<U0[i])t=i;else if(n>=nR[i])e=i+1;else return!0;if(e==t)return!1}}function WC(n){return n>=127462&&n<=127487}const XC=8205;function Y5(n,e,t=!0,i=!0){return(t?iR:W5)(n,e,i)}function iR(n,e,t){if(e==n.length)return e;e&&sR(n.charCodeAt(e))&&rR(n.charCodeAt(e-1))&&e--;let i=Py(n,e);for(e+=$C(i);e<n.length;){let r=Py(n,e);if(i==XC||r==XC||t&&K5(r))e+=$C(r),i=r;else if(WC(r)){let o=0,a=e-2;for(;a>=0&&WC(Py(n,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function W5(n,e,t){for(;e>1;){let i=iR(n,e-2,t);if(i<e)return i;e--}return 0}function Py(n,e){let t=n.charCodeAt(e);if(!rR(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return sR(i)?(t-55296<<10)+(i-56320)+65536:t}function sR(n){return n>=56320&&n<57344}function rR(n){return n>=55296&&n<56320}function $C(n){return n<65536?1:2}class kt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Mc(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),Js.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Mc(this,e,t);let i=[];return this.decompose(e,t,i,0),Js.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new Ju(this),o=new Ju(e);for(let a=t,u=t;;){if(r.next(a),o.next(a),a=0,r.lineBreak!=o.lineBreak||r.done!=o.done||r.value!=o.value)return!1;if(u+=r.value.length,r.done||u>=i)return!0}}iter(e=1){return new Ju(this,e)}iterRange(e,t=this.length){return new lR(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new oR(i)}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]?kt.empty:e.length<=32?new yn(e):Js.from(yn.split(e,[]))}}class yn extends kt{constructor(e,t=X5(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let o=0;;o++){let a=this.text[o],u=r+a.length;if((t?i:u)>=e)return new $5(r,u,i,a);r=u+1,i++}}decompose(e,t,i,r){let o=e<=0&&t>=this.length?this:new yn(ZC(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let a=i.pop(),u=Ud(o.text,a.text.slice(),0,o.length);if(u.length<=32)i.push(new yn(u,a.length+o.length));else{let f=u.length>>1;i.push(new yn(u.slice(0,f)),new yn(u.slice(f)))}}else i.push(o)}replace(e,t,i){if(!(i instanceof yn))return super.replace(e,t,i);[e,t]=Mc(this,e,t);let r=Ud(this.text,Ud(i.text,ZC(this.text,0,e)),t),o=this.length+i.length-(t-e);return r.length<=32?new yn(r,o):Js.from(yn.split(r,[]),o)}sliceString(e,t=this.length,i=`
|
|
200
200
|
`){[e,t]=Mc(this,e,t);let r="";for(let o=0,a=0;o<=t&&a<this.text.length;a++){let u=this.text[a],f=o+u.length;o>e&&a&&(r+=i),e<f&&t>o&&(r+=u.slice(Math.max(0,e-o),t-o)),o=f+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let o of e)i.push(o),r+=o.length+1,i.length==32&&(t.push(new yn(i,r)),i=[],r=-1);return r>-1&&t.push(new yn(i,r)),t}}class Js extends kt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let o=0;;o++){let a=this.children[o],u=r+a.length,f=i+a.lines-1;if((t?f:u)>=e)return a.lineInner(e,t,i,r);r=u+1,i=f+1}}decompose(e,t,i,r){for(let o=0,a=0;a<=t&&o<this.children.length;o++){let u=this.children[o],f=a+u.length;if(e<=f&&t>=a){let d=r&((a<=e?1:0)|(f>=t?2:0));a>=e&&f<=t&&!d?i.push(u):u.decompose(e-a,t-a,i,d)}a=f+1}}replace(e,t,i){if([e,t]=Mc(this,e,t),i.lines<this.lines)for(let r=0,o=0;r<this.children.length;r++){let a=this.children[r],u=o+a.length;if(e>=o&&t<=u){let f=a.replace(e-o,t-o,i),d=this.lines-a.lines+f.lines;if(f.lines<d>>4&&f.lines>d>>6){let p=this.children.slice();return p[r]=f,new Js(p,this.length-(t-e)+i.length)}return super.replace(o,u,f)}o=u+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
201
|
-
`){[e,t]=Mc(this,e,t);let r="";for(let o=0,a=0;o<this.children.length&&a<=t;o++){let u=this.children[o],f=a+u.length;a>e&&o&&(r+=i),e<f&&t>a&&(r+=u.sliceString(e-a,t-a,i)),a=f+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Js))return 0;let i=0,[r,o,a,u]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,o+=t){if(r==a||o==u)return i;let f=this.children[r],d=e.children[o];if(f!=d)return i+f.scanIdentical(d,t);i+=f.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let S of e)S.flatten(v);return new yn(v,t)}let r=Math.max(32,i>>5),o=r<<1,a=r>>1,u=[],f=0,d=-1,p=[];function g(v){let S;if(v.lines>o&&v instanceof Js)for(let w of v.children)g(w);else v.lines>a&&(f>a||!f)?(b(),u.push(v)):v instanceof yn&&f&&(S=p[p.length-1])instanceof yn&&v.lines+S.lines<=32?(f+=v.lines,d+=v.length+1,p[p.length-1]=new yn(S.text.concat(v.text),S.length+1+v.length)):(f+v.lines>r&&b(),f+=v.lines,d+=v.length+1,p.push(v))}function b(){f!=0&&(u.push(p.length==1?p[0]:Js.from(p,d)),d=-1,f=p.length=0)}for(let v of e)g(v);return b(),u.length==1?u[0]:new Js(u,t)}}kt.empty=new yn([""],0);function
|
|
202
|
-
`,this;e--}else if(r instanceof yn){let f=r.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,f.length>Math.max(0,e))return this.value=e==0?f:t>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=r.children[a+(t<0?-1:0)];e>f.length?(e-=f.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(f),this.offsets.push(t>0?1:(f instanceof yn?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 rR{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ju(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),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 lR{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(kt.prototype[Symbol.iterator]=function(){return this.iter()},Ju.prototype[Symbol.iterator]=rR.prototype[Symbol.iterator]=lR.prototype[Symbol.iterator]=function(){return this});class W5{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function Mc(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function ii(n,e,t=!0,i=!0){return Q5(n,e,t,i)}function X5(n){return n>=56320&&n<57344}function $5(n){return n>=55296&&n<56320}function Z5(n,e){let t=n.charCodeAt(e);if(!$5(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return X5(i)?(t-55296<<10)+(i-56320)+65536:t}function J5(n){return n<65536?1:2}const q0=/\r\n?|\n/;var Xi=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Xi||(Xi={}));class or{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let o=this.sections[t++],a=this.sections[t++];a<0?(e(i,r,o),r+=o):r+=a,i+=o}}iterChangedRanges(e,t=!1){F0(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new or(e)}composeDesc(e){return this.empty?e:e.empty?this:oR(this,e)}mapDesc(e,t=!1){return e.empty?this:G0(this,e,t)}mapPos(e,t=-1,i=Xi.Simple){let r=0,o=0;for(let a=0;a<this.sections.length;){let u=this.sections[a++],f=this.sections[a++],d=r+u;if(f<0){if(d>e)return o+(e-r);o+=u}else{if(i!=Xi.Simple&&d>=e&&(i==Xi.TrackDel&&r<e&&d>e||i==Xi.TrackBefore&&r<e||i==Xi.TrackAfter&&d>e))return null;if(d>e||d==e&&t<0&&!u)return e==r||t<0?o:o+f;o+=f}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let o=this.sections[i++],a=this.sections[i++],u=r+o;if(a>=0&&r<=t&&u>=e)return r<e&&u>t?"cover":!0;r=u}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new or(e)}static create(e){return new or(e)}}class jn extends or{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return F0(this,(t,i,r,o,a)=>e=e.replace(r,r+(i-t),a),!1),e}mapDesc(e,t=!1){return G0(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,o=0;r<t.length;r+=2){let a=t[r],u=t[r+1];if(u>=0){t[r]=u,t[r+1]=a;let f=r>>1;for(;i.length<f;)i.push(kt.empty);i.push(a?e.slice(o,o+a):kt.empty)}o+=a}return new jn(t,i)}compose(e){return this.empty?e:e.empty?this:oR(this,e,!0)}map(e,t=!1){return e.empty?this:G0(this,e,t,!0)}iterChanges(e,t=!1){F0(this,e,t)}get desc(){return or.create(this.sections)}filter(e){let t=[],i=[],r=[],o=new ff(this);e:for(let a=0,u=0;;){let f=a==e.length?1e9:e[a++];for(;u<f||u==f&&o.len==0;){if(o.done)break e;let p=Math.min(o.len,f-u);ti(r,p,-1);let g=o.ins==-1?-1:o.off==0?o.ins:0;ti(t,p,g),g>0&&Ql(i,t,o.text),o.forward(p),u+=p}let d=e[a++];for(;u<d;){if(o.done)break e;let p=Math.min(o.len,d-u);ti(t,p,-1),ti(r,p,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(p),u+=p}}return{changes:new jn(t,i),filtered:or.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],o=[],a=0,u=null;function f(p=!1){if(!p&&!r.length)return;a<t&&ti(r,t-a,-1);let g=new jn(r,o);u=u?u.compose(g.map(u)):g,r=[],o=[],a=0}function d(p){if(Array.isArray(p))for(let g of p)d(g);else if(p instanceof jn){if(p.length!=t)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${t})`);f(),u=u?u.compose(p.map(u)):p}else{let{from:g,to:b=g,insert:v}=p;if(g>b||g<0||b>t)throw new RangeError(`Invalid change range ${g} to ${b} (in doc of length ${t})`);let S=v?typeof v=="string"?kt.of(v.split(i||q0)):v:kt.empty,w=S.length;if(g==b&&w==0)return;g<a&&f(),g>a&&ti(r,g-a,-1),ti(r,b-g,w),Ql(o,r,S),a=b}}return d(e),f(!u),u}static empty(e){return new jn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let o=e[r];if(typeof o=="number")t.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((a,u)=>u&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;i.length<r;)i.push(kt.empty);i[r]=kt.of(o.slice(1)),t.push(o[0],i[r].length)}}}return new jn(t,i)}static createSet(e,t){return new jn(e,t)}}function ti(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function Ql(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(kt.empty);n.push(t)}}function F0(n,e,t){let i=n.inserted;for(let r=0,o=0,a=0;a<n.sections.length;){let u=n.sections[a++],f=n.sections[a++];if(f<0)r+=u,o+=u;else{let d=r,p=o,g=kt.empty;for(;d+=u,p+=f,f&&i&&(g=g.append(i[a-2>>1])),!(t||a==n.sections.length||n.sections[a+1]<0);)u=n.sections[a++],f=n.sections[a++];e(r,d,o,p,g),r=d,o=p}}}function G0(n,e,t,i=!1){let r=[],o=i?[]:null,a=new ff(n),u=new ff(e);for(let f=-1;;){if(a.done&&u.len||u.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&u.ins==-1){let d=Math.min(a.len,u.len);ti(r,d,-1),a.forward(d),u.forward(d)}else if(u.ins>=0&&(a.ins<0||f==a.i||a.off==0&&(u.len<a.len||u.len==a.len&&!t))){let d=u.len;for(ti(r,u.ins,-1);d;){let p=Math.min(a.len,d);a.ins>=0&&f<a.i&&a.len<=p&&(ti(r,0,a.ins),o&&Ql(o,r,a.text),f=a.i),a.forward(p),d-=p}u.next()}else if(a.ins>=0){let d=0,p=a.len;for(;p;)if(u.ins==-1){let g=Math.min(p,u.len);d+=g,p-=g,u.forward(g)}else if(u.ins==0&&u.len<p)p-=u.len,u.next();else break;ti(r,d,f<a.i?a.ins:0),o&&f<a.i&&Ql(o,r,a.text),f=a.i,a.forward(a.len-p)}else{if(a.done&&u.done)return o?jn.createSet(r,o):or.create(r);throw new Error("Mismatched change set lengths")}}}function oR(n,e,t=!1){let i=[],r=t?[]:null,o=new ff(n),a=new ff(e);for(let u=!1;;){if(o.done&&a.done)return r?jn.createSet(i,r):or.create(i);if(o.ins==0)ti(i,o.len,0,u),o.next();else if(a.len==0&&!a.done)ti(i,0,a.ins,u),r&&Ql(r,i,a.text),a.next();else{if(o.done||a.done)throw new Error("Mismatched change set lengths");{let f=Math.min(o.len2,a.len),d=i.length;if(o.ins==-1){let p=a.ins==-1?-1:a.off?0:a.ins;ti(i,f,p,u),r&&p&&Ql(r,i,a.text)}else a.ins==-1?(ti(i,o.off?0:o.len,f,u),r&&Ql(r,i,o.textBit(f))):(ti(i,o.off?0:o.len,a.off?0:a.ins,u),r&&!a.off&&Ql(r,i,a.text));u=(o.ins>f||a.ins>=0&&a.len>f)&&(u||i.length>d),o.forward2(f),a.forward(f)}}}}class ff{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?kt.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?kt.empty:t[i].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 Bl{constructor(e,t,i,r){this.from=e,this.to=t,this.flags=i,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new Bl(i,r,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return Se.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Se.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Se.range(e.anchor,e.head)}static create(e,t,i,r){return new Bl(e,t,i,r)}}class Se{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Se.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Se([this.main],0)}addRange(e,t=!0){return Se.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,Se.create(i,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 Se(e.ranges.map(t=>Bl.fromJSON(t)),e.main)}static single(e,t=e){return new Se([Se.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let o=e[r];if(o.empty?o.from<=i:o.from<i)return Se.normalized(e.slice(),t);i=o.to}return new Se(e,t)}static cursor(e,t=0,i,r){return Bl.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i)),r)}static range(e,t,i,r,o){let a=r==null?7:Math.min(6,r);return!o&&e!=t&&(o=t<e?1:-1),o&&(a|=o<0?8:16),t<e?Bl.create(t,e,a|32,i):Bl.create(e,t,a,i)}static undirectionalRange(e,t){return Bl.create(e,t,64,void 0)}static normalized(e,t=0){let i=e[t];e.sort((r,o)=>r.from-o.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let o=e[r],a=e[r-1];if(o.empty?o.from<=a.to:o.from<a.to){let u=a.from,f=Math.max(o.to,a.to);r<=t&&t--,e.splice(--r,2,o.anchor>o.head?Se.range(f,u):Se.range(u,f))}}return new Se(e,t)}}function aR(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let wv=0;class We{constructor(e,t,i,r,o){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=wv++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new We(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Cv),!!e.static,e.enables)}of(e){return new qd([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qd(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qd(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Cv(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class qd{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=wv++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,o=this.id,a=e[o]>>1,u=this.type==2,f=!1,d=!1,p=[];for(let g of this.dependencies)g=="doc"?f=!0:g=="selection"?d=!0:(((t=e[g.id])!==null&&t!==void 0?t:1)&1)==0&&p.push(e[g.id]);return{create(g){return g.values[a]=i(g),1},update(g,b){if(f&&b.docChanged||d&&(b.docChanged||b.selection)||Q0(g,p)){let v=i(g);if(u?!ZC(v,g.values[a],r):!r(v,g.values[a]))return g.values[a]=v,1}return 0},reconfigure:(g,b)=>{let v,S=b.config.address[o];if(S!=null){let w=dp(b,S);if(this.dependencies.every(E=>E instanceof We?b.facet(E)===g.facet(E):E instanceof uo?b.field(E,!1)==g.field(E,!1):!0)||(u?ZC(v=i(g),w,r):r(v=i(g),w)))return g.values[a]=w,0}else v=i(g);return g.values[a]=v,1}}}}function ZC(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Q0(n,e){let t=!1;for(let i of e)ef(n,i)&1&&(t=!0);return t}function e6(n,e,t){let i=t.map(f=>n[f.id]),r=t.map(f=>f.type),o=i.filter(f=>!(f&1)),a=n[e.id]>>1;function u(f){let d=[];for(let p=0;p<i.length;p++){let g=dp(f,i[p]);if(r[p]==2)for(let b of g)d.push(b);else d.push(g)}return e.combine(d)}return{create(f){for(let d of i)ef(f,d);return f.values[a]=u(f),1},update(f,d){if(!Q0(f,o))return 0;let p=u(f);return e.compare(p,f.values[a])?0:(f.values[a]=p,1)},reconfigure(f,d){let p=Q0(f,i),g=d.config.facets[e.id],b=d.facet(e);if(g&&!p&&Cv(t,g))return f.values[a]=b,0;let v=u(f);return e.compare(v,b)?(f.values[a]=b,0):(f.values[a]=v,1)}}}const vd=We.define({static:!0});class uo{constructor(e,t,i,r,o){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=o,this.provides=void 0}static define(e){let t=new uo(wv++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(vd).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let o=i.values[t],a=this.updateF(o,r);return this.compareF(o,a)?0:(i.values[t]=a,1)},reconfigure:(i,r)=>{let o=i.facet(vd),a=r.facet(vd),u;return(u=o.find(f=>f.field==this))&&u!=a.find(f=>f.field==this)?(i.values[t]=u.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,vd.of({field:this,create:e})]}get extension(){return this}}const Io={lowest:4,low:3,default:2,high:1,highest:0};function Pu(n){return e=>new cR(e,n)}const kv={highest:Pu(Io.highest),high:Pu(Io.high),default:Pu(Io.default),low:Pu(Io.low),lowest:Pu(Io.lowest)};class cR{constructor(e,t){this.inner=e,this.prec=t}}class Pf{of(e){return new K0(this,e)}reconfigure(e){return Pf.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class K0{constructor(e,t){this.compartment=e,this.inner=t}}class hp{constructor(e,t,i,r,o,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],o=Object.create(null),a=new Map;for(let b of t6(e,t,a))b instanceof uo?r.push(b):(o[b.facet.id]||(o[b.facet.id]=[])).push(b);let u=Object.create(null),f=[],d=[];for(let b of r)u[b.id]=d.length<<1,d.push(v=>b.slot(v));let p=i==null?void 0:i.config.facets;for(let b in o){let v=o[b],S=v[0].facet,w=p&&p[b]||[];if(v.every(E=>E.type==0))if(u[S.id]=f.length<<1|1,Cv(w,v))f.push(i.facet(S));else{let E=S.combine(v.map(k=>k.value));f.push(i&&S.compare(E,i.facet(S))?i.facet(S):E)}else{for(let E of v)E.type==0?(u[E.id]=f.length<<1|1,f.push(E.value)):(u[E.id]=d.length<<1,d.push(k=>E.dynamicSlot(k)));u[S.id]=d.length<<1,d.push(E=>e6(E,S,v))}}let g=d.map(b=>b(u));return new hp(e,a,g,u,f,o)}}function t6(n,e,t){let i=[[],[],[],[],[]],r=new Map;function o(a,u){let f=r.get(a);if(f!=null){if(f<=u)return;let d=i[f].indexOf(a);d>-1&&i[f].splice(d,1),a instanceof K0&&t.delete(a.compartment)}if(r.set(a,u),Array.isArray(a))for(let d of a)o(d,u);else if(a instanceof K0){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;t.set(a.compartment,d),o(d,u)}else if(a instanceof cR)o(a.inner,a.prec);else if(a instanceof uo)i[u].push(a),a.provides&&o(a.provides,u);else if(a instanceof qd)i[u].push(a),a.facet.extensions&&o(a.facet.extensions,Io.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,u)}}return o(n,Io.default),i.reduce((a,u)=>a.concat(u))}function ef(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function dp(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const uR=We.define(),Y0=We.define({combine:n=>n.some(e=>e),static:!0}),fR=We.define({combine:n=>n.length?n[0]:void 0,static:!0}),hR=We.define(),dR=We.define(),pR=We.define(),mR=We.define({combine:n=>n.length?n[0]:!1});class fo{constructor(e,t){this.type=e,this.value=t}static define(){return new n6}}class n6{of(e){return new fo(this,e)}}class i6{constructor(e){this.map=e}of(e){return new vn(this,e)}}class vn{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new vn(this.type,t)}is(e){return this.type==e}static define(e={}){return new i6(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let o=r.map(t);o&&i.push(o)}return i}}vn.reconfigure=vn.define();vn.appendConfig=vn.define();class zn{constructor(e,t,i,r,o,a){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,i&&aR(i,t.newLength),o.some(u=>u.type==zn.time)||(this.annotations=o.concat(zn.time.of(Date.now())))}static create(e,t,i,r,o,a){return new zn(e,t,i,r,o,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(zn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}zn.time=fo.define();zn.userEvent=fo.define();zn.addToHistory=fo.define();zn.remote=fo.define();function s6(n,e){let t=[];for(let i=0,r=0;;){let o,a;if(i<n.length&&(r==e.length||e[r]>=n[i]))o=n[i++],a=n[i++];else if(r<e.length)o=e[r++],a=e[r++];else return t;!t.length||t[t.length-1]<o?t.push(o,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function gR(n,e,t){var i;let r,o,a;return t?(r=e.changes,o=jn.empty(e.changes.length),a=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),o=n.changes.mapDesc(e.changes,!0),a=n.changes.compose(r)),{changes:a,selection:e.selection?e.selection.map(o):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:vn.mapEffects(n.effects,r).concat(vn.mapEffects(e.effects,o)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function W0(n,e,t){let i=e.selection,r=oc(e.annotations);return e.userEvent&&(r=r.concat(zn.userEvent.of(e.userEvent))),{changes:e.changes instanceof jn?e.changes:jn.of(e.changes||[],t,n.facet(fR)),selection:i&&(i instanceof Se?i:Se.single(i.anchor,i.head)),effects:oc(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function yR(n,e,t){let i=W0(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(t=!1);let a=!!e[o].sequential;i=gR(i,W0(n,e[o],a?i.changes.newLength:n.doc.length),a)}let r=zn.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return l6(t?r6(r):r)}function r6(n){let e=n.startState,t=!0;for(let r of e.facet(hR)){let o=r(n);if(o===!1){t=!1;break}Array.isArray(o)&&(t=t===!0?o:s6(t,o))}if(t!==!0){let r,o;if(t===!1)o=n.changes.invertedDesc,r=jn.empty(e.doc.length);else{let a=n.changes.filter(t);r=a.changes,o=a.filtered.mapDesc(a.changes).invertedDesc}n=zn.create(e,r,n.selection&&n.selection.map(o),vn.mapEffects(n.effects,o),n.annotations,n.scrollIntoView)}let i=e.facet(dR);for(let r=i.length-1;r>=0;r--){let o=i[r](n);o instanceof zn?n=o:Array.isArray(o)&&o.length==1&&o[0]instanceof zn?n=o[0]:n=yR(e,oc(o),!1)}return n}function l6(n){let e=n.startState,t=e.facet(pR),i=n;for(let r=t.length-1;r>=0;r--){let o=t[r](n);o&&Object.keys(o).length&&(i=gR(i,W0(e,o,n.changes.newLength),!0))}return i==n?n:zn.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const o6=[];function oc(n){return n==null?o6:Array.isArray(n)?n:[n]}var Pr=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Pr||(Pr={}));const a6=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let X0;try{X0=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function c6(n){if(X0)return X0.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||a6.test(t)))return!0}return!1}function u6(n){return e=>{if(!/\S/.test(e))return Pr.Space;if(c6(e))return Pr.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Pr.Word;return Pr.Other}}class wt{constructor(e,t,i,r,o,a){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let u=0;u<this.config.dynamicSlots.length;u++)ef(this,u<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return ef(this,i),dp(this,i)}update(...e){return yR(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let u of e.effects)u.is(Pf.reconfigure)?(t&&(r=new Map,t.compartments.forEach((f,d)=>r.set(d,f)),t=null),r.set(u.value.compartment,u.value.extension)):u.is(vn.reconfigure)?(t=null,i=u.value):u.is(vn.appendConfig)&&(t=null,i=oc(i).concat(u.value));let o;t?o=e.startState.values.slice():(t=hp.resolve(i,r,this),o=new wt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(f,d)=>d.reconfigure(f,this),null).values);let a=e.startState.facet(Y0)?e.newSelection:e.newSelection.asSingle();new wt(t,e.newDoc,a,o,(u,f)=>f.update(u,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Se.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),o=[i.range],a=oc(i.effects);for(let u=1;u<t.ranges.length;u++){let f=e(t.ranges[u]),d=this.changes(f.changes),p=d.map(r);for(let b=0;b<u;b++)o[b]=o[b].map(p);let g=r.mapDesc(d,!0);o.push(f.range.map(g)),r=r.compose(p),a=vn.mapEffects(a,p).concat(vn.mapEffects(oc(f.effects),g))}return{changes:r,selection:Se.create(o,t.mainIndex),effects:a}}changes(e=[]){return e instanceof jn?e:jn.of(e,this.doc.length,this.facet(wt.lineSeparator))}toText(e){return kt.of(e.split(this.facet(wt.lineSeparator)||q0))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(ef(this,t),dp(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof uo&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let o in i)if(Object.prototype.hasOwnProperty.call(e,o)){let a=i[o],u=e[o];r.push(a.init(f=>a.spec.fromJSON(u,f)))}}return wt.create({doc:e.doc,selection:Se.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=hp.resolve(e.extensions||[],new Map),i=e.doc instanceof kt?e.doc:kt.of((e.doc||"").split(t.staticFacet(wt.lineSeparator)||q0)),r=e.selection?e.selection instanceof Se?e.selection:Se.single(e.selection.anchor,e.selection.head):Se.single(0);return aR(r,i.length),t.staticFacet(Y0)||(r=r.asSingle()),new wt(t,i,r,t.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(wt.tabSize)}get lineBreak(){return this.facet(wt.lineSeparator)||`
|
|
203
|
-
`}get readOnly(){return this.facet(mR)}phrase(e,...t){for(let i of this.facet(wt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let o=+(r||1);return!o||o>t.length?i:t[o-1]})),e}languageDataAt(e,t,i=-1){let r=[];for(let o of this.facet(uR))for(let a of o(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return u6(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:r}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-i,u=e-i;for(;a>0;){let f=ii(t,a,!1);if(o(t.slice(f,a))!=Pr.Word)break;a=f}for(;u<r;){let f=ii(t,u);if(o(t.slice(u,f))!=Pr.Word)break;u=f}return a==u?null:Se.range(a+i,u+i)}}wt.allowMultipleSelections=Y0;wt.tabSize=We.define({combine:n=>n.length?n[0]:4});wt.lineSeparator=fR;wt.readOnly=mR;wt.phrases=We.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(r=>n[r]==e[r])}});wt.languageData=uR;wt.changeFilter=hR;wt.transactionFilter=dR;wt.transactionExtender=pR;Pf.reconfigure=vn.define();function Av(n,e,t={}){let i={};for(let r of n)for(let o of Object.keys(r)){let a=r[o],u=i[o];if(u===void 0)i[o]=a;else if(!(u===a||a===void 0))if(Object.hasOwnProperty.call(t,o))i[o]=t[o](u,a);else throw new Error("Config merge conflict for field "+o)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}class ia{eq(e){return this==e}range(e,t=e){return $0.create(e,t,this)}}ia.prototype.startSide=ia.prototype.endSide=0;ia.prototype.point=!1;ia.prototype.mapMode=Xi.TrackDel;function Ev(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let $0=class bR{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new bR(e,t,i)}};function Z0(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Rv{constructor(e,t,i,r){this.from=e,this.to=t,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,r=0){let o=i?this.to:this.from;for(let a=r,u=o.length;;){if(a==u)return a;let f=a+u>>1,d=o[f]-e||(i?this.value[f].endSide:this.value[f].startSide)-t;if(f==a)return d>=0?a:u;d>=0?u=f:a=f+1}}between(e,t,i,r){for(let o=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,o);o<a;o++)if(r(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,t){let i=[],r=[],o=[],a=-1,u=-1;for(let f=0;f<this.value.length;f++){let d=this.value[f],p=this.from[f]+e,g=this.to[f]+e,b,v;if(p==g){let S=t.mapPos(p,d.startSide,d.mapMode);if(S==null||(b=v=S,d.startSide!=d.endSide&&(v=t.mapPos(p,d.endSide),v<b)))continue}else if(b=t.mapPos(p,d.startSide),v=t.mapPos(g,d.endSide),b>v||b==v&&d.startSide>0&&d.endSide<=0)continue;(v-b||d.endSide-d.startSide)<0||(a<0&&(a=b),d.point&&(u=Math.max(u,v-b)),i.push(d),r.push(b-a),o.push(v-a))}return{mapped:i.length?new Rv(r,o,i,u):null,pos:a}}}class Ct{constructor(e,t,i,r){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=r}static create(e,t,i,r){return new Ct(e,t,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:r=0,filterTo:o=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(Z0)),this.isEmpty)return t.length?Ct.of(t):this;let u=new vR(this,null,-1).goto(0),f=0,d=[],p=new hf;for(;u.value||f<t.length;)if(f<t.length&&(u.from-t[f].from||u.startSide-t[f].value.startSide)>=0){let g=t[f++];p.addInner(g.from,g.to,g.value)||d.push(g)}else u.rangeIndex==1&&u.chunkIndex<this.chunk.length&&(f==t.length||this.chunkEnd(u.chunkIndex)<t[f].from)&&(!a||r>this.chunkEnd(u.chunkIndex)||o<this.chunkPos[u.chunkIndex])&&p.addChunk(this.chunkPos[u.chunkIndex],this.chunk[u.chunkIndex])?u.nextChunk():((!a||r>u.to||o<u.from||a(u.from,u.to,u.value))&&(p.addInner(u.from,u.to,u.value)||d.push($0.create(u.from,u.to,u.value))),u.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?Ct.empty:this.nextLayer.update({add:d,filter:a,filterFrom:r,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],r=-1;for(let a=0;a<this.chunk.length;a++){let u=this.chunkPos[a],f=this.chunk[a],d=e.touchesRange(u,u+f.length);if(d===!1)r=Math.max(r,f.maxPoint),t.push(f),i.push(e.mapPos(u));else if(d===!0){let{mapped:p,pos:g}=f.map(u,e);p&&(r=Math.max(r,p.maxPoint),t.push(p),i.push(g))}}let o=this.nextLayer.map(e);return t.length==0?o:new Ct(i,t,o||Ct.empty,r)}between(e,t,i){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],a=this.chunk[r];if(t>=o&&e<=o+a.length&&a.between(o,e-o,t-o,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return df.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return df.from(e).goto(t)}static compare(e,t,i,r,o=-1){let a=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),u=t.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),f=JC(a,u,i),d=new Hu(a,f,o),p=new Hu(u,f,o);i.iterGaps((g,b,v)=>ek(d,g,p,b,v,r)),i.empty&&i.length==0&&ek(d,0,p,0,0,r)}static eq(e,t,i=0,r){r==null&&(r=999999999);let o=e.filter(p=>!p.isEmpty&&t.indexOf(p)<0),a=t.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let u=JC(o,a),f=new Hu(o,u,0).goto(i),d=new Hu(a,u,0).goto(i);for(;;){if(f.to!=d.to||!J0(f.active,d.active)||f.point&&(!d.point||!Ev(f.point,d.point)))return!1;if(f.to>r)return!0;f.next(),d.next()}}static spans(e,t,i,r,o=-1){let a=new Hu(e,null,o).goto(t),u=t,f=a.openStart;for(;;){let d=Math.min(a.to,i);if(a.point){let p=a.activeForPoint(a.to),g=a.pointFrom<t?p.length+1:a.point.startSide<0?p.length:Math.min(p.length,f);r.point(u,d,a.point,p,g,a.pointRank),f=Math.min(a.openEnd(d),p.length)}else d>u&&(r.span(u,d,a.active,f),f=a.openEnd(d));if(a.to>i)return f+(a.point&&a.to>i?1:0);u=a.to,a.next()}}static of(e,t=!1){let i=new hf;for(let r of e instanceof $0?[e]:t?f6(e):e)i.add(r.from,r.to,r.value);return i.finish()}static join(e){if(!e.length)return Ct.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let r=e[i];r!=Ct.empty;r=r.nextLayer)t=new Ct(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}Ct.empty=new Ct([],[],null,-1);function f6(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let i=n[t];if(Z0(e,i)>0)return n.slice().sort(Z0);e=i}return n}Ct.empty.nextLayer=Ct.empty;class hf{finishChunk(e){this.chunks.push(new Rv(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new hf)).add(e,t,i)}addInner(e,t,i){let r=e-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(Ct.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ct.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function JC(n,e,t){let i=new Map;for(let o of n)for(let a=0;a<o.chunk.length;a++)o.chunk[a].maxPoint<=0&&i.set(o.chunk[a],o.chunkPos[a]);let r=new Set;for(let o of e)for(let a=0;a<o.chunk.length;a++){let u=i.get(o.chunk[a]);u!=null&&(t?t.mapPos(u):u)==o.chunkPos[a]&&!(t!=null&&t.touchesRange(u,u+o.chunk[a].length))&&r.add(o.chunk[a])}return r}class vR{constructor(e,t,i,r=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class df{constructor(e){this.heap=e}static from(e,t=null,i=-1){let r=[];for(let o=0;o<e.length;o++)for(let a=e[o];!a.isEmpty;a=a.nextLayer)a.maxPoint>=i&&r.push(new vR(a,t,i,o));return r.length==1?r[0]:new df(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Hy(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Hy(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Hy(this.heap,0)}}}function Hy(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let r=n[i];if(i+1<n.length&&r.compare(n[i+1])>=0&&(r=n[i+1],i++),t.compare(r)<0)break;n[i]=t,n[e]=r,e=i}}class Hu{constructor(e,t,i){this.minPoint=i,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=df.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){xd(this.active,e),xd(this.activeTo,e),xd(this.activeRank,e),this.minActive=tk(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:r,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||r-this.activeTo[t])>0;)t++;Sd(this.active,t,i),Sd(this.activeTo,t,r),Sd(this.activeRank,t,o),e&&Sd(e,t,this.cursor.from),this.minActive=tk(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&xd(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let r=i.length-1;r>=0&&i[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function ek(n,e,t,i,r,o){n.goto(e),t.goto(i);let a=i+r,u=i,f=i-e,d=!!o.boundChange;for(let p=!1;;){let g=n.to+f-t.to,b=g||n.endSide-t.endSide,v=b<0?n.to+f:t.to,S=Math.min(v,a);if(n.point||t.point?(n.point&&t.point&&Ev(n.point,t.point)&&J0(n.activeForPoint(n.to),t.activeForPoint(t.to))||o.comparePoint(u,S,n.point,t.point),p=!1):(p&&o.boundChange(u),S>u&&!J0(n.active,t.active)&&o.compareRange(u,S,n.active,t.active),d&&S<a&&(g||n.openEnd(v)!=t.openEnd(v))&&(p=!0)),v>a)break;u=v,b<=0&&n.next(),b>=0&&t.next()}}function J0(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!Ev(n[t],e[t]))return!1;return!0}function xd(n,e){for(let t=e,i=n.length-1;t<i;t++)n[t]=n[t+1];n.pop()}function Sd(n,e,t){for(let i=n.length-1;i>=e;i--)n[i+1]=n[i];n[e]=t}function tk(n,e){let t=-1,i=1e9;for(let r=0;r<e.length;r++)(e[r]-i||n[r].endSide-n[t].endSide)<0&&(t=r,i=e[r]);return t}function $p(n,e,t=n.length){let i=0;for(let r=0;r<t&&r<n.length;)n.charCodeAt(r)==9?(i+=e-i%e,r++):(i++,r=ii(n,r));return i}function h6(n,e,t,i){for(let r=0,o=0;;){if(o>=e)return r;if(r==n.length)break;o+=n.charCodeAt(r)==9?t-o%t:1,r=ii(n,r)}return n.length}const eb="ͼ",nk=typeof Symbol>"u"?"__"+eb:Symbol.for(eb),tb=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),ik=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Jl{constructor(e,t){this.rules=[];let{finish:i}=t||{};function r(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,u,f,d){let p=[],g=/^@(\w+)\b/.exec(a[0]),b=g&&g[1]=="keyframes";if(g&&u==null)return f.push(a[0]+";");for(let v in u){let S=u[v];if(/&/.test(v))o(v.split(/,\s*/).map(w=>a.map(E=>w.replace(/&/,E))).reduce((w,E)=>w.concat(E)),S,f);else if(S&&typeof S=="object"){if(!g)throw new RangeError("The value of a property ("+v+") should be a primitive value.");o(r(v),S,p,b)}else S!=null&&p.push(v.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+S+";")}(p.length||b)&&f.push((i&&!g&&!d?a.map(i):a).join(", ")+" {"+p.join(" ")+"}")}for(let a in e)o(r(a),e[a],this.rules)}getRules(){return this.rules.join(`
|
|
204
|
-
`)}static newName(){let e=ik
|
|
205
|
-
`;this.styleTag.textContent=a;let u=t.head||t;this.styleTag.parentNode!=u&&u.insertBefore(this.styleTag,u.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var eo={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:"'"},pf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},p6=typeof navigator<"u"&&/Mac/.test(navigator.platform),m6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wn=0;Wn<10;Wn++)eo[48+Wn]=eo[96+Wn]=String(Wn);for(var Wn=1;Wn<=24;Wn++)eo[Wn+111]="F"+Wn;for(var Wn=65;Wn<=90;Wn++)eo[Wn]=String.fromCharCode(Wn+32),pf[Wn]=String.fromCharCode(Wn);for(var Vy in eo)pf.hasOwnProperty(Vy)||(pf[Vy]=eo[Vy]);function g6(n){var e=p6&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||m6&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?pf:eo)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}let pi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},nb=typeof document<"u"?document:{documentElement:{style:{}}};const ib=/Edge\/(\d+)/.exec(pi.userAgent),xR=/MSIE \d/.test(pi.userAgent),sb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pi.userAgent),Zp=!!(xR||sb||ib),rk=!Zp&&/gecko\/(\d+)/i.test(pi.userAgent),_y=!Zp&&/Chrome\/(\d+)/.exec(pi.userAgent),lk="webkitFontSmoothing"in nb.documentElement.style,rb=!Zp&&/Apple Computer/.test(pi.vendor),ok=rb&&(/Mobile\/\w+/.test(pi.userAgent)||pi.maxTouchPoints>2);var Be={mac:ok||/Mac/.test(pi.platform),windows:/Win/.test(pi.platform),linux:/Linux|X11/.test(pi.platform),ie:Zp,ie_version:xR?nb.documentMode||6:sb?+sb[1]:ib?+ib[1]:0,gecko:rk,gecko_version:rk?+(/Firefox\/(\d+)/.exec(pi.userAgent)||[0,0])[1]:0,chrome:!!_y,chrome_version:_y?+_y[1]:0,ios:ok,android:/Android\b/.test(pi.userAgent),webkit:lk,webkit_version:lk?+(/\bAppleWebKit\/(\d+)/.exec(pi.userAgent)||[0,0])[1]:0,safari:rb,safari_version:rb?+(/\bVersion\/(\d+(\.\d+)?)/.exec(pi.userAgent)||[0,0])[1]:0,tabSize:nb.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Tv(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const pp=Object.create(null);function Ov(n,e,t){if(n==e)return!0;n||(n=pp),e||(e=pp);let i=Object.keys(n),r=Object.keys(e);if(i.length-0!=r.length-0)return!1;for(let o of i)if(o!=t&&(r.indexOf(o)==-1||n[o]!==e[o]))return!1;return!0}function y6(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function ak(n,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?n.style.cssText="":n.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?n.style.cssText=t[r]:n.setAttribute(r,t[r]));return i}function b6(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}class Hf{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Di=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(Di||(Di={}));class Gt extends ia{constructor(e,t,i,r){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Vf(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new sa(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:o,end:a}=SR(e,t);i=(o?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new sa(e,i,r,t,e.widget||null,!0)}static line(e){return new _f(e)}static set(e,t=!1){return Ct.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Gt.none=Ct.empty;class Vf extends Gt{constructor(e){let{start:t,end:i}=SR(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Tv(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||pp}eq(e){return this==e||e instanceof Vf&&this.tagName==e.tagName&&Ov(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Vf.prototype.point=!1;class _f extends Gt{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof _f&&this.spec.class==e.spec.class&&Ov(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}_f.prototype.mapMode=Xi.TrackBefore;_f.prototype.point=!0;class sa extends Gt{constructor(e,t,i,r,o,a){super(t,i,o,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?Xi.TrackBefore:Xi.TrackAfter:Xi.TrackDel}get type(){return this.startSide!=this.endSide?Di.WidgetRange:this.startSide<=0?Di.WidgetBefore:Di.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof sa&&v6(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}sa.prototype.point=!0;function SR(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function v6(n,e){return n==e||!!(n&&e&&n.compare(e))}function ac(n,e,t,i=0){let r=t.length-1;r>=0&&t[r]+i>=n?t[r]=Math.max(t[r],e):t.push(n,e)}class mf extends ia{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof mf&&this.tagName==e.tagName&&Ov(this.attributes,e.attributes)}static create(e){return new mf(e.tagName,e.attributes||pp,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return Ct.of(e,t)}}mf.prototype.startSide=mf.prototype.endSide=-1;function gf(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function lb(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function tf(n,e){if(!e.anchorNode)return!1;try{return lb(n,e.anchorNode)}catch{return!1}}function nf(n){return n.nodeType==3?bf(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function sf(n,e,t,i){return t?ck(n,e,t,i,-1)||ck(n,e,t,i,1):!1}function to(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function mp(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function ck(n,e,t,i,r){for(;;){if(n==t&&e==i)return!0;if(e==(r<0?0:Kr(n))){if(n.nodeName=="DIV")return!1;let o=n.parentNode;if(!o||o.nodeType!=1)return!1;e=to(n)+(r<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(r<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=r<0?Kr(n):0}else return!1}}function Kr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function yf(n,e){let{left:t,right:i}=n;if(t==i)return n;let r=e?t:i;return{left:r,right:r,top:n.top,bottom:n.bottom}}function x6(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function wR(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function S6(n,e,t,i,r,o,a,u){let f=n.ownerDocument,d=f.defaultView||window;for(let p=n,g=!1;p&&!g;)if(p.nodeType==1){let b,v=p==f.body,S=1,w=1;if(v)b=x6(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(g=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let R=p.getBoundingClientRect();({scaleX:S,scaleY:w}=wR(p,R)),b={left:R.left,right:R.left+p.clientWidth*S,top:R.top,bottom:R.top+p.clientHeight*w}}let E=0,k=0;if(r=="nearest")e.top<b.top+a?(k=e.top-(b.top+a),t>0&&e.bottom>b.bottom+k&&(k=e.bottom-b.bottom+a)):e.bottom>b.bottom-a&&(k=e.bottom-b.bottom+a,t<0&&e.top-k<b.top&&(k=e.top-(b.top+a)));else{let R=e.bottom-e.top,N=b.bottom-b.top;k=(r=="center"&&R<=N?e.top+R/2-N/2:r=="start"||r=="center"&&t<0?e.top-a:e.bottom-N+a)-b.top}if(i=="nearest"?e.left<b.left+o?(E=e.left-(b.left+o),t>0&&e.right>b.right+E&&(E=e.right-b.right+o)):e.right>b.right-o&&(E=e.right-b.right+o,t<0&&e.left<b.left+E&&(E=e.left-(b.left+o))):E=(i=="center"?e.left+(e.right-e.left)/2-(b.right-b.left)/2:i=="start"==u?e.left-o:e.right-(b.right-b.left)+o)-b.left,E||k)if(v)d.scrollBy(E,k);else{let R=0,N=0;if(k){let T=p.scrollTop;p.scrollTop+=k/w,N=(p.scrollTop-T)*w}if(E){let T=p.scrollLeft;p.scrollLeft+=E/S,R=(p.scrollLeft-T)*S}e={left:e.left-R,top:e.top-N,right:e.right-R,bottom:e.bottom-N},R&&Math.abs(R-E)<1&&(i="nearest"),N&&Math.abs(N-k)<1&&(r="nearest")}if(v)break;(e.top<b.top||e.bottom>b.bottom||e.left<b.left||e.right>b.right)&&(e={left:Math.max(e.left,b.left),right:Math.min(e.right,b.right),top:Math.max(e.top,b.top),bottom:Math.min(e.bottom,b.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function CR(n,e=!0){let t=n.ownerDocument,i=null,r=null;for(let o=n.parentNode;o&&!(o==t.body||(!e||i)&&r);)if(o.nodeType==1)!r&&o.scrollHeight>o.clientHeight&&(r=o),e&&!i&&o.scrollWidth>o.clientWidth&&(i=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:i,y:r}}class w6{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Kr(t):0),i,Math.min(e.focusOffset,i?Kr(i):0))}set(e,t,i,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=r}}let zo=null;Be.safari&&Be.safari_version>=26&&(zo=!1);function kR(n){if(n.setActive)return n.setActive();if(zo)return n.focus(zo);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(zo==null?{get preventScroll(){return zo={preventScroll:!0},!0}}:void 0),!zo){zo=!1;for(let t=0;t<e.length;){let i=e[t++],r=e[t++],o=e[t++];i.scrollTop!=r&&(i.scrollTop=r),i.scrollLeft!=o&&(i.scrollLeft=o)}}}let uk;function bf(n,e,t=e){let i=uk||(uk=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function cc(n,e,t,i){let r={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,n.dispatchEvent(o);let a=new KeyboardEvent("keyup",r);return a.synthetic=!0,n.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function C6(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function k6(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Kr(t));;)if(i){if(t.nodeType!=1)return!1;let r=t.childNodes[i-1];r.contentEditable=="false"?i--:(t=r,i=Kr(t))}else{if(t==n)return!0;i=to(t),t=t.parentNode}}function AR(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function ER(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Kr(t)}else if(t.parentNode&&!mp(t))i=to(t),t=t.parentNode;else return null}}function RR(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!mp(t))i=to(t)+1,t=t.parentNode;else return null}}class Ts{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new Ts(e.parentNode,to(e),t)}static after(e,t){return new Ts(e.parentNode,to(e)+1,t)}}var xn=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(xn||(xn={}));const ra=xn.LTR,Mv=xn.RTL;function TR(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const A6=TR("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),E6=TR("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ob=Object.create(null),Gs=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);ob[e]=t,ob[t]=-e}function OR(n){return n<=247?A6[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?E6[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const R6=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class tr{get dir(){return this.level%2?Mv:ra}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,r){let o=-1;for(let a=0;a<e.length;a++){let u=e[a];if(u.from<=t&&u.to>=t){if(u.level==i)return a;(o<0||(r!=0?r<0?u.from<t:u.to>t:e[o].level>u.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function MR(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],r=e[t];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!MR(i.inner,r.inner))return!1}return!0}const Ft=[];function T6(n,e,t,i,r){for(let o=0;o<=i.length;o++){let a=o?i[o-1].to:e,u=o<i.length?i[o].from:t,f=o?256:r;for(let d=a,p=f,g=f;d<u;d++){let b=OR(n.charCodeAt(d));b==512?b=p:b==8&&g==4&&(b=16),Ft[d]=b==4?2:b,b&7&&(g=b),p=b}for(let d=a,p=f,g=f;d<u;d++){let b=Ft[d];if(b==128)d<u-1&&p==Ft[d+1]&&p&24?b=Ft[d]=p:Ft[d]=256;else if(b==64){let v=d+1;for(;v<u&&Ft[v]==64;)v++;let S=d&&p==8||v<t&&Ft[v]==8?g==1?1:8:256;for(let w=d;w<v;w++)Ft[w]=S;d=v-1}else b==8&&g==1&&(Ft[d]=1);p=b,b&7&&(g=b)}}}function O6(n,e,t,i,r){let o=r==1?2:1;for(let a=0,u=0,f=0;a<=i.length;a++){let d=a?i[a-1].to:e,p=a<i.length?i[a].from:t;for(let g=d,b,v,S;g<p;g++)if(v=ob[b=n.charCodeAt(g)])if(v<0){for(let w=u-3;w>=0;w-=3)if(Gs[w+1]==-v){let E=Gs[w+2],k=E&2?r:E&4?E&1?o:r:0;k&&(Ft[g]=Ft[Gs[w]]=k),u=w;break}}else{if(Gs.length==189)break;Gs[u++]=g,Gs[u++]=b,Gs[u++]=f}else if((S=Ft[g])==2||S==1){let w=S==r;f=w?0:1;for(let E=u-3;E>=0;E-=3){let k=Gs[E+2];if(k&2)break;if(w)Gs[E+2]|=2;else{if(k&4)break;Gs[E+2]|=4}}}}}function M6(n,e,t,i){for(let r=0,o=i;r<=t.length;r++){let a=r?t[r-1].to:n,u=r<t.length?t[r].from:e;for(let f=a;f<u;){let d=Ft[f];if(d==256){let p=f+1;for(;;)if(p==u){if(r==t.length)break;p=t[r++].to,u=r<t.length?t[r].from:e}else if(Ft[p]==256)p++;else break;let g=o==1,b=(p<e?Ft[p]:i)==1,v=g==b?g?1:2:i;for(let S=p,w=r,E=w?t[w-1].to:n;S>f;)S==E&&(S=t[--w].from,E=w?t[w-1].to:n),Ft[--S]=v;f=p}else o=d,f++}}}function ab(n,e,t,i,r,o,a){let u=i%2?2:1;if(i%2==r%2)for(let f=e,d=0;f<t;){let p=!0,g=!1;if(d==o.length||f<o[d].from){let w=Ft[f];w!=u&&(p=!1,g=w==16)}let b=!p&&u==1?[]:null,v=p?i:i+1,S=f;e:for(;;)if(d<o.length&&S==o[d].from){if(g)break e;let w=o[d];if(!p)for(let E=w.to,k=d+1;;){if(E==t)break e;if(k<o.length&&o[k].from==E)E=o[k++].to;else{if(Ft[E]==u)break e;break}}if(d++,b)b.push(w);else{w.from>f&&a.push(new tr(f,w.from,v));let E=w.direction==ra!=!(v%2);cb(n,E?i+1:i,r,w.inner,w.from,w.to,a),f=w.to}S=w.to}else{if(S==t||(p?Ft[S]!=u:Ft[S]==u))break;S++}b?ab(n,f,S,i+1,r,b,a):f<S&&a.push(new tr(f,S,v)),f=S}else for(let f=t,d=o.length;f>e;){let p=!0,g=!1;if(!d||f>o[d-1].to){let w=Ft[f-1];w!=u&&(p=!1,g=w==16)}let b=!p&&u==1?[]:null,v=p?i:i+1,S=f;e:for(;;)if(d&&S==o[d-1].to){if(g)break e;let w=o[--d];if(!p)for(let E=w.from,k=d;;){if(E==e)break e;if(k&&o[k-1].to==E)E=o[--k].from;else{if(Ft[E-1]==u)break e;break}}if(b)b.push(w);else{w.to<f&&a.push(new tr(w.to,f,v));let E=w.direction==ra!=!(v%2);cb(n,E?i+1:i,r,w.inner,w.from,w.to,a),f=w.from}S=w.from}else{if(S==e||(p?Ft[S-1]!=u:Ft[S-1]==u))break;S--}b?ab(n,S,f,i+1,r,b,a):S<f&&a.push(new tr(S,f,v)),f=S}}function cb(n,e,t,i,r,o,a){let u=e%2?2:1;T6(n,r,o,i,u),O6(n,r,o,i,u),M6(r,o,i,u),ab(n,r,o,e,t,i,a)}function N6(n,e,t){if(!n)return[new tr(0,0,e==Mv?1:0)];if(e==ra&&!t.length&&!R6.test(n))return NR(n.length);if(t.length)for(;n.length>Ft.length;)Ft[Ft.length]=256;let i=[],r=e==ra?0:1;return cb(n,r,r,t,0,n.length,i),i}function NR(n){return[new tr(0,n,0)]}let DR="";function D6(n,e,t,i,r){var o;let a=i.head-n.from,u=tr.find(e,a,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc),f=e[u],d=f.side(r,t);if(a==d){let b=u+=r?1:-1;if(b<0||b>=e.length)return null;f=e[u=b],a=f.side(!r,t),d=f.side(r,t)}let p=ii(n.text,a,f.forward(r,t));(p<f.from||p>f.to)&&(p=d),DR=n.text.slice(Math.min(a,p),Math.max(a,p));let g=u==(r?e.length-1:0)?null:e[u+(r?1:-1)];return g&&p==d&&g.level+(r?0:1)<f.level?Se.cursor(g.side(!r,t)+n.from,g.forward(r,t)?1:-1,g.level):Se.cursor(p+n.from,f.forward(r,t)?-1:1,f.level)}function j6(n,e,t){for(let i=e;i<t;i++){let r=OR(n.charCodeAt(i));if(r==1)return ra;if(r==2||r==4)return Mv}return ra}const jR=We.define(),BR=We.define(),LR=We.define(),zR=We.define(),ub=We.define(),IR=We.define(),PR=We.define(),Nv=We.define(),Dv=We.define(),HR=We.define({combine:n=>n.some(e=>e)}),B6=We.define({combine:n=>n.some(e=>e)}),VR=We.define();class uc{constructor(e,t,i,r,o,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=r,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new uc(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 uc(Se.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const wd=vn.define({map:(n,e)=>n.map(e)}),_R=vn.define();function nr(n,e,t){let i=n.facet(zR);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Ir=We.define({combine:n=>n.length?n[0]:!0});let L6=0;const ec=We.define({combine(n){return n.filter((e,t)=>{for(let i=0;i<t;i++)if(n[i].plugin==e.plugin)return!1;return!0})}});class Ds{constructor(e,t,i,r,o){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=r,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(ec.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(ec.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:i,eventObservers:r,provide:o,decorations:a}=t||{};return new Ds(L6++,e,i,r,u=>{let f=[];return a&&f.push(Jp.of(d=>{let p=d.plugin(u);return p?a(p):Gt.none})),o&&f.push(o(u)),f})}static fromClass(e,t){return Ds.define((i,r)=>new e(i,r),t)}}class Uy{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(nr(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){nr(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){nr(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const UR=We.define(),jv=We.define(),Jp=We.define(),qR=We.define(),Bv=We.define(),Uf=We.define(),FR=We.define();function fk(n,e){let t=n.state.facet(FR);if(!t.length)return t;let i=t.map(o=>o instanceof Function?o(n):o),r=[];return Ct.spans(i,e.from,e.to,{point(){},span(o,a,u,f){let d=o-e.from,p=a-e.from,g=r;for(let b=u.length-1;b>=0;b--,f--){let v=u[b].spec.bidiIsolate,S;if(v==null&&(v=j6(e.text,d,p)),f>0&&g.length&&(S=g[g.length-1]).to==d&&S.direction==v)S.to=p,g=S.inner;else{let w={from:d,to:p,direction:v,inner:[]};g.push(w),g=w.inner}}}}),r}const GR=We.define();function QR(n){let e=0,t=0,i=0,r=0;for(let o of n.state.facet(GR)){let a=o(n);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(t=Math.max(t,a.right)),a.top!=null&&(i=Math.max(i,a.top)),a.bottom!=null&&(r=Math.max(r,a.bottom)))}return{left:e,right:t,top:i,bottom:r}}const Qu=We.define();class ds{constructor(e,t,i,r){this.fromA=e,this.toA=t,this.fromB=i,this.toB=r}join(e){return new ds(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>i.toA)){if(r.toA<i.fromA)break;i=i.join(r),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let r=0,o=0,a=0;;){let u=r<e.length?e[r].fromB:1e9,f=o<t.length?t[o]:1e9,d=Math.min(u,f);if(d==1e9)break;let p=d+a,g=d,b=p;for(;;)if(o<t.length&&t[o]<=g){let v=t[o+1];o+=2,g=Math.max(g,v);for(let S=r;S<e.length&&e[S].fromB<=g;S++)a=e[S].toA-e[S].toB;b=Math.max(b,v+a)}else if(r<e.length&&e[r].fromB<=g){let v=e[r++];g=Math.max(g,v.toB),b=Math.max(b,v.toA),a=v.toA-v.toB}else break;i.push(new ds(p,b,d,g))}return i}}class gp{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=jn.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let r=[];this.changes.iterChangedRanges((o,a,u,f)=>r.push(new ds(o,a,u,f))),this.changedRanges=r}static create(e,t,i){return new gp(e,t,i)}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 z6=[];class hn{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return z6}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&y6(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let r of this.children){if(r==e)return i;i+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=to(this.dom),r=this.length?e>0:t>0;return new Ts(this.parent.dom,i+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof tm)return e;return null}static get(e){return e.cmTile}}class em extends hn{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,r,o=(e==null?void 0:e.node)==t?e:null,a=0;for(let u of this.children){if(u.sync(e),a+=u.length+u.breakAfter,r=i?i.nextSibling:t.firstChild,o&&r!=u.dom&&(o.written=!0),u.dom.parentNode==t)for(;r&&r!=u.dom;)r=hk(r);else t.insertBefore(u.dom,r);i=u.dom}for(r=i?i.nextSibling:t.firstChild,o&&r&&(o.written=!0);r;)r=hk(r);this.length=a}}function hk(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class tm extends em{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=hn.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,r=0,o=0;;)if(r==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&o++,r=t.pop()}else{let a=i.children[r++];if(a instanceof Vr)t.push(r),i=a,r=0;else{let u=o+a.length,f=e(a,o);if(f!==void 0)return f;o=u+a.breakAfter}}}resolveBlock(e,t){let i,r=-1,o,a=-1;if(this.blockTiles((u,f)=>{let d=f+u.length;if(e>=f&&e<=d){if(u.isWidget()&&t>=-1&&t<=1){if(u.flags&32)return!0;u.flags&16&&(i=void 0)}(f<e||e==d&&(t<-1?u.length:u.covers(1)))&&(!i||!u.isWidget()&&i.isWidget())&&(i=u,r=e-f),(d>e||e==f&&(t>1?u.length:u.covers(-1)))&&(!o||!u.isWidget()&&o.isWidget())&&(o=u,a=e-f)}}),!i&&!o)throw new Error("No tile at position "+e);return i&&t<0||!o?{tile:i,offset:r}:{tile:o,offset:a}}}class Vr extends em{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new Vr(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Nc extends em{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let r=new Nc(t||document.createElement("div"),e);return(!t||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,i){let r=null,o=-1,a=null,u=-1;function f(p,g){for(let b=0,v=0;b<p.children.length&&v<=g;b++){let S=p.children[b],w=v+S.length;w>=g&&(S.isComposite()?f(S,g-v):(!a||a.isHidden&&(t>0&&!(a.flags&32)||i&&P6(a,S)))&&(w>g||S.flags&32)?(a=S,u=g-v):(v<g||S.flags&16&&!S.isHidden)&&(r=S,o=g-v)),v=w}}f(this,e);let d=(t<0?r:a)||r||a;return d?{tile:d,offset:d==r?o:u}:null}coordsIn(e,t,i){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,i):I6(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:r,offset:o}=i;if(this.dom.contains(r.dom))return r.isText()?new Ts(r.dom,Math.min(r.dom.nodeValue.length,o)):r.domPosFor(o,r.flags&16?1:r.flags&32?-1:t);let a=i.tile.parent,u=!1;for(let f of a.children){if(u)return new Ts(f.dom,0);f==i.tile&&(u=!0)}}return new Ts(this.dom,0)}}function I6(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=nf(e);return t[t.length-1]||null}function P6(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.top<t.bottom}class Mi extends em{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let i=new Mi(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Uo extends hn{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,i){let r=this.dom.nodeValue.length;e>r&&(e=r);let o=e,a=e,u=0;e==0&&t<0||e==r&&t>=0?Be.chrome||Be.gecko||(e?(o--,u=1):a<r&&(a++,u=-1)):t<0?o--:a<r&&a++;let f=bf(this.dom,o,a).getClientRects();if(!f.length)return null;let d=f[(u?u<0:t>=0)?0:f.length-1];return Be.safari&&!u&&d.width==0&&(d=Array.prototype.find.call(f,p=>p.width)||d),i==null?d:yf(d,(u?u>0:t<0)==i)}static of(e,t){let i=new Uo(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class la extends hn{constructor(e,t,i,r){super(e,t,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(i)return yf(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?o.length-1:0;a=o[f],!(e>0?f==0:f==o.length-1||a.top<a.bottom);f+=u?-1:1);return yf(a,!u)}}get overrideDOMText(){if(!this.length)return kt.empty;let{root:e}=this;if(!e)return kt.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,i,r,o){return o||(o=e.toDOM(t),e.editable||(o.contentEditable="false")),new la(o,i,e,r)}}class yp extends hn{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return kt.empty}coordsIn(e,t,i){let r=this.dom.getBoundingClientRect();return i==null?r:yf(r,t>0==i)}}class H6{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:r,index:o,beforeBreak:a,parents:u}=this;for(;e||t>0;)if(r.isComposite())if(a){if(!e)break;i&&i.break(),e--,a=!1}else if(o==r.children.length){if(!e&&!u.length)break;i&&i.leave(r),a=!!r.breakAfter,{tile:r,index:o}=u.pop(),o++}else{let f=r.children[o],d=f.breakAfter;(t>0?f.length<=e:f.length<e)&&(!i||i.skip(f,0,f.length)!==!1||!f.isComposite)?(a=!!d,o++,e-=f.length):(u.push({tile:r,index:o}),r=f,o=0,i&&f.isComposite()&&i.enter(f))}else if(o==r.length)a=!!r.breakAfter,{tile:r,index:o}=u.pop(),o++;else if(e){let f=Math.min(e,r.length-o);i&&i.skip(r,o,o+f),e-=f,o+=f}else break;return this.tile=r,this.index=o,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class V6{constructor(e,t,i,r){this.from=e,this.to=t,this.wrapper=i,this.rank=r}}class _6{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,r){var o;this.flushBuffer();let a=this.ensureMarks(t,i),u=a.lastChild;if(u&&u.isText()&&!(u.flags&8)&&u.length+e.length<512){this.cache.reused.set(u,2);let f=a.children[a.children.length-1]=new Uo(u.dom,u.text+e);f.parent=a}else a.append(r||Uo.of(e,(o=this.cache.find(Uo))===null||o===void 0?void 0:o.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?qy(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=i;for(let u=t.marks.length-1;u>=0;u--){let f=t.marks[u],d=r.lastChild;if(d instanceof Mi&&d.mark.eq(f.mark))d.dom!=f.dom&&d.setDOM(qy(f.dom)),r=d;else{if(this.cache.reused.get(f)){let g=hn.get(f.dom);g&&g.setDOM(qy(f.dom))}let p=Mi.of(f.mark,f.dom);r.append(p),r=p}this.cache.reused.set(f,2)}let o=hn.get(e.text);o&&this.cache.reused.set(o,2);let a=new Uo(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,i){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let o=this.ensureMarks(t,i);!r&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=KR);let r=Nc.start(e,t||((i=this.cache.find(Nc))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let r=this.curLine;for(let o=e.length-1;o>=0;o--){let a=e[o],u;if(t>0&&(u=r.lastChild)&&u instanceof Mi&&u.mark.eq(a))r=u,t--;else{let f=Mi.of(a,(i=this.cache.find(Mi,d=>d.mark.eq(a)))===null||i===void 0?void 0:i.dom);r.append(f),r=f,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!dk(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Be.ios&&dk(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Fy,0,32)||new la(Fy.toDOM(),0,Fy,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,i=new V6(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-i.rank||this.wrappers[r-1].to-i.to)<0;)r--;this.wrappers.splice(r,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let r=t.lastChild;if(i.from<this.pos&&r instanceof Vr&&r.wrapper.eq(i.wrapper))t=r;else{let o=Vr.of(i.wrapper,(e=this.cache.find(Vr,a=>a.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(o),t=o}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(yp,void 0,1);return i&&(i.flags=t),i||new yp(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class U6{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=r;let u=this.textOff=Math.min(e,r.length);return o?null:r.slice(0,u)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const bp=[la,Nc,Uo,Mi,yp,Vr,tm];for(let n=0;n<bp.length;n++)bp[n].bucket=n;class q6{constructor(e){this.view=e,this.buckets=bp.map(()=>[]),this.index=bp.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let r=e.bucket,o=this.buckets[r],a=this.index[r];for(let u=0;u<o.length;u++){let f=(u+a)%o.length,d=o[f];if((!t||t(d))&&!this.reused.has(d))return o.splice(f,1),f<a&&this.index[r]--,this.reused.set(d,i),d}return null}findWidget(e,t,i){let r=this.buckets[0];if(r.length)for(let o=0,a=0;;o++){if(o==r.length){if(a)return null;a=1,o=0}let u=r[o];if(!this.reused.has(u)&&(a==0?u.widget.compare(e):u.widget.constructor==e.constructor&&e.updateDOM(u.dom,this.view,u.widget)))return r.splice(o,1),o<this.index[0]&&this.index[0]--,u.widget==e&&u.length==t&&(u.flags&497)==i?(this.reused.set(u,1),u):(this.reused.set(u,2),new la(u.dom,t,e,u.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class F6{constructor(e,t,i,r,o){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new q6(e),this.text=new U6(e.state.doc),this.builder=new _6(this.cache,new tm(e,e.contentDOM),Ct.iter(i)),this.cache.reused.set(t,2),this.old=new H6(t),this.reuseWalker={skip:(a,u,f)=>{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let r=0,o=0,a=0;;){let u=a<e.length?e[a++]:null,f=u?u.fromA:this.old.root.length;if(f>r){let d=f-r;this.preserve(d,!a,!u),r=f,o+=d}if(!u)break;t&&u.fromA<=t.range.fromA&&u.toA>=t.range.toA?(this.forward(u.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(o,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,i),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,u.toA),this.emit(t.range.toB,u.toB)):(this.forward(u.fromA,u.toA),this.emit(o,u.toB)),o=u.toB,r=u.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let r=K6(this.old),o=this.openMarks;this.old.advance(e,i?1:-1,{skip:(a,u,f)=>{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let d=f>0||u<a.length?la.of(a.widget,this.view,f-u,a.flags&496,this.cache.maybeReuse(a)):this.cache.reuse(a);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,r,o),o=r.length)}else if(a.isText())this.builder.ensureLine(null),!u&&f==a.length&&!this.cache.reused.has(a)?this.builder.addText(a.text,r,o,this.cache.reuse(a)):(this.cache.add(a),this.builder.addText(a.text.slice(u,f),r,o)),o=r.length;else if(a.isLine())a.flags&=-2,this.cache.reused.set(a,1),this.builder.addLine(a);else if(a instanceof yp)this.cache.add(a);else if(a instanceof Mi)this.builder.ensureLine(null),this.builder.addMark(a,r,o),this.cache.reused.set(a,1),o=r.length;else return!1;this.openWidget=!1},enter:a=>{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof Mi&&r.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?r.length&&(r.length=o=0):a instanceof Mi&&(r.shift(),o=Math.min(o,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,r=this.builder,o=0,a=Ct.spans(this.decorations,e,t,{point:(u,f,d,p,g,b)=>{if(d instanceof sa){if(this.disallowBlockEffectsFor[b]){if(d.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(o=p.length,g>p.length)r.continueWidget(f-u);else{let v=d.widget||(d.block?Dc.block:Dc.inline),S=G6(d),w=this.cache.findWidget(v,f-u,S)||la.of(v,this.view,f-u,S);d.block?(d.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(w)):(r.ensureLine(i),r.addInlineWidget(w,p,g))}i=null}else i=Q6(i,d);f>u&&this.text.skip(f-u)},span:(u,f,d,p)=>{for(let g=u;g<f;){let b=this.text.next(Math.min(512,f-g));b==null?(r.addLineStartIfNotCovered(i),r.addBreak(),g++):(r.ensureLine(i),r.addText(b,d,g==u?p:d.length),g+=b.length),i=null}o=d.length}});this.openWidget=a>o,this.openWidget||r.addLineStartIfNotCovered(i),this.openMarks=a}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let r=e.parentNode;;r=r.parentNode){let o=hn.get(r);if(r==this.view.contentDOM)break;o instanceof Mi?t.push(o):o!=null&&o.isLine()?i=o:o instanceof Vr||(r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new Nc(r,KR):i||t.push(Mi.of(new Vf({tagName:r.nodeName.toLowerCase(),attributes:b6(r)}),r)))}return{line:i,marks:t}}}function dk(n,e){let t=i=>{for(let r of i.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(n)}function G6(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const KR={class:"cm-line"};function Q6(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Tv(t,n),i&&(n.class+=" "+i)),n}function K6(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof Mi&&e.push(i.mark)}return e}function qy(n){let e=hn.get(n);return e&&e.setDOM(n.cloneNode()),n}class Dc extends Hf{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}}Dc.inline=new Dc("span");Dc.block=new Dc("div");const Fy=new class extends Hf{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class pk{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Gt.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 tm(e,e.contentDOM),this.updateInner([new ds(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:p,toA:g})=>g<this.minWidthFrom||p>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!nI(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let o=r>-1?W6(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:g}=this.hasComposition;i=new ds(p,g,e.changes.mapPos(p,-1),e.changes.mapPos(g,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Be.ie||Be.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,u=this.blockWrappers;this.updateDeco();let f=Z6(a,this.decorations,e.changes);f.length&&(i=ds.extendWithRanges(i,f));let d=eI(u,this.blockWrappers,e.changes);return d.length&&(i=ds.extendWithRanges(i,d)),o&&!i.some(p=>p.fromA<=o.range.fromA&&p.toA>=o.range.toA)&&(i=o.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let a=this.tile,u=new F6(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&hn.get(t.text)&&u.cache.reused.set(hn.get(t.text),2),this.tile=u.run(e,t),fb(a,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 o=Be.chrome||Be.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||i.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.tile.children)o.isWidget()&&o.widget instanceof Gy&&r.push(o.dom);i.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(_R)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,r=this.view.root.activeElement,o=r==i,a=!o&&!(this.view.state.facet(Ir)||i.tabIndex>-1)&&tf(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(o||t||a))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,d,p;if(f.empty?p=d=this.inlineDOMNearPos(f.anchor,f.assoc||1):(p=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),d=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),Be.gecko&&f.empty&&!this.hasComposition&&Y6(d)){let b=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(b,d.node.childNodes[d.offset]||null)),d=p=new Ts(b,0),u=!0}let g=this.view.observer.selectionRange;(u||!g.focusNode||(!sf(d.node,d.offset,g.anchorNode,g.anchorOffset)||!sf(p.node,p.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,f))&&(this.view.observer.ignore(()=>{Be.android&&Be.chrome&&i.contains(g.focusNode)&&tI(g.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let b=gf(this.view.root);if(b)if(f.empty){if(Be.gecko){let v=X6(d.node,d.offset);if(v&&v!=3){let S=(v==1?ER:RR)(d.node,d.offset);S&&(d=new Ts(S.node,S.offset))}}b.collapse(d.node,d.offset),f.bidiLevel!=null&&b.caretBidiLevel!==void 0&&(b.caretBidiLevel=f.bidiLevel)}else if(b.extend){b.collapse(d.node,d.offset);try{b.extend(p.node,p.offset)}catch{}}else{let v=document.createRange();f.anchor>f.head&&([d,p]=[p,d]),v.setEnd(p.node,p.offset),v.setStart(d.node,d.offset),b.removeAllRanges(),b.addRange(v)}a&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Ts(g.anchorNode,g.anchorOffset),this.impreciseHead=p.precise?null:new Ts(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&sf(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=gf(e.root),{anchorNode:r,anchorOffset:o}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let u=a.posAtStart;if(t.head==u||t.head==u+a.length)return;let f=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!f||!d||f.bottom>d.top)return;let p=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(p.node,p.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=t.from&&i.collapse(r,o)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let o;if(e==i.dom)o=i.dom.childNodes[t];else{let a=Kr(e)==0?0:t==0?-1:1;for(;;){let u=e.parentNode;if(u==i.dom)break;a==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?a=-1:a=1),e=u}a<0?o=e:o=e.nextSibling}if(o==i.dom.firstChild)return r;for(;o&&!hn.get(o);)o=o.nextSibling;if(!o)return r+i.length;for(let a=0,u=r;;a++){let f=i.children[a];if(f.dom==o)return u;u+=f.length+f.breakAfter}}else return i.isText()?e==i.dom?r+t:r+(t?i.length:0):r}domAtPos(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(r,t):i.domIn(r,t)}inlineDOMNearPos(e,t){let i,r=-1,o=!1,a,u=-1,f=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(o=!0)}else{let g=p+d.length;if(p<=e&&(i=d,r=e-p,o=g<e),g>=e&&!a&&(a=d,u=e-p,f=p>e),p>e&&a)return!0}}),!i&&!a?this.domAtPos(e,t):(o&&a?i=null:f&&i&&(a=null),i&&t<0||!a?i.domIn(r,t):a.domIn(u,t))}coordsAt(e,t,i){let{tile:r,offset:o}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Gy?null:r.coordsInWidget(o,t,!0):r.coordsIn(o,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(o,a){if(o.isComposite())for(let u of o.children){if(u.length>=a){let f=r(u,a);if(f)return f}if(a-=u.length,a<0)break}else if(o.isText()&&a<o.length){let u=ii(o.text,a);if(u==a)return null;let f=bf(o.dom,a,u).getClientRects();for(let d=0;d<f.length;d++){let p=f[d];if(d==f.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return r(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:r}=e,o=this.view.contentDOM.clientWidth,a=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==xn.LTR,d=0,p=(g,b,v)=>{for(let S=0;S<g.children.length&&!(b>r);S++){let w=g.children[S],E=b+w.length,k=w.dom.getBoundingClientRect(),{height:R}=k;if(v&&!S&&(d+=k.top-v.top),w instanceof Vr)E>i&&p(w,b,k);else if(b>=i&&(d>0&&t.push(-d),t.push(R+d),d=0,a)){let N=w.dom.lastChild,T=N?nf(N):[];if(T.length){let B=T[T.length-1],L=f?B.right-k.left:k.right-B.left;L>u&&(u=L,this.minWidth=o,this.minWidthFrom=b,this.minWidthTo=E)}}v&&S==g.children.length-1&&(d+=v.bottom-k.bottom),b=E+w.breakAfter}};return p(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?xn.RTL:xn.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let u=0,f;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=nf(d.dom);if(p.length!=1)return;u+=p[0].width,f=p[0].height}if(u)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:u/a.length,textHeight:f}}});if(e)return e;let t=document.createElement("div"),i,r,o;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let a=nf(t.firstChild)[0];i=t.getBoundingClientRect().height,r=a&&a.width?a.width/27:7,o=a&&a.height?a.height:i,t.remove()}),{lineHeight:i,charWidth:r,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,r=0;;r++){let o=r==t.viewports.length?null:t.viewports[r],a=o?o.from-1:this.view.state.doc.length;if(a>i){let u=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(Gt.replace({widget:new Gy(u),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!o)break;i=o.to+1}return Gt.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Jp).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,r=this.view.state.facet(Bv).map((o,a)=>{let u=typeof o=="function";return u&&(i=!0),u?o(this.view):o});for(r.length&&(this.dynamicDecorationMap[e++]=i,t.push(Ct.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(qR).map(o=>typeof o=="function"?o(this.view):o)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(VR))try{if(d(this.view,e.range,e))return!0}catch(p){nr(this.view.state,p,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!i)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let o=QR(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(S6(this.view.scrollDOM,a,t.head<t.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==xn.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(t.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=i=>i.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){fb(this.tile)}}function fb(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)fb(i,e)}}function Y6(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function YR(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=ER(t.focusNode,t.focusOffset),r=RR(t.focusNode,t.focusOffset),o=i||r;if(r&&i&&r.node!=i.node){let u=hn.get(r.node);if(!u||u.isText()&&u.text!=r.node.nodeValue)o=r;else if(n.docView.lastCompositionAfterCursor){let f=hn.get(i.node);!f||f.isText()&&f.text!=i.node.nodeValue||(o=r)}}if(n.docView.lastCompositionAfterCursor=o!=i,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function W6(n,e,t){let i=YR(n,t);if(!i)return null;let{node:r,from:o,to:a}=i,u=r.nodeValue;if(/[\n\r]/.test(u)||n.state.doc.sliceString(i.from,i.to)!=u)return null;let f=e.invertedDesc;return{range:new ds(f.mapPos(o),f.mapPos(a),o,a),text:r}}function X6(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let $6=class{constructor(){this.changes=[]}compareRange(e,t){ac(e,t,this.changes)}comparePoint(e,t){ac(e,t,this.changes)}boundChange(e){ac(e,e,this.changes)}};function Z6(n,e,t){let i=new $6;return Ct.compare(n,e,t,i),i.changes}class J6{constructor(){this.changes=[]}compareRange(e,t){ac(e,t,this.changes)}comparePoint(){}boundChange(e){ac(e,e,this.changes)}}function eI(n,e,t){let i=new J6;return Ct.compare(n,e,t,i),i.changes}function tI(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function nI(n,e){let t=!1;return e&&n.iterChangedRanges((i,r)=>{i<e.to&&r>e.from&&(t=!0)}),t}class Gy extends Hf{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 iI(n,e,t=1){let i=n.charCategorizer(e),r=n.doc.lineAt(e),o=e-r.from;if(r.length==0)return Se.cursor(e);o==0?t=1:o==r.length&&(t=-1);let a=o,u=o;t<0?a=ii(r.text,o,!1):u=ii(r.text,o);let f=i(r.text.slice(a,u));for(;a>0;){let d=ii(r.text,a,!1);if(i(r.text.slice(d,a))!=f)break;a=d}for(;u<r.length;){let d=ii(r.text,u);if(i(r.text.slice(u,d))!=f)break;u=d}return Se.undirectionalRange(a+r.from,u+r.from)}function sI(n,e,t,i,r){let o=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let u=n.viewState.heightOracle.textHeight,f=Math.floor((r-t.top-(n.defaultLineHeight-u)*.5)/u);o+=f*n.viewState.heightOracle.lineLength}let a=n.state.sliceDoc(t.from,t.to);return t.from+h6(a,o,n.state.tabSize)}function rI(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let r;for(let o of i.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!r||o.type==Di.Text&&(r.type!=o.type||(t<0?o.from<e:o.to>e)))&&(r=o)}}return r||i}return i}function lI(n,e,t,i){let r=rI(n,e.head,e.assoc||-1),o=!i||r.type!=Di.Text||!(n.lineWrapping||r.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(o){let a=n.dom.getBoundingClientRect(),u=n.textDirectionAt(r.from),f=n.posAtCoords({x:t==(u==xn.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(f!=null)return Se.cursor(f,t?-1:1)}return Se.cursor(t?r.to:r.from,t?-1:1)}function mk(n,e,t,i){let r=n.state.doc.lineAt(e.head),o=n.bidiSpans(r),a=n.textDirectionAt(r.from);for(let u=e,f=null;;){let d=D6(r,o,a,u,t),p=DR;if(!d){if(r.number==(t?n.state.doc.lines:1))return u;p=`
|
|
206
|
-
`,r=n.state.doc.line(r.number+(t?1:-1)),o=n.bidiSpans(r),d=n.visualLineSide(r,!t)}if(f){if(!f(p))return u}else{if(!i)return d;f=i(p)}u=d}}function oI(n,e,t){let i=n.state.charCategorizer(e),r=i(t);return o=>{let a=i(o);return r==Pr.Space&&(r=a),r==a}}function aI(n,e,t,i){let r=e.head,o=t?1:-1;if(r==(t?n.state.doc.length:0))return Se.cursor(r,e.assoc);let a=e.goalColumn,u,f=n.contentDOM.getBoundingClientRect(),d=n.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),p=n.documentTop;if(d)a==null&&(a=d.left-f.left),u=o<0?d.top:d.bottom;else{let S=n.viewState.lineBlockAt(r);a==null&&(a=Math.min(f.right-f.left,n.defaultCharacterWidth*(r-S.from))),u=(o<0?S.top:S.bottom)+p}let g=f.left+a,b=n.viewState.heightOracle.textHeight>>1,v=i??b;for(let S=0;;S+=b){let w=u+(v+S)*o,E=hb(n,{x:g,y:w},!1,o);if(t?w>f.bottom:w<f.top)return Se.cursor(E.pos,E.assoc);let k=n.coordsAtPos(E.pos,E.assoc),R=k?(k.top+k.bottom)/2:0;if(!k||(t?R>u:R<u))return Se.cursor(E.pos,E.assoc,void 0,a)}}function rf(n,e,t){for(;;){let i=0;for(let r of n)r.between(e-1,e+1,(o,a,u)=>{if(e>o&&e<a){let f=i||t||(e-o<a-e?-1:1);e=f<0?o:a,i=f}});if(!i)return e}}function WR(n,e){let t=null;for(let i=0;i<e.ranges.length;i++){let r=e.ranges[i],o=null;if(r.empty){let a=rf(n,r.from,0);a!=r.from&&(o=Se.cursor(a,-1))}else{let a=rf(n,r.from,-1),u=rf(n,r.to,1);(a!=r.from||u!=r.to)&&(r.undirectional?o=Se.undirectionalRange(r.from,r.to):o=Se.range(r.from==r.anchor?a:u,r.from==r.head?a:u))}o&&(t||(t=e.ranges.slice()),t[i]=o)}return t?Se.create(t,e.mainIndex):e}function Qy(n,e,t){let i=rf(n.state.facet(Uf).map(r=>r(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:Se.cursor(i,i<t.from?1:-1)}class er{constructor(e,t){this.pos=e,this.assoc=t}}function hb(n,e,t,i){let r=n.contentDOM.getBoundingClientRect(),o=r.top+n.viewState.paddingTop,{x:a,y:u}=e,f=u-o,d;for(;;){if(f<0)return new er(0,1);if(f>n.viewState.docHeight)return new er(n.state.doc.length,-1);if(d=n.elementAtHeight(f),i==null)break;if(d.type==Di.Text){if(i<0?d.to<n.viewport.from:d.from>n.viewport.to)break;let b=n.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(b&&(i<0?b.top<=f+o:b.bottom>=f+o))break}let g=n.viewState.heightOracle.textHeight/2;f=i>0?d.bottom+g:d.top-g}if(n.viewport.from>=d.to||n.viewport.to<=d.from){if(t)return null;if(d.type==Di.Text){let g=sI(n,r,d,a,u);return new er(g,g==d.from?1:-1)}}if(d.type!=Di.Text)return f<(d.top+d.bottom)/2?new er(d.from,1):new er(d.to,-1);let p=n.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=n.docView.lineAt(d.from,-2)),new cI(n,a,u,n.textDirectionAt(d.from)).scanTile(p,d.from)}class cI{constructor(e,t,i,r){this.view=e,this.x=t,this.y=i,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[tr.find(r,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[tr.find(r,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:r}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from<t)}scan(e,t,i=!1){let r=0,o=e.length-1,a=new Set,u=this.bidiIn(e[0],e[o]),f,d,p=-1,g=1e9,b;e:for(;r<o;){let S=o-r,w=r+o>>1;t:if(a.has(w)){let k=r+Math.floor(Math.random()*S);for(let R=0;R<S;R++){if(!a.has(k)){w=k;break t}k++,k==o&&(k=r)}break e}a.add(w);let E=t(w);if(E)for(let k=0;k<E.length;k++){let R=E[k],N=0;if(!(R.width==0&&E.length>1)){if(R.bottom<this.y)(!f||f.bottom<R.bottom)&&(f=R),N=1;else if(R.top>this.y)(!d||d.top>R.top)&&(d=R),N=-1;else{let T=R.left>this.x?this.x-R.left:R.right<this.x?this.x-R.right:0,B=Math.abs(T);B<g&&(p=w,g=B,b=R),T&&(N=T<0==(this.baseDir==xn.LTR)?-1:1)}N==-1&&(!u||this.baseDirAt(e[w],1))?o=w:N==1&&(!u||this.baseDirAt(e[w+1],-1))&&(r=w+1)}}}if(!b){if(!d&&!f)return{i:e[0],after:!1};let S=f&&(!d||this.y-f.bottom<d.top-this.y)?f:d;return this.y=(S.top+S.bottom)/2,this.scan(e,t,!0)}if(g&&!i){let{top:S,bottom:w}=b;if(f&&f.bottom>(S+S+w)/3)return this.y=f.bottom-1,this.scan(e,t,!0);if(d&&d.top<(S+w+w)/3)return this.y=d.top+1,this.scan(e,t,!0)}let v=(u?this.dirAt(e[p],1):this.baseDir)==xn.LTR;return{i:p,after:this.x>(b.left+b.right)/2==v}}scanText(e,t){let i=[];for(let o=0;o<e.length;o=ii(e.text,o))i.push(t+o);i.push(t+e.length);let r=this.scan(i,o=>{let a=i[o]-t,u=i[o+1]-t;return bf(e.dom,a,u).getClientRects()});return r.after?new er(i[r.i+1],-1):new er(i[r.i],1)}scanTile(e,t){if(!e.length)return new er(t,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,t);if(u.isComposite())return this.scanTile(u,t)}let i=[t];for(let u=0,f=t;u<e.children.length;u++)i.push(f+=e.children[u].length);let r=this.scan(i,u=>{let f=e.children[u];return f.flags&48?null:(f.dom.nodeType==1?f.dom:bf(f.dom,0,f.length)).getClientRects()}),o=e.children[r.i],a=i[r.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):r.after?new er(i[r.i+1],-1):new er(a,1)}}const $a="";class uI{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(wt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=$a}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let r=e;;){this.findPointBefore(i,r);let o=this.text.length;this.readNode(r);let a=hn.get(r),u=r.nextSibling;if(u==t){a!=null&&a.breakAfter&&!u&&i!=this.view.contentDOM&&this.lineBreak();break}let f=hn.get(u);(a&&f?a.breakAfter:(a?a.breakAfter:mp(r))||mp(u)&&(r.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>o)&&!hI(u,t)&&this.lineBreak(),r=u}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,a=1,u;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(u=r.exec(t))&&(o=u.index,a=u[0].length),this.append(t.slice(i,o<0?t.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=a-1);i=o+a}}readNode(e){let t=hn.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(fI(e,i.node,i.offset)?t:0))}}function fI(n,e,t){for(;;){if(!e||t<Kr(e))return!1;if(e==n)return!0;t=to(e)+1,e=e.parentNode}}function hI(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let i=hn.get(n);if(!(i!=null&&i.isWidget()))return!1;i&&(t||(t=[])).push(i)}if(t)for(let i of t){let r=i.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class gk{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class dI{constructor(e,t,i,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:a}=e.docView,u=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=XR(e.docView.tile,t,i,0))){let f=o||a?[]:mI(e),d=new uI(f,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=gI(f,this.bounds.from)}else{let f=e.observer.selectionRange,d=o&&o.node==f.focusNode&&o.offset==f.focusOffset||!lb(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),p=a&&a.node==f.anchorNode&&a.offset==f.anchorOffset||!lb(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),g=e.viewport;if((Be.ios||Be.chrome)&&d!=p&&Math.min(d,p)<=u.main.from&&Math.max(d,p)>=u.main.to&&(g.from>0||g.to<e.state.doc.length)){let b=Math.min(d,p),v=Math.max(d,p),S=g.from-b,w=g.to-v;(S==0||S==1||b==0)&&(w==0||w==-1||v==e.state.doc.length)&&(d=0,p=e.state.doc.length)}if(e.inputState.composing>-1&&u.ranges.length>1)this.newSel=u.replaceRange(Se.range(p,d));else if(e.lineWrapping&&p==d&&!(u.main.empty&&u.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let b=e.coordsAtPos(d,-1),v=0;b&&(v=e.inputState.lastTouchY<=b.bottom?-1:1),this.newSel=Se.create([Se.cursor(d,v)])}else this.newSel=Se.single(p,d)}}}function XR(n,e,t,i){if(n.isComposite()){let r=-1,o=-1,a=-1,u=-1;for(let f=0,d=i,p=i;f<n.children.length;f++){let g=n.children[f],b=d+g.length;if(d<e&&b>t)return XR(g,e,t,d);if(b>=e&&r==-1&&(r=f,o=d),d>t&&g.dom.parentNode==n.dom){a=f,u=p;break}p=b,d=b+g.breakAfter}return{from:o,to:u<0?i+n.length:u,startDOM:(r?n.children[r-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:a<n.children.length&&a>=0?n.children[a].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function $R(n,e){let t,{newSel:i}=e,{state:r}=n,o=r.selection.main,a=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,d=o.from,p=null;(a===8||Be.android&&e.text.length<f-u)&&(d=o.to,p="end");let g=r.doc.sliceString(u,f,$a),b,v;!o.empty&&o.from>=u&&o.to<=f&&(e.typeOver||g!=e.text)&&g.slice(0,o.from-u)==e.text.slice(0,o.from-u)&&g.slice(o.to-u)==e.text.slice(b=e.text.length-(g.length-(o.to-u)))?t={from:o.from,to:o.to,insert:kt.of(e.text.slice(o.from-u,b).split($a))}:(v=ZR(g,e.text,d-u,p))&&(Be.chrome&&a==13&&v.toB==v.from+2&&e.text.slice(v.from,v.toB)==$a+$a&&v.toB--,t={from:u+v.from,to:u+v.toA,insert:kt.of(e.text.slice(v.from,v.toB).split($a))})}else i&&(!n.hasFocus&&r.facet(Ir)||vp(i,o))&&(i=null);if(!t&&!i)return!1;if((Be.mac||Be.android)&&t&&t.from==t.to&&t.from==o.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=Se.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:kt.of([t.insert.toString().replace("."," ")])}):r.doc.lineAt(o.from).to<o.to&&n.docView.lineHasWidget(o.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:o.from,to:o.to,insert:r.toText(n.inputState.insertingText)}:Be.chrome&&t&&t.from==t.to&&t.from==o.head&&t.insert.toString()==`
|
|
207
|
-
`&&n.lineWrapping&&(i&&(i=Se.single(i.main.anchor-1,i.main.head-1)),t={from:o.from,to:o.to,insert:kt.of([" "])}),t)return Lv(n,t,i,a);if(i&&!vp(i,o)){let u=!1,f="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(u=!0),f=n.inputState.lastSelectionOrigin,f=="select.pointer"&&(i=WR(r.facet(Uf).map(d=>d(n)),i))),n.dispatch({selection:i,scrollIntoView:u,userEvent:f}),!0}else return!1}function Lv(n,e,t,i=-1){if(Be.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(Be.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&cc(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&cc(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&cc(n.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let a,u=()=>a||(a=pI(n,e,t));return n.state.facet(IR).some(f=>f(n,e.from,e.to,o,u))||n.dispatch(u()),!0}function pI(n,e,t){let i,r=n.state,o=r.selection.main,a=-1;if(e.from==e.to&&e.from<o.from||e.from>o.to){let f=e.from<o.from?-1:1,d=f<0?o.from:o.to,p=rf(r.facet(Uf).map(g=>g(n)),d,f);e.from==p&&(a=p)}if(a>-1)i={changes:e,selection:Se.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let f=o.from<e.from?r.sliceDoc(o.from,e.from):"",d=o.to>e.to?r.sliceDoc(e.to,o.to):"";i=r.replaceSelection(n.state.toText(f+e.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let f=r.changes(e),d=t&&t.main.to<=f.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let p=n.state.sliceDoc(e.from,e.to),g,b=t&&YR(n,t.main.head);if(b){let S=e.insert.length-(e.to-e.from);g={from:b.from,to:b.to-S}}else g=n.state.doc.lineAt(o.head);let v=o.to-e.to;i=r.changeByRange(S=>{if(S.from==o.from&&S.to==o.to)return{changes:f,range:d||S.map(f)};let w=S.to-v,E=w-p.length;if(n.state.sliceDoc(E,w)!=p||w>=g.from&&E<=g.to)return{range:S};let k=r.changes({from:E,to:w,insert:e.insert}),R=S.to-o.to;return{changes:k,range:d?Se.range(Math.max(0,d.anchor+R),Math.max(0,d.head+R)):S.map(k)}})}else i={changes:f,selection:d&&r.selection.replaceRange(d)}}let u="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,u+=".compose",n.inputState.compositionFirstChange&&(u+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:u,scrollIntoView:!0})}function ZR(n,e,t,i){let r=Math.min(n.length,e.length),o=0;for(;o<r&&n.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&n.length==e.length)return null;let a=n.length,u=e.length;for(;a>0&&u>0&&n.charCodeAt(a-1)==e.charCodeAt(u-1);)a--,u--;if(i=="end"){let f=Math.max(0,o-Math.min(a,u));t-=a+f-o}if(a<o&&n.length<e.length){let f=t<=o&&t>=a?o-t:0;o-=f,u=o+(u-a),a=o}else if(u<o){let f=t<=o&&t>=u?o-t:0;o-=f,a=o+(a-u),u=o}return{from:o,toA:a,toB:u}}function mI(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:o}=n.observer.selectionRange;return t&&(e.push(new gk(t,i)),(r!=t||o!=i)&&e.push(new gk(r,o))),e}function gI(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?Se.single(t+e,i+e):null}function vp(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class yI{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,Be.safari&&e.contentDOM.addEventListener("input",()=>null),Be.gecko&&jI(e.contentDOM.ownerDocument)}handleEvent(e){!EI(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=vI(e),i=this.handlers,r=this.view.contentDOM;for(let o in t)if(o!="scroll"){let a=!t[o].handlers.length,u=i[o];u&&a!=!u.handlers.length&&(r.removeEventListener(o,this.handleEvent),u=null),u||r.addEventListener(o,this.handleEvent,{passive:a})}for(let o in i)o!="scroll"&&!t[o]&&r.removeEventListener(o,this.handleEvent);this.handlers=t}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&&eT.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Be.android&&Be.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Be.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(JR.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||xI.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return t.shiftKey&&Be.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&bI(this.view.win)&&(t.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,cc(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Be.safari&&!Be.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 bI(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function yk(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(r){nr(t.state,r)}}}function vI(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let r=i.spec,o=r&&r.plugin.domEventHandlers,a=r&&r.plugin.domEventObservers;if(o)for(let u in o){let f=o[u];f&&t(u).handlers.push(yk(i.value,f))}if(a)for(let u in a){let f=a[u];f&&t(u).observers.push(yk(i.value,f))}}for(let i in js)t(i).handlers.push(js[i]);for(let i in gi)t(i).observers.push(gi[i]);return e}const JR=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],xI="dthko",eT=[16,17,18,20,91,92,224,225],Cd=6;function kd(n){return Math.max(0,n)*.7+8}function SI(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class wI{constructor(e,t,i,r){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=CR(e.contentDOM),this.atoms=e.state.facet(Uf).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(wt.allowMultipleSelections)&&CI(e,t),this.dragging=AI(e,t)&&iT(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&SI(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,r=0,o=0,a=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=QR(this.view);e.clientX-f.left<=r+Cd?t=-kd(r-e.clientX):e.clientX+f.right>=a-Cd&&(t=kd(e.clientX-a)),e.clientY-f.top<=o+Cd?i=-kd(o-e.clientY):e.clientY+f.bottom>=u-Cd&&(i=kd(e.clientY-u)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=WR(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function CI(n,e){let t=n.state.facet(jR);return t.length?t[0](e):Be.mac?e.metaKey:e.ctrlKey}function kI(n,e){let t=n.state.facet(BR);return t.length?t[0](e):Be.mac?!e.altKey:!e.ctrlKey}function AI(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=gf(n.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let o=0;o<r.length;o++){let a=r[o];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function EI(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=hn.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const js=Object.create(null),gi=Object.create(null),tT=Be.ie&&Be.ie_version<15||Be.ios&&Be.webkit_version<604;function RI(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),nT(n,t.value)},50)}function nm(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function nT(n,e){e=nm(n.state,Nv,e);let{state:t}=n,i,r=1,o=t.toText(e),a=o.lines==t.selection.ranges.length;if(db!=null&&t.selection.ranges.every(f=>f.empty)&&db==o.toString()){let f=-1;i=t.changeByRange(d=>{let p=t.doc.lineAt(d.from);if(p.from==f)return{range:d};f=p.from;let g=t.toText((a?o.line(r++).text:e)+t.lineBreak);return{changes:{from:p.from,insert:g},range:Se.cursor(d.from+g.length)}})}else a?i=t.changeByRange(f=>{let d=o.line(r++);return{changes:{from:f.from,to:f.to,insert:d.text},range:Se.cursor(f.from+d.length)}}):i=t.replaceSelection(o);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}gi.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,Be.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};gi.wheel=gi.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};js.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);gi.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};gi.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};gi.touchend=(n,e)=>{n.inputState.touchActive=!1};js.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(LR))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=OI(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new wI(n,e,t,i)),i&&n.observer.ignore(()=>{kR(n.contentDOM);let o=n.root.activeElement;o&&!o.contains(n.contentDOM)&&o.blur()});let r=n.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function bk(n,e,t,i){if(i==1)return Se.cursor(e,t);if(i==2)return iI(n.state,e,t);{let r=n.docView.lineAt(e,t),o=n.state.doc.lineAt(r?r.posAtEnd:e),a=r?r.posAtStart:o.from,u=r?r.posAtEnd:o.to;return u<n.state.doc.length&&u==o.to&&u++,Se.undirectionalRange(a,u)}}const TI=Be.ie&&Be.ie_version<=11;let vk=null,xk=0,Sk=0;function iT(n){if(!TI)return n.detail;let e=vk,t=Sk;return vk=n,Sk=Date.now(),xk=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(xk+1)%3:1}function OI(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=iT(e),r=n.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),r=r.map(o.changes))},get(o,a,u){let f=n.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,p=bk(n,f.pos,f.assoc,i);if(t.pos!=f.pos&&!a){let g=bk(n,t.pos,t.assoc,i),b=Math.min(g.from,p.from),v=Math.max(g.to,p.to);p=b<p.from?Se.range(b,v,p.assoc):Se.range(v,b,p.assoc)}return a?r.replaceRange(r.main.extend(p.from,p.to,p.assoc)):u&&i==1&&r.ranges.length>1&&(d=MI(r,f.pos))?d:u?r.addRange(p):Se.create([p])}}}function MI(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:r}=n.ranges[t];if(i<=e&&r>=e)return Se.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}js.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let r=n.docView.tile.nearest(e.target);if(r&&r.isWidget()){let o=r.posAtStart,a=o+r.length;(o>=t.to||a<=t.from)&&(t=Se.undirectionalRange(o,a))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",nm(n.state,Dv,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};js.dragend=n=>(n.inputState.draggedContent=null,!1);function wk(n,e,t,i){if(t=nm(n.state,Nv,t),!t)return;let r=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=n.inputState,a=i&&o&&kI(n,e)?{from:o.from,to:o.to}:null,u={from:r,insert:t},f=n.state.changes(a?[a,u]:u);n.focus(),n.dispatch({changes:f,selection:{anchor:f.mapPos(r,-1),head:f.mapPos(r,1)},userEvent:a?"move.drop":"input.drop"}),n.inputState.draggedContent=null}js.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),r=0,o=()=>{++r==t.length&&wk(n,e,i.filter(a=>a!=null).join(n.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let u=new FileReader;u.onerror=o,u.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(i[a]=u.result),o()},u.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return wk(n,e,i,!0),!0}return!1};js.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=tT?null:e.clipboardData;return t?(nT(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(RI(n),!1)};function NI(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function DI(n){let e=[],t=[],i=!1;for(let r of n.selection.ranges)r.empty||(e.push(n.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:o}of n.selection.ranges){let a=n.doc.lineAt(o);a.number>r&&(e.push(a.text),t.push({from:a.from,to:Math.min(n.doc.length,a.to+1)})),r=a.number}i=!0}return{text:nm(n,Dv,e.join(n.lineBreak)),ranges:t,linewise:i}}let db=null;js.copy=js.cut=(n,e)=>{if(!tf(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:r}=DI(n.state);if(!t&&!r)return!1;db=r?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=tT?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(NI(n,t),!1)};const sT=fo.define();function rT(n,e){let t=[];for(let i of n.facet(PR)){let r=i(n,e);r&&t.push(r)}return t.length?n.update({effects:t,annotations:sT.of(!0)}):null}function lT(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=rT(n.state,e);t?n.dispatch(t):n.update([])}},10)}gi.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),lT(n)};gi.blur=n=>{n.observer.clearSelectionRange(),lT(n)};gi.compositionstart=gi.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};gi.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Be.chrome&&Be.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};gi.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};js.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let u=a[0],f=n.posAtDOM(u.startContainer,u.startOffset),d=n.posAtDOM(u.endContainer,u.endOffset);return Lv(n,{from:f,to:d,insert:n.state.toText(o)},null),!0}}let r;if(Be.chrome&&Be.android&&(r=JR.find(o=>o.inputType==e.inputType))&&(n.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return Be.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),Be.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>gi.compositionend(n,e),20),!1};const Ck=new Set;function jI(n){Ck.has(n)||(Ck.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const kk=["pre-wrap","normal","pre-line","break-spaces"];let jc=!1;function Ak(){jc=!1}class BI{constructor(e){this.lineWrapping=e,this.doc=kt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}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 kk.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let r=e[i];r<0?i++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,i,r,o,a){let u=kk.indexOf(e)>-1,f=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=t,this.charWidth=i,this.textHeight=r,this.lineLength=o,f){this.heightSamples={};for(let d=0;d<a.length;d++){let p=a[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return f}}class LI{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Rs{constructor(e,t,i,r,o){this.from=e,this.length=t,this.top=i,this.height=r,this._content=o}get type(){return typeof this._content=="number"?Di.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 sa?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Rs(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Yt=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(Yt||(Yt={}));const Fd=.001;class mi{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}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)>Fd&&(jc=!0),this.height=e)}replace(e,t,i){return mi.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,r){let o=this,a=i.doc;for(let u=r.length-1;u>=0;u--){let{fromA:f,toA:d,fromB:p,toB:g}=r[u],b=o.lineAt(f,Yt.ByPosNoHeight,i.setDoc(t),0,0),v=b.to>=d?b:o.lineAt(d,Yt.ByPosNoHeight,i,0,0);for(g+=v.to-d,d=v.to;u>0&&b.from<=r[u-1].toA;)f=r[u-1].fromA,p=r[u-1].fromB,u--,f<b.from&&(b=o.lineAt(f,Yt.ByPosNoHeight,i,0,0));p+=b.from-f,f=b.from;let S=zv.build(i.setDoc(a),e,p,g);o=xp(o,o.replace(f,d,S))}return o.updateHeight(i,0)}static empty(){return new Gi(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,r=0,o=0;for(;;)if(t==i)if(r>o*2){let u=e[t-1];u.break?e.splice(--t,1,u.left,null,u.right):e.splice(--t,1,u.left,u.right),i+=1+u.break,r-=u.size}else if(o>r*2){let u=e[i];u.break?e.splice(i,1,u.left,null,u.right):e.splice(i,1,u.left,u.right),i+=2+u.break,o-=u.size}else break;else if(r<o){let u=e[t++];u&&(r+=u.size)}else{let u=e[--i];u&&(o+=u.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new II(mi.of(e.slice(0,t)),a,mi.of(e.slice(i)))}}function xp(n,e){return n==e?n:(n.constructor!=e.constructor&&(jc=!0),e)}mi.prototype.size=1;const zI=Gt.replace({});class oT extends mi{constructor(e,t,i){super(e,t),this.deco=i,this.spaceAbove=0}mainBlock(e,t){return new Rs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,i,r){return this.spaceAbove&&e<i+this.spaceAbove?new Rs(r,0,i,this.spaceAbove,zI):this.mainBlock(i,r)}lineAt(e,t,i,r,o){let a=this.mainBlock(r,o);return this.spaceAbove?this.blockAt(0,i,r,o).join(a):a}forEachLine(e,t,i,r,o,a){e<=o+this.length&&t>=o&&a(this.lineAt(0,Yt.ByPos,i,r,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Gi extends oT{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Rs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let r=i[0];return i.length==1&&(r instanceof Gi||r instanceof Yn&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Yn?r=new Gi(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):mi.of(i)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(i||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 Yn extends mi{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,o=r-i+1,a,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*o);a=f/o,this.length>o+1&&(u=(this.height-f)/(this.length-o-1))}else a=this.height/o;return{firstLine:i,lastLine:r,perLine:a,perChar:u}}blockAt(e,t,i,r){let{firstLine:o,lastLine:a,perLine:u,perChar:f}=this.heightMetrics(t,r);if(t.lineWrapping){let d=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),p=t.doc.lineAt(d),g=u+p.length*f,b=Math.max(i,e-g/2);return new Rs(p.from,p.length,b,g,0)}else{let d=Math.max(0,Math.min(a-o,Math.floor((e-i)/u))),{from:p,length:g}=t.doc.line(o+d);return new Rs(p,g,i+u*d,u,0)}}lineAt(e,t,i,r,o){if(t==Yt.ByHeight)return this.blockAt(e,i,r,o);if(t==Yt.ByPosNoHeight){let{from:v,to:S}=i.doc.lineAt(e);return new Rs(v,S-v,0,0,0)}let{firstLine:a,perLine:u,perChar:f}=this.heightMetrics(i,o),d=i.doc.lineAt(e),p=u+d.length*f,g=d.number-a,b=r+u*g+f*(d.from-o-g);return new Rs(d.from,d.length,Math.max(r,Math.min(b,r+this.height-p)),p,0)}forEachLine(e,t,i,r,o,a){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:u,perLine:f,perChar:d}=this.heightMetrics(i,o);for(let p=e,g=r;p<=t;){let b=i.doc.lineAt(p);if(p==e){let S=b.number-u;g+=f*S+d*(e-o-S)}let v=f+d*b.length;a(new Rs(b.from,b.length,g,v,0)),g+=v,p=b.to+1}}replace(e,t,i){let r=this.length-t;if(r>0){let o=i[i.length-1];o instanceof Yn?i[i.length-1]=new Yn(o.length+r):i.push(null,new Yn(r-1))}if(e>0){let o=i[0];o instanceof Yn?i[0]=new Yn(e+o.length):i.unshift(new Yn(e-1),null)}return mi.of(i)}decomposeLeft(e,t){t.push(new Yn(e-1),null)}decomposeRight(e,t){t.push(null,new Yn(this.length-e-1))}updateHeight(e,t=0,i=!1,r){let o=t+this.length;if(r&&r.from<=t+this.length&&r.more){let a=[],u=Math.max(t,r.from),f=-1;for(r.from>t&&a.push(new Yn(r.from-t-1).updateHeight(e,t));u<=o&&r.more;){let p=e.doc.lineAt(u).length;a.length&&a.push(null);let g=r.heights[r.index++],b=0;g<0&&(b=-g,g=r.heights[r.index++]),f==-1?f=g:Math.abs(g-f)>=Fd&&(f=-2);let v=new Gi(p,g,b);v.outdated=!1,a.push(v),u+=p+1}u<=o&&a.push(null,new Yn(o-u).updateHeight(e,u));let d=mi.of(a);return(f<0||Math.abs(d.height-this.height)>=Fd||Math.abs(f-this.heightMetrics(e,t).perLine)>=Fd)&&(jc=!0),xp(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class II extends mi{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,r){let o=i+this.left.height;return e<o?this.left.blockAt(e,t,i,r):this.right.blockAt(e,t,o,r+this.left.length+this.break)}lineAt(e,t,i,r,o){let a=r+this.left.height,u=o+this.left.length+this.break,f=t==Yt.ByHeight?e<a:e<u,d=f?this.left.lineAt(e,t,i,r,o):this.right.lineAt(e,t,i,a,u);if(this.break||(f?d.to<u:d.from>u))return d;let p=t==Yt.ByPosNoHeight?Yt.ByPosNoHeight:Yt.ByPos;return f?d.join(this.right.lineAt(u,p,i,a,u)):this.left.lineAt(u,p,i,r,o).join(d)}forEachLine(e,t,i,r,o,a){let u=r+this.left.height,f=o+this.left.length+this.break;if(this.break)e<f&&this.left.forEachLine(e,t,i,r,o,a),t>=f&&this.right.forEachLine(e,t,i,u,f,a);else{let d=this.lineAt(f,Yt.ByPos,i,r,o);e<d.from&&this.left.forEachLine(e,d.from-1,i,r,o,a),d.to>=e&&d.from<=t&&a(d),t>d.to&&this.right.forEachLine(d.to+1,t,i,u,f,a)}}replace(e,t,i){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,i));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let u of i)o.push(u);if(e>0&&Ek(o,a-1),t<this.length){let u=o.length;this.decomposeRight(t,o),Ek(o,u)}return mi.of(o)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,r=i+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?mi.of(this.break?[e,null,t]:[e,t]):(this.left=xp(this.left,e),this.right=xp(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,r){let{left:o,right:a}=this,u=t+o.length+this.break,f=null;return r&&r.from<=t+o.length&&r.more?f=o=o.updateHeight(e,t,i,r):o.updateHeight(e,t,i),r&&r.from<=u+a.length&&r.more?f=a=a.updateHeight(e,u,i,r):a.updateHeight(e,u,i),f?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Ek(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof Yn&&(i=n[e+1])instanceof Yn&&n.splice(e-1,3,new Yn(t.length+1+i.length))}const PI=5;class zv{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Gi?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Gi(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let r=i.widget?i.widget.estimatedHeight:0,o=i.widget?i.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new oT(a,r,i)):(a||o||r>=PI)&&this.addLineDeco(r,o,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Gi(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new Yn(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Gi)return e;let t=new Gi(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Gi)&&!this.isCovered?this.nodes.push(new Gi(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let r of this.nodes)r instanceof Gi&&r.updateHeight(this.oracle,i),i+=r?r.length:1;return this.nodes}static build(e,t,i,r){let o=new zv(i,e);return Ct.spans(t,i,r,o,0),o.finish(i)}}function HI(n,e,t){let i=new VI;return Ct.compare(n,e,t,i,0),i.changes}class VI{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,r){(e<t||i&&i.heightRelevant||r&&r.heightRelevant)&&ac(e,t,this.changes,5)}}function _I(n,e){let t=n.getBoundingClientRect(),i=n.ownerDocument,r=i.defaultView||window,o=Math.max(0,t.left),a=Math.min(r.innerWidth,t.right),u=Math.max(0,t.top),f=Math.min(r.innerHeight,t.bottom);for(let d=n.parentNode;d&&d!=i.body;)if(d.nodeType==1){let p=d,g=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&g.overflow!="visible"){let b=p.getBoundingClientRect();o=Math.max(o,b.left),a=Math.min(a,b.right),u=Math.max(u,b.top),f=Math.min(d==n.parentNode?r.innerHeight:f,b.bottom)}d=g.position=="absolute"||g.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-t.left,right:Math.max(o,a)-t.left,top:u-(t.top+e),bottom:Math.max(u,f)-(t.top+e)}}function UI(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function qI(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Ky{constructor(e,t,i,r){this.from=e,this.to=t,this.size=i,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let r=e[i],o=t[i];if(r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1}return!0}draw(e,t){return Gt.replace({widget:new FI(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class FI extends Hf{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Rk{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Tk,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=xn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=t.facet(jv).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new BI(i),this.stateDeco=Ok(t),this.heightMap=mi.empty().applyChanges(this.stateDeco,kt.empty,this.heightOracle.setDoc(t.doc),[new ds(0,0,0,t.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Gt.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let r=i?t.head:t.anchor;if(!e.some(({from:o,to:a})=>r>=o&&r<=a)){let{from:o,to:a}=this.lineBlockAt(r);e.push(new Ad(o,a))}}return this.viewports=e.sort((i,r)=>i.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Tk:new Iv(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(Ku(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=Ok(this.state);let r=e.changedRanges,o=ds.extendWithRanges(r,HI(i,this.stateDeco,e?e.changes:jn.empty(this.state.doc.length))),a=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Ak(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||jc)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let f=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<f.from||t.range.head>f.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));let d=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(B6)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),r=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?xn.RTL:xn.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",u=t.getBoundingClientRect(),f=a||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let d=0,p=0;if(u.width&&u.height){let{scaleX:B,scaleY:L}=wR(t,u);(B>.005&&Math.abs(this.scaleX-B)>.005||L>.005&&Math.abs(this.scaleY-L)>.005)&&(this.scaleX=B,this.scaleY=L,d|=16,a=f=!0)}let g=(parseInt(i.paddingTop)||0)*this.scaleY,b=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=b)&&(this.paddingTop=g,this.paddingBottom=b,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=CR(this.view.contentDOM,!1).y;v!=this.scrollParent&&(this.scrollParent=v,this.scrollAnchorHeight=-1,this.scrollOffset=0);let S=this.getScrollOffset();this.scrollOffset!=S&&(this.scrollAnchorHeight=-1,this.scrollOffset=S),this.scrolledToBottom=AR(this.scrollParent||e.win);let w=(this.printing?qI:_I)(t,this.paddingTop),E=w.top-this.pixelViewport.top,k=w.bottom-this.pixelViewport.bottom;this.pixelViewport=w;let R=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(R!=this.inView&&(this.inView=R,R&&(f=!0)),!this.inView&&!this.scrollTarget&&!UI(e.dom))return 0;let N=u.width;if((this.contentDOMWidth!=N||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),f){let B=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(B)&&(a=!0),a||r.lineWrapping&&Math.abs(N-this.contentDOMWidth)>r.charWidth){let{lineHeight:L,charWidth:D,textHeight:j}=e.docView.measureTextSize();a=L>0&&r.refresh(o,L,D,j,Math.max(5,N/D),B),a&&(e.docView.minWidth=0,d|=16)}E>0&&k>0?p=Math.max(E,k):E<0&&k<0&&(p=Math.min(E,k)),Ak();for(let L of this.viewports){let D=L.from==this.viewport.from?B:e.docView.measureVisibleLineHeights(L);this.heightMap=(a?mi.empty().applyChanges(this.stateDeco,kt.empty,this.heightOracle,[new ds(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new LI(L.from,D))}jc&&(d|=2)}let T=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return T&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||T)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:u}=this,f=new Ad(r.lineAt(a-i*1e3,Yt.ByHeight,o,0,0).from,r.lineAt(u+(1-i)*1e3,Yt.ByHeight,o,0,0).to);if(t){let{head:d}=t.range;if(d<f.from||d>f.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=r.lineAt(d,Yt.ByPos,o,0,0),b;t.y=="center"?b=(g.top+g.bottom)/2-p/2:t.y=="start"||t.y=="nearest"&&d<f.from?b=g.top:b=g.bottom-p,f=new Ad(r.lineAt(b-1e3/2,Yt.ByHeight,o,0,0).from,r.lineAt(b+p+1e3/2,Yt.ByHeight,o,0,0).to)}}return f}mapViewport(e,t){let i=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new Ad(this.heightMap.lineAt(i,Yt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Yt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Yt.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,Yt.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:u}=this;return(e==0||r<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||o>=u+Math.max(10,Math.min(i,250)))&&r>a-2*1e3&&o<u+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let r of e)t.touchesRange(r.from,r.to)||i.push(new Ky(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,r=i?1e4:2e3,o=r>>1,a=r<<1;if(this.defaultTextDirection!=xn.LTR&&!i)return[];let u=[],f=(p,g,b,v)=>{if(g-p<o)return;let S=this.state.selection.main,w=[S.from];S.empty||w.push(S.to);for(let k of w)if(k>p&&k<g){f(p,k-10,b,v),f(k+10,g,b,v);return}let E=QI(e,k=>k.from>=b.from&&k.to<=b.to&&Math.abs(k.from-p)<o&&Math.abs(k.to-g)<o&&!w.some(R=>k.from<R&&k.to>R));if(!E){if(g<b.to&&t&&i&&t.visibleRanges.some(N=>N.from<=g&&N.to>=g)){let N=t.moveToLineBoundary(Se.cursor(g),!1,!0).head;N>p&&(g=N)}let k=this.gapSize(b,p,g,v),R=i||k<2e6?k:2e6;E=new Ky(p,g,k,R)}u.push(E)},d=p=>{if(p.length<a||p.type!=Di.Text)return;let g=GI(p.from,p.to,this.stateDeco);if(g.total<a)return;let b=this.scrollTarget?this.scrollTarget.range.head:null,v,S;if(i){let w=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,E,k;if(b!=null){let R=Rd(g,b),N=((this.visibleBottom-this.visibleTop)/2+w)/p.height;E=R-N,k=R+N}else E=(this.visibleTop-p.top-w)/p.height,k=(this.visibleBottom-p.top+w)/p.height;v=Ed(g,E),S=Ed(g,k)}else{let w=g.total*this.heightOracle.charWidth,E=r*this.heightOracle.charWidth,k=0;if(w>2e6)for(let L of e)L.from>=p.from&&L.from<p.to&&L.size!=L.displaySize&&L.from*this.heightOracle.charWidth+k<this.pixelViewport.left&&(k=L.size-L.displaySize);let R=this.pixelViewport.left+k,N=this.pixelViewport.right+k,T,B;if(b!=null){let L=Rd(g,b),D=((N-R)/2+E)/w;T=L-D,B=L+D}else T=(R-E)/w,B=(N+E)/w;v=Ed(g,T),S=Ed(g,B)}v>p.from&&f(p.from,v,p,g),S<p.to&&f(S,p.to,p,g)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return u}gapSize(e,t,i,r){let o=Rd(r,i)-Rd(r,t);return this.heightOracle.lineWrapping?e.height*o:r.total*this.heightOracle.charWidth*o}updateLineGaps(e){Ky.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Gt.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];Ct.spans(t,this.viewport.from,this.viewport.to,{span(o,a){i.push({from:o,to:a})},point(){}},20);let r=0;if(i.length!=this.visibleRanges.length)r=12;else for(let o=0;o<i.length&&!(r&8);o++){let a=this.visibleRanges[o],u=i[o];(a.from!=u.from||a.to!=u.to)&&(r|=4,e&&e.mapPos(a.from,-1)==u.from&&e.mapPos(a.to,1)==u.to||(r|=8))}return this.visibleRanges=i,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Ku(this.heightMap.lineAt(e,Yt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Ku(this.heightMap.lineAt(this.scaler.fromDOM(e),Yt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Ku(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 Ad{constructor(e,t){this.from=e,this.to=t}}function GI(n,e,t){let i=[],r=n,o=0;return Ct.spans(t,n,e,{span(){},point(a,u){a>r&&(i.push({from:r,to:a}),o+=a-r),r=u}},20),r<e&&(i.push({from:r,to:e}),o+=e-r),{total:o,ranges:i}}function Ed({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let r=0;;r++){let{from:o,to:a}=e[r],u=a-o;if(i<=u)return o+i;i-=u}}function Rd(n,e){let t=0;for(let{from:i,to:r}of n.ranges){if(e<=r){t+=e-i;break}t+=r-i}return t/n.total}function QI(n,e){for(let t of n)if(e(t))return t}const Tk={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function Ok(n){let e=n.facet(Jp).filter(i=>typeof i!="function"),t=n.facet(Bv).filter(i=>typeof i!="function");return t.length&&e.push(Ct.join(t)),e}class Iv{constructor(e,t,i){let r=0,o=0,a=0;this.viewports=i.map(({from:u,to:f})=>{let d=t.lineAt(u,Yt.ByPos,e,0,0).top,p=t.lineAt(f,Yt.ByPos,e,0,0).bottom;return r+=p-d,{from:u,to:f,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let u of this.viewports)u.domTop=a+(u.top-o)*this.scale,a=u.domBottom=u.domTop+(u.bottom-u.top),o=u.bottom}toDOM(e){for(let t=0,i=0,r=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return r+(e-i)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);i=o.bottom,r=o.domBottom}}fromDOM(e){for(let t=0,i=0,r=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return i+(e-r)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);i=o.bottom,r=o.domBottom}}eq(e){return e instanceof Iv?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Ku(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Rs(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(r=>Ku(r,e)):n._content)}const Td=We.define({combine:n=>n.join(" ")}),pb=We.define({combine:n=>n.indexOf(!0)>-1}),mb=Jl.newName(),aT=Jl.newName(),cT=Jl.newName(),uT={"&light":"."+aT,"&dark":"."+cT};function gb(n,e,t){return new Jl(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return n;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):n+" "+i}})}const KI=gb("."+mb,{"&":{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"},"&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":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"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"}},uT),YI={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Yy=Be.ie&&Be.ie_version<=11;class WI{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new w6,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Be.ie&&Be.ie_version<=11||Be.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Be.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Be.chrome&&Be.chrome_version<126)&&(this.editContext=new $I(e),e.state.facet(Ir)&&(e.contentDOM.editContext=this.editContext.editContext)),Yy&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!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((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(Ir)?i.root.activeElement!=this.dom:!tf(this.dom,r))return;let o=r.anchorNode&&i.docView.tile.nearest(r.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Be.ie&&Be.ie_version<=11||Be.android&&Be.chrome)&&!i.state.selection.main.empty&&r.focusNode&&sf(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=gf(e.root);if(!t)return!1;let i=Be.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&XI(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let r=tf(this.dom,i);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&k6(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.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,YI),Yy&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Yy&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let r=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&cc(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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 t=-1,i=-1,r=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(r=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:r}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),r=this.selectionChanged&&tf(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new dI(this.view,e,t,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,r=$R(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!vp(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=Mk(t,e.previousSibling||e.target.previousSibling,-1),r=Mk(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Ir)!=e.state.facet(Ir)&&(e.view.contentDOM.editContext=e.state.facet(Ir)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Mk(n,e,t){for(;e;){let i=hn.get(e);if(i&&i.parent==n)return i;let r=e.parentNode;e=r!=n.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function Nk(n,e){let t=e.startContainer,i=e.startOffset,r=e.endContainer,o=e.endOffset,a=n.docView.domAtPos(n.state.selection.main.anchor,1);return sf(a.node,a.offset,r,o)&&([t,i,r,o]=[r,o,t,i]),{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:o}}function XI(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return Nk(n,r)}let t=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?Nk(n,t):null}class $I{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let r=e.state.selection.main,{anchor:o,head:a}=r,u=this.toEditorPos(i.updateRangeStart),f=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:u,drifted:!1});let d=f-u>i.text.length;u==this.from&&o<this.from?u=o:f==this.to&&o>this.to&&(f=o);let p=ZR(e.state.sliceDoc(u,f),i.text,(d?r.from:r.to)-u,d?"end":null);if(!p){let b=Se.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));vp(b,r)||e.dispatch({selection:b,userEvent:"select"});return}let g={from:p.from+u,to:p.toA+u,insert:kt.of(i.text.slice(p.from,p.toB).split(`
|
|
208
|
-
`))};if((Be.mac||Be.android)&&g.from==a-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:u,to:f,insert:kt.of([i.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let b=this.to-this.from+(g.to-g.from+g.insert.length);Lv(e,g,Se.single(this.toEditorPos(i.selectionStart,b),this.toEditorPos(i.selectionEnd,b)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from<g.to&&!g.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],o=null;for(let a=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);a<u;a++){let f=e.coordsForChar(a);o=f&&new DOMRect(f.left,f.top,f.right-f.left,f.bottom-f.top)||o||new DOMRect,r.push(o)}t.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let o of i.getTextFormats()){let a=o.underlineStyle,u=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(u)){let f=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(f<d){let p=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(u)?1:2}px`;r.push(Gt.mark({attributes:{style:p}}).range(f,d))}}}e.dispatch({effects:_R.of(Gt.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let r=gf(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((o,a,u,f,d)=>{if(i)return;let p=d.length-(a-o);if(r&&a>=r.to)if(r.from==o&&r.to==a&&r.insert.eq(d)){r=this.pendingContextChange=null,t+=p,this.to+=p;return}else r=null,this.revertPending(e.state);if(o+=t,a+=t,a<=this.from)this.from+=p,this.to+=p;else if(o<this.to){if(o<this.from||a>this.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=p}t+=p}),r&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class et{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.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:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(r=>r.forEach(o=>i(o,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||C6(e.parent)||document,this.viewState=new Rk(this,e.state||wt.create(e)),e.scrollTo&&e.scrollTo.is(wd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ec).map(r=>new Uy(r));for(let r of this.plugins)r.update(this);this.observer=new WI(this),this.inputState=new yI(this),this.inputState.ensureHandlers(this.plugins),this.docView=new pk(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof zn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,r,o=this.state;for(let b of e){if(b.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=b.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,u=0,f=null;e.some(b=>b.annotation(sT))?(this.inputState.notifiedFocused=a,u=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,f=rT(o,a),f||(u=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(p=null)):this.observer.clear(),o.facet(wt.phrases)!=this.state.facet(wt.phrases))return this.setState(o);r=gp.create(this,o,e),r.flags|=u;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let b of e){if(g&&(g=g.map(b.changes)),b.scrollIntoView){let{main:v}=b.state.selection,{x:S,y:w}=this.state.facet(et.cursorScrollMargin);g=new uc(v.empty?v:Se.cursor(v.head,v.head>v.anchor?-1:1),"nearest","nearest",w,S)}for(let v of b.effects)v.is(wd)&&(g=v.value.clip(this.state))}this.viewState.update(r,g),this.bidiCache=Sp.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(Qu)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(b=>b.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Td)!=r.state.facet(Td)&&(this.viewState.mustMeasureContent=!0),(t||i||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let b of this.state.facet(ub))try{b(r)}catch(v){nr(this.state,v,"update listener")}(f||p)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),p&&!$R(this,p)&&d.force&&cc(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Rk(this,e),this.plugins=e.facet(ec).map(i=>new Uy(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new pk(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(ec),i=e.state.facet(ec);if(t!=i){let r=[];for(let o of i){let a=t.indexOf(o);if(a<0)r.push(new Uy(o));else{let u=this.plugins[a];u.mustUpdate=e,r.push(u)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){nr(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:a}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let u=0;;u++){if(a<0)if(AR(i||this.win))o=-1,a=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(r);o=v.from,a=v.top}this.updateState=1;let f=this.viewState.measure();if(!f&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(u>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];f&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(v=>{try{return v.read(this)}catch(S){return nr(this.state,S),Dk}}),g=gp.create(this,this.state,[]),b=!1;g.flags|=f,t?t.flags|=f:t=g,this.updateState=2,g.empty||(this.updatePlugins(g),this.inputState.update(g),this.updateAttrs(),b=this.docView.update(g),b&&this.docViewUpdate());for(let v=0;v<d.length;v++)if(p[v]!=Dk)try{let S=d[v];S.write&&S.write(p[v],this)}catch(S){nr(this.state,S)}if(b&&this.docView.updateSelection(!0),!g.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let S=((o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-a)/this.scaleY;if((S>1||S<-1)&&!(Be.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+S,i?i.scrollTop+=S:this.win.scrollBy(0,S),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let u of this.state.facet(ub))u(t)}get themeClasses(){return mb+" "+(this.state.facet(pb)?cT:aT)+" "+this.state.facet(Td)}updateAttrs(){let e=jk(this,UR,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ir)?"true":"false",class:"cm-content",style:`${Be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),jk(this,jv,t);let i=this.observer.ignore(()=>{let r=ak(this.contentDOM,this.contentAttrs,t),o=ak(this.dom,this.editorAttrs,e);return r||o});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let r of i.effects)if(r.is(et.announce)){t&&(this.announceDOM.textContent=""),t=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Qu);let e=this.state.facet(et.cspNonce);Jl.mount(this.root,this.styleModules.concat(KI).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Qy(this,e,mk(this,e,t,i))}moveByGroup(e,t){return Qy(this,e,mk(this,e,t,i=>oI(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),r=this.textDirectionAt(e.from),o=i[t?i.length-1:0];return Se.cursor(o.side(t,r)+e.from,o.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,i=!0){return lI(this,e,t,i)}moveVertically(e,t,i){return Qy(this,e,aI(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=hb(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),hb(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),r=this.bidiSpans(i),o=r[tr.find(r,e-i.from,-1,t)];return this.docView.coordsAt(e,t,o.dir==xn.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(HR)||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>ZI)return NR(e.length);let t=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||MR(o.isolates,i=fk(this,e))))return o.order;i||(i=fk(this,e));let r=N6(e.text,t,i);return this.bidiCache.push(new Sp(e.from,e.to,t,i,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Be.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{kR(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,t={}){var i,r,o,a;return wd.of(new uc(typeof e=="number"?Se.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(r=t.x)!==null&&r!==void 0?r:"nearest",(o=t.yMargin)!==null&&o!==void 0?o:5,(a=t.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return wd.of(new uc(Se.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ds.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ds.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Jl.newName(),r=[Td.of(i),Qu.of(gb(`.${i}`,e))];return t&&t.dark&&r.push(pb.of(!0)),r}static baseTheme(e){return kv.lowest(Qu.of(gb("."+mb,e,uT)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),r=i&&hn.get(i)||hn.get(e);return((t=r==null?void 0:r.root)===null||t===void 0?void 0:t.view)||null}}et.styleModule=Qu;et.inputHandler=IR;et.clipboardInputFilter=Nv;et.clipboardOutputFilter=Dv;et.scrollHandler=VR;et.focusChangeEffect=PR;et.perLineTextDirection=HR;et.exceptionSink=zR;et.updateListener=ub;et.editable=Ir;et.mouseSelectionStyle=LR;et.dragMovesSelection=BR;et.clickAddsSelectionRange=jR;et.decorations=Jp;et.blockWrappers=qR;et.outerDecorations=Bv;et.atomicRanges=Uf;et.bidiIsolatedRanges=FR;et.cursorScrollMargin=We.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});et.scrollMargins=GR;et.darkTheme=pb;et.cspNonce=We.define({combine:n=>n.length?n[0]:""});et.contentAttributes=jv;et.editorAttributes=UR;et.lineWrapping=et.contentAttributes.of({class:"cm-lineWrapping"});et.announce=vn.define();const ZI=4096,Dk={};class Sp{constructor(e,t,i,r,o,a){this.from=e,this.to=t,this.dir=i,this.isolates=r,this.fresh=o,this.order=a}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let i=[],r=e.length?e[e.length-1].dir:xn.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let a=e[o];a.dir==r&&!t.touchesRange(a.from,a.to)&&i.push(new Sp(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function jk(n,e,t){for(let i=n.state.facet(e),r=i.length-1;r>=0;r--){let o=i[r],a=typeof o=="function"?o(n):o;a&&Tv(a,t)}return t}const JI=Be.mac?"mac":Be.windows?"win":Be.linux?"linux":"key";function e8(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let r,o,a,u;for(let f=0;f<t.length-1;++f){const d=t[f];if(/^(cmd|meta|m)$/i.test(d))u=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))o=!0;else if(/^s(hift)?$/i.test(d))a=!0;else if(/^mod$/i.test(d))e=="mac"?u=!0:o=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(i="Alt-"+i),o&&(i="Ctrl-"+i),u&&(i="Meta-"+i),a&&(i="Shift-"+i),i}function Od(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const t8=kv.default(et.domEventHandlers({keydown(n,e){return r8(n8(e.state),n,e,"editor")}})),fT=We.define({enables:t8}),Bk=new WeakMap;function n8(n){let e=n.facet(fT),t=Bk.get(e);return t||Bk.set(e,t=s8(e.reduce((i,r)=>i.concat(r),[]))),t}let Ll=null;const i8=4e3;function s8(n,e=JI){let t=Object.create(null),i=Object.create(null),r=(a,u)=>{let f=i[a];if(f==null)i[a]=u;else if(f!=u)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,u,f,d,p)=>{var g,b;let v=t[a]||(t[a]=Object.create(null)),S=u.split(/ (?!$)/).map(k=>e8(k,e));for(let k=1;k<S.length;k++){let R=S.slice(0,k).join(" ");r(R,!0),v[R]||(v[R]={preventDefault:!0,stopPropagation:!1,run:[N=>{let T=Ll={view:N,prefix:R,scope:a};return setTimeout(()=>{Ll==T&&(Ll=null)},i8),!0}]})}let w=S.join(" ");r(w,!1);let E=v[w]||(v[w]={preventDefault:!1,stopPropagation:!1,run:((b=(g=v._any)===null||g===void 0?void 0:g.run)===null||b===void 0?void 0:b.slice())||[]});f&&E.run.push(f),d&&(E.preventDefault=!0),p&&(E.stopPropagation=!0)};for(let a of n){let u=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of u){let p=t[d]||(t[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=a;for(let b in p)p[b].run.push(v=>g(v,yb))}let f=a[e]||a.key;if(f)for(let d of u)o(d,f,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+f,a.shift,a.preventDefault,a.stopPropagation)}return t}let yb=null;function r8(n,e,t,i){yb=e;let r=g6(e),o=Z5(r,0),a=J5(o)==r.length&&r!=" ",u="",f=!1,d=!1,p=!1;Ll&&Ll.view==t&&Ll.scope==i&&(u=Ll.prefix+" ",eT.indexOf(e.keyCode)<0&&(d=!0,Ll=null));let g=new Set,b=E=>{if(E){for(let k of E.run)if(!g.has(k)&&(g.add(k),k(t)))return E.stopPropagation&&(p=!0),!0;E.preventDefault&&(E.stopPropagation&&(p=!0),d=!0)}return!1},v=n[i],S,w;return v&&(b(v[u+Od(r,e,!a)])?f=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Be.windows&&e.ctrlKey&&e.altKey)&&!(Be.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(S=eo[e.keyCode])&&S!=r?(b(v[u+Od(S,e,!0)])||e.shiftKey&&(w=pf[e.keyCode])!=r&&w!=S&&b(v[u+Od(w,e,!1)]))&&(f=!0):a&&e.shiftKey&&b(v[u+Od(r,e,!0)])&&(f=!0),!f&&b(v._any)&&(f=!0)),d&&(f=!0),f&&p&&e.stopPropagation(),yb=null,f}function l8(){return a8}const o8=Gt.line({class:"cm-activeLine"}),a8=Ds.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let r=n.lineBlockAt(i.head);r.from>e&&(t.push(o8.range(r.from)),e=r.from)}return Gt.set(t)}},{decorations:n=>n.decorations});class c8 extends Hf{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?nf(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),r=yf(t[0],i.direction!="rtl"),o=parseInt(i.lineHeight);return r.bottom-r.top>o*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+o}:r}ignoreEvent(){return!1}}function u8(n){let e=Ds.fromClass(class{constructor(t){this.view=t,this.placeholder=n?Gt.set([Gt.widget({widget:new c8(n),side:1}).range(0)]):Gt.none}get decorations(){return this.view.state.doc.length?Gt.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,et.contentAttributes.of({"aria-placeholder":n})]:e}class oa extends ia{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}oa.prototype.elementClass="";oa.prototype.toDOM=void 0;oa.prototype.mapMode=Xi.TrackBefore;oa.prototype.startSide=oa.prototype.endSide=-1;oa.prototype.point=!0;const Wy=We.define(),f8=We.define(),Gd=We.define(),Lk=We.define({combine:n=>n.some(e=>e)});function h8(n){return[d8]}const d8=Ds.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.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=n.state.facet(Gd).map(e=>new Ik(n,e)),this.fixed=!n.state.facet(Lk);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),n.scrollDOM.insertBefore(this.dom,n.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(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.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(Lk)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=Ct.iter(this.view.state.facet(Wy),this.view.viewport.from),i=[],r=this.gutters.map(o=>new p8(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(o.type)){let a=!0;for(let u of o.type)if(u.type==Di.Text&&a){bb(t,i,u.from);for(let f of r)f.line(this.view,u,i);a=!1}else if(u.widget)for(let f of r)f.widget(this.view,u)}else if(o.type==Di.Text){bb(t,i,o.from);for(let a of r)a.line(this.view,o,i)}else if(o.widget)for(let a of r)a.widget(this.view,o);for(let o of r)o.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Gd),t=n.state.facet(Gd),i=n.docChanged||n.heightChanged||n.viewportChanged||!Ct.eq(n.startState.facet(Wy),n.state.facet(Wy),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(n)&&(i=!0);else{i=!0;let r=[];for(let o of t){let a=e.indexOf(o);a<0?r.push(new Ik(this.view,o)):(this.gutters[a].update(n),r.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),r.indexOf(o)<0&&o.destroy();for(let o of r)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=r}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>et.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==xn.LTR?{left:i,right:r}:{right:i,left:r}})});function zk(n){return Array.isArray(n)?n:[n]}function bb(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class p8{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=Ct.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:r}=this,o=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let u=new hT(e,a,o,i);r.elements.push(u),r.dom.appendChild(u.dom)}else r.elements[this.i].update(e,a,o,i);this.height=t.bottom,this.i++}line(e,t,i){let r=[];bb(this.cursor,r,t.from),i.length&&(r=r.concat(i));let o=this.gutter.config.lineMarker(e,t,r);o&&r.unshift(o);let a=this.gutter;r.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),r=i?[i]:null;for(let o of e.state.facet(f8)){let a=o(e,t.widget,t);a&&(r||(r=[])).push(a)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Ik{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,r=>{let o=r.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let f=o.getBoundingClientRect();a=(f.top+f.bottom)/2}else a=r.clientY;let u=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[i](e,u,r)&&r.preventDefault()});this.markers=zk(t.markers(e)),t.initialSpacer&&(this.spacer=new hT(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=zk(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let i=e.view.viewport;return!Ct.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class hT{constructor(e,t,i,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,r)}update(e,t,i,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),m8(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let i="cm-gutterElement",r=this.dom.firstChild;for(let o=0,a=0;;){let u=a,f=o<t.length?t[o++]:null,d=!1;if(f){let p=f.elementClass;p&&(i+=" "+p);for(let g=a;g<this.markers.length;g++)if(this.markers[g].compare(f)){u=g,d=!0;break}}else u=this.markers.length;for(;a<u;){let p=this.markers[a++];if(p.toDOM){p.destroy(r);let g=r.nextSibling;r.remove(),r=g}}if(!f)break;f.toDOM&&(d?r=r.nextSibling:this.dom.insertBefore(f.toDOM(e),r)),d&&a++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}}function m8(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const g8=We.define(),y8=We.define(),tc=We.define({combine(n){return Av(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let r in t){let o=i[r],a=t[r];i[r]=o?(u,f,d)=>o(u,f,d)||a(u,f,d):a}return i}})}});class Xy extends oa{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function $y(n,e){return n.state.facet(tc).formatNumber(e,n.state)}const b8=Gd.compute([tc],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(g8)},lineMarker(e,t,i){return i.some(r=>r.toDOM)?null:new Xy($y(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let r of e.state.facet(y8)){let o=r(e,t,i);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(tc)!=e.state.facet(tc),initialSpacer(e){return new Xy($y(e,Pk(e.state.doc.lines)))},updateSpacer(e,t){let i=$y(t.view,Pk(t.view.state.doc.lines));return i==e.number?e:new Xy(i)},domEventHandlers:n.facet(tc).domEventHandlers,side:"before"}));function v8(n={}){return[tc.of(n),h8(),b8]}function Pk(n){let e=9;for(;e<n;)e=e*10+9;return e}const dT=1024;let x8=0;class Zy{constructor(e,t){this.from=e,this.to=t}}class mt{constructor(e={}){this.id=x8++,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=zi.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}mt.closedBy=new mt({deserialize:n=>n.split(" ")});mt.openedBy=new mt({deserialize:n=>n.split(" ")});mt.group=new mt({deserialize:n=>n.split(" ")});mt.isolate=new mt({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});mt.contextHash=new mt({perNode:!0});mt.lookAhead=new mt({perNode:!0});mt.mounted=new mt({perNode:!0});class lf{constructor(e,t,i,r=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=r}static get(e){return e&&e.props&&e.props[mt.mounted.id]}}const S8=Object.create(null);class zi{constructor(e,t,i,r=0){this.name=e,this.props=t,this.id=i,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):S8,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new zi(e.name||"",t,e.id,i);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(r)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(mt.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let r of i.split(" "))t[r]=e[i];return i=>{for(let r=i.prop(mt.group),o=-1;o<(r?r.length:0);o++){let a=t[o<0?i.name:r[o]];if(a)return a}}}}zi.none=new zi("",Object.create(null),0,8);class Pv{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let r=null;for(let o of e){let a=o(i);if(a){r||(r=Object.assign({},i.props));let u=a[1],f=a[0];f.combine&&f.id in r&&(u=f.combine(r[f.id],u)),r[f.id]=u}}t.push(r?new zi(i.name,r,i.id,i.flags):i)}return new Pv(t)}}const Md=new WeakMap,Hk=new WeakMap;var fn;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(fn||(fn={}));class Sn{constructor(e,t,i,r,o){if(this.type=e,this.children=t,this.positions=i,this.length=r,this.props=null,o&&o.length){this.props=Object.create(null);for(let[a,u]of o)this.props[typeof a=="number"?a:a.id]=u}}toString(){let e=lf.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let r=i.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new xb(this.topNode,e)}cursorAt(e,t=0,i=0){let r=Md.get(this)||this.topNode,o=new xb(r);return o.moveTo(e,t),Md.set(this,o._tree),o}get topNode(){return new ms(this,0,0,null)}resolve(e,t=0){let i=vf(Md.get(this)||this.topNode,e,t,!1);return Md.set(this,i),i}resolveInner(e,t=0){let i=vf(Hk.get(this)||this.topNode,e,t,!0);return Hk.set(this,i),i}resolveStack(e,t=0){return k8(this,e,t)}iterate(e){let{enter:t,leave:i,from:r=0,to:o=this.length}=e,a=e.mode||0,u=(a&fn.IncludeAnonymous)>0;for(let f=this.cursor(a|fn.IncludeAnonymous);;){let d=!1;if(f.from<=o&&f.to>=r&&(!u&&f.type.isAnonymous||t(f)!==!1)){if(f.firstChild())continue;d=!0}for(;d&&i&&(u||!f.type.isAnonymous)&&i(f),!f.nextSibling();){if(!f.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:_v(zi.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,r)=>new Sn(this.type,t,i,r,this.propValues),e.makeTree||((t,i,r)=>new Sn(zi.none,t,i,r)))}static build(e){return A8(e)}}Sn.empty=new Sn(zi.none,[],[],0);class Hv{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Hv(this.buffer,this.index)}}class no{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return zi.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],r=this.set.types[t],o=r.name;if(/\W/.test(o)&&!r.isError&&(o=JSON.stringify(o)),e+=4,i==e)return o;let a=[];for(;e<i;)a.push(this.childString(e)),e=this.buffer[e+3];return o+"("+a.join(",")+")"}findChild(e,t,i,r,o){let{buffer:a}=this,u=-1;for(let f=e;f!=t&&!(pT(o,r,a[f+1],a[f+2])&&(u=f,i>0));f=a[f+3]);return u}slice(e,t,i){let r=this.buffer,o=new Uint16Array(t-e),a=0;for(let u=e,f=0;u<t;){o[f++]=r[u++],o[f++]=r[u++]-i;let d=o[f++]=r[u++]-i;o[f++]=r[u++]-e,a=Math.max(a,d)}return new no(o,a,this.set)}}function pT(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function vf(n,e,t,i){for(var r;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let a=!i&&n instanceof ms&&n.index<0?null:n.parent;if(!a)return n;n=a}let o=i?0:fn.IgnoreOverlays;if(i)for(let a=n,u=a.parent;u;a=u,u=a.parent)a instanceof ms&&a.index<0&&((r=u.enter(e,t,o))===null||r===void 0?void 0:r.from)!=a.from&&(n=u);for(;;){let a=n.enter(e,t,o);if(!a)return n;n=a}}class mT{cursor(e=0){return new xb(this,e)}getChild(e,t=null,i=null){let r=Vk(this,e,t,i);return r.length?r[0]:null}getChildren(e,t=null,i=null){return Vk(this,e,t,i)}resolve(e,t=0){return vf(this,e,t,!1)}resolveInner(e,t=0){return vf(this,e,t,!0)}matchContext(e){return vb(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(i=t,t=r.prevSibling):t=r}return i}get node(){return this}get next(){return this.parent}}class ms extends mT{constructor(e,t,i,r){super(),this._tree=e,this.from=t,this.index=i,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,r,o=0){for(let a=this;;){for(let{children:u,positions:f}=a._tree,d=t>0?u.length:-1;e!=d;e+=t){let p=u[e],g=f[e]+a.from,b;if(!(!(o&fn.EnterBracketed&&p instanceof Sn&&(b=lf.get(p))&&!b.overlay&&b.bracketed&&i>=g&&i<=g+p.length)&&!pT(r,i,g,g+p.length))){if(p instanceof no){if(o&fn.ExcludeBuffers)continue;let v=p.findChild(0,p.buffer.length,t,i-g,r);if(v>-1)return new Kl(new w8(a,p,e,g),null,v)}else if(o&fn.IncludeAnonymous||!p.type.isAnonymous||Vv(p)){let v;if(!(o&fn.IgnoreMounts)&&(v=lf.get(p))&&!v.overlay)return new ms(v.tree,g,e,a);let S=new ms(p,g,e,a);return o&fn.IncludeAnonymous||!S.type.isAnonymous?S:S.nextChild(t<0?p.children.length-1:0,t,i,r,o)}}}if(o&fn.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let r;if(!(i&fn.IgnoreOverlays)&&(r=lf.get(this._tree))&&r.overlay){let o=e-this.from,a=i&fn.EnterBracketed&&r.bracketed;for(let{from:u,to:f}of r.overlay)if((t>0||a?u<=o:u<o)&&(t<0||a?f>=o:f>o))return new ms(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 Vk(n,e,t,i){let r=n.cursor(),o=[];if(!r.firstChild())return o;if(t!=null){for(let a=!1;!a;)if(a=r.type.is(t),!r.nextSibling())return o}for(;;){if(i!=null&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return i==null?o:[]}}function vb(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class w8{constructor(e,t,i,r){this.parent=e,this.buffer=t,this.index=i,this.start=r}}class Kl extends mT{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,i);return o<0?null:new Kl(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&fn.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Kl(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Kl(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Kl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,r=this.index+4,o=i.buffer[this.index+3];if(o>r){let a=i.buffer[this.index+1];e.push(i.slice(r,o,a)),t.push(0)}return new Sn(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function gT(n){if(!n.length)return null;let e=0,t=n[0];for(let o=1;o<n.length;o++){let a=n[o];(a.from>t.from||a.to<t.to)&&(t=a,e=o)}let i=t instanceof ms&&t.index<0?null:t.parent,r=n.slice();return i?r[e]=i:r.splice(e,1),new C8(r,t)}class C8{constructor(e,t){this.heads=e,this.node=t}get next(){return gT(this.heads)}}function k8(n,e,t){let i=n.resolveInner(e,t),r=null;for(let o=i instanceof ms?i:i.context.parent;o;o=o.parent)if(o.index<0){let a=o.parent;(r||(r=[i])).push(a.resolve(e,t)),o=a}else{let a=lf.get(o.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let u=new ms(a.tree,a.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(vf(u,e,t,!1))}}return r?gT(r):i}class xb{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~fn.EnterBracketed,e instanceof ms)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof ms?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:r}=this.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,i);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&fn.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(r.buffer.buffer[o+3]<this.index)return!1;({index:t,parent:i}=r)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let o=t+e,a=e<0?-1:i._tree.children.length;o!=a;o+=e){let u=i._tree.children[o];if(this.mode&fn.IncludeAnonymous||u instanceof no||!u.type.isAnonymous||Vv(u))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let r=this.index,o=this.stack.length;o>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,i=o+1;break e}r=this.stack[--o]}for(let r=i;r<this.stack.length;r++)t=new Kl(this.buffer,t,this.stack[r]);return this.bufferNode=new Kl(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(e){if(!this.buffer)return vb(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let r=e.length-1,o=this.stack.length-1;r>=0;o--){if(o<0)return vb(this._tree,e,r);let a=i[t.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}}function Vv(n){return n.children.some(e=>e instanceof no||!e.type.isAnonymous||Vv(e))}function A8(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:r=dT,reused:o=[],minRepeatType:a=i.types.length}=n,u=Array.isArray(t)?new Hv(t,t.length):t,f=i.types,d=0,p=0;function g(B,L,D,j,X,J){let{id:V,start:K,end:ae,size:$}=u,H=p,z=d;if($<0)if(u.next(),$==-1){let M=o[V];D.push(M),j.push(K-B);return}else if($==-3){d=V;return}else if($==-4){p=V;return}else throw new RangeError(`Unrecognized record size: ${$}`);let Q=f[V],F,ee,G=K-B;if(ae-K<=r&&(ee=E(u.pos-L,X))){let M=new Uint16Array(ee.size-ee.skip),U=u.pos-ee.size,te=M.length;for(;u.pos>U;)te=k(ee.start,M,te);F=new no(M,ae-ee.start,i),G=ee.start-B}else{let M=u.pos-$;u.next();let U=[],te=[],le=V>=a?V:-1,ne=0,se=ae;for(;u.pos>M;)le>=0&&u.id==le&&u.size>=0?(u.end<=se-r&&(S(U,te,K,ne,u.end,se,le,H,z),ne=U.length,se=u.end),u.next()):J>2500?b(K,M,U,te):g(K,M,U,te,le,J+1);if(le>=0&&ne>0&&ne<U.length&&S(U,te,K,ne,K,se,le,H,z),U.reverse(),te.reverse(),le>-1&&ne>0){let he=v(Q,z);F=_v(Q,U,te,0,U.length,0,ae-K,he,he)}else F=w(Q,U,te,ae-K,H-ae,z)}D.push(F),j.push(G)}function b(B,L,D,j){let X=[],J=0,V=-1;for(;u.pos>L;){let{id:K,start:ae,end:$,size:H}=u;if(H>4)u.next();else{if(V>-1&&ae<V)break;V<0&&(V=$-r),X.push(K,ae,$),J++,u.next()}}if(J){let K=new Uint16Array(J*4),ae=X[X.length-2];for(let $=X.length-3,H=0;$>=0;$-=3)K[H++]=X[$],K[H++]=X[$+1]-ae,K[H++]=X[$+2]-ae,K[H++]=H;D.push(new no(K,X[2]-ae,i)),j.push(ae-B)}}function v(B,L){return(D,j,X)=>{let J=0,V=D.length-1,K,ae;if(V>=0&&(K=D[V])instanceof Sn){if(!V&&K.type==B&&K.length==X)return K;(ae=K.prop(mt.lookAhead))&&(J=j[V]+K.length+ae)}return w(B,D,j,X,J,L)}}function S(B,L,D,j,X,J,V,K,ae){let $=[],H=[];for(;B.length>j;)$.push(B.pop()),H.push(L.pop()+D-X);B.push(w(i.types[V],$,H,J-X,K-J,ae)),L.push(X-D)}function w(B,L,D,j,X,J,V){if(J){let K=[mt.contextHash,J];V=V?[K].concat(V):[K]}if(X>25){let K=[mt.lookAhead,X];V=V?[K].concat(V):[K]}return new Sn(B,L,D,j,V)}function E(B,L){let D=u.fork(),j=0,X=0,J=0,V=D.end-r,K={size:0,start:0,skip:0};e:for(let ae=D.pos-B;D.pos>ae;){let $=D.size;if(D.id==L&&$>=0){K.size=j,K.start=X,K.skip=J,J+=4,j+=4,D.next();continue}let H=D.pos-$;if($<0||H<ae||D.start<V)break;let z=D.id>=a?4:0,Q=D.start;for(D.next();D.pos>H;){if(D.size<0)if(D.size==-3||D.size==-4)z+=4;else break e;else D.id>=a&&(z+=4);D.next()}X=Q,j+=$,J+=z}return(L<0||j==B)&&(K.size=j,K.start=X,K.skip=J),K.size>4?K:void 0}function k(B,L,D){let{id:j,start:X,end:J,size:V}=u;if(u.next(),V>=0&&j<a){let K=D;if(V>4){let ae=u.pos-(V-4);for(;u.pos>ae;)D=k(B,L,D)}L[--D]=K,L[--D]=J-B,L[--D]=X-B,L[--D]=j}else V==-3?d=j:V==-4&&(p=j);return D}let R=[],N=[];for(;u.pos>0;)g(n.start||0,n.bufferStart||0,R,N,-1,0);let T=(e=n.length)!==null&&e!==void 0?e:R.length?N[0]+R[0].length:0;return new Sn(f[n.topID],R.reverse(),N.reverse(),T)}const _k=new WeakMap;function Qd(n,e){if(!n.isAnonymous||e instanceof no||e.type!=n)return 1;let t=_k.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof Sn)){t=1;break}t+=Qd(n,i)}_k.set(e,t)}return t}function _v(n,e,t,i,r,o,a,u,f){let d=0;for(let S=i;S<r;S++)d+=Qd(n,e[S]);let p=Math.ceil(d*1.5/8),g=[],b=[];function v(S,w,E,k,R){for(let N=E;N<k;){let T=N,B=w[N],L=Qd(n,S[N]);for(N++;N<k;N++){let D=Qd(n,S[N]);if(L+D>=p)break;L+=D}if(N==T+1){if(L>p){let D=S[T];v(D.children,D.positions,0,D.children.length,w[T]+R);continue}g.push(S[T])}else{let D=w[N-1]+S[N-1].length-B;g.push(_v(n,S,w,T,N,B,D,null,f))}b.push(B+R-o)}}return v(e,t,i,r,0),(u||f)(g,b,a)}class ea{constructor(e,t,i,r,o=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=r,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let r=[new ea(0,e.length,e,0,!1,i)];for(let o of t)o.to>e.length&&r.push(o);return r}static applyChanges(e,t,i=128){if(!t.length)return e;let r=[],o=1,a=e.length?e[0]:null;for(let u=0,f=0,d=0;;u++){let p=u<t.length?t[u]:null,g=p?p.fromA:1e9;if(g-f>=i)for(;a&&a.from<g;){let b=a;if(f>=b.from||g<=b.to||d){let v=Math.max(b.from,f)-d,S=Math.min(b.to,g)-d;b=v>=S?null:new ea(v,S,b.tree,b.offset+d,u>0,!!p)}if(b&&r.push(b),a.to>g)break;a=o<e.length?e[o++]:null}if(!p)break;f=p.toA,d=p.toA-p.toB}return r}}class yT{startParse(e,t,i){return typeof e=="string"&&(e=new E8(e)),i=i?i.length?i.map(r=>new Zy(r.from,r.to)):[new Zy(0,0)]:[new Zy(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let r=this.startParse(e,t,i);for(;;){let o=r.advance();if(o)return o}}}class E8{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new mt({perNode:!0});let R8=0;class fs{constructor(e,t,i,r){this.name=e,this.set=t,this.base=i,this.modified=r,this.id=R8++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof fs&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new fs(i,[],null,[]);if(r.set.push(r),t)for(let o of t.set)r.set.push(o);return r}static defineModifier(e){let t=new wp(e);return i=>i.modified.indexOf(t)>-1?i:wp.get(i.base||i,i.modified.concat(t).sort((r,o)=>r.id-o.id))}}let T8=0;class wp{constructor(e){this.name=e,this.instances=[],this.id=T8++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(u=>u.base==e&&O8(t,u.modified));if(i)return i;let r=[],o=new fs(e.name,r,e,t);for(let u of t)u.instances.push(o);let a=M8(t);for(let u of e.set)if(!u.modified.length)for(let f of a)r.push(wp.get(u,f));return o}}function O8(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function M8(n){let e=[[]];for(let t=0;t<n.length;t++)for(let i=0,r=e.length;i<r;i++)e.push(e[i].concat(n[t]));return e.sort((t,i)=>i.length-t.length)}function bT(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let r of t.split(" "))if(r){let o=[],a=2,u=r;for(let g=0;;){if(u=="..."&&g>0&&g+3==r.length){a=1;break}let b=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!b)throw new RangeError("Invalid path: "+r);if(o.push(b[0]=="*"?"":b[0][0]=='"'?JSON.parse(b[0]):b[0]),g+=b[0].length,g==r.length)break;let v=r[g++];if(g==r.length&&v=="!"){a=0;break}if(v!="/")throw new RangeError("Invalid path: "+r);u=r.slice(g)}let f=o.length-1,d=o[f];if(!d)throw new RangeError("Invalid path: "+r);let p=new xf(i,a,f>0?o.slice(0,f):null);e[d]=p.sort(e[d])}}return vT.add(e)}const vT=new mt({combine(n,e){let t,i,r;for(;n||e;){if(!n||e&&n.depth>=e.depth?(r=e,e=e.next):(r=n,n=n.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let o=new xf(r.tags,r.mode,r.context);t?t.next=o:i=o,t=o}return i}});class xf{constructor(e,t,i,r){this.tags=e,this.mode=t,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}xf.empty=new xf([],2,null);function xT(n,e){let t=Object.create(null);for(let o of n)if(!Array.isArray(o.tag))t[o.tag.id]=o.class;else for(let a of o.tag)t[a.id]=o.class;let{scope:i,all:r=null}=e||{};return{style:o=>{let a=r;for(let u of o)for(let f of u.set){let d=t[f.id];if(d){a=a?a+" "+d:d;break}}return a},scope:i}}function N8(n,e){let t=null;for(let i of n){let r=i.style(e);r&&(t=t?t+" "+r:r)}return t}function D8(n,e,t,i=0,r=n.length){let o=new j8(i,Array.isArray(e)?e:[e],t);o.highlightRange(n.cursor(),i,r,"",o.highlighters),o.flush(r)}class j8{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,r,o){let{type:a,from:u,to:f}=e;if(u>=i||f<=t)return;a.isTop&&(o=this.highlighters.filter(v=>!v.scope||v.scope(a)));let d=r,p=B8(e)||xf.empty,g=N8(o,p.tags);if(g&&(d&&(d+=" "),d+=g,p.mode==1&&(r+=(r?" ":"")+g)),this.startSpan(Math.max(t,u),d),p.opaque)return;let b=e.tree&&e.tree.prop(mt.mounted);if(b&&b.overlay){let v=e.node.enter(b.overlay[0].from+u,1),S=this.highlighters.filter(E=>!E.scope||E.scope(b.tree.type)),w=e.firstChild();for(let E=0,k=u;;E++){let R=E<b.overlay.length?b.overlay[E]:null,N=R?R.from+u:f,T=Math.max(t,k),B=Math.min(i,N);if(T<B&&w)for(;e.from<B&&(this.highlightRange(e,T,B,r,o),this.startSpan(Math.min(B,e.to),d),!(e.to>=N||!e.nextSibling())););if(!R||N>i)break;k=R.to+u,k>t&&(this.highlightRange(v.cursor(),Math.max(t,R.from+u),Math.min(i,k),"",S),this.startSpan(Math.min(i,k),d))}w&&e.parent()}else if(e.firstChild()){b&&(r="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,r,o),this.startSpan(Math.min(i,e.to),d)}while(e.nextSibling());e.parent()}}}function B8(n){let e=n.type.prop(vT);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const Oe=fs.define,Nd=Oe(),Ml=Oe(),Uk=Oe(Ml),qk=Oe(Ml),Nl=Oe(),Dd=Oe(Nl),Jy=Oe(Nl),Ys=Oe(),Bo=Oe(Ys),Qs=Oe(),Ks=Oe(),Sb=Oe(),Vu=Oe(Sb),jd=Oe(),Ee={comment:Nd,lineComment:Oe(Nd),blockComment:Oe(Nd),docComment:Oe(Nd),name:Ml,variableName:Oe(Ml),typeName:Uk,tagName:Oe(Uk),propertyName:qk,attributeName:Oe(qk),className:Oe(Ml),labelName:Oe(Ml),namespace:Oe(Ml),macroName:Oe(Ml),literal:Nl,string:Dd,docString:Oe(Dd),character:Oe(Dd),attributeValue:Oe(Dd),number:Jy,integer:Oe(Jy),float:Oe(Jy),bool:Oe(Nl),regexp:Oe(Nl),escape:Oe(Nl),color:Oe(Nl),url:Oe(Nl),keyword:Qs,self:Oe(Qs),null:Oe(Qs),atom:Oe(Qs),unit:Oe(Qs),modifier:Oe(Qs),operatorKeyword:Oe(Qs),controlKeyword:Oe(Qs),definitionKeyword:Oe(Qs),moduleKeyword:Oe(Qs),operator:Ks,derefOperator:Oe(Ks),arithmeticOperator:Oe(Ks),logicOperator:Oe(Ks),bitwiseOperator:Oe(Ks),compareOperator:Oe(Ks),updateOperator:Oe(Ks),definitionOperator:Oe(Ks),typeOperator:Oe(Ks),controlOperator:Oe(Ks),punctuation:Sb,separator:Oe(Sb),bracket:Vu,angleBracket:Oe(Vu),squareBracket:Oe(Vu),paren:Oe(Vu),brace:Oe(Vu),content:Ys,heading:Bo,heading1:Oe(Bo),heading2:Oe(Bo),heading3:Oe(Bo),heading4:Oe(Bo),heading5:Oe(Bo),heading6:Oe(Bo),contentSeparator:Oe(Ys),list:Oe(Ys),quote:Oe(Ys),emphasis:Oe(Ys),strong:Oe(Ys),link:Oe(Ys),monospace:Oe(Ys),strikethrough:Oe(Ys),inserted:Oe(),deleted:Oe(),changed:Oe(),invalid:Oe(),meta:jd,documentMeta:Oe(jd),annotation:Oe(jd),processingInstruction:Oe(jd),definition:fs.defineModifier("definition"),constant:fs.defineModifier("constant"),function:fs.defineModifier("function"),standard:fs.defineModifier("standard"),local:fs.defineModifier("local"),special:fs.defineModifier("special")};for(let n in Ee){let e=Ee[n];e instanceof fs&&(e.name=n)}xT([{tag:Ee.link,class:"tok-link"},{tag:Ee.heading,class:"tok-heading"},{tag:Ee.emphasis,class:"tok-emphasis"},{tag:Ee.strong,class:"tok-strong"},{tag:Ee.keyword,class:"tok-keyword"},{tag:Ee.atom,class:"tok-atom"},{tag:Ee.bool,class:"tok-bool"},{tag:Ee.url,class:"tok-url"},{tag:Ee.labelName,class:"tok-labelName"},{tag:Ee.inserted,class:"tok-inserted"},{tag:Ee.deleted,class:"tok-deleted"},{tag:Ee.literal,class:"tok-literal"},{tag:Ee.string,class:"tok-string"},{tag:Ee.number,class:"tok-number"},{tag:[Ee.regexp,Ee.escape,Ee.special(Ee.string)],class:"tok-string2"},{tag:Ee.variableName,class:"tok-variableName"},{tag:Ee.local(Ee.variableName),class:"tok-variableName tok-local"},{tag:Ee.definition(Ee.variableName),class:"tok-variableName tok-definition"},{tag:Ee.special(Ee.variableName),class:"tok-variableName2"},{tag:Ee.definition(Ee.propertyName),class:"tok-propertyName tok-definition"},{tag:Ee.typeName,class:"tok-typeName"},{tag:Ee.namespace,class:"tok-namespace"},{tag:Ee.className,class:"tok-className"},{tag:Ee.macroName,class:"tok-macroName"},{tag:Ee.propertyName,class:"tok-propertyName"},{tag:Ee.operator,class:"tok-operator"},{tag:Ee.comment,class:"tok-comment"},{tag:Ee.meta,class:"tok-meta"},{tag:Ee.invalid,class:"tok-invalid"},{tag:Ee.punctuation,class:"tok-punctuation"}]);var e0;const nc=new mt;function L8(n){return We.define({combine:n?e=>e.concat(n):void 0})}const z8=new mt;class Os{constructor(e,t,i=[],r=""){this.data=e,this.name=r,wt.prototype.hasOwnProperty("tree")||Object.defineProperty(wt.prototype,"tree",{get(){return ar(this)}}),this.parser=t,this.extension=[Lc.of(this),wt.languageData.of((o,a,u)=>{let f=Fk(o,a,u),d=f.type.prop(nc);if(!d)return[];let p=o.facet(d),g=f.type.prop(z8);if(g){let b=f.resolve(a-f.from,u);for(let v of g)if(v.test(b,o)){let S=o.facet(v.facet);return v.type=="replace"?S:S.concat(p)}}return p})].concat(i)}isActiveAt(e,t,i=-1){return Fk(e,t,i).type.prop(nc)==this.data}findRegions(e){let t=e.facet(Lc);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],r=(o,a)=>{if(o.prop(nc)==this.data){i.push({from:a,to:a+o.length});return}let u=o.prop(mt.mounted);if(u){if(u.tree.prop(nc)==this.data){if(u.overlay)for(let f of u.overlay)i.push({from:f.from+a,to:f.to+a});else i.push({from:a,to:a+o.length});return}else if(u.overlay){let f=i.length;if(r(u.tree,u.overlay[0].from+a),i.length>f)return}}for(let f=0;f<o.children.length;f++){let d=o.children[f];d instanceof Sn&&r(d,o.positions[f]+a)}};return r(ar(e),0),i}get allowsNesting(){return!0}}Os.setState=vn.define();function Fk(n,e,t){let i=n.facet(Lc),r=ar(n).topNode;if(!i||i.allowsNesting)for(let o=r;o;o=o.enter(e,t,fn.ExcludeBuffers|fn.EnterBracketed))o.type.isTop&&(r=o);return r}class Cp extends Os{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=L8(e.languageData);return new Cp(t,e.parser.configure({props:[nc.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Cp(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ar(n){let e=n.field(Os.state,!1);return e?e.tree:Sn.empty}class I8{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let _u=null;class kp{constructor(e,t,i=[],r,o,a,u,f){this.parser=e,this.state=t,this.fragments=i,this.tree=r,this.treeLen=o,this.viewport=a,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new kp(e,t,[],Sn.empty,0,i,[],null)}startParse(){return this.parser.startParse(new I8(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Sn.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(ea.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ea.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=_u;_u=this;try{return e()}finally{_u=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Gk(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:r,treeLen:o,viewport:a,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((d,p,g,b)=>f.push({fromA:d,toA:p,fromB:g,toB:b})),i=ea.applyChanges(i,f),r=Sn.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){u=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);p<g&&u.push({from:p,to:g})}}}return new kp(this.parser,t,i,r,o,a,u,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:r,to:o}=this.skipped[i];r<e.to&&o>e.from&&(this.fragments=Gk(this.fragments,r,o),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends yT{createParse(t,i,r){let o=r[0].from,a=r[r.length-1].to;return{parsedPos:o,advance(){let f=_u;if(f){for(let d of r)f.tempSkipped.push(d);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=a,new Sn(zi.none,[],[],a-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return _u}}function Gk(n,e,t){return ea.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Bc{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Bc(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=kp.create(e.facet(Lc).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Bc(i)}}Os.state=uo.define({create:Bc.init,update(n,e){for(let t of e.effects)if(t.is(Os.setState))return t.value;return e.startState.facet(Lc)!=e.state.facet(Lc)?Bc.init(e.state):n.apply(e)}});let ST=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ST=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const t0=typeof navigator<"u"&&(!((e0=navigator.scheduling)===null||e0===void 0)&&e0.isInputPending)?()=>navigator.scheduling.isInputPending():null,P8=Ds.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Os.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Os.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ST(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:r}}=this.view,o=i.field(Os.state);if(o.tree==o.context.tree&&o.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!t0?Math.max(25,e.timeRemaining()-5):1e9),u=o.context.treeLen<r&&i.doc.length>r+1e3,f=o.context.work(()=>t0&&t0()||Date.now()>a,r+(u?0:1e5));this.chunkBudget-=Date.now()-t,(f||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Os.setState.of(new Bc(o.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>nr(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Lc=We.define({combine(n){return n.length?n[0]:null},enables:n=>[Os.state,P8,et.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class H8{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const V8=We.define(),Uv=We.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ap(n){let e=n.facet(Uv);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Sf(n,e){let t="",i=n.tabSize,r=n.facet(Uv)[0];if(r==" "){for(;e>=i;)t+=" ",e-=i;r=" "}for(let o=0;o<e;o++)t+=r;return t}function qv(n,e){n instanceof wt&&(n=new im(n));for(let i of n.state.facet(V8)){let r=i(n,e);if(r!==void 0)return r}let t=ar(n.state);return t.length>=e?_8(n,t,e):null}class im{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ap(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:o}=this.options;return r!=null&&r>=i.from&&r<=i.to?o&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:i.text.slice(r-i.from),from:r}:{text:i.text.slice(0,r-i.from),from:i.from}:i}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:r}=this.lineAt(e,t);return i.slice(e-r,Math.min(i.length,e+100-r))}column(e,t=1){let{text:i,from:r}=this.lineAt(e,t),o=this.countColumn(i,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(o+=a-this.countColumn(i,i.search(/\S|$/))),o}countColumn(e,t=e.length){return $p(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:r}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let a=o(r);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const wT=new mt;function _8(n,e,t){let i=e.resolveStack(t),r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=i.node){let o=[];for(let a=r;a&&!(a.from<i.node.from||a.to>i.node.to||a.from==i.node.from&&a.type==i.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)i={node:o[a],next:i}}return CT(i,n,t)}function CT(n,e,t){for(let i=n;i;i=i.next){let r=q8(i.node);if(r)return r(Fv.create(e,t,i))}return 0}function U8(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function q8(n){let e=n.type.prop(wT);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(mt.closedBy))){let r=n.lastChild,o=r&&i.indexOf(r.name)>-1;return a=>K8(a,!0,1,void 0,o&&!U8(a)?r.from:void 0)}return n.parent==null?F8:null}function F8(){return 0}class Fv extends im{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Fv(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(G8(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return CT(this.context.next,this.base,this.pos)}}function G8(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function Q8(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let r=n.options.simulateBreak,o=n.state.doc.lineAt(t.from),a=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let u=t.to;;){let f=e.childAfter(u);if(!f||f==i)return null;if(!f.type.isSkipped){if(f.from>=a)return null;let d=/^ */.exec(o.text.slice(t.to-o.from))[0].length;return{from:t.from,to:t.to+d}}u=f.to}}function K8(n,e,t,i,r){let o=n.textAfter,a=o.match(/^\s*/)[0].length,u=i&&o.slice(a,a+i.length)==i||r==n.pos+a,f=Q8(n);return f?u?n.column(f.from):n.column(f.to):n.baseIndent+(u?0:n.unit*t)}function Qk({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const Y8=200;function W8(){return wt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,r=t.lineAt(i);if(i>r.from+Y8)return n;let o=t.sliceString(r.from,i);if(!e.some(d=>d.test(o)))return n;let{state:a}=n,u=-1,f=[];for(let{head:d}of a.selection.ranges){let p=a.doc.lineAt(d);if(p.from==u)continue;u=p.from;let g=qv(a,p.from);if(g==null)continue;let b=/^\s*/.exec(p.text)[0],v=Sf(a,g);b!=v&&f.push({from:p.from,to:p.from+b.length,insert:v})}return f.length?[n,{changes:f,sequential:!0}]:n})}const X8=new mt;function $8(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}class sm{constructor(e,t){this.specs=e;let i;function r(u){let f=Jl.newName();return(i||(i=Object.create(null)))["."+f]=u,f}const o=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof Os?u=>u.prop(nc)==a.data:a?u=>u==a:void 0,this.style=xT(e.map(u=>({tag:u.tag,class:u.class||r(Object.assign({},u,{tag:null}))})),{all:o}).style,this.module=i?new Jl(i):null,this.themeType=t.themeType}static define(e,t){return new sm(e,t||{})}}const wb=We.define(),kT=We.define({combine(n){return n.length?[n[0]]:null}});function n0(n){let e=n.facet(wb);return e.length?e:n.facet(kT)}function Z8(n,e){let t=[eP],i;return n instanceof sm&&(n.module&&t.push(et.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(kT.of(n)):i?t.push(wb.computeN([et.darkTheme],r=>r.facet(et.darkTheme)==(i=="dark")?[n]:[])):t.push(wb.of(n)),t}class J8{constructor(e){this.markCache=Object.create(null),this.tree=ar(e.state),this.decorations=this.buildDeco(e,n0(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=ar(e.state),i=n0(e.state),r=i!=n0(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<o.to&&!r&&t.type==this.tree.type&&a>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return Gt.none;let i=new hf;for(let{from:r,to:o}of e.visibleRanges)D8(this.tree,t,(a,u,f)=>{i.add(a,u,this.markCache[f]||(this.markCache[f]=Gt.mark({class:f})))},r,o);return i.finish()}}const eP=kv.high(Ds.fromClass(J8,{decorations:n=>n.decorations})),tP=sm.define([{tag:Ee.meta,color:"#404740"},{tag:Ee.link,textDecoration:"underline"},{tag:Ee.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Ee.emphasis,fontStyle:"italic"},{tag:Ee.strong,fontWeight:"bold"},{tag:Ee.strikethrough,textDecoration:"line-through"},{tag:Ee.keyword,color:"#708"},{tag:[Ee.atom,Ee.bool,Ee.url,Ee.contentSeparator,Ee.labelName],color:"#219"},{tag:[Ee.literal,Ee.inserted],color:"#164"},{tag:[Ee.string,Ee.deleted],color:"#a11"},{tag:[Ee.regexp,Ee.escape,Ee.special(Ee.string)],color:"#e40"},{tag:Ee.definition(Ee.variableName),color:"#00f"},{tag:Ee.local(Ee.variableName),color:"#30a"},{tag:[Ee.typeName,Ee.namespace],color:"#085"},{tag:Ee.className,color:"#167"},{tag:[Ee.special(Ee.variableName),Ee.macroName],color:"#256"},{tag:Ee.definition(Ee.propertyName),color:"#00c"},{tag:Ee.comment,color:"#940"},{tag:Ee.invalid,color:"#f00"}]),nP=et.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),AT=1e4,ET="()[]{}",RT=We.define({combine(n){return Av(n,{afterCursor:!0,brackets:ET,maxScanDistance:AT,renderMatch:rP})}}),iP=Gt.mark({class:"cm-matchingBracket"}),sP=Gt.mark({class:"cm-nonmatchingBracket"});function rP(n){let e=[],t=n.matched?iP:sP;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function Kk(n){let e=[],t=n.facet(RT);for(let i of n.selection.ranges){if(!i.empty)continue;let r=ir(n,i.head,-1,t)||i.head>0&&ir(n,i.head-1,1,t)||t.afterCursor&&(ir(n,i.head,1,t)||i.head<n.doc.length&&ir(n,i.head+1,-1,t));r&&(e=e.concat(t.renderMatch(r,n)))}return Gt.set(e,!0)}const lP=Ds.fromClass(class{constructor(n){this.paused=!1,this.decorations=Kk(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=Kk(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),oP=[lP,nP];function aP(n={}){return[RT.of(n),oP]}const cP=new mt;function Cb(n,e,t){let i=n.prop(e<0?mt.openedBy:mt.closedBy);if(i)return i;if(n.name.length==1){let r=t.indexOf(n.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function kb(n){let e=n.type.prop(cP);return e?e(n.node):n}function ir(n,e,t,i={}){let r=i.maxScanDistance||AT,o=i.brackets||ET,a=ar(n),u=a.resolveInner(e,t);for(let f=u;f;f=f.parent){let d=Cb(f.type,t,o);if(d&&f.from<f.to){let p=kb(f);if(p&&(t>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return uP(n,e,t,f,p,d,o)}}return fP(n,e,t,a,u.type,r,o)}function uP(n,e,t,i,r,o,a){let u=i.parent,f={from:r.from,to:r.to},d=0,p=u==null?void 0:u.cursor();if(p&&(t<0?p.childBefore(i.from):p.childAfter(i.to)))do if(t<0?p.to<=i.from:p.from>=i.to){if(d==0&&o.indexOf(p.type.name)>-1&&p.from<p.to){let g=kb(p);return{start:f,end:g?{from:g.from,to:g.to}:void 0,matched:!0}}else if(Cb(p.type,t,a))d++;else if(Cb(p.type,-t,a)){if(d==0){let g=kb(p);return{start:f,end:g&&g.from<g.to?{from:g.from,to:g.to}:void 0,matched:!1}}d--}}while(t<0?p.prevSibling():p.nextSibling());return{start:f,matched:!1}}function fP(n,e,t,i,r,o,a){if(t<0?!e:e==n.doc.length)return null;let u=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),f=a.indexOf(u);if(f<0||f%2==0!=t>0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},p=n.doc.iterRange(e,t>0?n.doc.length:0),g=0;for(let b=0;!p.next().done&&b<=o;){let v=p.value;t<0&&(b+=v.length);let S=e+b*t;for(let w=t>0?0:v.length-1,E=t>0?v.length:-1;w!=E;w+=t){let k=a.indexOf(v[w]);if(!(k<0||i.resolveInner(S+w,1).type!=r))if(k%2==0==t>0)g++;else{if(g==1)return{start:d,end:{from:S+w,to:S+w+1},matched:k>>1==f>>1};g--}}t>0&&(b+=v.length)}return p.done?{start:d,matched:!1}:null}const hP=Object.create(null),Yk=[zi.none],Wk=[],Xk=Object.create(null),dP=Object.create(null);for(let[n,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"]])dP[n]=pP(hP,e);function i0(n,e){Wk.indexOf(n)>-1||(Wk.push(n),console.warn(e))}function pP(n,e){let t=[];for(let u of e.split(" ")){let f=[];for(let d of u.split(".")){let p=n[d]||Ee[d];p?typeof p=="function"?f.length?f=f.map(p):i0(d,`Modifier ${d} used at start of tag`):f.length?i0(d,`Tag ${d} used as modifier`):f=Array.isArray(p)?p:[p]:i0(d,`Unknown highlighting tag ${d}`)}for(let d of f)t.push(d)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+t.map(u=>u.id),o=Xk[r];if(o)return o.id;let a=Xk[r]=zi.define({id:Yk.length,name:i,props:[bT({[i]:t})]});return Yk.push(a),a.id}xn.RTL,xn.LTR;const mP=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Qv(n.state,t.from);return i.line?gP(n):i.block?bP(n):!1};function Gv(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let r=n(e,t);return r?(i(t.update(r)),!0):!1}}const gP=Gv(SP,0),yP=Gv(TT,0),bP=Gv((n,e)=>TT(n,e,xP(e)),0);function Qv(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Uu=50;function vP(n,{open:e,close:t},i,r){let o=n.sliceDoc(i-Uu,i),a=n.sliceDoc(r,r+Uu),u=/\s*$/.exec(o)[0].length,f=/^\s*/.exec(a)[0].length,d=o.length-u;if(o.slice(d-e.length,d)==e&&a.slice(f,f+t.length)==t)return{open:{pos:i-u,margin:u&&1},close:{pos:r+f,margin:f&&1}};let p,g;r-i<=2*Uu?p=g=n.sliceDoc(i,r):(p=n.sliceDoc(i,i+Uu),g=n.sliceDoc(r-Uu,r));let b=/^\s*/.exec(p)[0].length,v=/\s*$/.exec(g)[0].length,S=g.length-v-t.length;return p.slice(b,b+e.length)==e&&g.slice(S,S+t.length)==t?{open:{pos:i+b+e.length,margin:/\s/.test(p.charAt(b+e.length))?1:0},close:{pos:r-v-t.length,margin:/\s/.test(g.charAt(S-1))?1:0}}:null}function xP(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),r=t.to<=i.to?i:n.doc.lineAt(t.to);r.from>i.from&&r.from==t.to&&(r=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let o=e.length-1;o>=0&&e[o].to>i.from?e[o].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}function TT(n,e,t=e.selection.ranges){let i=t.map(o=>Qv(e,o.from).block);if(!i.every(o=>o))return null;let r=t.map((o,a)=>vP(e,i[a],o.from,o.to));if(n!=2&&!r.every(o=>o))return{changes:e.changes(t.map((o,a)=>r[a]?[]:[{from:o.from,insert:i[a].open+" "},{from:o.to,insert:" "+i[a].close}]))};if(n!=1&&r.some(o=>o)){let o=[];for(let a=0,u;a<r.length;a++)if(u=r[a]){let f=i[a],{open:d,close:p}=u;o.push({from:d.pos-f.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+f.close.length})}return{changes:o}}return null}function SP(n,e,t=e.selection.ranges){let i=[],r=-1;e:for(let{from:o,to:a}of t){let u=i.length,f=1e9,d;for(let p=o;p<=a;){let g=e.doc.lineAt(p);if(d==null&&(d=Qv(e,g.from).line,!d))continue e;if(g.from>r&&(o==a||a>g.from)){r=g.from;let b=/^\s*/.exec(g.text)[0].length,v=b==g.length,S=g.text.slice(b,b+d.length)==d?b:-1;b<g.text.length&&b<f&&(f=b),i.push({line:g,comment:S,token:d,indent:b,empty:v,single:!1})}p=g.to+1}if(f<1e9)for(let p=u;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=f);i.length==u+1&&(i[u].single=!0)}if(n!=2&&i.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:u,token:f,indent:d,empty:p,single:g}of i)(g||!p)&&o.push({from:u.from+d,insert:f+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(n!=1&&i.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:u,token:f}of i)if(u>=0){let d=a.from+u,p=d+f.length;a.text[p-a.from]==" "&&p++,o.push({from:d,to:p})}return{changes:o}}return null}const Ab=fo.define(),wP=fo.define(),CP=We.define(),OT=We.define({combine(n){return Av(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,r)=>e(i,r)||t(i,r)})}}),MT=uo.define({create(){return sr.empty},update(n,e){let t=e.state.facet(OT),i=e.annotation(Ab);if(i){let f=Ni.fromTransaction(e,i.selection),d=i.side,p=d==0?n.undone:n.done;return f?p=Ep(p,p.length,t.minDepth,f):p=jT(p,e.startState.selection),new sr(d==0?i.rest:p,d==0?p:i.rest)}let r=e.annotation(wP);if((r=="full"||r=="before")&&(n=n.isolate()),e.annotation(zn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let o=Ni.fromTransaction(e),a=e.annotation(zn.time),u=e.annotation(zn.userEvent);return o?n=n.addChanges(o,a,u,t,e):e.selection&&(n=n.addSelection(e.startState.selection,a,u,t.newGroupDelay)),(r=="full"||r=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new sr(n.done.map(Ni.fromJSON),n.undone.map(Ni.fromJSON))}});function kP(n={}){return[MT,OT.of(n),et.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?NT:e.inputType=="historyRedo"?Eb:null;return i?(e.preventDefault(),i(t)):!1}})]}function rm(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let r=t.field(MT,!1);if(!r)return!1;let o=r.pop(n,t,e);return o?(i(o),!0):!1}}const NT=rm(0,!1),Eb=rm(1,!1),AP=rm(0,!0),EP=rm(1,!0);class Ni{constructor(e,t,i,r,o){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new Ni(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new Ni(e.changes&&jn.fromJSON(e.changes),[],e.mapped&&or.fromJSON(e.mapped),e.startSelection&&Se.fromJSON(e.startSelection),e.selectionsAfter.map(Se.fromJSON))}static fromTransaction(e,t){let i=ps;for(let r of e.startState.facet(CP)){let o=r(e);o.length&&(i=i.concat(o))}return!i.length&&e.changes.empty?null:new Ni(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,ps)}static selection(e){return new Ni(void 0,ps,void 0,void 0,e)}}function Ep(n,e,t,i){let r=e+1>t+20?e-t-1:0,o=n.slice(r,e);return o.push(i),o}function RP(n,e){let t=[],i=!1;return n.iterChangedRanges((r,o)=>t.push(r,o)),e.iterChangedRanges((r,o,a,u)=>{for(let f=0;f<t.length;){let d=t[f++],p=t[f++];u>=d&&a<=p&&(i=!0)}}),i}function TP(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function DT(n,e){return n.length?e.length?n.concat(e):n:e}const ps=[],OP=200;function jT(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-OP));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Ep(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Ni.selection([e])]}function MP(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function s0(n,e){if(!n.length)return n;let t=n.length,i=ps;for(;t;){let r=NP(n[t-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let o=n.slice(0,t);return o[t-1]=r,o}else e=r.mapped,t--,i=r.selectionsAfter}return i.length?[Ni.selection(i)]:ps}function NP(n,e,t){let i=DT(n.selectionsAfter.length?n.selectionsAfter.map(u=>u.map(e)):ps,t);if(!n.changes)return Ni.selection(i);let r=n.changes.map(e),o=e.mapDesc(n.changes,!0),a=n.mapped?n.mapped.composeDesc(o):o;return new Ni(r,vn.mapEffects(n.effects,e),a,n.startSelection.map(o),i)}const DP=/^(input\.type|delete)($|\.)/;class sr{constructor(e,t,i=0,r=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new sr(this.done,this.undone):this}addChanges(e,t,i,r,o){let a=this.done,u=a[a.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!i||DP.test(i))&&(!u.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,RP(u.changes,e.changes))||i=="input.type.compose")?a=Ep(a,a.length-1,r.minDepth,new Ni(e.changes.compose(u.changes),DT(vn.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,ps)):a=Ep(a,a.length,r.minDepth,e),new sr(a,ps,t,i)}addSelection(e,t,i,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:ps;return o.length>0&&t-this.prevTime<r&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&TP(o[o.length-1],e)?this:new sr(jT(this.done,e),this.undone,t,i)}addMapping(e){return new sr(s0(this.done,e),s0(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],a=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(i&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Ab.of({side:e,rest:MP(r),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let u=r.length==1?ps:r.slice(0,r.length-1);return o.mapped&&(u=s0(u,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Ab.of({side:e,rest:u,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}sr.empty=new sr(ps,ps);const jP=[{key:"Mod-z",run:NT,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Eb,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Eb,preventDefault:!0},{key:"Mod-u",run:AP,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:EP,preventDefault:!0}];function _c(n,e){return Se.create(n.ranges.map(e),n.mainIndex)}function Bs(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Ls({state:n,dispatch:e},t){let i=_c(n.selection,t);return i.eq(n.selection,!0)?!1:(e(Bs(n,i)),!0)}function lm(n,e){return Se.cursor(e?n.to:n.from)}function BT(n,e){return Ls(n,t=>t.empty?n.moveByChar(t,e):lm(t,e))}function li(n){return n.textDirectionAt(n.state.selection.main.head)==xn.LTR}const LT=n=>BT(n,!li(n)),zT=n=>BT(n,li(n));function IT(n,e){return Ls(n,t=>t.empty?n.moveByGroup(t,e):lm(t,e))}const BP=n=>IT(n,!li(n)),LP=n=>IT(n,li(n));function zP(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function om(n,e,t){let i=ar(n).resolveInner(e.head),r=t?mt.closedBy:mt.openedBy;for(let f=e.head;;){let d=t?i.childAfter(f):i.childBefore(f);if(!d)break;zP(n,d,r)?i=d:f=t?d.to:d.from}let o=i.type.prop(r),a,u;return o&&(a=t?ir(n,i.from,1):ir(n,i.to,-1))&&a.matched?u=t?a.end.to:a.end.from:u=t?i.to:i.from,Se.cursor(u,t?-1:1)}const IP=n=>Ls(n,e=>om(n.state,e,!li(n))),PP=n=>Ls(n,e=>om(n.state,e,li(n)));function PT(n,e){return Ls(n,t=>{if(!t.empty)return lm(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const HT=n=>PT(n,!1),VT=n=>PT(n,!0);function _T(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,i=0,r;if(e){for(let o of n.state.facet(et.scrollMargins)){let a=o(n);a!=null&&a.top&&(t=Math.max(a==null?void 0:a.top,t)),a!=null&&a.bottom&&(i=Math.max(a==null?void 0:a.bottom,i))}r=n.scrollDOM.clientHeight-t-i}else r=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:i,selfScroll:e,height:Math.max(n.defaultLineHeight,r-5)}}function UT(n,e){let t=_T(n),{state:i}=n,r=_c(i.selection,a=>a.empty?n.moveVertically(a,e,t.height):lm(a,e));if(r.eq(i.selection))return!1;let o;if(t.selfScroll){let a=n.coordsAtPos(i.selection.main.head),u=n.scrollDOM.getBoundingClientRect(),f=u.top+t.marginTop,d=u.bottom-t.marginBottom;a&&a.top>f&&a.bottom<d&&(o=et.scrollIntoView(r.main.head,{y:"start",yMargin:a.top-f}))}return n.dispatch(Bs(i,r),{effects:o}),!0}const $k=n=>UT(n,!1),Rb=n=>UT(n,!0);function ho(n,e,t){let i=n.lineBlockAt(e.head),r=n.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?i.to:i.from)&&(r=n.moveToLineBoundary(e,t,!1)),!t&&r.head==i.from&&i.length){let o=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&e.head!=i.from+o&&(r=Se.cursor(i.from+o))}return r}const HP=n=>Ls(n,e=>ho(n,e,!0)),VP=n=>Ls(n,e=>ho(n,e,!1)),_P=n=>Ls(n,e=>ho(n,e,!li(n))),UP=n=>Ls(n,e=>ho(n,e,li(n))),qP=n=>Ls(n,e=>Se.cursor(n.lineBlockAt(e.head).from,1)),FP=n=>Ls(n,e=>Se.cursor(n.lineBlockAt(e.head).to,-1));function GP(n,e,t){let i=!1,r=_c(n.selection,o=>{let a=ir(n,o.head,-1)||ir(n,o.head,1)||o.head>0&&ir(n,o.head-1,1)||o.head<n.doc.length&&ir(n,o.head+1,-1);if(!a||!a.end)return o;i=!0;let u=a.start.from==o.head?a.end.to:a.end.from;return Se.cursor(u)});return i?(e(Bs(n,r)),!0):!1}const QP=({state:n,dispatch:e})=>GP(n,e);function gs(n,e,t){let i=_c(n.state.selection,r=>{r.undirectional&&r.head>=r.anchor!=e&&(r=Se.range(r.head,r.anchor));let o=t(r);return Se.range(r.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(Bs(n.state,i)),!0)}function qT(n,e){return gs(n,e,t=>n.moveByChar(t,e))}const FT=n=>qT(n,!li(n)),GT=n=>qT(n,li(n));function QT(n,e){return gs(n,e,t=>n.moveByGroup(t,e))}const KP=n=>QT(n,!li(n)),YP=n=>QT(n,li(n)),WP=n=>{let e=!li(n);return gs(n,e,t=>om(n.state,t,e))},XP=n=>{let e=li(n);return gs(n,e,t=>om(n.state,t,e))};function KT(n,e){return gs(n,e,t=>n.moveVertically(t,e))}const YT=n=>KT(n,!1),WT=n=>KT(n,!0);function XT(n,e){return gs(n,e,t=>n.moveVertically(t,e,_T(n).height))}const Zk=n=>XT(n,!1),Jk=n=>XT(n,!0),$P=n=>gs(n,!0,e=>ho(n,e,!0)),ZP=n=>gs(n,!1,e=>ho(n,e,!1)),JP=n=>{let e=!li(n);return gs(n,e,t=>ho(n,t,e))},eH=n=>{let e=li(n);return gs(n,e,t=>ho(n,t,e))},tH=n=>gs(n,!1,e=>Se.cursor(n.lineBlockAt(e.head).from)),nH=n=>gs(n,!0,e=>Se.cursor(n.lineBlockAt(e.head).to)),eA=({state:n,dispatch:e})=>(e(Bs(n,{anchor:0})),!0),tA=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.doc.length})),!0),nA=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.selection.main.anchor,head:0})),!0),iA=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),iH=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),sH=({state:n,dispatch:e})=>{let t=am(n).map(({from:i,to:r})=>Se.range(i,Math.min(r+1,n.doc.length)));return e(n.update({selection:Se.create(t),userEvent:"select"})),!0},rH=({state:n,dispatch:e})=>{let t=_c(n.selection,i=>{let r=ar(n),o=r.resolveStack(i.from,1);if(i.empty){let a=r.resolveStack(i.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:u}=a;if((u.from<i.from&&u.to>=i.to||u.to>i.to&&u.from<=i.from)&&a.next)return Se.range(u.to,u.from)}return i});return t.eq(n.selection)?!1:(e(Bs(n,t)),!0)};function $T(n,e){let{state:t}=n,i=t.selection,r=t.selection.ranges.slice();for(let o of t.selection.ranges){let a=t.doc.lineAt(o.head);if(e?a.to<n.state.doc.length:a.from>0)for(let u=o;;){let f=n.moveVertically(u,e);if(f.head<a.from||f.head>a.to){r.some(d=>d.head==f.head)||r.push(f);break}else{if(f.head==u.head)break;u=f}}}return r.length==i.ranges.length?!1:(n.dispatch(Bs(t,Se.create(r,r.length-1))),!0)}const lH=n=>$T(n,!1),oH=n=>$T(n,!0),aH=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=Se.create([t.main]):t.main.empty||(i=Se.create([Se.cursor(t.main.head)])),i?(e(Bs(n,i)),!0):!1};function qf(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,r=i.changeByRange(o=>{let{from:a,to:u}=o;if(a==u){let f=e(o);f<a?(t="delete.backward",f=Bd(n,f,!1)):f>a&&(t="delete.forward",f=Bd(n,f,!0)),a=Math.min(a,f),u=Math.max(u,f)}else a=Bd(n,a,!1),u=Bd(n,u,!0);return a==u?{range:o}:{changes:{from:a,to:u},range:Se.cursor(a,a<o.head?-1:1)}});return r.changes.empty?!1:(n.dispatch(i.update(r,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?et.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Bd(n,e,t){if(n instanceof et)for(let i of n.state.facet(et.atomicRanges).map(r=>r(n)))i.between(e,e,(r,o)=>{r<e&&o>e&&(e=t?o:r)});return e}const ZT=(n,e,t)=>qf(n,i=>{let r=i.from,{state:o}=n,a=o.doc.lineAt(r),u,f;if(t&&!e&&r>a.from&&r<a.from+200&&!/[^ \t]/.test(u=a.text.slice(0,r-a.from))){if(u[u.length-1]==" ")return r-1;let d=$p(u,o.tabSize),p=d%Ap(o)||Ap(o);for(let g=0;g<p&&u[u.length-1-g]==" ";g++)r--;f=r}else f=ii(a.text,r-a.from,e,e)+a.from,f==r&&a.number!=(e?o.doc.lines:1)?f+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(f-a.from,r-a.from))&&(f=ii(a.text,f-a.from,!1,!1)+a.from);return f}),Tb=n=>ZT(n,!1,!0),JT=n=>ZT(n,!0,!1),eO=(n,e)=>qf(n,t=>{let i=t.head,{state:r}=n,o=r.doc.lineAt(i),a=r.charCategorizer(i);for(let u=null;;){if(i==(e?o.to:o.from)){i==t.head&&o.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let f=ii(o.text,i-o.from,e)+o.from,d=o.text.slice(Math.min(i,f)-o.from,Math.max(i,f)-o.from),p=a(d);if(u!=null&&p!=u)break;(d!=" "||i!=t.head)&&(u=p),i=f}return i}),tO=n=>eO(n,!1),cH=n=>eO(n,!0),uH=n=>qf(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),fH=n=>qf(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),hH=n=>qf(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),dH=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:kt.of(["",""])},range:Se.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},pH=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let r=i.from,o=n.doc.lineAt(r),a=r==o.from?r-1:ii(o.text,r-o.from,!1)+o.from,u=r==o.to?r+1:ii(o.text,r-o.from,!0)+o.from;return{changes:{from:a,to:u,insert:n.doc.slice(r,u).append(n.doc.slice(a,r))},range:Se.cursor(u)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function am(n){let e=[],t=-1;for(let i of n.selection.ranges){let r=n.doc.lineAt(i.from),o=n.doc.lineAt(i.to);if(!i.empty&&i.to==o.from&&(o=n.doc.lineAt(i.to-1)),t>=r.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(i)}else e.push({from:r.from,to:o.to,ranges:[i]});t=o.number+1}return e}function nO(n,e,t){if(n.readOnly)return!1;let i=[],r=[];for(let o of am(n)){if(t?o.to==n.doc.length:o.from==0)continue;let a=n.doc.lineAt(t?o.to+1:o.from-1),u=a.length+1;if(t){i.push({from:o.to,to:a.to},{from:o.from,insert:a.text+n.lineBreak});for(let f of o.ranges)r.push(Se.range(Math.min(n.doc.length,f.anchor+u),Math.min(n.doc.length,f.head+u)))}else{i.push({from:a.from,to:o.from},{from:o.to,insert:n.lineBreak+a.text});for(let f of o.ranges)r.push(Se.range(f.anchor-u,f.head-u))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:Se.create(r,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const mH=({state:n,dispatch:e})=>nO(n,e,!1),gH=({state:n,dispatch:e})=>nO(n,e,!0);function iO(n,e,t){if(n.readOnly)return!1;let i=[];for(let o of am(n))t?i.push({from:o.from,insert:n.doc.slice(o.from,o.to)+n.lineBreak}):i.push({from:o.to,insert:n.lineBreak+n.doc.slice(o.from,o.to)});let r=n.changes(i);return e(n.update({changes:r,selection:n.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const yH=({state:n,dispatch:e})=>iO(n,e,!1),bH=({state:n,dispatch:e})=>iO(n,e,!0),vH=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(am(e).map(({from:r,to:o})=>(r>0?r--:o<e.doc.length&&o++,{from:r,to:o}))),i=_c(e.selection,r=>{let o;if(n.lineWrapping){let a=n.lineBlockAt(r.head),u=n.coordsAtPos(r.head,r.assoc||1);u&&(o=a.bottom+n.documentTop-u.bottom+n.defaultLineHeight/2)}return n.moveVertically(r,!0,o)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function xH(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=ar(n).resolveInner(e),i=t.childBefore(e),r=t.childAfter(e),o;return i&&r&&i.to<=e&&r.from>=e&&(o=i.type.prop(mt.closedBy))&&o.indexOf(r.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(r.from).from&&!/\S/.test(n.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const sA=sO(!1),SH=sO(!0);function sO(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(r=>{let{from:o,to:a}=r,u=e.doc.lineAt(o),f=!n&&o==a&&xH(e,o);n&&(o=a=(a<=u.to?u:e.doc.lineAt(a)).to);let d=new im(e,{simulateBreak:o,simulateDoubleBreak:!!f}),p=qv(d,o);for(p==null&&(p=$p(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));a<u.to&&/\s/.test(u.text[a-u.from]);)a++;f?{from:o,to:a}=f:o>u.from&&o<u.from+100&&!/\S/.test(u.text.slice(0,o))&&(o=u.from);let g=["",Sf(e,p)];return f&&g.push(Sf(e,d.lineIndent(u.from,-1))),{changes:{from:o,to:a,insert:kt.of(g)},range:Se.cursor(o+1+g[1].length)}});return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Kv(n,e){let t=-1;return n.changeByRange(i=>{let r=[];for(let a=i.from;a<=i.to;){let u=n.doc.lineAt(a);u.number>t&&(i.empty||i.to>u.from)&&(e(u,r,i),t=u.number),a=u.to+1}let o=n.changes(r);return{changes:r,range:Se.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}const wH=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new im(n,{overrideIndentation:o=>{let a=t[o];return a??-1}}),r=Kv(n,(o,a,u)=>{let f=qv(i,o.from);if(f==null)return;/\S/.test(o.text)||(f=0);let d=/^\s*/.exec(o.text)[0],p=Sf(n,f);(d!=p||u.from<o.from+d.length)&&(t[o.from]=f,a.push({from:o.from,to:o.from+d.length,insert:p}))});return r.changes.empty||e(n.update(r,{userEvent:"indent"})),!0},CH=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Kv(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Uv)})}),{userEvent:"input.indent"})),!0),kH=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Kv(n,(t,i)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let o=$p(r,n.tabSize),a=0,u=Sf(n,Math.max(0,o-Ap(n)));for(;a<r.length&&a<u.length&&r.charCodeAt(a)==u.charCodeAt(a);)a++;i.push({from:t.from+a,to:t.from+r.length,insert:u.slice(a)})}),{userEvent:"delete.dedent"})),!0),AH=n=>(n.setTabFocusMode(),!0),EH=[{key:"Ctrl-b",run:LT,shift:FT,preventDefault:!0},{key:"Ctrl-f",run:zT,shift:GT},{key:"Ctrl-p",run:HT,shift:YT},{key:"Ctrl-n",run:VT,shift:WT},{key:"Ctrl-a",run:qP,shift:tH},{key:"Ctrl-e",run:FP,shift:nH},{key:"Ctrl-d",run:JT},{key:"Ctrl-h",run:Tb},{key:"Ctrl-k",run:uH},{key:"Ctrl-Alt-h",run:tO},{key:"Ctrl-o",run:dH},{key:"Ctrl-t",run:pH},{key:"Ctrl-v",run:Rb}],RH=[{key:"ArrowLeft",run:LT,shift:FT,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:BP,shift:KP,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:_P,shift:JP,preventDefault:!0},{key:"ArrowRight",run:zT,shift:GT,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:LP,shift:YP,preventDefault:!0},{mac:"Cmd-ArrowRight",run:UP,shift:eH,preventDefault:!0},{key:"ArrowUp",run:HT,shift:YT,preventDefault:!0},{mac:"Cmd-ArrowUp",run:eA,shift:nA},{mac:"Ctrl-ArrowUp",run:$k,shift:Zk},{key:"ArrowDown",run:VT,shift:WT,preventDefault:!0},{mac:"Cmd-ArrowDown",run:tA,shift:iA},{mac:"Ctrl-ArrowDown",run:Rb,shift:Jk},{key:"PageUp",run:$k,shift:Zk},{key:"PageDown",run:Rb,shift:Jk},{key:"Home",run:VP,shift:ZP,preventDefault:!0},{key:"Mod-Home",run:eA,shift:nA},{key:"End",run:HP,shift:$P,preventDefault:!0},{key:"Mod-End",run:tA,shift:iA},{key:"Enter",run:sA,shift:sA},{key:"Mod-a",run:iH},{key:"Backspace",run:Tb,shift:Tb,preventDefault:!0},{key:"Delete",run:JT,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:tO,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:cH,preventDefault:!0},{mac:"Mod-Backspace",run:fH,preventDefault:!0},{mac:"Mod-Delete",run:hH,preventDefault:!0}].concat(EH.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),TH=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:IP,shift:WP},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:PP,shift:XP},{key:"Alt-ArrowUp",run:mH},{key:"Shift-Alt-ArrowUp",run:yH},{key:"Alt-ArrowDown",run:gH},{key:"Shift-Alt-ArrowDown",run:bH},{key:"Mod-Alt-ArrowUp",run:lH},{key:"Mod-Alt-ArrowDown",run:oH},{key:"Escape",run:aH},{key:"Mod-Enter",run:SH},{key:"Alt-l",mac:"Ctrl-l",run:sH},{key:"Mod-i",run:rH,preventDefault:!0},{key:"Mod-[",run:kH},{key:"Mod-]",run:CH},{key:"Mod-Alt-\\",run:wH},{key:"Shift-Mod-k",run:vH},{key:"Shift-Mod-\\",run:QP},{key:"Mod-/",run:mP},{key:"Alt-A",run:yP},{key:"Ctrl-m",mac:"Shift-Alt-m",run:AH}].concat(RH);var rA={};class Rp{constructor(e,t,i,r,o,a,u,f,d,p=0,g){this.p=e,this.stack=t,this.state=i,this.reducePos=r,this.pos=o,this.score=a,this.buffer=u,this.bufferBase=f,this.curContext=d,this.lookAhead=p,this.parent=g}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let r=e.parser.context;return new Rp(e,[],t,i,i,0,[],0,r?new lA(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,r=e&65535,{parser:o}=this.p,a=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),u=o.dynamicPrecedence(r);if(u&&(this.score+=u),i==0){r<o.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r<o.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(r,this.reducePos);return}let f=this.stack.length-(i-1)*3-(e&262144?6:0),d=f?this.stack[f-2]:this.p.ranges[0].from;r<o.minRepeatTerm&&d==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let p=this.reducePos-d;p>=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let g=f?this.stack[f-1]:0,b=this.bufferBase+this.buffer.length-g;if(r<o.minRepeatTerm||e&131072){let v=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,d,v,b+4,!0)}if(e&262144)this.state=this.stack[f];else{let v=this.stack[f-3];this.state=o.getGoto(v,r,!0)}for(;this.stack.length>f;)this.stack.pop();this.reduceContext(r,d)}storeNode(e,t,i,r=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this.buffer.length;if(a>0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==i)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,t,i,r);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let u=!1;for(let f=a;f>0&&this.buffer[f-2]>i;f-=4)if(this.buffer[f-1]>=0){u=!0;break}if(u)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,r>4&&(r-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=r}}shift(e,t,i,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=r;let u=a.stateFlag(o,1);!u&&(r>i||t<=a.maxNode)&&(this.reducePos=r),this.pushState(o,u?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,r,4)}else this.pos=r,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,r,4)}apply(e,t,i,r){e&65536?this.reduce(e):this.shift(e,t,i,r)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Rp(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new OH(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let o=0,a;o<t.length;o+=2)(a=t[o+1])!=this.state&&this.p.parser.hasAction(a,e)&&r.push(t[o],a);if(this.stack.length<120)for(let o=0;r.length<8&&o<t.length;o+=2){let a=t[o+1];r.some((u,f)=>f&1&&u==a)||r.push(t[o],a)}t=r}let i=[];for(let r=0;r<t.length&&i.length<4;r+=2){let o=t[r+1];if(o==this.state)continue;let a=this.split();a.pushState(o,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[r],this.pos),a.reducePos=this.pos,a.score-=200,i.push(a)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let i=t>>19,r=t&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],r,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(r,o)=>{if(!t.includes(r))return t.push(r),e.allActions(r,a=>{if(!(a&393216))if(a&65536){let u=(a>>19)-o;if(u>1){let f=a&65535,d=this.stack.length-u*3;if(d>=0&&e.getGoto(this.stack[d],f,!1)>=0)return u<<19|65536|f}}else{let u=i(a,o+1);if(u!=null)return u}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new lA(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class lA{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class OH{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Tp{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Tp(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Tp(this.stack,this.pos,this.index)}}function Ld(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,r=0;i<n.length;){let o=0;for(;;){let a=n.charCodeAt(i++),u=!1;if(a==126){o=65535;break}a>=92&&a--,a>=34&&a--;let f=a-32;if(f>=46&&(f-=46,u=!0),o+=f,u)break;o*=46}t?t[r++]=o:t=new e(o)}return t}class Kd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const oA=new Kd;class MH{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=oA,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,r=this.rangeIndex,o=this.pos+e;for(;o<i.from;){if(!r)return null;let a=this.ranges[--r];o-=i.from-a.to,i=a}for(;t<0?o>i.to:o>=i.to;){if(r==this.ranges.length-1)return null;let a=this.ranges[++r];o+=a.from-i.to,i=a}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,r;if(t>=0&&t<this.chunk.length)i=this.pos+e,r=this.chunk.charCodeAt(t);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(i=o,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let a=this.rangeIndex,u=this.range;for(;u.to<=i;)u=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>u.to&&(this.chunk2=this.chunk2.slice(0,u.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=oA,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(i+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return i}}class fc{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;NH(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}fc.prototype.contextual=fc.prototype.fallback=fc.prototype.extend=!1;fc.prototype.fallback=fc.prototype.extend=!1;function NH(n,e,t,i,r,o){let a=0,u=1<<i,{dialect:f}=t.p.parser;e:for(;(u&n[a])!=0;){let d=n[a+1];for(let v=a+3;v<d;v+=2)if((n[v+1]&u)>0){let S=n[v];if(f.allows(S)&&(e.token.value==-1||e.token.value==S||DH(S,e.token.value,r,o))){e.acceptToken(S);break}}let p=e.next,g=0,b=n[a+2];if(e.next<0&&b>g&&n[d+b*3-3]==65535){a=n[d+b*3-1];continue e}for(;g<b;){let v=g+b>>1,S=d+v+(v<<1),w=n[S],E=n[S+1]||65536;if(p<w)b=v;else if(p>=E)g=v+1;else{a=n[S+2],e.advance();continue e}}break}}function aA(n,e,t){for(let i=e,r;(r=n[i])!=65535;i++)if(r==t)return i-e;return-1}function DH(n,e,t,i){let r=aA(t,i,e);return r<0||aA(t,i,n)<r}const Fi=typeof process<"u"&&rA&&/\bparse\b/.test(rA.LOG);let r0=null;function cA(n,e,t){let i=n.cursor(fn.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class jH{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?cA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?cA(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],r=this.index[t];if(r==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=i.children[r],a=this.start[t]+i.positions[r];if(a>e)return this.nextStart=a,null;if(o instanceof Sn){if(a==e){if(a<this.safeFrom)return null;let u=a+o.length;if(u<=this.safeTo){let f=o.prop(mt.lookAhead);if(!f||u+f<this.fragment.to)return o}}this.index[t]++,a+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+o.length}}}class BH{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Kd)}getActions(e){let t=0,i=null,{parser:r}=e.p,{tokenizers:o}=r,a=r.stateSlot(e.state,3),u=e.curContext?e.curContext.hash:0,f=0;for(let d=0;d<o.length;d++){if((1<<d&a)==0)continue;let p=o[d],g=this.tokens[d];if(!(i&&!p.fallback)&&((p.contextual||g.start!=e.pos||g.mask!=a||g.context!=u)&&(this.updateCachedToken(g,p,e),g.mask=a,g.context=u),g.lookAhead>g.end+25&&(f=Math.max(g.lookAhead,f)),g.value!=0)){let b=t;if(g.extended>-1&&(t=this.addActions(e,g.extended,g.end,t)),t=this.addActions(e,g.value,g.end,t),!p.extend&&(i=g,t>b))break}}for(;this.actions.length>t;)this.actions.pop();return f&&e.setLookAhead(f),!i&&e.pos==this.stream.end&&(i=new Kd,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Kd,{pos:i,p:r}=e;return t.start=i,t.end=Math.min(i+1,r.stream.end),t.value=i==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,i){let r=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(r,e),i),e.value>-1){let{parser:o}=i.p;for(let a=0;a<o.specialized.length;a++)if(o.specialized[a]==e.value){let u=o.specializers[a](this.stream.read(e.start,e.end),i);if(u>=0&&i.p.parser.dialect.allows(u>>1)){(u&1)==0?e.value=u>>1:e.extended=u>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,i,r){for(let o=0;o<r;o+=3)if(this.actions[o]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=i,r}addActions(e,t,i,r){let{state:o}=e,{parser:a}=e.p,{data:u}=a;for(let f=0;f<2;f++)for(let d=a.stateSlot(o,f?2:1);;d+=3){if(u[d]==65535)if(u[d+1]==1)d=Dr(u,d+2);else{r==0&&u[d+1]==2&&(r=this.putAction(Dr(u,d+2),t,i,r));break}u[d]==t&&(r=this.putAction(Dr(u,d+1),t,i,r))}return r}}class LH{constructor(e,t,i,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new MH(t,r),this.tokens=new BH(e,this.stream),this.topTerm=e.top[1];let{from:o}=r[0];this.stacks=[Rp.start(this,e.top[0],o)],this.fragments=i.length&&this.stream.end-o>e.bufferLength*4?new jH(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],r,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let u=e[a];for(;;){if(this.tokens.mainToken=null,u.pos>t)i.push(u);else{if(this.advanceStack(u,i,e))continue;{r||(r=[],o=[]),r.push(u);let f=this.tokens.getMainToken(u);o.push(f.value,f.end)}}break}}if(!i.length){let a=r&&IH(r);if(a)return Fi&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Fi&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let a=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,o,i);if(a)return Fi&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((u,f)=>f.score-u.score);i.length>a;)i.pop();i.some(u=>u.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a<i.length-1;a++){let u=i[a];for(let f=a+1;f<i.length;f++){let d=i[f];if(u.sameState(d)||u.buffer.length>500&&d.buffer.length>500)if((u.score-d.score||u.buffer.length-d.buffer.length)>0)i.splice(f--,1);else{i.splice(a--,1);continue e}}}i.length>12&&(i.sort((a,u)=>u.score-a.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let a=1;a<i.length;a++)i[a].pos<this.minStackPos&&(this.minStackPos=i[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let r=e.pos,{parser:o}=this,a=Fi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,p=d?e.curContext.hash:0;for(let g=this.fragments.nodeAt(r);g;){let b=this.parser.nodeSet.types[g.type.id]==g.type?o.getGoto(e.state,g.type.id):-1;if(b>-1&&g.length&&(!d||(g.prop(mt.contextHash)||0)==p))return e.useNode(g,b),Fi&&console.log(a+this.stackID(e)+` (via reuse of ${o.getName(g.type.id)})`),!0;if(!(g instanceof Sn)||g.children.length==0||g.positions[0]>0)break;let v=g.children[0];if(v instanceof Sn&&g.positions[0]==0)g=v;else break}}let u=o.stateSlot(e.state,4);if(u>0)return e.reduce(u),Fi&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(u&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let f=this.tokens.getActions(e);for(let d=0;d<f.length;){let p=f[d++],g=f[d++],b=f[d++],v=d==f.length||!i,S=v?e:e.split(),w=this.tokens.mainToken;if(S.apply(p,g,w?w.start:S.pos,b),Fi&&console.log(a+this.stackID(S)+` (via ${(p&65536)==0?"shift":`reduce of ${o.getName(p&65535)}`} for ${o.getName(g)} @ ${r}${S==e?"":", split"})`),v)return!0;S.pos>r?t.push(S):i.push(S)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return uA(e,t),!0}}runRecovery(e,t,i){let r=null,o=!1;for(let a=0;a<e.length;a++){let u=e[a],f=t[a<<1],d=t[(a<<1)+1],p=Fi?this.stackID(u)+" -> ":"";if(u.deadEnd&&(o||(o=!0,u.restart(),Fi&&console.log(p+this.stackID(u)+" (restarted)"),this.advanceFully(u,i))))continue;let g=u.split(),b=p;for(let v=0;v<10&&g.forceReduce()&&(Fi&&console.log(b+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,i));v++)Fi&&(b=this.stackID(g)+" -> ");for(let v of u.recoverByInsert(f))Fi&&console.log(p+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,i);this.stream.end>u.pos?(d==u.pos&&(d++,f=0),u.recoverByDelete(f,d),Fi&&console.log(p+this.stackID(u)+` (via recover-delete ${this.parser.getName(f)})`),uA(u,i)):(!r||r.score<g.score)&&(r=g)}return r}stackToTree(e){return e.close(),Sn.build({buffer:Tp.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(r0||(r0=new WeakMap)).get(e);return t||r0.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function uA(n,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==n.pos&&i.sameState(n)){e[t].score<n.score&&(e[t]=n);return}}e.push(n)}class zH{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class Op extends yT{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let u=0;u<e.repeatNodeCount;u++)t.push("");let i=Object.keys(e.topRules).map(u=>e.topRules[u][1]),r=[];for(let u=0;u<t.length;u++)r.push([]);function o(u,f,d){r[u].push([f,f.deserialize(String(d))])}if(e.nodeProps)for(let u of e.nodeProps){let f=u[0];typeof f=="string"&&(f=mt[f]);for(let d=1;d<u.length;){let p=u[d++];if(p>=0)o(p,f,u[d++]);else{let g=u[d+-p];for(let b=-p;b>0;b--)o(u[d++],f,g);d++}}}this.nodeSet=new Pv(t.map((u,f)=>zi.define({name:f>=this.minRepeatTerm?void 0:u,id:f,props:r[f],top:i.indexOf(f)>-1,error:f==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(f)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=dT;let a=Ld(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let u=0;u<this.specializerSpecs.length;u++)this.specialized[u]=this.specializerSpecs[u].term;this.specializers=this.specializerSpecs.map(fA),this.states=Ld(e.states,Uint32Array),this.data=Ld(e.stateData),this.goto=Ld(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(u=>typeof u=="number"?new fc(a,u):u),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let r=new LH(this,e,t,i);for(let o of this.wrappers)r=o(r,e,t,i);return r}getGoto(e,t,i=!1){let r=this.goto;if(t>=r[0])return-1;for(let o=r[t+1];;){let a=r[o++],u=a&1,f=r[o++];if(u&&i)return f;for(let d=o+(a>>1);o<d;o++)if(r[o]==e)return f;if(u)return-1}}hasAction(e,t){let i=this.data;for(let r=0;r<2;r++)for(let o=this.stateSlot(e,r?2:1),a;;o+=3){if((a=i[o])==65535)if(i[o+1]==1)a=i[o=Dr(i,o+2)];else{if(i[o+1]==2)return Dr(i,o+2);break}if(a==t||a==0)return Dr(i,o+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),r=i?t(i):void 0;for(let o=this.stateSlot(e,1);r==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Dr(this.data,o+2);else break;r=t(Dr(this.data,o+1))}return r}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Dr(this.data,i+2);else break;if((this.data[i+2]&1)==0){let r=this.data[i+1];t.some((o,a)=>a&1&&o==r)||t.push(this.data[i],r)}}return t}configure(e){let t=Object.assign(Object.create(Op.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let r=e.tokenizers.find(o=>o.from==i);return r?r.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,r)=>{let o=e.specializers.find(u=>u.from==i.external);if(!o)return i;let a=Object.assign(Object.assign({},i),{external:o.to});return t.specializers[r]=fA(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let o of e.split(" ")){let a=t.indexOf(o);a>=0&&(i[a]=!0)}let r=null;for(let o=0;o<t.length;o++)if(!i[o])for(let a=this.dialects[t[o]],u;(u=this.data[a++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[u]=1;return new zH(e,i,r)}static deserialize(e){return new Op(e)}}function Dr(n,e){return n[e]|n[e+1]<<16}function IH(n){let e=null;for(let t of n){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function fA(n){if(n.external){let e=n.extend?1:0;return(t,i)=>n.external(t,i)<<1|e}return n.get}const PH=bT({String:Ee.string,Number:Ee.number,"True False":Ee.bool,PropertyName:Ee.propertyName,Null:Ee.null,", :":Ee.separator,"[ ]":Ee.squareBracket,"{ }":Ee.brace}),HH=Op.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[PH],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),VH=Cp.define({name:"json",parser:HH.configure({props:[wT.add({Object:Qk({except:/^\s*\}/}),Array:Qk({except:/^\s*\]/})}),X8.add({"Object Array":$8})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function _H(){return new H8(VH)}function Yv({value:n,onChange:e,readOnly:t=!1,placeholderText:i="{ }"}){const r=A.useRef(null),o=A.useRef(null),a=A.useRef(e);a.current=e;const u=A.useRef(new Pf);return A.useEffect(()=>{if(!r.current)return;const f=[et.editable.of(!t),wt.readOnly.of(t)],d=wt.create({doc:n,extensions:[v8(),kP(),W8(),aP(),l8(),Z8(tP,{fallback:!0}),_H(),u8(i),fT.of([...TH,...jP]),u.current.of(f),et.updateListener.of(g=>{g.docChanged&&a.current(g.state.doc.toString())}),et.theme({"&":{fontSize:"12px",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace"},".cm-gutters":{backgroundColor:"transparent",border:"none"}})]}),p=new et({state:d,parent:r.current});return o.current=p,()=>{p.destroy(),o.current=null}},[]),A.useEffect(()=>{const f=o.current;f&&n!==f.state.doc.toString()&&f.dispatch({changes:{from:0,to:f.state.doc.length,insert:n}})},[n]),A.useEffect(()=>{var f;(f=o.current)==null||f.dispatch({effects:u.current.reconfigure([et.editable.of(!t),wt.readOnly.of(t)])})},[t]),x.jsx("div",{ref:r,className:"w-full overflow-hidden rounded-md border border-input bg-background py-1 text-left"})}const Ob=(n,e)=>n instanceof Tf?n.body.error:e,l0=n=>({description:n.description??"",groupName:n.groupName??"",schemaText:n.schema!==void 0?JSON.stringify(n.schema,null,2):"",deprecated:n.deprecated??!1}),UH=(n,e)=>n.description===e.description&&n.groupName===e.groupName&&n.schemaText===e.schemaText&&n.deprecated===e.deprecated;function qH({type:n,readonly:e,onBack:t}){const i=ua(),r=io(),[o,a]=A.useState(()=>l0(n)),u=l0(n),f=!UH(o,u);A.useEffect(()=>{a(l0(n))},[n.name]),A.useEffect(()=>{const k=()=>!f||window.confirm("Discard unsaved event-type changes?");return Z2(k),()=>J2(k)},[f]);let d=null,p;if(o.schemaText.trim()!=="")try{p=JSON.parse(o.schemaText)}catch{d="Schema is not valid JSON"}const g=Yi({mutationFn:()=>m3(n.name,{name:n.name,description:o.description||void 0,groupName:o.groupName||void 0,deprecated:o.deprecated||void 0,...o.schemaText.trim()!==""?{schema:p}:{}}),onSuccess:()=>{i.add("success","Event type saved"),r.invalidateQueries({queryKey:["event-types"]})},onError:k=>i.add("error",Ob(k,"Failed to save event type"))}),[b,v]=A.useState(!1),[S,w]=A.useState(""),E=Yi({mutationFn:()=>g3(n.name),onSuccess:()=>{i.add("success","Event type deleted"),r.invalidateQueries({queryKey:["event-types"]}),v(!1),t()},onError:k=>i.add("error",Ob(k,"Failed to delete event type"))});return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsxs("button",{onClick:t,className:"mb-4 inline-flex items-center gap-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[x.jsx(Np,{className:"size-3.5"}),"Event Types"]}),x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx("h1",{className:"font-mono text-xl font-semibold tracking-tight",children:n.name}),(e?n.deprecated:o.deprecated)&&x.jsx(lr,{className:"border-warning/30 bg-warning/10 text-warning",children:"Deprecated"})]}),x.jsxs("div",{className:"mt-6 flex flex-col gap-5",children:[x.jsx(Es,{title:"Details",children:x.jsxs("div",{className:"flex flex-col gap-4",children:[x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"et-desc",className:"text-xs font-medium text-muted-foreground",children:"Description"}),x.jsx(Ms,{id:"et-desc",placeholder:"What does this event mean?",value:o.description,disabled:e,onChange:k=>a({...o,description:k.target.value})})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"et-group",className:"text-xs font-medium text-muted-foreground",children:"Group"}),x.jsx(Ms,{id:"et-group",placeholder:"Billing",value:o.groupName,disabled:e,onChange:k=>a({...o,groupName:k.target.value})})]}),x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(V5,{checked:o.deprecated,onCheckedChange:k=>!e&&a({...o,deprecated:k}),disabled:e,"aria-label":"Deprecated"}),x.jsxs("div",{children:[x.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Deprecated"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Flagged in the UI but still deliverable."})]})]})]})}),x.jsxs(Es,{title:"Payload schema",description:"Optional JSON Schema documenting the payload. Enforced only when the core is configured with a payload validator.",children:[x.jsx(Yv,{value:o.schemaText,onChange:k=>!e&&a({...o,schemaText:k}),readOnly:e,placeholderText:'{ "type": "object" }'}),d&&x.jsx("p",{className:"mt-2 text-xs text-destructive",children:d})]}),!e&&x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Wt,{variant:"primary",disabled:!f||d!==null,loading:g.isPending,onClick:()=>g.mutate(),children:"Save changes"}),f&&x.jsx(Wt,{variant:"secondary",onClick:()=>a(u),children:"Revert"}),x.jsx("div",{className:"ml-auto",children:x.jsx(Wt,{variant:"danger",icon:x.jsx(Ub,{className:"size-3.5"}),onClick:()=>{w(""),v(!0)},children:"Delete event type"})})]})]}),x.jsxs(_d,{open:b,onClose:()=>v(!1),onConfirm:()=>E.mutate(),title:"Delete event type",confirmLabel:"Delete permanently",danger:!0,loading:E.isPending,confirmDisabled:S!==n.name,children:[x.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["Endpoints subscribed to ",x.jsx("code",{className:"font-mono text-foreground",children:n.name})," ","keep their subscription entry and simply stop matching new publishes of this name. This can't be undone."]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("label",{htmlFor:"et-delete-confirm",className:"text-xs font-medium text-muted-foreground",children:["Type ",x.jsx("code",{className:"font-mono text-foreground",children:n.name})," to confirm"]}),x.jsx(Ms,{id:"et-delete-confirm",className:"font-mono",value:S,onChange:k=>w(k.target.value),autoFocus:!0})]})]})]})}function FH({readonly:n,portal:e,selectedName:t,onOpen:i,onBack:r}){const o=ua(),a=io(),u=ji({queryKey:["event-types"],queryFn:qb,staleTime:1e4}),[f,d]=A.useState(!1),[p,g]=A.useState(""),b=Yi({mutationFn:()=>p3({name:p.trim()}),onSuccess:E=>{a.invalidateQueries({queryKey:["event-types"]}),d(!1),g(""),i(E.name)},onError:E=>o.add("error",Ob(E,"Failed to create event type"))}),v=u.data??[],S=t?v.find(E=>E.name===t):void 0;if(S)return x.jsx(qH,{type:S,readonly:n,onBack:r});if(t&&u.isLoading)return x.jsx(Ns,{label:"Loading event type…"});const w=Pj(v);return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Event Types",description:x.jsxs(x.Fragment,{children:["The global catalog",e?" (read-only in the portal)":""," — public at"," ",x.jsx("code",{className:"font-mono text-foreground",children:"api/event-types.json"})," so receiver teams can browse it without panel credentials."]}),actions:n?void 0:x.jsx(Wt,{variant:"primary",icon:x.jsx(Dp,{className:"size-4"}),onClick:()=>d(!0),children:"New event type"})}),u.isLoading?x.jsx(Ns,{label:"Loading event types…"}):u.isError?x.jsx(Li,{children:"Failed to load event types."}):v.length===0?x.jsx(Li,{children:"No event types yet. Define the kinds of events your applications publish."}):x.jsx("div",{className:"mt-4 flex flex-col gap-6",children:w.map(({group:E,types:k})=>x.jsxs("div",{children:[x.jsx("h2",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:E}),x.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:k.map(R=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>i(R.name),className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary/30",children:[x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"truncate font-mono text-[13px] font-medium text-foreground",children:R.name}),R.deprecated&&x.jsx(lr,{className:"border-warning/30 bg-warning/10 text-warning",children:"Deprecated"}),R.schema!==void 0&&x.jsx(lr,{children:"Schema"})]}),R.description&&x.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:R.description})]}),x.jsx(aa,{className:"size-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},R.name))})})]},E))}),x.jsxs(up,{open:f,onClose:()=>d(!1),title:"New event type",footer:x.jsxs(x.Fragment,{children:[x.jsx(Wt,{variant:"secondary",onClick:()=>d(!1),children:"Cancel"}),x.jsx(Wt,{variant:"primary",disabled:!p.trim(),loading:b.isPending,onClick:()=>b.mutate(),children:"Create event type"})]}),children:[x.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["Dot-delimited, e.g. ",x.jsx("code",{className:"font-mono text-foreground",children:"invoice.paid"}),". Endpoints subscribe to event types by name."]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"new-et-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),x.jsx(Ms,{id:"new-et-name",className:"font-mono",placeholder:"invoice.paid",value:p,onChange:E=>g(E.target.value),onKeyDown:E=>{E.key==="Enter"&&p.trim()&&!b.isPending&&b.mutate()},autoFocus:!0})]})]})]})}const hA=50;function GH(n){try{return JSON.stringify(JSON.parse(n.envelope),null,2)}catch{return n.envelope}}function QH({app:n,id:e,onBack:t,onOpenDelivery:i}){const r=ji({queryKey:["messages",n,{id:e}],queryFn:()=>R3(n,e)});if(r.isLoading)return x.jsx(Ns,{label:"Loading message…"});if(r.isError||!r.data)return x.jsx("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:x.jsx(Li,{children:"Message not found."})});const o=r.data;return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsxs("button",{onClick:t,className:"mb-4 inline-flex items-center gap-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[x.jsx(Np,{className:"size-3.5"}),"Messages"]}),x.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[x.jsx("h1",{className:"font-mono text-xl font-semibold tracking-tight",children:o.eventType}),x.jsx(Tc,{className:"text-muted-foreground",children:o.id})]}),x.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Published ",Xn(o.createdAt)," · event time"," ",Xn(o.timestamp)," · the message id is the"," ",x.jsx("code",{className:"font-mono",children:"webhook-id"})," header (receivers dedupe on it)",o.idempotencyKey?x.jsxs(x.Fragment,{children:[" ","· idempotency key ",x.jsx("span",{className:"font-mono",children:o.idempotencyKey})]}):null]}),x.jsxs("div",{className:"mt-6 flex flex-col gap-5",children:[x.jsx(Es,{title:"Envelope",description:"The exact signed bytes every delivery of this message carries.",children:x.jsx(Yv,{value:GH(o),onChange:()=>{},readOnly:!0})}),x.jsx(Es,{title:"Deliveries",description:"One delivery per matching endpoint (fan-out).",children:o.deliveries.length===0?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No deliveries — no enabled endpoint matched this event type at publish time."}):x.jsx("ul",{className:"divide-y divide-border",children:o.deliveries.map(a=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>i(a.id),className:"group flex w-full items-center gap-3 py-2.5 text-left",children:[x.jsx(If,{status:a.status}),x.jsx(Tc,{className:"min-w-0 flex-1 truncate",children:a.id}),x.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.attemptCount," attempt",a.attemptCount===1?"":"s"]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(a.updatedAt),children:Of(a.updatedAt)}),x.jsx(aa,{className:"size-4 text-muted-foreground/50 group-hover:text-muted-foreground"})]})},a.id))})})]})]})}function KH({app:n,selectedId:e,onOpen:t,onBack:i,onOpenDelivery:r}){var g;const[o,a]=Nb.useState(""),f=ji({queryKey:["event-types"],queryFn:qb}).data??[],d=QA({queryKey:["messages",n,{eventType:o}],queryFn:({pageParam:b})=>E3(n,{limit:hA,...o?{eventType:o}:{},...b?{before:b}:{}}),initialPageParam:"",getNextPageParam:b=>{var v;return b.length===hA?(v=b[b.length-1])==null?void 0:v.id:void 0},enabled:n!==""&&!e});if(!n)return x.jsx(Kp,{});if(e)return x.jsx(QH,{app:n,id:e,onBack:i,onOpenDelivery:r});const p=((g=d.data)==null?void 0:g.pages.flat())??[];return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Messages",description:"Every published event, newest first. A message's payload is signed once and shared by all its deliveries."}),x.jsx("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:x.jsx(Sv,{"aria-label":"Filter by event type",value:o,onValueChange:a,options:[{value:"",label:"All event types"},...f.map(b=>({value:b.name,label:b.name}))],className:"w-64"})}),d.isLoading?x.jsx(Ns,{label:"Loading messages…"}):d.isError?x.jsx(Li,{children:"Failed to load messages."}):p.length===0?x.jsx(Li,{children:o?`No messages of type "${o}".`:"No messages published yet."}):x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:p.map(b=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>t(b.id),className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary/30",children:[x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("span",{className:"block truncate font-mono text-[13px] font-medium text-foreground",children:b.eventType}),x.jsx(Tc,{className:"mt-0.5 block truncate text-muted-foreground",children:b.id})]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(b.createdAt),children:Of(b.createdAt)}),x.jsx(aa,{className:"size-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},b.id))})}),d.hasNextPage&&x.jsx("div",{className:"mt-4 flex justify-center",children:x.jsx(Wt,{variant:"secondary",loading:d.isFetchingNextPage,onClick:()=>d.fetchNextPage(),children:"Load more"})})]})]})}const dA=50,YH=[{label:"All",status:""},{label:"Pending",status:"pending"},{label:"Succeeded",status:"succeeded"},{label:"Dead-letter",status:"failed"}],WH={schedule:"border-border bg-secondary/60 text-muted-foreground",manual:"border-accent/30 bg-accent/10 text-accent",test:"border-chart-2/30 bg-chart-2/10 text-chart-2"};function XH({attempt:n}){return x.jsxs("li",{className:"relative pl-8",children:[x.jsx("span",{className:jt("absolute left-2 top-1.5 size-2.5 rounded-full border-2 border-card",n.ok?"bg-success":"bg-destructive"),"aria-hidden":!0}),x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsxs("span",{className:"text-[13px] font-semibold text-foreground",children:["Attempt #",n.attemptNumber]}),x.jsx(lr,{className:WH[n.trigger],children:n.trigger}),n.httpStatus!==void 0?x.jsxs("span",{className:jt("font-mono text-[12px] font-medium",n.ok?"text-success":"text-destructive"),children:["HTTP ",n.httpStatus]}):x.jsx("span",{className:"font-mono text-[12px] font-medium text-destructive",children:n.error??"network error"}),x.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:Lj(n.durationMs)}),x.jsx("span",{className:"ml-auto whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(n.at),children:Xn(n.at)})]}),n.responseBody!==void 0&&n.responseBody!==""&&x.jsx("pre",{className:"mt-1.5 max-h-32 overflow-auto whitespace-pre-wrap break-all rounded-md border border-border bg-secondary/30 px-2.5 py-1.5 font-mono text-[11px] leading-relaxed text-muted-foreground",children:n.responseBody}),n.error!==void 0&&n.httpStatus!==void 0&&x.jsx("p",{className:"mt-1 font-mono text-[11px] text-destructive",children:n.error})]})}const o0=new Set(["webhook-id","webhook-timestamp","webhook-signature"]);function a0(n){return`'${n.replace(/'/g,"'\\''")}'`}function $H(n){const e=[`curl -X ${n.method} ${a0(n.url)}`];for(const[t,i]of Object.entries(n.headers))e.push(` -H ${a0(`${t}: ${i}`)}`);return n.body&&e.push(` -d ${a0(n.body)}`),e.join(` \\
|
|
209
|
-
`)}function ZH(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}function JH({name:n,value:e,signing:t}){return x.jsxs("div",{className:jt("flex gap-3 px-3 py-1.5",t&&"bg-accent/[0.06] border-l-2 border-accent"),children:[x.jsx("span",{className:jt("w-44 shrink-0 break-all font-mono text-[12px]",t?"font-semibold text-accent":"text-foreground"),children:n}),x.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-[12px] text-muted-foreground",children:e})]})}function eV({app:n,deliveryId:e}){const t=ua(),[i,r]=A.useState(!1),o=ji({queryKey:["delivery-request",n,e],queryFn:()=>O3(n,e),enabled:i}),a=async()=>{if(o.data)try{await navigator.clipboard.writeText($H(o.data)),t.add("success","Copied curl command","Paste it into a terminal to replay the request.")}catch{t.add("error","Copy failed","Clipboard access was denied by the browser.")}},u=o.data,f=u?Object.entries(u.headers).sort((d,p)=>{const g=o0.has(d[0].toLowerCase())?0:1,b=o0.has(p[0].toLowerCase())?0:1;return g-b}):[];return x.jsxs("section",{className:"rounded-xl border border-border bg-card",children:[x.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3",children:[x.jsxs("div",{children:[x.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:"Request"}),x.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"The signature and webhook-timestamp are computed live; each attempt re-signs."})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[i&&u&&x.jsx(Wt,{size:"sm",variant:"secondary",icon:x.jsx(_D,{className:"size-3.5"}),onClick:a,"aria-label":"Copy request as a curl command",children:"Copy as curl"}),x.jsx(Wt,{size:"sm",variant:"ghost",icon:x.jsx(s3,{className:"size-3.5"}),"aria-expanded":i,"aria-controls":"delivery-request-panel",onClick:()=>r(d=>!d),children:i?"Hide request":"Show request"})]})]}),i&&x.jsx("div",{id:"delivery-request-panel",className:"px-4 py-4",children:o.isLoading?x.jsx(Ns,{label:"Building the signed request…"}):o.isError||!u?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Could not build the request — the delivery or its endpoint may have been deleted."}):x.jsxs("div",{className:"flex flex-col gap-4",children:[x.jsx("div",{className:"overflow-x-auto rounded-md border border-border bg-secondary/30 px-3 py-2",children:x.jsxs("code",{className:"whitespace-nowrap font-mono text-[12px] text-foreground",children:[x.jsx("span",{className:"font-semibold text-accent",children:u.method})," ",u.url]})}),x.jsxs("div",{children:[x.jsx("h3",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Headers"}),x.jsx("div",{className:"divide-y divide-border overflow-hidden rounded-md border border-border",children:f.map(([d,p])=>x.jsx(JH,{name:d,value:p,signing:o0.has(d.toLowerCase())},d))})]}),x.jsxs("div",{children:[x.jsx("h3",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Body"}),x.jsx(Yv,{value:ZH(u.body),onChange:()=>{},readOnly:!0})]})]})})]})}function tV({app:n,id:e,readonly:t,onBack:i,onOpenMessage:r,onOpenEndpoint:o}){const a=ua(),u=io(),f=ji({queryKey:["deliveries",n,{id:e}],queryFn:()=>T3(n,e),refetchInterval:b=>{var S;const v=(S=b.state.data)==null?void 0:S.status;return v==="pending"||v==="delivering"?1500:!1}}),d=Yi({mutationFn:()=>M3(n,e),onSuccess:()=>{a.add("success","Delivery re-queued","It is due for immediate retry."),u.invalidateQueries({queryKey:["deliveries",n]})},onError:b=>a.add("error",b instanceof Tf?b.body.error:"Failed to retry delivery")});if(f.isLoading)return x.jsx(Ns,{label:"Loading delivery…"});if(f.isError||!f.data)return x.jsx("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:x.jsx(Li,{children:"Delivery not found."})});const p=f.data,g=[...p.attempts].sort((b,v)=>v.attemptNumber-b.attemptNumber);return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsxs("button",{onClick:i,className:"mb-4 inline-flex items-center gap-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[x.jsx(Np,{className:"size-3.5"}),"Deliveries"]}),x.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[x.jsx("h1",{className:"font-mono text-xl font-semibold tracking-tight",children:p.id}),x.jsx(If,{status:p.status}),!t&&p.status==="failed"&&x.jsx(Wt,{variant:"primary",size:"sm",icon:x.jsx(ZD,{className:"size-3.5"}),loading:d.isPending,onClick:()=>d.mutate(),children:"Retry"})]}),x.jsxs("dl",{className:"mt-3 grid grid-cols-1 gap-x-8 gap-y-2 text-[13px] sm:grid-cols-2",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("dt",{className:"w-28 shrink-0 text-xs font-medium text-muted-foreground",children:"Message"}),x.jsx("dd",{children:x.jsx("button",{onClick:()=>r(p.messageId),className:"font-mono text-[12px] text-accent hover:underline",children:p.messageId})})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("dt",{className:"w-28 shrink-0 text-xs font-medium text-muted-foreground",children:"Endpoint"}),x.jsx("dd",{children:x.jsx("button",{onClick:()=>o(p.endpointId),className:"font-mono text-[12px] text-accent hover:underline",children:p.endpointId})})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("dt",{className:"w-28 shrink-0 text-xs font-medium text-muted-foreground",children:"Created"}),x.jsx("dd",{className:"tabular-nums text-muted-foreground",children:Xn(p.createdAt)})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("dt",{className:"w-28 shrink-0 text-xs font-medium text-muted-foreground",children:"Next attempt"}),x.jsx("dd",{className:"tabular-nums text-muted-foreground",children:p.nextAttemptAt?Xn(p.nextAttemptAt):"—"})]})]}),x.jsx("div",{className:"mt-6",children:x.jsx(Es,{title:`Attempt timeline (${g.length})`,description:"Newest first. Response bodies are truncated server-side.",children:g.length===0?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No attempts yet — the dispatcher picks it up when it is due."}):x.jsx("ul",{className:"relative flex flex-col gap-4 before:absolute before:bottom-1 before:left-[13px] before:top-2 before:w-px before:bg-border",children:g.map(b=>x.jsx(XH,{attempt:b},b.id))})})}),x.jsx("div",{className:"mt-6",children:x.jsx(eV,{app:n,deliveryId:e})})]})}function nV({app:n,readonly:e,selectedId:t,onOpen:i,onBack:r,onOpenMessage:o,onOpenEndpoint:a}){var E;const[u,f]=A.useState(""),[d,p]=A.useState(""),b=ji({queryKey:["endpoints",n],queryFn:()=>Fb(n),staleTime:3e4,enabled:n!==""}).data??[],v=k=>{var R;return((R=b.find(N=>N.id===k))==null?void 0:R.url)??k},S=QA({queryKey:["deliveries",n,{status:u,endpointId:d}],queryFn:({pageParam:k})=>Gb(n,{limit:dA,...u?{status:u}:{},...d?{endpoint:d}:{},...k?{before:k}:{}}),initialPageParam:"",getNextPageParam:k=>{var R;return k.length===dA?(R=k[k.length-1])==null?void 0:R.id:void 0},enabled:n!==""&&!t,refetchInterval:2e3});if(!n)return x.jsx(Kp,{});if(t)return x.jsx(tV,{app:n,id:t,readonly:e,onBack:r,onOpenMessage:o,onOpenEndpoint:a});const w=((E=S.data)==null?void 0:E.pages.flat())??[];return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Deliveries",description:"One message to one endpoint, driven through the retry schedule to a terminal state."}),x.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[x.jsx("div",{className:"inline-flex h-9 items-center rounded-md border border-input bg-secondary/40 p-0.5 text-[13px]",children:YH.map(k=>x.jsx("button",{type:"button",onClick:()=>f(k.status),className:jt("h-8 rounded-[5px] px-3 font-medium transition-colors",u===k.status?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:k.label},k.label))}),x.jsx(Sv,{"aria-label":"Filter by endpoint",value:d,onValueChange:p,options:[{value:"",label:"All endpoints"},...b.map(k=>({value:k.id,label:k.url}))],className:"w-72"})]}),S.isLoading?x.jsx(Ns,{label:"Loading deliveries…"}):S.isError?x.jsx(Li,{children:"Failed to load deliveries."}):w.length===0?x.jsx(Li,{children:"No deliveries match the current filters."}):x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:w.map(k=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>i(k.id),className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary/30",children:[x.jsx(If,{status:k.status}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx(Tc,{className:"block truncate",children:k.id}),x.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[v(k.endpointId)," · ",k.attemptCount," attempt",k.attemptCount===1?"":"s"]})]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(k.updatedAt),children:Of(k.updatedAt)}),x.jsx(aa,{className:"size-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},k.id))})}),S.hasNextPage&&x.jsx("div",{className:"mt-4 flex justify-center",children:x.jsx(Wt,{variant:"secondary",loading:S.isFetchingNextPage,onClick:()=>S.fetchNextPage(),children:"Load more"})})]})]})}function iV(n){return n?n.name??n.email??n.id??"—":"—"}function sV(n){return n.includes("delete")?"bg-destructive/10 text-destructive border-destructive/20":n.includes("disable")||n.includes("rotate")?"bg-warning/10 text-warning border-warning/20":n.includes("create")?"bg-accent/10 text-accent border-accent/20":n.includes("retry")||n.includes("recover")||n.includes("enable")?"bg-success/10 text-success border-success/20":"bg-secondary/60 text-muted-foreground border-border"}function rV({app:n}){const e=ji({queryKey:["audit",n],queryFn:()=>N3(n),staleTime:15e3,enabled:n!==""}),t=A.useMemo(()=>e.data??[],[e.data]);return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Audit Log",description:"A record of every control-plane change for this application. Publishes are data-plane traffic — the message log is their record."}),e.isLoading&&x.jsx(Ns,{label:"Loading audit log…"}),e.isError&&x.jsx("p",{className:"mt-8 text-center text-[13px] text-destructive",children:"Failed to load audit log"}),t.length===0&&!e.isLoading&&!e.isError&&x.jsx(Li,{children:"No audit entries yet."}),t.length>0&&x.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{className:"w-full border-collapse",children:[x.jsx("thead",{children:x.jsx("tr",{className:"border-b border-border",children:["Action","Subject","By","At","Message"].map(i=>x.jsx("th",{className:"whitespace-nowrap px-4 py-2.5 text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i},i))})}),x.jsx("tbody",{className:"divide-y divide-border",children:t.map((i,r)=>x.jsxs("tr",{children:[x.jsx("td",{className:"px-4 py-3",children:x.jsx("span",{className:jt("inline-flex rounded-md border px-1.5 py-0.5 text-[11px] font-medium",sV(i.action)),children:i.action})}),x.jsx("td",{className:"px-4 py-3 font-mono text-[12px] text-muted-foreground",children:i.subjectId??"—"}),x.jsx("td",{className:"px-4 py-3 text-[12px] text-muted-foreground",children:iV(i.by)}),x.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-[12px] tabular-nums text-muted-foreground",children:Xn(i.at)}),x.jsx("td",{className:"max-w-[240px] px-4 py-3 text-[12px] text-muted-foreground",children:x.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap",children:i.message??"—"})})]},`${i.at}-${r}`))})]})})})]})}const lV=[{path:"/",label:"Overview",match:n=>n==="/",adminOnly:!0},{path:"/endpoints",label:"Endpoints",match:n=>n.startsWith("/endpoints")},{path:"/event-types",label:"Event Types",match:n=>n.startsWith("/event-types")},{path:"/messages",label:"Messages",match:n=>n.startsWith("/messages")},{path:"/deliveries",label:"Deliveries",match:n=>n.startsWith("/deliveries")},{path:"/audit",label:"Audit",match:n=>n.startsWith("/audit"),adminOnly:!0}];function oV(){return window.__WEBHOOKS_CONFIG__??{}}function aV({locationHook:n,base:e="",logoUrl:t,initialApplicationKey:i}){return x.jsx(eE,{hook:n??nE,base:e,children:x.jsx(cV,{logoUrl:t,initialApplicationKey:i})})}function cV({logoUrl:n,initialApplicationKey:e}){var j,X,J;const t=oV(),i=ua(),r=io(),[o,a]=ZA(),[u,f]=AD(),p=ji({queryKey:["config"],queryFn:f3,staleTime:6e4}).data??t,g=(p==null?void 0:p.readonly)??!1,b=(p==null?void 0:p.portal)??!1,v=b?((X=(j=p==null?void 0:p.principal)==null?void 0:j.id)==null?void 0:X.replace(/^portal:/,""))??"":null,S=(p==null?void 0:p.title)||"@xtandard/webhooks",w=n??(p==null?void 0:p.logoUrl),k=ji({queryKey:["applications"],queryFn:h3,staleTime:6e4,enabled:!b}).data??[],R=v??(u.get("app")||e||((J=k[0])==null?void 0:J.key)||""),N=u.toString(),T=V=>{QC()&&a(N?`${V}?${N}`:V)},B=V=>{QC()&&f(K=>{const ae=new URLSearchParams(K);return ae.set("app",V),ae},{replace:!1})},L=Yi({mutationFn:V=>d3({key:V}),onSuccess:V=>{r.invalidateQueries({queryKey:["applications"]}),B(V.key),i.add("success",`Application "${V.key}" created`)},onError:V=>i.add("error",V instanceof Tf?V.body.error:"Failed to create application")}),D=lV.filter(V=>!b||!V.adminOnly);return x.jsxs("div",{className:"flex flex-col h-screen overflow-hidden bg-background",children:[x.jsxs("header",{className:"sticky top-0 z-40 border-b border-border bg-background/80 backdrop-blur",children:[x.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 sm:px-6",children:[x.jsx("div",{className:"flex items-center gap-2 shrink-0",children:w?x.jsx("img",{src:w,alt:S,className:"h-7 max-w-[320px] object-contain"}):x.jsx("span",{className:"text-sm font-semibold tracking-tight",children:S})}),b?x.jsxs(x.Fragment,{children:[x.jsx("span",{className:"text-border select-none",children:"/"}),x.jsx("span",{className:"font-mono text-[13px] text-muted-foreground",children:R})]}):x.jsxs(x.Fragment,{children:[x.jsx("span",{className:"text-border select-none",children:"/"}),x.jsx(_5,{value:R,options:k.map(V=>V.key),onSelect:B,onCreate:V=>L.mutate(V),disabled:g,"aria-label":"Application",placeholder:"Application",createLabel:V=>`Create application "${V}"`,className:"w-48"})]}),x.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[g&&x.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-warning/30 bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:[x.jsx(qD,{className:"size-3"}),"Read-only"]}),b&&x.jsx("span",{className:"rounded-md border border-accent/30 bg-accent/10 px-2 py-0.5 text-xs font-medium text-accent",children:"Portal"}),x.jsx(Bj,{})]})]}),x.jsx("nav",{className:"mx-auto flex max-w-6xl items-center gap-1 overflow-x-auto px-2 sm:px-4","aria-label":"Main navigation",children:D.map(({path:V,label:K,match:ae})=>x.jsx("button",{onClick:()=>T(V),className:jt("whitespace-nowrap px-3 py-2.5 text-[13px] font-medium transition-colors",ae(o)?"relative text-foreground after:absolute after:inset-x-3 after:-bottom-px after:h-0.5 after:rounded-full after:bg-foreground":"text-muted-foreground hover:text-foreground"),children:K},V))})]}),x.jsx("main",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:x.jsxs(ED,{children:[x.jsx(Xa,{path:"/endpoints/:id?",children:V=>x.jsx(KC,{app:R,readonly:g,selectedId:V.id,onOpen:K=>T(`/endpoints/${encodeURIComponent(K)}`),onBack:()=>T("/endpoints"),onOpenDelivery:K=>T(`/deliveries/${encodeURIComponent(K)}`)})}),x.jsx(Xa,{path:"/event-types/:name?",children:V=>x.jsx(FH,{readonly:g||b,portal:b,selectedName:V.name,onOpen:K=>T(`/event-types/${encodeURIComponent(K)}`),onBack:()=>T("/event-types")})}),x.jsx(Xa,{path:"/messages/:id?",children:V=>x.jsx(KH,{app:R,selectedId:V.id,onOpen:K=>T(`/messages/${encodeURIComponent(K)}`),onBack:()=>T("/messages"),onOpenDelivery:K=>T(`/deliveries/${encodeURIComponent(K)}`)})}),x.jsx(Xa,{path:"/deliveries/:id?",children:V=>x.jsx(nV,{app:R,readonly:g,selectedId:V.id,onOpen:K=>T(`/deliveries/${encodeURIComponent(K)}`),onBack:()=>T("/deliveries"),onOpenMessage:K=>T(`/messages/${encodeURIComponent(K)}`),onOpenEndpoint:K=>T(`/endpoints/${encodeURIComponent(K)}`)})}),!b&&x.jsx(Xa,{path:"/audit",children:x.jsx(rV,{app:R})}),x.jsx(Xa,{children:b?x.jsx(KC,{app:R,readonly:g,selectedId:void 0,onOpen:V=>T(`/endpoints/${encodeURIComponent(V)}`),onBack:()=>T("/endpoints"),onOpenDelivery:V=>T(`/deliveries/${encodeURIComponent(V)}`)}):x.jsx(Tz,{app:R,onOpenDelivery:V=>T(`/deliveries/${encodeURIComponent(V)}`),onCreateEndpoint:()=>T("/endpoints")})})]})})]})}Dj();const pA=new URLSearchParams(window.location.search).get("token");pA&&u3(pA);const uV=new sD({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),rO=document.getElementById("root");if(!rO)throw new Error("Root element not found");var EA;const fV=(((EA=window.__WEBHOOKS_CONFIG__)==null?void 0:EA.basePath)??"").replace(/\/$/,"");xN.createRoot(rO).render(x.jsx(Nb.StrictMode,{children:x.jsx(rD,{client:uV,children:x.jsx(Tj,{children:x.jsx(aV,{locationHook:MA,base:fV})})})}));
|
|
201
|
+
`){[e,t]=Mc(this,e,t);let r="";for(let o=0,a=0;o<this.children.length&&a<=t;o++){let u=this.children[o],f=a+u.length;a>e&&o&&(r+=i),e<f&&t>a&&(r+=u.sliceString(e-a,t-a,i)),a=f+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Js))return 0;let i=0,[r,o,a,u]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,o+=t){if(r==a||o==u)return i;let f=this.children[r],d=e.children[o];if(f!=d)return i+f.scanIdentical(d,t);i+=f.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let S of e)S.flatten(v);return new yn(v,t)}let r=Math.max(32,i>>5),o=r<<1,a=r>>1,u=[],f=0,d=-1,p=[];function g(v){let S;if(v.lines>o&&v instanceof Js)for(let w of v.children)g(w);else v.lines>a&&(f>a||!f)?(b(),u.push(v)):v instanceof yn&&f&&(S=p[p.length-1])instanceof yn&&v.lines+S.lines<=32?(f+=v.lines,d+=v.length+1,p[p.length-1]=new yn(S.text.concat(v.text),S.length+1+v.length)):(f+v.lines>r&&b(),f+=v.lines,d+=v.length+1,p.push(v))}function b(){f!=0&&(u.push(p.length==1?p[0]:Js.from(p,d)),d=-1,f=p.length=0)}for(let v of e)g(v);return b(),u.length==1?u[0]:new Js(u,t)}}kt.empty=new yn([""],0);function X5(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Ud(n,e,t=0,i=1e9){for(let r=0,o=0,a=!0;o<n.length&&r<=i;o++){let u=n[o],f=r+u.length;f>=t&&(f>i&&(u=u.slice(0,i-r)),r<t&&(u=u.slice(t-r)),a?(e[e.length-1]+=u,a=!1):e.push(u)),r=f+1}return e}function ZC(n,e,t){return Ud(n,[""],e,t)}class Ju{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof yn?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],o=this.offsets[i],a=o>>1,u=r instanceof yn?r.text.length:r.children.length;if(a==(t>0?u:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
202
|
+
`,this;e--}else if(r instanceof yn){let f=r.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,f.length>Math.max(0,e))return this.value=e==0?f:t>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=r.children[a+(t<0?-1:0)];e>f.length?(e-=f.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(f),this.offsets.push(t>0?1:(f instanceof yn?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 lR{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Ju(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),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 oR{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(kt.prototype[Symbol.iterator]=function(){return this.iter()},Ju.prototype[Symbol.iterator]=lR.prototype[Symbol.iterator]=oR.prototype[Symbol.iterator]=function(){return this});class $5{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function Mc(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function ii(n,e,t=!0,i=!0){return Y5(n,e,t,i)}function Z5(n){return n>=56320&&n<57344}function J5(n){return n>=55296&&n<56320}function e6(n,e){let t=n.charCodeAt(e);if(!J5(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Z5(i)?(t-55296<<10)+(i-56320)+65536:t}function t6(n){return n<65536?1:2}const q0=/\r\n?|\n/;var Xi=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Xi||(Xi={}));class or{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let o=this.sections[t++],a=this.sections[t++];a<0?(e(i,r,o),r+=o):r+=a,i+=o}}iterChangedRanges(e,t=!1){F0(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new or(e)}composeDesc(e){return this.empty?e:e.empty?this:aR(this,e)}mapDesc(e,t=!1){return e.empty?this:G0(this,e,t)}mapPos(e,t=-1,i=Xi.Simple){let r=0,o=0;for(let a=0;a<this.sections.length;){let u=this.sections[a++],f=this.sections[a++],d=r+u;if(f<0){if(d>e)return o+(e-r);o+=u}else{if(i!=Xi.Simple&&d>=e&&(i==Xi.TrackDel&&r<e&&d>e||i==Xi.TrackBefore&&r<e||i==Xi.TrackAfter&&d>e))return null;if(d>e||d==e&&t<0&&!u)return e==r||t<0?o:o+f;o+=f}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return o}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let o=this.sections[i++],a=this.sections[i++],u=r+o;if(a>=0&&r<=t&&u>=e)return r<e&&u>t?"cover":!0;r=u}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new or(e)}static create(e){return new or(e)}}class jn extends or{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return F0(this,(t,i,r,o,a)=>e=e.replace(r,r+(i-t),a),!1),e}mapDesc(e,t=!1){return G0(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,o=0;r<t.length;r+=2){let a=t[r],u=t[r+1];if(u>=0){t[r]=u,t[r+1]=a;let f=r>>1;for(;i.length<f;)i.push(kt.empty);i.push(a?e.slice(o,o+a):kt.empty)}o+=a}return new jn(t,i)}compose(e){return this.empty?e:e.empty?this:aR(this,e,!0)}map(e,t=!1){return e.empty?this:G0(this,e,t,!0)}iterChanges(e,t=!1){F0(this,e,t)}get desc(){return or.create(this.sections)}filter(e){let t=[],i=[],r=[],o=new ff(this);e:for(let a=0,u=0;;){let f=a==e.length?1e9:e[a++];for(;u<f||u==f&&o.len==0;){if(o.done)break e;let p=Math.min(o.len,f-u);ti(r,p,-1);let g=o.ins==-1?-1:o.off==0?o.ins:0;ti(t,p,g),g>0&&Ql(i,t,o.text),o.forward(p),u+=p}let d=e[a++];for(;u<d;){if(o.done)break e;let p=Math.min(o.len,d-u);ti(t,p,-1),ti(r,p,o.ins==-1?-1:o.off==0?o.ins:0),o.forward(p),u+=p}}return{changes:new jn(t,i),filtered:or.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],o=[],a=0,u=null;function f(p=!1){if(!p&&!r.length)return;a<t&&ti(r,t-a,-1);let g=new jn(r,o);u=u?u.compose(g.map(u)):g,r=[],o=[],a=0}function d(p){if(Array.isArray(p))for(let g of p)d(g);else if(p instanceof jn){if(p.length!=t)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${t})`);f(),u=u?u.compose(p.map(u)):p}else{let{from:g,to:b=g,insert:v}=p;if(g>b||g<0||b>t)throw new RangeError(`Invalid change range ${g} to ${b} (in doc of length ${t})`);let S=v?typeof v=="string"?kt.of(v.split(i||q0)):v:kt.empty,w=S.length;if(g==b&&w==0)return;g<a&&f(),g>a&&ti(r,g-a,-1),ti(r,b-g,w),Ql(o,r,S),a=b}}return d(e),f(!u),u}static empty(e){return new jn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let o=e[r];if(typeof o=="number")t.push(o,-1);else{if(!Array.isArray(o)||typeof o[0]!="number"||o.some((a,u)=>u&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;i.length<r;)i.push(kt.empty);i[r]=kt.of(o.slice(1)),t.push(o[0],i[r].length)}}}return new jn(t,i)}static createSet(e,t){return new jn(e,t)}}function ti(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function Ql(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(kt.empty);n.push(t)}}function F0(n,e,t){let i=n.inserted;for(let r=0,o=0,a=0;a<n.sections.length;){let u=n.sections[a++],f=n.sections[a++];if(f<0)r+=u,o+=u;else{let d=r,p=o,g=kt.empty;for(;d+=u,p+=f,f&&i&&(g=g.append(i[a-2>>1])),!(t||a==n.sections.length||n.sections[a+1]<0);)u=n.sections[a++],f=n.sections[a++];e(r,d,o,p,g),r=d,o=p}}}function G0(n,e,t,i=!1){let r=[],o=i?[]:null,a=new ff(n),u=new ff(e);for(let f=-1;;){if(a.done&&u.len||u.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&u.ins==-1){let d=Math.min(a.len,u.len);ti(r,d,-1),a.forward(d),u.forward(d)}else if(u.ins>=0&&(a.ins<0||f==a.i||a.off==0&&(u.len<a.len||u.len==a.len&&!t))){let d=u.len;for(ti(r,u.ins,-1);d;){let p=Math.min(a.len,d);a.ins>=0&&f<a.i&&a.len<=p&&(ti(r,0,a.ins),o&&Ql(o,r,a.text),f=a.i),a.forward(p),d-=p}u.next()}else if(a.ins>=0){let d=0,p=a.len;for(;p;)if(u.ins==-1){let g=Math.min(p,u.len);d+=g,p-=g,u.forward(g)}else if(u.ins==0&&u.len<p)p-=u.len,u.next();else break;ti(r,d,f<a.i?a.ins:0),o&&f<a.i&&Ql(o,r,a.text),f=a.i,a.forward(a.len-p)}else{if(a.done&&u.done)return o?jn.createSet(r,o):or.create(r);throw new Error("Mismatched change set lengths")}}}function aR(n,e,t=!1){let i=[],r=t?[]:null,o=new ff(n),a=new ff(e);for(let u=!1;;){if(o.done&&a.done)return r?jn.createSet(i,r):or.create(i);if(o.ins==0)ti(i,o.len,0,u),o.next();else if(a.len==0&&!a.done)ti(i,0,a.ins,u),r&&Ql(r,i,a.text),a.next();else{if(o.done||a.done)throw new Error("Mismatched change set lengths");{let f=Math.min(o.len2,a.len),d=i.length;if(o.ins==-1){let p=a.ins==-1?-1:a.off?0:a.ins;ti(i,f,p,u),r&&p&&Ql(r,i,a.text)}else a.ins==-1?(ti(i,o.off?0:o.len,f,u),r&&Ql(r,i,o.textBit(f))):(ti(i,o.off?0:o.len,a.off?0:a.ins,u),r&&!a.off&&Ql(r,i,a.text));u=(o.ins>f||a.ins>=0&&a.len>f)&&(u||i.length>d),o.forward2(f),a.forward(f)}}}}class ff{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?kt.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?kt.empty:t[i].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 Bl{constructor(e,t,i,r){this.from=e,this.to=t,this.flags=i,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new Bl(i,r,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return Se.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Se.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Se.range(e.anchor,e.head)}static create(e,t,i,r){return new Bl(e,t,i,r)}}class Se{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Se.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Se([this.main],0)}addRange(e,t=!0){return Se.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,Se.create(i,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 Se(e.ranges.map(t=>Bl.fromJSON(t)),e.main)}static single(e,t=e){return new Se([Se.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let o=e[r];if(o.empty?o.from<=i:o.from<i)return Se.normalized(e.slice(),t);i=o.to}return new Se(e,t)}static cursor(e,t=0,i,r){return Bl.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i)),r)}static range(e,t,i,r,o){let a=r==null?7:Math.min(6,r);return!o&&e!=t&&(o=t<e?1:-1),o&&(a|=o<0?8:16),t<e?Bl.create(t,e,a|32,i):Bl.create(e,t,a,i)}static undirectionalRange(e,t){return Bl.create(e,t,64,void 0)}static normalized(e,t=0){let i=e[t];e.sort((r,o)=>r.from-o.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let o=e[r],a=e[r-1];if(o.empty?o.from<=a.to:o.from<a.to){let u=a.from,f=Math.max(o.to,a.to);r<=t&&t--,e.splice(--r,2,o.anchor>o.head?Se.range(f,u):Se.range(u,f))}}return new Se(e,t)}}function cR(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Cv=0;class We{constructor(e,t,i,r,o){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=Cv++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new We(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:kv),!!e.static,e.enables)}of(e){return new qd([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qd(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new qd(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function kv(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class qd{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=Cv++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,o=this.id,a=e[o]>>1,u=this.type==2,f=!1,d=!1,p=[];for(let g of this.dependencies)g=="doc"?f=!0:g=="selection"?d=!0:(((t=e[g.id])!==null&&t!==void 0?t:1)&1)==0&&p.push(e[g.id]);return{create(g){return g.values[a]=i(g),1},update(g,b){if(f&&b.docChanged||d&&(b.docChanged||b.selection)||Q0(g,p)){let v=i(g);if(u?!JC(v,g.values[a],r):!r(v,g.values[a]))return g.values[a]=v,1}return 0},reconfigure:(g,b)=>{let v,S=b.config.address[o];if(S!=null){let w=dp(b,S);if(this.dependencies.every(E=>E instanceof We?b.facet(E)===g.facet(E):E instanceof uo?b.field(E,!1)==g.field(E,!1):!0)||(u?JC(v=i(g),w,r):r(v=i(g),w)))return g.values[a]=w,0}else v=i(g);return g.values[a]=v,1}}}}function JC(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Q0(n,e){let t=!1;for(let i of e)ef(n,i)&1&&(t=!0);return t}function n6(n,e,t){let i=t.map(f=>n[f.id]),r=t.map(f=>f.type),o=i.filter(f=>!(f&1)),a=n[e.id]>>1;function u(f){let d=[];for(let p=0;p<i.length;p++){let g=dp(f,i[p]);if(r[p]==2)for(let b of g)d.push(b);else d.push(g)}return e.combine(d)}return{create(f){for(let d of i)ef(f,d);return f.values[a]=u(f),1},update(f,d){if(!Q0(f,o))return 0;let p=u(f);return e.compare(p,f.values[a])?0:(f.values[a]=p,1)},reconfigure(f,d){let p=Q0(f,i),g=d.config.facets[e.id],b=d.facet(e);if(g&&!p&&kv(t,g))return f.values[a]=b,0;let v=u(f);return e.compare(v,b)?(f.values[a]=b,0):(f.values[a]=v,1)}}}const vd=We.define({static:!0});class uo{constructor(e,t,i,r,o){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=o,this.provides=void 0}static define(e){let t=new uo(Cv++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(vd).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let o=i.values[t],a=this.updateF(o,r);return this.compareF(o,a)?0:(i.values[t]=a,1)},reconfigure:(i,r)=>{let o=i.facet(vd),a=r.facet(vd),u;return(u=o.find(f=>f.field==this))&&u!=a.find(f=>f.field==this)?(i.values[t]=u.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,vd.of({field:this,create:e})]}get extension(){return this}}const Io={lowest:4,low:3,default:2,high:1,highest:0};function Pu(n){return e=>new uR(e,n)}const Av={highest:Pu(Io.highest),high:Pu(Io.high),default:Pu(Io.default),low:Pu(Io.low),lowest:Pu(Io.lowest)};class uR{constructor(e,t){this.inner=e,this.prec=t}}class Pf{of(e){return new K0(this,e)}reconfigure(e){return Pf.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class K0{constructor(e,t){this.compartment=e,this.inner=t}}class hp{constructor(e,t,i,r,o,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],o=Object.create(null),a=new Map;for(let b of i6(e,t,a))b instanceof uo?r.push(b):(o[b.facet.id]||(o[b.facet.id]=[])).push(b);let u=Object.create(null),f=[],d=[];for(let b of r)u[b.id]=d.length<<1,d.push(v=>b.slot(v));let p=i==null?void 0:i.config.facets;for(let b in o){let v=o[b],S=v[0].facet,w=p&&p[b]||[];if(v.every(E=>E.type==0))if(u[S.id]=f.length<<1|1,kv(w,v))f.push(i.facet(S));else{let E=S.combine(v.map(k=>k.value));f.push(i&&S.compare(E,i.facet(S))?i.facet(S):E)}else{for(let E of v)E.type==0?(u[E.id]=f.length<<1|1,f.push(E.value)):(u[E.id]=d.length<<1,d.push(k=>E.dynamicSlot(k)));u[S.id]=d.length<<1,d.push(E=>n6(E,S,v))}}let g=d.map(b=>b(u));return new hp(e,a,g,u,f,o)}}function i6(n,e,t){let i=[[],[],[],[],[]],r=new Map;function o(a,u){let f=r.get(a);if(f!=null){if(f<=u)return;let d=i[f].indexOf(a);d>-1&&i[f].splice(d,1),a instanceof K0&&t.delete(a.compartment)}if(r.set(a,u),Array.isArray(a))for(let d of a)o(d,u);else if(a instanceof K0){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;t.set(a.compartment,d),o(d,u)}else if(a instanceof uR)o(a.inner,a.prec);else if(a instanceof uo)i[u].push(a),a.provides&&o(a.provides,u);else if(a instanceof qd)i[u].push(a),a.facet.extensions&&o(a.facet.extensions,Io.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,u)}}return o(n,Io.default),i.reduce((a,u)=>a.concat(u))}function ef(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function dp(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const fR=We.define(),Y0=We.define({combine:n=>n.some(e=>e),static:!0}),hR=We.define({combine:n=>n.length?n[0]:void 0,static:!0}),dR=We.define(),pR=We.define(),mR=We.define(),gR=We.define({combine:n=>n.length?n[0]:!1});class fo{constructor(e,t){this.type=e,this.value=t}static define(){return new s6}}class s6{of(e){return new fo(this,e)}}class r6{constructor(e){this.map=e}of(e){return new vn(this,e)}}class vn{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new vn(this.type,t)}is(e){return this.type==e}static define(e={}){return new r6(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let o=r.map(t);o&&i.push(o)}return i}}vn.reconfigure=vn.define();vn.appendConfig=vn.define();class zn{constructor(e,t,i,r,o,a){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,i&&cR(i,t.newLength),o.some(u=>u.type==zn.time)||(this.annotations=o.concat(zn.time.of(Date.now())))}static create(e,t,i,r,o,a){return new zn(e,t,i,r,o,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(zn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}zn.time=fo.define();zn.userEvent=fo.define();zn.addToHistory=fo.define();zn.remote=fo.define();function l6(n,e){let t=[];for(let i=0,r=0;;){let o,a;if(i<n.length&&(r==e.length||e[r]>=n[i]))o=n[i++],a=n[i++];else if(r<e.length)o=e[r++],a=e[r++];else return t;!t.length||t[t.length-1]<o?t.push(o,a):t[t.length-1]<a&&(t[t.length-1]=a)}}function yR(n,e,t){var i;let r,o,a;return t?(r=e.changes,o=jn.empty(e.changes.length),a=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),o=n.changes.mapDesc(e.changes,!0),a=n.changes.compose(r)),{changes:a,selection:e.selection?e.selection.map(o):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:vn.mapEffects(n.effects,r).concat(vn.mapEffects(e.effects,o)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function W0(n,e,t){let i=e.selection,r=oc(e.annotations);return e.userEvent&&(r=r.concat(zn.userEvent.of(e.userEvent))),{changes:e.changes instanceof jn?e.changes:jn.of(e.changes||[],t,n.facet(hR)),selection:i&&(i instanceof Se?i:Se.single(i.anchor,i.head)),effects:oc(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function bR(n,e,t){let i=W0(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let o=1;o<e.length;o++){e[o].filter===!1&&(t=!1);let a=!!e[o].sequential;i=yR(i,W0(n,e[o],a?i.changes.newLength:n.doc.length),a)}let r=zn.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return a6(t?o6(r):r)}function o6(n){let e=n.startState,t=!0;for(let r of e.facet(dR)){let o=r(n);if(o===!1){t=!1;break}Array.isArray(o)&&(t=t===!0?o:l6(t,o))}if(t!==!0){let r,o;if(t===!1)o=n.changes.invertedDesc,r=jn.empty(e.doc.length);else{let a=n.changes.filter(t);r=a.changes,o=a.filtered.mapDesc(a.changes).invertedDesc}n=zn.create(e,r,n.selection&&n.selection.map(o),vn.mapEffects(n.effects,o),n.annotations,n.scrollIntoView)}let i=e.facet(pR);for(let r=i.length-1;r>=0;r--){let o=i[r](n);o instanceof zn?n=o:Array.isArray(o)&&o.length==1&&o[0]instanceof zn?n=o[0]:n=bR(e,oc(o),!1)}return n}function a6(n){let e=n.startState,t=e.facet(mR),i=n;for(let r=t.length-1;r>=0;r--){let o=t[r](n);o&&Object.keys(o).length&&(i=yR(i,W0(e,o,n.changes.newLength),!0))}return i==n?n:zn.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const c6=[];function oc(n){return n==null?c6:Array.isArray(n)?n:[n]}var Pr=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Pr||(Pr={}));const u6=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let X0;try{X0=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function f6(n){if(X0)return X0.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||u6.test(t)))return!0}return!1}function h6(n){return e=>{if(!/\S/.test(e))return Pr.Space;if(f6(e))return Pr.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Pr.Word;return Pr.Other}}class wt{constructor(e,t,i,r,o,a){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let u=0;u<this.config.dynamicSlots.length;u++)ef(this,u<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return ef(this,i),dp(this,i)}update(...e){return bR(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let u of e.effects)u.is(Pf.reconfigure)?(t&&(r=new Map,t.compartments.forEach((f,d)=>r.set(d,f)),t=null),r.set(u.value.compartment,u.value.extension)):u.is(vn.reconfigure)?(t=null,i=u.value):u.is(vn.appendConfig)&&(t=null,i=oc(i).concat(u.value));let o;t?o=e.startState.values.slice():(t=hp.resolve(i,r,this),o=new wt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(f,d)=>d.reconfigure(f,this),null).values);let a=e.startState.facet(Y0)?e.newSelection:e.newSelection.asSingle();new wt(t,e.newDoc,a,o,(u,f)=>f.update(u,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:Se.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),o=[i.range],a=oc(i.effects);for(let u=1;u<t.ranges.length;u++){let f=e(t.ranges[u]),d=this.changes(f.changes),p=d.map(r);for(let b=0;b<u;b++)o[b]=o[b].map(p);let g=r.mapDesc(d,!0);o.push(f.range.map(g)),r=r.compose(p),a=vn.mapEffects(a,p).concat(vn.mapEffects(oc(f.effects),g))}return{changes:r,selection:Se.create(o,t.mainIndex),effects:a}}changes(e=[]){return e instanceof jn?e:jn.of(e,this.doc.length,this.facet(wt.lineSeparator))}toText(e){return kt.of(e.split(this.facet(wt.lineSeparator)||q0))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(ef(this,t),dp(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof uo&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let o in i)if(Object.prototype.hasOwnProperty.call(e,o)){let a=i[o],u=e[o];r.push(a.init(f=>a.spec.fromJSON(u,f)))}}return wt.create({doc:e.doc,selection:Se.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=hp.resolve(e.extensions||[],new Map),i=e.doc instanceof kt?e.doc:kt.of((e.doc||"").split(t.staticFacet(wt.lineSeparator)||q0)),r=e.selection?e.selection instanceof Se?e.selection:Se.single(e.selection.anchor,e.selection.head):Se.single(0);return cR(r,i.length),t.staticFacet(Y0)||(r=r.asSingle()),new wt(t,i,r,t.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(wt.tabSize)}get lineBreak(){return this.facet(wt.lineSeparator)||`
|
|
203
|
+
`}get readOnly(){return this.facet(gR)}phrase(e,...t){for(let i of this.facet(wt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,r)=>{if(r=="$")return"$";let o=+(r||1);return!o||o>t.length?i:t[o-1]})),e}languageDataAt(e,t,i=-1){let r=[];for(let o of this.facet(fR))for(let a of o(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return h6(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:r}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-i,u=e-i;for(;a>0;){let f=ii(t,a,!1);if(o(t.slice(f,a))!=Pr.Word)break;a=f}for(;u<r;){let f=ii(t,u);if(o(t.slice(u,f))!=Pr.Word)break;u=f}return a==u?null:Se.range(a+i,u+i)}}wt.allowMultipleSelections=Y0;wt.tabSize=We.define({combine:n=>n.length?n[0]:4});wt.lineSeparator=hR;wt.readOnly=gR;wt.phrases=We.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(r=>n[r]==e[r])}});wt.languageData=fR;wt.changeFilter=dR;wt.transactionFilter=pR;wt.transactionExtender=mR;Pf.reconfigure=vn.define();function Ev(n,e,t={}){let i={};for(let r of n)for(let o of Object.keys(r)){let a=r[o],u=i[o];if(u===void 0)i[o]=a;else if(!(u===a||a===void 0))if(Object.hasOwnProperty.call(t,o))i[o]=t[o](u,a);else throw new Error("Config merge conflict for field "+o)}for(let r in e)i[r]===void 0&&(i[r]=e[r]);return i}class ia{eq(e){return this==e}range(e,t=e){return $0.create(e,t,this)}}ia.prototype.startSide=ia.prototype.endSide=0;ia.prototype.point=!1;ia.prototype.mapMode=Xi.TrackDel;function Rv(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let $0=class vR{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new vR(e,t,i)}};function Z0(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Tv{constructor(e,t,i,r){this.from=e,this.to=t,this.value=i,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,i,r=0){let o=i?this.to:this.from;for(let a=r,u=o.length;;){if(a==u)return a;let f=a+u>>1,d=o[f]-e||(i?this.value[f].endSide:this.value[f].startSide)-t;if(f==a)return d>=0?a:u;d>=0?u=f:a=f+1}}between(e,t,i,r){for(let o=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,o);o<a;o++)if(r(this.from[o]+e,this.to[o]+e,this.value[o])===!1)return!1}map(e,t){let i=[],r=[],o=[],a=-1,u=-1;for(let f=0;f<this.value.length;f++){let d=this.value[f],p=this.from[f]+e,g=this.to[f]+e,b,v;if(p==g){let S=t.mapPos(p,d.startSide,d.mapMode);if(S==null||(b=v=S,d.startSide!=d.endSide&&(v=t.mapPos(p,d.endSide),v<b)))continue}else if(b=t.mapPos(p,d.startSide),v=t.mapPos(g,d.endSide),b>v||b==v&&d.startSide>0&&d.endSide<=0)continue;(v-b||d.endSide-d.startSide)<0||(a<0&&(a=b),d.point&&(u=Math.max(u,v-b)),i.push(d),r.push(b-a),o.push(v-a))}return{mapped:i.length?new Tv(r,o,i,u):null,pos:a}}}class Ct{constructor(e,t,i,r){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=r}static create(e,t,i,r){return new Ct(e,t,i,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:r=0,filterTo:o=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(Z0)),this.isEmpty)return t.length?Ct.of(t):this;let u=new xR(this,null,-1).goto(0),f=0,d=[],p=new hf;for(;u.value||f<t.length;)if(f<t.length&&(u.from-t[f].from||u.startSide-t[f].value.startSide)>=0){let g=t[f++];p.addInner(g.from,g.to,g.value)||d.push(g)}else u.rangeIndex==1&&u.chunkIndex<this.chunk.length&&(f==t.length||this.chunkEnd(u.chunkIndex)<t[f].from)&&(!a||r>this.chunkEnd(u.chunkIndex)||o<this.chunkPos[u.chunkIndex])&&p.addChunk(this.chunkPos[u.chunkIndex],this.chunk[u.chunkIndex])?u.nextChunk():((!a||r>u.to||o<u.from||a(u.from,u.to,u.value))&&(p.addInner(u.from,u.to,u.value)||d.push($0.create(u.from,u.to,u.value))),u.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?Ct.empty:this.nextLayer.update({add:d,filter:a,filterFrom:r,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],r=-1;for(let a=0;a<this.chunk.length;a++){let u=this.chunkPos[a],f=this.chunk[a],d=e.touchesRange(u,u+f.length);if(d===!1)r=Math.max(r,f.maxPoint),t.push(f),i.push(e.mapPos(u));else if(d===!0){let{mapped:p,pos:g}=f.map(u,e);p&&(r=Math.max(r,p.maxPoint),t.push(p),i.push(g))}}let o=this.nextLayer.map(e);return t.length==0?o:new Ct(i,t,o||Ct.empty,r)}between(e,t,i){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],a=this.chunk[r];if(t>=o&&e<=o+a.length&&a.between(o,e-o,t-o,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return df.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return df.from(e).goto(t)}static compare(e,t,i,r,o=-1){let a=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),u=t.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),f=ek(a,u,i),d=new Hu(a,f,o),p=new Hu(u,f,o);i.iterGaps((g,b,v)=>tk(d,g,p,b,v,r)),i.empty&&i.length==0&&tk(d,0,p,0,0,r)}static eq(e,t,i=0,r){r==null&&(r=999999999);let o=e.filter(p=>!p.isEmpty&&t.indexOf(p)<0),a=t.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let u=ek(o,a),f=new Hu(o,u,0).goto(i),d=new Hu(a,u,0).goto(i);for(;;){if(f.to!=d.to||!J0(f.active,d.active)||f.point&&(!d.point||!Rv(f.point,d.point)))return!1;if(f.to>r)return!0;f.next(),d.next()}}static spans(e,t,i,r,o=-1){let a=new Hu(e,null,o).goto(t),u=t,f=a.openStart;for(;;){let d=Math.min(a.to,i);if(a.point){let p=a.activeForPoint(a.to),g=a.pointFrom<t?p.length+1:a.point.startSide<0?p.length:Math.min(p.length,f);r.point(u,d,a.point,p,g,a.pointRank),f=Math.min(a.openEnd(d),p.length)}else d>u&&(r.span(u,d,a.active,f),f=a.openEnd(d));if(a.to>i)return f+(a.point&&a.to>i?1:0);u=a.to,a.next()}}static of(e,t=!1){let i=new hf;for(let r of e instanceof $0?[e]:t?d6(e):e)i.add(r.from,r.to,r.value);return i.finish()}static join(e){if(!e.length)return Ct.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let r=e[i];r!=Ct.empty;r=r.nextLayer)t=new Ct(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}Ct.empty=new Ct([],[],null,-1);function d6(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let i=n[t];if(Z0(e,i)>0)return n.slice().sort(Z0);e=i}return n}Ct.empty.nextLayer=Ct.empty;class hf{finishChunk(e){this.chunks.push(new Tv(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new hf)).add(e,t,i)}addInner(e,t,i){let r=e-this.lastTo||i.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(Ct.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Ct.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function ek(n,e,t){let i=new Map;for(let o of n)for(let a=0;a<o.chunk.length;a++)o.chunk[a].maxPoint<=0&&i.set(o.chunk[a],o.chunkPos[a]);let r=new Set;for(let o of e)for(let a=0;a<o.chunk.length;a++){let u=i.get(o.chunk[a]);u!=null&&(t?t.mapPos(u):u)==o.chunkPos[a]&&!(t!=null&&t.touchesRange(u,u+o.chunk[a].length))&&r.add(o.chunk[a])}return r}class xR{constructor(e,t,i,r=0){this.layer=e,this.skip=t,this.minPoint=i,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,i){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class df{constructor(e){this.heap=e}static from(e,t=null,i=-1){let r=[];for(let o=0;o<e.length;o++)for(let a=e[o];!a.isEmpty;a=a.nextLayer)a.maxPoint>=i&&r.push(new xR(a,t,i,o));return r.length==1?r[0]:new df(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Hy(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Hy(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Hy(this.heap,0)}}}function Hy(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let r=n[i];if(i+1<n.length&&r.compare(n[i+1])>=0&&(r=n[i+1],i++),t.compare(r)<0)break;n[i]=t,n[e]=r,e=i}}class Hu{constructor(e,t,i){this.minPoint=i,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=df.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){xd(this.active,e),xd(this.activeTo,e),xd(this.activeRank,e),this.minActive=nk(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:r,rank:o}=this.cursor;for(;t<this.activeRank.length&&(o-this.activeRank[t]||r-this.activeTo[t])>0;)t++;Sd(this.active,t,i),Sd(this.activeTo,t,r),Sd(this.activeRank,t,o),e&&Sd(e,t,this.cursor.from),this.minActive=nk(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),i&&xd(i,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=o,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=o.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let r=i.length-1;r>=0&&i[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function tk(n,e,t,i,r,o){n.goto(e),t.goto(i);let a=i+r,u=i,f=i-e,d=!!o.boundChange;for(let p=!1;;){let g=n.to+f-t.to,b=g||n.endSide-t.endSide,v=b<0?n.to+f:t.to,S=Math.min(v,a);if(n.point||t.point?(n.point&&t.point&&Rv(n.point,t.point)&&J0(n.activeForPoint(n.to),t.activeForPoint(t.to))||o.comparePoint(u,S,n.point,t.point),p=!1):(p&&o.boundChange(u),S>u&&!J0(n.active,t.active)&&o.compareRange(u,S,n.active,t.active),d&&S<a&&(g||n.openEnd(v)!=t.openEnd(v))&&(p=!0)),v>a)break;u=v,b<=0&&n.next(),b>=0&&t.next()}}function J0(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!Rv(n[t],e[t]))return!1;return!0}function xd(n,e){for(let t=e,i=n.length-1;t<i;t++)n[t]=n[t+1];n.pop()}function Sd(n,e,t){for(let i=n.length-1;i>=e;i--)n[i+1]=n[i];n[e]=t}function nk(n,e){let t=-1,i=1e9;for(let r=0;r<e.length;r++)(e[r]-i||n[r].endSide-n[t].endSide)<0&&(t=r,i=e[r]);return t}function $p(n,e,t=n.length){let i=0;for(let r=0;r<t&&r<n.length;)n.charCodeAt(r)==9?(i+=e-i%e,r++):(i++,r=ii(n,r));return i}function p6(n,e,t,i){for(let r=0,o=0;;){if(o>=e)return r;if(r==n.length)break;o+=n.charCodeAt(r)==9?t-o%t:1,r=ii(n,r)}return n.length}const eb="ͼ",ik=typeof Symbol>"u"?"__"+eb:Symbol.for(eb),tb=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),sk=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Jl{constructor(e,t){this.rules=[];let{finish:i}=t||{};function r(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,u,f,d){let p=[],g=/^@(\w+)\b/.exec(a[0]),b=g&&g[1]=="keyframes";if(g&&u==null)return f.push(a[0]+";");for(let v in u){let S=u[v];if(/&/.test(v))o(v.split(/,\s*/).map(w=>a.map(E=>w.replace(/&/,E))).reduce((w,E)=>w.concat(E)),S,f);else if(S&&typeof S=="object"){if(!g)throw new RangeError("The value of a property ("+v+") should be a primitive value.");o(r(v),S,p,b)}else S!=null&&p.push(v.replace(/_.*/,"").replace(/[A-Z]/g,w=>"-"+w.toLowerCase())+": "+S+";")}(p.length||b)&&f.push((i&&!g&&!d?a.map(i):a).join(", ")+" {"+p.join(" ")+"}")}for(let a in e)o(r(a),e[a],this.rules)}getRules(){return this.rules.join(`
|
|
204
|
+
`)}static newName(){let e=sk[ik]||1;return sk[ik]=e+1,eb+e.toString(36)}static mount(e,t,i){let r=e[tb],o=i&&i.nonce;r?o&&r.setNonce(o):r=new m6(e,o),r.mount(Array.isArray(t)?t:[t],e)}}let rk=new Map;class m6{constructor(e,t){let i=e.ownerDocument||e,r=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let o=rk.get(i);if(o)return e[tb]=o;this.sheet=new r.CSSStyleSheet,rk.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[tb]=this}mount(e,t){let i=this.sheet,r=0,o=0;for(let a=0;a<e.length;a++){let u=e[a],f=this.modules.indexOf(u);if(f<o&&f>-1&&(this.modules.splice(f,1),o--,f=-1),f==-1){if(this.modules.splice(o++,0,u),i)for(let d=0;d<u.rules.length;d++)i.insertRule(u.rules[d],r++)}else{for(;o<f;)r+=this.modules[o++].rules.length;r+=u.rules.length,o++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let a="";for(let f=0;f<this.modules.length;f++)a+=this.modules[f].getRules()+`
|
|
205
|
+
`;this.styleTag.textContent=a;let u=t.head||t;this.styleTag.parentNode!=u&&u.insertBefore(this.styleTag,u.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var eo={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:"'"},pf={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},g6=typeof navigator<"u"&&/Mac/.test(navigator.platform),y6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Wn=0;Wn<10;Wn++)eo[48+Wn]=eo[96+Wn]=String(Wn);for(var Wn=1;Wn<=24;Wn++)eo[Wn+111]="F"+Wn;for(var Wn=65;Wn<=90;Wn++)eo[Wn]=String.fromCharCode(Wn+32),pf[Wn]=String.fromCharCode(Wn);for(var Vy in eo)pf.hasOwnProperty(Vy)||(pf[Vy]=eo[Vy]);function b6(n){var e=g6&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||y6&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?pf:eo)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}let pi=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},nb=typeof document<"u"?document:{documentElement:{style:{}}};const ib=/Edge\/(\d+)/.exec(pi.userAgent),SR=/MSIE \d/.test(pi.userAgent),sb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(pi.userAgent),Zp=!!(SR||sb||ib),lk=!Zp&&/gecko\/(\d+)/i.test(pi.userAgent),_y=!Zp&&/Chrome\/(\d+)/.exec(pi.userAgent),ok="webkitFontSmoothing"in nb.documentElement.style,rb=!Zp&&/Apple Computer/.test(pi.vendor),ak=rb&&(/Mobile\/\w+/.test(pi.userAgent)||pi.maxTouchPoints>2);var Be={mac:ak||/Mac/.test(pi.platform),windows:/Win/.test(pi.platform),linux:/Linux|X11/.test(pi.platform),ie:Zp,ie_version:SR?nb.documentMode||6:sb?+sb[1]:ib?+ib[1]:0,gecko:lk,gecko_version:lk?+(/Firefox\/(\d+)/.exec(pi.userAgent)||[0,0])[1]:0,chrome:!!_y,chrome_version:_y?+_y[1]:0,ios:ak,android:/Android\b/.test(pi.userAgent),webkit:ok,webkit_version:ok?+(/\bAppleWebKit\/(\d+)/.exec(pi.userAgent)||[0,0])[1]:0,safari:rb,safari_version:rb?+(/\bVersion\/(\d+(\.\d+)?)/.exec(pi.userAgent)||[0,0])[1]:0,tabSize:nb.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Ov(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const pp=Object.create(null);function Mv(n,e,t){if(n==e)return!0;n||(n=pp),e||(e=pp);let i=Object.keys(n),r=Object.keys(e);if(i.length-0!=r.length-0)return!1;for(let o of i)if(o!=t&&(r.indexOf(o)==-1||n[o]!==e[o]))return!1;return!0}function v6(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function ck(n,e,t){let i=!1;if(e)for(let r in e)t&&r in t||(i=!0,r=="style"?n.style.cssText="":n.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(i=!0,r=="style"?n.style.cssText=t[r]:n.setAttribute(r,t[r]));return i}function x6(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}class Hf{eq(e){return!1}updateDOM(e,t,i){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var Di=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(Di||(Di={}));class Gt extends ia{constructor(e,t,i,r){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Vf(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new sa(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,r;if(e.isBlockGap)i=-5e8,r=4e8;else{let{start:o,end:a}=wR(e,t);i=(o?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new sa(e,i,r,t,e.widget||null,!0)}static line(e){return new _f(e)}static set(e,t=!1){return Ct.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Gt.none=Ct.empty;class Vf extends Gt{constructor(e){let{start:t,end:i}=wR(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Ov(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||pp}eq(e){return this==e||e instanceof Vf&&this.tagName==e.tagName&&Mv(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Vf.prototype.point=!1;class _f extends Gt{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof _f&&this.spec.class==e.spec.class&&Mv(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}_f.prototype.mapMode=Xi.TrackBefore;_f.prototype.point=!0;class sa extends Gt{constructor(e,t,i,r,o,a){super(t,i,o,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?Xi.TrackBefore:Xi.TrackAfter:Xi.TrackDel}get type(){return this.startSide!=this.endSide?Di.WidgetRange:this.startSide<=0?Di.WidgetBefore:Di.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof sa&&S6(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}sa.prototype.point=!0;function wR(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function S6(n,e){return n==e||!!(n&&e&&n.compare(e))}function ac(n,e,t,i=0){let r=t.length-1;r>=0&&t[r]+i>=n?t[r]=Math.max(t[r],e):t.push(n,e)}class mf extends ia{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof mf&&this.tagName==e.tagName&&Mv(this.attributes,e.attributes)}static create(e){return new mf(e.tagName,e.attributes||pp,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return Ct.of(e,t)}}mf.prototype.startSide=mf.prototype.endSide=-1;function gf(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function lb(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function tf(n,e){if(!e.anchorNode)return!1;try{return lb(n,e.anchorNode)}catch{return!1}}function nf(n){return n.nodeType==3?bf(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function sf(n,e,t,i){return t?uk(n,e,t,i,-1)||uk(n,e,t,i,1):!1}function to(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function mp(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function uk(n,e,t,i,r){for(;;){if(n==t&&e==i)return!0;if(e==(r<0?0:Kr(n))){if(n.nodeName=="DIV")return!1;let o=n.parentNode;if(!o||o.nodeType!=1)return!1;e=to(n)+(r<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[e+(r<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=r<0?Kr(n):0}else return!1}}function Kr(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function yf(n,e){let{left:t,right:i}=n;if(t==i)return n;let r=e?t:i;return{left:r,right:r,top:n.top,bottom:n.bottom}}function w6(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function CR(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function C6(n,e,t,i,r,o,a,u){let f=n.ownerDocument,d=f.defaultView||window;for(let p=n,g=!1;p&&!g;)if(p.nodeType==1){let b,v=p==f.body,S=1,w=1;if(v)b=w6(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(g=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let R=p.getBoundingClientRect();({scaleX:S,scaleY:w}=CR(p,R)),b={left:R.left,right:R.left+p.clientWidth*S,top:R.top,bottom:R.top+p.clientHeight*w}}let E=0,k=0;if(r=="nearest")e.top<b.top+a?(k=e.top-(b.top+a),t>0&&e.bottom>b.bottom+k&&(k=e.bottom-b.bottom+a)):e.bottom>b.bottom-a&&(k=e.bottom-b.bottom+a,t<0&&e.top-k<b.top&&(k=e.top-(b.top+a)));else{let R=e.bottom-e.top,N=b.bottom-b.top;k=(r=="center"&&R<=N?e.top+R/2-N/2:r=="start"||r=="center"&&t<0?e.top-a:e.bottom-N+a)-b.top}if(i=="nearest"?e.left<b.left+o?(E=e.left-(b.left+o),t>0&&e.right>b.right+E&&(E=e.right-b.right+o)):e.right>b.right-o&&(E=e.right-b.right+o,t<0&&e.left<b.left+E&&(E=e.left-(b.left+o))):E=(i=="center"?e.left+(e.right-e.left)/2-(b.right-b.left)/2:i=="start"==u?e.left-o:e.right-(b.right-b.left)+o)-b.left,E||k)if(v)d.scrollBy(E,k);else{let R=0,N=0;if(k){let T=p.scrollTop;p.scrollTop+=k/w,N=(p.scrollTop-T)*w}if(E){let T=p.scrollLeft;p.scrollLeft+=E/S,R=(p.scrollLeft-T)*S}e={left:e.left-R,top:e.top-N,right:e.right-R,bottom:e.bottom-N},R&&Math.abs(R-E)<1&&(i="nearest"),N&&Math.abs(N-k)<1&&(r="nearest")}if(v)break;(e.top<b.top||e.bottom>b.bottom||e.left<b.left||e.right>b.right)&&(e={left:Math.max(e.left,b.left),right:Math.min(e.right,b.right),top:Math.max(e.top,b.top),bottom:Math.min(e.bottom,b.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function kR(n,e=!0){let t=n.ownerDocument,i=null,r=null;for(let o=n.parentNode;o&&!(o==t.body||(!e||i)&&r);)if(o.nodeType==1)!r&&o.scrollHeight>o.clientHeight&&(r=o),e&&!i&&o.scrollWidth>o.clientWidth&&(i=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:i,y:r}}class k6{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?Kr(t):0),i,Math.min(e.focusOffset,i?Kr(i):0))}set(e,t,i,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=r}}let zo=null;Be.safari&&Be.safari_version>=26&&(zo=!1);function AR(n){if(n.setActive)return n.setActive();if(zo)return n.focus(zo);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(zo==null?{get preventScroll(){return zo={preventScroll:!0},!0}}:void 0),!zo){zo=!1;for(let t=0;t<e.length;){let i=e[t++],r=e[t++],o=e[t++];i.scrollTop!=r&&(i.scrollTop=r),i.scrollLeft!=o&&(i.scrollLeft=o)}}}let fk;function bf(n,e,t=e){let i=fk||(fk=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function cc(n,e,t,i){let r={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=i);let o=new KeyboardEvent("keydown",r);o.synthetic=!0,n.dispatchEvent(o);let a=new KeyboardEvent("keyup",r);return a.synthetic=!0,n.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function A6(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function E6(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,Kr(t));;)if(i){if(t.nodeType!=1)return!1;let r=t.childNodes[i-1];r.contentEditable=="false"?i--:(t=r,i=Kr(t))}else{if(t==n)return!0;i=to(t),t=t.parentNode}}function ER(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function RR(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=Kr(t)}else if(t.parentNode&&!mp(t))i=to(t),t=t.parentNode;else return null}}function TR(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!mp(t))i=to(t)+1,t=t.parentNode;else return null}}class Ts{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new Ts(e.parentNode,to(e),t)}static after(e,t){return new Ts(e.parentNode,to(e)+1,t)}}var xn=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(xn||(xn={}));const ra=xn.LTR,Nv=xn.RTL;function OR(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const R6=OR("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),T6=OR("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),ob=Object.create(null),Gs=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);ob[e]=t,ob[t]=-e}function MR(n){return n<=247?R6[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?T6[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const O6=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class tr{get dir(){return this.level%2?Nv:ra}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,r){let o=-1;for(let a=0;a<e.length;a++){let u=e[a];if(u.from<=t&&u.to>=t){if(u.level==i)return a;(o<0||(r!=0?r<0?u.from<t:u.to>t:e[o].level>u.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function NR(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],r=e[t];if(i.from!=r.from||i.to!=r.to||i.direction!=r.direction||!NR(i.inner,r.inner))return!1}return!0}const Ft=[];function M6(n,e,t,i,r){for(let o=0;o<=i.length;o++){let a=o?i[o-1].to:e,u=o<i.length?i[o].from:t,f=o?256:r;for(let d=a,p=f,g=f;d<u;d++){let b=MR(n.charCodeAt(d));b==512?b=p:b==8&&g==4&&(b=16),Ft[d]=b==4?2:b,b&7&&(g=b),p=b}for(let d=a,p=f,g=f;d<u;d++){let b=Ft[d];if(b==128)d<u-1&&p==Ft[d+1]&&p&24?b=Ft[d]=p:Ft[d]=256;else if(b==64){let v=d+1;for(;v<u&&Ft[v]==64;)v++;let S=d&&p==8||v<t&&Ft[v]==8?g==1?1:8:256;for(let w=d;w<v;w++)Ft[w]=S;d=v-1}else b==8&&g==1&&(Ft[d]=1);p=b,b&7&&(g=b)}}}function N6(n,e,t,i,r){let o=r==1?2:1;for(let a=0,u=0,f=0;a<=i.length;a++){let d=a?i[a-1].to:e,p=a<i.length?i[a].from:t;for(let g=d,b,v,S;g<p;g++)if(v=ob[b=n.charCodeAt(g)])if(v<0){for(let w=u-3;w>=0;w-=3)if(Gs[w+1]==-v){let E=Gs[w+2],k=E&2?r:E&4?E&1?o:r:0;k&&(Ft[g]=Ft[Gs[w]]=k),u=w;break}}else{if(Gs.length==189)break;Gs[u++]=g,Gs[u++]=b,Gs[u++]=f}else if((S=Ft[g])==2||S==1){let w=S==r;f=w?0:1;for(let E=u-3;E>=0;E-=3){let k=Gs[E+2];if(k&2)break;if(w)Gs[E+2]|=2;else{if(k&4)break;Gs[E+2]|=4}}}}}function D6(n,e,t,i){for(let r=0,o=i;r<=t.length;r++){let a=r?t[r-1].to:n,u=r<t.length?t[r].from:e;for(let f=a;f<u;){let d=Ft[f];if(d==256){let p=f+1;for(;;)if(p==u){if(r==t.length)break;p=t[r++].to,u=r<t.length?t[r].from:e}else if(Ft[p]==256)p++;else break;let g=o==1,b=(p<e?Ft[p]:i)==1,v=g==b?g?1:2:i;for(let S=p,w=r,E=w?t[w-1].to:n;S>f;)S==E&&(S=t[--w].from,E=w?t[w-1].to:n),Ft[--S]=v;f=p}else o=d,f++}}}function ab(n,e,t,i,r,o,a){let u=i%2?2:1;if(i%2==r%2)for(let f=e,d=0;f<t;){let p=!0,g=!1;if(d==o.length||f<o[d].from){let w=Ft[f];w!=u&&(p=!1,g=w==16)}let b=!p&&u==1?[]:null,v=p?i:i+1,S=f;e:for(;;)if(d<o.length&&S==o[d].from){if(g)break e;let w=o[d];if(!p)for(let E=w.to,k=d+1;;){if(E==t)break e;if(k<o.length&&o[k].from==E)E=o[k++].to;else{if(Ft[E]==u)break e;break}}if(d++,b)b.push(w);else{w.from>f&&a.push(new tr(f,w.from,v));let E=w.direction==ra!=!(v%2);cb(n,E?i+1:i,r,w.inner,w.from,w.to,a),f=w.to}S=w.to}else{if(S==t||(p?Ft[S]!=u:Ft[S]==u))break;S++}b?ab(n,f,S,i+1,r,b,a):f<S&&a.push(new tr(f,S,v)),f=S}else for(let f=t,d=o.length;f>e;){let p=!0,g=!1;if(!d||f>o[d-1].to){let w=Ft[f-1];w!=u&&(p=!1,g=w==16)}let b=!p&&u==1?[]:null,v=p?i:i+1,S=f;e:for(;;)if(d&&S==o[d-1].to){if(g)break e;let w=o[--d];if(!p)for(let E=w.from,k=d;;){if(E==e)break e;if(k&&o[k-1].to==E)E=o[--k].from;else{if(Ft[E-1]==u)break e;break}}if(b)b.push(w);else{w.to<f&&a.push(new tr(w.to,f,v));let E=w.direction==ra!=!(v%2);cb(n,E?i+1:i,r,w.inner,w.from,w.to,a),f=w.from}S=w.from}else{if(S==e||(p?Ft[S-1]!=u:Ft[S-1]==u))break;S--}b?ab(n,S,f,i+1,r,b,a):S<f&&a.push(new tr(S,f,v)),f=S}}function cb(n,e,t,i,r,o,a){let u=e%2?2:1;M6(n,r,o,i,u),N6(n,r,o,i,u),D6(r,o,i,u),ab(n,r,o,e,t,i,a)}function j6(n,e,t){if(!n)return[new tr(0,0,e==Nv?1:0)];if(e==ra&&!t.length&&!O6.test(n))return DR(n.length);if(t.length)for(;n.length>Ft.length;)Ft[Ft.length]=256;let i=[],r=e==ra?0:1;return cb(n,r,r,t,0,n.length,i),i}function DR(n){return[new tr(0,n,0)]}let jR="";function B6(n,e,t,i,r){var o;let a=i.head-n.from,u=tr.find(e,a,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc),f=e[u],d=f.side(r,t);if(a==d){let b=u+=r?1:-1;if(b<0||b>=e.length)return null;f=e[u=b],a=f.side(!r,t),d=f.side(r,t)}let p=ii(n.text,a,f.forward(r,t));(p<f.from||p>f.to)&&(p=d),jR=n.text.slice(Math.min(a,p),Math.max(a,p));let g=u==(r?e.length-1:0)?null:e[u+(r?1:-1)];return g&&p==d&&g.level+(r?0:1)<f.level?Se.cursor(g.side(!r,t)+n.from,g.forward(r,t)?1:-1,g.level):Se.cursor(p+n.from,f.forward(r,t)?-1:1,f.level)}function L6(n,e,t){for(let i=e;i<t;i++){let r=MR(n.charCodeAt(i));if(r==1)return ra;if(r==2||r==4)return Nv}return ra}const BR=We.define(),LR=We.define(),zR=We.define(),IR=We.define(),ub=We.define(),PR=We.define(),HR=We.define(),Dv=We.define(),jv=We.define(),VR=We.define({combine:n=>n.some(e=>e)}),z6=We.define({combine:n=>n.some(e=>e)}),_R=We.define();class uc{constructor(e,t,i,r,o,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=r,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new uc(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 uc(Se.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const wd=vn.define({map:(n,e)=>n.map(e)}),UR=vn.define();function nr(n,e,t){let i=n.facet(IR);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Ir=We.define({combine:n=>n.length?n[0]:!0});let I6=0;const ec=We.define({combine(n){return n.filter((e,t)=>{for(let i=0;i<t;i++)if(n[i].plugin==e.plugin)return!1;return!0})}});class Ds{constructor(e,t,i,r,o){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=r,this.baseExtensions=o(this),this.extension=this.baseExtensions.concat(ec.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(ec.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:i,eventObservers:r,provide:o,decorations:a}=t||{};return new Ds(I6++,e,i,r,u=>{let f=[];return a&&f.push(Jp.of(d=>{let p=d.plugin(u);return p?a(p):Gt.none})),o&&f.push(o(u)),f})}static fromClass(e,t){return Ds.define((i,r)=>new e(i,r),t)}}class Uy{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(nr(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){nr(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){nr(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const qR=We.define(),Bv=We.define(),Jp=We.define(),FR=We.define(),Lv=We.define(),Uf=We.define(),GR=We.define();function hk(n,e){let t=n.state.facet(GR);if(!t.length)return t;let i=t.map(o=>o instanceof Function?o(n):o),r=[];return Ct.spans(i,e.from,e.to,{point(){},span(o,a,u,f){let d=o-e.from,p=a-e.from,g=r;for(let b=u.length-1;b>=0;b--,f--){let v=u[b].spec.bidiIsolate,S;if(v==null&&(v=L6(e.text,d,p)),f>0&&g.length&&(S=g[g.length-1]).to==d&&S.direction==v)S.to=p,g=S.inner;else{let w={from:d,to:p,direction:v,inner:[]};g.push(w),g=w.inner}}}}),r}const QR=We.define();function KR(n){let e=0,t=0,i=0,r=0;for(let o of n.state.facet(QR)){let a=o(n);a&&(a.left!=null&&(e=Math.max(e,a.left)),a.right!=null&&(t=Math.max(t,a.right)),a.top!=null&&(i=Math.max(i,a.top)),a.bottom!=null&&(r=Math.max(r,a.bottom)))}return{left:e,right:t,top:i,bottom:r}}const Qu=We.define();class ds{constructor(e,t,i,r){this.fromA=e,this.toA=t,this.fromB=i,this.toB=r}join(e){return new ds(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>i.toA)){if(r.toA<i.fromA)break;i=i.join(r),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let r=0,o=0,a=0;;){let u=r<e.length?e[r].fromB:1e9,f=o<t.length?t[o]:1e9,d=Math.min(u,f);if(d==1e9)break;let p=d+a,g=d,b=p;for(;;)if(o<t.length&&t[o]<=g){let v=t[o+1];o+=2,g=Math.max(g,v);for(let S=r;S<e.length&&e[S].fromB<=g;S++)a=e[S].toA-e[S].toB;b=Math.max(b,v+a)}else if(r<e.length&&e[r].fromB<=g){let v=e[r++];g=Math.max(g,v.toB),b=Math.max(b,v.toA),a=v.toA-v.toB}else break;i.push(new ds(p,b,d,g))}return i}}class gp{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=jn.empty(this.startState.doc.length);for(let o of i)this.changes=this.changes.compose(o.changes);let r=[];this.changes.iterChangedRanges((o,a,u,f)=>r.push(new ds(o,a,u,f))),this.changedRanges=r}static create(e,t,i){return new gp(e,t,i)}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 P6=[];class hn{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return P6}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&v6(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let r of this.children){if(r==e)return i;i+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=to(this.dom),r=this.length?e>0:t>0;return new Ts(this.parent.dom,i+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof tm)return e;return null}static get(e){return e.cmTile}}class em extends hn{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,r,o=(e==null?void 0:e.node)==t?e:null,a=0;for(let u of this.children){if(u.sync(e),a+=u.length+u.breakAfter,r=i?i.nextSibling:t.firstChild,o&&r!=u.dom&&(o.written=!0),u.dom.parentNode==t)for(;r&&r!=u.dom;)r=dk(r);else t.insertBefore(u.dom,r);i=u.dom}for(r=i?i.nextSibling:t.firstChild,o&&r&&(o.written=!0);r;)r=dk(r);this.length=a}}function dk(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class tm extends em{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=hn.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,r=0,o=0;;)if(r==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&o++,r=t.pop()}else{let a=i.children[r++];if(a instanceof Vr)t.push(r),i=a,r=0;else{let u=o+a.length,f=e(a,o);if(f!==void 0)return f;o=u+a.breakAfter}}}resolveBlock(e,t){let i,r=-1,o,a=-1;if(this.blockTiles((u,f)=>{let d=f+u.length;if(e>=f&&e<=d){if(u.isWidget()&&t>=-1&&t<=1){if(u.flags&32)return!0;u.flags&16&&(i=void 0)}(f<e||e==d&&(t<-1?u.length:u.covers(1)))&&(!i||!u.isWidget()&&i.isWidget())&&(i=u,r=e-f),(d>e||e==f&&(t>1?u.length:u.covers(-1)))&&(!o||!u.isWidget()&&o.isWidget())&&(o=u,a=e-f)}}),!i&&!o)throw new Error("No tile at position "+e);return i&&t<0||!o?{tile:i,offset:r}:{tile:o,offset:a}}}class Vr extends em{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new Vr(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Nc extends em{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let r=new Nc(t||document.createElement("div"),e);return(!t||!i)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,i){let r=null,o=-1,a=null,u=-1;function f(p,g){for(let b=0,v=0;b<p.children.length&&v<=g;b++){let S=p.children[b],w=v+S.length;w>=g&&(S.isComposite()?f(S,g-v):(!a||a.isHidden&&(t>0&&!(a.flags&32)||i&&V6(a,S)))&&(w>g||S.flags&32)?(a=S,u=g-v):(v<g||S.flags&16&&!S.isHidden)&&(r=S,o=g-v)),v=w}}f(this,e);let d=(t<0?r:a)||r||a;return d?{tile:d,offset:d==r?o:u}:null}coordsIn(e,t,i){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,i):H6(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:r,offset:o}=i;if(this.dom.contains(r.dom))return r.isText()?new Ts(r.dom,Math.min(r.dom.nodeValue.length,o)):r.domPosFor(o,r.flags&16?1:r.flags&32?-1:t);let a=i.tile.parent,u=!1;for(let f of a.children){if(u)return new Ts(f.dom,0);f==i.tile&&(u=!0)}}return new Ts(this.dom,0)}}function H6(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=nf(e);return t[t.length-1]||null}function V6(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.top<t.bottom}class Mi extends em{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let i=new Mi(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Uo extends hn{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,i){let r=this.dom.nodeValue.length;e>r&&(e=r);let o=e,a=e,u=0;e==0&&t<0||e==r&&t>=0?Be.chrome||Be.gecko||(e?(o--,u=1):a<r&&(a++,u=-1)):t<0?o--:a<r&&a++;let f=bf(this.dom,o,a).getClientRects();if(!f.length)return null;let d=f[(u?u<0:t>=0)?0:f.length-1];return Be.safari&&!u&&d.width==0&&(d=Array.prototype.find.call(f,p=>p.width)||d),i==null?d:yf(d,(u?u>0:t<0)==i)}static of(e,t){let i=new Uo(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class la extends hn{constructor(e,t,i,r){super(e,t,r),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(i)return yf(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?o.length-1:0;a=o[f],!(e>0?f==0:f==o.length-1||a.top<a.bottom);f+=u?-1:1);return yf(a,!u)}}get overrideDOMText(){if(!this.length)return kt.empty;let{root:e}=this;if(!e)return kt.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,i,r,o){return o||(o=e.toDOM(t),e.editable||(o.contentEditable="false")),new la(o,i,e,r)}}class yp extends hn{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return kt.empty}coordsIn(e,t,i){let r=this.dom.getBoundingClientRect();return i==null?r:yf(r,t>0==i)}}class _6{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:r,index:o,beforeBreak:a,parents:u}=this;for(;e||t>0;)if(r.isComposite())if(a){if(!e)break;i&&i.break(),e--,a=!1}else if(o==r.children.length){if(!e&&!u.length)break;i&&i.leave(r),a=!!r.breakAfter,{tile:r,index:o}=u.pop(),o++}else{let f=r.children[o],d=f.breakAfter;(t>0?f.length<=e:f.length<e)&&(!i||i.skip(f,0,f.length)!==!1||!f.isComposite)?(a=!!d,o++,e-=f.length):(u.push({tile:r,index:o}),r=f,o=0,i&&f.isComposite()&&i.enter(f))}else if(o==r.length)a=!!r.breakAfter,{tile:r,index:o}=u.pop(),o++;else if(e){let f=Math.min(e,r.length-o);i&&i.skip(r,o,o+f),e-=f,o+=f}else break;return this.tile=r,this.index=o,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class U6{constructor(e,t,i,r){this.from=e,this.to=t,this.wrapper=i,this.rank=r}}class q6{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,r){var o;this.flushBuffer();let a=this.ensureMarks(t,i),u=a.lastChild;if(u&&u.isText()&&!(u.flags&8)&&u.length+e.length<512){this.cache.reused.set(u,2);let f=a.children[a.children.length-1]=new Uo(u.dom,u.text+e);f.parent=a}else a.append(r||Uo.of(e,(o=this.cache.find(Uo))===null||o===void 0?void 0:o.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?qy(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=i;for(let u=t.marks.length-1;u>=0;u--){let f=t.marks[u],d=r.lastChild;if(d instanceof Mi&&d.mark.eq(f.mark))d.dom!=f.dom&&d.setDOM(qy(f.dom)),r=d;else{if(this.cache.reused.get(f)){let g=hn.get(f.dom);g&&g.setDOM(qy(f.dom))}let p=Mi.of(f.mark,f.dom);r.append(p),r=p}this.cache.reused.set(f,2)}let o=hn.get(e.text);o&&this.cache.reused.set(o,2);let a=new Uo(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,i){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let o=this.ensureMarks(t,i);!r&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=YR);let r=Nc.start(e,t||((i=this.cache.find(Nc))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let r=this.curLine;for(let o=e.length-1;o>=0;o--){let a=e[o],u;if(t>0&&(u=r.lastChild)&&u instanceof Mi&&u.mark.eq(a))r=u,t--;else{let f=Mi.of(a,(i=this.cache.find(Mi,d=>d.mark.eq(a)))===null||i===void 0?void 0:i.dom);r.append(f),r=f,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!pk(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Be.ios&&pk(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(Fy,0,32)||new la(Fy.toDOM(),0,Fy,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,i=new U6(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-i.rank||this.wrappers[r-1].to-i.to)<0;)r--;this.wrappers.splice(r,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let r=t.lastChild;if(i.from<this.pos&&r instanceof Vr&&r.wrapper.eq(i.wrapper))t=r;else{let o=Vr.of(i.wrapper,(e=this.cache.find(Vr,a=>a.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(o),t=o}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(yp,void 0,1);return i&&(i.flags=t),i||new yp(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class F6{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=r;let u=this.textOff=Math.min(e,r.length);return o?null:r.slice(0,u)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const bp=[la,Nc,Uo,Mi,yp,Vr,tm];for(let n=0;n<bp.length;n++)bp[n].bucket=n;class G6{constructor(e){this.view=e,this.buckets=bp.map(()=>[]),this.index=bp.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let r=e.bucket,o=this.buckets[r],a=this.index[r];for(let u=0;u<o.length;u++){let f=(u+a)%o.length,d=o[f];if((!t||t(d))&&!this.reused.has(d))return o.splice(f,1),f<a&&this.index[r]--,this.reused.set(d,i),d}return null}findWidget(e,t,i){let r=this.buckets[0];if(r.length)for(let o=0,a=0;;o++){if(o==r.length){if(a)return null;a=1,o=0}let u=r[o];if(!this.reused.has(u)&&(a==0?u.widget.compare(e):u.widget.constructor==e.constructor&&e.updateDOM(u.dom,this.view,u.widget)))return r.splice(o,1),o<this.index[0]&&this.index[0]--,u.widget==e&&u.length==t&&(u.flags&497)==i?(this.reused.set(u,1),u):(this.reused.set(u,2),new la(u.dom,t,e,u.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class Q6{constructor(e,t,i,r,o){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=o,this.openWidget=!1,this.openMarks=0,this.cache=new G6(e),this.text=new F6(e.state.doc),this.builder=new q6(this.cache,new tm(e,e.contentDOM),Ct.iter(i)),this.cache.reused.set(t,2),this.old=new _6(t),this.reuseWalker={skip:(a,u,f)=>{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let r=0,o=0,a=0;;){let u=a<e.length?e[a++]:null,f=u?u.fromA:this.old.root.length;if(f>r){let d=f-r;this.preserve(d,!a,!u),r=f,o+=d}if(!u)break;t&&u.fromA<=t.range.fromA&&u.toA>=t.range.toA?(this.forward(u.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(o,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,i),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,u.toA),this.emit(t.range.toB,u.toB)):(this.forward(u.fromA,u.toA),this.emit(o,u.toB)),o=u.toB,r=u.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let r=W6(this.old),o=this.openMarks;this.old.advance(e,i?1:-1,{skip:(a,u,f)=>{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let d=f>0||u<a.length?la.of(a.widget,this.view,f-u,a.flags&496,this.cache.maybeReuse(a)):this.cache.reuse(a);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,r,o),o=r.length)}else if(a.isText())this.builder.ensureLine(null),!u&&f==a.length&&!this.cache.reused.has(a)?this.builder.addText(a.text,r,o,this.cache.reuse(a)):(this.cache.add(a),this.builder.addText(a.text.slice(u,f),r,o)),o=r.length;else if(a.isLine())a.flags&=-2,this.cache.reused.set(a,1),this.builder.addLine(a);else if(a instanceof yp)this.cache.add(a);else if(a instanceof Mi)this.builder.ensureLine(null),this.builder.addMark(a,r,o),this.cache.reused.set(a,1),o=r.length;else return!1;this.openWidget=!1},enter:a=>{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof Mi&&r.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?r.length&&(r.length=o=0):a instanceof Mi&&(r.shift(),o=Math.min(o,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,r=this.builder,o=0,a=Ct.spans(this.decorations,e,t,{point:(u,f,d,p,g,b)=>{if(d instanceof sa){if(this.disallowBlockEffectsFor[b]){if(d.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(o=p.length,g>p.length)r.continueWidget(f-u);else{let v=d.widget||(d.block?Dc.block:Dc.inline),S=K6(d),w=this.cache.findWidget(v,f-u,S)||la.of(v,this.view,f-u,S);d.block?(d.startSide>0&&r.addLineStartIfNotCovered(i),r.addBlockWidget(w)):(r.ensureLine(i),r.addInlineWidget(w,p,g))}i=null}else i=Y6(i,d);f>u&&this.text.skip(f-u)},span:(u,f,d,p)=>{for(let g=u;g<f;){let b=this.text.next(Math.min(512,f-g));b==null?(r.addLineStartIfNotCovered(i),r.addBreak(),g++):(r.ensureLine(i),r.addText(b,d,g==u?p:d.length),g+=b.length),i=null}o=d.length}});this.openWidget=a>o,this.openWidget||r.addLineStartIfNotCovered(i),this.openMarks=a}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let r=e.parentNode;;r=r.parentNode){let o=hn.get(r);if(r==this.view.contentDOM)break;o instanceof Mi?t.push(o):o!=null&&o.isLine()?i=o:o instanceof Vr||(r.nodeName=="DIV"&&!i&&r!=this.view.contentDOM?i=new Nc(r,YR):i||t.push(Mi.of(new Vf({tagName:r.nodeName.toLowerCase(),attributes:x6(r)}),r)))}return{line:i,marks:t}}}function pk(n,e){let t=i=>{for(let r of i.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(n)}function K6(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const YR={class:"cm-line"};function Y6(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Ov(t,n),i&&(n.class+=" "+i)),n}function W6(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof Mi&&e.push(i.mark)}return e}function qy(n){let e=hn.get(n);return e&&e.setDOM(n.cloneNode()),n}class Dc extends Hf{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}}Dc.inline=new Dc("span");Dc.block=new Dc("div");const Fy=new class extends Hf{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class mk{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Gt.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 tm(e,e.contentDOM),this.updateInner([new ds(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:p,toA:g})=>g<this.minWidthFrom||p>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!sI(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let o=r>-1?$6(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:g}=this.hasComposition;i=new ds(p,g,e.changes.mapPos(p,-1),e.changes.mapPos(g,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Be.ie||Be.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,u=this.blockWrappers;this.updateDeco();let f=eI(a,this.decorations,e.changes);f.length&&(i=ds.extendWithRanges(i,f));let d=nI(u,this.blockWrappers,e.changes);return d.length&&(i=ds.extendWithRanges(i,d)),o&&!i.some(p=>p.fromA<=o.range.fromA&&p.toA>=o.range.toA)&&(i=o.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let a=this.tile,u=new Q6(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&hn.get(t.text)&&u.cache.reused.set(hn.get(t.text),2),this.tile=u.run(e,t),fb(a,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 o=Be.chrome||Be.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||i.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let o of this.tile.children)o.isWidget()&&o.widget instanceof Gy&&r.push(o.dom);i.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(UR)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,r=this.view.root.activeElement,o=r==i,a=!o&&!(this.view.state.facet(Ir)||i.tabIndex>-1)&&tf(i,this.view.observer.selectionRange)&&!(r&&i.contains(r));if(!(o||t||a))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,d,p;if(f.empty?p=d=this.inlineDOMNearPos(f.anchor,f.assoc||1):(p=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),d=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),Be.gecko&&f.empty&&!this.hasComposition&&X6(d)){let b=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(b,d.node.childNodes[d.offset]||null)),d=p=new Ts(b,0),u=!0}let g=this.view.observer.selectionRange;(u||!g.focusNode||(!sf(d.node,d.offset,g.anchorNode,g.anchorOffset)||!sf(p.node,p.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,f))&&(this.view.observer.ignore(()=>{Be.android&&Be.chrome&&i.contains(g.focusNode)&&iI(g.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let b=gf(this.view.root);if(b)if(f.empty){if(Be.gecko){let v=Z6(d.node,d.offset);if(v&&v!=3){let S=(v==1?RR:TR)(d.node,d.offset);S&&(d=new Ts(S.node,S.offset))}}b.collapse(d.node,d.offset),f.bidiLevel!=null&&b.caretBidiLevel!==void 0&&(b.caretBidiLevel=f.bidiLevel)}else if(b.extend){b.collapse(d.node,d.offset);try{b.extend(p.node,p.offset)}catch{}}else{let v=document.createRange();f.anchor>f.head&&([d,p]=[p,d]),v.setEnd(p.node,p.offset),v.setStart(d.node,d.offset),b.removeAllRanges(),b.addRange(v)}a&&this.view.root.activeElement==i&&(i.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new Ts(g.anchorNode,g.anchorOffset),this.impreciseHead=p.precise?null:new Ts(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&sf(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=gf(e.root),{anchorNode:r,anchorOffset:o}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let u=a.posAtStart;if(t.head==u||t.head==u+a.length)return;let f=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!f||!d||f.bottom>d.top)return;let p=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(p.node,p.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=t.from&&i.collapse(r,o)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=i.posAtStart;if(i.isComposite()){let o;if(e==i.dom)o=i.dom.childNodes[t];else{let a=Kr(e)==0?0:t==0?-1:1;for(;;){let u=e.parentNode;if(u==i.dom)break;a==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?a=-1:a=1),e=u}a<0?o=e:o=e.nextSibling}if(o==i.dom.firstChild)return r;for(;o&&!hn.get(o);)o=o.nextSibling;if(!o)return r+i.length;for(let a=0,u=r;;a++){let f=i.children[a];if(f.dom==o)return u;u+=f.length+f.breakAfter}}else return i.isText()?e==i.dom?r+t:r+(t?i.length:0):r}domAtPos(e,t){let{tile:i,offset:r}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(r,t):i.domIn(r,t)}inlineDOMNearPos(e,t){let i,r=-1,o=!1,a,u=-1,f=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(o=!0)}else{let g=p+d.length;if(p<=e&&(i=d,r=e-p,o=g<e),g>=e&&!a&&(a=d,u=e-p,f=p>e),p>e&&a)return!0}}),!i&&!a?this.domAtPos(e,t):(o&&a?i=null:f&&i&&(a=null),i&&t<0||!a?i.domIn(r,t):a.domIn(u,t))}coordsAt(e,t,i){let{tile:r,offset:o}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof Gy?null:r.coordsInWidget(o,t,!0):r.coordsIn(o,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(o,a){if(o.isComposite())for(let u of o.children){if(u.length>=a){let f=r(u,a);if(f)return f}if(a-=u.length,a<0)break}else if(o.isText()&&a<o.length){let u=ii(o.text,a);if(u==a)return null;let f=bf(o.dom,a,u).getClientRects();for(let d=0;d<f.length;d++){let p=f[d];if(d==f.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return r(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:r}=e,o=this.view.contentDOM.clientWidth,a=o>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==xn.LTR,d=0,p=(g,b,v)=>{for(let S=0;S<g.children.length&&!(b>r);S++){let w=g.children[S],E=b+w.length,k=w.dom.getBoundingClientRect(),{height:R}=k;if(v&&!S&&(d+=k.top-v.top),w instanceof Vr)E>i&&p(w,b,k);else if(b>=i&&(d>0&&t.push(-d),t.push(R+d),d=0,a)){let N=w.dom.lastChild,T=N?nf(N):[];if(T.length){let B=T[T.length-1],L=f?B.right-k.left:k.right-B.left;L>u&&(u=L,this.minWidth=o,this.minWidthFrom=b,this.minWidthTo=E)}}v&&S==g.children.length-1&&(d+=v.bottom-k.bottom),b=E+w.breakAfter}};return p(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?xn.RTL:xn.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let u=0,f;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=nf(d.dom);if(p.length!=1)return;u+=p[0].width,f=p[0].height}if(u)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:u/a.length,textHeight:f}}});if(e)return e;let t=document.createElement("div"),i,r,o;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let a=nf(t.firstChild)[0];i=t.getBoundingClientRect().height,r=a&&a.width?a.width/27:7,o=a&&a.height?a.height:i,t.remove()}),{lineHeight:i,charWidth:r,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,r=0;;r++){let o=r==t.viewports.length?null:t.viewports[r],a=o?o.from-1:this.view.state.doc.length;if(a>i){let u=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(Gt.replace({widget:new Gy(u),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!o)break;i=o.to+1}return Gt.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Jp).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,r=this.view.state.facet(Lv).map((o,a)=>{let u=typeof o=="function";return u&&(i=!0),u?o(this.view):o});for(r.length&&(this.dynamicDecorationMap[e++]=i,t.push(Ct.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(FR).map(o=>typeof o=="function"?o(this.view):o)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(_R))try{if(d(this.view,e.range,e))return!0}catch(p){nr(this.view.state,p,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!i)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,r.left),top:Math.min(i.top,r.top),right:Math.max(i.right,r.right),bottom:Math.max(i.bottom,r.bottom)});let o=KR(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(C6(this.view.scrollDOM,a,t.head<t.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==xn.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let d=this.view.docView.lineAt(t.head,1);d&&d.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=i=>i.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){fb(this.tile)}}function fb(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)fb(i,e)}}function X6(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function WR(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=RR(t.focusNode,t.focusOffset),r=TR(t.focusNode,t.focusOffset),o=i||r;if(r&&i&&r.node!=i.node){let u=hn.get(r.node);if(!u||u.isText()&&u.text!=r.node.nodeValue)o=r;else if(n.docView.lastCompositionAfterCursor){let f=hn.get(i.node);!f||f.isText()&&f.text!=i.node.nodeValue||(o=r)}}if(n.docView.lastCompositionAfterCursor=o!=i,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function $6(n,e,t){let i=WR(n,t);if(!i)return null;let{node:r,from:o,to:a}=i,u=r.nodeValue;if(/[\n\r]/.test(u)||n.state.doc.sliceString(i.from,i.to)!=u)return null;let f=e.invertedDesc;return{range:new ds(f.mapPos(o),f.mapPos(a),o,a),text:r}}function Z6(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let J6=class{constructor(){this.changes=[]}compareRange(e,t){ac(e,t,this.changes)}comparePoint(e,t){ac(e,t,this.changes)}boundChange(e){ac(e,e,this.changes)}};function eI(n,e,t){let i=new J6;return Ct.compare(n,e,t,i),i.changes}class tI{constructor(){this.changes=[]}compareRange(e,t){ac(e,t,this.changes)}comparePoint(){}boundChange(e){ac(e,e,this.changes)}}function nI(n,e,t){let i=new tI;return Ct.compare(n,e,t,i),i.changes}function iI(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function sI(n,e){let t=!1;return e&&n.iterChangedRanges((i,r)=>{i<e.to&&r>e.from&&(t=!0)}),t}class Gy extends Hf{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 rI(n,e,t=1){let i=n.charCategorizer(e),r=n.doc.lineAt(e),o=e-r.from;if(r.length==0)return Se.cursor(e);o==0?t=1:o==r.length&&(t=-1);let a=o,u=o;t<0?a=ii(r.text,o,!1):u=ii(r.text,o);let f=i(r.text.slice(a,u));for(;a>0;){let d=ii(r.text,a,!1);if(i(r.text.slice(d,a))!=f)break;a=d}for(;u<r.length;){let d=ii(r.text,u);if(i(r.text.slice(u,d))!=f)break;u=d}return Se.undirectionalRange(a+r.from,u+r.from)}function lI(n,e,t,i,r){let o=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let u=n.viewState.heightOracle.textHeight,f=Math.floor((r-t.top-(n.defaultLineHeight-u)*.5)/u);o+=f*n.viewState.heightOracle.lineLength}let a=n.state.sliceDoc(t.from,t.to);return t.from+p6(a,o,n.state.tabSize)}function oI(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let r;for(let o of i.type){if(o.from>e)break;if(!(o.to<e)){if(o.from<e&&o.to>e)return o;(!r||o.type==Di.Text&&(r.type!=o.type||(t<0?o.from<e:o.to>e)))&&(r=o)}}return r||i}return i}function aI(n,e,t,i){let r=oI(n,e.head,e.assoc||-1),o=!i||r.type!=Di.Text||!(n.lineWrapping||r.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(o){let a=n.dom.getBoundingClientRect(),u=n.textDirectionAt(r.from),f=n.posAtCoords({x:t==(u==xn.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(f!=null)return Se.cursor(f,t?-1:1)}return Se.cursor(t?r.to:r.from,t?-1:1)}function gk(n,e,t,i){let r=n.state.doc.lineAt(e.head),o=n.bidiSpans(r),a=n.textDirectionAt(r.from);for(let u=e,f=null;;){let d=B6(r,o,a,u,t),p=jR;if(!d){if(r.number==(t?n.state.doc.lines:1))return u;p=`
|
|
206
|
+
`,r=n.state.doc.line(r.number+(t?1:-1)),o=n.bidiSpans(r),d=n.visualLineSide(r,!t)}if(f){if(!f(p))return u}else{if(!i)return d;f=i(p)}u=d}}function cI(n,e,t){let i=n.state.charCategorizer(e),r=i(t);return o=>{let a=i(o);return r==Pr.Space&&(r=a),r==a}}function uI(n,e,t,i){let r=e.head,o=t?1:-1;if(r==(t?n.state.doc.length:0))return Se.cursor(r,e.assoc);let a=e.goalColumn,u,f=n.contentDOM.getBoundingClientRect(),d=n.coordsAtPos(r,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),p=n.documentTop;if(d)a==null&&(a=d.left-f.left),u=o<0?d.top:d.bottom;else{let S=n.viewState.lineBlockAt(r);a==null&&(a=Math.min(f.right-f.left,n.defaultCharacterWidth*(r-S.from))),u=(o<0?S.top:S.bottom)+p}let g=f.left+a,b=n.viewState.heightOracle.textHeight>>1,v=i??b;for(let S=0;;S+=b){let w=u+(v+S)*o,E=hb(n,{x:g,y:w},!1,o);if(t?w>f.bottom:w<f.top)return Se.cursor(E.pos,E.assoc);let k=n.coordsAtPos(E.pos,E.assoc),R=k?(k.top+k.bottom)/2:0;if(!k||(t?R>u:R<u))return Se.cursor(E.pos,E.assoc,void 0,a)}}function rf(n,e,t){for(;;){let i=0;for(let r of n)r.between(e-1,e+1,(o,a,u)=>{if(e>o&&e<a){let f=i||t||(e-o<a-e?-1:1);e=f<0?o:a,i=f}});if(!i)return e}}function XR(n,e){let t=null;for(let i=0;i<e.ranges.length;i++){let r=e.ranges[i],o=null;if(r.empty){let a=rf(n,r.from,0);a!=r.from&&(o=Se.cursor(a,-1))}else{let a=rf(n,r.from,-1),u=rf(n,r.to,1);(a!=r.from||u!=r.to)&&(r.undirectional?o=Se.undirectionalRange(r.from,r.to):o=Se.range(r.from==r.anchor?a:u,r.from==r.head?a:u))}o&&(t||(t=e.ranges.slice()),t[i]=o)}return t?Se.create(t,e.mainIndex):e}function Qy(n,e,t){let i=rf(n.state.facet(Uf).map(r=>r(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:Se.cursor(i,i<t.from?1:-1)}class er{constructor(e,t){this.pos=e,this.assoc=t}}function hb(n,e,t,i){let r=n.contentDOM.getBoundingClientRect(),o=r.top+n.viewState.paddingTop,{x:a,y:u}=e,f=u-o,d;for(;;){if(f<0)return new er(0,1);if(f>n.viewState.docHeight)return new er(n.state.doc.length,-1);if(d=n.elementAtHeight(f),i==null)break;if(d.type==Di.Text){if(i<0?d.to<n.viewport.from:d.from>n.viewport.to)break;let b=n.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(b&&(i<0?b.top<=f+o:b.bottom>=f+o))break}let g=n.viewState.heightOracle.textHeight/2;f=i>0?d.bottom+g:d.top-g}if(n.viewport.from>=d.to||n.viewport.to<=d.from){if(t)return null;if(d.type==Di.Text){let g=lI(n,r,d,a,u);return new er(g,g==d.from?1:-1)}}if(d.type!=Di.Text)return f<(d.top+d.bottom)/2?new er(d.from,1):new er(d.to,-1);let p=n.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=n.docView.lineAt(d.from,-2)),new fI(n,a,u,n.textDirectionAt(d.from)).scanTile(p,d.from)}class fI{constructor(e,t,i,r){this.view=e,this.x=t,this.y=i,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[tr.find(r,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:r}=this.bidiSpansAt(e);return r[tr.find(r,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:r}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+r.from<t)}scan(e,t,i=!1){let r=0,o=e.length-1,a=new Set,u=this.bidiIn(e[0],e[o]),f,d,p=-1,g=1e9,b;e:for(;r<o;){let S=o-r,w=r+o>>1;t:if(a.has(w)){let k=r+Math.floor(Math.random()*S);for(let R=0;R<S;R++){if(!a.has(k)){w=k;break t}k++,k==o&&(k=r)}break e}a.add(w);let E=t(w);if(E)for(let k=0;k<E.length;k++){let R=E[k],N=0;if(!(R.width==0&&E.length>1)){if(R.bottom<this.y)(!f||f.bottom<R.bottom)&&(f=R),N=1;else if(R.top>this.y)(!d||d.top>R.top)&&(d=R),N=-1;else{let T=R.left>this.x?this.x-R.left:R.right<this.x?this.x-R.right:0,B=Math.abs(T);B<g&&(p=w,g=B,b=R),T&&(N=T<0==(this.baseDir==xn.LTR)?-1:1)}N==-1&&(!u||this.baseDirAt(e[w],1))?o=w:N==1&&(!u||this.baseDirAt(e[w+1],-1))&&(r=w+1)}}}if(!b){if(!d&&!f)return{i:e[0],after:!1};let S=f&&(!d||this.y-f.bottom<d.top-this.y)?f:d;return this.y=(S.top+S.bottom)/2,this.scan(e,t,!0)}if(g&&!i){let{top:S,bottom:w}=b;if(f&&f.bottom>(S+S+w)/3)return this.y=f.bottom-1,this.scan(e,t,!0);if(d&&d.top<(S+w+w)/3)return this.y=d.top+1,this.scan(e,t,!0)}let v=(u?this.dirAt(e[p],1):this.baseDir)==xn.LTR;return{i:p,after:this.x>(b.left+b.right)/2==v}}scanText(e,t){let i=[];for(let o=0;o<e.length;o=ii(e.text,o))i.push(t+o);i.push(t+e.length);let r=this.scan(i,o=>{let a=i[o]-t,u=i[o+1]-t;return bf(e.dom,a,u).getClientRects()});return r.after?new er(i[r.i+1],-1):new er(i[r.i],1)}scanTile(e,t){if(!e.length)return new er(t,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,t);if(u.isComposite())return this.scanTile(u,t)}let i=[t];for(let u=0,f=t;u<e.children.length;u++)i.push(f+=e.children[u].length);let r=this.scan(i,u=>{let f=e.children[u];return f.flags&48?null:(f.dom.nodeType==1?f.dom:bf(f.dom,0,f.length)).getClientRects()}),o=e.children[r.i],a=i[r.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):r.after?new er(i[r.i+1],-1):new er(a,1)}}const $a="";class hI{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(wt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=$a}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let r=e;;){this.findPointBefore(i,r);let o=this.text.length;this.readNode(r);let a=hn.get(r),u=r.nextSibling;if(u==t){a!=null&&a.breakAfter&&!u&&i!=this.view.contentDOM&&this.lineBreak();break}let f=hn.get(u);(a&&f?a.breakAfter:(a?a.breakAfter:mp(r))||mp(u)&&(r.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>o)&&!pI(u,t)&&this.lineBreak(),r=u}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,a=1,u;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(u=r.exec(t))&&(o=u.index,a=u[0].length),this.append(t.slice(i,o<0?t.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=a-1);i=o+a}}readNode(e){let t=hn.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let r=i.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.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,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(dI(e,i.node,i.offset)?t:0))}}function dI(n,e,t){for(;;){if(!e||t<Kr(e))return!1;if(e==n)return!0;t=to(e)+1,e=e.parentNode}}function pI(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let i=hn.get(n);if(!(i!=null&&i.isWidget()))return!1;i&&(t||(t=[])).push(i)}if(t)for(let i of t){let r=i.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class yk{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class mI{constructor(e,t,i,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:o,impreciseAnchor:a}=e.docView,u=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=$R(e.docView.tile,t,i,0))){let f=o||a?[]:yI(e),d=new hI(f,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=bI(f,this.bounds.from)}else{let f=e.observer.selectionRange,d=o&&o.node==f.focusNode&&o.offset==f.focusOffset||!lb(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),p=a&&a.node==f.anchorNode&&a.offset==f.anchorOffset||!lb(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),g=e.viewport;if((Be.ios||Be.chrome)&&d!=p&&Math.min(d,p)<=u.main.from&&Math.max(d,p)>=u.main.to&&(g.from>0||g.to<e.state.doc.length)){let b=Math.min(d,p),v=Math.max(d,p),S=g.from-b,w=g.to-v;(S==0||S==1||b==0)&&(w==0||w==-1||v==e.state.doc.length)&&(d=0,p=e.state.doc.length)}if(e.inputState.composing>-1&&u.ranges.length>1)this.newSel=u.replaceRange(Se.range(p,d));else if(e.lineWrapping&&p==d&&!(u.main.empty&&u.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let b=e.coordsAtPos(d,-1),v=0;b&&(v=e.inputState.lastTouchY<=b.bottom?-1:1),this.newSel=Se.create([Se.cursor(d,v)])}else this.newSel=Se.single(p,d)}}}function $R(n,e,t,i){if(n.isComposite()){let r=-1,o=-1,a=-1,u=-1;for(let f=0,d=i,p=i;f<n.children.length;f++){let g=n.children[f],b=d+g.length;if(d<e&&b>t)return $R(g,e,t,d);if(b>=e&&r==-1&&(r=f,o=d),d>t&&g.dom.parentNode==n.dom){a=f,u=p;break}p=b,d=b+g.breakAfter}return{from:o,to:u<0?i+n.length:u,startDOM:(r?n.children[r-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:a<n.children.length&&a>=0?n.children[a].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function ZR(n,e){let t,{newSel:i}=e,{state:r}=n,o=r.selection.main,a=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,d=o.from,p=null;(a===8||Be.android&&e.text.length<f-u)&&(d=o.to,p="end");let g=r.doc.sliceString(u,f,$a),b,v;!o.empty&&o.from>=u&&o.to<=f&&(e.typeOver||g!=e.text)&&g.slice(0,o.from-u)==e.text.slice(0,o.from-u)&&g.slice(o.to-u)==e.text.slice(b=e.text.length-(g.length-(o.to-u)))?t={from:o.from,to:o.to,insert:kt.of(e.text.slice(o.from-u,b).split($a))}:(v=JR(g,e.text,d-u,p))&&(Be.chrome&&a==13&&v.toB==v.from+2&&e.text.slice(v.from,v.toB)==$a+$a&&v.toB--,t={from:u+v.from,to:u+v.toA,insert:kt.of(e.text.slice(v.from,v.toB).split($a))})}else i&&(!n.hasFocus&&r.facet(Ir)||vp(i,o))&&(i=null);if(!t&&!i)return!1;if((Be.mac||Be.android)&&t&&t.from==t.to&&t.from==o.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=Se.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:kt.of([t.insert.toString().replace("."," ")])}):r.doc.lineAt(o.from).to<o.to&&n.docView.lineHasWidget(o.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:o.from,to:o.to,insert:r.toText(n.inputState.insertingText)}:Be.chrome&&t&&t.from==t.to&&t.from==o.head&&t.insert.toString()==`
|
|
207
|
+
`&&n.lineWrapping&&(i&&(i=Se.single(i.main.anchor-1,i.main.head-1)),t={from:o.from,to:o.to,insert:kt.of([" "])}),t)return zv(n,t,i,a);if(i&&!vp(i,o)){let u=!1,f="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(u=!0),f=n.inputState.lastSelectionOrigin,f=="select.pointer"&&(i=XR(r.facet(Uf).map(d=>d(n)),i))),n.dispatch({selection:i,scrollIntoView:u,userEvent:f}),!0}else return!1}function zv(n,e,t,i=-1){if(Be.ios&&n.inputState.flushIOSKey(e))return!0;let r=n.state.selection.main;if(Be.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&n.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&cc(n.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&cc(n.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&cc(n.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let a,u=()=>a||(a=gI(n,e,t));return n.state.facet(PR).some(f=>f(n,e.from,e.to,o,u))||n.dispatch(u()),!0}function gI(n,e,t){let i,r=n.state,o=r.selection.main,a=-1;if(e.from==e.to&&e.from<o.from||e.from>o.to){let f=e.from<o.from?-1:1,d=f<0?o.from:o.to,p=rf(r.facet(Uf).map(g=>g(n)),d,f);e.from==p&&(a=p)}if(a>-1)i={changes:e,selection:Se.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let f=o.from<e.from?r.sliceDoc(o.from,e.from):"",d=o.to>e.to?r.sliceDoc(e.to,o.to):"";i=r.replaceSelection(n.state.toText(f+e.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let f=r.changes(e),d=t&&t.main.to<=f.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let p=n.state.sliceDoc(e.from,e.to),g,b=t&&WR(n,t.main.head);if(b){let S=e.insert.length-(e.to-e.from);g={from:b.from,to:b.to-S}}else g=n.state.doc.lineAt(o.head);let v=o.to-e.to;i=r.changeByRange(S=>{if(S.from==o.from&&S.to==o.to)return{changes:f,range:d||S.map(f)};let w=S.to-v,E=w-p.length;if(n.state.sliceDoc(E,w)!=p||w>=g.from&&E<=g.to)return{range:S};let k=r.changes({from:E,to:w,insert:e.insert}),R=S.to-o.to;return{changes:k,range:d?Se.range(Math.max(0,d.anchor+R),Math.max(0,d.head+R)):S.map(k)}})}else i={changes:f,selection:d&&r.selection.replaceRange(d)}}let u="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,u+=".compose",n.inputState.compositionFirstChange&&(u+=".start",n.inputState.compositionFirstChange=!1)),r.update(i,{userEvent:u,scrollIntoView:!0})}function JR(n,e,t,i){let r=Math.min(n.length,e.length),o=0;for(;o<r&&n.charCodeAt(o)==e.charCodeAt(o);)o++;if(o==r&&n.length==e.length)return null;let a=n.length,u=e.length;for(;a>0&&u>0&&n.charCodeAt(a-1)==e.charCodeAt(u-1);)a--,u--;if(i=="end"){let f=Math.max(0,o-Math.min(a,u));t-=a+f-o}if(a<o&&n.length<e.length){let f=t<=o&&t>=a?o-t:0;o-=f,u=o+(u-a),a=o}else if(u<o){let f=t<=o&&t>=u?o-t:0;o-=f,a=o+(a-u),u=o}return{from:o,toA:a,toB:u}}function yI(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:o}=n.observer.selectionRange;return t&&(e.push(new yk(t,i)),(r!=t||o!=i)&&e.push(new yk(r,o))),e}function bI(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?Se.single(t+e,i+e):null}function vp(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class vI{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,Be.safari&&e.contentDOM.addEventListener("input",()=>null),Be.gecko&&LI(e.contentDOM.ownerDocument)}handleEvent(e){!TI(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let r of i.observers)r(this.view,t);for(let r of i.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=SI(e),i=this.handlers,r=this.view.contentDOM;for(let o in t)if(o!="scroll"){let a=!t[o].handlers.length,u=i[o];u&&a!=!u.handlers.length&&(r.removeEventListener(o,this.handleEvent),u=null),u||r.addEventListener(o,this.handleEvent,{passive:a})}for(let o in i)o!="scroll"&&!t[o]&&r.removeEventListener(o,this.handleEvent);this.handlers=t}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&&tT.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Be.android&&Be.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Be.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(eT.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||wI.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};return t.shiftKey&&Be.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&xI(this.view.win)&&(t.shiftKey=!1),this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t},setTimeout(()=>this.flushIOSKey(),250),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,cc(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:Be.safari&&!Be.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 xI(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function bk(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(r){nr(t.state,r)}}}function SI(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let r=i.spec,o=r&&r.plugin.domEventHandlers,a=r&&r.plugin.domEventObservers;if(o)for(let u in o){let f=o[u];f&&t(u).handlers.push(bk(i.value,f))}if(a)for(let u in a){let f=a[u];f&&t(u).observers.push(bk(i.value,f))}}for(let i in js)t(i).handlers.push(js[i]);for(let i in gi)t(i).observers.push(gi[i]);return e}const eT=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],wI="dthko",tT=[16,17,18,20,91,92,224,225],Cd=6;function kd(n){return Math.max(0,n)*.7+8}function CI(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class kI{constructor(e,t,i,r){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=kR(e.contentDOM),this.atoms=e.state.facet(Uf).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(wt.allowMultipleSelections)&&AI(e,t),this.dragging=RI(e,t)&&sT(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&CI(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,r=0,o=0,a=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=KR(this.view);e.clientX-f.left<=r+Cd?t=-kd(r-e.clientX):e.clientX+f.right>=a-Cd&&(t=kd(e.clientX-a)),e.clientY-f.top<=o+Cd?i=-kd(o-e.clientY):e.clientY+f.bottom>=u-Cd&&(i=kd(e.clientY-u)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=XR(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function AI(n,e){let t=n.state.facet(BR);return t.length?t[0](e):Be.mac?e.metaKey:e.ctrlKey}function EI(n,e){let t=n.state.facet(LR);return t.length?t[0](e):Be.mac?!e.altKey:!e.ctrlKey}function RI(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=gf(n.root);if(!i||i.rangeCount==0)return!0;let r=i.getRangeAt(0).getClientRects();for(let o=0;o<r.length;o++){let a=r[o];if(a.left<=e.clientX&&a.right>=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function TI(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=hn.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const js=Object.create(null),gi=Object.create(null),nT=Be.ie&&Be.ie_version<15||Be.ios&&Be.webkit_version<604;function OI(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),iT(n,t.value)},50)}function nm(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function iT(n,e){e=nm(n.state,Dv,e);let{state:t}=n,i,r=1,o=t.toText(e),a=o.lines==t.selection.ranges.length;if(db!=null&&t.selection.ranges.every(f=>f.empty)&&db==o.toString()){let f=-1;i=t.changeByRange(d=>{let p=t.doc.lineAt(d.from);if(p.from==f)return{range:d};f=p.from;let g=t.toText((a?o.line(r++).text:e)+t.lineBreak);return{changes:{from:p.from,insert:g},range:Se.cursor(d.from+g.length)}})}else a?i=t.changeByRange(f=>{let d=o.line(r++);return{changes:{from:f.from,to:f.to,insert:d.text},range:Se.cursor(f.from+d.length)}}):i=t.replaceSelection(o);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}gi.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,Be.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};gi.wheel=gi.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};js.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);gi.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};gi.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};gi.touchend=(n,e)=>{n.inputState.touchActive=!1};js.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(zR))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=NI(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new kI(n,e,t,i)),i&&n.observer.ignore(()=>{AR(n.contentDOM);let o=n.root.activeElement;o&&!o.contains(n.contentDOM)&&o.blur()});let r=n.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function vk(n,e,t,i){if(i==1)return Se.cursor(e,t);if(i==2)return rI(n.state,e,t);{let r=n.docView.lineAt(e,t),o=n.state.doc.lineAt(r?r.posAtEnd:e),a=r?r.posAtStart:o.from,u=r?r.posAtEnd:o.to;return u<n.state.doc.length&&u==o.to&&u++,Se.undirectionalRange(a,u)}}const MI=Be.ie&&Be.ie_version<=11;let xk=null,Sk=0,wk=0;function sT(n){if(!MI)return n.detail;let e=xk,t=wk;return xk=n,wk=Date.now(),Sk=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Sk+1)%3:1}function NI(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=sT(e),r=n.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),r=r.map(o.changes))},get(o,a,u){let f=n.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,p=vk(n,f.pos,f.assoc,i);if(t.pos!=f.pos&&!a){let g=vk(n,t.pos,t.assoc,i),b=Math.min(g.from,p.from),v=Math.max(g.to,p.to);p=b<p.from?Se.range(b,v,p.assoc):Se.range(v,b,p.assoc)}return a?r.replaceRange(r.main.extend(p.from,p.to,p.assoc)):u&&i==1&&r.ranges.length>1&&(d=DI(r,f.pos))?d:u?r.addRange(p):Se.create([p])}}}function DI(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:r}=n.ranges[t];if(i<=e&&r>=e)return Se.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}js.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let r=n.docView.tile.nearest(e.target);if(r&&r.isWidget()){let o=r.posAtStart,a=o+r.length;(o>=t.to||a<=t.from)&&(t=Se.undirectionalRange(o,a))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",nm(n.state,jv,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};js.dragend=n=>(n.inputState.draggedContent=null,!1);function Ck(n,e,t,i){if(t=nm(n.state,Dv,t),!t)return;let r=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=n.inputState,a=i&&o&&EI(n,e)?{from:o.from,to:o.to}:null,u={from:r,insert:t},f=n.state.changes(a?[a,u]:u);n.focus(),n.dispatch({changes:f,selection:{anchor:f.mapPos(r,-1),head:f.mapPos(r,1)},userEvent:a?"move.drop":"input.drop"}),n.inputState.draggedContent=null}js.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),r=0,o=()=>{++r==t.length&&Ck(n,e,i.filter(a=>a!=null).join(n.state.lineBreak),!1)};for(let a=0;a<t.length;a++){let u=new FileReader;u.onerror=o,u.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(i[a]=u.result),o()},u.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return Ck(n,e,i,!0),!0}return!1};js.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=nT?null:e.clipboardData;return t?(iT(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(OI(n),!1)};function jI(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function BI(n){let e=[],t=[],i=!1;for(let r of n.selection.ranges)r.empty||(e.push(n.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:o}of n.selection.ranges){let a=n.doc.lineAt(o);a.number>r&&(e.push(a.text),t.push({from:a.from,to:Math.min(n.doc.length,a.to+1)})),r=a.number}i=!0}return{text:nm(n,jv,e.join(n.lineBreak)),ranges:t,linewise:i}}let db=null;js.copy=js.cut=(n,e)=>{if(!tf(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:r}=BI(n.state);if(!t&&!r)return!1;db=r?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=nT?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(jI(n,t),!1)};const rT=fo.define();function lT(n,e){let t=[];for(let i of n.facet(HR)){let r=i(n,e);r&&t.push(r)}return t.length?n.update({effects:t,annotations:rT.of(!0)}):null}function oT(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=lT(n.state,e);t?n.dispatch(t):n.update([])}},10)}gi.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),oT(n)};gi.blur=n=>{n.observer.clearSelectionRange(),oT(n)};gi.compositionstart=gi.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};gi.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Be.chrome&&Be.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};gi.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};js.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let u=a[0],f=n.posAtDOM(u.startContainer,u.startOffset),d=n.posAtDOM(u.endContainer,u.endOffset);return zv(n,{from:f,to:d,insert:n.state.toText(o)},null),!0}}let r;if(Be.chrome&&Be.android&&(r=eT.find(o=>o.inputType==e.inputType))&&(n.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return Be.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),Be.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>gi.compositionend(n,e),20),!1};const kk=new Set;function LI(n){kk.has(n)||(kk.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const Ak=["pre-wrap","normal","pre-line","break-spaces"];let jc=!1;function Ek(){jc=!1}class zI{constructor(e){this.lineWrapping=e,this.doc=kt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}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 Ak.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let r=e[i];r<0?i++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,i,r,o,a){let u=Ak.indexOf(e)>-1,f=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=t,this.charWidth=i,this.textHeight=r,this.lineLength=o,f){this.heightSamples={};for(let d=0;d<a.length;d++){let p=a[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return f}}class II{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Rs{constructor(e,t,i,r,o){this.from=e,this.length=t,this.top=i,this.height=r,this._content=o}get type(){return typeof this._content=="number"?Di.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 sa?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Rs(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Yt=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(Yt||(Yt={}));const Fd=.001;class mi{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}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)>Fd&&(jc=!0),this.height=e)}replace(e,t,i){return mi.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,r){let o=this,a=i.doc;for(let u=r.length-1;u>=0;u--){let{fromA:f,toA:d,fromB:p,toB:g}=r[u],b=o.lineAt(f,Yt.ByPosNoHeight,i.setDoc(t),0,0),v=b.to>=d?b:o.lineAt(d,Yt.ByPosNoHeight,i,0,0);for(g+=v.to-d,d=v.to;u>0&&b.from<=r[u-1].toA;)f=r[u-1].fromA,p=r[u-1].fromB,u--,f<b.from&&(b=o.lineAt(f,Yt.ByPosNoHeight,i,0,0));p+=b.from-f,f=b.from;let S=Iv.build(i.setDoc(a),e,p,g);o=xp(o,o.replace(f,d,S))}return o.updateHeight(i,0)}static empty(){return new Gi(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,r=0,o=0;for(;;)if(t==i)if(r>o*2){let u=e[t-1];u.break?e.splice(--t,1,u.left,null,u.right):e.splice(--t,1,u.left,u.right),i+=1+u.break,r-=u.size}else if(o>r*2){let u=e[i];u.break?e.splice(i,1,u.left,null,u.right):e.splice(i,1,u.left,u.right),i+=2+u.break,o-=u.size}else break;else if(r<o){let u=e[t++];u&&(r+=u.size)}else{let u=e[--i];u&&(o+=u.size)}let a=0;return e[t-1]==null?(a=1,t--):e[t]==null&&(a=1,i++),new HI(mi.of(e.slice(0,t)),a,mi.of(e.slice(i)))}}function xp(n,e){return n==e?n:(n.constructor!=e.constructor&&(jc=!0),e)}mi.prototype.size=1;const PI=Gt.replace({});class aT extends mi{constructor(e,t,i){super(e,t),this.deco=i,this.spaceAbove=0}mainBlock(e,t){return new Rs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,i,r){return this.spaceAbove&&e<i+this.spaceAbove?new Rs(r,0,i,this.spaceAbove,PI):this.mainBlock(i,r)}lineAt(e,t,i,r,o){let a=this.mainBlock(r,o);return this.spaceAbove?this.blockAt(0,i,r,o).join(a):a}forEachLine(e,t,i,r,o,a){e<=o+this.length&&t>=o&&a(this.lineAt(0,Yt.ByPos,i,r,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Gi extends aT{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Rs(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let r=i[0];return i.length==1&&(r instanceof Gi||r instanceof Yn&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Yn?r=new Gi(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):mi.of(i)}updateHeight(e,t=0,i=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(i||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 Yn extends mi{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,o=r-i+1,a,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*o);a=f/o,this.length>o+1&&(u=(this.height-f)/(this.length-o-1))}else a=this.height/o;return{firstLine:i,lastLine:r,perLine:a,perChar:u}}blockAt(e,t,i,r){let{firstLine:o,lastLine:a,perLine:u,perChar:f}=this.heightMetrics(t,r);if(t.lineWrapping){let d=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),p=t.doc.lineAt(d),g=u+p.length*f,b=Math.max(i,e-g/2);return new Rs(p.from,p.length,b,g,0)}else{let d=Math.max(0,Math.min(a-o,Math.floor((e-i)/u))),{from:p,length:g}=t.doc.line(o+d);return new Rs(p,g,i+u*d,u,0)}}lineAt(e,t,i,r,o){if(t==Yt.ByHeight)return this.blockAt(e,i,r,o);if(t==Yt.ByPosNoHeight){let{from:v,to:S}=i.doc.lineAt(e);return new Rs(v,S-v,0,0,0)}let{firstLine:a,perLine:u,perChar:f}=this.heightMetrics(i,o),d=i.doc.lineAt(e),p=u+d.length*f,g=d.number-a,b=r+u*g+f*(d.from-o-g);return new Rs(d.from,d.length,Math.max(r,Math.min(b,r+this.height-p)),p,0)}forEachLine(e,t,i,r,o,a){e=Math.max(e,o),t=Math.min(t,o+this.length);let{firstLine:u,perLine:f,perChar:d}=this.heightMetrics(i,o);for(let p=e,g=r;p<=t;){let b=i.doc.lineAt(p);if(p==e){let S=b.number-u;g+=f*S+d*(e-o-S)}let v=f+d*b.length;a(new Rs(b.from,b.length,g,v,0)),g+=v,p=b.to+1}}replace(e,t,i){let r=this.length-t;if(r>0){let o=i[i.length-1];o instanceof Yn?i[i.length-1]=new Yn(o.length+r):i.push(null,new Yn(r-1))}if(e>0){let o=i[0];o instanceof Yn?i[0]=new Yn(e+o.length):i.unshift(new Yn(e-1),null)}return mi.of(i)}decomposeLeft(e,t){t.push(new Yn(e-1),null)}decomposeRight(e,t){t.push(null,new Yn(this.length-e-1))}updateHeight(e,t=0,i=!1,r){let o=t+this.length;if(r&&r.from<=t+this.length&&r.more){let a=[],u=Math.max(t,r.from),f=-1;for(r.from>t&&a.push(new Yn(r.from-t-1).updateHeight(e,t));u<=o&&r.more;){let p=e.doc.lineAt(u).length;a.length&&a.push(null);let g=r.heights[r.index++],b=0;g<0&&(b=-g,g=r.heights[r.index++]),f==-1?f=g:Math.abs(g-f)>=Fd&&(f=-2);let v=new Gi(p,g,b);v.outdated=!1,a.push(v),u+=p+1}u<=o&&a.push(null,new Yn(o-u).updateHeight(e,u));let d=mi.of(a);return(f<0||Math.abs(d.height-this.height)>=Fd||Math.abs(f-this.heightMetrics(e,t).perLine)>=Fd)&&(jc=!0),xp(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class HI extends mi{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,r){let o=i+this.left.height;return e<o?this.left.blockAt(e,t,i,r):this.right.blockAt(e,t,o,r+this.left.length+this.break)}lineAt(e,t,i,r,o){let a=r+this.left.height,u=o+this.left.length+this.break,f=t==Yt.ByHeight?e<a:e<u,d=f?this.left.lineAt(e,t,i,r,o):this.right.lineAt(e,t,i,a,u);if(this.break||(f?d.to<u:d.from>u))return d;let p=t==Yt.ByPosNoHeight?Yt.ByPosNoHeight:Yt.ByPos;return f?d.join(this.right.lineAt(u,p,i,a,u)):this.left.lineAt(u,p,i,r,o).join(d)}forEachLine(e,t,i,r,o,a){let u=r+this.left.height,f=o+this.left.length+this.break;if(this.break)e<f&&this.left.forEachLine(e,t,i,r,o,a),t>=f&&this.right.forEachLine(e,t,i,u,f,a);else{let d=this.lineAt(f,Yt.ByPos,i,r,o);e<d.from&&this.left.forEachLine(e,d.from-1,i,r,o,a),d.to>=e&&d.from<=t&&a(d),t>d.to&&this.right.forEachLine(d.to+1,t,i,u,f,a)}}replace(e,t,i){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,i));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let u of i)o.push(u);if(e>0&&Rk(o,a-1),t<this.length){let u=o.length;this.decomposeRight(t,o),Rk(o,u)}return mi.of(o)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,r=i+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?mi.of(this.break?[e,null,t]:[e,t]):(this.left=xp(this.left,e),this.right=xp(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,r){let{left:o,right:a}=this,u=t+o.length+this.break,f=null;return r&&r.from<=t+o.length&&r.more?f=o=o.updateHeight(e,t,i,r):o.updateHeight(e,t,i),r&&r.from<=u+a.length&&r.more?f=a=a.updateHeight(e,u,i,r):a.updateHeight(e,u,i),f?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Rk(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof Yn&&(i=n[e+1])instanceof Yn&&n.splice(e-1,3,new Yn(t.length+1+i.length))}const VI=5;class Iv{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof Gi?r.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Gi(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let r=i.widget?i.widget.estimatedHeight:0,o=i.widget?i.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;i.block?this.addBlock(new aT(a,r,i)):(a||o||r>=VI)&&this.addLineDeco(r,o,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Gi(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new Yn(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Gi)return e;let t=new Gi(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let r=this.ensureLine();r.length+=i,r.collapsed+=i,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Gi)&&!this.isCovered?this.nodes.push(new Gi(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let r of this.nodes)r instanceof Gi&&r.updateHeight(this.oracle,i),i+=r?r.length:1;return this.nodes}static build(e,t,i,r){let o=new Iv(i,e);return Ct.spans(t,i,r,o,0),o.finish(i)}}function _I(n,e,t){let i=new UI;return Ct.compare(n,e,t,i,0),i.changes}class UI{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,r){(e<t||i&&i.heightRelevant||r&&r.heightRelevant)&&ac(e,t,this.changes,5)}}function qI(n,e){let t=n.getBoundingClientRect(),i=n.ownerDocument,r=i.defaultView||window,o=Math.max(0,t.left),a=Math.min(r.innerWidth,t.right),u=Math.max(0,t.top),f=Math.min(r.innerHeight,t.bottom);for(let d=n.parentNode;d&&d!=i.body;)if(d.nodeType==1){let p=d,g=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&g.overflow!="visible"){let b=p.getBoundingClientRect();o=Math.max(o,b.left),a=Math.min(a,b.right),u=Math.max(u,b.top),f=Math.min(d==n.parentNode?r.innerHeight:f,b.bottom)}d=g.position=="absolute"||g.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-t.left,right:Math.max(o,a)-t.left,top:u-(t.top+e),bottom:Math.max(u,f)-(t.top+e)}}function FI(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function GI(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class Ky{constructor(e,t,i,r){this.from=e,this.to=t,this.size=i,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let r=e[i],o=t[i];if(r.from!=o.from||r.to!=o.to||r.size!=o.size)return!1}return!0}draw(e,t){return Gt.replace({widget:new QI(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class QI extends Hf{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Tk{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=Ok,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=xn.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=t.facet(Bv).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new zI(i),this.stateDeco=Mk(t),this.heightMap=mi.empty().applyChanges(this.stateDeco,kt.empty,this.heightOracle.setDoc(t.doc),[new ds(0,0,0,t.doc.length)]);for(let r=0;r<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());r++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Gt.set(this.lineGaps.map(r=>r.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let r=i?t.head:t.anchor;if(!e.some(({from:o,to:a})=>r>=o&&r<=a)){let{from:o,to:a}=this.lineBlockAt(r);e.push(new Ad(o,a))}}return this.viewports=e.sort((i,r)=>i.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ok:new Pv(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(Ku(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=Mk(this.state);let r=e.changedRanges,o=ds.extendWithRanges(r,_I(i,this.stateDeco,e?e.changes:jn.empty(this.state.doc.length))),a=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);Ek(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||jc)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let f=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<f.from||t.range.head>f.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));let d=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(z6)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),r=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?xn.RTL:xn.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",u=t.getBoundingClientRect(),f=a||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let d=0,p=0;if(u.width&&u.height){let{scaleX:B,scaleY:L}=CR(t,u);(B>.005&&Math.abs(this.scaleX-B)>.005||L>.005&&Math.abs(this.scaleY-L)>.005)&&(this.scaleX=B,this.scaleY=L,d|=16,a=f=!0)}let g=(parseInt(i.paddingTop)||0)*this.scaleY,b=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=b)&&(this.paddingTop=g,this.paddingBottom=b,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=kR(this.view.contentDOM,!1).y;v!=this.scrollParent&&(this.scrollParent=v,this.scrollAnchorHeight=-1,this.scrollOffset=0);let S=this.getScrollOffset();this.scrollOffset!=S&&(this.scrollAnchorHeight=-1,this.scrollOffset=S),this.scrolledToBottom=ER(this.scrollParent||e.win);let w=(this.printing?GI:qI)(t,this.paddingTop),E=w.top-this.pixelViewport.top,k=w.bottom-this.pixelViewport.bottom;this.pixelViewport=w;let R=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(R!=this.inView&&(this.inView=R,R&&(f=!0)),!this.inView&&!this.scrollTarget&&!FI(e.dom))return 0;let N=u.width;if((this.contentDOMWidth!=N||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),f){let B=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(B)&&(a=!0),a||r.lineWrapping&&Math.abs(N-this.contentDOMWidth)>r.charWidth){let{lineHeight:L,charWidth:D,textHeight:j}=e.docView.measureTextSize();a=L>0&&r.refresh(o,L,D,j,Math.max(5,N/D),B),a&&(e.docView.minWidth=0,d|=16)}E>0&&k>0?p=Math.max(E,k):E<0&&k<0&&(p=Math.min(E,k)),Ek();for(let L of this.viewports){let D=L.from==this.viewport.from?B:e.docView.measureVisibleLineHeights(L);this.heightMap=(a?mi.empty().applyChanges(this.stateDeco,kt.empty,this.heightOracle,[new ds(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new II(L.from,D))}jc&&(d|=2)}let T=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return T&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||T)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:u}=this,f=new Ad(r.lineAt(a-i*1e3,Yt.ByHeight,o,0,0).from,r.lineAt(u+(1-i)*1e3,Yt.ByHeight,o,0,0).to);if(t){let{head:d}=t.range;if(d<f.from||d>f.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=r.lineAt(d,Yt.ByPos,o,0,0),b;t.y=="center"?b=(g.top+g.bottom)/2-p/2:t.y=="start"||t.y=="nearest"&&d<f.from?b=g.top:b=g.bottom-p,f=new Ad(r.lineAt(b-1e3/2,Yt.ByHeight,o,0,0).from,r.lineAt(b+p+1e3/2,Yt.ByHeight,o,0,0).to)}}return f}mapViewport(e,t){let i=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new Ad(this.heightMap.lineAt(i,Yt.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Yt.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Yt.ByPos,this.heightOracle,0,0),{bottom:o}=this.heightMap.lineAt(t,Yt.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:u}=this;return(e==0||r<=a-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||o>=u+Math.max(10,Math.min(i,250)))&&r>a-2*1e3&&o<u+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let r of e)t.touchesRange(r.from,r.to)||i.push(new Ky(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,r=i?1e4:2e3,o=r>>1,a=r<<1;if(this.defaultTextDirection!=xn.LTR&&!i)return[];let u=[],f=(p,g,b,v)=>{if(g-p<o)return;let S=this.state.selection.main,w=[S.from];S.empty||w.push(S.to);for(let k of w)if(k>p&&k<g){f(p,k-10,b,v),f(k+10,g,b,v);return}let E=YI(e,k=>k.from>=b.from&&k.to<=b.to&&Math.abs(k.from-p)<o&&Math.abs(k.to-g)<o&&!w.some(R=>k.from<R&&k.to>R));if(!E){if(g<b.to&&t&&i&&t.visibleRanges.some(N=>N.from<=g&&N.to>=g)){let N=t.moveToLineBoundary(Se.cursor(g),!1,!0).head;N>p&&(g=N)}let k=this.gapSize(b,p,g,v),R=i||k<2e6?k:2e6;E=new Ky(p,g,k,R)}u.push(E)},d=p=>{if(p.length<a||p.type!=Di.Text)return;let g=KI(p.from,p.to,this.stateDeco);if(g.total<a)return;let b=this.scrollTarget?this.scrollTarget.range.head:null,v,S;if(i){let w=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,E,k;if(b!=null){let R=Rd(g,b),N=((this.visibleBottom-this.visibleTop)/2+w)/p.height;E=R-N,k=R+N}else E=(this.visibleTop-p.top-w)/p.height,k=(this.visibleBottom-p.top+w)/p.height;v=Ed(g,E),S=Ed(g,k)}else{let w=g.total*this.heightOracle.charWidth,E=r*this.heightOracle.charWidth,k=0;if(w>2e6)for(let L of e)L.from>=p.from&&L.from<p.to&&L.size!=L.displaySize&&L.from*this.heightOracle.charWidth+k<this.pixelViewport.left&&(k=L.size-L.displaySize);let R=this.pixelViewport.left+k,N=this.pixelViewport.right+k,T,B;if(b!=null){let L=Rd(g,b),D=((N-R)/2+E)/w;T=L-D,B=L+D}else T=(R-E)/w,B=(N+E)/w;v=Ed(g,T),S=Ed(g,B)}v>p.from&&f(p.from,v,p,g),S<p.to&&f(S,p.to,p,g)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return u}gapSize(e,t,i,r){let o=Rd(r,i)-Rd(r,t);return this.heightOracle.lineWrapping?e.height*o:r.total*this.heightOracle.charWidth*o}updateLineGaps(e){Ky.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Gt.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];Ct.spans(t,this.viewport.from,this.viewport.to,{span(o,a){i.push({from:o,to:a})},point(){}},20);let r=0;if(i.length!=this.visibleRanges.length)r=12;else for(let o=0;o<i.length&&!(r&8);o++){let a=this.visibleRanges[o],u=i[o];(a.from!=u.from||a.to!=u.to)&&(r|=4,e&&e.mapPos(a.from,-1)==u.from&&e.mapPos(a.to,1)==u.to||(r|=8))}return this.visibleRanges=i,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Ku(this.heightMap.lineAt(e,Yt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Ku(this.heightMap.lineAt(this.scaler.fromDOM(e),Yt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Ku(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 Ad{constructor(e,t){this.from=e,this.to=t}}function KI(n,e,t){let i=[],r=n,o=0;return Ct.spans(t,n,e,{span(){},point(a,u){a>r&&(i.push({from:r,to:a}),o+=a-r),r=u}},20),r<e&&(i.push({from:r,to:e}),o+=e-r),{total:o,ranges:i}}function Ed({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let r=0;;r++){let{from:o,to:a}=e[r],u=a-o;if(i<=u)return o+i;i-=u}}function Rd(n,e){let t=0;for(let{from:i,to:r}of n.ranges){if(e<=r){t+=e-i;break}t+=r-i}return t/n.total}function YI(n,e){for(let t of n)if(e(t))return t}const Ok={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function Mk(n){let e=n.facet(Jp).filter(i=>typeof i!="function"),t=n.facet(Lv).filter(i=>typeof i!="function");return t.length&&e.push(Ct.join(t)),e}class Pv{constructor(e,t,i){let r=0,o=0,a=0;this.viewports=i.map(({from:u,to:f})=>{let d=t.lineAt(u,Yt.ByPos,e,0,0).top,p=t.lineAt(f,Yt.ByPos,e,0,0).bottom;return r+=p-d,{from:u,to:f,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let u of this.viewports)u.domTop=a+(u.top-o)*this.scale,a=u.domBottom=u.domTop+(u.bottom-u.top),o=u.bottom}toDOM(e){for(let t=0,i=0,r=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.top)return r+(e-i)*this.scale;if(e<=o.bottom)return o.domTop+(e-o.top);i=o.bottom,r=o.domBottom}}fromDOM(e){for(let t=0,i=0,r=0;;t++){let o=t<this.viewports.length?this.viewports[t]:null;if(!o||e<o.domTop)return i+(e-r)/this.scale;if(e<=o.domBottom)return o.top+(e-o.domTop);i=o.bottom,r=o.domBottom}}eq(e){return e instanceof Pv?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Ku(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Rs(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(r=>Ku(r,e)):n._content)}const Td=We.define({combine:n=>n.join(" ")}),pb=We.define({combine:n=>n.indexOf(!0)>-1}),mb=Jl.newName(),cT=Jl.newName(),uT=Jl.newName(),fT={"&light":"."+cT,"&dark":"."+uT};function gb(n,e,t){return new Jl(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,r=>{if(r=="&")return n;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):n+" "+i}})}const WI=gb("."+mb,{"&":{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"},"&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":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"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"}},fT),XI={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Yy=Be.ie&&Be.ie_version<=11;class $I{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new k6,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Be.ie&&Be.ie_version<=11||Be.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Be.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Be.chrome&&Be.chrome_version<126)&&(this.editContext=new JI(e),e.state.facet(Ir)&&(e.contentDOM.editContext=this.editContext.editContext)),Yy&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!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((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,r=this.selectionRange;if(i.state.facet(Ir)?i.root.activeElement!=this.dom:!tf(this.dom,r))return;let o=r.anchorNode&&i.docView.tile.nearest(r.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Be.ie&&Be.ie_version<=11||Be.android&&Be.chrome)&&!i.state.selection.main.empty&&r.focusNode&&sf(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=gf(e.root);if(!t)return!1;let i=Be.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&ZI(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let r=tf(this.dom,i);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&E6(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.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,XI),Yy&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),Yy&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let r=()=>{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&cc(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.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 t=-1,i=-1,r=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(r=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:r}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),r=this.selectionChanged&&tf(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new mI(this.view,e,t,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,r=ZR(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!vp(this.view.state.selection,t.newSel.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=Nk(t,e.previousSibling||e.target.previousSibling,-1),r=Nk(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Ir)!=e.state.facet(Ir)&&(e.view.contentDOM.editContext=e.state.facet(Ir)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function Nk(n,e,t){for(;e;){let i=hn.get(e);if(i&&i.parent==n)return i;let r=e.parentNode;e=r!=n.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function Dk(n,e){let t=e.startContainer,i=e.startOffset,r=e.endContainer,o=e.endOffset,a=n.docView.domAtPos(n.state.selection.main.anchor,1);return sf(a.node,a.offset,r,o)&&([t,i,r,o]=[r,o,t,i]),{anchorNode:t,anchorOffset:i,focusNode:r,focusOffset:o}}function ZI(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return Dk(n,r)}let t=null;function i(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?Dk(n,t):null}class JI{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let r=e.state.selection.main,{anchor:o,head:a}=r,u=this.toEditorPos(i.updateRangeStart),f=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:u,drifted:!1});let d=f-u>i.text.length;u==this.from&&o<this.from?u=o:f==this.to&&o>this.to&&(f=o);let p=JR(e.state.sliceDoc(u,f),i.text,(d?r.from:r.to)-u,d?"end":null);if(!p){let b=Se.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));vp(b,r)||e.dispatch({selection:b,userEvent:"select"});return}let g={from:p.from+u,to:p.toA+u,insert:kt.of(i.text.slice(p.from,p.toB).split(`
|
|
208
|
+
`))};if((Be.mac||Be.android)&&g.from==a-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:u,to:f,insert:kt.of([i.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let b=this.to-this.from+(g.to-g.from+g.insert.length);zv(e,g,Se.single(this.toEditorPos(i.selectionStart,b),this.toEditorPos(i.selectionEnd,b)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from<g.to&&!g.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let r=[],o=null;for(let a=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);a<u;a++){let f=e.coordsForChar(a);o=f&&new DOMRect(f.left,f.top,f.right-f.left,f.bottom-f.top)||o||new DOMRect,r.push(o)}t.updateCharacterBounds(i.rangeStart,r)},this.handlers.textformatupdate=i=>{let r=[];for(let o of i.getTextFormats()){let a=o.underlineStyle,u=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(u)){let f=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(f<d){let p=`text-decoration: underline ${/^[a-z]/.test(a)?a+" ":a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${/thin/i.test(u)?1:2}px`;r.push(Gt.mark({attributes:{style:p}}).range(f,d))}}}e.dispatch({effects:UR.of(Gt.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let r=gf(i.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,r=this.pendingContextChange;return e.changes.iterChanges((o,a,u,f,d)=>{if(i)return;let p=d.length-(a-o);if(r&&a>=r.to)if(r.from==o&&r.to==a&&r.insert.eq(d)){r=this.pendingContextChange=null,t+=p,this.to+=p;return}else r=null,this.revertPending(e.state);if(o+=t,a+=t,a<=this.from)this.from+=p,this.to+=p;else if(o<this.to){if(o<this.from||a>this.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=p}t+=p}),r&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(i,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class et{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.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:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(r=>r.forEach(o=>i(o,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||A6(e.parent)||document,this.viewState=new Tk(this,e.state||wt.create(e)),e.scrollTo&&e.scrollTo.is(wd)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ec).map(r=>new Uy(r));for(let r of this.plugins)r.update(this);this.observer=new $I(this),this.inputState=new vI(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mk(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof zn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,r,o=this.state;for(let b of e){if(b.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=b.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,u=0,f=null;e.some(b=>b.annotation(rT))?(this.inputState.notifiedFocused=a,u=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,f=lT(o,a),f||(u=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(p=null)):this.observer.clear(),o.facet(wt.phrases)!=this.state.facet(wt.phrases))return this.setState(o);r=gp.create(this,o,e),r.flags|=u;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let b of e){if(g&&(g=g.map(b.changes)),b.scrollIntoView){let{main:v}=b.state.selection,{x:S,y:w}=this.state.facet(et.cursorScrollMargin);g=new uc(v.empty?v:Se.cursor(v.head,v.head>v.anchor?-1:1),"nearest","nearest",w,S)}for(let v of b.effects)v.is(wd)&&(g=v.value.clip(this.state))}this.viewState.update(r,g),this.bidiCache=Sp.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(Qu)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(b=>b.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(Td)!=r.state.facet(Td)&&(this.viewState.mustMeasureContent=!0),(t||i||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let b of this.state.facet(ub))try{b(r)}catch(v){nr(this.state,v,"update listener")}(f||p)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),p&&!ZR(this,p)&&d.force&&cc(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new Tk(this,e),this.plugins=e.facet(ec).map(i=>new Uy(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new mk(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(ec),i=e.state.facet(ec);if(t!=i){let r=[];for(let o of i){let a=t.indexOf(o);if(a<0)r.push(new Uy(o));else{let u=this.plugins[a];u.mustUpdate=e,r.push(u)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){nr(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:a}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let u=0;;u++){if(a<0)if(ER(i||this.win))o=-1,a=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(r);o=v.from,a=v.top}this.updateState=1;let f=this.viewState.measure();if(!f&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(u>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];f&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(v=>{try{return v.read(this)}catch(S){return nr(this.state,S),jk}}),g=gp.create(this,this.state,[]),b=!1;g.flags|=f,t?t.flags|=f:t=g,this.updateState=2,g.empty||(this.updatePlugins(g),this.inputState.update(g),this.updateAttrs(),b=this.docView.update(g),b&&this.docViewUpdate());for(let v=0;v<d.length;v++)if(p[v]!=jk)try{let S=d[v];S.write&&S.write(p[v],this)}catch(S){nr(this.state,S)}if(b&&this.docView.updateSelection(!0),!g.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let S=((o<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(o).top)-a)/this.scaleY;if((S>1||S<-1)&&!(Be.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r=r+S,i?i.scrollTop+=S:this.win.scrollBy(0,S),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let u of this.state.facet(ub))u(t)}get themeClasses(){return mb+" "+(this.state.facet(pb)?uT:cT)+" "+this.state.facet(Td)}updateAttrs(){let e=Bk(this,qR,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Ir)?"true":"false",class:"cm-content",style:`${Be.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Bk(this,Bv,t);let i=this.observer.ignore(()=>{let r=ck(this.contentDOM,this.contentAttrs,t),o=ck(this.dom,this.editorAttrs,e);return r||o});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let r of i.effects)if(r.is(et.announce)){t&&(this.announceDOM.textContent=""),t=!1;let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Qu);let e=this.state.facet(et.cspNonce);Jl.mount(this.root,this.styleModules.concat(WI).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return Qy(this,e,gk(this,e,t,i))}moveByGroup(e,t){return Qy(this,e,gk(this,e,t,i=>cI(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),r=this.textDirectionAt(e.from),o=i[t?i.length-1:0];return Se.cursor(o.side(t,r)+e.from,o.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,i=!0){return aI(this,e,t,i)}moveVertically(e,t,i){return Qy(this,e,uI(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=hb(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),hb(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),r=this.bidiSpans(i),o=r[tr.find(r,e-i.from,-1,t)];return this.docView.coordsAt(e,t,o.dir==xn.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(VR)||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>e8)return DR(e.length);let t=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||NR(o.isolates,i=hk(this,e))))return o.order;i||(i=hk(this,e));let r=j6(e.text,t,i);return this.bidiCache.push(new Sp(e.from,e.to,t,i,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Be.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{AR(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,t={}){var i,r,o,a;return wd.of(new uc(typeof e=="number"?Se.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(r=t.x)!==null&&r!==void 0?r:"nearest",(o=t.yMargin)!==null&&o!==void 0?o:5,(a=t.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return wd.of(new uc(Se.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return Ds.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return Ds.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Jl.newName(),r=[Td.of(i),Qu.of(gb(`.${i}`,e))];return t&&t.dark&&r.push(pb.of(!0)),r}static baseTheme(e){return Av.lowest(Qu.of(gb("."+mb,e,fT)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),r=i&&hn.get(i)||hn.get(e);return((t=r==null?void 0:r.root)===null||t===void 0?void 0:t.view)||null}}et.styleModule=Qu;et.inputHandler=PR;et.clipboardInputFilter=Dv;et.clipboardOutputFilter=jv;et.scrollHandler=_R;et.focusChangeEffect=HR;et.perLineTextDirection=VR;et.exceptionSink=IR;et.updateListener=ub;et.editable=Ir;et.mouseSelectionStyle=zR;et.dragMovesSelection=LR;et.clickAddsSelectionRange=BR;et.decorations=Jp;et.blockWrappers=FR;et.outerDecorations=Lv;et.atomicRanges=Uf;et.bidiIsolatedRanges=GR;et.cursorScrollMargin=We.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});et.scrollMargins=QR;et.darkTheme=pb;et.cspNonce=We.define({combine:n=>n.length?n[0]:""});et.contentAttributes=Bv;et.editorAttributes=qR;et.lineWrapping=et.contentAttributes.of({class:"cm-lineWrapping"});et.announce=vn.define();const e8=4096,jk={};class Sp{constructor(e,t,i,r,o,a){this.from=e,this.to=t,this.dir=i,this.isolates=r,this.fresh=o,this.order=a}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let i=[],r=e.length?e[e.length-1].dir:xn.LTR;for(let o=Math.max(0,e.length-10);o<e.length;o++){let a=e[o];a.dir==r&&!t.touchesRange(a.from,a.to)&&i.push(new Sp(t.mapPos(a.from,1),t.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return i}}function Bk(n,e,t){for(let i=n.state.facet(e),r=i.length-1;r>=0;r--){let o=i[r],a=typeof o=="function"?o(n):o;a&&Ov(a,t)}return t}const t8=Be.mac?"mac":Be.windows?"win":Be.linux?"linux":"key";function n8(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let r,o,a,u;for(let f=0;f<t.length-1;++f){const d=t[f];if(/^(cmd|meta|m)$/i.test(d))u=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))o=!0;else if(/^s(hift)?$/i.test(d))a=!0;else if(/^mod$/i.test(d))e=="mac"?u=!0:o=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(i="Alt-"+i),o&&(i="Ctrl-"+i),u&&(i="Meta-"+i),a&&(i="Shift-"+i),i}function Od(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const i8=Av.default(et.domEventHandlers({keydown(n,e){return o8(s8(e.state),n,e,"editor")}})),hT=We.define({enables:i8}),Lk=new WeakMap;function s8(n){let e=n.facet(hT),t=Lk.get(e);return t||Lk.set(e,t=l8(e.reduce((i,r)=>i.concat(r),[]))),t}let Ll=null;const r8=4e3;function l8(n,e=t8){let t=Object.create(null),i=Object.create(null),r=(a,u)=>{let f=i[a];if(f==null)i[a]=u;else if(f!=u)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,u,f,d,p)=>{var g,b;let v=t[a]||(t[a]=Object.create(null)),S=u.split(/ (?!$)/).map(k=>n8(k,e));for(let k=1;k<S.length;k++){let R=S.slice(0,k).join(" ");r(R,!0),v[R]||(v[R]={preventDefault:!0,stopPropagation:!1,run:[N=>{let T=Ll={view:N,prefix:R,scope:a};return setTimeout(()=>{Ll==T&&(Ll=null)},r8),!0}]})}let w=S.join(" ");r(w,!1);let E=v[w]||(v[w]={preventDefault:!1,stopPropagation:!1,run:((b=(g=v._any)===null||g===void 0?void 0:g.run)===null||b===void 0?void 0:b.slice())||[]});f&&E.run.push(f),d&&(E.preventDefault=!0),p&&(E.stopPropagation=!0)};for(let a of n){let u=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of u){let p=t[d]||(t[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=a;for(let b in p)p[b].run.push(v=>g(v,yb))}let f=a[e]||a.key;if(f)for(let d of u)o(d,f,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+f,a.shift,a.preventDefault,a.stopPropagation)}return t}let yb=null;function o8(n,e,t,i){yb=e;let r=b6(e),o=e6(r,0),a=t6(o)==r.length&&r!=" ",u="",f=!1,d=!1,p=!1;Ll&&Ll.view==t&&Ll.scope==i&&(u=Ll.prefix+" ",tT.indexOf(e.keyCode)<0&&(d=!0,Ll=null));let g=new Set,b=E=>{if(E){for(let k of E.run)if(!g.has(k)&&(g.add(k),k(t)))return E.stopPropagation&&(p=!0),!0;E.preventDefault&&(E.stopPropagation&&(p=!0),d=!0)}return!1},v=n[i],S,w;return v&&(b(v[u+Od(r,e,!a)])?f=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Be.windows&&e.ctrlKey&&e.altKey)&&!(Be.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(S=eo[e.keyCode])&&S!=r?(b(v[u+Od(S,e,!0)])||e.shiftKey&&(w=pf[e.keyCode])!=r&&w!=S&&b(v[u+Od(w,e,!1)]))&&(f=!0):a&&e.shiftKey&&b(v[u+Od(r,e,!0)])&&(f=!0),!f&&b(v._any)&&(f=!0)),d&&(f=!0),f&&p&&e.stopPropagation(),yb=null,f}function a8(){return u8}const c8=Gt.line({class:"cm-activeLine"}),u8=Ds.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let r=n.lineBlockAt(i.head);r.from>e&&(t.push(c8.range(r.from)),e=r.from)}return Gt.set(t)}},{decorations:n=>n.decorations});class f8 extends Hf{constructor(e){super(),this.content=e}toDOM(e){let t=document.createElement("span");return t.className="cm-placeholder",t.style.pointerEvents="none",t.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(e):this.content.cloneNode(!0)),t.setAttribute("aria-hidden","true"),t}coordsAt(e){let t=e.firstChild?nf(e.firstChild):[];if(!t.length)return null;let i=window.getComputedStyle(e.parentNode),r=yf(t[0],i.direction!="rtl"),o=parseInt(i.lineHeight);return r.bottom-r.top>o*1.5?{left:r.left,right:r.right,top:r.top,bottom:r.top+o}:r}ignoreEvent(){return!1}}function h8(n){let e=Ds.fromClass(class{constructor(t){this.view=t,this.placeholder=n?Gt.set([Gt.widget({widget:new f8(n),side:1}).range(0)]):Gt.none}get decorations(){return this.view.state.doc.length?Gt.none:this.placeholder}},{decorations:t=>t.decorations});return typeof n=="string"?[e,et.contentAttributes.of({"aria-placeholder":n})]:e}class oa extends ia{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}oa.prototype.elementClass="";oa.prototype.toDOM=void 0;oa.prototype.mapMode=Xi.TrackBefore;oa.prototype.startSide=oa.prototype.endSide=-1;oa.prototype.point=!0;const Wy=We.define(),d8=We.define(),Gd=We.define(),zk=We.define({combine:n=>n.some(e=>e)});function p8(n){return[m8]}const m8=Ds.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.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=n.state.facet(Gd).map(e=>new Pk(n,e)),this.fixed=!n.state.facet(zk);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),n.scrollDOM.insertBefore(this.dom,n.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(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.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(zk)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=Ct.iter(this.view.state.facet(Wy),this.view.viewport.from),i=[],r=this.gutters.map(o=>new g8(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(o.type)){let a=!0;for(let u of o.type)if(u.type==Di.Text&&a){bb(t,i,u.from);for(let f of r)f.line(this.view,u,i);a=!1}else if(u.widget)for(let f of r)f.widget(this.view,u)}else if(o.type==Di.Text){bb(t,i,o.from);for(let a of r)a.line(this.view,o,i)}else if(o.widget)for(let a of r)a.widget(this.view,o);for(let o of r)o.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Gd),t=n.state.facet(Gd),i=n.docChanged||n.heightChanged||n.viewportChanged||!Ct.eq(n.startState.facet(Wy),n.state.facet(Wy),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(n)&&(i=!0);else{i=!0;let r=[];for(let o of t){let a=e.indexOf(o);a<0?r.push(new Pk(this.view,o)):(this.gutters[a].update(n),r.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),r.indexOf(o)<0&&o.destroy();for(let o of r)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=r}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>et.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==xn.LTR?{left:i,right:r}:{right:i,left:r}})});function Ik(n){return Array.isArray(n)?n:[n]}function bb(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class g8{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=Ct.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:r}=this,o=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==r.elements.length){let u=new dT(e,a,o,i);r.elements.push(u),r.dom.appendChild(u.dom)}else r.elements[this.i].update(e,a,o,i);this.height=t.bottom,this.i++}line(e,t,i){let r=[];bb(this.cursor,r,t.from),i.length&&(r=r.concat(i));let o=this.gutter.config.lineMarker(e,t,r);o&&r.unshift(o);let a=this.gutter;r.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),r=i?[i]:null;for(let o of e.state.facet(d8)){let a=o(e,t.widget,t);a&&(r||(r=[])).push(a)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Pk{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,r=>{let o=r.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let f=o.getBoundingClientRect();a=(f.top+f.bottom)/2}else a=r.clientY;let u=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[i](e,u,r)&&r.preventDefault()});this.markers=Ik(t.markers(e)),t.initialSpacer&&(this.spacer=new dT(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Ik(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let i=e.view.viewport;return!Ct.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class dT{constructor(e,t,i,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,r)}update(e,t,i,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),y8(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let i="cm-gutterElement",r=this.dom.firstChild;for(let o=0,a=0;;){let u=a,f=o<t.length?t[o++]:null,d=!1;if(f){let p=f.elementClass;p&&(i+=" "+p);for(let g=a;g<this.markers.length;g++)if(this.markers[g].compare(f)){u=g,d=!0;break}}else u=this.markers.length;for(;a<u;){let p=this.markers[a++];if(p.toDOM){p.destroy(r);let g=r.nextSibling;r.remove(),r=g}}if(!f)break;f.toDOM&&(d?r=r.nextSibling:this.dom.insertBefore(f.toDOM(e),r)),d&&a++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}}function y8(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const b8=We.define(),v8=We.define(),tc=We.define({combine(n){return Ev(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let r in t){let o=i[r],a=t[r];i[r]=o?(u,f,d)=>o(u,f,d)||a(u,f,d):a}return i}})}});class Xy extends oa{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function $y(n,e){return n.state.facet(tc).formatNumber(e,n.state)}const x8=Gd.compute([tc],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(b8)},lineMarker(e,t,i){return i.some(r=>r.toDOM)?null:new Xy($y(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let r of e.state.facet(v8)){let o=r(e,t,i);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(tc)!=e.state.facet(tc),initialSpacer(e){return new Xy($y(e,Hk(e.state.doc.lines)))},updateSpacer(e,t){let i=$y(t.view,Hk(t.view.state.doc.lines));return i==e.number?e:new Xy(i)},domEventHandlers:n.facet(tc).domEventHandlers,side:"before"}));function S8(n={}){return[tc.of(n),p8(),x8]}function Hk(n){let e=9;for(;e<n;)e=e*10+9;return e}const pT=1024;let w8=0;class Zy{constructor(e,t){this.from=e,this.to=t}}class mt{constructor(e={}){this.id=w8++,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=zi.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}mt.closedBy=new mt({deserialize:n=>n.split(" ")});mt.openedBy=new mt({deserialize:n=>n.split(" ")});mt.group=new mt({deserialize:n=>n.split(" ")});mt.isolate=new mt({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});mt.contextHash=new mt({perNode:!0});mt.lookAhead=new mt({perNode:!0});mt.mounted=new mt({perNode:!0});class lf{constructor(e,t,i,r=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=r}static get(e){return e&&e.props&&e.props[mt.mounted.id]}}const C8=Object.create(null);class zi{constructor(e,t,i,r=0){this.name=e,this.props=t,this.id=i,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):C8,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new zi(e.name||"",t,e.id,i);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(r)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(mt.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let r of i.split(" "))t[r]=e[i];return i=>{for(let r=i.prop(mt.group),o=-1;o<(r?r.length:0);o++){let a=t[o<0?i.name:r[o]];if(a)return a}}}}zi.none=new zi("",Object.create(null),0,8);class Hv{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let r=null;for(let o of e){let a=o(i);if(a){r||(r=Object.assign({},i.props));let u=a[1],f=a[0];f.combine&&f.id in r&&(u=f.combine(r[f.id],u)),r[f.id]=u}}t.push(r?new zi(i.name,r,i.id,i.flags):i)}return new Hv(t)}}const Md=new WeakMap,Vk=new WeakMap;var fn;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(fn||(fn={}));class Sn{constructor(e,t,i,r,o){if(this.type=e,this.children=t,this.positions=i,this.length=r,this.props=null,o&&o.length){this.props=Object.create(null);for(let[a,u]of o)this.props[typeof a=="number"?a:a.id]=u}}toString(){let e=lf.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let r=i.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new xb(this.topNode,e)}cursorAt(e,t=0,i=0){let r=Md.get(this)||this.topNode,o=new xb(r);return o.moveTo(e,t),Md.set(this,o._tree),o}get topNode(){return new ms(this,0,0,null)}resolve(e,t=0){let i=vf(Md.get(this)||this.topNode,e,t,!1);return Md.set(this,i),i}resolveInner(e,t=0){let i=vf(Vk.get(this)||this.topNode,e,t,!0);return Vk.set(this,i),i}resolveStack(e,t=0){return E8(this,e,t)}iterate(e){let{enter:t,leave:i,from:r=0,to:o=this.length}=e,a=e.mode||0,u=(a&fn.IncludeAnonymous)>0;for(let f=this.cursor(a|fn.IncludeAnonymous);;){let d=!1;if(f.from<=o&&f.to>=r&&(!u&&f.type.isAnonymous||t(f)!==!1)){if(f.firstChild())continue;d=!0}for(;d&&i&&(u||!f.type.isAnonymous)&&i(f),!f.nextSibling();){if(!f.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Uv(zi.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,r)=>new Sn(this.type,t,i,r,this.propValues),e.makeTree||((t,i,r)=>new Sn(zi.none,t,i,r)))}static build(e){return R8(e)}}Sn.empty=new Sn(zi.none,[],[],0);class Vv{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new Vv(this.buffer,this.index)}}class no{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return zi.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],r=this.set.types[t],o=r.name;if(/\W/.test(o)&&!r.isError&&(o=JSON.stringify(o)),e+=4,i==e)return o;let a=[];for(;e<i;)a.push(this.childString(e)),e=this.buffer[e+3];return o+"("+a.join(",")+")"}findChild(e,t,i,r,o){let{buffer:a}=this,u=-1;for(let f=e;f!=t&&!(mT(o,r,a[f+1],a[f+2])&&(u=f,i>0));f=a[f+3]);return u}slice(e,t,i){let r=this.buffer,o=new Uint16Array(t-e),a=0;for(let u=e,f=0;u<t;){o[f++]=r[u++],o[f++]=r[u++]-i;let d=o[f++]=r[u++]-i;o[f++]=r[u++]-e,a=Math.max(a,d)}return new no(o,a,this.set)}}function mT(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function vf(n,e,t,i){for(var r;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let a=!i&&n instanceof ms&&n.index<0?null:n.parent;if(!a)return n;n=a}let o=i?0:fn.IgnoreOverlays;if(i)for(let a=n,u=a.parent;u;a=u,u=a.parent)a instanceof ms&&a.index<0&&((r=u.enter(e,t,o))===null||r===void 0?void 0:r.from)!=a.from&&(n=u);for(;;){let a=n.enter(e,t,o);if(!a)return n;n=a}}class gT{cursor(e=0){return new xb(this,e)}getChild(e,t=null,i=null){let r=_k(this,e,t,i);return r.length?r[0]:null}getChildren(e,t=null,i=null){return _k(this,e,t,i)}resolve(e,t=0){return vf(this,e,t,!1)}resolveInner(e,t=0){return vf(this,e,t,!0)}matchContext(e){return vb(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(i=t,t=r.prevSibling):t=r}return i}get node(){return this}get next(){return this.parent}}class ms extends gT{constructor(e,t,i,r){super(),this._tree=e,this.from=t,this.index=i,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,r,o=0){for(let a=this;;){for(let{children:u,positions:f}=a._tree,d=t>0?u.length:-1;e!=d;e+=t){let p=u[e],g=f[e]+a.from,b;if(!(!(o&fn.EnterBracketed&&p instanceof Sn&&(b=lf.get(p))&&!b.overlay&&b.bracketed&&i>=g&&i<=g+p.length)&&!mT(r,i,g,g+p.length))){if(p instanceof no){if(o&fn.ExcludeBuffers)continue;let v=p.findChild(0,p.buffer.length,t,i-g,r);if(v>-1)return new Kl(new k8(a,p,e,g),null,v)}else if(o&fn.IncludeAnonymous||!p.type.isAnonymous||_v(p)){let v;if(!(o&fn.IgnoreMounts)&&(v=lf.get(p))&&!v.overlay)return new ms(v.tree,g,e,a);let S=new ms(p,g,e,a);return o&fn.IncludeAnonymous||!S.type.isAnonymous?S:S.nextChild(t<0?p.children.length-1:0,t,i,r,o)}}}if(o&fn.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let r;if(!(i&fn.IgnoreOverlays)&&(r=lf.get(this._tree))&&r.overlay){let o=e-this.from,a=i&fn.EnterBracketed&&r.bracketed;for(let{from:u,to:f}of r.overlay)if((t>0||a?u<=o:u<o)&&(t<0||a?f>=o:f>o))return new ms(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 _k(n,e,t,i){let r=n.cursor(),o=[];if(!r.firstChild())return o;if(t!=null){for(let a=!1;!a;)if(a=r.type.is(t),!r.nextSibling())return o}for(;;){if(i!=null&&r.type.is(i))return o;if(r.type.is(e)&&o.push(r.node),!r.nextSibling())return i==null?o:[]}}function vb(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class k8{constructor(e,t,i,r){this.parent=e,this.buffer=t,this.index=i,this.start=r}}class Kl extends gT{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,i);return o<0?null:new Kl(this.context,this,o)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&fn.ExcludeBuffers)return null;let{buffer:r}=this.context,o=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Kl(this.context,this,o)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Kl(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Kl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,r=this.index+4,o=i.buffer[this.index+3];if(o>r){let a=i.buffer[this.index+1];e.push(i.slice(r,o,a)),t.push(0)}return new Sn(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function yT(n){if(!n.length)return null;let e=0,t=n[0];for(let o=1;o<n.length;o++){let a=n[o];(a.from>t.from||a.to<t.to)&&(t=a,e=o)}let i=t instanceof ms&&t.index<0?null:t.parent,r=n.slice();return i?r[e]=i:r.splice(e,1),new A8(r,t)}class A8{constructor(e,t){this.heads=e,this.node=t}get next(){return yT(this.heads)}}function E8(n,e,t){let i=n.resolveInner(e,t),r=null;for(let o=i instanceof ms?i:i.context.parent;o;o=o.parent)if(o.index<0){let a=o.parent;(r||(r=[i])).push(a.resolve(e,t)),o=a}else{let a=lf.get(o.tree);if(a&&a.overlay&&a.overlay[0].from<=e&&a.overlay[a.overlay.length-1].to>=e){let u=new ms(a.tree,a.overlay[0].from+o.from,-1,o);(r||(r=[i])).push(vf(u,e,t,!1))}}return r?yT(r):i}class xb{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~fn.EnterBracketed,e instanceof ms)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=i+r.buffer[e+1],this.to=i+r.buffer[e+2],!0}yield(e){return e?e instanceof ms?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:r}=this.buffer,o=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,i);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&fn.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&fn.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&fn.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let r=i<0?0:this.stack[i]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(r)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let o=0;o<this.index;o++)if(r.buffer.buffer[o+3]<this.index)return!1;({index:t,parent:i}=r)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let o=t+e,a=e<0?-1:i._tree.children.length;o!=a;o+=e){let u=i._tree.children[o];if(this.mode&fn.IncludeAnonymous||u instanceof no||!u.type.isAnonymous||_v(u))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let r=this.index,o=this.stack.length;o>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,i=o+1;break e}r=this.stack[--o]}for(let r=i;r<this.stack.length;r++)t=new Kl(this.buffer,t,this.stack[r]);return this.bufferNode=new Kl(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,r=!0}}}matchContext(e){if(!this.buffer)return vb(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let r=e.length-1,o=this.stack.length-1;r>=0;o--){if(o<0)return vb(this._tree,e,r);let a=i[t.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}}function _v(n){return n.children.some(e=>e instanceof no||!e.type.isAnonymous||_v(e))}function R8(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:r=pT,reused:o=[],minRepeatType:a=i.types.length}=n,u=Array.isArray(t)?new Vv(t,t.length):t,f=i.types,d=0,p=0;function g(B,L,D,j,X,J){let{id:V,start:K,end:ae,size:$}=u,H=p,z=d;if($<0)if(u.next(),$==-1){let M=o[V];D.push(M),j.push(K-B);return}else if($==-3){d=V;return}else if($==-4){p=V;return}else throw new RangeError(`Unrecognized record size: ${$}`);let Q=f[V],F,ee,G=K-B;if(ae-K<=r&&(ee=E(u.pos-L,X))){let M=new Uint16Array(ee.size-ee.skip),U=u.pos-ee.size,te=M.length;for(;u.pos>U;)te=k(ee.start,M,te);F=new no(M,ae-ee.start,i),G=ee.start-B}else{let M=u.pos-$;u.next();let U=[],te=[],le=V>=a?V:-1,ne=0,se=ae;for(;u.pos>M;)le>=0&&u.id==le&&u.size>=0?(u.end<=se-r&&(S(U,te,K,ne,u.end,se,le,H,z),ne=U.length,se=u.end),u.next()):J>2500?b(K,M,U,te):g(K,M,U,te,le,J+1);if(le>=0&&ne>0&&ne<U.length&&S(U,te,K,ne,K,se,le,H,z),U.reverse(),te.reverse(),le>-1&&ne>0){let he=v(Q,z);F=Uv(Q,U,te,0,U.length,0,ae-K,he,he)}else F=w(Q,U,te,ae-K,H-ae,z)}D.push(F),j.push(G)}function b(B,L,D,j){let X=[],J=0,V=-1;for(;u.pos>L;){let{id:K,start:ae,end:$,size:H}=u;if(H>4)u.next();else{if(V>-1&&ae<V)break;V<0&&(V=$-r),X.push(K,ae,$),J++,u.next()}}if(J){let K=new Uint16Array(J*4),ae=X[X.length-2];for(let $=X.length-3,H=0;$>=0;$-=3)K[H++]=X[$],K[H++]=X[$+1]-ae,K[H++]=X[$+2]-ae,K[H++]=H;D.push(new no(K,X[2]-ae,i)),j.push(ae-B)}}function v(B,L){return(D,j,X)=>{let J=0,V=D.length-1,K,ae;if(V>=0&&(K=D[V])instanceof Sn){if(!V&&K.type==B&&K.length==X)return K;(ae=K.prop(mt.lookAhead))&&(J=j[V]+K.length+ae)}return w(B,D,j,X,J,L)}}function S(B,L,D,j,X,J,V,K,ae){let $=[],H=[];for(;B.length>j;)$.push(B.pop()),H.push(L.pop()+D-X);B.push(w(i.types[V],$,H,J-X,K-J,ae)),L.push(X-D)}function w(B,L,D,j,X,J,V){if(J){let K=[mt.contextHash,J];V=V?[K].concat(V):[K]}if(X>25){let K=[mt.lookAhead,X];V=V?[K].concat(V):[K]}return new Sn(B,L,D,j,V)}function E(B,L){let D=u.fork(),j=0,X=0,J=0,V=D.end-r,K={size:0,start:0,skip:0};e:for(let ae=D.pos-B;D.pos>ae;){let $=D.size;if(D.id==L&&$>=0){K.size=j,K.start=X,K.skip=J,J+=4,j+=4,D.next();continue}let H=D.pos-$;if($<0||H<ae||D.start<V)break;let z=D.id>=a?4:0,Q=D.start;for(D.next();D.pos>H;){if(D.size<0)if(D.size==-3||D.size==-4)z+=4;else break e;else D.id>=a&&(z+=4);D.next()}X=Q,j+=$,J+=z}return(L<0||j==B)&&(K.size=j,K.start=X,K.skip=J),K.size>4?K:void 0}function k(B,L,D){let{id:j,start:X,end:J,size:V}=u;if(u.next(),V>=0&&j<a){let K=D;if(V>4){let ae=u.pos-(V-4);for(;u.pos>ae;)D=k(B,L,D)}L[--D]=K,L[--D]=J-B,L[--D]=X-B,L[--D]=j}else V==-3?d=j:V==-4&&(p=j);return D}let R=[],N=[];for(;u.pos>0;)g(n.start||0,n.bufferStart||0,R,N,-1,0);let T=(e=n.length)!==null&&e!==void 0?e:R.length?N[0]+R[0].length:0;return new Sn(f[n.topID],R.reverse(),N.reverse(),T)}const Uk=new WeakMap;function Qd(n,e){if(!n.isAnonymous||e instanceof no||e.type!=n)return 1;let t=Uk.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof Sn)){t=1;break}t+=Qd(n,i)}Uk.set(e,t)}return t}function Uv(n,e,t,i,r,o,a,u,f){let d=0;for(let S=i;S<r;S++)d+=Qd(n,e[S]);let p=Math.ceil(d*1.5/8),g=[],b=[];function v(S,w,E,k,R){for(let N=E;N<k;){let T=N,B=w[N],L=Qd(n,S[N]);for(N++;N<k;N++){let D=Qd(n,S[N]);if(L+D>=p)break;L+=D}if(N==T+1){if(L>p){let D=S[T];v(D.children,D.positions,0,D.children.length,w[T]+R);continue}g.push(S[T])}else{let D=w[N-1]+S[N-1].length-B;g.push(Uv(n,S,w,T,N,B,D,null,f))}b.push(B+R-o)}}return v(e,t,i,r,0),(u||f)(g,b,a)}class ea{constructor(e,t,i,r,o=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=r,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let r=[new ea(0,e.length,e,0,!1,i)];for(let o of t)o.to>e.length&&r.push(o);return r}static applyChanges(e,t,i=128){if(!t.length)return e;let r=[],o=1,a=e.length?e[0]:null;for(let u=0,f=0,d=0;;u++){let p=u<t.length?t[u]:null,g=p?p.fromA:1e9;if(g-f>=i)for(;a&&a.from<g;){let b=a;if(f>=b.from||g<=b.to||d){let v=Math.max(b.from,f)-d,S=Math.min(b.to,g)-d;b=v>=S?null:new ea(v,S,b.tree,b.offset+d,u>0,!!p)}if(b&&r.push(b),a.to>g)break;a=o<e.length?e[o++]:null}if(!p)break;f=p.toA,d=p.toA-p.toB}return r}}class bT{startParse(e,t,i){return typeof e=="string"&&(e=new T8(e)),i=i?i.length?i.map(r=>new Zy(r.from,r.to)):[new Zy(0,0)]:[new Zy(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let r=this.startParse(e,t,i);for(;;){let o=r.advance();if(o)return o}}}class T8{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new mt({perNode:!0});let O8=0;class fs{constructor(e,t,i,r){this.name=e,this.set=t,this.base=i,this.modified=r,this.id=O8++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof fs&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new fs(i,[],null,[]);if(r.set.push(r),t)for(let o of t.set)r.set.push(o);return r}static defineModifier(e){let t=new wp(e);return i=>i.modified.indexOf(t)>-1?i:wp.get(i.base||i,i.modified.concat(t).sort((r,o)=>r.id-o.id))}}let M8=0;class wp{constructor(e){this.name=e,this.instances=[],this.id=M8++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(u=>u.base==e&&N8(t,u.modified));if(i)return i;let r=[],o=new fs(e.name,r,e,t);for(let u of t)u.instances.push(o);let a=D8(t);for(let u of e.set)if(!u.modified.length)for(let f of a)r.push(wp.get(u,f));return o}}function N8(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function D8(n){let e=[[]];for(let t=0;t<n.length;t++)for(let i=0,r=e.length;i<r;i++)e.push(e[i].concat(n[t]));return e.sort((t,i)=>i.length-t.length)}function vT(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let r of t.split(" "))if(r){let o=[],a=2,u=r;for(let g=0;;){if(u=="..."&&g>0&&g+3==r.length){a=1;break}let b=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!b)throw new RangeError("Invalid path: "+r);if(o.push(b[0]=="*"?"":b[0][0]=='"'?JSON.parse(b[0]):b[0]),g+=b[0].length,g==r.length)break;let v=r[g++];if(g==r.length&&v=="!"){a=0;break}if(v!="/")throw new RangeError("Invalid path: "+r);u=r.slice(g)}let f=o.length-1,d=o[f];if(!d)throw new RangeError("Invalid path: "+r);let p=new xf(i,a,f>0?o.slice(0,f):null);e[d]=p.sort(e[d])}}return xT.add(e)}const xT=new mt({combine(n,e){let t,i,r;for(;n||e;){if(!n||e&&n.depth>=e.depth?(r=e,e=e.next):(r=n,n=n.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let o=new xf(r.tags,r.mode,r.context);t?t.next=o:i=o,t=o}return i}});class xf{constructor(e,t,i,r){this.tags=e,this.mode=t,this.context=i,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}xf.empty=new xf([],2,null);function ST(n,e){let t=Object.create(null);for(let o of n)if(!Array.isArray(o.tag))t[o.tag.id]=o.class;else for(let a of o.tag)t[a.id]=o.class;let{scope:i,all:r=null}=e||{};return{style:o=>{let a=r;for(let u of o)for(let f of u.set){let d=t[f.id];if(d){a=a?a+" "+d:d;break}}return a},scope:i}}function j8(n,e){let t=null;for(let i of n){let r=i.style(e);r&&(t=t?t+" "+r:r)}return t}function B8(n,e,t,i=0,r=n.length){let o=new L8(i,Array.isArray(e)?e:[e],t);o.highlightRange(n.cursor(),i,r,"",o.highlighters),o.flush(r)}class L8{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,r,o){let{type:a,from:u,to:f}=e;if(u>=i||f<=t)return;a.isTop&&(o=this.highlighters.filter(v=>!v.scope||v.scope(a)));let d=r,p=z8(e)||xf.empty,g=j8(o,p.tags);if(g&&(d&&(d+=" "),d+=g,p.mode==1&&(r+=(r?" ":"")+g)),this.startSpan(Math.max(t,u),d),p.opaque)return;let b=e.tree&&e.tree.prop(mt.mounted);if(b&&b.overlay){let v=e.node.enter(b.overlay[0].from+u,1),S=this.highlighters.filter(E=>!E.scope||E.scope(b.tree.type)),w=e.firstChild();for(let E=0,k=u;;E++){let R=E<b.overlay.length?b.overlay[E]:null,N=R?R.from+u:f,T=Math.max(t,k),B=Math.min(i,N);if(T<B&&w)for(;e.from<B&&(this.highlightRange(e,T,B,r,o),this.startSpan(Math.min(B,e.to),d),!(e.to>=N||!e.nextSibling())););if(!R||N>i)break;k=R.to+u,k>t&&(this.highlightRange(v.cursor(),Math.max(t,R.from+u),Math.min(i,k),"",S),this.startSpan(Math.min(i,k),d))}w&&e.parent()}else if(e.firstChild()){b&&(r="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,r,o),this.startSpan(Math.min(i,e.to),d)}while(e.nextSibling());e.parent()}}}function z8(n){let e=n.type.prop(xT);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const Oe=fs.define,Nd=Oe(),Ml=Oe(),qk=Oe(Ml),Fk=Oe(Ml),Nl=Oe(),Dd=Oe(Nl),Jy=Oe(Nl),Ys=Oe(),Bo=Oe(Ys),Qs=Oe(),Ks=Oe(),Sb=Oe(),Vu=Oe(Sb),jd=Oe(),Ee={comment:Nd,lineComment:Oe(Nd),blockComment:Oe(Nd),docComment:Oe(Nd),name:Ml,variableName:Oe(Ml),typeName:qk,tagName:Oe(qk),propertyName:Fk,attributeName:Oe(Fk),className:Oe(Ml),labelName:Oe(Ml),namespace:Oe(Ml),macroName:Oe(Ml),literal:Nl,string:Dd,docString:Oe(Dd),character:Oe(Dd),attributeValue:Oe(Dd),number:Jy,integer:Oe(Jy),float:Oe(Jy),bool:Oe(Nl),regexp:Oe(Nl),escape:Oe(Nl),color:Oe(Nl),url:Oe(Nl),keyword:Qs,self:Oe(Qs),null:Oe(Qs),atom:Oe(Qs),unit:Oe(Qs),modifier:Oe(Qs),operatorKeyword:Oe(Qs),controlKeyword:Oe(Qs),definitionKeyword:Oe(Qs),moduleKeyword:Oe(Qs),operator:Ks,derefOperator:Oe(Ks),arithmeticOperator:Oe(Ks),logicOperator:Oe(Ks),bitwiseOperator:Oe(Ks),compareOperator:Oe(Ks),updateOperator:Oe(Ks),definitionOperator:Oe(Ks),typeOperator:Oe(Ks),controlOperator:Oe(Ks),punctuation:Sb,separator:Oe(Sb),bracket:Vu,angleBracket:Oe(Vu),squareBracket:Oe(Vu),paren:Oe(Vu),brace:Oe(Vu),content:Ys,heading:Bo,heading1:Oe(Bo),heading2:Oe(Bo),heading3:Oe(Bo),heading4:Oe(Bo),heading5:Oe(Bo),heading6:Oe(Bo),contentSeparator:Oe(Ys),list:Oe(Ys),quote:Oe(Ys),emphasis:Oe(Ys),strong:Oe(Ys),link:Oe(Ys),monospace:Oe(Ys),strikethrough:Oe(Ys),inserted:Oe(),deleted:Oe(),changed:Oe(),invalid:Oe(),meta:jd,documentMeta:Oe(jd),annotation:Oe(jd),processingInstruction:Oe(jd),definition:fs.defineModifier("definition"),constant:fs.defineModifier("constant"),function:fs.defineModifier("function"),standard:fs.defineModifier("standard"),local:fs.defineModifier("local"),special:fs.defineModifier("special")};for(let n in Ee){let e=Ee[n];e instanceof fs&&(e.name=n)}ST([{tag:Ee.link,class:"tok-link"},{tag:Ee.heading,class:"tok-heading"},{tag:Ee.emphasis,class:"tok-emphasis"},{tag:Ee.strong,class:"tok-strong"},{tag:Ee.keyword,class:"tok-keyword"},{tag:Ee.atom,class:"tok-atom"},{tag:Ee.bool,class:"tok-bool"},{tag:Ee.url,class:"tok-url"},{tag:Ee.labelName,class:"tok-labelName"},{tag:Ee.inserted,class:"tok-inserted"},{tag:Ee.deleted,class:"tok-deleted"},{tag:Ee.literal,class:"tok-literal"},{tag:Ee.string,class:"tok-string"},{tag:Ee.number,class:"tok-number"},{tag:[Ee.regexp,Ee.escape,Ee.special(Ee.string)],class:"tok-string2"},{tag:Ee.variableName,class:"tok-variableName"},{tag:Ee.local(Ee.variableName),class:"tok-variableName tok-local"},{tag:Ee.definition(Ee.variableName),class:"tok-variableName tok-definition"},{tag:Ee.special(Ee.variableName),class:"tok-variableName2"},{tag:Ee.definition(Ee.propertyName),class:"tok-propertyName tok-definition"},{tag:Ee.typeName,class:"tok-typeName"},{tag:Ee.namespace,class:"tok-namespace"},{tag:Ee.className,class:"tok-className"},{tag:Ee.macroName,class:"tok-macroName"},{tag:Ee.propertyName,class:"tok-propertyName"},{tag:Ee.operator,class:"tok-operator"},{tag:Ee.comment,class:"tok-comment"},{tag:Ee.meta,class:"tok-meta"},{tag:Ee.invalid,class:"tok-invalid"},{tag:Ee.punctuation,class:"tok-punctuation"}]);var e0;const nc=new mt;function I8(n){return We.define({combine:n?e=>e.concat(n):void 0})}const P8=new mt;class Os{constructor(e,t,i=[],r=""){this.data=e,this.name=r,wt.prototype.hasOwnProperty("tree")||Object.defineProperty(wt.prototype,"tree",{get(){return ar(this)}}),this.parser=t,this.extension=[Lc.of(this),wt.languageData.of((o,a,u)=>{let f=Gk(o,a,u),d=f.type.prop(nc);if(!d)return[];let p=o.facet(d),g=f.type.prop(P8);if(g){let b=f.resolve(a-f.from,u);for(let v of g)if(v.test(b,o)){let S=o.facet(v.facet);return v.type=="replace"?S:S.concat(p)}}return p})].concat(i)}isActiveAt(e,t,i=-1){return Gk(e,t,i).type.prop(nc)==this.data}findRegions(e){let t=e.facet(Lc);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],r=(o,a)=>{if(o.prop(nc)==this.data){i.push({from:a,to:a+o.length});return}let u=o.prop(mt.mounted);if(u){if(u.tree.prop(nc)==this.data){if(u.overlay)for(let f of u.overlay)i.push({from:f.from+a,to:f.to+a});else i.push({from:a,to:a+o.length});return}else if(u.overlay){let f=i.length;if(r(u.tree,u.overlay[0].from+a),i.length>f)return}}for(let f=0;f<o.children.length;f++){let d=o.children[f];d instanceof Sn&&r(d,o.positions[f]+a)}};return r(ar(e),0),i}get allowsNesting(){return!0}}Os.setState=vn.define();function Gk(n,e,t){let i=n.facet(Lc),r=ar(n).topNode;if(!i||i.allowsNesting)for(let o=r;o;o=o.enter(e,t,fn.ExcludeBuffers|fn.EnterBracketed))o.type.isTop&&(r=o);return r}class Cp extends Os{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=I8(e.languageData);return new Cp(t,e.parser.configure({props:[nc.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new Cp(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function ar(n){let e=n.field(Os.state,!1);return e?e.tree:Sn.empty}class H8{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let _u=null;class kp{constructor(e,t,i=[],r,o,a,u,f){this.parser=e,this.state=t,this.fragments=i,this.tree=r,this.treeLen=o,this.viewport=a,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new kp(e,t,[],Sn.empty,0,i,[],null)}startParse(){return this.parser.startParse(new H8(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Sn.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(ea.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(ea.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=_u;_u=this;try{return e()}finally{_u=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Qk(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:r,treeLen:o,viewport:a,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((d,p,g,b)=>f.push({fromA:d,toA:p,fromB:g,toB:b})),i=ea.applyChanges(i,f),r=Sn.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){u=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);p<g&&u.push({from:p,to:g})}}}return new kp(this.parser,t,i,r,o,a,u,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:r,to:o}=this.skipped[i];r<e.to&&o>e.from&&(this.fragments=Qk(this.fragments,r,o),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends bT{createParse(t,i,r){let o=r[0].from,a=r[r.length-1].to;return{parsedPos:o,advance(){let f=_u;if(f){for(let d of r)f.tempSkipped.push(d);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=a,new Sn(zi.none,[],[],a-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return _u}}function Qk(n,e,t){return ea.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Bc{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Bc(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=kp.create(e.facet(Lc).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Bc(i)}}Os.state=uo.define({create:Bc.init,update(n,e){for(let t of e.effects)if(t.is(Os.setState))return t.value;return e.startState.facet(Lc)!=e.state.facet(Lc)?Bc.init(e.state):n.apply(e)}});let wT=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(wT=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const t0=typeof navigator<"u"&&(!((e0=navigator.scheduling)===null||e0===void 0)&&e0.isInputPending)?()=>navigator.scheduling.isInputPending():null,V8=Ds.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(Os.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(Os.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=wT(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:r}}=this.view,o=i.field(Os.state);if(o.tree==o.context.tree&&o.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!t0?Math.max(25,e.timeRemaining()-5):1e9),u=o.context.treeLen<r&&i.doc.length>r+1e3,f=o.context.work(()=>t0&&t0()||Date.now()>a,r+(u?0:1e5));this.chunkBudget-=Date.now()-t,(f||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:Os.setState.of(new Bc(o.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>nr(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Lc=We.define({combine(n){return n.length?n[0]:null},enables:n=>[Os.state,V8,et.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class _8{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const U8=We.define(),qv=We.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Ap(n){let e=n.facet(qv);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function Sf(n,e){let t="",i=n.tabSize,r=n.facet(qv)[0];if(r==" "){for(;e>=i;)t+=" ",e-=i;r=" "}for(let o=0;o<e;o++)t+=r;return t}function Fv(n,e){n instanceof wt&&(n=new im(n));for(let i of n.state.facet(U8)){let r=i(n,e);if(r!==void 0)return r}let t=ar(n.state);return t.length>=e?q8(n,t,e):null}class im{constructor(e,t={}){this.state=e,this.options=t,this.unit=Ap(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:o}=this.options;return r!=null&&r>=i.from&&r<=i.to?o&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:i.text.slice(r-i.from),from:r}:{text:i.text.slice(0,r-i.from),from:i.from}:i}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:r}=this.lineAt(e,t);return i.slice(e-r,Math.min(i.length,e+100-r))}column(e,t=1){let{text:i,from:r}=this.lineAt(e,t),o=this.countColumn(i,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(o+=a-this.countColumn(i,i.search(/\S|$/))),o}countColumn(e,t=e.length){return $p(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:r}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let a=o(r);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const CT=new mt;function q8(n,e,t){let i=e.resolveStack(t),r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=i.node){let o=[];for(let a=r;a&&!(a.from<i.node.from||a.to>i.node.to||a.from==i.node.from&&a.type==i.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)i={node:o[a],next:i}}return kT(i,n,t)}function kT(n,e,t){for(let i=n;i;i=i.next){let r=G8(i.node);if(r)return r(Gv.create(e,t,i))}return 0}function F8(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function G8(n){let e=n.type.prop(CT);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(mt.closedBy))){let r=n.lastChild,o=r&&i.indexOf(r.name)>-1;return a=>W8(a,!0,1,void 0,o&&!F8(a)?r.from:void 0)}return n.parent==null?Q8:null}function Q8(){return 0}class Gv extends im{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Gv(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(K8(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return kT(this.context.next,this.base,this.pos)}}function K8(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function Y8(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let r=n.options.simulateBreak,o=n.state.doc.lineAt(t.from),a=r==null||r<=o.from?o.to:Math.min(o.to,r);for(let u=t.to;;){let f=e.childAfter(u);if(!f||f==i)return null;if(!f.type.isSkipped){if(f.from>=a)return null;let d=/^ */.exec(o.text.slice(t.to-o.from))[0].length;return{from:t.from,to:t.to+d}}u=f.to}}function W8(n,e,t,i,r){let o=n.textAfter,a=o.match(/^\s*/)[0].length,u=i&&o.slice(a,a+i.length)==i||r==n.pos+a,f=Y8(n);return f?u?n.column(f.from):n.column(f.to):n.baseIndent+(u?0:n.unit*t)}function Kk({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const X8=200;function $8(){return wt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,r=t.lineAt(i);if(i>r.from+X8)return n;let o=t.sliceString(r.from,i);if(!e.some(d=>d.test(o)))return n;let{state:a}=n,u=-1,f=[];for(let{head:d}of a.selection.ranges){let p=a.doc.lineAt(d);if(p.from==u)continue;u=p.from;let g=Fv(a,p.from);if(g==null)continue;let b=/^\s*/.exec(p.text)[0],v=Sf(a,g);b!=v&&f.push({from:p.from,to:p.from+b.length,insert:v})}return f.length?[n,{changes:f,sequential:!0}]:n})}const Z8=new mt;function J8(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}class sm{constructor(e,t){this.specs=e;let i;function r(u){let f=Jl.newName();return(i||(i=Object.create(null)))["."+f]=u,f}const o=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof Os?u=>u.prop(nc)==a.data:a?u=>u==a:void 0,this.style=ST(e.map(u=>({tag:u.tag,class:u.class||r(Object.assign({},u,{tag:null}))})),{all:o}).style,this.module=i?new Jl(i):null,this.themeType=t.themeType}static define(e,t){return new sm(e,t||{})}}const wb=We.define(),AT=We.define({combine(n){return n.length?[n[0]]:null}});function n0(n){let e=n.facet(wb);return e.length?e:n.facet(AT)}function eP(n,e){let t=[nP],i;return n instanceof sm&&(n.module&&t.push(et.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(AT.of(n)):i?t.push(wb.computeN([et.darkTheme],r=>r.facet(et.darkTheme)==(i=="dark")?[n]:[])):t.push(wb.of(n)),t}class tP{constructor(e){this.markCache=Object.create(null),this.tree=ar(e.state),this.decorations=this.buildDeco(e,n0(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=ar(e.state),i=n0(e.state),r=i!=n0(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<o.to&&!r&&t.type==this.tree.type&&a>=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return Gt.none;let i=new hf;for(let{from:r,to:o}of e.visibleRanges)B8(this.tree,t,(a,u,f)=>{i.add(a,u,this.markCache[f]||(this.markCache[f]=Gt.mark({class:f})))},r,o);return i.finish()}}const nP=Av.high(Ds.fromClass(tP,{decorations:n=>n.decorations})),iP=sm.define([{tag:Ee.meta,color:"#404740"},{tag:Ee.link,textDecoration:"underline"},{tag:Ee.heading,textDecoration:"underline",fontWeight:"bold"},{tag:Ee.emphasis,fontStyle:"italic"},{tag:Ee.strong,fontWeight:"bold"},{tag:Ee.strikethrough,textDecoration:"line-through"},{tag:Ee.keyword,color:"#708"},{tag:[Ee.atom,Ee.bool,Ee.url,Ee.contentSeparator,Ee.labelName],color:"#219"},{tag:[Ee.literal,Ee.inserted],color:"#164"},{tag:[Ee.string,Ee.deleted],color:"#a11"},{tag:[Ee.regexp,Ee.escape,Ee.special(Ee.string)],color:"#e40"},{tag:Ee.definition(Ee.variableName),color:"#00f"},{tag:Ee.local(Ee.variableName),color:"#30a"},{tag:[Ee.typeName,Ee.namespace],color:"#085"},{tag:Ee.className,color:"#167"},{tag:[Ee.special(Ee.variableName),Ee.macroName],color:"#256"},{tag:Ee.definition(Ee.propertyName),color:"#00c"},{tag:Ee.comment,color:"#940"},{tag:Ee.invalid,color:"#f00"}]),sP=et.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),ET=1e4,RT="()[]{}",TT=We.define({combine(n){return Ev(n,{afterCursor:!0,brackets:RT,maxScanDistance:ET,renderMatch:oP})}}),rP=Gt.mark({class:"cm-matchingBracket"}),lP=Gt.mark({class:"cm-nonmatchingBracket"});function oP(n){let e=[],t=n.matched?rP:lP;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function Yk(n){let e=[],t=n.facet(TT);for(let i of n.selection.ranges){if(!i.empty)continue;let r=ir(n,i.head,-1,t)||i.head>0&&ir(n,i.head-1,1,t)||t.afterCursor&&(ir(n,i.head,1,t)||i.head<n.doc.length&&ir(n,i.head+1,-1,t));r&&(e=e.concat(t.renderMatch(r,n)))}return Gt.set(e,!0)}const aP=Ds.fromClass(class{constructor(n){this.paused=!1,this.decorations=Yk(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=Yk(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),cP=[aP,sP];function uP(n={}){return[TT.of(n),cP]}const fP=new mt;function Cb(n,e,t){let i=n.prop(e<0?mt.openedBy:mt.closedBy);if(i)return i;if(n.name.length==1){let r=t.indexOf(n.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function kb(n){let e=n.type.prop(fP);return e?e(n.node):n}function ir(n,e,t,i={}){let r=i.maxScanDistance||ET,o=i.brackets||RT,a=ar(n),u=a.resolveInner(e,t);for(let f=u;f;f=f.parent){let d=Cb(f.type,t,o);if(d&&f.from<f.to){let p=kb(f);if(p&&(t>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return hP(n,e,t,f,p,d,o)}}return dP(n,e,t,a,u.type,r,o)}function hP(n,e,t,i,r,o,a){let u=i.parent,f={from:r.from,to:r.to},d=0,p=u==null?void 0:u.cursor();if(p&&(t<0?p.childBefore(i.from):p.childAfter(i.to)))do if(t<0?p.to<=i.from:p.from>=i.to){if(d==0&&o.indexOf(p.type.name)>-1&&p.from<p.to){let g=kb(p);return{start:f,end:g?{from:g.from,to:g.to}:void 0,matched:!0}}else if(Cb(p.type,t,a))d++;else if(Cb(p.type,-t,a)){if(d==0){let g=kb(p);return{start:f,end:g&&g.from<g.to?{from:g.from,to:g.to}:void 0,matched:!1}}d--}}while(t<0?p.prevSibling():p.nextSibling());return{start:f,matched:!1}}function dP(n,e,t,i,r,o,a){if(t<0?!e:e==n.doc.length)return null;let u=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),f=a.indexOf(u);if(f<0||f%2==0!=t>0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},p=n.doc.iterRange(e,t>0?n.doc.length:0),g=0;for(let b=0;!p.next().done&&b<=o;){let v=p.value;t<0&&(b+=v.length);let S=e+b*t;for(let w=t>0?0:v.length-1,E=t>0?v.length:-1;w!=E;w+=t){let k=a.indexOf(v[w]);if(!(k<0||i.resolveInner(S+w,1).type!=r))if(k%2==0==t>0)g++;else{if(g==1)return{start:d,end:{from:S+w,to:S+w+1},matched:k>>1==f>>1};g--}}t>0&&(b+=v.length)}return p.done?{start:d,matched:!1}:null}const pP=Object.create(null),Wk=[zi.none],Xk=[],$k=Object.create(null),mP=Object.create(null);for(let[n,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"]])mP[n]=gP(pP,e);function i0(n,e){Xk.indexOf(n)>-1||(Xk.push(n),console.warn(e))}function gP(n,e){let t=[];for(let u of e.split(" ")){let f=[];for(let d of u.split(".")){let p=n[d]||Ee[d];p?typeof p=="function"?f.length?f=f.map(p):i0(d,`Modifier ${d} used at start of tag`):f.length?i0(d,`Tag ${d} used as modifier`):f=Array.isArray(p)?p:[p]:i0(d,`Unknown highlighting tag ${d}`)}for(let d of f)t.push(d)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),r=i+" "+t.map(u=>u.id),o=$k[r];if(o)return o.id;let a=$k[r]=zi.define({id:Wk.length,name:i,props:[vT({[i]:t})]});return Wk.push(a),a.id}xn.RTL,xn.LTR;const yP=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Kv(n.state,t.from);return i.line?bP(n):i.block?xP(n):!1};function Qv(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let r=n(e,t);return r?(i(t.update(r)),!0):!1}}const bP=Qv(CP,0),vP=Qv(OT,0),xP=Qv((n,e)=>OT(n,e,wP(e)),0);function Kv(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Uu=50;function SP(n,{open:e,close:t},i,r){let o=n.sliceDoc(i-Uu,i),a=n.sliceDoc(r,r+Uu),u=/\s*$/.exec(o)[0].length,f=/^\s*/.exec(a)[0].length,d=o.length-u;if(o.slice(d-e.length,d)==e&&a.slice(f,f+t.length)==t)return{open:{pos:i-u,margin:u&&1},close:{pos:r+f,margin:f&&1}};let p,g;r-i<=2*Uu?p=g=n.sliceDoc(i,r):(p=n.sliceDoc(i,i+Uu),g=n.sliceDoc(r-Uu,r));let b=/^\s*/.exec(p)[0].length,v=/\s*$/.exec(g)[0].length,S=g.length-v-t.length;return p.slice(b,b+e.length)==e&&g.slice(S,S+t.length)==t?{open:{pos:i+b+e.length,margin:/\s/.test(p.charAt(b+e.length))?1:0},close:{pos:r-v-t.length,margin:/\s/.test(g.charAt(S-1))?1:0}}:null}function wP(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),r=t.to<=i.to?i:n.doc.lineAt(t.to);r.from>i.from&&r.from==t.to&&(r=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let o=e.length-1;o>=0&&e[o].to>i.from?e[o].to=r.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:r.to})}return e}function OT(n,e,t=e.selection.ranges){let i=t.map(o=>Kv(e,o.from).block);if(!i.every(o=>o))return null;let r=t.map((o,a)=>SP(e,i[a],o.from,o.to));if(n!=2&&!r.every(o=>o))return{changes:e.changes(t.map((o,a)=>r[a]?[]:[{from:o.from,insert:i[a].open+" "},{from:o.to,insert:" "+i[a].close}]))};if(n!=1&&r.some(o=>o)){let o=[];for(let a=0,u;a<r.length;a++)if(u=r[a]){let f=i[a],{open:d,close:p}=u;o.push({from:d.pos-f.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+f.close.length})}return{changes:o}}return null}function CP(n,e,t=e.selection.ranges){let i=[],r=-1;e:for(let{from:o,to:a}of t){let u=i.length,f=1e9,d;for(let p=o;p<=a;){let g=e.doc.lineAt(p);if(d==null&&(d=Kv(e,g.from).line,!d))continue e;if(g.from>r&&(o==a||a>g.from)){r=g.from;let b=/^\s*/.exec(g.text)[0].length,v=b==g.length,S=g.text.slice(b,b+d.length)==d?b:-1;b<g.text.length&&b<f&&(f=b),i.push({line:g,comment:S,token:d,indent:b,empty:v,single:!1})}p=g.to+1}if(f<1e9)for(let p=u;p<i.length;p++)i[p].indent<i[p].line.text.length&&(i[p].indent=f);i.length==u+1&&(i[u].single=!0)}if(n!=2&&i.some(o=>o.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:u,token:f,indent:d,empty:p,single:g}of i)(g||!p)&&o.push({from:u.from+d,insert:f+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(n!=1&&i.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:u,token:f}of i)if(u>=0){let d=a.from+u,p=d+f.length;a.text[p-a.from]==" "&&p++,o.push({from:d,to:p})}return{changes:o}}return null}const Ab=fo.define(),kP=fo.define(),AP=We.define(),MT=We.define({combine(n){return Ev(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,r)=>e(i,r)||t(i,r)})}}),NT=uo.define({create(){return sr.empty},update(n,e){let t=e.state.facet(MT),i=e.annotation(Ab);if(i){let f=Ni.fromTransaction(e,i.selection),d=i.side,p=d==0?n.undone:n.done;return f?p=Ep(p,p.length,t.minDepth,f):p=BT(p,e.startState.selection),new sr(d==0?i.rest:p,d==0?p:i.rest)}let r=e.annotation(kP);if((r=="full"||r=="before")&&(n=n.isolate()),e.annotation(zn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let o=Ni.fromTransaction(e),a=e.annotation(zn.time),u=e.annotation(zn.userEvent);return o?n=n.addChanges(o,a,u,t,e):e.selection&&(n=n.addSelection(e.startState.selection,a,u,t.newGroupDelay)),(r=="full"||r=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new sr(n.done.map(Ni.fromJSON),n.undone.map(Ni.fromJSON))}});function EP(n={}){return[NT,MT.of(n),et.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?DT:e.inputType=="historyRedo"?Eb:null;return i?(e.preventDefault(),i(t)):!1}})]}function rm(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let r=t.field(NT,!1);if(!r)return!1;let o=r.pop(n,t,e);return o?(i(o),!0):!1}}const DT=rm(0,!1),Eb=rm(1,!1),RP=rm(0,!0),TP=rm(1,!0);class Ni{constructor(e,t,i,r,o){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=r,this.selectionsAfter=o}setSelAfter(e){return new Ni(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new Ni(e.changes&&jn.fromJSON(e.changes),[],e.mapped&&or.fromJSON(e.mapped),e.startSelection&&Se.fromJSON(e.startSelection),e.selectionsAfter.map(Se.fromJSON))}static fromTransaction(e,t){let i=ps;for(let r of e.startState.facet(AP)){let o=r(e);o.length&&(i=i.concat(o))}return!i.length&&e.changes.empty?null:new Ni(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,ps)}static selection(e){return new Ni(void 0,ps,void 0,void 0,e)}}function Ep(n,e,t,i){let r=e+1>t+20?e-t-1:0,o=n.slice(r,e);return o.push(i),o}function OP(n,e){let t=[],i=!1;return n.iterChangedRanges((r,o)=>t.push(r,o)),e.iterChangedRanges((r,o,a,u)=>{for(let f=0;f<t.length;){let d=t[f++],p=t[f++];u>=d&&a<=p&&(i=!0)}}),i}function MP(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function jT(n,e){return n.length?e.length?n.concat(e):n:e}const ps=[],NP=200;function BT(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-NP));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Ep(n,n.length-1,1e9,t.setSelAfter(i)))}else return[Ni.selection([e])]}function DP(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function s0(n,e){if(!n.length)return n;let t=n.length,i=ps;for(;t;){let r=jP(n[t-1],e,i);if(r.changes&&!r.changes.empty||r.effects.length){let o=n.slice(0,t);return o[t-1]=r,o}else e=r.mapped,t--,i=r.selectionsAfter}return i.length?[Ni.selection(i)]:ps}function jP(n,e,t){let i=jT(n.selectionsAfter.length?n.selectionsAfter.map(u=>u.map(e)):ps,t);if(!n.changes)return Ni.selection(i);let r=n.changes.map(e),o=e.mapDesc(n.changes,!0),a=n.mapped?n.mapped.composeDesc(o):o;return new Ni(r,vn.mapEffects(n.effects,e),a,n.startSelection.map(o),i)}const BP=/^(input\.type|delete)($|\.)/;class sr{constructor(e,t,i=0,r=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=r}isolate(){return this.prevTime?new sr(this.done,this.undone):this}addChanges(e,t,i,r,o){let a=this.done,u=a[a.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!i||BP.test(i))&&(!u.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,OP(u.changes,e.changes))||i=="input.type.compose")?a=Ep(a,a.length-1,r.minDepth,new Ni(e.changes.compose(u.changes),jT(vn.mapEffects(e.effects,u.changes),u.effects),u.mapped,u.startSelection,ps)):a=Ep(a,a.length,r.minDepth,e),new sr(a,ps,t,i)}addSelection(e,t,i,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:ps;return o.length>0&&t-this.prevTime<r&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&MP(o[o.length-1],e)?this:new sr(BT(this.done,e),this.undone,t,i)}addMapping(e){return new sr(s0(this.done,e),s0(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],a=o.selectionsAfter[0]||(o.startSelection?o.startSelection.map(o.changes.invertedDesc,1):t.selection);if(i&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:Ab.of({side:e,rest:DP(r),selection:a}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(o.changes){let u=r.length==1?ps:r.slice(0,r.length-1);return o.mapped&&(u=s0(u,o.mapped)),t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:Ab.of({side:e,rest:u,selection:a}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}sr.empty=new sr(ps,ps);const LP=[{key:"Mod-z",run:DT,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Eb,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Eb,preventDefault:!0},{key:"Mod-u",run:RP,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:TP,preventDefault:!0}];function _c(n,e){return Se.create(n.ranges.map(e),n.mainIndex)}function Bs(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function Ls({state:n,dispatch:e},t){let i=_c(n.selection,t);return i.eq(n.selection,!0)?!1:(e(Bs(n,i)),!0)}function lm(n,e){return Se.cursor(e?n.to:n.from)}function LT(n,e){return Ls(n,t=>t.empty?n.moveByChar(t,e):lm(t,e))}function li(n){return n.textDirectionAt(n.state.selection.main.head)==xn.LTR}const zT=n=>LT(n,!li(n)),IT=n=>LT(n,li(n));function PT(n,e){return Ls(n,t=>t.empty?n.moveByGroup(t,e):lm(t,e))}const zP=n=>PT(n,!li(n)),IP=n=>PT(n,li(n));function PP(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function om(n,e,t){let i=ar(n).resolveInner(e.head),r=t?mt.closedBy:mt.openedBy;for(let f=e.head;;){let d=t?i.childAfter(f):i.childBefore(f);if(!d)break;PP(n,d,r)?i=d:f=t?d.to:d.from}let o=i.type.prop(r),a,u;return o&&(a=t?ir(n,i.from,1):ir(n,i.to,-1))&&a.matched?u=t?a.end.to:a.end.from:u=t?i.to:i.from,Se.cursor(u,t?-1:1)}const HP=n=>Ls(n,e=>om(n.state,e,!li(n))),VP=n=>Ls(n,e=>om(n.state,e,li(n)));function HT(n,e){return Ls(n,t=>{if(!t.empty)return lm(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const VT=n=>HT(n,!1),_T=n=>HT(n,!0);function UT(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,i=0,r;if(e){for(let o of n.state.facet(et.scrollMargins)){let a=o(n);a!=null&&a.top&&(t=Math.max(a==null?void 0:a.top,t)),a!=null&&a.bottom&&(i=Math.max(a==null?void 0:a.bottom,i))}r=n.scrollDOM.clientHeight-t-i}else r=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:i,selfScroll:e,height:Math.max(n.defaultLineHeight,r-5)}}function qT(n,e){let t=UT(n),{state:i}=n,r=_c(i.selection,a=>a.empty?n.moveVertically(a,e,t.height):lm(a,e));if(r.eq(i.selection))return!1;let o;if(t.selfScroll){let a=n.coordsAtPos(i.selection.main.head),u=n.scrollDOM.getBoundingClientRect(),f=u.top+t.marginTop,d=u.bottom-t.marginBottom;a&&a.top>f&&a.bottom<d&&(o=et.scrollIntoView(r.main.head,{y:"start",yMargin:a.top-f}))}return n.dispatch(Bs(i,r),{effects:o}),!0}const Zk=n=>qT(n,!1),Rb=n=>qT(n,!0);function ho(n,e,t){let i=n.lineBlockAt(e.head),r=n.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?i.to:i.from)&&(r=n.moveToLineBoundary(e,t,!1)),!t&&r.head==i.from&&i.length){let o=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&e.head!=i.from+o&&(r=Se.cursor(i.from+o))}return r}const _P=n=>Ls(n,e=>ho(n,e,!0)),UP=n=>Ls(n,e=>ho(n,e,!1)),qP=n=>Ls(n,e=>ho(n,e,!li(n))),FP=n=>Ls(n,e=>ho(n,e,li(n))),GP=n=>Ls(n,e=>Se.cursor(n.lineBlockAt(e.head).from,1)),QP=n=>Ls(n,e=>Se.cursor(n.lineBlockAt(e.head).to,-1));function KP(n,e,t){let i=!1,r=_c(n.selection,o=>{let a=ir(n,o.head,-1)||ir(n,o.head,1)||o.head>0&&ir(n,o.head-1,1)||o.head<n.doc.length&&ir(n,o.head+1,-1);if(!a||!a.end)return o;i=!0;let u=a.start.from==o.head?a.end.to:a.end.from;return Se.cursor(u)});return i?(e(Bs(n,r)),!0):!1}const YP=({state:n,dispatch:e})=>KP(n,e);function gs(n,e,t){let i=_c(n.state.selection,r=>{r.undirectional&&r.head>=r.anchor!=e&&(r=Se.range(r.head,r.anchor));let o=t(r);return Se.range(r.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(Bs(n.state,i)),!0)}function FT(n,e){return gs(n,e,t=>n.moveByChar(t,e))}const GT=n=>FT(n,!li(n)),QT=n=>FT(n,li(n));function KT(n,e){return gs(n,e,t=>n.moveByGroup(t,e))}const WP=n=>KT(n,!li(n)),XP=n=>KT(n,li(n)),$P=n=>{let e=!li(n);return gs(n,e,t=>om(n.state,t,e))},ZP=n=>{let e=li(n);return gs(n,e,t=>om(n.state,t,e))};function YT(n,e){return gs(n,e,t=>n.moveVertically(t,e))}const WT=n=>YT(n,!1),XT=n=>YT(n,!0);function $T(n,e){return gs(n,e,t=>n.moveVertically(t,e,UT(n).height))}const Jk=n=>$T(n,!1),eA=n=>$T(n,!0),JP=n=>gs(n,!0,e=>ho(n,e,!0)),eH=n=>gs(n,!1,e=>ho(n,e,!1)),tH=n=>{let e=!li(n);return gs(n,e,t=>ho(n,t,e))},nH=n=>{let e=li(n);return gs(n,e,t=>ho(n,t,e))},iH=n=>gs(n,!1,e=>Se.cursor(n.lineBlockAt(e.head).from)),sH=n=>gs(n,!0,e=>Se.cursor(n.lineBlockAt(e.head).to)),tA=({state:n,dispatch:e})=>(e(Bs(n,{anchor:0})),!0),nA=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.doc.length})),!0),iA=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.selection.main.anchor,head:0})),!0),sA=({state:n,dispatch:e})=>(e(Bs(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),rH=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),lH=({state:n,dispatch:e})=>{let t=am(n).map(({from:i,to:r})=>Se.range(i,Math.min(r+1,n.doc.length)));return e(n.update({selection:Se.create(t),userEvent:"select"})),!0},oH=({state:n,dispatch:e})=>{let t=_c(n.selection,i=>{let r=ar(n),o=r.resolveStack(i.from,1);if(i.empty){let a=r.resolveStack(i.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:u}=a;if((u.from<i.from&&u.to>=i.to||u.to>i.to&&u.from<=i.from)&&a.next)return Se.range(u.to,u.from)}return i});return t.eq(n.selection)?!1:(e(Bs(n,t)),!0)};function ZT(n,e){let{state:t}=n,i=t.selection,r=t.selection.ranges.slice();for(let o of t.selection.ranges){let a=t.doc.lineAt(o.head);if(e?a.to<n.state.doc.length:a.from>0)for(let u=o;;){let f=n.moveVertically(u,e);if(f.head<a.from||f.head>a.to){r.some(d=>d.head==f.head)||r.push(f);break}else{if(f.head==u.head)break;u=f}}}return r.length==i.ranges.length?!1:(n.dispatch(Bs(t,Se.create(r,r.length-1))),!0)}const aH=n=>ZT(n,!1),cH=n=>ZT(n,!0),uH=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=Se.create([t.main]):t.main.empty||(i=Se.create([Se.cursor(t.main.head)])),i?(e(Bs(n,i)),!0):!1};function qf(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,r=i.changeByRange(o=>{let{from:a,to:u}=o;if(a==u){let f=e(o);f<a?(t="delete.backward",f=Bd(n,f,!1)):f>a&&(t="delete.forward",f=Bd(n,f,!0)),a=Math.min(a,f),u=Math.max(u,f)}else a=Bd(n,a,!1),u=Bd(n,u,!0);return a==u?{range:o}:{changes:{from:a,to:u},range:Se.cursor(a,a<o.head?-1:1)}});return r.changes.empty?!1:(n.dispatch(i.update(r,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?et.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Bd(n,e,t){if(n instanceof et)for(let i of n.state.facet(et.atomicRanges).map(r=>r(n)))i.between(e,e,(r,o)=>{r<e&&o>e&&(e=t?o:r)});return e}const JT=(n,e,t)=>qf(n,i=>{let r=i.from,{state:o}=n,a=o.doc.lineAt(r),u,f;if(t&&!e&&r>a.from&&r<a.from+200&&!/[^ \t]/.test(u=a.text.slice(0,r-a.from))){if(u[u.length-1]==" ")return r-1;let d=$p(u,o.tabSize),p=d%Ap(o)||Ap(o);for(let g=0;g<p&&u[u.length-1-g]==" ";g++)r--;f=r}else f=ii(a.text,r-a.from,e,e)+a.from,f==r&&a.number!=(e?o.doc.lines:1)?f+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(a.text.slice(f-a.from,r-a.from))&&(f=ii(a.text,f-a.from,!1,!1)+a.from);return f}),Tb=n=>JT(n,!1,!0),eO=n=>JT(n,!0,!1),tO=(n,e)=>qf(n,t=>{let i=t.head,{state:r}=n,o=r.doc.lineAt(i),a=r.charCategorizer(i);for(let u=null;;){if(i==(e?o.to:o.from)){i==t.head&&o.number!=(e?r.doc.lines:1)&&(i+=e?1:-1);break}let f=ii(o.text,i-o.from,e)+o.from,d=o.text.slice(Math.min(i,f)-o.from,Math.max(i,f)-o.from),p=a(d);if(u!=null&&p!=u)break;(d!=" "||i!=t.head)&&(u=p),i=f}return i}),nO=n=>tO(n,!1),fH=n=>tO(n,!0),hH=n=>qf(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),dH=n=>qf(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),pH=n=>qf(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),mH=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:kt.of(["",""])},range:Se.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},gH=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let r=i.from,o=n.doc.lineAt(r),a=r==o.from?r-1:ii(o.text,r-o.from,!1)+o.from,u=r==o.to?r+1:ii(o.text,r-o.from,!0)+o.from;return{changes:{from:a,to:u,insert:n.doc.slice(r,u).append(n.doc.slice(a,r))},range:Se.cursor(u)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function am(n){let e=[],t=-1;for(let i of n.selection.ranges){let r=n.doc.lineAt(i.from),o=n.doc.lineAt(i.to);if(!i.empty&&i.to==o.from&&(o=n.doc.lineAt(i.to-1)),t>=r.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(i)}else e.push({from:r.from,to:o.to,ranges:[i]});t=o.number+1}return e}function iO(n,e,t){if(n.readOnly)return!1;let i=[],r=[];for(let o of am(n)){if(t?o.to==n.doc.length:o.from==0)continue;let a=n.doc.lineAt(t?o.to+1:o.from-1),u=a.length+1;if(t){i.push({from:o.to,to:a.to},{from:o.from,insert:a.text+n.lineBreak});for(let f of o.ranges)r.push(Se.range(Math.min(n.doc.length,f.anchor+u),Math.min(n.doc.length,f.head+u)))}else{i.push({from:a.from,to:o.from},{from:o.to,insert:n.lineBreak+a.text});for(let f of o.ranges)r.push(Se.range(f.anchor-u,f.head-u))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:Se.create(r,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const yH=({state:n,dispatch:e})=>iO(n,e,!1),bH=({state:n,dispatch:e})=>iO(n,e,!0);function sO(n,e,t){if(n.readOnly)return!1;let i=[];for(let o of am(n))t?i.push({from:o.from,insert:n.doc.slice(o.from,o.to)+n.lineBreak}):i.push({from:o.to,insert:n.lineBreak+n.doc.slice(o.from,o.to)});let r=n.changes(i);return e(n.update({changes:r,selection:n.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const vH=({state:n,dispatch:e})=>sO(n,e,!1),xH=({state:n,dispatch:e})=>sO(n,e,!0),SH=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(am(e).map(({from:r,to:o})=>(r>0?r--:o<e.doc.length&&o++,{from:r,to:o}))),i=_c(e.selection,r=>{let o;if(n.lineWrapping){let a=n.lineBlockAt(r.head),u=n.coordsAtPos(r.head,r.assoc||1);u&&(o=a.bottom+n.documentTop-u.bottom+n.defaultLineHeight/2)}return n.moveVertically(r,!0,o)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function wH(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=ar(n).resolveInner(e),i=t.childBefore(e),r=t.childAfter(e),o;return i&&r&&i.to<=e&&r.from>=e&&(o=i.type.prop(mt.closedBy))&&o.indexOf(r.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(r.from).from&&!/\S/.test(n.sliceDoc(i.to,r.from))?{from:i.to,to:r.from}:null}const rA=rO(!1),CH=rO(!0);function rO(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(r=>{let{from:o,to:a}=r,u=e.doc.lineAt(o),f=!n&&o==a&&wH(e,o);n&&(o=a=(a<=u.to?u:e.doc.lineAt(a)).to);let d=new im(e,{simulateBreak:o,simulateDoubleBreak:!!f}),p=Fv(d,o);for(p==null&&(p=$p(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));a<u.to&&/\s/.test(u.text[a-u.from]);)a++;f?{from:o,to:a}=f:o>u.from&&o<u.from+100&&!/\S/.test(u.text.slice(0,o))&&(o=u.from);let g=["",Sf(e,p)];return f&&g.push(Sf(e,d.lineIndent(u.from,-1))),{changes:{from:o,to:a,insert:kt.of(g)},range:Se.cursor(o+1+g[1].length)}});return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function Yv(n,e){let t=-1;return n.changeByRange(i=>{let r=[];for(let a=i.from;a<=i.to;){let u=n.doc.lineAt(a);u.number>t&&(i.empty||i.to>u.from)&&(e(u,r,i),t=u.number),a=u.to+1}let o=n.changes(r);return{changes:r,range:Se.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}const kH=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new im(n,{overrideIndentation:o=>{let a=t[o];return a??-1}}),r=Yv(n,(o,a,u)=>{let f=Fv(i,o.from);if(f==null)return;/\S/.test(o.text)||(f=0);let d=/^\s*/.exec(o.text)[0],p=Sf(n,f);(d!=p||u.from<o.from+d.length)&&(t[o.from]=f,a.push({from:o.from,to:o.from+d.length,insert:p}))});return r.changes.empty||e(n.update(r,{userEvent:"indent"})),!0},AH=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Yv(n,(t,i)=>{i.push({from:t.from,insert:n.facet(qv)})}),{userEvent:"input.indent"})),!0),EH=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Yv(n,(t,i)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let o=$p(r,n.tabSize),a=0,u=Sf(n,Math.max(0,o-Ap(n)));for(;a<r.length&&a<u.length&&r.charCodeAt(a)==u.charCodeAt(a);)a++;i.push({from:t.from+a,to:t.from+r.length,insert:u.slice(a)})}),{userEvent:"delete.dedent"})),!0),RH=n=>(n.setTabFocusMode(),!0),TH=[{key:"Ctrl-b",run:zT,shift:GT,preventDefault:!0},{key:"Ctrl-f",run:IT,shift:QT},{key:"Ctrl-p",run:VT,shift:WT},{key:"Ctrl-n",run:_T,shift:XT},{key:"Ctrl-a",run:GP,shift:iH},{key:"Ctrl-e",run:QP,shift:sH},{key:"Ctrl-d",run:eO},{key:"Ctrl-h",run:Tb},{key:"Ctrl-k",run:hH},{key:"Ctrl-Alt-h",run:nO},{key:"Ctrl-o",run:mH},{key:"Ctrl-t",run:gH},{key:"Ctrl-v",run:Rb}],OH=[{key:"ArrowLeft",run:zT,shift:GT,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:zP,shift:WP,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:qP,shift:tH,preventDefault:!0},{key:"ArrowRight",run:IT,shift:QT,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:IP,shift:XP,preventDefault:!0},{mac:"Cmd-ArrowRight",run:FP,shift:nH,preventDefault:!0},{key:"ArrowUp",run:VT,shift:WT,preventDefault:!0},{mac:"Cmd-ArrowUp",run:tA,shift:iA},{mac:"Ctrl-ArrowUp",run:Zk,shift:Jk},{key:"ArrowDown",run:_T,shift:XT,preventDefault:!0},{mac:"Cmd-ArrowDown",run:nA,shift:sA},{mac:"Ctrl-ArrowDown",run:Rb,shift:eA},{key:"PageUp",run:Zk,shift:Jk},{key:"PageDown",run:Rb,shift:eA},{key:"Home",run:UP,shift:eH,preventDefault:!0},{key:"Mod-Home",run:tA,shift:iA},{key:"End",run:_P,shift:JP,preventDefault:!0},{key:"Mod-End",run:nA,shift:sA},{key:"Enter",run:rA,shift:rA},{key:"Mod-a",run:rH},{key:"Backspace",run:Tb,shift:Tb,preventDefault:!0},{key:"Delete",run:eO,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:nO,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:fH,preventDefault:!0},{mac:"Mod-Backspace",run:dH,preventDefault:!0},{mac:"Mod-Delete",run:pH,preventDefault:!0}].concat(TH.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),MH=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:HP,shift:$P},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:VP,shift:ZP},{key:"Alt-ArrowUp",run:yH},{key:"Shift-Alt-ArrowUp",run:vH},{key:"Alt-ArrowDown",run:bH},{key:"Shift-Alt-ArrowDown",run:xH},{key:"Mod-Alt-ArrowUp",run:aH},{key:"Mod-Alt-ArrowDown",run:cH},{key:"Escape",run:uH},{key:"Mod-Enter",run:CH},{key:"Alt-l",mac:"Ctrl-l",run:lH},{key:"Mod-i",run:oH,preventDefault:!0},{key:"Mod-[",run:EH},{key:"Mod-]",run:AH},{key:"Mod-Alt-\\",run:kH},{key:"Shift-Mod-k",run:SH},{key:"Shift-Mod-\\",run:YP},{key:"Mod-/",run:yP},{key:"Alt-A",run:vP},{key:"Ctrl-m",mac:"Shift-Alt-m",run:RH}].concat(OH);var lA={};class Rp{constructor(e,t,i,r,o,a,u,f,d,p=0,g){this.p=e,this.stack=t,this.state=i,this.reducePos=r,this.pos=o,this.score=a,this.buffer=u,this.bufferBase=f,this.curContext=d,this.lookAhead=p,this.parent=g}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let r=e.parser.context;return new Rp(e,[],t,i,i,0,[],0,r?new oA(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,r=e&65535,{parser:o}=this.p,a=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),u=o.dynamicPrecedence(r);if(u&&(this.score+=u),i==0){r<o.minRepeatTerm&&this.reducePos<this.pos&&(this.reducePos=this.pos),this.pushState(o.getGoto(this.state,r,!0),this.reducePos),r<o.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,a?8:4,!0),this.reduceContext(r,this.reducePos);return}let f=this.stack.length-(i-1)*3-(e&262144?6:0),d=f?this.stack[f-2]:this.p.ranges[0].from;r<o.minRepeatTerm&&d==this.reducePos&&this.reducePos<this.pos&&(this.reducePos=this.pos);let p=this.reducePos-d;p>=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let g=f?this.stack[f-1]:0,b=this.bufferBase+this.buffer.length-g;if(r<o.minRepeatTerm||e&131072){let v=o.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,d,v,b+4,!0)}if(e&262144)this.state=this.stack[f];else{let v=this.stack[f-3];this.state=o.getGoto(v,r,!0)}for(;this.stack.length>f;)this.stack.pop();this.reduceContext(r,d)}storeNode(e,t,i,r=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let a=this.buffer.length;if(a>0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==i)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,t,i,r);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let u=!1;for(let f=a;f>0&&this.buffer[f-2]>i;f-=4)if(this.buffer[f-1]>=0){u=!0;break}if(u)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,r>4&&(r-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=r}}shift(e,t,i,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=r;let u=a.stateFlag(o,1);!u&&(r>i||t<=a.maxNode)&&(this.reducePos=r),this.pushState(o,u?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,r,4)}else this.pos=r,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,r,4)}apply(e,t,i,r){e&65536?this.reduce(e):this.shift(e,t,i,r)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(i,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(t&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Rp(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new NH(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let o=0,a;o<t.length;o+=2)(a=t[o+1])!=this.state&&this.p.parser.hasAction(a,e)&&r.push(t[o],a);if(this.stack.length<120)for(let o=0;r.length<8&&o<t.length;o+=2){let a=t[o+1];r.some((u,f)=>f&1&&u==a)||r.push(t[o],a)}t=r}let i=[];for(let r=0;r<t.length&&i.length<4;r+=2){let o=t[r+1];if(o==this.state)continue;let a=this.split();a.pushState(o,this.pos),a.storeNode(0,a.pos,a.pos,4,!0),a.shiftContext(t[r],this.pos),a.reducePos=this.pos,a.score-=200,i.push(a)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let i=t>>19,r=t&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],r,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(r,o)=>{if(!t.includes(r))return t.push(r),e.allActions(r,a=>{if(!(a&393216))if(a&65536){let u=(a>>19)-o;if(u>1){let f=a&65535,d=this.stack.length-u*3;if(d>=0&&e.getGoto(this.stack[d],f,!1)>=0)return u<<19|65536|f}}else{let u=i(a,o+1);if(u!=null)return u}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new oA(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class oA{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class NH{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Tp{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Tp(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Tp(this.stack,this.pos,this.index)}}function Ld(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,r=0;i<n.length;){let o=0;for(;;){let a=n.charCodeAt(i++),u=!1;if(a==126){o=65535;break}a>=92&&a--,a>=34&&a--;let f=a-32;if(f>=46&&(f-=46,u=!0),o+=f,u)break;o*=46}t?t[r++]=o:t=new e(o)}return t}class Kd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const aA=new Kd;class DH{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=aA,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,r=this.rangeIndex,o=this.pos+e;for(;o<i.from;){if(!r)return null;let a=this.ranges[--r];o-=i.from-a.to,i=a}for(;t<0?o>i.to:o>=i.to;){if(r==this.ranges.length-1)return null;let a=this.ranges[++r];o+=a.from-i.to,i=a}return o}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,r;if(t>=0&&t<this.chunk.length)i=this.pos+e,r=this.chunk.charCodeAt(t);else{let o=this.resolveOffset(e,1);if(o==null)return-1;if(i=o,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let a=this.rangeIndex,u=this.range;for(;u.to<=i;)u=this.ranges[++a];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>u.to&&(this.chunk2=this.chunk2.slice(0,u.to-i)),r=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),r}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=aA,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(i+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return i}}class fc{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;jH(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}fc.prototype.contextual=fc.prototype.fallback=fc.prototype.extend=!1;fc.prototype.fallback=fc.prototype.extend=!1;function jH(n,e,t,i,r,o){let a=0,u=1<<i,{dialect:f}=t.p.parser;e:for(;(u&n[a])!=0;){let d=n[a+1];for(let v=a+3;v<d;v+=2)if((n[v+1]&u)>0){let S=n[v];if(f.allows(S)&&(e.token.value==-1||e.token.value==S||BH(S,e.token.value,r,o))){e.acceptToken(S);break}}let p=e.next,g=0,b=n[a+2];if(e.next<0&&b>g&&n[d+b*3-3]==65535){a=n[d+b*3-1];continue e}for(;g<b;){let v=g+b>>1,S=d+v+(v<<1),w=n[S],E=n[S+1]||65536;if(p<w)b=v;else if(p>=E)g=v+1;else{a=n[S+2],e.advance();continue e}}break}}function cA(n,e,t){for(let i=e,r;(r=n[i])!=65535;i++)if(r==t)return i-e;return-1}function BH(n,e,t,i){let r=cA(t,i,e);return r<0||cA(t,i,n)<r}const Fi=typeof process<"u"&&lA&&/\bparse\b/.test(lA.LOG);let r0=null;function uA(n,e,t){let i=n.cursor(fn.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class LH{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?uA(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?uA(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],r=this.index[t];if(r==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let o=i.children[r],a=this.start[t]+i.positions[r];if(a>e)return this.nextStart=a,null;if(o instanceof Sn){if(a==e){if(a<this.safeFrom)return null;let u=a+o.length;if(u<=this.safeTo){let f=o.prop(mt.lookAhead);if(!f||u+f<this.fragment.to)return o}}this.index[t]++,a+o.length>=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+o.length}}}class zH{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new Kd)}getActions(e){let t=0,i=null,{parser:r}=e.p,{tokenizers:o}=r,a=r.stateSlot(e.state,3),u=e.curContext?e.curContext.hash:0,f=0;for(let d=0;d<o.length;d++){if((1<<d&a)==0)continue;let p=o[d],g=this.tokens[d];if(!(i&&!p.fallback)&&((p.contextual||g.start!=e.pos||g.mask!=a||g.context!=u)&&(this.updateCachedToken(g,p,e),g.mask=a,g.context=u),g.lookAhead>g.end+25&&(f=Math.max(g.lookAhead,f)),g.value!=0)){let b=t;if(g.extended>-1&&(t=this.addActions(e,g.extended,g.end,t)),t=this.addActions(e,g.value,g.end,t),!p.extend&&(i=g,t>b))break}}for(;this.actions.length>t;)this.actions.pop();return f&&e.setLookAhead(f),!i&&e.pos==this.stream.end&&(i=new Kd,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Kd,{pos:i,p:r}=e;return t.start=i,t.end=Math.min(i+1,r.stream.end),t.value=i==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,i){let r=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(r,e),i),e.value>-1){let{parser:o}=i.p;for(let a=0;a<o.specialized.length;a++)if(o.specialized[a]==e.value){let u=o.specializers[a](this.stream.read(e.start,e.end),i);if(u>=0&&i.p.parser.dialect.allows(u>>1)){(u&1)==0?e.value=u>>1:e.extended=u>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,i,r){for(let o=0;o<r;o+=3)if(this.actions[o]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=i,r}addActions(e,t,i,r){let{state:o}=e,{parser:a}=e.p,{data:u}=a;for(let f=0;f<2;f++)for(let d=a.stateSlot(o,f?2:1);;d+=3){if(u[d]==65535)if(u[d+1]==1)d=Dr(u,d+2);else{r==0&&u[d+1]==2&&(r=this.putAction(Dr(u,d+2),t,i,r));break}u[d]==t&&(r=this.putAction(Dr(u,d+1),t,i,r))}return r}}class IH{constructor(e,t,i,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new DH(t,r),this.tokens=new zH(e,this.stream),this.topTerm=e.top[1];let{from:o}=r[0];this.stacks=[Rp.start(this,e.top[0],o)],this.fragments=i.length&&this.stream.end-o>e.bufferLength*4?new LH(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],r,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;a<e.length;a++){let u=e[a];for(;;){if(this.tokens.mainToken=null,u.pos>t)i.push(u);else{if(this.advanceStack(u,i,e))continue;{r||(r=[],o=[]),r.push(u);let f=this.tokens.getMainToken(u);o.push(f.value,f.end)}}break}}if(!i.length){let a=r&&HH(r);if(a)return Fi&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Fi&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let a=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,o,i);if(a)return Fi&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((u,f)=>f.score-u.score);i.length>a;)i.pop();i.some(u=>u.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a<i.length-1;a++){let u=i[a];for(let f=a+1;f<i.length;f++){let d=i[f];if(u.sameState(d)||u.buffer.length>500&&d.buffer.length>500)if((u.score-d.score||u.buffer.length-d.buffer.length)>0)i.splice(f--,1);else{i.splice(a--,1);continue e}}}i.length>12&&(i.sort((a,u)=>u.score-a.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let a=1;a<i.length;a++)i[a].pos<this.minStackPos&&(this.minStackPos=i[a].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let r=e.pos,{parser:o}=this,a=Fi?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,p=d?e.curContext.hash:0;for(let g=this.fragments.nodeAt(r);g;){let b=this.parser.nodeSet.types[g.type.id]==g.type?o.getGoto(e.state,g.type.id):-1;if(b>-1&&g.length&&(!d||(g.prop(mt.contextHash)||0)==p))return e.useNode(g,b),Fi&&console.log(a+this.stackID(e)+` (via reuse of ${o.getName(g.type.id)})`),!0;if(!(g instanceof Sn)||g.children.length==0||g.positions[0]>0)break;let v=g.children[0];if(v instanceof Sn&&g.positions[0]==0)g=v;else break}}let u=o.stateSlot(e.state,4);if(u>0)return e.reduce(u),Fi&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(u&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let f=this.tokens.getActions(e);for(let d=0;d<f.length;){let p=f[d++],g=f[d++],b=f[d++],v=d==f.length||!i,S=v?e:e.split(),w=this.tokens.mainToken;if(S.apply(p,g,w?w.start:S.pos,b),Fi&&console.log(a+this.stackID(S)+` (via ${(p&65536)==0?"shift":`reduce of ${o.getName(p&65535)}`} for ${o.getName(g)} @ ${r}${S==e?"":", split"})`),v)return!0;S.pos>r?t.push(S):i.push(S)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return fA(e,t),!0}}runRecovery(e,t,i){let r=null,o=!1;for(let a=0;a<e.length;a++){let u=e[a],f=t[a<<1],d=t[(a<<1)+1],p=Fi?this.stackID(u)+" -> ":"";if(u.deadEnd&&(o||(o=!0,u.restart(),Fi&&console.log(p+this.stackID(u)+" (restarted)"),this.advanceFully(u,i))))continue;let g=u.split(),b=p;for(let v=0;v<10&&g.forceReduce()&&(Fi&&console.log(b+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,i));v++)Fi&&(b=this.stackID(g)+" -> ");for(let v of u.recoverByInsert(f))Fi&&console.log(p+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,i);this.stream.end>u.pos?(d==u.pos&&(d++,f=0),u.recoverByDelete(f,d),Fi&&console.log(p+this.stackID(u)+` (via recover-delete ${this.parser.getName(f)})`),fA(u,i)):(!r||r.score<g.score)&&(r=g)}return r}stackToTree(e){return e.close(),Sn.build({buffer:Tp.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(r0||(r0=new WeakMap)).get(e);return t||r0.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function fA(n,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==n.pos&&i.sameState(n)){e[t].score<n.score&&(e[t]=n);return}}e.push(n)}class PH{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class Op extends bT{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let u=0;u<e.repeatNodeCount;u++)t.push("");let i=Object.keys(e.topRules).map(u=>e.topRules[u][1]),r=[];for(let u=0;u<t.length;u++)r.push([]);function o(u,f,d){r[u].push([f,f.deserialize(String(d))])}if(e.nodeProps)for(let u of e.nodeProps){let f=u[0];typeof f=="string"&&(f=mt[f]);for(let d=1;d<u.length;){let p=u[d++];if(p>=0)o(p,f,u[d++]);else{let g=u[d+-p];for(let b=-p;b>0;b--)o(u[d++],f,g);d++}}}this.nodeSet=new Hv(t.map((u,f)=>zi.define({name:f>=this.minRepeatTerm?void 0:u,id:f,props:r[f],top:i.indexOf(f)>-1,error:f==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(f)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=pT;let a=Ld(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let u=0;u<this.specializerSpecs.length;u++)this.specialized[u]=this.specializerSpecs[u].term;this.specializers=this.specializerSpecs.map(hA),this.states=Ld(e.states,Uint32Array),this.data=Ld(e.stateData),this.goto=Ld(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(u=>typeof u=="number"?new fc(a,u):u),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let r=new IH(this,e,t,i);for(let o of this.wrappers)r=o(r,e,t,i);return r}getGoto(e,t,i=!1){let r=this.goto;if(t>=r[0])return-1;for(let o=r[t+1];;){let a=r[o++],u=a&1,f=r[o++];if(u&&i)return f;for(let d=o+(a>>1);o<d;o++)if(r[o]==e)return f;if(u)return-1}}hasAction(e,t){let i=this.data;for(let r=0;r<2;r++)for(let o=this.stateSlot(e,r?2:1),a;;o+=3){if((a=i[o])==65535)if(i[o+1]==1)a=i[o=Dr(i,o+2)];else{if(i[o+1]==2)return Dr(i,o+2);break}if(a==t||a==0)return Dr(i,o+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),r=i?t(i):void 0;for(let o=this.stateSlot(e,1);r==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=Dr(this.data,o+2);else break;r=t(Dr(this.data,o+1))}return r}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Dr(this.data,i+2);else break;if((this.data[i+2]&1)==0){let r=this.data[i+1];t.some((o,a)=>a&1&&o==r)||t.push(this.data[i],r)}}return t}configure(e){let t=Object.assign(Object.create(Op.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let r=e.tokenizers.find(o=>o.from==i);return r?r.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,r)=>{let o=e.specializers.find(u=>u.from==i.external);if(!o)return i;let a=Object.assign(Object.assign({},i),{external:o.to});return t.specializers[r]=hA(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let o of e.split(" ")){let a=t.indexOf(o);a>=0&&(i[a]=!0)}let r=null;for(let o=0;o<t.length;o++)if(!i[o])for(let a=this.dialects[t[o]],u;(u=this.data[a++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[u]=1;return new PH(e,i,r)}static deserialize(e){return new Op(e)}}function Dr(n,e){return n[e]|n[e+1]<<16}function HH(n){let e=null;for(let t of n){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function hA(n){if(n.external){let e=n.extend?1:0;return(t,i)=>n.external(t,i)<<1|e}return n.get}const VH=vT({String:Ee.string,Number:Ee.number,"True False":Ee.bool,PropertyName:Ee.propertyName,Null:Ee.null,", :":Ee.separator,"[ ]":Ee.squareBracket,"{ }":Ee.brace}),_H=Op.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[VH],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),UH=Cp.define({name:"json",parser:_H.configure({props:[CT.add({Object:Kk({except:/^\s*\}/}),Array:Kk({except:/^\s*\]/})}),Z8.add({"Object Array":J8})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function qH(){return new _8(UH)}function Wv({value:n,onChange:e,readOnly:t=!1,placeholderText:i="{ }"}){const r=A.useRef(null),o=A.useRef(null),a=A.useRef(e);a.current=e;const u=A.useRef(new Pf);return A.useEffect(()=>{if(!r.current)return;const f=[et.editable.of(!t),wt.readOnly.of(t)],d=wt.create({doc:n,extensions:[S8(),EP(),$8(),uP(),a8(),eP(iP,{fallback:!0}),qH(),h8(i),hT.of([...MH,...LP]),u.current.of(f),et.updateListener.of(g=>{g.docChanged&&a.current(g.state.doc.toString())}),et.theme({"&":{fontSize:"12px",backgroundColor:"transparent"},"&.cm-focused":{outline:"none"},".cm-content":{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace"},".cm-gutters":{backgroundColor:"transparent",border:"none"}})]}),p=new et({state:d,parent:r.current});return o.current=p,()=>{p.destroy(),o.current=null}},[]),A.useEffect(()=>{const f=o.current;f&&n!==f.state.doc.toString()&&f.dispatch({changes:{from:0,to:f.state.doc.length,insert:n}})},[n]),A.useEffect(()=>{var f;(f=o.current)==null||f.dispatch({effects:u.current.reconfigure([et.editable.of(!t),wt.readOnly.of(t)])})},[t]),x.jsx("div",{ref:r,className:"w-full overflow-hidden rounded-md border border-input bg-background py-1 text-left"})}const Ob=(n,e)=>n instanceof Tf?n.body.error:e,l0=n=>({description:n.description??"",groupName:n.groupName??"",schemaText:n.schema!==void 0?JSON.stringify(n.schema,null,2):"",deprecated:n.deprecated??!1}),FH=(n,e)=>n.description===e.description&&n.groupName===e.groupName&&n.schemaText===e.schemaText&&n.deprecated===e.deprecated;function GH({type:n,readonly:e,onBack:t}){const i=ua(),r=io(),[o,a]=A.useState(()=>l0(n)),u=l0(n),f=!FH(o,u);A.useEffect(()=>{a(l0(n))},[n.name]),A.useEffect(()=>{const k=()=>!f||window.confirm("Discard unsaved event-type changes?");return J2(k),()=>eR(k)},[f]);let d=null,p;if(o.schemaText.trim()!=="")try{p=JSON.parse(o.schemaText)}catch{d="Schema is not valid JSON"}const g=Yi({mutationFn:()=>g3(n.name,{name:n.name,description:o.description||void 0,groupName:o.groupName||void 0,deprecated:o.deprecated||void 0,...o.schemaText.trim()!==""?{schema:p}:{}}),onSuccess:()=>{i.add("success","Event type saved"),r.invalidateQueries({queryKey:["event-types"]})},onError:k=>i.add("error",Ob(k,"Failed to save event type"))}),[b,v]=A.useState(!1),[S,w]=A.useState(""),E=Yi({mutationFn:()=>y3(n.name),onSuccess:()=>{i.add("success","Event type deleted"),r.invalidateQueries({queryKey:["event-types"]}),v(!1),t()},onError:k=>i.add("error",Ob(k,"Failed to delete event type"))});return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsxs("button",{onClick:t,className:"mb-4 inline-flex items-center gap-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[x.jsx(Np,{className:"size-3.5"}),"Event Types"]}),x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsx("h1",{className:"font-mono text-xl font-semibold tracking-tight",children:n.name}),(e?n.deprecated:o.deprecated)&&x.jsx(lr,{className:"border-warning/30 bg-warning/10 text-warning",children:"Deprecated"})]}),x.jsxs("div",{className:"mt-6 flex flex-col gap-5",children:[x.jsx(Es,{title:"Details",children:x.jsxs("div",{className:"flex flex-col gap-4",children:[x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"et-desc",className:"text-xs font-medium text-muted-foreground",children:"Description"}),x.jsx(Ms,{id:"et-desc",placeholder:"What does this event mean?",value:o.description,disabled:e,onChange:k=>a({...o,description:k.target.value})})]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"et-group",className:"text-xs font-medium text-muted-foreground",children:"Group"}),x.jsx(Ms,{id:"et-group",placeholder:"Billing",value:o.groupName,disabled:e,onChange:k=>a({...o,groupName:k.target.value})})]}),x.jsxs("div",{className:"flex items-center gap-3",children:[x.jsx(U5,{checked:o.deprecated,onCheckedChange:k=>!e&&a({...o,deprecated:k}),disabled:e,"aria-label":"Deprecated"}),x.jsxs("div",{children:[x.jsx("p",{className:"text-[13px] font-medium text-foreground",children:"Deprecated"}),x.jsx("p",{className:"text-xs text-muted-foreground",children:"Flagged in the UI but still deliverable."})]})]})]})}),x.jsxs(Es,{title:"Payload schema",description:"Optional JSON Schema documenting the payload. Enforced only when the core is configured with a payload validator.",children:[x.jsx(Wv,{value:o.schemaText,onChange:k=>!e&&a({...o,schemaText:k}),readOnly:e,placeholderText:'{ "type": "object" }'}),d&&x.jsx("p",{className:"mt-2 text-xs text-destructive",children:d})]}),!e&&x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx(Wt,{variant:"primary",disabled:!f||d!==null,loading:g.isPending,onClick:()=>g.mutate(),children:"Save changes"}),f&&x.jsx(Wt,{variant:"secondary",onClick:()=>a(u),children:"Revert"}),x.jsx("div",{className:"ml-auto",children:x.jsx(Wt,{variant:"danger",icon:x.jsx(Ub,{className:"size-3.5"}),onClick:()=>{w(""),v(!0)},children:"Delete event type"})})]})]}),x.jsxs(_d,{open:b,onClose:()=>v(!1),onConfirm:()=>E.mutate(),title:"Delete event type",confirmLabel:"Delete permanently",danger:!0,loading:E.isPending,confirmDisabled:S!==n.name,children:[x.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["Endpoints subscribed to ",x.jsx("code",{className:"font-mono text-foreground",children:n.name})," ","keep their subscription entry and simply stop matching new publishes of this name. This can't be undone."]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsxs("label",{htmlFor:"et-delete-confirm",className:"text-xs font-medium text-muted-foreground",children:["Type ",x.jsx("code",{className:"font-mono text-foreground",children:n.name})," to confirm"]}),x.jsx(Ms,{id:"et-delete-confirm",className:"font-mono",value:S,onChange:k=>w(k.target.value),autoFocus:!0})]})]})]})}function QH({readonly:n,portal:e,selectedName:t,onOpen:i,onBack:r}){const o=ua(),a=io(),u=ji({queryKey:["event-types"],queryFn:qb,staleTime:1e4}),[f,d]=A.useState(!1),[p,g]=A.useState(""),b=Yi({mutationFn:()=>m3({name:p.trim()}),onSuccess:E=>{a.invalidateQueries({queryKey:["event-types"]}),d(!1),g(""),i(E.name)},onError:E=>o.add("error",Ob(E,"Failed to create event type"))}),v=u.data??[],S=t?v.find(E=>E.name===t):void 0;if(S)return x.jsx(GH,{type:S,readonly:n,onBack:r});if(t&&u.isLoading)return x.jsx(Ns,{label:"Loading event type…"});const w=Hj(v);return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Event Types",description:x.jsxs(x.Fragment,{children:["The global catalog",e?" (read-only in the portal)":""," — public at"," ",x.jsx("code",{className:"font-mono text-foreground",children:"api/event-types.json"})," so receiver teams can browse it without panel credentials."]}),actions:n?void 0:x.jsx(Wt,{variant:"primary",icon:x.jsx(Dp,{className:"size-4"}),onClick:()=>d(!0),children:"New event type"})}),u.isLoading?x.jsx(Ns,{label:"Loading event types…"}):u.isError?x.jsx(Li,{children:"Failed to load event types."}):v.length===0?x.jsx(Li,{children:"No event types yet. Define the kinds of events your applications publish."}):x.jsx("div",{className:"mt-4 flex flex-col gap-6",children:w.map(({group:E,types:k})=>x.jsxs("div",{children:[x.jsx("h2",{className:"mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:E}),x.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:k.map(R=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>i(R.name),className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary/30",children:[x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("span",{className:"truncate font-mono text-[13px] font-medium text-foreground",children:R.name}),R.deprecated&&x.jsx(lr,{className:"border-warning/30 bg-warning/10 text-warning",children:"Deprecated"}),R.schema!==void 0&&x.jsx(lr,{children:"Schema"})]}),R.description&&x.jsx("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:R.description})]}),x.jsx(aa,{className:"size-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},R.name))})})]},E))}),x.jsxs(up,{open:f,onClose:()=>d(!1),title:"New event type",footer:x.jsxs(x.Fragment,{children:[x.jsx(Wt,{variant:"secondary",onClick:()=>d(!1),children:"Cancel"}),x.jsx(Wt,{variant:"primary",disabled:!p.trim(),loading:b.isPending,onClick:()=>b.mutate(),children:"Create event type"})]}),children:[x.jsxs("p",{className:"text-[13px] text-muted-foreground",children:["Dot-delimited, e.g. ",x.jsx("code",{className:"font-mono text-foreground",children:"invoice.paid"}),". Endpoints subscribe to event types by name."]}),x.jsxs("div",{className:"flex flex-col gap-1.5",children:[x.jsx("label",{htmlFor:"new-et-name",className:"text-xs font-medium text-muted-foreground",children:"Name"}),x.jsx(Ms,{id:"new-et-name",className:"font-mono",placeholder:"invoice.paid",value:p,onChange:E=>g(E.target.value),onKeyDown:E=>{E.key==="Enter"&&p.trim()&&!b.isPending&&b.mutate()},autoFocus:!0})]})]})]})}const dA=50;function KH(n){try{return JSON.stringify(JSON.parse(n.envelope),null,2)}catch{return n.envelope}}function YH({app:n,id:e,onBack:t,onOpenDelivery:i}){const r=ji({queryKey:["messages",n,{id:e}],queryFn:()=>T3(n,e)});if(r.isLoading)return x.jsx(Ns,{label:"Loading message…"});if(r.isError||!r.data)return x.jsx("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:x.jsx(Li,{children:"Message not found."})});const o=r.data;return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsxs("button",{onClick:t,className:"mb-4 inline-flex items-center gap-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[x.jsx(Np,{className:"size-3.5"}),"Messages"]}),x.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[x.jsx("h1",{className:"font-mono text-xl font-semibold tracking-tight",children:o.eventType}),x.jsx(Tc,{className:"text-muted-foreground",children:o.id})]}),x.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Published ",Xn(o.createdAt)," · event time"," ",Xn(o.timestamp)," · the message id is the"," ",x.jsx("code",{className:"font-mono",children:"webhook-id"})," header (receivers dedupe on it)",o.idempotencyKey?x.jsxs(x.Fragment,{children:[" ","· idempotency key ",x.jsx("span",{className:"font-mono",children:o.idempotencyKey})]}):null]}),x.jsxs("div",{className:"mt-6 flex flex-col gap-5",children:[x.jsx(Es,{title:"Envelope",description:"The exact signed bytes every delivery of this message carries.",children:x.jsx(Wv,{value:KH(o),onChange:()=>{},readOnly:!0})}),x.jsx(Es,{title:"Deliveries",description:"One delivery per matching endpoint (fan-out).",children:o.deliveries.length===0?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No deliveries — no enabled endpoint matched this event type at publish time."}):x.jsx("ul",{className:"divide-y divide-border",children:o.deliveries.map(a=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>i(a.id),className:"group flex w-full items-center gap-3 py-2.5 text-left",children:[x.jsx(If,{status:a.status}),x.jsx(Tc,{className:"min-w-0 flex-1 truncate",children:a.id}),x.jsxs("span",{className:"text-xs text-muted-foreground",children:[a.attemptCount," attempt",a.attemptCount===1?"":"s"]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(a.updatedAt),children:Of(a.updatedAt)}),x.jsx(aa,{className:"size-4 text-muted-foreground/50 group-hover:text-muted-foreground"})]})},a.id))})})]})]})}function WH({app:n,selectedId:e,onOpen:t,onBack:i,onOpenDelivery:r}){var g;const[o,a]=Nb.useState(""),f=ji({queryKey:["event-types"],queryFn:qb}).data??[],d=KA({queryKey:["messages",n,{eventType:o}],queryFn:({pageParam:b})=>R3(n,{limit:dA,...o?{eventType:o}:{},...b?{before:b}:{}}),initialPageParam:"",getNextPageParam:b=>{var v;return b.length===dA?(v=b[b.length-1])==null?void 0:v.id:void 0},enabled:n!==""&&!e});if(!n)return x.jsx(Kp,{});if(e)return x.jsx(YH,{app:n,id:e,onBack:i,onOpenDelivery:r});const p=((g=d.data)==null?void 0:g.pages.flat())??[];return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Messages",description:"Every published event, newest first. A message's payload is signed once and shared by all its deliveries."}),x.jsx("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:x.jsx(wv,{"aria-label":"Filter by event type",value:o,onValueChange:a,options:[{value:"",label:"All event types"},...f.map(b=>({value:b.name,label:b.name}))],className:"w-64"})}),d.isLoading?x.jsx(Ns,{label:"Loading messages…"}):d.isError?x.jsx(Li,{children:"Failed to load messages."}):p.length===0?x.jsx(Li,{children:o?`No messages of type "${o}".`:"No messages published yet."}):x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:p.map(b=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>t(b.id),className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary/30",children:[x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx("span",{className:"block truncate font-mono text-[13px] font-medium text-foreground",children:b.eventType}),x.jsx(Tc,{className:"mt-0.5 block truncate text-muted-foreground",children:b.id})]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(b.createdAt),children:Of(b.createdAt)}),x.jsx(aa,{className:"size-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},b.id))})}),d.hasNextPage&&x.jsx("div",{className:"mt-4 flex justify-center",children:x.jsx(Wt,{variant:"secondary",loading:d.isFetchingNextPage,onClick:()=>d.fetchNextPage(),children:"Load more"})})]})]})}const pA=50,XH=[{label:"All",status:""},{label:"Pending",status:"pending"},{label:"Succeeded",status:"succeeded"},{label:"Dead-letter",status:"failed"}],$H={schedule:"border-border bg-secondary/60 text-muted-foreground",manual:"border-accent/30 bg-accent/10 text-accent",test:"border-chart-2/30 bg-chart-2/10 text-chart-2"};function ZH({attempt:n}){return x.jsxs("li",{className:"relative pl-8",children:[x.jsx("span",{className:jt("absolute left-2 top-1.5 size-2.5 rounded-full border-2 border-card",n.ok?"bg-success":"bg-destructive"),"aria-hidden":!0}),x.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[x.jsxs("span",{className:"text-[13px] font-semibold text-foreground",children:["Attempt #",n.attemptNumber]}),x.jsx(lr,{className:$H[n.trigger],children:n.trigger}),n.httpStatus!==void 0?x.jsxs("span",{className:jt("font-mono text-[12px] font-medium",n.ok?"text-success":"text-destructive"),children:["HTTP ",n.httpStatus]}):x.jsx("span",{className:"font-mono text-[12px] font-medium text-destructive",children:n.error??"network error"}),x.jsx("span",{className:"text-xs tabular-nums text-muted-foreground",children:zj(n.durationMs)}),x.jsx("span",{className:"ml-auto whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(n.at),children:Xn(n.at)})]}),n.responseBody!==void 0&&n.responseBody!==""&&x.jsx("pre",{className:"mt-1.5 max-h-32 overflow-auto whitespace-pre-wrap break-all rounded-md border border-border bg-secondary/30 px-2.5 py-1.5 font-mono text-[11px] leading-relaxed text-muted-foreground",children:n.responseBody}),n.error!==void 0&&n.httpStatus!==void 0&&x.jsx("p",{className:"mt-1 font-mono text-[11px] text-destructive",children:n.error})]})}const o0=new Set(["webhook-id","webhook-timestamp","webhook-signature"]);function a0(n){return`'${n.replace(/'/g,"'\\''")}'`}function JH(n){const e=[`curl -X ${n.method} ${a0(n.url)}`];for(const[t,i]of Object.entries(n.headers))e.push(` -H ${a0(`${t}: ${i}`)}`);return n.body&&e.push(` -d ${a0(n.body)}`),e.join(` \\
|
|
209
|
+
`)}function eV(n){try{return JSON.stringify(JSON.parse(n),null,2)}catch{return n}}function tV({name:n,value:e,signing:t}){return x.jsxs("div",{className:jt("flex gap-3 px-3 py-1.5",t&&"bg-accent/[0.06] border-l-2 border-accent"),children:[x.jsx("span",{className:jt("w-44 shrink-0 break-all font-mono text-[12px]",t?"font-semibold text-accent":"text-foreground"),children:n}),x.jsx("span",{className:"min-w-0 flex-1 break-all font-mono text-[12px] text-muted-foreground",children:e})]})}function nV({app:n,deliveryId:e}){const t=ua(),[i,r]=A.useState(!1),o=ji({queryKey:["delivery-request",n,e],queryFn:()=>M3(n,e),enabled:i}),a=async()=>{if(o.data)try{await navigator.clipboard.writeText(JH(o.data)),t.add("success","Copied curl command","Paste it into a terminal to replay the request.")}catch{t.add("error","Copy failed","Clipboard access was denied by the browser.")}},u=o.data,f=u?Object.entries(u.headers).sort((d,p)=>{const g=o0.has(d[0].toLowerCase())?0:1,b=o0.has(p[0].toLowerCase())?0:1;return g-b}):[];return x.jsxs("section",{className:"rounded-xl border border-border bg-card",children:[x.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 border-b border-border px-4 py-3",children:[x.jsxs("div",{children:[x.jsx("h2",{className:"text-[13px] font-semibold text-foreground",children:"Request"}),x.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"The signature and webhook-timestamp are computed live; each attempt re-signs."})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[i&&u&&x.jsx(Wt,{size:"sm",variant:"secondary",icon:x.jsx(UD,{className:"size-3.5"}),onClick:a,"aria-label":"Copy request as a curl command",children:"Copy as curl"}),x.jsx(Wt,{size:"sm",variant:"ghost",icon:x.jsx(r3,{className:"size-3.5"}),"aria-expanded":i,"aria-controls":"delivery-request-panel",onClick:()=>r(d=>!d),children:i?"Hide request":"Show request"})]})]}),i&&x.jsx("div",{id:"delivery-request-panel",className:"px-4 py-4",children:o.isLoading?x.jsx(Ns,{label:"Building the signed request…"}):o.isError||!u?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"Could not build the request — the delivery or its endpoint may have been deleted."}):x.jsxs("div",{className:"flex flex-col gap-4",children:[x.jsx("div",{className:"overflow-x-auto rounded-md border border-border bg-secondary/30 px-3 py-2",children:x.jsxs("code",{className:"whitespace-nowrap font-mono text-[12px] text-foreground",children:[x.jsx("span",{className:"font-semibold text-accent",children:u.method})," ",u.url]})}),x.jsxs("div",{children:[x.jsx("h3",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Headers"}),x.jsx("div",{className:"divide-y divide-border overflow-hidden rounded-md border border-border",children:f.map(([d,p])=>x.jsx(tV,{name:d,value:p,signing:o0.has(d.toLowerCase())},d))})]}),x.jsxs("div",{children:[x.jsx("h3",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Body"}),x.jsx(Wv,{value:eV(u.body),onChange:()=>{},readOnly:!0})]})]})})]})}function iV({app:n,id:e,readonly:t,onBack:i,onOpenMessage:r,onOpenEndpoint:o}){const a=ua(),u=io(),f=ji({queryKey:["deliveries",n,{id:e}],queryFn:()=>O3(n,e),refetchInterval:b=>{var S;const v=(S=b.state.data)==null?void 0:S.status;return v==="pending"||v==="delivering"?1500:!1}}),d=Yi({mutationFn:()=>N3(n,e),onSuccess:()=>{a.add("success","Delivery re-queued","It is due for immediate retry."),u.invalidateQueries({queryKey:["deliveries",n]})},onError:b=>a.add("error",b instanceof Tf?b.body.error:"Failed to retry delivery")});if(f.isLoading)return x.jsx(Ns,{label:"Loading delivery…"});if(f.isError||!f.data)return x.jsx("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:x.jsx(Li,{children:"Delivery not found."})});const p=f.data,g=[...p.attempts].sort((b,v)=>v.attemptNumber-b.attemptNumber);return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsxs("button",{onClick:i,className:"mb-4 inline-flex items-center gap-1.5 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground",children:[x.jsx(Np,{className:"size-3.5"}),"Deliveries"]}),x.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[x.jsx("h1",{className:"font-mono text-xl font-semibold tracking-tight",children:p.id}),x.jsx(If,{status:p.status}),!t&&p.status==="failed"&&x.jsx(Wt,{variant:"primary",size:"sm",icon:x.jsx(JD,{className:"size-3.5"}),loading:d.isPending,onClick:()=>d.mutate(),children:"Retry"})]}),x.jsxs("dl",{className:"mt-3 grid grid-cols-1 gap-x-8 gap-y-2 text-[13px] sm:grid-cols-2",children:[x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("dt",{className:"w-28 shrink-0 text-xs font-medium text-muted-foreground",children:"Message"}),x.jsx("dd",{children:x.jsx("button",{onClick:()=>r(p.messageId),className:"font-mono text-[12px] text-accent hover:underline",children:p.messageId})})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("dt",{className:"w-28 shrink-0 text-xs font-medium text-muted-foreground",children:"Endpoint"}),x.jsx("dd",{children:x.jsx("button",{onClick:()=>o(p.endpointId),className:"font-mono text-[12px] text-accent hover:underline",children:p.endpointId})})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("dt",{className:"w-28 shrink-0 text-xs font-medium text-muted-foreground",children:"Created"}),x.jsx("dd",{className:"tabular-nums text-muted-foreground",children:Xn(p.createdAt)})]}),x.jsxs("div",{className:"flex items-center gap-2",children:[x.jsx("dt",{className:"w-28 shrink-0 text-xs font-medium text-muted-foreground",children:"Next attempt"}),x.jsx("dd",{className:"tabular-nums text-muted-foreground",children:p.nextAttemptAt?Xn(p.nextAttemptAt):"—"})]})]}),x.jsx("div",{className:"mt-6",children:x.jsx(Es,{title:`Attempt timeline (${g.length})`,description:"Newest first. Response bodies are truncated server-side.",children:g.length===0?x.jsx("p",{className:"text-[13px] text-muted-foreground",children:"No attempts yet — the dispatcher picks it up when it is due."}):x.jsx("ul",{className:"relative flex flex-col gap-4 before:absolute before:bottom-1 before:left-[13px] before:top-2 before:w-px before:bg-border",children:g.map(b=>x.jsx(ZH,{attempt:b},b.id))})})}),x.jsx("div",{className:"mt-6",children:x.jsx(nV,{app:n,deliveryId:e})})]})}function sV({app:n,readonly:e,selectedId:t,onOpen:i,onBack:r,onOpenMessage:o,onOpenEndpoint:a}){var E;const[u,f]=A.useState(""),[d,p]=A.useState(""),b=ji({queryKey:["endpoints",n],queryFn:()=>Fb(n),staleTime:3e4,enabled:n!==""}).data??[],v=k=>{var R;return((R=b.find(N=>N.id===k))==null?void 0:R.url)??k},S=KA({queryKey:["deliveries",n,{status:u,endpointId:d}],queryFn:({pageParam:k})=>Gb(n,{limit:pA,...u?{status:u}:{},...d?{endpoint:d}:{},...k?{before:k}:{}}),initialPageParam:"",getNextPageParam:k=>{var R;return k.length===pA?(R=k[k.length-1])==null?void 0:R.id:void 0},enabled:n!==""&&!t,refetchInterval:2e3});if(!n)return x.jsx(Kp,{});if(t)return x.jsx(iV,{app:n,id:t,readonly:e,onBack:r,onOpenMessage:o,onOpenEndpoint:a});const w=((E=S.data)==null?void 0:E.pages.flat())??[];return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Deliveries",description:"One message to one endpoint, driven through the retry schedule to a terminal state."}),x.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[x.jsx("div",{className:"inline-flex h-9 items-center rounded-md border border-input bg-secondary/40 p-0.5 text-[13px]",children:XH.map(k=>x.jsx("button",{type:"button",onClick:()=>f(k.status),className:jt("h-8 rounded-[5px] px-3 font-medium transition-colors",u===k.status?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:k.label},k.label))}),x.jsx(wv,{"aria-label":"Filter by endpoint",value:d,onValueChange:p,options:[{value:"",label:"All endpoints"},...b.map(k=>({value:k.id,label:k.url}))],className:"w-72"})]}),S.isLoading?x.jsx(Ns,{label:"Loading deliveries…"}):S.isError?x.jsx(Li,{children:"Failed to load deliveries."}):w.length===0?x.jsx(Li,{children:"No deliveries match the current filters."}):x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("ul",{className:"divide-y divide-border",children:w.map(k=>x.jsx("li",{children:x.jsxs("button",{onClick:()=>i(k.id),className:"group flex w-full items-center gap-3 px-4 py-3 text-left transition-colors hover:bg-secondary/30",children:[x.jsx(If,{status:k.status}),x.jsxs("div",{className:"min-w-0 flex-1",children:[x.jsx(Tc,{className:"block truncate",children:k.id}),x.jsxs("p",{className:"mt-0.5 truncate text-xs text-muted-foreground",children:[v(k.endpointId)," · ",k.attemptCount," attempt",k.attemptCount===1?"":"s"]})]}),x.jsx("span",{className:"whitespace-nowrap text-xs tabular-nums text-muted-foreground",title:Xn(k.updatedAt),children:Of(k.updatedAt)}),x.jsx(aa,{className:"size-4 shrink-0 text-muted-foreground/50 transition-transform group-hover:translate-x-0.5 group-hover:text-muted-foreground"})]})},k.id))})}),S.hasNextPage&&x.jsx("div",{className:"mt-4 flex justify-center",children:x.jsx(Wt,{variant:"secondary",loading:S.isFetchingNextPage,onClick:()=>S.fetchNextPage(),children:"Load more"})})]})]})}function rV(n){return n?n.name??n.email??n.id??"—":"—"}function lV(n){return n.includes("delete")?"bg-destructive/10 text-destructive border-destructive/20":n.includes("disable")||n.includes("rotate")?"bg-warning/10 text-warning border-warning/20":n.includes("create")?"bg-accent/10 text-accent border-accent/20":n.includes("retry")||n.includes("recover")||n.includes("enable")?"bg-success/10 text-success border-success/20":"bg-secondary/60 text-muted-foreground border-border"}function oV({app:n}){const e=ji({queryKey:["audit",n],queryFn:()=>D3(n),staleTime:15e3,enabled:n!==""}),t=A.useMemo(()=>e.data??[],[e.data]);return x.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-8 sm:px-6",children:[x.jsx(Hc,{title:"Audit Log",description:"A record of every control-plane change for this application. Publishes are data-plane traffic — the message log is their record."}),e.isLoading&&x.jsx(Ns,{label:"Loading audit log…"}),e.isError&&x.jsx("p",{className:"mt-8 text-center text-[13px] text-destructive",children:"Failed to load audit log"}),t.length===0&&!e.isLoading&&!e.isError&&x.jsx(Li,{children:"No audit entries yet."}),t.length>0&&x.jsx("div",{className:"mt-4 overflow-hidden rounded-xl border border-border bg-card",children:x.jsx("div",{className:"overflow-x-auto",children:x.jsxs("table",{className:"w-full border-collapse",children:[x.jsx("thead",{children:x.jsx("tr",{className:"border-b border-border",children:["Action","Subject","By","At","Message"].map(i=>x.jsx("th",{className:"whitespace-nowrap px-4 py-2.5 text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:i},i))})}),x.jsx("tbody",{className:"divide-y divide-border",children:t.map((i,r)=>x.jsxs("tr",{children:[x.jsx("td",{className:"px-4 py-3",children:x.jsx("span",{className:jt("inline-flex rounded-md border px-1.5 py-0.5 text-[11px] font-medium",lV(i.action)),children:i.action})}),x.jsx("td",{className:"px-4 py-3 font-mono text-[12px] text-muted-foreground",children:i.subjectId??"—"}),x.jsx("td",{className:"px-4 py-3 text-[12px] text-muted-foreground",children:rV(i.by)}),x.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-[12px] tabular-nums text-muted-foreground",children:Xn(i.at)}),x.jsx("td",{className:"max-w-[240px] px-4 py-3 text-[12px] text-muted-foreground",children:x.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap",children:i.message??"—"})})]},`${i.at}-${r}`))})]})})})]})}const aV=[{path:"/",label:"Overview",match:n=>n==="/",adminOnly:!0},{path:"/endpoints",label:"Endpoints",match:n=>n.startsWith("/endpoints")},{path:"/event-types",label:"Event Types",match:n=>n.startsWith("/event-types")},{path:"/messages",label:"Messages",match:n=>n.startsWith("/messages")},{path:"/deliveries",label:"Deliveries",match:n=>n.startsWith("/deliveries")},{path:"/audit",label:"Audit",match:n=>n.startsWith("/audit"),adminOnly:!0}];function cV(){return window.__WEBHOOKS_CONFIG__??{}}function uV({locationHook:n,base:e="",logoUrl:t,initialApplicationKey:i}){return x.jsx(tE,{hook:n??iE,base:e,children:x.jsx(fV,{logoUrl:t,initialApplicationKey:i})})}function fV({logoUrl:n,initialApplicationKey:e}){var j,X,J;const t=cV(),i=ua(),r=io(),[o,a]=JA(),[u,f]=ED(),p=ji({queryKey:["config"],queryFn:h3,staleTime:6e4}).data??t,g=(p==null?void 0:p.readonly)??!1,b=(p==null?void 0:p.portal)??!1,v=b?((X=(j=p==null?void 0:p.principal)==null?void 0:j.id)==null?void 0:X.replace(/^portal:/,""))??"":null,S=(p==null?void 0:p.title)||"@xtandard/webhooks",w=n??(p==null?void 0:p.logoUrl),k=ji({queryKey:["applications"],queryFn:d3,staleTime:6e4,enabled:!b}).data??[],R=v??(u.get("app")||e||((J=k[0])==null?void 0:J.key)||""),N=u.toString(),T=V=>{KC()&&a(N?`${V}?${N}`:V)},B=V=>{KC()&&f(K=>{const ae=new URLSearchParams(K);return ae.set("app",V),ae},{replace:!1})},L=Yi({mutationFn:V=>p3({key:V}),onSuccess:V=>{r.invalidateQueries({queryKey:["applications"]}),B(V.key),i.add("success",`Application "${V.key}" created`)},onError:V=>i.add("error",V instanceof Tf?V.body.error:"Failed to create application")}),D=aV.filter(V=>!b||!V.adminOnly);return x.jsxs("div",{className:"flex flex-col h-screen overflow-hidden bg-background",children:[x.jsxs("header",{className:"sticky top-0 z-40 border-b border-border bg-background/80 backdrop-blur",children:[x.jsxs("div",{className:"mx-auto flex h-14 max-w-6xl items-center gap-3 px-4 sm:px-6",children:[x.jsx("div",{className:"flex items-center gap-2 shrink-0",children:w?x.jsx("img",{src:w,alt:S,className:"h-7 max-w-[320px] object-contain"}):x.jsx("span",{className:"text-sm font-semibold tracking-tight",children:S})}),b?x.jsxs(x.Fragment,{children:[x.jsx("span",{className:"text-border select-none",children:"/"}),x.jsx("span",{className:"font-mono text-[13px] text-muted-foreground",children:R})]}):x.jsxs(x.Fragment,{children:[x.jsx("span",{className:"text-border select-none",children:"/"}),x.jsx(q5,{value:R,options:k.map(V=>V.key),onSelect:B,onCreate:V=>L.mutate(V),disabled:g,"aria-label":"Application",placeholder:"Application",createLabel:V=>`Create application "${V}"`,className:"w-48"})]}),x.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[g&&x.jsxs("span",{className:"flex items-center gap-1 rounded-md border border-warning/30 bg-warning/10 px-2 py-0.5 text-xs font-medium text-warning",children:[x.jsx(FD,{className:"size-3"}),"Read-only"]}),b&&x.jsx("span",{className:"rounded-md border border-accent/30 bg-accent/10 px-2 py-0.5 text-xs font-medium text-accent",children:"Portal"}),x.jsx(Lj,{})]})]}),x.jsx("nav",{className:"mx-auto flex max-w-6xl items-center gap-1 overflow-x-auto px-2 sm:px-4","aria-label":"Main navigation",children:D.map(({path:V,label:K,match:ae})=>x.jsx("button",{onClick:()=>T(V),className:jt("whitespace-nowrap px-3 py-2.5 text-[13px] font-medium transition-colors",ae(o)?"relative text-foreground after:absolute after:inset-x-3 after:-bottom-px after:h-0.5 after:rounded-full after:bg-foreground":"text-muted-foreground hover:text-foreground"),children:K},V))})]}),x.jsx("main",{className:"flex-1 overflow-y-auto overflow-x-hidden",children:x.jsxs(RD,{children:[x.jsx(Xa,{path:"/endpoints/:id?",children:V=>x.jsx(YC,{app:R,readonly:g,selectedId:V.id,onOpen:K=>T(`/endpoints/${encodeURIComponent(K)}`),onBack:()=>T("/endpoints"),onOpenDelivery:K=>T(`/deliveries/${encodeURIComponent(K)}`)})}),x.jsx(Xa,{path:"/event-types/:name?",children:V=>x.jsx(QH,{readonly:g||b,portal:b,selectedName:V.name,onOpen:K=>T(`/event-types/${encodeURIComponent(K)}`),onBack:()=>T("/event-types")})}),x.jsx(Xa,{path:"/messages/:id?",children:V=>x.jsx(WH,{app:R,selectedId:V.id,onOpen:K=>T(`/messages/${encodeURIComponent(K)}`),onBack:()=>T("/messages"),onOpenDelivery:K=>T(`/deliveries/${encodeURIComponent(K)}`)})}),x.jsx(Xa,{path:"/deliveries/:id?",children:V=>x.jsx(sV,{app:R,readonly:g,selectedId:V.id,onOpen:K=>T(`/deliveries/${encodeURIComponent(K)}`),onBack:()=>T("/deliveries"),onOpenMessage:K=>T(`/messages/${encodeURIComponent(K)}`),onOpenEndpoint:K=>T(`/endpoints/${encodeURIComponent(K)}`)})}),!b&&x.jsx(Xa,{path:"/audit",children:x.jsx(oV,{app:R})}),x.jsx(Xa,{children:b?x.jsx(YC,{app:R,readonly:g,selectedId:void 0,onOpen:V=>T(`/endpoints/${encodeURIComponent(V)}`),onBack:()=>T("/endpoints"),onOpenDelivery:V=>T(`/deliveries/${encodeURIComponent(V)}`)}):x.jsx(Mz,{app:R,onOpenDelivery:V=>T(`/deliveries/${encodeURIComponent(V)}`),onCreateEndpoint:()=>T("/endpoints")})})]})})]})}jj();const mA=new URLSearchParams(window.location.search).get("token");mA&&f3(mA);const hV=new rD({defaultOptions:{queries:{retry:1,refetchOnWindowFocus:!1}}}),lO=document.getElementById("root");if(!lO)throw new Error("Root element not found");var RA;const dV=(((RA=window.__WEBHOOKS_CONFIG__)==null?void 0:RA.basePath)??"").replace(/\/$/,"");SN.createRoot(lO).render(x.jsx(Nb.StrictMode,{children:x.jsx(lD,{client:hV,children:x.jsx(Oj,{children:x.jsx(uV,{locationHook:NA,base:dV})})})}));
|